@ansiversa/components 0.0.117 → 0.0.119

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/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { default as WebLayout } from "./src/layouts/WebLayout.astro";
2
2
  export { default as AuthLayout } from "./src/layouts/AuthLayout.astro";
3
+ export { default as AvMiniAppBar } from "./src/layouts/AvMiniAppBar.astro";
3
4
  export { default as AvBrand } from './src/AvBrand.astro';
4
5
  export { default as AvButton } from './src/AvButton.astro';
5
6
  export { default as AvCard } from './src/AvCard.astro';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ansiversa/components",
3
- "version": "0.0.117",
3
+ "version": "0.0.119",
4
4
  "description": "Shared UI components and layouts for the Ansiversa ecosystem",
5
5
  "type": "module",
6
6
  "exports": {
@@ -16,9 +16,14 @@
16
16
  "keywords": [
17
17
  "astro-component"
18
18
  ],
19
- "scripts": {},
19
+ "scripts": {
20
+ "typecheck": "astro check",
21
+ "build": "astro check"
22
+ },
20
23
  "devDependencies": {
21
- "astro": "^5.16.3"
24
+ "@astrojs/check": "^0.9.6",
25
+ "astro": "^5.16.3",
26
+ "typescript": "^5.9.3"
22
27
  },
23
28
  "peerDependencies": {
24
29
  "astro": "^4.0.0 || ^5.0.0"
@@ -104,7 +104,6 @@ const scriptContent = `
104
104
  data-id={item.id}
105
105
  data-disabled={item.disabled ? "true" : undefined}
106
106
  aria-disabled={item.disabled ? "true" : undefined}
107
- disabled={item.disabled ? true : undefined}
108
107
  >
109
108
  <summary
110
109
  class="av-accordion__summary"
@@ -0,0 +1,73 @@
1
+ ---
2
+ import type { MiniAppLink } from "./miniAppRegistry";
3
+ import { MINI_APP_REGISTRY } from "./miniAppRegistry";
4
+
5
+ interface Props {
6
+ appKey: string;
7
+ links?: MiniAppLink[];
8
+ }
9
+
10
+ const { appKey, links } = Astro.props as Props;
11
+
12
+ const meta = MINI_APP_REGISTRY[appKey];
13
+ const appName = meta?.name ?? appKey;
14
+
15
+ let menuLinks = links ?? meta?.links ?? [];
16
+ if (!menuLinks.length) {
17
+ menuLinks = [{ label: "Home", href: "/" }];
18
+ }
19
+ ---
20
+
21
+ <div class="av-mini-app-bar">
22
+ <div class="av-mini-app-bar__inner">
23
+ <div class="av-mini-app-bar__title" title={appName}>
24
+ <span class="av-mini-app-bar__name">{appName}</span>
25
+ </div>
26
+
27
+ <div class="av-mini-app-bar__menu" x-data="{ open: false }">
28
+ <button
29
+ type="button"
30
+ class="av-mini-app-bar__menu-button"
31
+ aria-label="Open app menu"
32
+ aria-haspopup="menu"
33
+ x-on:click="open = !open"
34
+ x-bind:aria-expanded="open"
35
+ >
36
+ <svg
37
+ class="av-mini-app-bar__menu-icon"
38
+ width="18"
39
+ height="18"
40
+ viewBox="0 0 24 24"
41
+ fill="none"
42
+ stroke="currentColor"
43
+ stroke-width="2"
44
+ stroke-linecap="round"
45
+ stroke-linejoin="round"
46
+ aria-hidden="true"
47
+ >
48
+ <circle cx="12" cy="5" r="1.5" />
49
+ <circle cx="12" cy="12" r="1.5" />
50
+ <circle cx="12" cy="19" r="1.5" />
51
+ </svg>
52
+ </button>
53
+
54
+ <div
55
+ x-show="open"
56
+ x-cloak
57
+ x-transition.origin.top.right
58
+ x-on:click.outside="open = false"
59
+ class="av-user-menu av-mini-app-menu"
60
+ role="menu"
61
+ aria-label={`${appName} menu`}
62
+ >
63
+ <div class="av-nav-user-menu">
64
+ {menuLinks.map((item) => (
65
+ <a href={item.href} class="av-dropdown-item" role="menuitem">
66
+ <span>{item.label}</span>
67
+ </a>
68
+ ))}
69
+ </div>
70
+ </div>
71
+ </div>
72
+ </div>
73
+ </div>
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  import AvBrand from "../AvBrand.astro";
3
3
  import AvFooter from "../AvFooter.astro";
4
+ import AvMiniAppBar from "./AvMiniAppBar.astro";
4
5
  import AvNavbar from "../AvNavbar.astro";
5
6
  import AvNavbarActions from "../AvNavbarActions.astro";
6
7
 
@@ -8,15 +9,24 @@ interface Props {
8
9
  title?: string;
9
10
  description?: string;
10
11
  notificationUnreadCount?: number;
12
+ miniAppKey?: string;
13
+ links?: { label: string; href: string }[];
11
14
  }
12
15
 
13
16
  const {
14
17
  title = "Ansiversa",
15
18
  description = "Ansiversa – A unified ecosystem of premium Apps designed to feel simple, powerful, and delightful.",
16
19
  notificationUnreadCount = 0,
20
+ miniAppKey,
21
+ links,
17
22
  } = Astro.props;
18
23
 
19
- const user = Astro.locals.user;
24
+ const user = (Astro.locals as { user?: {
25
+ id: string;
26
+ email: string;
27
+ name?: string;
28
+ roleId?: number;
29
+ } }).user;
20
30
 
21
31
  const rawDomain = (
22
32
  import.meta.env.PUBLIC_SITE_URL ||
@@ -77,6 +87,8 @@ const ROOT_URL = rawDomain.match(/^https?:\/\//i)
77
87
  <AvNavbarActions user={user} notificationUnreadCount={notificationUnreadCount} />
78
88
  </AvNavbar>
79
89
 
90
+ {miniAppKey && <AvMiniAppBar appKey={miniAppKey} links={links} />}
91
+
80
92
  <!-- Main content -->
81
93
  <main class="av-main">
82
94
  <slot />
@@ -0,0 +1,25 @@
1
+ export type MiniAppLink = { label: string; href: string };
2
+ export type MiniAppMeta = { name: string; links: MiniAppLink[] };
3
+
4
+ export const MINI_APP_REGISTRY: Record<string, MiniAppMeta> = {
5
+ "quiz": {
6
+ name: "Quiz",
7
+ links: [{ label: "Home", href: "/" }],
8
+ },
9
+ "resume-builder": {
10
+ name: "Resume Builder",
11
+ links: [{ label: "Home", href: "/" }],
12
+ },
13
+ "portfolio-creator": {
14
+ name: "Portfolio Creator",
15
+ links: [{ label: "Home", href: "/" }],
16
+ },
17
+ "app-starter": {
18
+ name: "App Starter",
19
+ links: [{ label: "Home", href: "/" }],
20
+ },
21
+ "flashnote": {
22
+ name: "FlashNote",
23
+ links: [{ label: "Home", href: "/" }],
24
+ },
25
+ };
@@ -1404,6 +1404,39 @@
1404
1404
  @apply text-slate-50;
1405
1405
  }
1406
1406
 
1407
+ /* Mini-app context bar ------------------------------- */
1408
+
1409
+ .av-mini-app-bar {
1410
+ @apply border-b border-slate-800/60 bg-slate-950/70 backdrop-blur-xl;
1411
+ position: relative;
1412
+ z-index: 40;
1413
+ }
1414
+
1415
+ .av-mini-app-bar__inner {
1416
+ @apply w-full max-w-none px-4 py-2 flex items-center justify-between gap-3;
1417
+ }
1418
+
1419
+ .av-mini-app-bar__title {
1420
+ @apply text-sm font-medium text-slate-100;
1421
+ min-width: 0;
1422
+ }
1423
+
1424
+ .av-mini-app-bar__name {
1425
+ @apply block truncate;
1426
+ }
1427
+
1428
+ .av-mini-app-bar__menu {
1429
+ @apply relative;
1430
+ }
1431
+
1432
+ .av-mini-app-bar__menu-button {
1433
+ @apply inline-flex h-8 w-8 items-center justify-center rounded-lg border border-slate-800/70 bg-slate-950/60 text-slate-200 transition hover:border-slate-600 hover:text-slate-50;
1434
+ }
1435
+
1436
+ .av-mini-app-menu {
1437
+ @apply w-56 mt-2;
1438
+ }
1439
+
1407
1440
  /* Badges / Pills --------------------------------------- */
1408
1441
 
1409
1442
  .av-badge {