@bamboocss/preset-open-props 1.11.1 → 1.11.3

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/index.cjs ADDED
@@ -0,0 +1,205 @@
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ //#region \0rolldown/runtime.js
6
+ var __create = Object.create;
7
+ var __defProp = Object.defineProperty;
8
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
+ var __getOwnPropNames = Object.getOwnPropertyNames;
10
+ var __getProtoOf = Object.getPrototypeOf;
11
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
14
+ key = keys[i];
15
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: ((k) => from[k]).bind(null, key),
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+ //#endregion
27
+ let open_props_src_animations = require("open-props/src/animations");
28
+ open_props_src_animations = __toESM(open_props_src_animations);
29
+ let open_props_src_easing = require("open-props/src/easing");
30
+ open_props_src_easing = __toESM(open_props_src_easing);
31
+ let css = require("css");
32
+ css = __toESM(css);
33
+ let open_props_src_colors = require("open-props/src/colors");
34
+ open_props_src_colors = __toESM(open_props_src_colors);
35
+ let open_props_src_colors_hsl = require("open-props/src/colors-hsl");
36
+ open_props_src_colors_hsl = __toESM(open_props_src_colors_hsl);
37
+ let open_props_src_zindex = require("open-props/src/zindex");
38
+ open_props_src_zindex = __toESM(open_props_src_zindex);
39
+ let open_props_src_svg = require("open-props/src/svg");
40
+ open_props_src_svg = __toESM(open_props_src_svg);
41
+ let open_props_src_gradients = require("open-props/src/gradients");
42
+ open_props_src_gradients = __toESM(open_props_src_gradients);
43
+ let open_props_src_borders = require("open-props/src/borders");
44
+ open_props_src_borders = __toESM(open_props_src_borders);
45
+ let open_props_src_shadows = require("open-props/src/shadows");
46
+ open_props_src_shadows = __toESM(open_props_src_shadows);
47
+ let open_props_src_sizes = require("open-props/src/sizes");
48
+ open_props_src_sizes = __toESM(open_props_src_sizes);
49
+ let open_props_src_fonts = require("open-props/src/fonts");
50
+ open_props_src_fonts = __toESM(open_props_src_fonts);
51
+ let open_props_src_masks_corner_cuts = require("open-props/src/masks.corner-cuts");
52
+ open_props_src_masks_corner_cuts = __toESM(open_props_src_masks_corner_cuts);
53
+ let open_props_src_masks_edges = require("open-props/src/masks.edges");
54
+ open_props_src_masks_edges = __toESM(open_props_src_masks_edges);
55
+ //#region src/utils.ts
56
+ const camelize = (text) => {
57
+ return text.replace(/[-]+(.)?/g, (_, c) => c ? c.toUpperCase() : "").toLowerCase().replace(/^./, (match) => match.toLowerCase());
58
+ };
59
+ const transformOpenPropsObj = (obj, keyTransform = camelize, valueTransform = (text) => text) => Object.fromEntries(Object.entries(obj).map(([key, value]) => [keyTransform(key), { value: valueTransform(value) }]));
60
+ const cssKeyframesToObj = (_css) => {
61
+ const stylesheet = css.default.parse(_css).stylesheet;
62
+ if (!stylesheet) return {};
63
+ function isKeyframe(rule) {
64
+ return "keyframes" in rule && rule.type === "keyframes";
65
+ }
66
+ const rule = stylesheet.rules[0];
67
+ if (!isKeyframe(rule) || !rule.keyframes) return {};
68
+ return rule.keyframes.map((keyframe) => {
69
+ const key = keyframe.values.join(", ");
70
+ const value = keyframe.declarations?.map((decl) => ({ [decl.property]: decl.value })).reduce((acc, nxt) => Object.assign({}, acc, nxt), {});
71
+ return { [key]: value };
72
+ }).reduce((acc, nxt) => Object.assign({}, acc, nxt), {});
73
+ };
74
+ //#endregion
75
+ //#region src/keyframes.ts
76
+ const easings = transformOpenPropsObj(open_props_src_easing.default, (key) => key.replace("--ease-", ""), (value) => value.replace(/var\(--ease-([^)]+)\)/g, "{easings.$1}"));
77
+ const _keyframes = Object.entries(open_props_src_animations.default).filter(([key]) => key.includes("@"));
78
+ const keyframes = _keyframes.reduce((acc, [_key, value]) => {
79
+ const key = _key.replace(/--animation-(.*?)-@(.*)/, "$1");
80
+ const suffix = _key.includes("media:dark") ? "-dark" : "";
81
+ return Object.assign({}, acc, { [key + suffix]: cssKeyframesToObj(value) });
82
+ }, {});
83
+ const animations = Object.entries(open_props_src_animations.default).filter(([key]) => !key.includes("@")).reduce((acc, [key, value]) => Object.assign({}, acc, { [key.replace("--animation-", "")]: { value: value.replace(/var\(--ease-([^)]+)\)/g, "{easings.$1}") } }), {});
84
+ const semanticAnimations = _keyframes.filter(([key]) => key.includes("media:dark")).reduce((acc, [_key]) => {
85
+ const key = _key.replace(/--animation-(.*?)-@(.*)/, "$1");
86
+ const value = animations[key].value;
87
+ return Object.assign({}, acc, { [key]: { value: { _dark: value.replace(key, key + "-dark") } } });
88
+ }, {});
89
+ //#endregion
90
+ //#region src/breakpoints.ts
91
+ const breakpoints = {
92
+ xxs: "240px",
93
+ xs: "360px",
94
+ sm: "480px",
95
+ md: "768px",
96
+ lg: "1024px",
97
+ xl: "1440px",
98
+ xxl: "1920px"
99
+ };
100
+ //#endregion
101
+ //#region src/colors.ts
102
+ const base = transformOpenPropsObj(open_props_src_colors.default);
103
+ const hsl = transformOpenPropsObj(open_props_src_colors_hsl.default);
104
+ const colors = Object.assign({}, base, hsl);
105
+ //#endregion
106
+ //#region src/zIndex.ts
107
+ const zIndex = transformOpenPropsObj(open_props_src_zindex.default);
108
+ //#endregion
109
+ //#region src/assets.ts
110
+ const assets = transformOpenPropsObj(open_props_src_svg.default);
111
+ //#endregion
112
+ //#region src/gradients.ts
113
+ const noiseFilters = Object.fromEntries(Object.entries(open_props_src_gradients.default).filter(([key]) => key.includes("-filter-")).map(([key, value]) => [camelize(key), value]));
114
+ const gradients = Object.fromEntries(Object.entries(open_props_src_gradients.default).filter(([key]) => !key.includes("-filter-")).map(([key, value]) => [camelize(key.replace("--gradient-", "")), { value }]));
115
+ //#endregion
116
+ //#region src/borders.ts
117
+ const borderWidths = Object.fromEntries(Object.entries(open_props_src_borders.default).filter(([key]) => key.includes("-size-")).map(([key, value]) => [key.replace("--border-size-", ""), { value }]));
118
+ const radii = Object.fromEntries(Object.entries(open_props_src_borders.default).filter(([key]) => !key.includes("-size-")).map(([key, value]) => [key.replace("--radius-", ""), { value: value.replace(/var\(--radius-([^)]+)\)/g, "{radii.$1}") }]));
119
+ //#endregion
120
+ //#region src/shadows.ts
121
+ const _shadows = Object.entries(open_props_src_shadows.default).filter(([key]) => /--(shadow|inner-shadow)-\d+/.test(key));
122
+ const _shadow_vars = Object.keys(open_props_src_shadows.default).filter((key) => !/--(shadow|inner-shadow)-\d+/.test(key) && !key.includes("media:dark"));
123
+ const shadows = Object.fromEntries(_shadows.map(([key, _value]) => {
124
+ const value = _shadow_vars.reduce((result, str) => {
125
+ return result.replaceAll(`var(${str})`, open_props_src_shadows.default[str]);
126
+ }, _value);
127
+ return [camelize(key.replace("-shadow-", "")), { value }];
128
+ }));
129
+ const semanticShadows = Object.fromEntries(_shadows.map(([key, _value]) => {
130
+ const value = _shadow_vars.reduce((result, str) => {
131
+ return result.replaceAll(`var(${str})`, open_props_src_shadows.default[str + "-@media:dark"]);
132
+ }, _value);
133
+ return [camelize(key.replace("-shadow-", "")), { value: { _dark: value } }];
134
+ }));
135
+ //#endregion
136
+ //#region src/sizes.ts
137
+ const spacing = transformOpenPropsObj(open_props_src_sizes.default, (key) => key.replace("--size-", ""));
138
+ const sizes = spacing;
139
+ //#endregion
140
+ //#region src/typography.ts
141
+ const transformFonts = (_v) => {
142
+ const v = `--font-${_v}-`;
143
+ return Object.fromEntries(Object.entries(open_props_src_fonts.default).filter(([key]) => key.startsWith(v)).map(([key, value]) => [key.replace(v, ""), { value }]));
144
+ };
145
+ const fontWeights = transformFonts("weight");
146
+ const lineHeights = transformFonts("lineheight");
147
+ const letterSpacings = transformFonts("letterspacing");
148
+ const fontSizes = transformFonts("size");
149
+ const fonts = Object.fromEntries([
150
+ "sans",
151
+ "serif",
152
+ "mono"
153
+ ].map((v) => [v, { value: open_props_src_fonts.default[`--font-${v}`] }]));
154
+ //#endregion
155
+ //#region src/tokens.ts
156
+ const defineTokens = (v) => v;
157
+ const tokens = defineTokens({
158
+ borderWidths,
159
+ radii,
160
+ easings,
161
+ zIndex,
162
+ letterSpacings,
163
+ fonts,
164
+ lineHeights,
165
+ fontWeights,
166
+ fontSizes,
167
+ shadows,
168
+ assets,
169
+ gradients,
170
+ colors,
171
+ spacing,
172
+ sizes,
173
+ animations
174
+ });
175
+ const utilities = {
176
+ WebkitMask: {
177
+ values: Object.fromEntries(Object.entries(Object.assign({}, open_props_src_masks_corner_cuts.default, open_props_src_masks_edges.default)).map(([key, value]) => [camelize(key.replace("--mask-", "")), value])),
178
+ transform(value) {
179
+ return { WebkitMask: value };
180
+ }
181
+ },
182
+ filter: {
183
+ className: "filter",
184
+ values: noiseFilters
185
+ }
186
+ };
187
+ //#endregion
188
+ //#region src/index.ts
189
+ const definePreset = (config) => config;
190
+ const preset = definePreset({
191
+ name: "@bamboocss/open-props",
192
+ theme: {
193
+ keyframes,
194
+ tokens,
195
+ semanticTokens: {
196
+ animations: semanticAnimations,
197
+ shadows: semanticShadows
198
+ },
199
+ breakpoints
200
+ },
201
+ utilities
202
+ });
203
+ //#endregion
204
+ exports.default = preset;
205
+ exports.preset = preset;
@@ -0,0 +1,107 @@
1
+ //#region src/index.d.ts
2
+ declare const preset: {
3
+ name: string;
4
+ theme: {
5
+ keyframes: {};
6
+ tokens: {
7
+ borderWidths: {
8
+ [k: string]: {
9
+ value: string;
10
+ };
11
+ };
12
+ radii: {
13
+ [k: string]: {
14
+ value: string;
15
+ };
16
+ };
17
+ easings: {
18
+ [k: string]: {
19
+ value: string;
20
+ };
21
+ };
22
+ zIndex: {
23
+ [k: string]: {
24
+ value: string;
25
+ };
26
+ };
27
+ letterSpacings: {
28
+ [k: string]: {
29
+ value: string;
30
+ };
31
+ };
32
+ fonts: {
33
+ [k: string]: {
34
+ value: string;
35
+ };
36
+ };
37
+ lineHeights: {
38
+ [k: string]: {
39
+ value: string;
40
+ };
41
+ };
42
+ fontWeights: {
43
+ [k: string]: {
44
+ value: string;
45
+ };
46
+ };
47
+ fontSizes: {
48
+ [k: string]: {
49
+ value: string;
50
+ };
51
+ };
52
+ shadows: {
53
+ [k: string]: {
54
+ value: string;
55
+ };
56
+ };
57
+ assets: {
58
+ [k: string]: {
59
+ value: string;
60
+ };
61
+ };
62
+ gradients: {
63
+ [k: string]: {
64
+ value: string;
65
+ };
66
+ };
67
+ colors: {
68
+ [k: string]: {
69
+ value: string;
70
+ };
71
+ };
72
+ spacing: {
73
+ [k: string]: {
74
+ value: string;
75
+ };
76
+ };
77
+ sizes: {
78
+ [k: string]: {
79
+ value: string;
80
+ };
81
+ };
82
+ animations: import("@bamboocss/types").Dict;
83
+ };
84
+ semanticTokens: {
85
+ animations: {};
86
+ shadows: {
87
+ [k: string]: {
88
+ value: {
89
+ _dark: string;
90
+ };
91
+ };
92
+ };
93
+ };
94
+ breakpoints: {
95
+ xxs: string;
96
+ xs: string;
97
+ sm: string;
98
+ md: string;
99
+ lg: string;
100
+ xl: string;
101
+ xxl: string;
102
+ };
103
+ };
104
+ utilities: import("@bamboocss/types").UtilityConfig;
105
+ };
106
+ //#endregion
107
+ export { preset as default, preset };
@@ -0,0 +1,107 @@
1
+ //#region src/index.d.ts
2
+ declare const preset: {
3
+ name: string;
4
+ theme: {
5
+ keyframes: {};
6
+ tokens: {
7
+ borderWidths: {
8
+ [k: string]: {
9
+ value: string;
10
+ };
11
+ };
12
+ radii: {
13
+ [k: string]: {
14
+ value: string;
15
+ };
16
+ };
17
+ easings: {
18
+ [k: string]: {
19
+ value: string;
20
+ };
21
+ };
22
+ zIndex: {
23
+ [k: string]: {
24
+ value: string;
25
+ };
26
+ };
27
+ letterSpacings: {
28
+ [k: string]: {
29
+ value: string;
30
+ };
31
+ };
32
+ fonts: {
33
+ [k: string]: {
34
+ value: string;
35
+ };
36
+ };
37
+ lineHeights: {
38
+ [k: string]: {
39
+ value: string;
40
+ };
41
+ };
42
+ fontWeights: {
43
+ [k: string]: {
44
+ value: string;
45
+ };
46
+ };
47
+ fontSizes: {
48
+ [k: string]: {
49
+ value: string;
50
+ };
51
+ };
52
+ shadows: {
53
+ [k: string]: {
54
+ value: string;
55
+ };
56
+ };
57
+ assets: {
58
+ [k: string]: {
59
+ value: string;
60
+ };
61
+ };
62
+ gradients: {
63
+ [k: string]: {
64
+ value: string;
65
+ };
66
+ };
67
+ colors: {
68
+ [k: string]: {
69
+ value: string;
70
+ };
71
+ };
72
+ spacing: {
73
+ [k: string]: {
74
+ value: string;
75
+ };
76
+ };
77
+ sizes: {
78
+ [k: string]: {
79
+ value: string;
80
+ };
81
+ };
82
+ animations: import("@bamboocss/types").Dict;
83
+ };
84
+ semanticTokens: {
85
+ animations: {};
86
+ shadows: {
87
+ [k: string]: {
88
+ value: {
89
+ _dark: string;
90
+ };
91
+ };
92
+ };
93
+ };
94
+ breakpoints: {
95
+ xxs: string;
96
+ xs: string;
97
+ sm: string;
98
+ md: string;
99
+ lg: string;
100
+ xl: string;
101
+ xxl: string;
102
+ };
103
+ };
104
+ utilities: import("@bamboocss/types").UtilityConfig;
105
+ };
106
+ //#endregion
107
+ export { preset as default, preset };
package/dist/index.mjs CHANGED
@@ -1,221 +1,164 @@
1
- // src/keyframes.ts
2
1
  import Animations from "open-props/src/animations";
