@dyrected/vue 2.22.0 → 2.23.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.
@@ -6,12 +6,13 @@ import * as ReactModule from 'react';
6
6
  *
7
7
  * Rather than spinning up a full `createApp()` per rendered instance, each
8
8
  * island is mounted with Vue's low-level `render()` and shares a single
9
- * `appContext` — normally the host app's, captured by `<DyrectedAdmin>`. That
10
- * keeps the cost of many custom fields/slots low and lets host-app plugins,
11
- * `provide`/`inject`, Pinia, and i18n flow into custom components.
9
+ * `appContext` — normally the host app's, captured by `<DyrectedAdmin>`.
12
10
  *
13
- * React is imported from the host dependency graph. The Nuxt adapter dedupes
14
- * React resolution so custom Vue field components share the admin's React copy.
11
+ * An ambient ContextProvider automatically passes down React controllers and
12
+ * providers (form controller, field path, client, theme, and admin bridge) into
13
+ * Vue's `provide()`/`inject()` system so composables like `useDyrectedForm()`,
14
+ * `useField()`, `useAdminNavigate()`, `useAdminNotify()`, and `useAccess()` work
15
+ * out of the box with zero manual provider ceremony.
15
16
  */
16
17
  export declare function wrapVueComponent(VueComp: Component, appContext?: AppContext | null): {
17
18
  (props: any): ReactModule.DetailedReactHTMLElement<{
@@ -13,6 +13,12 @@ type __VLS_Props = {
13
13
  * Can be raw Vue components; they will be automatically wrapped.
14
14
  */
15
15
  components?: any;
16
+ /**
17
+ * In development, warn once for each registered component the schema never
18
+ * references. Set to `false` to silence it.
19
+ * @default true
20
+ */
21
+ warnUnusedComponents?: boolean;
16
22
  /** Optional externally managed admin theme controller. */
17
23
  themeController?: AdminThemeController;
18
24
  /** Preferred theme when the wrapper should control the admin theme. */
@@ -0,0 +1,20 @@
1
+ import { AdminAccessHelpers } from './useAdminBridge';
2
+ export type { AdminAccessHelpers };
3
+ export interface UseAccessResult {
4
+ /**
5
+ * Evaluates whether the current user is permitted to perform an operation on a collection.
6
+ *
7
+ * IMPORTANT LIMITATIONS & SEMANTICS:
8
+ * 1. Evaluates collection-level boolean and string (JEXL) access rules only (`collection.access[operation]`).
9
+ * 2. Does not evaluate field-level access rules (`field.access`).
10
+ * 3. Function-based access rules and unknown/missing collection rules cannot be evaluated on the client and will return `true` as a non-blocking fallback.
11
+ * 4. This is purely a best-effort client-side UI hint to show/hide controls or disable actions. Server-side access rules remain the authoritative enforcement point.
12
+ */
13
+ can: (operation: "create" | "read" | "update" | "delete", collection: string, doc?: Record<string, unknown>) => boolean;
14
+ }
15
+ /**
16
+ * Vue composable for UI gating based on collection access rules.
17
+ *
18
+ * @experimental
19
+ */
20
+ export declare function useAccess(): UseAccessResult;
@@ -0,0 +1,8 @@
1
+ import { InjectionKey } from 'vue';
2
+ import { AdminBridgeBundle, AdminNavigateTarget, AdminNavigateHelpers, AdminNotifyHelpers, AdminNotifyOptions, AdminAccessHelpers } from '@dyrected/admin/public';
3
+ export type { AdminBridgeBundle, AdminNavigateTarget, AdminNavigateHelpers, AdminNotifyHelpers, AdminNotifyOptions, AdminAccessHelpers, };
4
+ export declare const DYRECTED_ADMIN_KEY: InjectionKey<AdminBridgeBundle>;
5
+ /**
6
+ * Access the ambient admin bridge bundle injected across the React-in-Vue bridge.
7
+ */
8
+ export declare function useAdminBridge(): AdminBridgeBundle;
@@ -0,0 +1,13 @@
1
+ import { AdminNavigateHelpers, AdminNavigateTarget } from './useAdminBridge';
2
+ export interface AdminNavigateResult {
3
+ navigate: (to: AdminNavigateTarget, options?: {
4
+ replace?: boolean;
5
+ }) => void;
6
+ to: AdminNavigateHelpers;
7
+ }
8
+ /**
9
+ * Vue composable for programmatic navigation in custom admin surfaces.
10
+ *
11
+ * @experimental
12
+ */
13
+ export declare function useAdminNavigate(): AdminNavigateResult;
@@ -0,0 +1,8 @@
1
+ import { AdminNotifyHelpers, AdminNotifyOptions } from './useAdminBridge';
2
+ export type { AdminNotifyHelpers, AdminNotifyOptions };
3
+ /**
4
+ * Vue composable for displaying toast notifications in custom admin surfaces.
5
+ *
6
+ * @experimental
7
+ */
8
+ export declare function useAdminNotify(): AdminNotifyHelpers;
@@ -0,0 +1,35 @@
1
+ import { ComputedRef, InjectionKey } from 'vue';
2
+ import { CollectionViewApi, DocumentGroup, ResolvedViewAction, ViewController, ViewDocument } from '@dyrected/admin/public';
3
+ export type { CollectionViewApi, ResolvedViewAction, ViewDocument, DocumentGroup };
4
+ /** Ambient key the bridge provides inside custom view layouts. */
5
+ export declare const DYRECTED_VIEW_KEY: InjectionKey<ViewController>;
6
+ /** Same shape as `CollectionViewApi`, with the state fields as refs. */
7
+ export type VueCollectionViewApi = {
8
+ [K in keyof CollectionViewApi]: CollectionViewApi[K] extends (...args: any[]) => any ? CollectionViewApi[K] : ComputedRef<CollectionViewApi[K]>;
9
+ };
10
+ /**
11
+ * Vue composable for custom view layouts. Mirrors `useCollectionView()` in
12
+ * `@dyrected/react`; read state through `.value`.
13
+ *
14
+ * @experimental
15
+ */
16
+ export declare function useCollectionView(): VueCollectionViewApi;
17
+ export interface VueViewActionsApi {
18
+ actions: ComputedRef<ResolvedViewAction[]>;
19
+ run: (name: string, docs?: ViewDocument[], input?: Record<string, unknown>) => Promise<boolean>;
20
+ isRunning: (name: string, docs?: ViewDocument[]) => boolean;
21
+ }
22
+ /**
23
+ * Vue composable for running the view's actions from a custom layout. The host
24
+ * shows its own confirm dialog and input form.
25
+ *
26
+ * @experimental
27
+ */
28
+ export declare function useViewActions(): VueViewActionsApi;
29
+ /**
30
+ * Groups the view's documents by a field, resolving select labels and
31
+ * populated relationship names.
32
+ *
33
+ * @experimental
34
+ */
35
+ export declare function useGroupedDocuments(groupBy: string | (() => string)): ComputedRef<import('@dyrected/admin/public').GroupedDocuments>;
@@ -0,0 +1,22 @@
1
+ import { InjectionKey, MaybeRefOrGetter } from 'vue';
2
+ import { PageAction, PageBreadcrumbItem, PageConfig } from '@dyrected/core';
3
+ export interface PageMeta {
4
+ title?: string;
5
+ description?: string;
6
+ breadcrumbs?: PageBreadcrumbItem[];
7
+ actions?: PageAction[];
8
+ }
9
+ export interface PageMetaBridgeValue {
10
+ meta: PageMeta;
11
+ setMeta: (next: Partial<PageMeta> | ((prev: PageMeta) => PageMeta)) => void;
12
+ options?: Record<string, unknown>;
13
+ page?: PageConfig;
14
+ }
15
+ export declare const DYRECTED_PAGE_KEY: InjectionKey<PageMetaBridgeValue>;
16
+ export interface UsePageMetaResult {
17
+ options?: Record<string, unknown>;
18
+ page?: PageConfig;
19
+ meta: PageMeta;
20
+ setMeta: (next: Partial<PageMeta> | ((prev: PageMeta) => PageMeta)) => void;
21
+ }
22
+ export declare function usePageMeta(meta?: MaybeRefOrGetter<Partial<PageMeta> | undefined>): UsePageMetaResult;
@@ -0,0 +1,15 @@
1
+ import { InjectionKey } from 'vue';
2
+ export interface PageRouteBridgeValue {
3
+ params: Record<string, string>;
4
+ splat: string;
5
+ searchParams: URLSearchParams;
6
+ setSearchParams: (next: any, opts?: {
7
+ replace?: boolean;
8
+ }) => void;
9
+ navigate: (subPath: string, opts?: {
10
+ replace?: boolean;
11
+ }) => void;
12
+ }
13
+ export declare const DYRECTED_PAGE_ROUTE_KEY: InjectionKey<PageRouteBridgeValue>;
14
+ export type PageRoute = PageRouteBridgeValue;
15
+ export declare function usePageRoute(): PageRoute;