phpxui 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. package/README.md +114 -36
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,46 +1,48 @@
1
- # **phpxui‑cli** — Instant PHPXUI Component Generator 🚀
1
+ # **phpxui‑cli** — Instant PHPXUI Component Generator 🚀
2
2
 
3
- > **Generate fully‑typed PHPXUI components for Prisma PHP right from the terminal.**
4
- > ⚡ **Single component**  `npx phpxui add Alert`   |   🌌 **Whole library**  `npx phpxui add --all`
3
+ > **Generate fully‑typed PHPXUI components for Prisma PHP right from the terminal.**
4
+ > ⚡ **Add one** `npx phpxui add Alert` | 🌌 **Add all** `npx phpxui add --all` | 🔁 **Update installed** → `npx phpxui update`
5
5
 
6
6
  ---
7
7
 
8
- ## ✨ Features
8
+ ## ✨ Features
9
9
 
10
- | Feature | Details |
11
- | --------------------- | ------------------------------------------------------------------------------------------------------------ |
12
- | **Bulk install** | `--all` downloads every component in one shot. |
13
- | **Ready‑to‑use code** | Each file already contains the `$class` merge logic and `{$attributes}` placeholder for **Wave** reactivity. |
14
- | **Clean paths** | Files are written under `src/Lib/PHPXUI/FancyName.php` with OS‑agnostic separators. |
15
- | **Friendly output** | Clear green / red summary with relative paths only. |
16
- | **Automatic icons** | Core **PPIcons** (`x`, `chevron‑down`, `chevron‑right`) are installed on the very first run. |
10
+ | Feature | Details |
11
+ | ---------------------- | ---------------------------------------------------------------------------------------------------------------- |
12
+ | **Bulk install** | `--all` downloads every component in one shot. |
13
+ | **Update in place** | `update` scans your `outputDir` and re‑downloads every installed component (overwrite). |
14
+ | **Ready‑to‑use code** | Each file already contains the `$class` merge logic and `{$attributes}` placeholder for **Wave** reactivity. |
15
+ | **Clean paths** | Files are written under `src/Lib/PHPXUI/FancyName.php` with OS‑agnostic separators. |
16
+ | **Friendly output** | Clear green / red summary with relative paths only. |
17
+ | **Automatic icons** | Core **PPIcons** (`x`, `chevron‑down`, `chevron‑right`, etc.) are installed on the very first run. |
18
+ | **Tailwind bootstrap** | Ensures `tw-animate-css` and (on first run / missing file) writes `src/app/globals.css` for a sensible baseline. |
17
19
 
18
20
  ---
19
21
 
20
- ## 📦 Installation
22
+ ## 📦 Installation
21
23
 
22
24
  ```bash
23
25
  # Global
24
26
  npm install -g phpxui
25
27
 
26
- # Or as a dev‑dependency
28
+ # Or as a dev‑dependency
27
29
  npm install -D phpxui
28
30
  ```
29
31
 
30
- > Requires **Node 18+** and a Prisma PHP project (PHP 8.2+).
32
+ > Requires **Node 18+** and a Prisma PHP project (PHP 8.2+).
31
33
 
32
34
  ---
33
35
 
34
- ## 🚀 Quick Start
36
+ ## 🚀 Quick Start
35
37
 
36
38
  ```bash
37
- # Add a single component
39
+ # Add a single component
38
40
  npx phpxui add Alert
39
41
 
40
- # Add multiple components at once
42
+ # Add multiple components at once
41
43
  npx phpxui add Alert Dialog Badge
42
44
 
43
- # Add the entire component set
45
+ # Add the entire component set
44
46
  npx phpxui add --all
45
47
  ```
46
48
 
