@kbach/ui 0.1.0-beta.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/package.json ADDED
@@ -0,0 +1,104 @@
1
+ {
2
+ "name": "@kbach/ui",
3
+ "version": "0.1.0-beta.0",
4
+ "description": "Tailwind-like utility classes and components for React — web, React Native, and Expo",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/semsakadanupol/kbach.git",
9
+ "directory": "packages/ui"
10
+ },
11
+ "homepage": "https://github.com/semsakadanupol/kbach#readme",
12
+ "bugs": "https://github.com/semsakadanupol/kbach/issues",
13
+ "source": "./src/index.ts",
14
+ "main": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "source": "./src/index.ts",
20
+ "import": "./dist/index.mjs",
21
+ "require": "./dist/index.js"
22
+ },
23
+ "./jsx-runtime": {
24
+ "types": "./dist/jsx-runtime.d.ts",
25
+ "source": "./src/jsx-runtime.tsx",
26
+ "import": "./dist/jsx-runtime.mjs",
27
+ "require": "./dist/jsx-runtime.js"
28
+ },
29
+ "./jsx-dev-runtime": {
30
+ "types": "./dist/jsx-dev-runtime.d.ts",
31
+ "source": "./src/jsx-dev-runtime.tsx",
32
+ "import": "./dist/jsx-dev-runtime.mjs",
33
+ "require": "./dist/jsx-dev-runtime.js"
34
+ },
35
+ "./types": {
36
+ "types": "./types.d.ts"
37
+ },
38
+ "./vite": {
39
+ "types": "./dist/vite-plugin.d.ts",
40
+ "source": "./src/vite-plugin.ts",
41
+ "import": "./dist/vite-plugin.mjs",
42
+ "require": "./dist/vite-plugin.js"
43
+ },
44
+ "./native": {
45
+ "types": "./dist/native.d.ts",
46
+ "source": "./src/native/index.ts",
47
+ "import": "./dist/native.js",
48
+ "require": "./dist/native.js"
49
+ },
50
+ "./babel": "./src/native/babel/index.js",
51
+ "./babel-plugin": "./src/native/babel-plugin/index.js"
52
+ },
53
+ "scripts": {
54
+ "build": "tsup",
55
+ "dev": "tsup --watch",
56
+ "test": "vitest run --passWithNoTests",
57
+ "lint": "tsc --noEmit",
58
+ "postinstall": "node scripts/postinstall.js"
59
+ },
60
+ "devDependencies": {
61
+ "@babel/core": "^7.29.7",
62
+ "@testing-library/react": "^16.3.2",
63
+ "@types/node": "^20.19.42",
64
+ "@types/react": "^19.2.0",
65
+ "@types/react-dom": "^19.2.4",
66
+ "jsdom": "^30.0.1",
67
+ "react-dom": "^19.2.3",
68
+ "tsup": "^8.0.0",
69
+ "vite": "^5.4.21",
70
+ "vitest": "^1.0.0"
71
+ },
72
+ "peerDependencies": {
73
+ "@babel/core": "^7.0.0",
74
+ "react": ">=18.0.0",
75
+ "react-native": ">=0.70.0",
76
+ "vite": ">=4.0.0"
77
+ },
78
+ "peerDependenciesMeta": {
79
+ "@babel/core": {
80
+ "optional": true
81
+ },
82
+ "react-native": {
83
+ "optional": true
84
+ },
85
+ "vite": {
86
+ "optional": true
87
+ }
88
+ },
89
+ "publishConfig": {
90
+ "access": "public"
91
+ },
92
+ "files": [
93
+ "dist",
94
+ "scripts",
95
+ "src/native/babel-plugin",
96
+ "src/native/babel",
97
+ "types.d.ts",
98
+ "jsx-runtime.js",
99
+ "jsx-dev-runtime.js",
100
+ "kbach-ui.md",
101
+ "KBACH.md",
102
+ "README.md"
103
+ ]
104
+ }
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+
7
+ // INIT_CWD is set by npm to the directory where `npm install` was invoked —
8
+ // i.e. the user's project root. It is not set during a local `npm pack` / publish run.
9
+ const projectRoot = process.env.INIT_CWD;
10
+ if (!projectRoot) process.exit(0);
11
+
12
+ // Safety: never write outside the user's project (e.g. if somehow inside node_modules)
13
+ if (projectRoot.includes('node_modules')) process.exit(0);
14
+
15
+ // Don't overwrite an existing file — user may have customised it.
16
+ const dest = path.join(projectRoot, 'KBACH.md');
17
+ if (fs.existsSync(dest)) process.exit(0);
18
+
19
+ // The reference file ships alongside this script inside the npm package.
20
+ const src = path.join(__dirname, '..', 'KBACH.md');
21
+ if (!fs.existsSync(src)) process.exit(0);
22
+
23
+ try {
24
+ fs.copyFileSync(src, dest);
25
+ console.log('[kbach] Created KBACH.md in your project — AI reference for all Kbach utilities and modifiers.');
26
+ } catch {
27
+ // Never break an install over a doc file.
28
+ }
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @kbach/ui/babel — Babel preset (NativeWind-style).
5
+ *
6
+ * babel.config.js:
7
+ * ```js
8
+ * module.exports = function(api) {
9
+ * api.cache(true);
10
+ * return {
11
+ * presets: [
12
+ * 'babel-preset-expo',
13
+ * '@kbach/ui/babel',
14
+ * ],
15
+ * };
16
+ * };
17
+ * ```
18
+ *
19
+ * Presets run in reverse order, so this preset's plugin runs BEFORE
20
+ * babel-preset-expo's JSX transform — which is the correct ordering:
21
+ * kbach renames className/tw attributes first, then the JSX transform
22
+ * compiles JSX using @kbach/ui/jsx-runtime.
23
+ */
24
+ module.exports = function kbachBabelPreset(api, options = {}) {
25
+ return {
26
+ plugins: [
27
+ [require('../babel-plugin'), options],
28
+ ],
29
+ };
30
+ };