3
2
  import Easings from "open-props/src/easing";
4
-
5
- // src/utils.ts
6
3
  import css from "css";
7
- var camelize = (text) => {
8
- return text.replace(/[-]+(.)?/g, (_, c) => c ? c.toUpperCase() : "").toLowerCase().replace(/^./, (match) => match.toLowerCase());
9
- };
10
- var transformOpenPropsObj = (obj, keyTransform = camelize, valueTransform = (text) => text) => Object.fromEntries(Object.entries(obj).map(([key, value]) => [keyTransform(key), { value: valueTransform(value) }]));
11
- var cssKeyframesToObj = (_css) => {
12
- const parsedCss = css.parse(_css);
13
- const stylesheet = parsedCss.stylesheet;
14
- if (!stylesheet) return {};
15
- function isKeyframe(rule2) {
16
- return "keyframes" in rule2 && rule2.type === "keyframes";
17
- }
18
- const rule = stylesheet.rules[0];
19
- if (!isKeyframe(rule) || !rule.keyframes) return {};
20
- return rule.keyframes.map((keyframe) => {
21
- const key = keyframe.values.join(", ");
22
- const value = keyframe.declarations?.map((decl) => ({
23
- [decl.property]: decl.value
24
- })).reduce((acc, nxt) => Object.assign({}, acc, nxt), {});
25
- return { [key]: value };
26
- }).reduce((acc, nxt) => Object.assign({}, acc, nxt), {});
27
- };
28
-
29
- // src/keyframes.ts
30
- var easings = transformOpenPropsObj(
31
- Easings,
32
- (key) => key.replace("--ease-", ""),
33
- (value) => value.replace(/var\(--ease-([^)]+)\)/g, "{easings.$1}")
34
- );
35
- var _keyframes = Object.entries(Animations).filter(([key]) => key.includes("@"));
36
- var keyframes = _keyframes.reduce((acc, [_key, value]) => {
37
- const key = _key.replace(/--animation-(.*?)-@(.*)/, "$1");
38
- const suffix = _key.includes("media:dark") ? "-dark" : "";
39
- return Object.assign({}, acc, {
40
- [key + suffix]: cssKeyframesToObj(value)
41
- });
42
- }, {});
43
- var animations = Object.entries(Animations).filter(([key]) => !key.includes("@")).reduce(
44
- (acc, [key, value]) => Object.assign({}, acc, {
45
- [key.replace("--animation-", "")]: { value: value.replace(/var\(--ease-([^)]+)\)/g, "{easings.$1}") }
46
- }),
47
- {}
48
- );
49
- var semanticAnimations = _keyframes.filter(([key]) => key.includes("media:dark")).reduce((acc, [_key]) => {
50
- const key = _key.replace(/--animation-(.*?)-@(.*)/, "$1");
51
- const value = animations[key].value;
52
- return Object.assign({}, acc, {
53
- [key]: { value: { _dark: value.replace(key, key + "-dark") } }
54
- });
55
- }, {});
56
-
57
- // src/breakpoints.ts
58
- var breakpoints = {
59
- xxs: "240px",
60
- xs: "360px",
61
- sm: "480px",
62
- md: "768px",
63
- lg: "1024px",
64
- xl: "1440px",
65
- xxl: "1920px"
66
- };
67
-
68
- // src/colors.ts
69
4
  import Colors from "open-props/src/colors";
