qstd 0.3.80 → 0.3.83
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/client/index.cjs +15 -2
- package/dist/client/index.js +15 -2
- package/dist/preset/index.cjs +67 -0
- package/dist/preset/index.d.ts.map +1 -1
- package/dist/preset/index.js +67 -0
- package/dist/server/index.cjs +15 -2
- package/dist/server/index.js +15 -2
- package/dist/shared/api/fns.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/client/index.cjs
CHANGED
|
@@ -708,14 +708,27 @@ var isDev = () => {
|
|
|
708
708
|
return false;
|
|
709
709
|
};
|
|
710
710
|
var isAbsolute = (path) => path.startsWith("http");
|
|
711
|
+
var joinBaseAndPath = (baseUrl, path) => {
|
|
712
|
+
if (!baseUrl) return path;
|
|
713
|
+
if (!path) return baseUrl;
|
|
714
|
+
if (path.startsWith("?") || path.startsWith("#")) {
|
|
715
|
+
return `${baseUrl.replace(/\/+$/, "")}${path}`;
|
|
716
|
+
}
|
|
717
|
+
const trimmedBase = baseUrl.replace(/\/+$/, "");
|
|
718
|
+
const trimmedPath = path.replace(/^\/+/, "");
|
|
719
|
+
if (!trimmedPath && path.startsWith("/")) {
|
|
720
|
+
return `${trimmedBase}/`;
|
|
721
|
+
}
|
|
722
|
+
return `${trimmedBase}/${trimmedPath}`;
|
|
723
|
+
};
|
|
711
724
|
var prepareUrl = (path, props) => {
|
|
712
725
|
if (isDev() && !isAbsolute(path) && path.includes("?") && path.split("?")[1]?.split("#")[0]) {
|
|
713
726
|
console.warn(
|
|
714
727
|
`[api] Query params detected in path string. Prefer using the 'params' option instead: Api.get("/path", { params: { ... } }). Path: ${path}`
|
|
715
728
|
);
|
|
716
729
|
}
|
|
717
|
-
const
|
|
718
|
-
let url =
|
|
730
|
+
const baseUrl = isAbsolute(path) ? "" : props.baseUrl;
|
|
731
|
+
let url = joinBaseAndPath(baseUrl, path);
|
|
719
732
|
if (props.params) {
|
|
720
733
|
const searchParams = new URLSearchParams();
|
|
721
734
|
for (const [key, value] of Object.entries(props.params)) {
|
package/dist/client/index.js
CHANGED
|
@@ -701,14 +701,27 @@ var isDev = () => {
|
|
|
701
701
|
return false;
|
|
702
702
|
};
|
|
703
703
|
var isAbsolute = (path) => path.startsWith("http");
|
|
704
|
+
var joinBaseAndPath = (baseUrl, path) => {
|
|
705
|
+
if (!baseUrl) return path;
|
|
706
|
+
if (!path) return baseUrl;
|
|
707
|
+
if (path.startsWith("?") || path.startsWith("#")) {
|
|
708
|
+
return `${baseUrl.replace(/\/+$/, "")}${path}`;
|
|
709
|
+
}
|
|
710
|
+
const trimmedBase = baseUrl.replace(/\/+$/, "");
|
|
711
|
+
const trimmedPath = path.replace(/^\/+/, "");
|
|
712
|
+
if (!trimmedPath && path.startsWith("/")) {
|
|
713
|
+
return `${trimmedBase}/`;
|
|
714
|
+
}
|
|
715
|
+
return `${trimmedBase}/${trimmedPath}`;
|
|
716
|
+
};
|
|
704
717
|
var prepareUrl = (path, props) => {
|
|
705
718
|
if (isDev() && !isAbsolute(path) && path.includes("?") && path.split("?")[1]?.split("#")[0]) {
|
|
706
719
|
console.warn(
|
|
707
720
|
`[api] Query params detected in path string. Prefer using the 'params' option instead: Api.get("/path", { params: { ... } }). Path: ${path}`
|
|
708
721
|
);
|
|
709
722
|
}
|
|
710
|
-
const
|
|
711
|
-
let url =
|
|
723
|
+
const baseUrl = isAbsolute(path) ? "" : props.baseUrl;
|
|
724
|
+
let url = joinBaseAndPath(baseUrl, path);
|
|
712
725
|
if (props.params) {
|
|
713
726
|
const searchParams = new URLSearchParams();
|
|
714
727
|
for (const [key, value] of Object.entries(props.params)) {
|
package/dist/preset/index.cjs
CHANGED
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// src/preset/index.ts
|
|
4
|
+
var normalizeBorderColor = (raw) => {
|
|
5
|
+
const borderColor = raw.trim();
|
|
6
|
+
const isKeyword = /^(currentColor|transparent|inherit|initial|unset|revert)$/i.test(
|
|
7
|
+
borderColor
|
|
8
|
+
);
|
|
9
|
+
const isHex = /^#/.test(borderColor);
|
|
10
|
+
const isFunc = /^(rgb|rgba|hsl|hsla|lab|lch|oklab|oklch|color)\(/i.test(
|
|
11
|
+
borderColor
|
|
12
|
+
);
|
|
13
|
+
const isVarRef = /^var\(/.test(borderColor);
|
|
14
|
+
const looksLikeScaleToken = /^[a-zA-Z][\w-]*\.\d{2,3}$/.test(borderColor);
|
|
15
|
+
const looksLikeSemanticToken = /^[a-zA-Z][\w-]*-[\w-]+$/.test(borderColor);
|
|
16
|
+
const shouldWrap = !isKeyword && !isHex && !isFunc && !isVarRef && (looksLikeScaleToken || looksLikeSemanticToken);
|
|
17
|
+
return shouldWrap ? `var(--colors-${borderColor.replace(/\./g, "-")})` : borderColor;
|
|
18
|
+
};
|
|
19
|
+
var parseBorderShorthand = (value) => {
|
|
20
|
+
const raw = value.trim();
|
|
21
|
+
if (raw === "none" || raw === "0" || raw === "0px" || raw === "0rem" || raw === "0em") {
|
|
22
|
+
return {
|
|
23
|
+
width: "0",
|
|
24
|
+
style: "none",
|
|
25
|
+
color: void 0
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const parts = raw.split(/\s+/);
|
|
29
|
+
let width = "";
|
|
30
|
+
let style = "";
|
|
31
|
+
let color = "";
|
|
32
|
+
parts.forEach((part) => {
|
|
33
|
+
if (/^\d+(\.\d+)?(px|em|rem|%|pt|pc|in|cm|mm|ex|ch|vw|vh|vmin|vmax)$/.test(
|
|
34
|
+
part
|
|
35
|
+
))
|
|
36
|
+
width = part;
|
|
37
|
+
else if (/^(none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset)$/.test(
|
|
38
|
+
part
|
|
39
|
+
))
|
|
40
|
+
style = part;
|
|
41
|
+
else color = part;
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
width: width || void 0,
|
|
45
|
+
style: style || void 0,
|
|
46
|
+
color: color ? normalizeBorderColor(color) : void 0
|
|
47
|
+
};
|
|
48
|
+
};
|
|
4
49
|
var preset = {
|
|
5
50
|
name: "qstd-preset",
|
|
6
51
|
globalCss: {
|
|
@@ -240,6 +285,28 @@ var preset = {
|
|
|
240
285
|
return { "&, & path": { strokeWidth: value } };
|
|
241
286
|
}
|
|
242
287
|
},
|
|
288
|
+
borderBottom: {
|
|
289
|
+
transform(value) {
|
|
290
|
+
if (typeof value !== "string") return {};
|
|
291
|
+
const parsed = parseBorderShorthand(value);
|
|
292
|
+
return {
|
|
293
|
+
...parsed.width && { borderBottomWidth: parsed.width },
|
|
294
|
+
...parsed.style && { borderBottomStyle: parsed.style },
|
|
295
|
+
...parsed.color && { borderBottomColor: parsed.color }
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
borderTop: {
|
|
300
|
+
transform(value) {
|
|
301
|
+
if (typeof value !== "string") return {};
|
|
302
|
+
const parsed = parseBorderShorthand(value);
|
|
303
|
+
return {
|
|
304
|
+
...parsed.width && { borderTopWidth: parsed.width },
|
|
305
|
+
...parsed.style && { borderTopStyle: parsed.style },
|
|
306
|
+
...parsed.color && { borderTopColor: parsed.color }
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
},
|
|
243
310
|
debug: {
|
|
244
311
|
values: { type: "boolean" },
|
|
245
312
|
transform(value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/preset/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/preset/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAwE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,QAAA,MAAM,MAAM,EAAE,MAskBb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/preset/index.js
CHANGED
|
@@ -1,4 +1,49 @@
|
|
|
1
1
|
// src/preset/index.ts
|
|
2
|
+
var normalizeBorderColor = (raw) => {
|
|
3
|
+
const borderColor = raw.trim();
|
|
4
|
+
const isKeyword = /^(currentColor|transparent|inherit|initial|unset|revert)$/i.test(
|
|
5
|
+
borderColor
|
|
6
|
+
);
|
|
7
|
+
const isHex = /^#/.test(borderColor);
|
|
8
|
+
const isFunc = /^(rgb|rgba|hsl|hsla|lab|lch|oklab|oklch|color)\(/i.test(
|
|
9
|
+
borderColor
|
|
10
|
+
);
|
|
11
|
+
const isVarRef = /^var\(/.test(borderColor);
|
|
12
|
+
const looksLikeScaleToken = /^[a-zA-Z][\w-]*\.\d{2,3}$/.test(borderColor);
|
|
13
|
+
const looksLikeSemanticToken = /^[a-zA-Z][\w-]*-[\w-]+$/.test(borderColor);
|
|
14
|
+
const shouldWrap = !isKeyword && !isHex && !isFunc && !isVarRef && (looksLikeScaleToken || looksLikeSemanticToken);
|
|
15
|
+
return shouldWrap ? `var(--colors-${borderColor.replace(/\./g, "-")})` : borderColor;
|
|
16
|
+
};
|
|
17
|
+
var parseBorderShorthand = (value) => {
|
|
18
|
+
const raw = value.trim();
|
|
19
|
+
if (raw === "none" || raw === "0" || raw === "0px" || raw === "0rem" || raw === "0em") {
|
|
20
|
+
return {
|
|
21
|
+
width: "0",
|
|
22
|
+
style: "none",
|
|
23
|
+
color: void 0
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const parts = raw.split(/\s+/);
|
|
27
|
+
let width = "";
|
|
28
|
+
let style = "";
|
|
29
|
+
let color = "";
|
|
30
|
+
parts.forEach((part) => {
|
|
31
|
+
if (/^\d+(\.\d+)?(px|em|rem|%|pt|pc|in|cm|mm|ex|ch|vw|vh|vmin|vmax)$/.test(
|
|
32
|
+
part
|
|
33
|
+
))
|
|
34
|
+
width = part;
|
|
35
|
+
else if (/^(none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset)$/.test(
|
|
36
|
+
part
|
|
37
|
+
))
|
|
38
|
+
style = part;
|
|
39
|
+
else color = part;
|
|
40
|
+
});
|
|
41
|
+
return {
|
|
42
|
+
width: width || void 0,
|
|
43
|
+
style: style || void 0,
|
|
44
|
+
color: color ? normalizeBorderColor(color) : void 0
|
|
45
|
+
};
|
|
46
|
+
};
|
|
2
47
|
var preset = {
|
|
3
48
|
name: "qstd-preset",
|
|
4
49
|
globalCss: {
|
|
@@ -238,6 +283,28 @@ var preset = {
|
|
|
238
283
|
return { "&, & path": { strokeWidth: value } };
|
|
239
284
|
}
|
|
240
285
|
},
|
|
286
|
+
borderBottom: {
|
|
287
|
+
transform(value) {
|
|
288
|
+
if (typeof value !== "string") return {};
|
|
289
|
+
const parsed = parseBorderShorthand(value);
|
|
290
|
+
return {
|
|
291
|
+
...parsed.width && { borderBottomWidth: parsed.width },
|
|
292
|
+
...parsed.style && { borderBottomStyle: parsed.style },
|
|
293
|
+
...parsed.color && { borderBottomColor: parsed.color }
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
borderTop: {
|
|
298
|
+
transform(value) {
|
|
299
|
+
if (typeof value !== "string") return {};
|
|
300
|
+
const parsed = parseBorderShorthand(value);
|
|
301
|
+
return {
|
|
302
|
+
...parsed.width && { borderTopWidth: parsed.width },
|
|
303
|
+
...parsed.style && { borderTopStyle: parsed.style },
|
|
304
|
+
...parsed.color && { borderTopColor: parsed.color }
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
},
|
|
241
308
|
debug: {
|
|
242
309
|
values: { type: "boolean" },
|
|
243
310
|
transform(value) {
|
package/dist/server/index.cjs
CHANGED
|
@@ -720,14 +720,27 @@ var isDev = () => {
|
|
|
720
720
|
return false;
|
|
721
721
|
};
|
|
722
722
|
var isAbsolute = (path) => path.startsWith("http");
|
|
723
|
+
var joinBaseAndPath = (baseUrl, path) => {
|
|
724
|
+
if (!baseUrl) return path;
|
|
725
|
+
if (!path) return baseUrl;
|
|
726
|
+
if (path.startsWith("?") || path.startsWith("#")) {
|
|
727
|
+
return `${baseUrl.replace(/\/+$/, "")}${path}`;
|
|
728
|
+
}
|
|
729
|
+
const trimmedBase = baseUrl.replace(/\/+$/, "");
|
|
730
|
+
const trimmedPath = path.replace(/^\/+/, "");
|
|
731
|
+
if (!trimmedPath && path.startsWith("/")) {
|
|
732
|
+
return `${trimmedBase}/`;
|
|
733
|
+
}
|
|
734
|
+
return `${trimmedBase}/${trimmedPath}`;
|
|
735
|
+
};
|
|
723
736
|
var prepareUrl = (path, props) => {
|
|
724
737
|
if (isDev() && !isAbsolute(path) && path.includes("?") && path.split("?")[1]?.split("#")[0]) {
|
|
725
738
|
console.warn(
|
|
726
739
|
`[api] Query params detected in path string. Prefer using the 'params' option instead: Api.get("/path", { params: { ... } }). Path: ${path}`
|
|
727
740
|
);
|
|
728
741
|
}
|
|
729
|
-
const
|
|
730
|
-
let url =
|
|
742
|
+
const baseUrl = isAbsolute(path) ? "" : props.baseUrl;
|
|
743
|
+
let url = joinBaseAndPath(baseUrl, path);
|
|
731
744
|
if (props.params) {
|
|
732
745
|
const searchParams = new URLSearchParams();
|
|
733
746
|
for (const [key, value] of Object.entries(props.params)) {
|
package/dist/server/index.js
CHANGED
|
@@ -712,14 +712,27 @@ var isDev = () => {
|
|
|
712
712
|
return false;
|
|
713
713
|
};
|
|
714
714
|
var isAbsolute = (path) => path.startsWith("http");
|
|
715
|
+
var joinBaseAndPath = (baseUrl, path) => {
|
|
716
|
+
if (!baseUrl) return path;
|
|
717
|
+
if (!path) return baseUrl;
|
|
718
|
+
if (path.startsWith("?") || path.startsWith("#")) {
|
|
719
|
+
return `${baseUrl.replace(/\/+$/, "")}${path}`;
|
|
720
|
+
}
|
|
721
|
+
const trimmedBase = baseUrl.replace(/\/+$/, "");
|
|
722
|
+
const trimmedPath = path.replace(/^\/+/, "");
|
|
723
|
+
if (!trimmedPath && path.startsWith("/")) {
|
|
724
|
+
return `${trimmedBase}/`;
|
|
725
|
+
}
|
|
726
|
+
return `${trimmedBase}/${trimmedPath}`;
|
|
727
|
+
};
|
|
715
728
|
var prepareUrl = (path, props) => {
|
|
716
729
|
if (isDev() && !isAbsolute(path) && path.includes("?") && path.split("?")[1]?.split("#")[0]) {
|
|
717
730
|
console.warn(
|
|
718
731
|
`[api] Query params detected in path string. Prefer using the 'params' option instead: Api.get("/path", { params: { ... } }). Path: ${path}`
|
|
719
732
|
);
|
|
720
733
|
}
|
|
721
|
-
const
|
|
722
|
-
let url =
|
|
734
|
+
const baseUrl = isAbsolute(path) ? "" : props.baseUrl;
|
|
735
|
+
let url = joinBaseAndPath(baseUrl, path);
|
|
723
736
|
if (props.params) {
|
|
724
737
|
const searchParams = new URLSearchParams();
|
|
725
738
|
for (const [key, value] of Object.entries(props.params)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fns.d.ts","sourceRoot":"","sources":["../../../src/shared/api/fns.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AA2B9B;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,YAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"fns.d.ts","sourceRoot":"","sources":["../../../src/shared/api/fns.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AA2B9B;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,YAA4B,CAAC;AA8CpE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,UAAU,GACrB,MAAM,MAAM,EACZ,OAAO;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,CAAA;CAAE,KAC7C,MA+BF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO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