@newlogic-digital/core 0.9.4 → 0.9.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/index.js +2 -1
- package/modules/Styles.js +27 -27
- package/modules/tailwind/index.cjs +13 -0
- package/modules/tailwind/index.js +13 -1
- package/package.json +3 -3
package/index.js
CHANGED
@@ -15,7 +15,7 @@ import {
|
|
15
15
|
root
|
16
16
|
} from "./modules/Core.js";
|
17
17
|
|
18
|
-
import { tailwindColors, tailwindColorsRgba, tailwindVariables, tailwindColorsAccent, tailwindColorsCurrent } from './modules/tailwind/index.js'
|
18
|
+
import { tailwindColors, tailwindColorsRgba, tailwindVariables, tailwindColorsAccent, tailwindColorsCurrent, tailwindAnimations } from './modules/tailwind/index.js'
|
19
19
|
|
20
20
|
const defineConfig = (config) => new Core().init(config);
|
21
21
|
|
@@ -26,6 +26,7 @@ export {
|
|
26
26
|
tailwindColorsRgba,
|
27
27
|
tailwindColorsAccent,
|
28
28
|
tailwindColorsCurrent,
|
29
|
+
tailwindAnimations,
|
29
30
|
Core,
|
30
31
|
Utils,
|
31
32
|
Styles,
|
package/modules/Styles.js
CHANGED
@@ -10,6 +10,32 @@ import glob from "glob";
|
|
10
10
|
import through from "through2";
|
11
11
|
import {Config, Exists, Functions, Modules, Utils, root} from "./Core.js";
|
12
12
|
|
13
|
+
const aspectRatio = () => {
|
14
|
+
return {
|
15
|
+
postcssPlugin: 'aspect-ratio',
|
16
|
+
Declaration: {
|
17
|
+
'aspect-ratio': (decl, {Rule, Declaration}) => {
|
18
|
+
const rule = decl.parent
|
19
|
+
const selector = rule.selector
|
20
|
+
const beforeRule = new Rule({selector: `${selector}:before`, raws: {after: rule.raws.after, semicolon: rule.raws.semicolon}})
|
21
|
+
const ratio = decl.value.replace(/['"]?((?:\d*\.?\d*)?)(?:\s*[:|\/]\s*)(\d*\.?\d*)['"]?/g, (match, width, height) => {
|
22
|
+
return (height / width) * 100 + '%'
|
23
|
+
})
|
24
|
+
|
25
|
+
beforeRule.append([
|
26
|
+
new Declaration({prop: 'padding-bottom', value: ratio}),
|
27
|
+
])
|
28
|
+
|
29
|
+
rule.after(beforeRule)
|
30
|
+
|
31
|
+
rule.nodes.length === 1 ? rule.remove() : decl.remove()
|
32
|
+
},
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
aspectRatio.postcss = true;
|
38
|
+
|
13
39
|
export class Styles {
|
14
40
|
get purge() {
|
15
41
|
return {
|
@@ -160,7 +186,7 @@ export class Styles {
|
|
160
186
|
}
|
161
187
|
|
162
188
|
gulp.src(`${root + Config.paths.input.styles}/${Config.styles.tailwind.basename}`)
|
163
|
-
.pipe(postcss(new Utils().postcssPlugins(Config.styles.tailwind.postcss, [tailwindcss(tailwindcssConfig), autoprefixer])))
|
189
|
+
.pipe(postcss(new Utils().postcssPlugins(Config.styles.tailwind.postcss, [tailwindcss(tailwindcssConfig), aspectRatio, autoprefixer])))
|
164
190
|
.pipe(gulpif(Config.styles.optimizations, clean()))
|
165
191
|
.pipe(gulp.dest(root + Config.paths.temp))
|
166
192
|
.on("end", resolve)
|
@@ -245,32 +271,6 @@ export class Styles {
|
|
245
271
|
});
|
246
272
|
}
|
247
273
|
|
248
|
-
const aspectRatio = () => {
|
249
|
-
return {
|
250
|
-
postcssPlugin: 'aspect-ratio',
|
251
|
-
Declaration: {
|
252
|
-
'aspect-ratio': (decl, {Rule, Declaration}) => {
|
253
|
-
const rule = decl.parent
|
254
|
-
const selector = rule.selector
|
255
|
-
const beforeRule = new Rule({selector: `${selector}:before`, raws: {after: rule.raws.after, semicolon: rule.raws.semicolon}})
|
256
|
-
const ratio = decl.value.replace(/['"]?((?:\d*\.?\d*)?)(?:\s*[:|\/]\s*)(\d*\.?\d*)['"]?/g, (match, width, height) => {
|
257
|
-
return (height / width) * 100 + '%'
|
258
|
-
})
|
259
|
-
|
260
|
-
beforeRule.append([
|
261
|
-
new Declaration({prop: 'padding-bottom', value: ratio}),
|
262
|
-
])
|
263
|
-
|
264
|
-
rule.after(beforeRule)
|
265
|
-
|
266
|
-
rule.nodes.length === 1 ? rule.remove() : decl.remove()
|
267
|
-
},
|
268
|
-
}
|
269
|
-
}
|
270
|
-
}
|
271
|
-
|
272
|
-
aspectRatio.postcss = true;
|
273
|
-
|
274
274
|
const build = lazypipe().pipe(() => gulpif("*.css", postcss(new Utils().postcssPlugins(Config.styles.postcss, [autoprefixer, aspectRatio, inset])))
|
275
275
|
).pipe(() => gulpif("*.less", Modules.less.module()));
|
276
276
|
|
@@ -64,6 +64,19 @@ const tailwindVariables = (type, variables = [], values = {}) => {
|
|
64
64
|
return values
|
65
65
|
};
|
66
66
|
|
67
|
+
const tailwindAnimations = (values) => {
|
68
|
+
const result = {};
|
69
|
+
|
70
|
+
values.forEach(value => {
|
71
|
+
result[`.animation-${value}`] = {
|
72
|
+
'animation-name': value
|
73
|
+
};
|
74
|
+
});
|
75
|
+
|
76
|
+
return result
|
77
|
+
};
|
78
|
+
|
79
|
+
exports.tailwindAnimations = tailwindAnimations;
|
67
80
|
exports.tailwindColors = tailwindColors;
|
68
81
|
exports.tailwindColorsAccent = tailwindColorsAccent;
|
69
82
|
exports.tailwindColorsCurrent = tailwindColorsCurrent;
|
@@ -60,4 +60,16 @@ const tailwindVariables = (type, variables = [], values = {}) => {
|
|
60
60
|
return values
|
61
61
|
}
|
62
62
|
|
63
|
-
|
63
|
+
const tailwindAnimations = (values) => {
|
64
|
+
const result = {};
|
65
|
+
|
66
|
+
values.forEach(value => {
|
67
|
+
result[`.animation-${value}`] = {
|
68
|
+
'animation-name': value
|
69
|
+
};
|
70
|
+
});
|
71
|
+
|
72
|
+
return result
|
73
|
+
}
|
74
|
+
|
75
|
+
export { tailwindColors, tailwindVariables, tailwindColorsRgba, tailwindColorsAccent, tailwindColorsCurrent, tailwindAnimations }
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@newlogic-digital/core",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.9.
|
4
|
+
"version": "0.9.5",
|
5
5
|
"main": "index.js",
|
6
6
|
"author": "New Logic Studio s.r.o.",
|
7
7
|
"description": "Set of tools that can be used to create modern web applications",
|
@@ -40,7 +40,7 @@
|
|
40
40
|
"lazypipe": "^1.0.2",
|
41
41
|
"lodash": "^4.17.21",
|
42
42
|
"postcss-custom-media": "^8.0.0",
|
43
|
-
"postcss-custom-properties": "^12.1.
|
43
|
+
"postcss-custom-properties": "^12.1.4",
|
44
44
|
"postcss-custom-selectors": "^6.0.0",
|
45
45
|
"postcss-import": "^14.0.2",
|
46
46
|
"postcss-nesting": "^10.1.2",
|
@@ -52,7 +52,7 @@
|
|
52
52
|
"peerDependencies": {
|
53
53
|
"autoprefixer": "^10.4.2",
|
54
54
|
"postcss": "^8.4.5",
|
55
|
-
"tailwindcss": "^3.0.
|
55
|
+
"tailwindcss": "^3.0.18"
|
56
56
|
},
|
57
57
|
"devDependencies": {
|
58
58
|
"vitepress": "^0.21.6"
|