@kokimoki/kit 1.0.0
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/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/kokimoki-kit-plugin.d.ts +2 -0
- package/dist/kokimoki-kit-plugin.js +84 -0
- package/dist/preprocess-style.d.ts +32 -0
- package/dist/preprocess-style.js +362 -0
- package/package.json +25 -0
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
import ObjectId from "bson-objectid";
|
2
|
+
import fs from "fs/promises";
|
3
|
+
import { preprocessStyle } from "./preprocess-style";
|
4
|
+
export const kokimokiKitPlugin = () => {
|
5
|
+
return {
|
6
|
+
name: "kokimoki-kit",
|
7
|
+
async transform(code, id) {
|
8
|
+
if (id.endsWith("kokimoki.style.css")) {
|
9
|
+
return preprocessStyle(code);
|
10
|
+
}
|
11
|
+
return code;
|
12
|
+
},
|
13
|
+
async transformIndexHtml(html) {
|
14
|
+
// NOTE: Try https://github.com/jsdom/jsdom instead of regex parsing
|
15
|
+
if (process.env.NODE_ENV !== "development") {
|
16
|
+
return html
|
17
|
+
.replace("<head>", `<head>
|
18
|
+
<base href="%KM_BASE%">
|
19
|
+
<script id="kokimoki-env" type="application/json">
|
20
|
+
{
|
21
|
+
"dev": %KM_DEV%,
|
22
|
+
"test": %KM_TEST%,
|
23
|
+
"host": "%KM_HOST%",
|
24
|
+
"appId": "%KM_APP_ID%",
|
25
|
+
"code": "%KM_CODE%",
|
26
|
+
"clientContext": "%KM_CLIENT_CONTEXT%",
|
27
|
+
"config": "%KM_CONFIG%",
|
28
|
+
"base": "%KM_BASE%",
|
29
|
+
"assets": "%KM_ASSETS%"
|
30
|
+
}
|
31
|
+
</script>
|
32
|
+
<script>
|
33
|
+
window.__toAssetsUrl = (path) => "%KM_ASSETS%/" + path;
|
34
|
+
</script>
|
35
|
+
`)
|
36
|
+
.replace(/<link.*?href="(.*?)".*?>/g, (match, p1) => {
|
37
|
+
return match.replace(p1, `%KM_ASSETS%${p1.startsWith("/") ? "" : "/"}${p1}`);
|
38
|
+
})
|
39
|
+
.replace(/<script.*?src="(.*?)".*?>/g, (match, p1) => {
|
40
|
+
return match.replace(p1, `%KM_ASSETS%${p1.startsWith("/") ? "" : "/"}${p1}`);
|
41
|
+
});
|
42
|
+
}
|
43
|
+
// Ensure .kokimoki directory exists
|
44
|
+
try {
|
45
|
+
await fs.mkdir(".kokimoki");
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
47
|
+
}
|
48
|
+
catch (e) {
|
49
|
+
if (e?.code !== "EEXIST") {
|
50
|
+
throw e;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
// Try to read the app id from the .kokimoki/app-id file
|
54
|
+
let appId;
|
55
|
+
try {
|
56
|
+
appId = await fs.readFile(".kokimoki/app-id", "utf8");
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
58
|
+
}
|
59
|
+
catch (e) {
|
60
|
+
if (e?.code !== "ENOENT") {
|
61
|
+
throw e;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
// If the app id doesn't exist, generate a new one
|
65
|
+
if (!appId) {
|
66
|
+
appId = new ObjectId().toHexString();
|
67
|
+
await fs.writeFile(".kokimoki/app-id", appId);
|
68
|
+
}
|
69
|
+
// Inject the app id into the index.html
|
70
|
+
html = html.replace("<head>", `<head>
|
71
|
+
<script id="kokimoki-env" type="application/json">
|
72
|
+
{
|
73
|
+
"dev": true,
|
74
|
+
"test": true,
|
75
|
+
"host": "y-wss.kokimoki.com",
|
76
|
+
"appId": "${appId}",
|
77
|
+
"base": "/",
|
78
|
+
"assets": "/"
|
79
|
+
}
|
80
|
+
</script>`);
|
81
|
+
return html;
|
82
|
+
},
|
83
|
+
};
|
84
|
+
};
|
@@ -0,0 +1,32 @@
|
|
1
|
+
export type Palette = {
|
2
|
+
[key: number]: {
|
3
|
+
/** The hex color. */
|
4
|
+
hex: string;
|
5
|
+
/** The RGB color. */
|
6
|
+
rgb: string;
|
7
|
+
/** The overlapping text/fill color. */
|
8
|
+
on: string;
|
9
|
+
};
|
10
|
+
};
|
11
|
+
type Rgb = {
|
12
|
+
r: number;
|
13
|
+
g: number;
|
14
|
+
b: number;
|
15
|
+
};
|
16
|
+
export declare function hexToRgb(hex: string): Rgb | null;
|
17
|
+
export declare function rgbToHex(r: number, g: number, b: number): string;
|
18
|
+
export declare function revertReplaceForColorPickers(code: string): string;
|
19
|
+
export declare function hexToTailwindRgbString(hex: string): string;
|
20
|
+
/** Takes the RGB and returns the luminance of it */
|
21
|
+
export declare function getLuminance(r: Rgb): number;
|
22
|
+
export declare function getLuminance(r: number, g: number, b: number): number;
|
23
|
+
export declare function calculateRatio(luminance1: string | number, luminance2: string | number): number;
|
24
|
+
export declare function handleStringColor(colorString: string): Rgb;
|
25
|
+
export declare function handleStringColor(colorString: string, returnType: "rgb"): Rgb;
|
26
|
+
export declare function handleStringColor(colorString: string, returnType: "hex"): string;
|
27
|
+
export declare function handleStringColor(colorString: string, returnType?: "hex" | "rgb"): string | Rgb;
|
28
|
+
export declare function destringRgb(rgbString: string): Rgb;
|
29
|
+
export declare function generateA11yOnColor(hex: string): "255 255 255" | "0 0 0";
|
30
|
+
export declare function generatePalette(baseColor: string): Palette;
|
31
|
+
export declare function preprocessStyle(code: string): string;
|
32
|
+
export {};
|
@@ -0,0 +1,362 @@
|
|
1
|
+
import colorNameToHex from "colornames";
|
2
|
+
import Color from "colorjs.io";
|
3
|
+
// List of rgb tuple variable names (possibly temporary system to support color picker for these variables)
|
4
|
+
const rgbTupleVariableNames = [
|
5
|
+
"theme-font-color-base",
|
6
|
+
"theme-font-color-dark",
|
7
|
+
"theme-rounded-base",
|
8
|
+
"theme-rounded-container",
|
9
|
+
"theme-border-base",
|
10
|
+
"on-primary",
|
11
|
+
"on-secondary",
|
12
|
+
"on-tertiary",
|
13
|
+
"on-success",
|
14
|
+
"on-warning",
|
15
|
+
"on-error",
|
16
|
+
"on-surface",
|
17
|
+
"color-primary-50",
|
18
|
+
"color-primary-100",
|
19
|
+
"color-primary-200",
|
20
|
+
"color-primary-300",
|
21
|
+
"color-primary-400",
|
22
|
+
"color-primary-500",
|
23
|
+
"color-primary-600",
|
24
|
+
"color-primary-700",
|
25
|
+
"color-primary-800",
|
26
|
+
"color-primary-900",
|
27
|
+
"color-secondary-50",
|
28
|
+
"color-secondary-100",
|
29
|
+
"color-secondary-200",
|
30
|
+
"color-secondary-300",
|
31
|
+
"color-secondary-400",
|
32
|
+
"color-secondary-500",
|
33
|
+
"color-secondary-600",
|
34
|
+
"color-secondary-700",
|
35
|
+
"color-secondary-800",
|
36
|
+
"color-secondary-900",
|
37
|
+
"color-tertiary-50",
|
38
|
+
"color-tertiary-100",
|
39
|
+
"color-tertiary-200",
|
40
|
+
"color-tertiary-300",
|
41
|
+
"color-tertiary-400",
|
42
|
+
"color-tertiary-500",
|
43
|
+
"color-tertiary-600",
|
44
|
+
"color-tertiary-700",
|
45
|
+
"color-tertiary-800",
|
46
|
+
"color-tertiary-900",
|
47
|
+
"color-success-50",
|
48
|
+
"color-success-100",
|
49
|
+
"color-success-200",
|
50
|
+
"color-success-300",
|
51
|
+
"color-success-400",
|
52
|
+
"color-success-500",
|
53
|
+
"color-success-600",
|
54
|
+
"color-success-700",
|
55
|
+
"color-success-800",
|
56
|
+
"color-success-900",
|
57
|
+
"color-warning-50",
|
58
|
+
"color-warning-100",
|
59
|
+
"color-warning-200",
|
60
|
+
"color-warning-300",
|
61
|
+
"color-warning-400",
|
62
|
+
"color-warning-500",
|
63
|
+
"color-warning-600",
|
64
|
+
"color-warning-700",
|
65
|
+
"color-warning-800",
|
66
|
+
"color-warning-900",
|
67
|
+
"color-error-50",
|
68
|
+
"color-error-100",
|
69
|
+
"color-error-200",
|
70
|
+
"color-error-300",
|
71
|
+
"color-error-400",
|
72
|
+
"color-error-500",
|
73
|
+
"color-error-600",
|
74
|
+
"color-error-700",
|
75
|
+
"color-error-800",
|
76
|
+
"color-error-900",
|
77
|
+
"color-surface-50",
|
78
|
+
"color-surface-100",
|
79
|
+
"color-surface-200",
|
80
|
+
"color-surface-300",
|
81
|
+
"color-surface-400",
|
82
|
+
"color-surface-500",
|
83
|
+
"color-surface-600",
|
84
|
+
"color-surface-700",
|
85
|
+
"color-surface-800",
|
86
|
+
"color-surface-900",
|
87
|
+
];
|
88
|
+
export function hexToRgb(hex) {
|
89
|
+
const sanitizedHex = hex.replace(/##/g, "#");
|
90
|
+
const colorParts = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(sanitizedHex);
|
91
|
+
if (!colorParts)
|
92
|
+
return null;
|
93
|
+
const [, r, g, b] = colorParts;
|
94
|
+
return {
|
95
|
+
r: parseInt(r, 16),
|
96
|
+
g: parseInt(g, 16),
|
97
|
+
b: parseInt(b, 16),
|
98
|
+
};
|
99
|
+
}
|
100
|
+
export function rgbToHex(r, g, b) {
|
101
|
+
const toHex = (c) => `0${c.toString(16)}`.slice(-2);
|
102
|
+
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
103
|
+
}
|
104
|
+
// export function replaceForColorPickers(code: string) {
|
105
|
+
// return code.replace(
|
106
|
+
// /--([a-z0-9-]+):\s*(\d+)\s+(\d+)\s+(\d+);/gi,
|
107
|
+
// (match, name, r, g, b) => {
|
108
|
+
// if (!rgbTupleVariableNames.includes(name)) return match;
|
109
|
+
// return `--${name}: ${rgbToHex(Number(r), Number(g), Number(b))};`;
|
110
|
+
// }
|
111
|
+
// );
|
112
|
+
// }
|
113
|
+
export function revertReplaceForColorPickers(code) {
|
114
|
+
return code.replace(/--([a-z0-9-]+):(.*?);/gi, (match, name, value) => {
|
115
|
+
if (!rgbTupleVariableNames.includes(name))
|
116
|
+
return match;
|
117
|
+
value = value.trim();
|
118
|
+
if (value.startsWith("#")) {
|
119
|
+
const rgb = hexToRgb(value);
|
120
|
+
if (rgb)
|
121
|
+
return `--${name}: ${rgb.r} ${rgb.g} ${rgb.b};`;
|
122
|
+
}
|
123
|
+
if (value.startsWith("rgb")) {
|
124
|
+
const [r, g, b] = value
|
125
|
+
.replace("rgb(", "")
|
126
|
+
.replace(")", "")
|
127
|
+
.split(",")
|
128
|
+
.map((x) => x.trim());
|
129
|
+
return `--${name}: ${r} ${g} ${b};`;
|
130
|
+
}
|
131
|
+
const hex = colorNameToHex(value);
|
132
|
+
if (hex) {
|
133
|
+
const rgb = hexToRgb(hex);
|
134
|
+
if (rgb)
|
135
|
+
return `--${name}: ${rgb.r} ${rgb.g} ${rgb.b};`;
|
136
|
+
}
|
137
|
+
return match;
|
138
|
+
});
|
139
|
+
}
|
140
|
+
function lighten(hex, intensity) {
|
141
|
+
const color = hexToRgb(`#${hex}`);
|
142
|
+
if (!color)
|
143
|
+
return "";
|
144
|
+
const r = Math.round(color.r + (255 - color.r) * intensity);
|
145
|
+
const g = Math.round(color.g + (255 - color.g) * intensity);
|
146
|
+
const b = Math.round(color.b + (255 - color.b) * intensity);
|
147
|
+
return rgbToHex(r, g, b);
|
148
|
+
}
|
149
|
+
function darken(hex, intensity) {
|
150
|
+
const color = hexToRgb(hex);
|
151
|
+
if (!color)
|
152
|
+
return "";
|
153
|
+
const r = Math.round(color.r * intensity);
|
154
|
+
const g = Math.round(color.g * intensity);
|
155
|
+
const b = Math.round(color.b * intensity);
|
156
|
+
return rgbToHex(r, g, b);
|
157
|
+
}
|
158
|
+
export function hexToTailwindRgbString(hex) {
|
159
|
+
const sanitizedHex = hex.replace(/##/g, "#");
|
160
|
+
const colorParts = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(sanitizedHex);
|
161
|
+
if (!colorParts)
|
162
|
+
return "(invalid)";
|
163
|
+
const [, r, g, b] = colorParts;
|
164
|
+
return `${parseInt(r, 16)} ${parseInt(g, 16)} ${parseInt(b, 16)}`;
|
165
|
+
}
|
166
|
+
export function getLuminance(r, g, b) {
|
167
|
+
const { _r, _g, _b } = typeof r === "object"
|
168
|
+
? { _r: r.r, _g: r.g, _b: r.b }
|
169
|
+
: { _r: r, _g: g, _b: b }; // I'm not really happy with this ternary, but it works
|
170
|
+
// we can't use !_r shorthand here because 0 is a valid value
|
171
|
+
if (_r === undefined || _g === undefined || _b === undefined)
|
172
|
+
throw new Error("Invalid RGB value!");
|
173
|
+
const a = [_r, _g, _b].map(function (v) {
|
174
|
+
v /= 255;
|
175
|
+
return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
|
176
|
+
});
|
177
|
+
return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;
|
178
|
+
}
|
179
|
+
export function calculateRatio(luminance1, luminance2) {
|
180
|
+
const lum1 = typeof luminance1 === "string"
|
181
|
+
? getLuminance(handleStringColor(luminance1))
|
182
|
+
: luminance1;
|
183
|
+
const lum2 = typeof luminance2 === "string"
|
184
|
+
? getLuminance(handleStringColor(luminance2))
|
185
|
+
: luminance2;
|
186
|
+
if (lum1 === undefined || lum2 === undefined)
|
187
|
+
throw new Error("Luminance is undefined!");
|
188
|
+
return lum1 > lum2
|
189
|
+
? (lum2 + 0.05) / (lum1 + 0.05)
|
190
|
+
: (lum1 + 0.05) / (lum2 + 0.05);
|
191
|
+
}
|
192
|
+
export function handleStringColor(colorString, returnType = "rgb") {
|
193
|
+
// if it's a css variable
|
194
|
+
if (colorString.includes("--")) {
|
195
|
+
colorString = colorString.replace(/var\(|\)/g, ""); // grab just the variable name
|
196
|
+
const cssVarHydrated = getComputedStyle(document.documentElement)
|
197
|
+
.getPropertyValue(colorString)
|
198
|
+
.trim();
|
199
|
+
return handleStringColor(cssVarHydrated, returnType);
|
200
|
+
}
|
201
|
+
// if it has spaces, it's an rgb string
|
202
|
+
if (colorString.includes(" ")) {
|
203
|
+
const rgb = destringRgb(colorString);
|
204
|
+
return returnType === "hex" ? rgbToHex(rgb.r, rgb.g, rgb.b) : rgb;
|
205
|
+
}
|
206
|
+
// if it's a hex string
|
207
|
+
if (colorString.includes("#")) {
|
208
|
+
const rgb = hexToRgb(colorString);
|
209
|
+
if (!rgb)
|
210
|
+
return "(invalid)";
|
211
|
+
return returnType === "hex" ? colorString : rgb;
|
212
|
+
}
|
213
|
+
return colorString;
|
214
|
+
}
|
215
|
+
function cssColorToHex(colorString) {
|
216
|
+
if (colorString.includes("#"))
|
217
|
+
return colorString;
|
218
|
+
if (colorString.includes("rgb")) {
|
219
|
+
const [r, g, b] = colorString
|
220
|
+
.replace("rgb(", "")
|
221
|
+
.replace(")", "")
|
222
|
+
.split(",")
|
223
|
+
.map((x) => x.trim());
|
224
|
+
return rgbToHex(Number(r), Number(g), Number(b));
|
225
|
+
}
|
226
|
+
const hex = colorNameToHex(colorString);
|
227
|
+
if (hex)
|
228
|
+
return hex;
|
229
|
+
return "#000000";
|
230
|
+
}
|
231
|
+
export function destringRgb(rgbString) {
|
232
|
+
const rgb = rgbString.match(/(\d+),?\s*(\d+),?\s*(\d+)/); // matches "255, 255, 255" and "255 255 255"
|
233
|
+
if (!rgb)
|
234
|
+
throw new Error("Invalid RGB string!");
|
235
|
+
return {
|
236
|
+
r: parseInt(rgb[1], 10),
|
237
|
+
g: parseInt(rgb[2], 10),
|
238
|
+
b: parseInt(rgb[3], 10),
|
239
|
+
};
|
240
|
+
}
|
241
|
+
export function generateA11yOnColor(hex) {
|
242
|
+
const black = calculateRatio(hex, "#000000");
|
243
|
+
const white = calculateRatio(hex, "#FFFFFF");
|
244
|
+
return black < white ? "0 0 0" : "255 255 255";
|
245
|
+
}
|
246
|
+
export function generatePalette(baseColor) {
|
247
|
+
const hexValidation = new RegExp(/^#[0-9a-f]{6}$/i);
|
248
|
+
if (!hexValidation.test(baseColor))
|
249
|
+
baseColor = "#CCCCCC";
|
250
|
+
const hex500 = `#${baseColor}`.replace("##", "#");
|
251
|
+
const response = {
|
252
|
+
500: {
|
253
|
+
hex: hex500,
|
254
|
+
rgb: hexToTailwindRgbString(hex500),
|
255
|
+
on: generateA11yOnColor(hex500),
|
256
|
+
},
|
257
|
+
};
|
258
|
+
const intensityMap = {
|
259
|
+
50: 0.85,
|
260
|
+
100: 0.8,
|
261
|
+
200: 0.75,
|
262
|
+
300: 0.6,
|
263
|
+
400: 0.3,
|
264
|
+
600: 0.9,
|
265
|
+
700: 0.75,
|
266
|
+
800: 0.6,
|
267
|
+
900: 0.49,
|
268
|
+
};
|
269
|
+
[50, 100, 200, 300, 400].forEach((level) => {
|
270
|
+
const hex = lighten(baseColor, intensityMap[level]);
|
271
|
+
response[level] = {
|
272
|
+
hex,
|
273
|
+
rgb: hexToTailwindRgbString(hex),
|
274
|
+
on: generateA11yOnColor(hex),
|
275
|
+
};
|
276
|
+
});
|
277
|
+
[600, 700, 800, 900].forEach((level) => {
|
278
|
+
const hex = darken(baseColor, intensityMap[level]);
|
279
|
+
response[level] = {
|
280
|
+
hex,
|
281
|
+
rgb: hexToTailwindRgbString(hex),
|
282
|
+
on: generateA11yOnColor(hex),
|
283
|
+
};
|
284
|
+
});
|
285
|
+
return response;
|
286
|
+
}
|
287
|
+
function preprocessGfcThemeBlock(code) {
|
288
|
+
// Generate map of defined css variables
|
289
|
+
const cssVariableMap = {};
|
290
|
+
const cssVariableRegex = /--([a-z0-9-]+):\s*(.*?);/gi;
|
291
|
+
let match;
|
292
|
+
while ((match = cssVariableRegex.exec(code))) {
|
293
|
+
cssVariableMap[match[1]] = {
|
294
|
+
hex: cssColorToHex(match[2]),
|
295
|
+
match: match[0],
|
296
|
+
};
|
297
|
+
}
|
298
|
+
// Generate palette for missing color variables
|
299
|
+
const paletteNames = [
|
300
|
+
"primary",
|
301
|
+
"secondary",
|
302
|
+
"tertiary",
|
303
|
+
"success",
|
304
|
+
"warning",
|
305
|
+
"error",
|
306
|
+
"surface",
|
307
|
+
];
|
308
|
+
for (const paletteName of paletteNames) {
|
309
|
+
const paletteVariableName = `color-${paletteName}`;
|
310
|
+
if (!cssVariableMap[paletteVariableName])
|
311
|
+
continue;
|
312
|
+
const palette = generatePalette(cssVariableMap[paletteVariableName].hex);
|
313
|
+
let replacement = "";
|
314
|
+
if (!cssVariableMap[`on-${paletteName}`]) {
|
315
|
+
replacement += `--on-${paletteName}: ${palette["500"].on};\n`;
|
316
|
+
}
|
317
|
+
for (const [level, color] of Object.entries(palette)) {
|
318
|
+
const variableName = `${paletteVariableName}-${level}`;
|
319
|
+
if (!cssVariableMap[variableName]) {
|
320
|
+
replacement += `--${variableName}: ${color.hex};\n`;
|
321
|
+
}
|
322
|
+
}
|
323
|
+
code = code.replace(cssVariableMap[paletteVariableName].match, replacement);
|
324
|
+
}
|
325
|
+
// Replace hex values to rgb tuples for skeleton system
|
326
|
+
code = revertReplaceForColorPickers(code);
|
327
|
+
return code;
|
328
|
+
}
|
329
|
+
function preprocessDaisyThemeBlock(code) {
|
330
|
+
const variableRegex = /--(p|pc|b1|bc|b2|er|erc|su|suc|s|sc|a|ac):\s*(.*?);/gi;
|
331
|
+
return code.replace(variableRegex, (_, name, value) => {
|
332
|
+
try {
|
333
|
+
const oklch = new Color(value).to("oklch");
|
334
|
+
const [l, c, h] = oklch.coords;
|
335
|
+
const lStr = (l * 100).toFixed(1);
|
336
|
+
const cStr = c.toFixed(3);
|
337
|
+
const hStr = (h || 0).toFixed(1); // h can be NaN for achromatic colors
|
338
|
+
return `--${name}: ${lStr}% ${cStr} ${hStr};`;
|
339
|
+
}
|
340
|
+
catch (e) {
|
341
|
+
// unable to parse color
|
342
|
+
return `--${name}: ${value};`;
|
343
|
+
}
|
344
|
+
});
|
345
|
+
}
|
346
|
+
export function preprocessStyle(code) {
|
347
|
+
// Find and replace [data-theme] block contents
|
348
|
+
const themeBlockRegex = /\[data-theme=(?:"|')?(gfc|gfc-theme|mac-theme|consensus-theme|daisy-light|daisy-dark)(?:"|')?\]\s*{([\s\S]*?)}/gi;
|
349
|
+
return code.replace(themeBlockRegex, (_, theme, block) => {
|
350
|
+
switch (theme) {
|
351
|
+
case "gfc":
|
352
|
+
case "gfc-theme":
|
353
|
+
case "mac-theme":
|
354
|
+
case "consensus-theme":
|
355
|
+
return `[data-theme="${theme}"] {${preprocessGfcThemeBlock(block)}}`;
|
356
|
+
case "daisy-light":
|
357
|
+
return `[data-theme="light"] {${preprocessDaisyThemeBlock(block)}}`;
|
358
|
+
case "daisy-dark":
|
359
|
+
return `[data-theme="dark"] {${preprocessDaisyThemeBlock(block)}}`;
|
360
|
+
}
|
361
|
+
});
|
362
|
+
}
|
package/package.json
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
{
|
2
|
+
"name": "@kokimoki/kit",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "",
|
5
|
+
"main": "dist/index.js",
|
6
|
+
"types": "dist/index.d.ts",
|
7
|
+
"files": [
|
8
|
+
"dist"
|
9
|
+
],
|
10
|
+
"scripts": {
|
11
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
12
|
+
"build": "tsc"
|
13
|
+
},
|
14
|
+
"author": "Loquiz OÜ",
|
15
|
+
"license": "Apache-2.0",
|
16
|
+
"devDependencies": {
|
17
|
+
"@types/colornames": "^1.1.4",
|
18
|
+
"vite": "^5.4.8"
|
19
|
+
},
|
20
|
+
"dependencies": {
|
21
|
+
"bson-objectid": "^2.0.4",
|
22
|
+
"colorjs.io": "^0.5.2",
|
23
|
+
"colornames": "^1.1.1"
|
24
|
+
}
|
25
|
+
}
|