adminforth 3.13.11 → 3.13.13

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: adminforth-custom-vue
3
- description: "Use when implementing AdminForth custom Vue UI: field components, page injections, login or global injections, meta-driven component declarations, and frontend packages inside custom/."
3
+ description: "Use when implementing AdminForth custom Vue UI: AFCL components, theme colors and dark mode, field components, page injections, login or global injections, meta-driven component declarations, and frontend packages inside custom/."
4
4
  user-invocable: true
5
5
  ---
6
6
 
@@ -13,6 +13,68 @@ user-invocable: true
13
13
  - Adding resource page injections, login injections, or global layout injections.
14
14
  - Passing `meta` into reusable Vue components.
15
15
  - Installing frontend packages used only by custom AdminForth Vue code.
16
+ - Any task that produces visible UI in an AdminForth app, even when the task says nothing about how it should look.
17
+
18
+ ## Adminforth UI Defaults
19
+
20
+ Apply all of these to every piece of UI you write under `custom/`, especially when the user gave no design
21
+ instructions at all. These are the defaults, not options — do not ask whether the user wants them, and do
22
+ not wait for a follow-up prompt about styling or dark mode.
23
+
24
+ 1. **Build from AFCL first.** AFCL (AdminForth Components Library) is imported from `@/afcl` and is always
25
+ available in `custom/` without installing anything. Reach for a raw HTML control only when no AFCL
26
+ component covers the case.
27
+ 2. **Buttons come from AFCL with an explicit intent.** Primary/confirming action is the default filled
28
+ accent `<Button>`. Secondary, cancel, and "back" actions are stroked `<Button variant="secondary">`.
29
+ Destructive actions are `<Button variant="danger">`.
30
+ 3. **Form controls come from AFCL.** `Input`, `Textarea`, `Select`, `Checkbox`, `Toggle`, `DatePicker`,
31
+ `Dropzone`. Preferably not a bare `<input>`, `<select>`, or `<textarea>` styled by hand — that is the main way
32
+ custom pages end up looking foreign.
33
+ 4. **Accents use `lightPrimary` / `darkPrimary`.** Anything that carries brand or "this is the important
34
+ one" meaning — accent fills, highlighted values, active states, links, focus emphasis, the main chart
35
+ series — should use `bg-lightPrimary dark:bg-darkPrimary`, `text-lightPrimary dark:text-darkPrimary`,
36
+ `text-lightPrimaryContrast dark:text-darkPrimaryContrast`.
37
+ 5. **Everything else may use Tailwind's stock palette.** `bg-white`, `bg-gray-50`, `text-gray-700`,
38
+ `text-red-600`, `border-gray-200`, `bg-pink-500`, and friends are all fine for neutrals, surfaces,
39
+ borders, and semantic colors. The theme tokens in the table below are still the better choice when a
40
+ block sits directly next to built-in AdminForth chrome and should match it exactly — but they are a
41
+ recommendation, not a restriction.
42
+ 6. **Dark theme is part of writing the class, not a later pass.** Every color utility must be written as a
43
+ light/dark pair: `bg-white dark:bg-gray-900`, `text-gray-700 dark:text-gray-300`.
44
+ This matters most with stock Tailwind colors, which have no built-in
45
+ dark behavior — a `bg-gray-50` with no `dark:` counterpart is a defect, fix it before finishing.
46
+ `light*`/`dark*` token pairs satisfy this by construction. Dark mode is class-based
47
+ (`darkMode: 'class'`), so `dark:` variants work everywhere in `custom/`.
48
+ 7. **Icons come from the prerendered Iconify packages** already present in the SPA:
49
+ `@iconify-prerendered/vue-flowbite` (default), plus `-heroicons`, `-humbleicons`, and `-flag`.
50
+ Do not add an icon dependency to `custom/package.json` for these.
51
+ 8. **Never build Tailwind class names dynamically.** `custom/` is copied into the SPA sources and scanned
52
+ statically by Tailwind, so `` `text-${color}-600` `` produces no CSS. Write full class strings and pick
53
+ between them.
54
+
55
+ ## Dark Theme Self-Check
56
+
57
+ Run this over every file you touched before reporting the work as done:
58
+
59
+ - Search the file for `bg-`, `text-`, `border-`, `ring-`, `fill-`, `stroke-`, `divide-`, `placeholder-`,
60
+ and `shadow-` color utilities.
61
+ - Each one either has a `dark:` counterpart, comes from a `light*`/`dark*` token pair (which already is
62
+ one), or belongs to an AFCL component that handles theming itself. This is the check that actually
63
+ matters — a stock Tailwind color with no `dark:` twin is the single most common way custom UI breaks in
64
+ dark mode.
65
+ - Accents are `lightPrimary`/`darkPrimary`, not a hardcoded blue or indigo.
66
+ - No raw `#hex` or `rgb()` in templates or `<style>` blocks.
67
+
68
+ ```
69
+ ❌ <button class="bg-blue-600 text-white rounded px-4 py-2">Save</button>
70
+ ✅ <Button @click="save">Save</Button>
71
+
72
+ ❌ <div class="bg-white border border-gray-200 text-gray-800">
73
+ ✅ <div class="bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700
74
+ text-gray-800 dark:text-gray-200">
75
+ ❌ <p class="text-red-600">\{{ error }}</p>
76
+ ✅ <p class="text-red-600 dark:text-red-400">\{{ error }}</p>
77
+ ```
16
78
 
