@apex-stack/core 0.2.1 → 0.3.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/components/Badge.alpine +14 -0
- package/components/Button.alpine +22 -0
- package/components/Card.alpine +11 -0
- package/components/registry.json +13 -0
- package/dist/add-2SBHPLEH.js +81 -0
- package/dist/cli.js +2 -0
- package/package.json +3 -2
- package/vscode/apex-alpine.vsix +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<template x-data>
|
|
2
|
+
<span class="ax-badge" :class="'ax-badge--' + (variant || 'default')"><slot>Badge</slot></span>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<style scoped>
|
|
6
|
+
.ax-badge {
|
|
7
|
+
display: inline-flex; align-items: center; gap: 0.3rem;
|
|
8
|
+
padding: 0.15rem 0.55rem; font-size: 0.78rem; font-weight: 600; line-height: 1.4;
|
|
9
|
+
border-radius: 999px; border: 1px solid var(--ax-border, #e2e8f0);
|
|
10
|
+
background: var(--ax-card, #f1f5f9); color: var(--ax-muted, #55617e);
|
|
11
|
+
}
|
|
12
|
+
.ax-badge--primary { background: var(--ax-primary, #4f46e5); color: var(--ax-primary-fg, #fff); border-color: transparent; }
|
|
13
|
+
.ax-badge--success { background: var(--ax-success, #0f9d6f); color: #fff; border-color: transparent; }
|
|
14
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<template x-data>
|
|
2
|
+
<button class="ax-btn" :class="'ax-btn--' + (variant || 'primary')" :type="type || 'button'">
|
|
3
|
+
<slot>Button</slot>
|
|
4
|
+
</button>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<style scoped>
|
|
8
|
+
/* Styles inherit the Apex theme via --ax-* tokens (with sane fallbacks, so the
|
|
9
|
+
component looks right even before you apply a theme). */
|
|
10
|
+
.ax-btn {
|
|
11
|
+
display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
|
|
12
|
+
padding: 0.55rem 1rem; font: inherit; font-weight: 600; line-height: 1; cursor: pointer;
|
|
13
|
+
border: 1px solid transparent; border-radius: var(--ax-radius, 0.6rem);
|
|
14
|
+
transition: filter 0.15s, background 0.15s, color 0.15s;
|
|
15
|
+
}
|
|
16
|
+
.ax-btn--primary { background: var(--ax-primary, #4f46e5); color: var(--ax-primary-fg, #fff); }
|
|
17
|
+
.ax-btn--danger { background: var(--ax-danger, #dc2626); color: #fff; }
|
|
18
|
+
.ax-btn--ghost { background: transparent; color: var(--ax-fg, #0a0e1a); border-color: var(--ax-border, #e2e8f0); }
|
|
19
|
+
.ax-btn:hover { filter: brightness(1.06); }
|
|
20
|
+
.ax-btn--ghost:hover { background: var(--ax-card, #f8fafc); filter: none; }
|
|
21
|
+
.ax-btn:disabled { opacity: 0.55; cursor: not-allowed; filter: none; }
|
|
22
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ax-card"><slot></slot></div>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<style scoped>
|
|
6
|
+
.ax-card {
|
|
7
|
+
background: var(--ax-card, #f8fafc); color: var(--ax-card-fg, #0a0e1a);
|
|
8
|
+
border: 1px solid var(--ax-border, #e2e8f0); border-radius: var(--ax-radius, 0.6rem);
|
|
9
|
+
padding: 1.25rem;
|
|
10
|
+
}
|
|
11
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"button": {
|
|
3
|
+
"name": "Button",
|
|
4
|
+
"file": "Button.alpine",
|
|
5
|
+
"description": "Themeable button with primary/ghost/danger variants."
|
|
6
|
+
},
|
|
7
|
+
"card": {
|
|
8
|
+
"name": "Card",
|
|
9
|
+
"file": "Card.alpine",
|
|
10
|
+
"description": "A surface container that inherits the theme."
|
|
11
|
+
},
|
|
12
|
+
"badge": { "name": "Badge", "file": "Badge.alpine", "description": "A small status/label pill." }
|
|
13
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {
|
|
2
|
+
banner,
|
|
3
|
+
color
|
|
4
|
+
} from "./chunk-QIXJSQLW.js";
|
|
5
|
+
|
|
6
|
+
// src/commands/add.ts
|
|
7
|
+
import { cpSync, existsSync, mkdirSync, readFileSync } from "fs";
|
|
8
|
+
import { dirname, join, resolve } from "path";
|
|
9
|
+
import { fileURLToPath } from "url";
|
|
10
|
+
import { defineCommand } from "citty";
|
|
11
|
+
var REGISTRY_DIR = fileURLToPath(new URL("../components", import.meta.url));
|
|
12
|
+
function loadRegistry() {
|
|
13
|
+
const p = join(REGISTRY_DIR, "registry.json");
|
|
14
|
+
if (!existsSync(p)) return {};
|
|
15
|
+
try {
|
|
16
|
+
return JSON.parse(readFileSync(p, "utf8"));
|
|
17
|
+
} catch {
|
|
18
|
+
return {};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
var addCommand = defineCommand({
|
|
22
|
+
meta: {
|
|
23
|
+
name: "add",
|
|
24
|
+
description: "Add a themeable component into your project (copies the .alpine source)"
|
|
25
|
+
},
|
|
26
|
+
args: {
|
|
27
|
+
name: { type: "positional", required: false, description: "Component to add (e.g. button)" },
|
|
28
|
+
root: { type: "string", description: "Project root", default: "." },
|
|
29
|
+
force: { type: "boolean", default: false, description: "Overwrite an existing component file" }
|
|
30
|
+
},
|
|
31
|
+
run({ args }) {
|
|
32
|
+
const registry = loadRegistry();
|
|
33
|
+
const log = console.log;
|
|
34
|
+
process.stdout.write(banner());
|
|
35
|
+
const keys = Object.keys(registry);
|
|
36
|
+
if (!keys.length) {
|
|
37
|
+
console.error(` ${color.red("\u2717")} No component registry bundled in this build.
|
|
38
|
+
`);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
const name = args.name ? String(args.name).toLowerCase() : "";
|
|
42
|
+
if (!name) {
|
|
43
|
+
log(` ${color.bold("Available components")} ${color.gray("\u2014 apex add <name>")}
|
|
44
|
+
`);
|
|
45
|
+
for (const k of keys) {
|
|
46
|
+
log(` ${color.cyan(k.padEnd(12))} ${color.gray(registry[k]?.description ?? "")}`);
|
|
47
|
+
}
|
|
48
|
+
log("");
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const entry = registry[name];
|
|
52
|
+
if (!entry) {
|
|
53
|
+
console.error(
|
|
54
|
+
` ${color.red("\u2717")} Unknown component "${name}". Available: ${keys.join(", ")}
|
|
55
|
+
`
|
|
56
|
+
);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
const root = resolve(process.cwd(), String(args.root));
|
|
60
|
+
const dest = join(root, "components", `${entry.name}.alpine`);
|
|
61
|
+
if (existsSync(dest) && !args.force) {
|
|
62
|
+
log(
|
|
63
|
+
` ${color.gray("\u2022")} ${entry.name} already exists at components/${entry.name}.alpine ${color.gray("(use --force to overwrite)")}
|
|
64
|
+
`
|
|
65
|
+
);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
mkdirSync(dirname(dest), { recursive: true });
|
|
69
|
+
cpSync(join(REGISTRY_DIR, entry.file), dest);
|
|
70
|
+
log(` ${color.green("+")} Added ${color.bold(`components/${entry.name}.alpine`)}`);
|
|
71
|
+
log(`
|
|
72
|
+
Use it: ${color.cyan(`<${entry.name} />`)} ${color.gray("in any page/component.")}`);
|
|
73
|
+
log(
|
|
74
|
+
` ${color.gray("It inherits your theme via --ax-* tokens (see")} ${color.cyan("@apex-stack/theme")}${color.gray(").")}
|
|
75
|
+
`
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
export {
|
|
80
|
+
addCommand
|
|
81
|
+
};
|
package/dist/cli.js
CHANGED
|
@@ -133,6 +133,7 @@ var COMMANDS = [
|
|
|
133
133
|
["build", "Build for production (static, islands, or server)"],
|
|
134
134
|
["start", "Run a production server build"],
|
|
135
135
|
["make", "Generate a page, component, route, store, middleware\u2026"],
|
|
136
|
+
["add", "Add a themeable component (button, card, badge\u2026)"],
|
|
136
137
|
["upgrade", "Adopt new scaffold defaults (non-destructive)"],
|
|
137
138
|
["migrate", "Apply pending database migrations"],
|
|
138
139
|
["mcp", "Inspect the MCP server \u2014 list or call tools"]
|
|
@@ -149,6 +150,7 @@ var main = defineCommand2({
|
|
|
149
150
|
build: () => import("./build-VHS6KZBK.js").then((m) => m.buildCommand),
|
|
150
151
|
start: () => import("./start-3O3E43PT.js").then((m) => m.startCommand),
|
|
151
152
|
make: () => import("./make-VAYO5GWA.js").then((m) => m.makeCommand),
|
|
153
|
+
add: () => import("./add-2SBHPLEH.js").then((m) => m.addCommand),
|
|
152
154
|
upgrade: () => import("./upgrade-WC5F5FKY.js").then((m) => m.upgradeCommand),
|
|
153
155
|
migrate: () => import("./migrate-X6LIHMIE.js").then((m) => m.migrateCommand),
|
|
154
156
|
mcp: () => import("./mcp-CH7L4GF3.js").then((m) => m.mcpCommand)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apex-stack/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "The full-stack meta-framework for Alpine.js — CLI and runtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
"files": [
|
|
39
39
|
"dist",
|
|
40
40
|
"templates",
|
|
41
|
-
"vscode"
|
|
41
|
+
"vscode",
|
|
42
|
+
"components"
|
|
42
43
|
],
|
|
43
44
|
"dependencies": {
|
|
44
45
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
package/vscode/apex-alpine.vsix
CHANGED
|
Binary file
|