70
5
  import ColorsHSL from "open-props/src/colors-hsl";
71
- var base = transformOpenPropsObj(Colors);
72
- var hsl = transformOpenPropsObj(ColorsHSL);
73
- var colors = Object.assign({}, base, hsl);
74
-
75
- // src/zIndex.ts
76
6
  import zindex from "open-props/src/zindex";
77
- var zIndex = transformOpenPropsObj(zindex);
78
-
79
- // src/assets.ts
80
7
  import svg from "open-props/src/svg";
81
- var assets = transformOpenPropsObj(svg);
82
-
83
- // src/gradients.ts
84
8
  import Gradients from "open-props/src/gradients";
85
- var noiseFilters = Object.fromEntries(
86
- Object.entries(Gradients).filter(([key]) => key.includes("-filter-")).map(([key, value]) => [camelize(key), value])
87
- );
88
- var gradients = Object.fromEntries(
89
- Object.entries(Gradients).filter(([key]) => !key.includes("-filter-")).map(([key, value]) => [camelize(key.replace("--gradient-", "")), { value }])
90
- );
91
-
92
- // src/borders.ts
93
9
  import Borders from "open-props/src/borders";
94
- var borderWidths = Object.fromEntries(
95
- Object.entries(Borders).filter(([key]) => key.includes("-size-")).map(([key, value]) => [key.replace("--border-size-", ""), { value }])
96
- );
97
- var radii = Object.fromEntries(
98
- Object.entries(Borders).filter(([key]) => !key.includes("-size-")).map(([key, value]) => [
99
- key.replace("--radius-", ""),
100
- { value: value.replace(/var\(--radius-([^)]+)\)/g, "{radii.$1}") }
101
- ])
102
- );
103
-
104
- // src/shadows.ts
105
10
  import Shadows from "open-props/src/shadows";