17
79
  ## `custom/` Directory and `@@/`
18
80
 
@@ -23,6 +85,10 @@ user-invocable: true
23
85
 
24
86
  ## Frontend Packages in `custom/`
25
87
 
88
+ - First check whether you need a package at all. These are already available to `custom/` components with
89
+ no install step: `@/afcl` (AFCL components), `@/types/Common` (AdminForth types), `@/adminforth`
90
+ (`useAdminforth`), `@/stores/core` (`useCoreStore`), `@/websocket`, Vue, Tailwind, and the
91
+ `@iconify-prerendered/vue-*` icon sets. AFCL charts already wrap ApexCharts.
26
92
  - Install frontend-only dependencies inside `custom/`, not in the app root.
27
93
 
28
94
  ```bash
@@ -127,17 +193,19 @@ show: {
127
193
  <template>
128
194
  <div class="grid gap-2">
129
195
  <Input
196
+ type="text"
197
+ full-width
130
198
  :model-value="localValue"
131
199
  :readonly="readonly"
132
200
  :placeholder="meta?.placeholder || column.label"
133
201
  @update:model-value="onInput"
134
202
  />
135
203
 
136
- <p v-if="errorMessage" class="text-sm text-red-600">
204
+ <p v-if="errorMessage" class="text-sm">
137
205
  \{{ errorMessage }}
138
206
  </p>
139
207
 
140
- <p v-else-if="isEmpty" class="text-sm text-amber-600">
208
+ <p v-else-if="isEmpty" class="text-sm">
141
209
  Value is currently empty
142
210
  </p>
143
211
  </div>
@@ -145,7 +213,7 @@ show: {
145
213
 
146
214
  <script setup lang="ts">
147
215
  import { computed, onMounted, ref } from 'vue';
148
- import Input from '@/afcl/Input.vue';
216
+ import { Input } from '@/afcl';
149
217
  import type {
150
218
  AdminForthResourceColumnCommon,
151
219
  AdminForthResourceCommon,
@@ -337,4 +405,8 @@ options: {
337
405
  - Prefer simple string declarations until you actually need `meta`.
338
406
  - Reuse one component with multiple full declarations instead of cloning similar files.
339
407
  - Keep page injections small unless the layout intentionally becomes page-scrolling.
340
- - Keep custom edit and create components explicit about validity and emptiness if the default input heuristics are not enough.
408
+ - Keep custom edit and create components explicit about validity and emptiness if the default input heuristics are not enough.
409
+ - Reach for an AFCL component before writing markup; use `lightPrimary`/`darkPrimary` for accents; write
410
+ the `dark:` variant in the same edit as the light one. These are defaults for every UI task, not polish
411
+ to be added when someone asks for it.
412
+ - When you are done, re-read your diff against the Dark Theme Self-Check above before reporting completion.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "3.13.11",
3
+ "version": "3.13.13",
4
4
  "description": "OpenSource Agent-Native forth-generation admin panel",
5
5
  "keywords": [
6
6
  "adminforth",
@@ -121,12 +121,12 @@
121
121
  "zod": "^4.3.6"
122
122
  },
123
123
  "devDependencies": {
124
- "@adminforth/connector-clickhouse": "^1.0.4",
125
- "@adminforth/connector-mongo": "^1.0.3",
126
- "@adminforth/connector-mysql": "^1.0.3",
127
- "@adminforth/connector-postgres": "^1.0.4",
124
+ "@adminforth/connector-clickhouse": "^1.0.7",
125
+ "@adminforth/connector-mongo": "^1.0.5",
126
+ "@adminforth/connector-mysql": "^1.0.9",
127
+ "@adminforth/connector-postgres": "^1.0.6",
128
128
  "@adminforth/connector-qdrant": "^1.0.4",
129
- "@adminforth/connector-sqlite": "^1.0.3",
129
+ "@adminforth/connector-sqlite": "^1.0.6",
130
130
  "@semantic-release/exec": "^7.1.0",
131
131
  "@semantic-release/github": "^12.0.1",
132
132
  "@types/node": "^20.14.2",
@@ -135,12 +135,12 @@
135
135
  "typescript": "^5.4.5"
136
136
  },
137
137
  "peerDependencies": {
138
- "@adminforth/connector-clickhouse": "^1.0.4",
139
- "@adminforth/connector-mongo": "^1.0.3",
140
- "@adminforth/connector-mysql": "^1.0.3",
141
- "@adminforth/connector-postgres": "^1.0.4",
138
+ "@adminforth/connector-clickhouse": "^1.0.7",
139
+ "@adminforth/connector-mongo": "^1.0.5",
140
+ "@adminforth/connector-mysql": "^1.0.9",
141
+ "@adminforth/connector-postgres": "^1.0.6",
142
142
  "@adminforth/connector-qdrant": "^1.0.4",
143
- "@adminforth/connector-sqlite": "^1.0.3",
143
+ "@adminforth/connector-sqlite": "^1.0.6",
144
144
  "express": "^4.21.0 || ^5.0.0"
145
145
  },
146
146
  "peerDependenciesMeta": {