@bamboocss/dev 1.11.1 → 1.11.2
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/bin.js +1 -1
- package/dist/chunk-C2EiDwsr.cjs +35 -0
- package/dist/cli-default.cjs +7512 -0
- package/dist/cli-default.d.cts +1 -0
- package/dist/cli-default.d.mts +1 -0
- package/dist/cli-default.mjs +7322 -9871
- package/dist/cli-main-BJ1ZEm4m.mjs +404 -0
- package/dist/cli-main.cjs +381 -0
- package/dist/cli-main.d.cts +4 -0
- package/dist/cli-main.d.mts +4 -0
- package/dist/cli-main.mjs +2 -524
- package/dist/errors-BhazEH_W.cjs +125 -0
- package/dist/errors-DyRfueHt.mjs +119 -0
- package/dist/errors.cjs +3 -0
- package/dist/errors.d.cts +4 -0
- package/dist/errors.d.mts +4 -0
- package/dist/errors.mjs +2 -137
- package/dist/index.cjs +89 -0
- package/dist/index.d.cts +29 -0
- package/dist/index.d.mts +29 -0
- package/dist/index.mjs +34 -62
- package/dist/interactive-CaIz3nIj.mjs +115 -0
- package/dist/interactive-D7Vh3spN.cjs +134 -0
- package/dist/interactive.cjs +3 -0
- package/dist/interactive.d.cts +11 -0
- package/dist/interactive.d.mts +11 -0
- package/dist/interactive.mjs +2 -94
- package/dist/presets.cjs +7 -0
- package/dist/presets.d.cts +2 -0
- package/dist/presets.d.mts +2 -0
- package/dist/presets.mjs +3 -4
- package/dist/types.cjs +0 -0
- package/dist/types.d.cts +107 -0
- package/dist/types.d.mts +107 -0
- package/dist/types.mjs +1 -0
- package/package.json +20 -20
- package/dist/cli-default.js +0 -10022
- package/dist/cli-main.js +0 -537
- package/dist/errors.js +0 -162
- package/dist/index.js +0 -140
- package/dist/interactive.js +0 -129
- package/dist/presets.js +0 -37
- package/dist/types.js +0 -18
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { isMainThread, parentPort } from "worker_threads";
|
|
2
|
+
import { BambooError } from "@bamboocss/shared";
|
|
3
|
+
//#region ../../node_modules/.pnpm/kleur@4.1.5/node_modules/kleur/index.mjs
|
|
4
|
+
let FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY = true;
|
|
5
|
+
if (typeof process !== "undefined") {
|
|
6
|
+
({FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM} = process.env || {});
|
|
7
|
+
isTTY = process.stdout && process.stdout.isTTY;
|
|
8
|
+
}
|
|
9
|
+
const $ = {
|
|
10
|
+
enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY),
|
|
11
|
+
reset: init(0, 0),
|
|
12
|
+
bold: init(1, 22),
|
|
13
|
+
dim: init(2, 22),
|
|
14
|
+
italic: init(3, 23),
|
|
15
|
+
underline: init(4, 24),
|
|
16
|
+
inverse: init(7, 27),
|
|
17
|
+
hidden: init(8, 28),
|
|
18
|
+
strikethrough: init(9, 29),
|
|
19
|
+
black: init(30, 39),
|
|
20
|
+
red: init(31, 39),
|
|
21
|
+
green: init(32, 39),
|
|
22
|
+
yellow: init(33, 39),
|
|
23
|
+
blue: init(34, 39),
|
|
24
|
+
magenta: init(35, 39),
|
|
25
|
+
cyan: init(36, 39),
|
|
26
|
+
white: init(37, 39),
|
|
27
|
+
gray: init(90, 39),
|
|
28
|
+
grey: init(90, 39),
|
|
29
|
+
bgBlack: init(40, 49),
|
|
30
|
+
bgRed: init(41, 49),
|
|
31
|
+
bgGreen: init(42, 49),
|
|
32
|
+
bgYellow: init(43, 49),
|
|
33
|
+
bgBlue: init(44, 49),
|
|
34
|
+
bgMagenta: init(45, 49),
|
|
35
|
+
bgCyan: init(46, 49),
|
|
36
|
+
bgWhite: init(47, 49)
|
|
37
|
+
};
|
|
38
|
+
function run(arr, str) {
|
|
39
|
+
let i = 0, tmp, beg = "", end = "";
|
|
40
|
+
for (; i < arr.length; i++) {
|
|
41
|
+
tmp = arr[i];
|
|
42
|
+
beg += tmp.open;
|
|
43
|
+
end += tmp.close;
|
|
44
|
+
if (!!~str.indexOf(tmp.close)) str = str.replace(tmp.rgx, tmp.close + tmp.open);
|
|
45
|
+
}
|
|
46
|
+
return beg + str + end;
|
|
47
|
+
}
|
|
48
|
+
function chain(has, keys) {
|
|
49
|
+
let ctx = {
|
|
50
|
+
has,
|
|
51
|
+
keys
|
|
52
|
+
};
|
|
53
|
+
ctx.reset = $.reset.bind(ctx);
|
|
54
|
+
ctx.bold = $.bold.bind(ctx);
|
|
55
|
+
ctx.dim = $.dim.bind(ctx);
|
|
56
|
+
ctx.italic = $.italic.bind(ctx);
|
|
57
|
+
ctx.underline = $.underline.bind(ctx);
|
|
58
|
+
ctx.inverse = $.inverse.bind(ctx);
|
|
59
|
+
ctx.hidden = $.hidden.bind(ctx);
|
|
60
|
+
ctx.strikethrough = $.strikethrough.bind(ctx);
|
|
61
|
+
ctx.black = $.black.bind(ctx);
|
|
62
|
+
ctx.red = $.red.bind(ctx);
|
|
63
|
+
ctx.green = $.green.bind(ctx);
|
|
64
|
+
ctx.yellow = $.yellow.bind(ctx);
|
|
65
|
+
ctx.blue = $.blue.bind(ctx);
|
|
66
|
+
ctx.magenta = $.magenta.bind(ctx);
|
|
67
|
+
ctx.cyan = $.cyan.bind(ctx);
|
|
68
|
+
ctx.white = $.white.bind(ctx);
|
|
69
|
+
ctx.gray = $.gray.bind(ctx);
|
|
70
|
+
ctx.grey = $.grey.bind(ctx);
|
|
71
|
+
ctx.bgBlack = $.bgBlack.bind(ctx);
|
|
72
|
+
ctx.bgRed = $.bgRed.bind(ctx);
|
|
73
|
+
ctx.bgGreen = $.bgGreen.bind(ctx);
|
|
74
|
+
ctx.bgYellow = $.bgYellow.bind(ctx);
|
|
75
|
+
ctx.bgBlue = $.bgBlue.bind(ctx);
|
|
76
|
+
ctx.bgMagenta = $.bgMagenta.bind(ctx);
|
|
77
|
+
ctx.bgCyan = $.bgCyan.bind(ctx);
|
|
78
|
+
ctx.bgWhite = $.bgWhite.bind(ctx);
|
|
79
|
+
return ctx;
|
|
80
|
+
}
|
|
81
|
+
function init(open, close) {
|
|
82
|
+
let blk = {
|
|
83
|
+
open: `\x1b[${open}m`,
|
|
84
|
+
close: `\x1b[${close}m`,
|
|
85
|
+
rgx: new RegExp(`\\x1b\\[${close}m`, "g")
|
|
86
|
+
};
|
|
87
|
+
return function(txt) {
|
|
88
|
+
if (this !== void 0 && this.has !== void 0) {
|
|
89
|
+
~this.has.indexOf(open) || (this.has.push(open), this.keys.push(blk));
|
|
90
|
+
return txt === void 0 ? this : $.enabled ? run(this.keys, txt + "") : txt + "";
|
|
91
|
+
}
|
|
92
|
+
return txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt + "") : txt + "";
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/errors.ts
|
|
97
|
+
function handleError(error) {
|
|
98
|
+
if (error instanceof BambooError) {
|
|
99
|
+
console.error($.red(`${error.code}: ${error.message}`));
|
|
100
|
+
if (error.hint) console.error($.dim(error.hint));
|
|
101
|
+
if (error.cause instanceof Error) console.error($.dim(`Caused by: ${error.cause.message}`));
|
|
102
|
+
} else if (isLocError(error)) {
|
|
103
|
+
console.error($.bold($.red(`Error parsing: ${error.loc.file}:${error.loc.line}:${error.loc.column}`)));
|
|
104
|
+
if (error.frame) {
|
|
105
|
+
console.error($.red(error.message));
|
|
106
|
+
console.error($.dim(error.frame));
|
|
107
|
+
} else console.error($.red(error.message));
|
|
108
|
+
} else {
|
|
109
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
110
|
+
console.error($.red(message));
|
|
111
|
+
}
|
|
112
|
+
process.exitCode = 1;
|
|
113
|
+
if (!isMainThread && parentPort) parentPort.postMessage("error");
|
|
114
|
+
}
|
|
115
|
+
function isLocError(error) {
|
|
116
|
+
return typeof error === "object" && error !== null && "loc" in error && typeof error.loc === "object" && "message" in error;
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
export { handleError as t };
|
package/dist/errors.cjs
ADDED
package/dist/errors.mjs
CHANGED
|
@@ -1,137 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// ../../node_modules/.pnpm/kleur@4.1.5/node_modules/kleur/index.mjs
|
|
5
|
-
var FORCE_COLOR;
|
|
6
|
-
var NODE_DISABLE_COLORS;
|
|
7
|
-
var NO_COLOR;
|
|
8
|
-
var TERM;
|
|
9
|
-
var isTTY = true;
|
|
10
|
-
if (typeof process !== "undefined") {
|
|
11
|
-
({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
|
|
12
|
-
isTTY = process.stdout && process.stdout.isTTY;
|
|
13
|
-
}
|
|
14
|
-
var $ = {
|
|
15
|
-
enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY),
|
|
16
|
-
// modifiers
|
|
17
|
-
reset: init(0, 0),
|
|
18
|
-
bold: init(1, 22),
|
|
19
|
-
dim: init(2, 22),
|
|
20
|
-
italic: init(3, 23),
|
|
21
|
-
underline: init(4, 24),
|
|
22
|
-
inverse: init(7, 27),
|
|
23
|
-
hidden: init(8, 28),
|
|
24
|
-
strikethrough: init(9, 29),
|
|
25
|
-
// colors
|
|
26
|
-
black: init(30, 39),
|
|
27
|
-
red: init(31, 39),
|
|
28
|
-
green: init(32, 39),
|
|
29
|
-
yellow: init(33, 39),
|
|
30
|
-
blue: init(34, 39),
|
|
31
|
-
magenta: init(35, 39),
|
|
32
|
-
cyan: init(36, 39),
|
|
33
|
-
white: init(37, 39),
|
|
34
|
-
gray: init(90, 39),
|
|
35
|
-
grey: init(90, 39),
|
|
36
|
-
// background colors
|
|
37
|
-
bgBlack: init(40, 49),
|
|
38
|
-
bgRed: init(41, 49),
|
|
39
|
-
bgGreen: init(42, 49),
|
|
40
|
-
bgYellow: init(43, 49),
|
|
41
|
-
bgBlue: init(44, 49),
|
|
42
|
-
bgMagenta: init(45, 49),
|
|
43
|
-
bgCyan: init(46, 49),
|
|
44
|
-
bgWhite: init(47, 49)
|
|
45
|
-
};
|
|
46
|
-
function run(arr, str) {
|
|
47
|
-
let i = 0, tmp, beg = "", end = "";
|
|
48
|
-
for (; i < arr.length; i++) {
|
|
49
|
-
tmp = arr[i];
|
|
50
|
-
beg += tmp.open;
|
|
51
|
-
end += tmp.close;
|
|
52
|
-
if (!!~str.indexOf(tmp.close)) {
|
|
53
|
-
str = str.replace(tmp.rgx, tmp.close + tmp.open);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return beg + str + end;
|
|
57
|
-
}
|
|
58
|
-
function chain(has, keys) {
|
|
59
|
-
let ctx = { has, keys };
|
|
60
|
-
ctx.reset = $.reset.bind(ctx);
|
|
61
|
-
ctx.bold = $.bold.bind(ctx);
|
|
62
|
-
ctx.dim = $.dim.bind(ctx);
|
|
63
|
-
ctx.italic = $.italic.bind(ctx);
|
|
64
|
-
ctx.underline = $.underline.bind(ctx);
|
|
65
|
-
ctx.inverse = $.inverse.bind(ctx);
|
|
66
|
-
ctx.hidden = $.hidden.bind(ctx);
|
|
67
|
-
ctx.strikethrough = $.strikethrough.bind(ctx);
|
|
68
|
-
ctx.black = $.black.bind(ctx);
|
|
69
|
-
ctx.red = $.red.bind(ctx);
|
|
70
|
-
ctx.green = $.green.bind(ctx);
|
|
71
|
-
ctx.yellow = $.yellow.bind(ctx);
|
|
72
|
-
ctx.blue = $.blue.bind(ctx);
|
|
73
|
-
ctx.magenta = $.magenta.bind(ctx);
|
|
74
|
-
ctx.cyan = $.cyan.bind(ctx);
|
|
75
|
-
ctx.white = $.white.bind(ctx);
|
|
76
|
-
ctx.gray = $.gray.bind(ctx);
|
|
77
|
-
ctx.grey = $.grey.bind(ctx);
|
|
78
|
-
ctx.bgBlack = $.bgBlack.bind(ctx);
|
|
79
|
-
ctx.bgRed = $.bgRed.bind(ctx);
|
|
80
|
-
ctx.bgGreen = $.bgGreen.bind(ctx);
|
|
81
|
-
ctx.bgYellow = $.bgYellow.bind(ctx);
|
|
82
|
-
ctx.bgBlue = $.bgBlue.bind(ctx);
|
|
83
|
-
ctx.bgMagenta = $.bgMagenta.bind(ctx);
|
|
84
|
-
ctx.bgCyan = $.bgCyan.bind(ctx);
|
|
85
|
-
ctx.bgWhite = $.bgWhite.bind(ctx);
|
|
86
|
-
return ctx;
|
|
87
|
-
}
|
|
88
|
-
function init(open, close) {
|
|
89
|
-
let blk = {
|
|
90
|
-
open: `\x1B[${open}m`,
|
|
91
|
-
close: `\x1B[${close}m`,
|
|
92
|
-
rgx: new RegExp(`\\x1b\\[${close}m`, "g")
|
|
93
|
-
};
|
|
94
|
-
return function(txt) {
|
|
95
|
-
if (this !== void 0 && this.has !== void 0) {
|
|
96
|
-
!!~this.has.indexOf(open) || (this.has.push(open), this.keys.push(blk));
|
|
97
|
-
return txt === void 0 ? this : $.enabled ? run(this.keys, txt + "") : txt + "";
|
|
98
|
-
}
|
|
99
|
-
return txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt + "") : txt + "";
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
var kleur_default = $;
|
|
103
|
-
|
|
104
|
-
// src/errors.ts
|
|
105
|
-
import { BambooError } from "@bamboocss/shared";
|
|
106
|
-
function handleError(error) {
|
|
107
|
-
if (error instanceof BambooError) {
|
|
108
|
-
console.error(kleur_default.red(`${error.code}: ${error.message}`));
|
|
109
|
-
if (error.hint) {
|
|
110
|
-
console.error(kleur_default.dim(error.hint));
|
|
111
|
-
}
|
|
112
|
-
if (error.cause instanceof Error) {
|
|
113
|
-
console.error(kleur_default.dim(`Caused by: ${error.cause.message}`));
|
|
114
|
-
}
|
|
115
|
-
} else if (isLocError(error)) {
|
|
116
|
-
console.error(kleur_default.bold(kleur_default.red(`Error parsing: ${error.loc.file}:${error.loc.line}:${error.loc.column}`)));
|
|
117
|
-
if (error.frame) {
|
|
118
|
-
console.error(kleur_default.red(error.message));
|
|
119
|
-
console.error(kleur_default.dim(error.frame));
|
|
120
|
-
} else {
|
|
121
|
-
console.error(kleur_default.red(error.message));
|
|
122
|
-
}
|
|
123
|
-
} else {
|
|
124
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
125
|
-
console.error(kleur_default.red(message));
|
|
126
|
-
}
|
|
127
|
-
process.exitCode = 1;
|
|
128
|
-
if (!isMainThread && parentPort) {
|
|
129
|
-
parentPort.postMessage("error");
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
function isLocError(error) {
|
|
133
|
-
return typeof error === "object" && error !== null && "loc" in error && typeof error.loc === "object" && "message" in error;
|
|
134
|
-
}
|
|
135
|
-
export {
|
|
136
|
-
handleError
|
|
137
|
-
};
|
|
1
|
+
import { t as handleError } from "./errors-DyRfueHt.mjs";
|
|
2
|
+
export { handleError };
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("./chunk-C2EiDwsr.cjs");
|
|
3
|
+
let _bamboocss_shared = require("@bamboocss/shared");
|
|
4
|
+
//#region src/index.ts
|
|
5
|
+
function defineConfig(config) {
|
|
6
|
+
return Object.assign(config, { name: "__bamboo.config__" });
|
|
7
|
+
}
|
|
8
|
+
function defineRecipe(config) {
|
|
9
|
+
return config;
|
|
10
|
+
}
|
|
11
|
+
function defineSlotRecipe(config) {
|
|
12
|
+
return config;
|
|
13
|
+
}
|
|
14
|
+
function defineParts(parts) {
|
|
15
|
+
return function(config) {
|
|
16
|
+
return Object.fromEntries(Object.entries(config).map(([key, value]) => {
|
|
17
|
+
const part = parts[key];
|
|
18
|
+
if (part == null) throw new _bamboocss_shared.BambooError("NOT_FOUND", `Part "${key}" does not exist in the anatomy. Available parts: ${Object.keys(parts).join(", ")}`);
|
|
19
|
+
return [part.selector, value];
|
|
20
|
+
}));
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function definePattern(config) {
|
|
24
|
+
return config;
|
|
25
|
+
}
|
|
26
|
+
function definePreset(preset) {
|
|
27
|
+
return preset;
|
|
28
|
+
}
|
|
29
|
+
function defineKeyframes(keyframes) {
|
|
30
|
+
return keyframes;
|
|
31
|
+
}
|
|
32
|
+
function defineGlobalStyles(definition) {
|
|
33
|
+
return definition;
|
|
34
|
+
}
|
|
35
|
+
function defineGlobalFontface(definition) {
|
|
36
|
+
return definition;
|
|
37
|
+
}
|
|
38
|
+
function defineUtility(utility) {
|
|
39
|
+
return utility;
|
|
40
|
+
}
|
|
41
|
+
function definePlugin(plugin) {
|
|
42
|
+
return plugin;
|
|
43
|
+
}
|
|
44
|
+
function defineThemeVariant(theme) {
|
|
45
|
+
return theme;
|
|
46
|
+
}
|
|
47
|
+
function defineThemeContract(_contract) {
|
|
48
|
+
return (theme) => defineThemeVariant(theme);
|
|
49
|
+
}
|
|
50
|
+
function createProxy() {
|
|
51
|
+
const identity = (v) => v;
|
|
52
|
+
return new Proxy(identity, { get() {
|
|
53
|
+
return identity;
|
|
54
|
+
} });
|
|
55
|
+
}
|
|
56
|
+
const defineTokens = /* @__PURE__ */ createProxy();
|
|
57
|
+
const defineSemanticTokens = /* @__PURE__ */ createProxy();
|
|
58
|
+
function defineTextStyles(definition) {
|
|
59
|
+
return definition;
|
|
60
|
+
}
|
|
61
|
+
function defineLayerStyles(definition) {
|
|
62
|
+
return definition;
|
|
63
|
+
}
|
|
64
|
+
function defineStyles(definition) {
|
|
65
|
+
return definition;
|
|
66
|
+
}
|
|
67
|
+
function defineAnimationStyles(definition) {
|
|
68
|
+
return definition;
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
exports.defineAnimationStyles = defineAnimationStyles;
|
|
72
|
+
exports.defineConfig = defineConfig;
|
|
73
|
+
exports.defineGlobalFontface = defineGlobalFontface;
|
|
74
|
+
exports.defineGlobalStyles = defineGlobalStyles;
|
|
75
|
+
exports.defineKeyframes = defineKeyframes;
|
|
76
|
+
exports.defineLayerStyles = defineLayerStyles;
|
|
77
|
+
exports.defineParts = defineParts;
|
|
78
|
+
exports.definePattern = definePattern;
|
|
79
|
+
exports.definePlugin = definePlugin;
|
|
80
|
+
exports.definePreset = definePreset;
|
|
81
|
+
exports.defineRecipe = defineRecipe;
|
|
82
|
+
exports.defineSemanticTokens = defineSemanticTokens;
|
|
83
|
+
exports.defineSlotRecipe = defineSlotRecipe;
|
|
84
|
+
exports.defineStyles = defineStyles;
|
|
85
|
+
exports.defineTextStyles = defineTextStyles;
|
|
86
|
+
exports.defineThemeContract = defineThemeContract;
|
|
87
|
+
exports.defineThemeVariant = defineThemeVariant;
|
|
88
|
+
exports.defineTokens = defineTokens;
|
|
89
|
+
exports.defineUtility = defineUtility;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AnimationStyles, BambooPlugin, CompositionStyles, Config, CssKeyframes, GlobalFontface, GlobalStyleObject, HooksApiInterface, LayerStyles, Parts, PatternConfig, PatternProperties, Preset, PropertyConfig, RecipeConfig, RecipeVariantRecord, SemanticTokens, SlotRecipeConfig, SlotRecipeVariantRecord, SystemStyleObject, TextStyles, ThemeVariant, Tokens } from "@bamboocss/types";
|
|
2
|
+
|
|
3
|
+
//#region src/index.d.ts
|
|
4
|
+
declare function defineConfig(config: Config): Config & {
|
|
5
|
+
name: string;
|
|
6
|
+
};
|
|
7
|
+
declare function defineRecipe<T extends RecipeVariantRecord>(config: RecipeConfig<T>): RecipeConfig;
|
|
8
|
+
declare function defineSlotRecipe<S extends string, T extends SlotRecipeVariantRecord<S>>(config: SlotRecipeConfig<S, T>): SlotRecipeConfig;
|
|
9
|
+
declare function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>;
|
|
10
|
+
declare function definePattern<T extends PatternConfig>(config: T): PatternConfig;
|
|
11
|
+
declare function definePreset(preset: Preset): Preset;
|
|
12
|
+
declare function defineKeyframes(keyframes: CssKeyframes): CssKeyframes;
|
|
13
|
+
declare function defineGlobalStyles(definition: GlobalStyleObject): GlobalStyleObject;
|
|
14
|
+
declare function defineGlobalFontface(definition: GlobalFontface): GlobalFontface;
|
|
15
|
+
declare function defineUtility(utility: PropertyConfig): PropertyConfig;
|
|
16
|
+
declare function definePlugin(plugin: BambooPlugin): BambooPlugin;
|
|
17
|
+
declare function defineThemeVariant<T extends ThemeVariant>(theme: T): T;
|
|
18
|
+
declare function defineThemeContract<C extends Partial<Omit<ThemeVariant, 'selector'>>>(_contract: C): <T extends C & ThemeVariant>(theme: T) => T;
|
|
19
|
+
type ProxyValue<T> = {
|
|
20
|
+
<Value>(definition: Value extends T ? Value : T): Value;
|
|
21
|
+
} & { [K in keyof Required<T>]: <Value>(definition: Value extends T[K] ? Value : T[K]) => Value };
|
|
22
|
+
declare const defineTokens: ProxyValue<Tokens>;
|
|
23
|
+
declare const defineSemanticTokens: ProxyValue<SemanticTokens>;
|
|
24
|
+
declare function defineTextStyles(definition: CompositionStyles['textStyles']): TextStyles;
|
|
25
|
+
declare function defineLayerStyles(definition: CompositionStyles['layerStyles']): LayerStyles;
|
|
26
|
+
declare function defineStyles(definition: SystemStyleObject): SystemStyleObject;
|
|
27
|
+
declare function defineAnimationStyles(definition: CompositionStyles['animationStyles']): AnimationStyles;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { type AnimationStyles, type CompositionStyles, type Config, type CssKeyframes, type GlobalStyleObject, type HooksApiInterface, type LayerStyles, type PatternConfig, type PatternProperties, type Preset, type PropertyConfig, type RecipeConfig, type RecipeVariantRecord, type SemanticTokens, type SlotRecipeConfig, type SlotRecipeVariantRecord, type SystemStyleObject, type TextStyles, type Tokens, defineAnimationStyles, defineConfig, defineGlobalFontface, defineGlobalStyles, defineKeyframes, defineLayerStyles, defineParts, definePattern, definePlugin, definePreset, defineRecipe, defineSemanticTokens, defineSlotRecipe, defineStyles, defineTextStyles, defineThemeContract, defineThemeVariant, defineTokens, defineUtility };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AnimationStyles, BambooPlugin, CompositionStyles, Config, CssKeyframes, GlobalFontface, GlobalStyleObject, HooksApiInterface, LayerStyles, Parts, PatternConfig, PatternProperties, Preset, PropertyConfig, RecipeConfig, RecipeVariantRecord, SemanticTokens, SlotRecipeConfig, SlotRecipeVariantRecord, SystemStyleObject, TextStyles, ThemeVariant, Tokens } from "@bamboocss/types";
|
|
2
|
+
|
|
3
|
+
//#region src/index.d.ts
|
|
4
|
+
declare function defineConfig(config: Config): Config & {
|
|
5
|
+
name: string;
|
|
6
|
+
};
|
|
7
|
+
declare function defineRecipe<T extends RecipeVariantRecord>(config: RecipeConfig<T>): RecipeConfig;
|
|
8
|
+
declare function defineSlotRecipe<S extends string, T extends SlotRecipeVariantRecord<S>>(config: SlotRecipeConfig<S, T>): SlotRecipeConfig;
|
|
9
|
+
declare function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>;
|
|
10
|
+
declare function definePattern<T extends PatternConfig>(config: T): PatternConfig;
|
|
11
|
+
declare function definePreset(preset: Preset): Preset;
|
|
12
|
+
declare function defineKeyframes(keyframes: CssKeyframes): CssKeyframes;
|
|
13
|
+
declare function defineGlobalStyles(definition: GlobalStyleObject): GlobalStyleObject;
|
|
14
|
+
declare function defineGlobalFontface(definition: GlobalFontface): GlobalFontface;
|
|
15
|
+
declare function defineUtility(utility: PropertyConfig): PropertyConfig;
|
|
16
|
+
declare function definePlugin(plugin: BambooPlugin): BambooPlugin;
|
|
17
|
+
declare function defineThemeVariant<T extends ThemeVariant>(theme: T): T;
|
|
18
|
+
declare function defineThemeContract<C extends Partial<Omit<ThemeVariant, 'selector'>>>(_contract: C): <T extends C & ThemeVariant>(theme: T) => T;
|
|
19
|
+
type ProxyValue<T> = {
|
|
20
|
+
<Value>(definition: Value extends T ? Value : T): Value;
|
|
21
|
+
} & { [K in keyof Required<T>]: <Value>(definition: Value extends T[K] ? Value : T[K]) => Value };
|
|
22
|
+
declare const defineTokens: ProxyValue<Tokens>;
|
|
23
|
+
declare const defineSemanticTokens: ProxyValue<SemanticTokens>;
|
|
24
|
+
declare function defineTextStyles(definition: CompositionStyles['textStyles']): TextStyles;
|
|
25
|
+
declare function defineLayerStyles(definition: CompositionStyles['layerStyles']): LayerStyles;
|
|
26
|
+
declare function defineStyles(definition: SystemStyleObject): SystemStyleObject;
|
|
27
|
+
declare function defineAnimationStyles(definition: CompositionStyles['animationStyles']): AnimationStyles;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { type AnimationStyles, type CompositionStyles, type Config, type CssKeyframes, type GlobalStyleObject, type HooksApiInterface, type LayerStyles, type PatternConfig, type PatternProperties, type Preset, type PropertyConfig, type RecipeConfig, type RecipeVariantRecord, type SemanticTokens, type SlotRecipeConfig, type SlotRecipeVariantRecord, type SystemStyleObject, type TextStyles, type Tokens, defineAnimationStyles, defineConfig, defineGlobalFontface, defineGlobalStyles, defineKeyframes, defineLayerStyles, defineParts, definePattern, definePlugin, definePreset, defineRecipe, defineSemanticTokens, defineSlotRecipe, defineStyles, defineTextStyles, defineThemeContract, defineThemeVariant, defineTokens, defineUtility };
|
package/dist/index.mjs
CHANGED
|
@@ -1,97 +1,69 @@
|
|
|
1
|
-
// src/index.ts
|
|
2
1
|
import { BambooError } from "@bamboocss/shared";
|
|
2
|
+
//#region src/index.ts
|
|
3
3
|
function defineConfig(config) {
|
|
4
|
-
|
|
4
|
+
return Object.assign(config, { name: "__bamboo.config__" });
|
|
5
5
|
}
|
|
6
6
|
function defineRecipe(config) {
|
|
7
|
-
|
|
7
|
+
return config;
|
|
8
8
|
}
|
|
9
9
|
function defineSlotRecipe(config) {
|
|
10
|
-
|
|
10
|
+
return config;
|
|
11
11
|
}
|
|
12
12
|
function defineParts(parts) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
`Part "${key}" does not exist in the anatomy. Available parts: ${Object.keys(parts).join(", ")}`
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
return [part.selector, value];
|
|
24
|
-
})
|
|
25
|
-
);
|
|
26
|
-
};
|
|
13
|
+
return function(config) {
|
|
14
|
+
return Object.fromEntries(Object.entries(config).map(([key, value]) => {
|
|
15
|
+
const part = parts[key];
|
|
16
|
+
if (part == null) throw new BambooError("NOT_FOUND", `Part "${key}" does not exist in the anatomy. Available parts: ${Object.keys(parts).join(", ")}`);
|
|
17
|
+
return [part.selector, value];
|
|
18
|
+
}));
|
|
19
|
+
};
|
|
27
20
|
}
|
|
28
21
|
function definePattern(config) {
|
|
29
|
-
|
|
22
|
+
return config;
|
|
30
23
|
}
|
|
31
24
|
function definePreset(preset) {
|
|
32
|
-
|
|
25
|
+
return preset;
|
|
33
26
|
}
|
|
34
27
|
function defineKeyframes(keyframes) {
|
|
35
|
-
|
|
28
|
+
return keyframes;
|
|
36
29
|
}
|
|
37
30
|
function defineGlobalStyles(definition) {
|
|
38
|
-
|
|
31
|
+
return definition;
|
|
39
32
|
}
|
|
40
33
|
function defineGlobalFontface(definition) {
|
|
41
|
-
|
|
34
|
+
return definition;
|
|
42
35
|
}
|
|
43
36
|
function defineUtility(utility) {
|
|
44
|
-
|
|
37
|
+
return utility;
|
|
45
38
|
}
|
|
46
39
|
function definePlugin(plugin) {
|
|
47
|
-
|
|
40
|
+
return plugin;
|
|
48
41
|
}
|
|
49
42
|
function defineThemeVariant(theme) {
|
|
50
|
-
|
|
43
|
+
return theme;
|
|
51
44
|
}
|
|
52
45
|
function defineThemeContract(_contract) {
|
|
53
|
-
|
|
46
|
+
return (theme) => defineThemeVariant(theme);
|
|
54
47
|
}
|
|
55
48
|
function createProxy() {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
var defineTokens = /* @__PURE__ */ createProxy();
|
|
64
|
-
var defineSemanticTokens = /* @__PURE__ */ createProxy();
|
|
49
|
+
const identity = (v) => v;
|
|
50
|
+
return new Proxy(identity, { get() {
|
|
51
|
+
return identity;
|
|
52
|
+
} });
|
|
53
|
+
}
|
|
54
|
+
const defineTokens = /* @__PURE__ */ createProxy();
|
|
55
|
+
const defineSemanticTokens = /* @__PURE__ */ createProxy();
|
|
65
56
|
function defineTextStyles(definition) {
|
|
66
|
-
|
|
57
|
+
return definition;
|
|
67
58
|
}
|
|
68
59
|
function defineLayerStyles(definition) {
|
|
69
|
-
|
|
60
|
+
return definition;
|
|
70
61
|
}
|
|
71
62
|
function defineStyles(definition) {
|
|
72
|
-
|
|
63
|
+
return definition;
|
|
73
64
|
}
|
|
74
65
|
function defineAnimationStyles(definition) {
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
defineConfig,
|
|
80
|
-
defineGlobalFontface,
|
|
81
|
-
defineGlobalStyles,
|
|
82
|
-
defineKeyframes,
|
|
83
|
-
defineLayerStyles,
|
|
84
|
-
defineParts,
|
|
85
|
-
definePattern,
|
|
86
|
-
definePlugin,
|
|
87
|
-
definePreset,
|
|
88
|
-
defineRecipe,
|
|
89
|
-
defineSemanticTokens,
|
|
90
|
-
defineSlotRecipe,
|
|
91
|
-
defineStyles,
|
|
92
|
-
defineTextStyles,
|
|
93
|
-
defineThemeContract,
|
|
94
|
-
defineThemeVariant,
|
|
95
|
-
defineTokens,
|
|
96
|
-
defineUtility
|
|
97
|
-
};
|
|
66
|
+
return definition;
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
export { defineAnimationStyles, defineConfig, defineGlobalFontface, defineGlobalStyles, defineKeyframes, defineLayerStyles, defineParts, definePattern, definePlugin, definePreset, defineRecipe, defineSemanticTokens, defineSlotRecipe, defineStyles, defineTextStyles, defineThemeContract, defineThemeVariant, defineTokens, defineUtility };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as p from "@clack/prompts";
|
|
2
|
+
//#region package.json
|
|
3
|
+
var name = "@bamboocss/dev";
|
|
4
|
+
var version = "1.11.2";
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/interactive.ts
|
|
7
|
+
const interactive = async () => {
|
|
8
|
+
p.intro(`bamboo v${version}`);
|
|
9
|
+
const initFlags = await p.group({
|
|
10
|
+
usePostcss: () => p.select({
|
|
11
|
+
message: "Would you like to use PostCSS ?",
|
|
12
|
+
initialValue: "yes",
|
|
13
|
+
options: [{
|
|
14
|
+
value: "yes",
|
|
15
|
+
label: "Yes"
|
|
16
|
+
}, {
|
|
17
|
+
value: "no",
|
|
18
|
+
label: "No"
|
|
19
|
+
}]
|
|
20
|
+
}),
|
|
21
|
+
useMjsExtension: () => p.select({
|
|
22
|
+
message: "Use the mjs extension ?",
|
|
23
|
+
initialValue: "yes",
|
|
24
|
+
options: [{
|
|
25
|
+
value: "yes",
|
|
26
|
+
label: "Yes"
|
|
27
|
+
}, {
|
|
28
|
+
value: "no",
|
|
29
|
+
label: "No"
|
|
30
|
+
}]
|
|
31
|
+
}),
|
|
32
|
+
jsxOptions: () => p.group({
|
|
33
|
+
styleProps: () => p.select({
|
|
34
|
+
message: "Would you like to use JSX Style Props ?",
|
|
35
|
+
initialValue: "yes",
|
|
36
|
+
options: [{
|
|
37
|
+
value: "yes",
|
|
38
|
+
label: "Yes"
|
|
39
|
+
}, {
|
|
40
|
+
value: "no",
|
|
41
|
+
label: "No"
|
|
42
|
+
}]
|
|
43
|
+
}),
|
|
44
|
+
jsxFramework: () => p.select({
|
|
45
|
+
message: "What JSX framework?",
|
|
46
|
+
initialValue: "react",
|
|
47
|
+
options: [
|
|
48
|
+
{
|
|
49
|
+
value: "react",
|
|
50
|
+
label: "React"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
value: "vue",
|
|
54
|
+
label: "Vue"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
value: "solid",
|
|
58
|
+
label: "Solid"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
value: "qwik",
|
|
62
|
+
label: "Qwik"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
})
|
|
66
|
+
}),
|
|
67
|
+
whatSyntax: () => p.select({
|
|
68
|
+
message: "What css syntax would you like to use?",
|
|
69
|
+
initialValue: "object",
|
|
70
|
+
options: [{
|
|
71
|
+
value: "object-literal",
|
|
72
|
+
label: "Object"
|
|
73
|
+
}, {
|
|
74
|
+
value: "template-literal",
|
|
75
|
+
label: "Template literal"
|
|
76
|
+
}]
|
|
77
|
+
}),
|
|
78
|
+
withStrictTokens: () => p.select({
|
|
79
|
+
message: "Use strict tokens to enforce full type-safety?",
|
|
80
|
+
initialValue: "no",
|
|
81
|
+
options: [{
|
|
82
|
+
value: "yes",
|
|
83
|
+
label: "Yes"
|
|
84
|
+
}, {
|
|
85
|
+
value: "no",
|
|
86
|
+
label: "No"
|
|
87
|
+
}]
|
|
88
|
+
}),
|
|
89
|
+
shouldUpdateGitignore: () => p.select({
|
|
90
|
+
message: "Update gitignore?",
|
|
91
|
+
initialValue: "yes",
|
|
92
|
+
options: [{
|
|
93
|
+
value: "yes",
|
|
94
|
+
label: "Yes"
|
|
95
|
+
}, {
|
|
96
|
+
value: "no",
|
|
97
|
+
label: "No"
|
|
98
|
+
}]
|
|
99
|
+
})
|
|
100
|
+
}, { onCancel: () => {
|
|
101
|
+
p.cancel("Operation cancelled.");
|
|
102
|
+
process.exit(0);
|
|
103
|
+
} });
|
|
104
|
+
p.outro("Let's get started! 🐼");
|
|
105
|
+
return {
|
|
106
|
+
postcss: initFlags.usePostcss === "yes",
|
|
107
|
+
outExtension: initFlags.useMjsExtension === "yes" ? "mjs" : "js",
|
|
108
|
+
jsxFramework: initFlags.jsxOptions.jsxFramework,
|
|
109
|
+
syntax: initFlags.whatSyntax,
|
|
110
|
+
strictTokens: initFlags.withStrictTokens === "yes",
|
|
111
|
+
gitignore: initFlags.shouldUpdateGitignore === "yes"
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
//#endregion
|
|
115
|
+
export { name as n, version as r, interactive as t };
|