106
- var _shadows = Object.entries(Shadows).filter(([key]) => /--(shadow|inner-shadow)-\d+/.test(key));
107
- var _shadow_vars = Object.keys(Shadows).filter(
108
- (key) => !/--(shadow|inner-shadow)-\d+/.test(key) && !key.includes("media:dark")
109
- );
110
- var shadows = Object.fromEntries(
111
- _shadows.map(([key, _value]) => {
112
- const value = _shadow_vars.reduce((result, str) => {
113
- return result.replaceAll(`var(${str})`, Shadows[str]);
114
- }, _value);
115
- return [
116
- camelize(key.replace("-shadow-", "")),
117
- {
118
- value
119
- }
120
- ];
121
- })
122
- );
123
- var semanticShadows = Object.fromEntries(
124
- _shadows.map(([key, _value]) => {
125
- const value = _shadow_vars.reduce((result, str) => {
126
- return result.replaceAll(`var(${str})`, Shadows[str + "-@media:dark"]);
127
- }, _value);
128
- return [
129
- camelize(key.replace("-shadow-", "")),
130
- {
131
- value: { _dark: value }
132
- }
133
- ];
134
- })
135
- );
136
-
137
- // src/sizes.ts
138
11
  import Sizes from "open-props/src/sizes";
139
- var spacing = transformOpenPropsObj(Sizes, (key) => key.replace("--size-", ""));
140
- var sizes = spacing;
141
-
142
- // src/typography.ts
143
12
  import Fonts from "open-props/src/fonts";
