@newlogic-digital/core 0.9.0 → 0.9.4
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 +4 -1
- package/modules/Serve.js +11 -4
- package/modules/tailwind/index.cjs +44 -0
- package/modules/tailwind/index.js +42 -1
- package/package.json +1 -1
package/index.js
CHANGED
@@ -15,7 +15,7 @@ import {
|
|
15
15
|
root
|
16
16
|
} from "./modules/Core.js";
|
17
17
|
|
18
|
-
import { tailwindColors, tailwindVariables } from './modules/tailwind/index.js'
|
18
|
+
import { tailwindColors, tailwindColorsRgba, tailwindVariables, tailwindColorsAccent, tailwindColorsCurrent } from './modules/tailwind/index.js'
|
19
19
|
|
20
20
|
const defineConfig = (config) => new Core().init(config);
|
21
21
|
|
@@ -23,6 +23,9 @@ export {
|
|
23
23
|
defineConfig,
|
24
24
|
tailwindColors,
|
25
25
|
tailwindVariables,
|
26
|
+
tailwindColorsRgba,
|
27
|
+
tailwindColorsAccent,
|
28
|
+
tailwindColorsCurrent,
|
26
29
|
Core,
|
27
30
|
Utils,
|
28
31
|
Styles,
|
package/modules/Serve.js
CHANGED
@@ -51,8 +51,15 @@ export const Serve = new class {
|
|
51
51
|
}
|
52
52
|
}
|
53
53
|
|
54
|
+
const reloadTailwind = {
|
55
|
+
name: 'reload-tailwind',
|
56
|
+
transformIndexHtml(html) {
|
57
|
+
return html.replace('tailwind.css', 'tailwind.css?v=' + new Date().getTime())
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
54
61
|
let config = {
|
55
|
-
plugins: (Config.serve.mode === "dev" && Config.styles.ratio.enabled) ? [middleware, ratio, reload] : [middleware, reload],
|
62
|
+
plugins: (Config.serve.mode === "dev" && Config.styles.ratio.enabled) ? [middleware, ratio, reload, reloadTailwind] : [middleware, reload, reloadTailwind],
|
56
63
|
publicDir: `${Config.paths.output.root}`,
|
57
64
|
server: {
|
58
65
|
open: Config.serve.index,
|
@@ -60,9 +67,6 @@ export const Serve = new class {
|
|
60
67
|
fsServe: {
|
61
68
|
strict: false
|
62
69
|
},
|
63
|
-
hmr: {
|
64
|
-
host: 'localhost'
|
65
|
-
},
|
66
70
|
watch: {
|
67
71
|
ignored: ['**/node_modules/**', '**/.git/**', '**/src/templates/**', '**/src/main.json', `**/${Config.paths.output.root}/*.html`]
|
68
72
|
}
|
@@ -76,6 +80,9 @@ export const Serve = new class {
|
|
76
80
|
https: {
|
77
81
|
key: fs.readFileSync(path.join(os.homedir(),'.ssh/localhost-key.pem')),
|
78
82
|
cert: fs.readFileSync(path.join(os.homedir(),'.ssh/localhost.pem')),
|
83
|
+
},
|
84
|
+
hmr: {
|
85
|
+
host: 'localhost'
|
79
86
|
}
|
80
87
|
}
|
81
88
|
})
|
@@ -15,6 +15,47 @@ const tailwindColors = (colors = []) => {
|
|
15
15
|
return colors
|
16
16
|
};
|
17
17
|
|
18
|
+
const tailwindColorsRgba = (colors = []) => {
|
19
|
+
colors.forEach(name => {
|
20
|
+
colors[name] = ({opacityVariable, opacityValue}) => {
|
21
|
+
if (opacityValue !== undefined) {
|
22
|
+
return `rgba(var(--color-${name}), ${opacityValue})`
|
23
|
+
}
|
24
|
+
if (opacityVariable !== undefined) {
|
25
|
+
return `rgba(var(--color-${name}), var(${opacityVariable}, 1))`
|
26
|
+
}
|
27
|
+
return `rgb(var(--color-${name}))`
|
28
|
+
};
|
29
|
+
});
|
30
|
+
|
31
|
+
return colors
|
32
|
+
};
|
33
|
+
|
34
|
+
const tailwindColorsAccent = (colors = []) => {
|
35
|
+
const result = {};
|
36
|
+
|
37
|
+
colors.forEach(color => {
|
38
|
+
result[`.accent-${color}`] = {
|
39
|
+
'--color-accent': `var(--color-${color})`,
|
40
|
+
'accent-color': 'rgb(var(--color-accent))'
|
41
|
+
};
|
42
|
+
});
|
43
|
+
|
44
|
+
return result
|
45
|
+
};
|
46
|
+
|
47
|
+
const tailwindColorsCurrent = (colors = []) => {
|
48
|
+
const result = {};
|
49
|
+
|
50
|
+
colors.forEach(color => {
|
51
|
+
result[`.text-${color}`] = {
|
52
|
+
'--color-current': `var(--color-${color})`
|
53
|
+
};
|
54
|
+
});
|
55
|
+
|
56
|
+
return result
|
57
|
+
};
|
58
|
+
|
18
59
|
const tailwindVariables = (type, variables = [], values = {}) => {
|
19
60
|
variables.forEach(name => {
|
20
61
|
values[name] = `var(--${type}-${name})`;
|
@@ -24,4 +65,7 @@ const tailwindVariables = (type, variables = [], values = {}) => {
|
|
24
65
|
};
|
25
66
|
|
26
67
|
exports.tailwindColors = tailwindColors;
|
68
|
+
exports.tailwindColorsAccent = tailwindColorsAccent;
|
69
|
+
exports.tailwindColorsCurrent = tailwindColorsCurrent;
|
70
|
+
exports.tailwindColorsRgba = tailwindColorsRgba;
|
27
71
|
exports.tailwindVariables = tailwindVariables;
|
@@ -11,6 +11,47 @@ const tailwindColors = (colors = []) => {
|
|
11
11
|
return colors
|
12
12
|
}
|
13
13
|
|
14
|
+
const tailwindColorsRgba = (colors = []) => {
|
15
|
+
colors.forEach(name => {
|
16
|
+
colors[name] = ({opacityVariable, opacityValue}) => {
|
17
|
+
if (opacityValue !== undefined) {
|
18
|
+
return `rgba(var(--color-${name}), ${opacityValue})`
|
19
|
+
}
|
20
|
+
if (opacityVariable !== undefined) {
|
21
|
+
return `rgba(var(--color-${name}), var(${opacityVariable}, 1))`
|
22
|
+
}
|
23
|
+
return `rgb(var(--color-${name}))`
|
24
|
+
}
|
25
|
+
})
|
26
|
+
|
27
|
+
return colors
|
28
|
+
}
|
29
|
+
|
30
|
+
const tailwindColorsAccent = (colors = []) => {
|
31
|
+
const result = {}
|
32
|
+
|
33
|
+
colors.forEach(color => {
|
34
|
+
result[`.accent-${color}`] = {
|
35
|
+
'--color-accent': `var(--color-${color})`,
|
36
|
+
'accent-color': 'rgb(var(--color-accent))'
|
37
|
+
}
|
38
|
+
})
|
39
|
+
|
40
|
+
return result
|
41
|
+
}
|
42
|
+
|
43
|
+
const tailwindColorsCurrent = (colors = []) => {
|
44
|
+
const result = {};
|
45
|
+
|
46
|
+
colors.forEach(color => {
|
47
|
+
result[`.text-${color}`] = {
|
48
|
+
'--color-current': `var(--color-${color})`
|
49
|
+
};
|
50
|
+
});
|
51
|
+
|
52
|
+
return result
|
53
|
+
};
|
54
|
+
|
14
55
|
const tailwindVariables = (type, variables = [], values = {}) => {
|
15
56
|
variables.forEach(name => {
|
16
57
|
values[name] = `var(--${type}-${name})`
|
@@ -19,4 +60,4 @@ const tailwindVariables = (type, variables = [], values = {}) => {
|
|
19
60
|
return values
|
20
61
|
}
|
21
62
|
|
22
|
-
export { tailwindColors, tailwindVariables }
|
63
|
+
export { tailwindColors, tailwindVariables, tailwindColorsRgba, tailwindColorsAccent, tailwindColorsCurrent }
|
package/package.json
CHANGED