@bndynet/vue-site 1.3.2 → 1.4.1

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/dist/types.d.ts CHANGED
@@ -11,7 +11,7 @@ import { RouteLocationNormalized } from 'vue-router';
11
11
  export type AuthRule = boolean | string | string[] | ((ctx: AuthContext) => boolean | Promise<boolean>);
12
12
  /**
13
13
  * Context passed to `SiteConfig.auth.authorize`. `to` / `from` are present when the guard runs
14
- * during navigation; they are absent during the one-time startup pass that filters the nav menu.
14
+ * during navigation; they are absent while filtering the nav menu.
15
15
  */
16
16
  export interface AuthContext {
17
17
  /** The `auth` rule declared on the matched nav / standalone item. */
@@ -28,8 +28,8 @@ export interface AuthConfig {
28
28
  /**
29
29
  * Decide whether the current user may access a route carrying `rule`. Return `true` to allow,
30
30
  * `false` to deny, or a path string to redirect (e.g. your login page). Runs at navigation time
31
- * on every guarded route, and once at startup (with only `rule` / `item`) to filter the nav menu
32
- * — there, any result other than `true` hides the item.
31
+ * on every guarded route, and whenever the auth-filtered nav menu is refreshed (with only
32
+ * `rule` / `item`) — there, any result other than `true` hides the item.
33
33
  */
34
34
  authorize: (ctx: AuthContext) => boolean | string | Promise<boolean | string>;
35
35
  /**
@@ -93,7 +93,7 @@ export interface NavItem {
93
93
  * Per-page authorization rule, interpreted by `SiteConfig.auth.authorize`. Unlike `visible`
94
94
  * (a build/startup-time existence switch), `auth` keeps the route registered and is enforced by
95
95
  * a navigation guard on every navigation, so it reacts to login/logout and can redirect to a
96
- * login page. It is also evaluated once at startup to hide unauthorized items from the menu.
96
+ * login page. It is also evaluated for the menu whenever auth navigation is refreshed.
97
97
  * Requires `SiteConfig.auth` to be set; otherwise it is ignored.
98
98
  */
99
99
  auth?: AuthRule;
@@ -331,6 +331,14 @@ export interface ShellConfig {
331
331
  */
332
332
  align?: 'left' | 'center' | 'right';
333
333
  }
334
+ /**
335
+ * Consumer-defined public configuration exposed through `useSiteConfig().config.custom`.
336
+ * Extend this interface with TypeScript module augmentation to type application-specific keys.
337
+ * Values are bundled into client code and must not contain secrets.
338
+ */
339
+ export interface SiteCustomConfig {
340
+ [key: string]: unknown;
341
+ }
334
342
  export interface SiteConfig {
335
343
  /** Site title (browser tab + header). Accepts a `LocalizedString` for multi-language sites. */
336
344
  title: LocalizedString;
@@ -364,7 +372,7 @@ export interface SiteConfig {
364
372
  /**
365
373
  * Central authorization policy. When set, any `NavItem` / `StandalonePage` carrying an `auth`
366
374
  * rule is enforced by a navigation guard (redirecting to `auth.loginPath` on denial) and hidden
367
- * from the nav menu at startup when not authorized. Omit to disable authorization entirely.
375
+ * from the nav menu when not authorized. Omit to disable authorization entirely.
368
376
  */
369
377
  auth?: AuthConfig;
370
378
  /** Router history configuration (hash vs HTML5). See `RouterConfig`. */
@@ -408,6 +416,12 @@ export interface SiteConfig {
408
416
  baseUrl?: string;
409
417
  /** Development / build environment configuration */
410
418
  env?: SiteEnvConfig;
419
+ /**
420
+ * Consumer-defined public configuration. The framework preserves these values without
421
+ * interpreting them and exposes them through `useSiteConfig().config.custom`. Values are
422
+ * bundled into client code and must not contain secrets.
423
+ */
424
+ custom?: SiteCustomConfig;
411
425
  /**
412
426
  * Same as `env.watchPackages` (CLI only). Used when `env.watchPackages` is omitted.
413
427
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bndynet/vue-site",
3
- "version": "1.3.2",
3
+ "version": "1.4.1",
4
4
  "type": "module",
5
5
  "description": "A configurable Vue 3 site framework with sidebar navigation, markdown rendering, and theme switching.",
6
6
  "repository": {
@@ -34,7 +34,7 @@
34
34
  "lint": "node -e \"process.exit(0)\"",
35
35
  "clean": "rimraf dist example/example-dist",
36
36
  "build:lib": "vite build",
37
- "build:lib:watch": "vite build --watch",
37
+ "build:lib:watch": "vite build --watch --emptyOutDir false",
38
38
  "dev:example": "npm --prefix example run dev",
39
39
  "dev": "npm run build:lib && concurrently -k -n lib,example -c blue,magenta \"npm run build:lib:watch\" \"npm run dev:example\"",
40
40
  "build": "npm run build:lib && npm install --prefix example && npm run build --prefix example",