144
- var transformFonts = (_v) => {
145
- const v = `--font-${_v}-`;
146
- return Object.fromEntries(
147
- Object.entries(Fonts).filter(([key]) => key.startsWith(v)).map(([key, value]) => [key.replace(v, ""), { value }])
148
- );
149
- };
150
- var fontWeights = transformFonts("weight");
151
- var lineHeights = transformFonts("lineheight");
152
- var letterSpacings = transformFonts("letterspacing");
153
- var fontSizes = transformFonts("size");
154
- var _fonts = ["sans", "serif", "mono"];
155
- var fonts = Object.fromEntries(_fonts.map((v) => [v, { value: Fonts[`--font-${v}`] }]));
156
-
157
- // src/tokens.ts
158
- var defineTokens = (v) => v;
159
- var tokens = defineTokens({
160
- borderWidths,
161
- radii,
162
- easings,
163
- zIndex,
164
- letterSpacings,
165
- fonts,
166
- lineHeights,
167
- fontWeights,
168
- fontSizes,
169
- shadows,
170
- assets,
171
- gradients,
172
- colors,
173
- spacing,
174
- sizes,
175
- animations
176
- });
177
-
178
- // src/utilities.ts
179
13
  import MaskCornerCuts from "open-props/src/masks.corner-cuts";
180
14
  import MaskEdges from "open-props/src/masks.edges";
181
- var masks = Object.fromEntries(
182
- Object.entries(Object.assign({}, MaskCornerCuts, MaskEdges)).map(([key, value]) => [
183
- camelize(key.replace("--mask-", "")),
184
- value
185
- ])
186
- );
187
- var utilities = {
188
- WebkitMask: {
189
- values: masks,
190
- transform(value) {
191
- return {
192
- WebkitMask: value
193
- };
194
- }
195
- },
196
- filter: {
197
- className: "filter",
198
- values: noiseFilters
199
- }
15
+ //#region src/utils.ts
16
+ const camelize = (text) => {
17
+ return text.replace(/[-]+(.)?/g, (_, c) => c ? c.toUpperCase() : "").toLowerCase().replace(/^./, (match) => match.toLowerCase());
200
18
  };
201
-
202
- // src/index.ts
203
- var definePreset = (config) => config;
204
- var preset = definePreset({
205
- name: "@bamboocss/open-props",
206
- theme: {
207
- keyframes,
208
- tokens,
209
- semanticTokens: {
210
- animations: semanticAnimations,
211
- shadows: semanticShadows
212
- },
213
- breakpoints
214
- },
215
- utilities
19
+ const transformOpenPropsObj = (obj, keyTransform = camelize, valueTransform = (text) => text) => Object.fromEntries(Object.entries(obj).map(([key, value]) => [keyTransform(key), { value: valueTransform(value) }]));
20
+ const cssKeyframesToObj = (_css) => {
21
+ const stylesheet = css.parse(_css).stylesheet;
22
+ if (!stylesheet) return {};
23
+ function isKeyframe(rule) {
24
+ return "keyframes" in rule && rule.type === "keyframes";
25
+ }
26
+ const rule = stylesheet.rules[0];
27
+ if (!isKeyframe(rule) || !rule.keyframes) return {};
28
+ return rule.keyframes.map((keyframe) => {
29
+ const key = keyframe.values.join(", ");
30
+ const value = keyframe.declarations?.map((decl) => ({ [decl.property]: decl.value })).reduce((acc, nxt) => Object.assign({}, acc, nxt), {});
31
+ return { [key]: value };
32
+ }).reduce((acc, nxt) => Object.assign({}, acc, nxt), {});
33
+ };
34
+ //#endregion
35
+ //#region src/keyframes.ts
36
+ const easings = transformOpenPropsObj(Easings, (key) => key.replace("--ease-", ""), (value) => value.replace(/var\(--ease-([^)]+)\)/g, "{easings.$1}"));
37
+ const _keyframes = Object.entries(Animations).filter(([key]) => key.includes("@"));
38
+ const keyframes = _keyframes.reduce((acc, [_key, value]) => {
39
+ const key = _key.replace(/--animation-(.*?)-@(.*)/, "$1");
40
+ const suffix = _key.includes("media:dark") ? "-dark" : "";
41
+ return Object.assign({}, acc, { [key + suffix]: cssKeyframesToObj(value) });
42
+ }, {});
43
+ const animations = Object.entries(Animations).filter(([key]) => !key.includes("@")).reduce((acc, [key, value]) => Object.assign({}, acc, { [key.replace("--animation-", "")]: { value: value.replace(/var\(--ease-([^)]+)\)/g, "{easings.$1}") } }), {});
44
+ const semanticAnimations = _keyframes.filter(([key]) => key.includes("media:dark")).reduce((acc, [_key]) => {
45
+ const key = _key.replace(/--animation-(.*?)-@(.*)/, "$1");
46
+ const value = animations[key].value;
47
+ return Object.assign({}, acc, { [key]: { value: { _dark: value.replace(key, key + "-dark") } } });
48
+ }, {});
49
+ //#endregion
50
+ //#region src/breakpoints.ts
51
+ const breakpoints = {
52
+ xxs: "240px",
53
+ xs: "360px",
54
+ sm: "480px",
55
+ md: "768px",
56
+ lg: "1024px",
57
+ xl: "1440px",
58
+ xxl: "1920px"
59
+ };
60
+ //#endregion
61
+ //#region src/colors.ts
62
+ const base = transformOpenPropsObj(Colors);
63
+ const hsl = transformOpenPropsObj(ColorsHSL);
64
+ const colors = Object.assign({}, base, hsl);
65
+ //#endregion
66
+ //#region src/zIndex.ts
67
+ const zIndex = transformOpenPropsObj(zindex);
68
+ //#endregion
69
+ //#region src/assets.ts
70
+ const assets = transformOpenPropsObj(svg);
71
+ //#endregion
72
+ //#region src/gradients.ts
73
+ const noiseFilters = Object.fromEntries(Object.entries(Gradients).filter(([key]) => key.includes("-filter-")).map(([key, value]) => [camelize(key), value]));
74
+ const gradients = Object.fromEntries(Object.entries(Gradients).filter(([key]) => !key.includes("-filter-")).map(([key, value]) => [camelize(key.replace("--gradient-", "")), { value }]));
75
+ //#endregion
76
+ //#region src/borders.ts
77
+ const borderWidths = Object.fromEntries(Object.entries(Borders).filter(([key]) => key.includes("-size-")).map(([key, value]) => [key.replace("--border-size-", ""), { value }]));
78
+ const radii = Object.fromEntries(Object.entries(Borders).filter(([key]) => !key.includes("-size-")).map(([key, value]) => [key.replace("--radius-", ""), { value: value.replace(/var\(--radius-([^)]+)\)/g, "{radii.$1}") }]));
79
+ //#endregion
80
+ //#region src/shadows.ts
81
+ const _shadows = Object.entries(Shadows).filter(([key]) => /--(shadow|inner-shadow)-\d+/.test(key));
82
+ const _shadow_vars = Object.keys(Shadows).filter((key) => !/--(shadow|inner-shadow)-\d+/.test(key) && !key.includes("media:dark"));
83
+ const shadows = Object.fromEntries(_shadows.map(([key, _value]) => {
84
+ const value = _shadow_vars.reduce((result, str) => {
85
+ return result.replaceAll(`var(${str})`, Shadows[str]);
86
+ }, _value);
87
+ return [camelize(key.replace("-shadow-", "")), { value }];
88
+ }));
89
+ const semanticShadows = Object.fromEntries(_shadows.map(([key, _value]) => {
90
+ const value = _shadow_vars.reduce((result, str) => {
91
+ return result.replaceAll(`var(${str})`, Shadows[str + "-@media:dark"]);
92
+ }, _value);
93
+ return [camelize(key.replace("-shadow-", "")), { value: { _dark: value } }];
94
+ }));
95
+ //#endregion
96
+ //#region src/sizes.ts
97
+ const spacing = transformOpenPropsObj(Sizes, (key) => key.replace("--size-", ""));
98
+ const sizes = spacing;
99
+ //#endregion
100
+ //#region src/typography.ts
101
+ const transformFonts = (_v) => {
102
+ const v = `--font-${_v}-`;
103
+ return Object.fromEntries(Object.entries(Fonts).filter(([key]) => key.startsWith(v)).map(([key, value]) => [key.replace(v, ""), { value }]));
104
+ };
105
+ const fontWeights = transformFonts("weight");
106
+ const lineHeights = transformFonts("lineheight");
107
+ const letterSpacings = transformFonts("letterspacing");
108
+ const fontSizes = transformFonts("size");
109
+ const fonts = Object.fromEntries([
110
+ "sans",
111
+ "serif",
112
+ "mono"
113
+ ].map((v) => [v, { value: Fonts[`--font-${v}`] }]));
114
+ //#endregion
115
+ //#region src/tokens.ts
116
+ const defineTokens = (v) => v;
117
+ const tokens = defineTokens({
118
+ borderWidths,
119
+ radii,
120
+ easings,
121
+ zIndex,
122
+ letterSpacings,
123
+ fonts,
124
+ lineHeights,
125
+ fontWeights,
126
+ fontSizes,
127
+ shadows,
128
+ assets,
129
+ gradients,
130
+ colors,
131
+ spacing,
132
+ sizes,
133
+ animations
216
134
  });
