@appsbd/vue3-appsbd-ui 1.0.3 → 1.0.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.
- package/.ai/ai_ref_AbAvatar.md +1 -11
- package/.ai/ai_ref_AbBadge.md +2 -11
- package/.ai/ai_ref_AbButton.md +4 -23
- package/.ai/ai_ref_AbCard.md +6 -25
- package/.ai/ai_ref_AbCarousel.md +1 -12
- package/.ai/ai_ref_AbChart.md +16 -57
- package/.ai/ai_ref_AbColorPicker.md +1 -14
- package/.ai/ai_ref_AbConfirmPopover.md +1 -6
- package/.ai/ai_ref_AbCustomField.md +1 -9
- package/.ai/ai_ref_AbDarkModeToggler.md +1 -10
- package/.ai/ai_ref_AbDateTimePicker.md +4 -38
- package/.ai/ai_ref_AbEasyModal.md +2 -8
- package/.ai/ai_ref_AbField.md +1 -9
- package/.ai/ai_ref_AbFileUploader.md +3 -19
- package/.ai/ai_ref_AbFilterPanel.md +0 -4
- package/.ai/ai_ref_AbFormCheck.md +2 -19
- package/.ai/ai_ref_AbImageRadioInput.md +1 -9
- package/.ai/ai_ref_AbInputField.md +1 -9
- package/.ai/ai_ref_AbInputTag.md +2 -22
- package/.ai/ai_ref_AbKbd.md +0 -12
- package/.ai/ai_ref_AbKbdGroup.md +1 -13
- package/.ai/ai_ref_AbModal.md +98 -103
- package/.ai/ai_ref_AbMultiSelect.md +3 -37
- package/.ai/ai_ref_AbNumberField.md +5 -30
- package/.ai/ai_ref_AbPinInput.md +1 -13
- package/.ai/ai_ref_AbPopover.md +2 -12
- package/.ai/ai_ref_AbPricingCard.md +0 -8
- package/.ai/ai_ref_AbPricingContainer.md +0 -8
- package/.ai/ai_ref_AbPricingTable.md +20 -36
- package/.ai/ai_ref_AbProgressbar.md +1 -11
- package/.ai/ai_ref_AbScrollbar.md +2 -12
- package/.ai/ai_ref_AbSettingsForm.md +1 -9
- package/.ai/ai_ref_AbSideMenuItem.md +1 -12
- package/.ai/ai_ref_AbSidebar.md +2 -10
- package/.ai/ai_ref_AbSkeleton.md +0 -18
- package/.ai/ai_ref_AbSlider.md +1 -20
- package/.ai/ai_ref_AbTab.md +0 -8
- package/.ai/ai_ref_AbTable.md +0 -10
- package/.ai/ai_ref_AbTabs.md +1 -11
- package/.ai/ai_ref_AbToggle.md +4 -23
- package/.ai/ai_ref_AbTooltip.md +1 -15
- package/.ai/ai_ref_AbWizard.md +7 -20
- package/.ai/ai_ref_AbWizardStep.md +1 -13
- package/.ai/ai_ref_abEventBus.md +66 -94
- package/.ai/ai_ref_abRequestParam.md +40 -55
- package/.ai/ai_ref_abTranslate.md +30 -15
- package/.ai/ai_ref_abVeeRules.md +33 -42
- package/.ai/ai_ref_global_config.md +7 -17
- package/.ai/ai_ref_useAlert.md +45 -63
- package/.ai/ai_ref_useFileValidator.md +31 -46
- package/.ai/ai_ref_useResponsive.md +41 -55
- package/.ai/ai_ref_useTheme.md +28 -39
- package/.ai/ai_ref_useToast.md +30 -42
- package/AI_REF.md +114 -0
- package/AI_REFERENCE.md +82 -1153
- package/dist/skins/black.css +1 -1
- package/dist/skins/cyan.css +1 -1
- package/dist/skins/default.css +1 -1
- package/dist/skins/gray.css +1 -1
- package/dist/skins/green.css +1 -1
- package/dist/skins/orange.css +1 -1
- package/dist/skins/pink.css +1 -1
- package/dist/skins/purple.css +1 -1
- package/dist/skins/red.css +1 -1
- package/dist/skins/themes/_blue.scss +35 -35
- package/dist/skins/themes/_common_variable.scss +101 -6
- package/dist/skins/themes/_cyan.scss +1 -1
- package/dist/skins/themes/_gray.scss +2 -1
- package/dist/skins/themes/_green.scss +1 -1
- package/dist/skins/themes/_grid.scss +4 -1
- package/dist/skins/themes/_orange.scss +1 -1
- package/dist/skins/themes/_pink.scss +1 -1
- package/dist/skins/themes/_purple.scss +1 -1
- package/dist/skins/themes/_red.scss +1 -1
- package/dist/skins/themes/_violet.scss +1 -1
- package/dist/skins/violet.css +1 -1
- package/dist/style.css +1 -1
- package/dist/vue3-appsbd-ui.cjs.js +93 -61
- package/dist/vue3-appsbd-ui.es.js +26869 -17342
- package/package.json +7 -1
- package/readme.md +59 -1
- package/scripts/postinstall.js +55 -0
- package/scripts/setup.js +16 -0
- package/scripts/skill-groups.js +38 -0
- package/skills/commands/generate-module.md +76 -0
- package/skills/commands/settings-form.md +175 -0
- package/skills/commands/use-appsbd-ui.md +40 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appsbd/vue3-appsbd-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Reusable Vue 3 component library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/vue3-appsbd-ui.cjs.js",
|
|
@@ -23,10 +23,16 @@
|
|
|
23
23
|
"dist",
|
|
24
24
|
"readme.md",
|
|
25
25
|
"AI_REFERENCE.md",
|
|
26
|
+
"AI_REF.md",
|
|
26
27
|
".ai",
|
|
28
|
+
"skills",
|
|
29
|
+
"scripts/postinstall.js",
|
|
30
|
+
"scripts/setup.js",
|
|
31
|
+
"scripts/skill-groups.js",
|
|
27
32
|
"design-system.md"
|
|
28
33
|
],
|
|
29
34
|
"scripts": {
|
|
35
|
+
"postinstall": "node scripts/postinstall.js",
|
|
30
36
|
"up": "npm run build && npm publish",
|
|
31
37
|
"dev": "vite --mode playground",
|
|
32
38
|
"lib": "vite",
|
package/readme.md
CHANGED
|
@@ -27,7 +27,65 @@ npm install bootstrap bootstrap-icons vee-validate @vee-validate/rules vue-route
|
|
|
27
27
|
|
|
28
28
|
## 🤖 AI Assistant Integration
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
Installing this library automatically copies AI skills into your project so Claude Code and Agent-based tools can generate correct component code without guessing props or imports.
|
|
31
|
+
|
|
32
|
+
### What gets installed
|
|
33
|
+
|
|
34
|
+
Running `npm install @appsbd/vue3-appsbd-ui` copies the following automatically:
|
|
35
|
+
|
|
36
|
+
| Destination | Purpose |
|
|
37
|
+
| --- | --- |
|
|
38
|
+
| `.claude/commands/` | Slash commands for Claude Code (`/use-appsbd-ui`, `/generate-module`) |
|
|
39
|
+
| `.claude/skills/` | Skills auto-detected by Claude Code |
|
|
40
|
+
| `.agent/workflows/` | Workflow commands for Agent-based tools |
|
|
41
|
+
| `.agent/skills/` | Skills for Agent-based tools |
|
|
42
|
+
|
|
43
|
+
### Available slash commands
|
|
44
|
+
|
|
45
|
+
| Command | Description |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| `/use-appsbd-ui` | Loads component reference before generating any code — always run this first |
|
|
48
|
+
| `/generate-module` | Scaffolds a full CRUD module (List + Form + Composable) for a given entity |
|
|
49
|
+
|
|
50
|
+
**Example:**
|
|
51
|
+
```
|
|
52
|
+
/generate-module
|
|
53
|
+
|
|
54
|
+
Module: Invoice
|
|
55
|
+
Fields:
|
|
56
|
+
- title (text, required)
|
|
57
|
+
- amount (number, required, min: 0)
|
|
58
|
+
- status (select: Draft | Sent | Paid, required)
|
|
59
|
+
- due_date (date)
|
|
60
|
+
|
|
61
|
+
API: /api/invoices
|
|
62
|
+
Output: src/modules/invoices/
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Optional: enable additional AI tools
|
|
66
|
+
|
|
67
|
+
To also install skills for Cursor or Windsurf, pass `APPSBD_AGENTS` during install:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
APPSBD_AGENTS=cursor npm install @appsbd/vue3-appsbd-ui
|
|
71
|
+
APPSBD_AGENTS=cursor,windsurf npm install @appsbd/vue3-appsbd-ui
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Or run the setup script any time after install:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
node node_modules/@appsbd/vue3-appsbd-ui/scripts/setup.js --cursor --windsurf
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Manual reference
|
|
81
|
+
|
|
82
|
+
If you prefer not to use auto-installed skills, the reference files are included in the package:
|
|
83
|
+
|
|
84
|
+
- `node_modules/@appsbd/vue3-appsbd-ui/AI_REF.md` — compact component index (~500 tokens, start here)
|
|
85
|
+
- `node_modules/@appsbd/vue3-appsbd-ui/AI_REFERENCE.md` — full table with descriptions
|
|
86
|
+
- `node_modules/@appsbd/vue3-appsbd-ui/.ai/ai_ref_[Name].md` — per-component props/events/slots
|
|
87
|
+
|
|
88
|
+
Point your AI to read `AI_REF.md` first, then the specific `.ai/` file for the component you need.
|
|
31
89
|
|
|
32
90
|
## 🛠️ Setup
|
|
33
91
|
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, copyFileSync, readFileSync, readdirSync } from "fs";
|
|
2
|
+
import { join, resolve } from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import { getSkillGroups } from "./skill-groups.js";
|
|
5
|
+
|
|
6
|
+
const __dirname = fileURLToPath(new URL(".", import.meta.url));
|
|
7
|
+
const pkgRoot = resolve(__dirname, "..");
|
|
8
|
+
|
|
9
|
+
// INIT_CWD = directory where `npm install` was invoked (consuming project root).
|
|
10
|
+
const projectRoot = process.env.INIT_CWD || resolve(__dirname, "../../../..");
|
|
11
|
+
|
|
12
|
+
// Skip when the library is installing its own devDependencies.
|
|
13
|
+
try {
|
|
14
|
+
const pkg = JSON.parse(readFileSync(join(projectRoot, "package.json"), "utf8"));
|
|
15
|
+
if (pkg.name === "@appsbd/vue3-appsbd-ui") process.exit(0);
|
|
16
|
+
} catch {
|
|
17
|
+
// consuming project has no package.json at that path — continue anyway
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Optional agents: APPSBD_AGENTS=cursor,windsurf npm install @appsbd/vue3-appsbd-ui
|
|
21
|
+
const agents = process.env.APPSBD_AGENTS
|
|
22
|
+
? process.env.APPSBD_AGENTS.split(",").map((a) => a.trim().toLowerCase())
|
|
23
|
+
: [];
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
copySkills(pkgRoot, projectRoot, agents);
|
|
27
|
+
} catch (err) {
|
|
28
|
+
// Non-fatal — never break npm install
|
|
29
|
+
console.warn("[@appsbd/vue3-appsbd-ui] Could not install skills:", err.message);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function copySkills(pkgRoot, projectRoot, agents = []) {
|
|
33
|
+
const groups = getSkillGroups(pkgRoot, projectRoot, agents);
|
|
34
|
+
let copied = 0, skipped = 0;
|
|
35
|
+
|
|
36
|
+
for (const group of groups) {
|
|
37
|
+
if (!existsSync(group.src)) continue;
|
|
38
|
+
const files = readdirSync(group.src).filter((f) => f.endsWith(".md"));
|
|
39
|
+
|
|
40
|
+
for (const dest of group.dests) {
|
|
41
|
+
if (!existsSync(dest)) mkdirSync(dest, { recursive: true });
|
|
42
|
+
for (const file of files) {
|
|
43
|
+
const dst = join(dest, file);
|
|
44
|
+
if (group.override.includes(file) || !existsSync(dst)) {
|
|
45
|
+
copyFileSync(join(group.src, file), dst);
|
|
46
|
+
copied++;
|
|
47
|
+
} else {
|
|
48
|
+
skipped++;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
console.log(`[@appsbd/vue3-appsbd-ui] Skills → copied: ${copied}, skipped (preserved): ${skipped}`);
|
|
55
|
+
}
|
package/scripts/setup.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Usage: node node_modules/@appsbd/vue3-appsbd-ui/scripts/setup.js --cursor --windsurf
|
|
3
|
+
|
|
4
|
+
import { resolve } from "path";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
6
|
+
import { copySkills } from "./postinstall.js";
|
|
7
|
+
|
|
8
|
+
const __dirname = fileURLToPath(new URL(".", import.meta.url));
|
|
9
|
+
const pkgRoot = resolve(__dirname, "..");
|
|
10
|
+
const projectRoot = process.env.INIT_CWD || process.cwd();
|
|
11
|
+
|
|
12
|
+
const agents = process.argv
|
|
13
|
+
.filter((a) => a.startsWith("--"))
|
|
14
|
+
.map((a) => a.slice(2).toLowerCase());
|
|
15
|
+
|
|
16
|
+
copySkills(pkgRoot, projectRoot, agents);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { join } from "path";
|
|
2
|
+
|
|
3
|
+
// Central config for all agent skill destinations.
|
|
4
|
+
// Add new agents here — postinstall.js and setup.js both use this.
|
|
5
|
+
|
|
6
|
+
const OPTIONAL_AGENTS = {
|
|
7
|
+
cursor: (pkgRoot, projectRoot) => [
|
|
8
|
+
{ src: join(pkgRoot, "skills", "commands"), dests: [join(projectRoot, ".cursor", "rules")], override: ["use-appsbd-ui.md"] },
|
|
9
|
+
{ src: join(pkgRoot, "skills", "skills"), dests: [join(projectRoot, ".cursor", "rules")], override: [] },
|
|
10
|
+
],
|
|
11
|
+
windsurf: (pkgRoot, projectRoot) => [
|
|
12
|
+
{ src: join(pkgRoot, "skills", "commands"), dests: [join(projectRoot, ".windsurf", "workflows")], override: ["use-appsbd-ui.md"] },
|
|
13
|
+
{ src: join(pkgRoot, "skills", "skills"), dests: [join(projectRoot, ".windsurf", "rules")], override: [] },
|
|
14
|
+
],
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function getSkillGroups(pkgRoot, projectRoot, agents = []) {
|
|
18
|
+
const groups = [
|
|
19
|
+
// Always installed — Claude Code + Agent
|
|
20
|
+
{
|
|
21
|
+
src: join(pkgRoot, "skills", "commands"),
|
|
22
|
+
dests: [join(projectRoot, ".claude", "commands"), join(projectRoot, ".agent", "workflows")],
|
|
23
|
+
override: ["use-appsbd-ui.md"],
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
src: join(pkgRoot, "skills", "skills"),
|
|
27
|
+
dests: [join(projectRoot, ".claude", "skills"), join(projectRoot, ".agent", "skills")],
|
|
28
|
+
override: [],
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
for (const agent of agents) {
|
|
33
|
+
if (OPTIONAL_AGENTS[agent]) groups.push(...OPTIONAL_AGENTS[agent](pkgRoot, projectRoot));
|
|
34
|
+
else console.warn(`[@appsbd/vue3-appsbd-ui] Unknown agent "${agent}" — skipped. Available: ${Object.keys(OPTIONAL_AGENTS).join(", ")}`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return groups;
|
|
38
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generate a full CRUD module (List + Form + Composable) using @appsbd/vue3-appsbd-ui components
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Generate Module
|
|
6
|
+
|
|
7
|
+
## Before anything else
|
|
8
|
+
|
|
9
|
+
Invoke `/use-appsbd-ui` to load the component reference. Use only props/events/slots documented there.
|
|
10
|
+
|
|
11
|
+
## What to generate
|
|
12
|
+
|
|
13
|
+
Given a module name and field definitions, scaffold three files:
|
|
14
|
+
|
|
15
|
+
### 1. `[Name]List.vue` — List/Table view
|
|
16
|
+
|
|
17
|
+
- Use `AbTable` for the data grid
|
|
18
|
+
- `AbButton` (primary) to open the create form
|
|
19
|
+
- `AbConfirmPopover` on each row's delete action
|
|
20
|
+
- `AbSkeleton` while data is loading
|
|
21
|
+
- `AbBadge` for status/boolean columns
|
|
22
|
+
- Call `useToast` on successful delete
|
|
23
|
+
|
|
24
|
+
### 2. `[Name]Form.vue` — Create / Edit form
|
|
25
|
+
|
|
26
|
+
- Wrap everything in `AbModal` with `v-model:is-modal-visible`
|
|
27
|
+
- Map each field to the correct Ab* input:
|
|
28
|
+
| Field type | Component |
|
|
29
|
+
|----------------|-------------------|
|
|
30
|
+
| text / email | `AbInputField` |
|
|
31
|
+
| number | `AbNumberField` |
|
|
32
|
+
| select (single)| `AbMultiSelect` mode="single" |
|
|
33
|
+
| select (multi) | `AbMultiSelect` mode="multiple" |
|
|
34
|
+
| boolean/switch | `AbToggle` |
|
|
35
|
+
| date / range | `AbDateTimePicker`|
|
|
36
|
+
| radio group | `AbFormCheck` |
|
|
37
|
+
| textarea | `AbInputField` type="textarea" |
|
|
38
|
+
| file | `AbFileUploader` |
|
|
39
|
+
- Add VeeValidate `rules` prop on required / validated fields
|
|
40
|
+
- `@on-submit` handler calls composable save method
|
|
41
|
+
- Call `modal.value.showLoader(true)` before async, `showLoader(false)` after
|
|
42
|
+
- Call `useToast` success/error inside the submit handler
|
|
43
|
+
|
|
44
|
+
### 3. `use[Name].js` — Composable
|
|
45
|
+
|
|
46
|
+
- `ref` for list data, single item, loading state, pagination
|
|
47
|
+
- `fetchList()`, `fetchOne(id)`, `save(payload)`, `remove(id)` functions
|
|
48
|
+
- `save` detects create vs edit by presence of `id`
|
|
49
|
+
- Return all refs and functions
|
|
50
|
+
|
|
51
|
+
## Output format
|
|
52
|
+
|
|
53
|
+
Ask the user for:
|
|
54
|
+
1. **Module name** (PascalCase, e.g. `Product`)
|
|
55
|
+
2. **Fields** — name, type, required?, options (for selects)
|
|
56
|
+
3. **API base path** (e.g. `/api/products`)
|
|
57
|
+
4. **Output folder** (default: `src/modules/[name]/`)
|
|
58
|
+
|
|
59
|
+
Then generate all three files in one response, each in a separate code block labeled with its file path.
|
|
60
|
+
|
|
61
|
+
## Example invocation
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
/generate-module
|
|
65
|
+
|
|
66
|
+
Module: Invoice
|
|
67
|
+
Fields:
|
|
68
|
+
- title (text, required)
|
|
69
|
+
- amount (number, required, min: 0)
|
|
70
|
+
- status (select: Draft | Sent | Paid, required)
|
|
71
|
+
- due_date (date, required)
|
|
72
|
+
- notes (textarea)
|
|
73
|
+
|
|
74
|
+
API: /api/invoices
|
|
75
|
+
Output: src/modules/invoices/
|
|
76
|
+
```
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Use when building a settings or preferences page with AbSettingsForm
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Generate a Settings Form
|
|
6
|
+
|
|
7
|
+
## Before anything else
|
|
8
|
+
|
|
9
|
+
Read `node_modules/@appsbd/vue3-appsbd-ui/.ai/ai_ref_AbSettingsForm.md` for the full API.
|
|
10
|
+
|
|
11
|
+
## What AbSettingsForm does
|
|
12
|
+
|
|
13
|
+
- Wraps fields in a VeeValidate `<Form>` with a built-in submit/loading state.
|
|
14
|
+
- When nested inside an `AbWizardStep`, auto-registers as the step's validator — returning `false` from `onSubmit` blocks the wizard from advancing.
|
|
15
|
+
- Standalone use (outside a wizard) works as a plain validated form.
|
|
16
|
+
|
|
17
|
+
## Supported field components
|
|
18
|
+
|
|
19
|
+
| Field type | Component |
|
|
20
|
+
|---|---|
|
|
21
|
+
| text / email / password | `<ab-input-field>` |
|
|
22
|
+
| number | `<ab-number-field>` |
|
|
23
|
+
| select (single) | `<ab-multi-select mode="single">` |
|
|
24
|
+
| select (multi) | `<ab-multi-select mode="multiple">` |
|
|
25
|
+
| boolean / switch | `<ab-toggle>` |
|
|
26
|
+
| date | `<ab-date-time-picker>` |
|
|
27
|
+
| checkbox / radio group | `<ab-form-check>` |
|
|
28
|
+
| textarea | `<ab-input-field type="textarea">` |
|
|
29
|
+
| file / avatar | `<ab-file-uploader>` |
|
|
30
|
+
| tags | `<ab-input-tag>` |
|
|
31
|
+
| color | `<ab-color-picker>` |
|
|
32
|
+
|
|
33
|
+
## Rules
|
|
34
|
+
|
|
35
|
+
- Import `AbSettingsForm` explicitly — it is **not** globally registered.
|
|
36
|
+
- Pass the save handler to `:on-submit`. The component manages the loading state automatically — do not add a separate loading ref.
|
|
37
|
+
- Return `false` (or throw) from `onSubmit` to block wizard progression or keep the form in error state.
|
|
38
|
+
- Wrap each field in `<ab-field>` only when you need a standalone label+error wrapper outside a component that has its own label prop.
|
|
39
|
+
- All `Ab*` form inputs must receive a `name` prop for VeeValidate to track them.
|
|
40
|
+
|
|
41
|
+
## Standalone settings page
|
|
42
|
+
|
|
43
|
+
```vue
|
|
44
|
+
<template>
|
|
45
|
+
<ab-settings-form :on-submit="save">
|
|
46
|
+
<ab-input-field v-model="form.name" name="name" label="Display name" rules="required" />
|
|
47
|
+
<ab-input-field v-model="form.email" name="email" label="Email" rules="required|email" />
|
|
48
|
+
<ab-toggle v-model="form.notifications" name="notifications" title="Email notifications" />
|
|
49
|
+
<ab-multi-select
|
|
50
|
+
v-model="form.language"
|
|
51
|
+
name="language"
|
|
52
|
+
label="Language"
|
|
53
|
+
:options="languageOptions"
|
|
54
|
+
label-key="title"
|
|
55
|
+
value-key="val"
|
|
56
|
+
/>
|
|
57
|
+
</ab-settings-form>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script setup>
|
|
61
|
+
import { ref } from "vue";
|
|
62
|
+
import { AbSettingsForm, useToast } from "@appsbd/vue3-appsbd-ui";
|
|
63
|
+
|
|
64
|
+
const { toast } = useToast();
|
|
65
|
+
|
|
66
|
+
const form = ref({
|
|
67
|
+
name: "",
|
|
68
|
+
email: "",
|
|
69
|
+
notifications: false,
|
|
70
|
+
language: null,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const languageOptions = [
|
|
74
|
+
{ val: "en", title: "English" },
|
|
75
|
+
{ val: "bn", title: "Bengali" },
|
|
76
|
+
{ val: "ar", title: "Arabic" },
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
async function save(values) {
|
|
80
|
+
await api.saveProfile(values);
|
|
81
|
+
toast.success("Settings saved.");
|
|
82
|
+
}
|
|
83
|
+
</script>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Wizard with per-step validation
|
|
87
|
+
|
|
88
|
+
```vue
|
|
89
|
+
<template>
|
|
90
|
+
<ab-wizard @finished="onFinished">
|
|
91
|
+
<ab-wizard-step title="Account">
|
|
92
|
+
<ab-settings-form :on-submit="validateAccount">
|
|
93
|
+
<ab-input-field v-model="form.email" name="email" label="Email" rules="required|email" />
|
|
94
|
+
<ab-input-field v-model="form.password" name="password" label="Password" rules="required|min:8" type="password" />
|
|
95
|
+
</ab-settings-form>
|
|
96
|
+
</ab-wizard-step>
|
|
97
|
+
|
|
98
|
+
<ab-wizard-step title="Profile">
|
|
99
|
+
<ab-settings-form :on-submit="validateProfile">
|
|
100
|
+
<ab-input-field v-model="form.name" name="name" label="Full name" rules="required" />
|
|
101
|
+
<ab-multi-select
|
|
102
|
+
v-model="form.role"
|
|
103
|
+
name="role"
|
|
104
|
+
label="Role"
|
|
105
|
+
:options="roleOptions"
|
|
106
|
+
label-key="title"
|
|
107
|
+
value-key="val"
|
|
108
|
+
rules="required"
|
|
109
|
+
/>
|
|
110
|
+
</ab-settings-form>
|
|
111
|
+
</ab-wizard-step>
|
|
112
|
+
|
|
113
|
+
<ab-wizard-step title="Preferences">
|
|
114
|
+
<ab-settings-form>
|
|
115
|
+
<ab-toggle v-model="form.emails" name="emails" title="Email me updates" />
|
|
116
|
+
<ab-toggle v-model="form.marketing" name="marketing" title="Marketing emails" />
|
|
117
|
+
</ab-settings-form>
|
|
118
|
+
</ab-wizard-step>
|
|
119
|
+
</ab-wizard>
|
|
120
|
+
</template>
|
|
121
|
+
|
|
122
|
+
<script setup>
|
|
123
|
+
import { ref } from "vue";
|
|
124
|
+
import { AbSettingsForm, useToast } from "@appsbd/vue3-appsbd-ui";
|
|
125
|
+
|
|
126
|
+
const { toast } = useToast();
|
|
127
|
+
|
|
128
|
+
const form = ref({
|
|
129
|
+
email: "", password: "", name: "", role: null,
|
|
130
|
+
emails: false, marketing: false,
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const roleOptions = [
|
|
134
|
+
{ val: "admin", title: "Admin" },
|
|
135
|
+
{ val: "editor", title: "Editor" },
|
|
136
|
+
{ val: "viewer", title: "Viewer" },
|
|
137
|
+
];
|
|
138
|
+
|
|
139
|
+
async function validateAccount(values) {
|
|
140
|
+
const taken = await api.checkEmail(values.email);
|
|
141
|
+
if (taken) return false; // blocks wizard from advancing to next step
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async function validateProfile(values) {
|
|
145
|
+
// return false to block, or nothing to allow
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function onFinished() {
|
|
149
|
+
toast.success("Setup complete!");
|
|
150
|
+
}
|
|
151
|
+
</script>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Output format
|
|
155
|
+
|
|
156
|
+
Ask the user for:
|
|
157
|
+
1. **Sections / steps** — one settings form per wizard step, or a single standalone form
|
|
158
|
+
2. **Fields per section** — name, type, required?, options (for selects)
|
|
159
|
+
3. **Save / API endpoint**
|
|
160
|
+
|
|
161
|
+
Then generate the Vue file(s) in one response, each in a separate code block labeled with its file path.
|
|
162
|
+
|
|
163
|
+
## Example invocation
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
/settings-form
|
|
167
|
+
|
|
168
|
+
Page: User Profile Settings
|
|
169
|
+
Sections:
|
|
170
|
+
- Account: email (required), password (required, min 8)
|
|
171
|
+
- Preferences: language (select: English|Bengali|Arabic), email_notifications (toggle), theme (select: Light|Dark)
|
|
172
|
+
|
|
173
|
+
API: /api/user/settings
|
|
174
|
+
Output: src/pages/settings/ProfileSettings.vue
|
|
175
|
+
```
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Use when generating code that uses @appsbd/vue3-appsbd-ui components or APIs
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Using @appsbd/vue3-appsbd-ui
|
|
6
|
+
|
|
7
|
+
## Rules
|
|
8
|
+
|
|
9
|
+
- Use `Ab*` components before reaching for any external UI library.
|
|
10
|
+
- Never guess props, events, or slots — always read the reference file first.
|
|
11
|
+
- Globally registered components need no import. All others: `import { X } from "@appsbd/vue3-appsbd-ui"`.
|
|
12
|
+
|
|
13
|
+
## Workflow
|
|
14
|
+
|
|
15
|
+
1. Read `node_modules/@appsbd/vue3-appsbd-ui/AI_REF.md` to find available components and their reference file paths.
|
|
16
|
+
2. Read `node_modules/@appsbd/vue3-appsbd-ui/.ai/ai_ref_[ComponentName].md` for the exact props / events / slots before writing any code.
|
|
17
|
+
3. Generate code using only the documented API from that file.
|
|
18
|
+
|
|
19
|
+
## Quick API (no file read needed)
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
// Toast
|
|
23
|
+
import { useToast } from "@appsbd/vue3-appsbd-ui";
|
|
24
|
+
const { toast } = useToast();
|
|
25
|
+
toast.success("Done"); // .error / .warning / .info
|
|
26
|
+
|
|
27
|
+
// Alert
|
|
28
|
+
import { useAlert } from "@appsbd/vue3-appsbd-ui";
|
|
29
|
+
const { alert } = useAlert();
|
|
30
|
+
alert.confirm("Sure?", "", { onConfirm: async () => {} });
|
|
31
|
+
|
|
32
|
+
// Theme
|
|
33
|
+
import { useTheme } from "@appsbd/vue3-appsbd-ui";
|
|
34
|
+
const { toggleTheme } = useTheme();
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```html
|
|
38
|
+
<!-- v-tooltip (global directive) -->
|
|
39
|
+
<ab-button v-tooltip="'Helper text'">Save</ab-button>
|
|
40
|
+
```
|