@seyuna/postcss 0.0.1-dev.0 → 0.0.1-dev.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/.github/workflows/release.yml +28 -2
- package/dist/functions/color.d.ts +1 -1
- package/dist/functions/color.js +16 -4
- package/dist/functions/index.js +2 -2
- package/dist/functions/spacing.js +1 -2
- package/package.json +1 -1
- package/src/functions/color.ts +18 -2
- package/src/functions/index.ts +3 -3
- package/src/functions/spacing.ts +1 -2
- package/src/functions/color.js +0 -7
- package/src/functions/index.js +0 -9
- package/src/functions/spacing.js +0 -8
- package/src/index.js +0 -7
- package/src/plugin.js +0 -25
|
@@ -78,13 +78,28 @@ jobs:
|
|
|
78
78
|
id: tag
|
|
79
79
|
run: |
|
|
80
80
|
BRANCH="${GITHUB_REF##*/}"
|
|
81
|
-
if [ "$BRANCH" = "
|
|
81
|
+
if [ "$BRANCH" = "stable" ]; then
|
|
82
82
|
echo "tag=latest" >> $GITHUB_OUTPUT
|
|
83
83
|
else
|
|
84
84
|
echo "tag=$BRANCH" >> $GITHUB_OUTPUT
|
|
85
85
|
fi
|
|
86
86
|
|
|
87
|
+
- name: Install dependencies
|
|
88
|
+
run: npm ci
|
|
89
|
+
|
|
90
|
+
- name: Check if version exists on npm
|
|
91
|
+
id: version_check
|
|
92
|
+
run: |
|
|
93
|
+
PKG_NAME=$(node -p "require('./package.json').name")
|
|
94
|
+
PKG_VERSION=$(node -p "require('./package.json').version")
|
|
95
|
+
if npm view "$PKG_NAME@$PKG_VERSION" > /dev/null 2>&1; then
|
|
96
|
+
echo "exists=true" >> $GITHUB_OUTPUT
|
|
97
|
+
else
|
|
98
|
+
echo "exists=false" >> $GITHUB_OUTPUT
|
|
99
|
+
fi
|
|
100
|
+
|
|
87
101
|
- name: Publish package
|
|
102
|
+
if: steps.version_check.outputs.exists != 'true'
|
|
88
103
|
run: npm publish --access public --tag ${{ steps.tag.outputs.tag }}
|
|
89
104
|
|
|
90
105
|
release:
|
|
@@ -120,10 +135,21 @@ jobs:
|
|
|
120
135
|
echo "$changelog"
|
|
121
136
|
} > RELEASE_NOTES.md
|
|
122
137
|
|
|
138
|
+
- name: Check if GitHub release exists
|
|
139
|
+
id: release_check
|
|
140
|
+
run: |
|
|
141
|
+
if gh release view "v${{ needs.build.outputs.version }}" >/dev/null 2>&1; then
|
|
142
|
+
echo "exists=true" >> $GITHUB_OUTPUT
|
|
143
|
+
else
|
|
144
|
+
echo "exists=false" >> $GITHUB_OUTPUT
|
|
145
|
+
fi
|
|
146
|
+
env:
|
|
147
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
148
|
+
|
|
123
149
|
- name: Create GitHub Release
|
|
150
|
+
if: steps.release_check.outputs.exists != 'true'
|
|
124
151
|
run: |
|
|
125
152
|
gh release create "v${{ needs.build.outputs.version }}" \
|
|
126
|
-
dist/* \
|
|
127
153
|
--title "v${{ needs.build.outputs.version }}" \
|
|
128
154
|
--notes-file RELEASE_NOTES.md
|
|
129
155
|
env:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const color: (name: string, alpha?: string, lightness?: string, chroma?: string) => string;
|
package/dist/functions/color.js
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
5
|
-
|
|
3
|
+
exports.color = void 0;
|
|
4
|
+
const color = (name, alpha, lightness, chroma) => {
|
|
5
|
+
let a = "1";
|
|
6
|
+
let l = "var(--lightness)";
|
|
7
|
+
let c = "var(--chroma)";
|
|
8
|
+
if (alpha && alpha !== "null") {
|
|
9
|
+
a = alpha;
|
|
10
|
+
}
|
|
11
|
+
if (lightness && lightness !== "null") {
|
|
12
|
+
l = lightness;
|
|
13
|
+
}
|
|
14
|
+
if (chroma && chroma !== "null") {
|
|
15
|
+
c = chroma;
|
|
16
|
+
}
|
|
17
|
+
return `oklch(${l}% ${c} ${name} / ${a})`;
|
|
6
18
|
};
|
|
7
|
-
exports.
|
|
19
|
+
exports.color = color;
|
package/dist/functions/index.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.spacing = void 0;
|
|
4
4
|
const spacing = (multiplier) => {
|
|
5
|
-
|
|
6
|
-
return `${num * 0.25}rem`;
|
|
5
|
+
return `${parseFloat(multiplier) * 1}rem`;
|
|
7
6
|
};
|
|
8
7
|
exports.spacing = spacing;
|
package/package.json
CHANGED
package/src/functions/color.ts
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
export const
|
|
2
|
-
|
|
1
|
+
export const color = (name: string, alpha?: string, lightness?: string, chroma?: string) => {
|
|
2
|
+
let a: string = "1";
|
|
3
|
+
let l: string = "var(--lightness)";
|
|
4
|
+
let c: string = "var(--chroma)";
|
|
5
|
+
|
|
6
|
+
if (alpha && alpha !== "null") {
|
|
7
|
+
a = alpha;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (lightness && lightness !== "null") {
|
|
11
|
+
l = lightness;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (chroma && chroma !== "null") {
|
|
15
|
+
c = chroma;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return `oklch(${l}% ${c} ${name} / ${a})`;
|
|
3
19
|
};
|
package/src/functions/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { color } from "./color";
|
|
2
2
|
import { spacing } from "./spacing";
|
|
3
3
|
|
|
4
4
|
export type FnHandler = (...args: string[]) => string;
|
|
5
5
|
|
|
6
6
|
export const functions: Record<string, FnHandler> = {
|
|
7
|
-
|
|
8
|
-
spacing
|
|
7
|
+
color,
|
|
8
|
+
spacing
|
|
9
9
|
};
|
package/src/functions/spacing.ts
CHANGED
package/src/functions/color.js
DELETED
package/src/functions/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.functions = void 0;
|
|
4
|
-
const color_1 = require("./color");
|
|
5
|
-
const spacing_1 = require("./spacing");
|
|
6
|
-
exports.functions = {
|
|
7
|
-
cssVar: color_1.cssVar,
|
|
8
|
-
spacing: spacing_1.spacing,
|
|
9
|
-
};
|
package/src/functions/spacing.js
DELETED
package/src/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.functions = exports.default = void 0;
|
|
4
|
-
var plugin_1 = require("./plugin");
|
|
5
|
-
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return plugin_1.dynamicFunctionsPlugin; } });
|
|
6
|
-
var functions_1 = require("./functions");
|
|
7
|
-
Object.defineProperty(exports, "functions", { enumerable: true, get: function () { return functions_1.functions; } });
|
package/src/plugin.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dynamicFunctionsPlugin = void 0;
|
|
4
|
-
const functions_1 = require("./functions");
|
|
5
|
-
const dynamicFunctionsPlugin = (opts = {}) => {
|
|
6
|
-
const fnMap = { ...functions_1.functions, ...opts.functions };
|
|
7
|
-
return {
|
|
8
|
-
postcssPlugin: "postcss-dynamic-functions",
|
|
9
|
-
Declaration(decl) {
|
|
10
|
-
let value = decl.value;
|
|
11
|
-
for (const fnName in fnMap) {
|
|
12
|
-
const regex = new RegExp(`${fnName}\\(([^)]*)\\)`, "g");
|
|
13
|
-
value = value.replace(regex, (_match, argsStr) => {
|
|
14
|
-
const args = argsStr
|
|
15
|
-
.split(",")
|
|
16
|
-
.map((a) => a.trim().replace(/^['"]|['"]$/g, ""));
|
|
17
|
-
return fnMap[fnName](...args);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
decl.value = value;
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
exports.dynamicFunctionsPlugin = dynamicFunctionsPlugin;
|
|
25
|
-
exports.dynamicFunctionsPlugin.postcss = true;
|