217
- var index_default = preset;
218
- export {
219
- index_default as default,
220
- preset
135
+ const utilities = {
136
+ WebkitMask: {
137
+ values: Object.fromEntries(Object.entries(Object.assign({}, MaskCornerCuts, MaskEdges)).map(([key, value]) => [camelize(key.replace("--mask-", "")), value])),
138
+ transform(value) {
139
+ return { WebkitMask: value };
140
+ }
141
+ },
142
+ filter: {
143
+ className: "filter",
144
+ values: noiseFilters
145
+ }
221
146
  };
147
+ //#endregion
148
+ //#region src/index.ts
149
+ const definePreset = (config) => config;
150
+ const preset = definePreset({
151
+ name: "@bamboocss/open-props",
152
+ theme: {
153
+ keyframes,
154
+ tokens,
155
+ semanticTokens: {
156
+ animations: semanticAnimations,
157
+ shadows: semanticShadows
158
+ },
159
+ breakpoints
160
+ },
161
+ utilities
162
+ });
163
+ //#endregion
164
+ export { preset as default, preset };
package/package.json CHANGED
@@ -1,27 +1,27 @@
1
1
  {
2
2
  "name": "@bamboocss/preset-open-props",
3
- "version": "1.11.1",
3
+ "version": "1.11.3",
4
4
  "description": "A preset for Open Props",
5
5
  "homepage": "https://bamboo-css.com",
6
6
  "license": "MIT",
7
7
  "author": "Abraham Aremu <anubra266@gmail.com>",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "git+https://github.com/chakra-ui/bamboo.git",
10
+ "url": "git+https://github.com/bamboocss/bamboo.git",
11
11
  "directory": "packages/preset-open-props"
12
12
  },
13
13
  "files": [
14
14
  "dist"
15
15
  ],
16
16
  "sideEffects": false,
17
- "main": "dist/index.js",
17
+ "main": "dist/index.cjs",
18
18
  "module": "dist/index.mjs",
19
- "types": "dist/index.d.ts",
19
+ "types": "dist/index.d.cts",
20
20
  "exports": {
21
21
  ".": {
22
22
  "source": "./src/index.ts",
23
- "types": "./dist/index.d.ts",
24
- "require": "./dist/index.js",
23
+ "types": "./dist/index.d.cts",
24
+ "require": "./dist/index.cjs",
25
25
  "import": {
26
26
  "types": "./dist/index.d.mts",
27
27
  "default": "./dist/index.mjs"
@@ -35,14 +35,14 @@
35
35
  "dependencies": {
36
36
  "css": "3.0.0",
37
37
  "open-props": "1.7.16",
38
- "@bamboocss/types": "1.11.1"
38
+ "@bamboocss/types": "1.11.3"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/css": "0.0.38"
42
42
  },
43
43
  "scripts": {
44
- "build": "tsup src/index.ts --format=esm,cjs --dts",
45
- "build-fast": "tsup src/index.ts --format=esm,cjs --no-dts",
44
+ "build": "tsdown src/index.ts --format=esm,cjs --dts",
45
+ "build-fast": "tsdown --dts=false src/index.ts --format=esm,cjs",
46
46
  "dev": "pnpm build-fast --watch"
47
47
  }
48
48
  }
package/dist/index.js DELETED
@@ -1,258 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var index_exports = {};
32
- __export(index_exports, {
33
- default: () => index_default,
34
- preset: () => preset
35
- });
36
- module.exports = __toCommonJS(index_exports);
37
-
38
- // src/keyframes.ts
39
- var import_animations = __toESM(require("open-props/src/animations"));
40
- var import_easing = __toESM(require("open-props/src/easing"));
41
-
42
- // src/utils.ts
43
- var import_css = __toESM(require("css"));
44
- var camelize = (text) => {
45
- return text.replace(/[-]+(.)?/g, (_, c) => c ? c.toUpperCase() : "").toLowerCase().replace(/^./, (match) => match.toLowerCase());
46
- };
47
- var transformOpenPropsObj = (obj, keyTransform = camelize, valueTransform = (text) => text) => Object.fromEntries(Object.entries(obj).map(([key, value]) => [keyTransform(key), { value: valueTransform(value) }]));
48
- var cssKeyframesToObj = (_css) => {
49
- const parsedCss = import_css.default.parse(_css);
50
- const stylesheet = parsedCss.stylesheet;
51
- if (!stylesheet) return {};
52
- function isKeyframe(rule2) {
53
- return "keyframes" in rule2 && rule2.type === "keyframes";
54
- }
55
- const rule = stylesheet.rules[0];
56
- if (!isKeyframe(rule) || !rule.keyframes) return {};
57
- return rule.keyframes.map((keyframe) => {
58
- const key = keyframe.values.join(", ");
59
- const value = keyframe.declarations?.map((decl) => ({
60
- [decl.property]: decl.value
61
- })).reduce((acc, nxt) => Object.assign({}, acc, nxt), {});
62
- return { [key]: value };
63
- }).reduce((acc, nxt) => Object.assign({}, acc, nxt), {});
64
- };
65
-
66
- // src/keyframes.ts
67
- var easings = transformOpenPropsObj(
68
- import_easing.default,
69
- (key) => key.replace("--ease-", ""),
70
- (value) => value.replace(/var\(--ease-([^)]+)\)/g, "{easings.$1}")
71
- );
72
- var _keyframes = Object.entries(import_animations.default).filter(([key]) => key.includes("@"));
73
- var keyframes = _keyframes.reduce((acc, [_key, value]) => {
74
- const key = _key.replace(/--animation-(.*?)-@(.*)/, "$1");
75
- const suffix = _key.includes("media:dark") ? "-dark" : "";
76
- return Object.assign({}, acc, {
77
- [key + suffix]: cssKeyframesToObj(value)
78
- });
79
- }, {});
80
- var animations = Object.entries(import_animations.default).filter(([key]) => !key.includes("@")).reduce(
81
- (acc, [key, value]) => Object.assign({}, acc, {
82
- [key.replace("--animation-", "")]: { value: value.replace(/var\(--ease-([^)]+)\)/g, "{easings.$1}") }
83
- }),
84
- {}
85
- );
86
- var semanticAnimations = _keyframes.filter(([key]) => key.includes("media:dark")).reduce((acc, [_key]) => {
87
- const key = _key.replace(/--animation-(.*?)-@(.*)/, "$1");
88
- const value = animations[key].value;
89
- return Object.assign({}, acc, {
90
- [key]: { value: { _dark: value.replace(key, key + "-dark") } }
91
- });
92
- }, {});
93
-
94
- // src/breakpoints.ts
95
- var breakpoints = {
96
- xxs: "240px",
97
- xs: "360px",
98
- sm: "480px",
99
- md: "768px",
100
- lg: "1024px",
101
- xl: "1440px",
102
- xxl: "1920px"
103
- };
104
-
105
- // src/colors.ts
106
- var import_colors = __toESM(require("open-props/src/colors"));
107
- var import_colors_hsl = __toESM(require("open-props/src/colors-hsl"));
108
- var base = transformOpenPropsObj(import_colors.default);
109
- var hsl = transformOpenPropsObj(import_colors_hsl.default);
110
- var colors = Object.assign({}, base, hsl);
111
-
112
- // src/zIndex.ts
113
- var import_zindex = __toESM(require("open-props/src/zindex"));
114
- var zIndex = transformOpenPropsObj(import_zindex.default);
115
-
116
- // src/assets.ts
117
- var import_svg = __toESM(require("open-props/src/svg"));
118
- var assets = transformOpenPropsObj(import_svg.default);
119
-
120
- // src/gradients.ts
121
- var import_gradients = __toESM(require("open-props/src/gradients"));
122
- var noiseFilters = Object.fromEntries(
123
- Object.entries(import_gradients.default).filter(([key]) => key.includes("-filter-")).map(([key, value]) => [camelize(key), value])
124
- );
125
- var gradients = Object.fromEntries(
126
- Object.entries(import_gradients.default).filter(([key]) => !key.includes("-filter-")).map(([key, value]) => [camelize(key.replace("--gradient-", "")), { value }])
127
- );
128
-
129
- // src/borders.ts
130
- var import_borders = __toESM(require("open-props/src/borders"));
131
- var borderWidths = Object.fromEntries(
132
- Object.entries(import_borders.default).filter(([key]) => key.includes("-size-")).map(([key, value]) => [key.replace("--border-size-", ""), { value }])
133
- );
134
- var radii = Object.fromEntries(
135
- Object.entries(import_borders.default).filter(([key]) => !key.includes("-size-")).map(([key, value]) => [
136
- key.replace("--radius-", ""),
137
- { value: value.replace(/var\(--radius-([^)]+)\)/g, "{radii.$1}") }
138
- ])
139
- );
140
-
141
- // src/shadows.ts
142
- var import_shadows = __toESM(require("open-props/src/shadows"));
143
- var _shadows = Object.entries(import_shadows.default).filter(([key]) => /--(shadow|inner-shadow)-\d+/.test(key));
144
- var _shadow_vars = Object.keys(import_shadows.default).filter(
145
- (key) => !/--(shadow|inner-shadow)-\d+/.test(key) && !key.includes("media:dark")
146
- );
147
- var shadows = Object.fromEntries(
148
- _shadows.map(([key, _value]) => {
149
- const value = _shadow_vars.reduce((result, str) => {
150
- return result.replaceAll(`var(${str})`, import_shadows.default[str]);
151
- }, _value);
152
- return [
153
- camelize(key.replace("-shadow-", "")),
154
- {
155
- value
156
- }
157
- ];
158
- })
159
- );
160
- var semanticShadows = Object.fromEntries(
161
- _shadows.map(([key, _value]) => {
162
- const value = _shadow_vars.reduce((result, str) => {
163
- return result.replaceAll(`var(${str})`, import_shadows.default[str + "-@media:dark"]);
164
- }, _value);
165
- return [
166
- camelize(key.replace("-shadow-", "")),
167
- {
168
- value: { _dark: value }
169
- }
170
- ];
171
- })
172
- );
173
-
174
- // src/sizes.ts
175
- var import_sizes = __toESM(require("open-props/src/sizes"));
176
- var spacing = transformOpenPropsObj(import_sizes.default, (key) => key.replace("--size-", ""));
177
- var sizes = spacing;
178
-
179
- // src/typography.ts
180
- var import_fonts = __toESM(require("open-props/src/fonts"));
181
- var transformFonts = (_v) => {
182
- const v = `--font-${_v}-`;
183
- return Object.fromEntries(
184
- Object.entries(import_fonts.default).filter(([key]) => key.startsWith(v)).map(([key, value]) => [key.replace(v, ""), { value }])
185
- );
186
- };
187
- var fontWeights = transformFonts("weight");
188
- var lineHeights = transformFonts("lineheight");
189
- var letterSpacings = transformFonts("letterspacing");
190
- var fontSizes = transformFonts("size");
191
- var _fonts = ["sans", "serif", "mono"];
192
- var fonts = Object.fromEntries(_fonts.map((v) => [v, { value: import_fonts.default[`--font-${v}`] }]));
193
-
194
- // src/tokens.ts
195
- var defineTokens = (v) => v;
196
- var tokens = defineTokens({
197
- borderWidths,
198
- radii,
199
- easings,
200
- zIndex,
201
- letterSpacings,
202
- fonts,
203
- lineHeights,
204
- fontWeights,
205
- fontSizes,
206
- shadows,
207
- assets,
208
- gradients,
209
- colors,
210
- spacing,
211
- sizes,
212
- animations
213
- });
214
-
215
- // src/utilities.ts
216
- var import_masks = __toESM(require("open-props/src/masks.corner-cuts"));
217
- var import_masks2 = __toESM(require("open-props/src/masks.edges"));
218
- var masks = Object.fromEntries(
219
- Object.entries(Object.assign({}, import_masks.default, import_masks2.default)).map(([key, value]) => [
220
- camelize(key.replace("--mask-", "")),
221
- value
222
- ])
223
- );
224
- var utilities = {
225
- WebkitMask: {
226
- values: masks,
227
- transform(value) {
228
- return {
229
- WebkitMask: value
230
- };
231
- }
232
- },
233
- filter: {
234
- className: "filter",
235
- values: noiseFilters
236
- }
237
- };
238
-
239
- // src/index.ts
240
- var definePreset = (config) => config;
241
- var preset = definePreset({
242
- name: "@bamboocss/open-props",
243
- theme: {
244
- keyframes,
245
- tokens,
246
- semanticTokens: {
247
- animations: semanticAnimations,
248
- shadows: semanticShadows
249
- },
250
- breakpoints
251
- },
252
- utilities
253
- });
254
- var index_default = preset;
255
- // Annotate the CommonJS export names for ESM import in node:
256
- 0 && (module.exports = {
257
- preset
258
- });