@@ -68,11 +70,13 @@ class Alert extends PHPX
68
70
  {
69
71
  public function render(): string
70
72
  {
71
- $attributes = $this->getAttributes();
72
73
  $class = $this->getMergeClasses();
74
+ $attributes = $this->getAttributes([
75
+ 'class' => $class,
76
+ ]);
73
77
 
74
78
  return <<<HTML
75
- <div {$attributes} class="alert {$class}">
79
+ <div {$attributes}>
76
80
  {$this->children}
77
81
  </div>
78
82
  HTML;
@@ -82,19 +86,93 @@ class Alert extends PHPX
82
86
 
83
87
  ---
84
88
 
85
- ## 🔧 CLI Options
89
+ ## 🔁 Updating Components
86
90
 
87
- | Flag / Argument | Description |
88
- | --------------- | -------------------------------------------------------- |
89
- | `<component …>` | One or more component names separated by space or comma. |
90
- | `--all` | Download the full catalogue in one request. |
91
- | `--force` | Overwrite existing files. |
91
+ ### Update everything you already installed
92
+
93
+ ```bash
94
+ npx phpxui update
95
+ ```
96
+
97
+ What it does:
98
+
99
+ - Reads your `phpxui.json` (creates it if missing)
100
+ - Resolves your `outputDir` (default: `src/Lib/PHPXUI`)
101
+ - Scans that folder for `*.php` files (e.g. `Alert.php`, `Dialog.php`)
102
+ - Re-downloads each matching component from the PHPXUI catalogue
103
+ - **Overwrites files automatically** (no `--force` required)
104
+
105
+ If you have no generated components yet, it will report:
106
+
107
+ - `⚠ No components found to update.`
108
+
109
+ ### Update a single component (targeted)
110
+
111
+ If you only want to refresh one component, use `add` with `--force`:
112
+
113
+ ```bash
114
+ npx phpxui add Alert --force
115
+ ```
116
+
117
+ ---
118
+
119
+ ## 🔧 CLI Usage and Options
120
+
121
+ ```bash
122
+ phpxui <command> [--all] [--force] <component…>
123
+ ```
124
+
125
+ ### Commands
126
+
127
+ | Command | Purpose |
128
+ | -------- | ---------------------------------------------------------------------------- |
129
+ | `add` | Generate one or more components by name, or the full catalogue with `--all`. |
130
+ | `update` | Update **all installed** components found in `outputDir` (overwrites). |
131
+
132
+ ### Flags / Arguments
133
+
134
+ | Flag / Argument | Description |
135
+ | --------------- | ---------------------------------------------------------------------------- |
136
+ | `<component …>` | One or more component names separated by space (or comma). Applies to `add`. |
137
+ | `--all` | Download the full catalogue in one request. Applies to `add`. |
138
+ | `--force` | Overwrite existing files. Applies to `add`. |
92
139
 
93
140
  > **Note:** The CLI automatically installs a default set of core icons (such as `x`, `chevron-down`, `chevron-right`) on first use. Extra icons are not yet selectable via `phpxui` directly.
94
141
 
95
142
  ---
96
143
 
97
- ## 🎨 Using Additional Icons
144
+ ## 🧩 Configuration (phpxui.json)
145
+
146
+ On first run, **phpxui‑cli** creates a `phpxui.json` in your project root. The most important fields are:
147
+
148
+ - `outputDir`: where PHPXUI components are written (default: `src/Lib/PHPXUI`)
149
+ - `psr4`: mapping hints for components and icons
150
+ - `iconsInstalled`: internal flag to avoid reinstalling the default icon set
151
+ - `tailwind.css`: where the base CSS should live (default: `src/app/globals.css`)
152
+
153
+ Example:
154
+
155
+ ```json
156
+ {
157
+ "outputDir": "src/Lib/PHPXUI",
158
+ "iconsInstalled": false,
159
+ "tailwind": {
160
+ "css": "src/app/globals.css",
161
+ "baseColor": "neutral",
162
+ "cssVariables": true,
163
+ "prefix": ""
164
+ },
165
+ "psr4": {
166
+ "Components": "src/Lib/PHPXUI/",
167
+ "Icons": "src/Lib/PPIcons/"
168
+ },
169
+ "iconLibrary": "ppicons"
170
+ }
171
+ ```
172
+
173
+ ---
174
+
175
+ ## 🎨 Using Additional Icons
98
176
 
99
177
  Need more icons? Use the **PPIcons** CLI directly:
100
178
 
@@ -102,35 +180,35 @@ Need more icons? Use the **PPIcons** CLI directly:
102
180
  npx ppicons add menu chevron-left arrow-right
103
181
  ```
104
182
 
105
- This will place the requested icons under `src/Lib/PPIcons` with full PHPXUI typings.
106
- Browse the complete icon catalogue and usage docs at **[https://ppicons.tsnc.tech/](https://ppicons.tsnc.tech/)**.
183
+ This will place the requested icons under `src/Lib/PPIcons` with full PHPXUI typings.
184
+ Browse the complete icon catalogue and usage docs at **https://ppicons.tsnc.tech/**.
107
185
 
108
186
  ---
109
187
 
110
- ## 📚 Documentation
188
+ ## 📚 Documentation
111
189
 
112
- Full guides and examples live at the [PHPXUI documentation site](https://phpxui.tsnc.tech/).
190
+ Full guides and examples live at the PHPXUI documentation site: **https://phpxui.tsnc.tech/**
113
191
 
114
192
  ---
115
193
 
116
- ## 💡 Contributing
194
+ ## 💡 Contributing
117
195
 
118
196
  We welcome contributions to improve **phpxui‑cli**. If you have ideas, find bugs, or want to add features, open an issue or submit a pull request.
119
197
 
120
198
  ---
121
199
 
122
- ## 📄 License
200
+ ## 📄 License
123
201
 
124
202
  `phpxui‑cli` is released under the MIT License. See `LICENSE` for details.
125
203
 
126
204
  ---
127
205
 
128
- ## 👤 Author
206
+ ## 👤 Author
129
207
 
130
- This project is developed and maintained by **TheSteelNinjaCode**, continuously pushing the boundaries of PHP development.
208
+ This project is developed and maintained by **The Steel Ninja Code**, continuously pushing the boundaries of PHP development.
131
209
 
132
210
  ---
133
211
 
134
- ## 📧 Contact
212
+ ## 📧 Contact
135
213
 
136
214
  Questions or feedback? Reach us at [thesteelninjacode@gmail.com](mailto:thesteelninjacode@gmail.com) — we’d love to hear from you!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phpxui",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "A package for generating Prisma PHP components with a CLI interface.",
5
5
  "main": "index.js",
6
6
  "scripts": {