@rokkit/unocss 1.0.0-next.128

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.
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Merge user configuration with defaults.
3
+ *
4
+ * @param {Partial<typeof DEFAULT_CONFIG>} [userConfig={}]
5
+ * @returns {typeof DEFAULT_CONFIG}
6
+ */
7
+ export function loadConfig(userConfig?: Partial<typeof DEFAULT_CONFIG>): typeof DEFAULT_CONFIG;
8
+ export namespace DEFAULT_CONFIG {
9
+ namespace colors {
10
+ let primary: string;
11
+ let secondary: string;
12
+ let accent: string;
13
+ let surface: string;
14
+ let success: string;
15
+ let warning: string;
16
+ let danger: string;
17
+ let error: string;
18
+ let info: string;
19
+ }
20
+ let skins: {};
21
+ let themes: string[];
22
+ namespace icons {
23
+ let app: string;
24
+ }
25
+ let switcher: string;
26
+ let storageKey: string;
27
+ }
@@ -0,0 +1,2 @@
1
+ export { presetRokkit } from "./preset";
2
+ export { loadConfig } from "./config.js";
@@ -0,0 +1,2 @@
1
+ import type { Preset } from 'unocss';
2
+ export declare function presetRokkit(options?: {}): Preset;
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@rokkit/unocss",
3
+ "version": "1.0.0-next.128",
4
+ "description": "UnoCSS preset for Rokkit — one-line setup for colors, shortcuts, icons, and dark mode.",
5
+ "author": "Jerry Thomas <me@jerrythomas.name>",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "scripts": {
12
+ "prepublishOnly": "bunx tsc --project tsconfig.build.json",
13
+ "clean": "rm -rf dist",
14
+ "build": "bun clean && bun prepublishOnly"
15
+ },
16
+ "files": [
17
+ "src/**/*.js",
18
+ "dist/**/*.d.ts",
19
+ "README.md",
20
+ "package.json"
21
+ ],
22
+ "exports": {
23
+ "./package.json": "./package.json",
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "import": "./src/index.js"
27
+ }
28
+ },
29
+ "dependencies": {
30
+ "@rokkit/core": "1.0.0-next.128",
31
+ "@rokkit/icons": "1.0.0-next.128",
32
+ "@unocss/extractor-svelte": "^66.6.1",
33
+ "unocss": "^66.6.1"
34
+ }
35
+ }
package/src/config.js ADDED
@@ -0,0 +1,47 @@
1
+ import { DEFAULT_THEME_MAPPING } from '@rokkit/core'
2
+
3
+ export const DEFAULT_CONFIG = {
4
+ colors: {
5
+ primary: DEFAULT_THEME_MAPPING.primary,
6
+ secondary: DEFAULT_THEME_MAPPING.secondary,
7
+ accent: DEFAULT_THEME_MAPPING.accent,
8
+ surface: DEFAULT_THEME_MAPPING.surface,
9
+ success: DEFAULT_THEME_MAPPING.success,
10
+ warning: DEFAULT_THEME_MAPPING.warning,
11
+ danger: DEFAULT_THEME_MAPPING.danger,
12
+ error: DEFAULT_THEME_MAPPING.error,
13
+ info: DEFAULT_THEME_MAPPING.info
14
+ },
15
+ skins: {},
16
+ themes: ['rokkit'],
17
+ icons: {
18
+ app: '@rokkit/icons/app.json'
19
+ },
20
+ switcher: 'manual',
21
+ storageKey: 'rokkit-theme'
22
+ }
23
+
24
+ const KNOWN_KEYS = new Set(Object.keys(DEFAULT_CONFIG))
25
+
26
+ /**
27
+ * Merge user configuration with defaults.
28
+ *
29
+ * @param {Partial<typeof DEFAULT_CONFIG>} [userConfig={}]
30
+ * @returns {typeof DEFAULT_CONFIG}
31
+ */
32
+ export function loadConfig(userConfig = {}) {
33
+ const result = {
34
+ colors: { ...DEFAULT_CONFIG.colors, ...userConfig.colors },
35
+ skins: userConfig.skins ?? DEFAULT_CONFIG.skins,
36
+ themes: userConfig.themes ?? DEFAULT_CONFIG.themes,
37
+ icons: { ...DEFAULT_CONFIG.icons, ...userConfig.icons },
38
+ switcher: userConfig.switcher ?? DEFAULT_CONFIG.switcher,
39
+ storageKey: userConfig.storageKey ?? DEFAULT_CONFIG.storageKey
40
+ }
41
+
42
+ for (const key of Object.keys(result)) {
43
+ if (!KNOWN_KEYS.has(key)) delete result[key]
44
+ }
45
+
46
+ return result
47
+ }
package/src/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { presetRokkit } from './preset'
2
+ export { loadConfig } from './config.js'