@dyrected/vue 2.22.0 → 2.24.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/dist/bridge/react-in-vue.d.ts +7 -12
- package/dist/bridge/react-slots.d.ts +18 -0
- package/dist/components/DocumentFields.d.ts +21 -0
- package/dist/components/DyrectedAdmin.vue.d.ts +6 -0
- package/dist/composables/useAccess.d.ts +20 -0
- package/dist/composables/useAdminBridge.d.ts +8 -0
- package/dist/composables/useAdminNavigate.d.ts +13 -0
- package/dist/composables/useAdminNotify.d.ts +8 -0
- package/dist/composables/useCollectionView.d.ts +35 -0
- package/dist/composables/useDocumentForm.d.ts +30 -0
- package/dist/composables/usePageMeta.d.ts +22 -0
- package/dist/composables/usePageRoute.d.ts +15 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +4002 -3705
- package/package.json +5 -4
|
@@ -6,21 +6,16 @@ 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>`.
|
|
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
|
-
*
|
|
14
|
-
*
|
|
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
|
-
(props: any): ReactModule.
|
|
18
|
-
ref: ReactModule.RefObject<HTMLDivElement | null>;
|
|
19
|
-
className: string;
|
|
20
|
-
style: {
|
|
21
|
-
display: "contents";
|
|
22
|
-
};
|
|
23
|
-
}, HTMLDivElement>;
|
|
18
|
+
(props: any): ReactModule.FunctionComponentElement<ReactModule.FragmentProps>;
|
|
24
19
|
displayName: string;
|
|
25
20
|
};
|
|
26
21
|
/**
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { InjectionKey } from 'vue';
|
|
2
|
+
/** Which React component a Vue placeholder asks the bridge to render. */
|
|
3
|
+
export type ReactSlotKind = 'field' | 'fields' | 'defaultForm';
|
|
4
|
+
export interface ReactSlotHandle {
|
|
5
|
+
update(props: Record<string, unknown>): void;
|
|
6
|
+
unmount(): void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Lets a Vue component render a React component *inside the React tree* that
|
|
10
|
+
* hosts the Vue island, through a portal into `el`.
|
|
11
|
+
*
|
|
12
|
+
* Built-in inputs need React contexts (the form engine, react-hook-form, the
|
|
13
|
+
* nested editor). A separate React root would lose them; a portal keeps them.
|
|
14
|
+
*/
|
|
15
|
+
export interface ReactSlotRegistry {
|
|
16
|
+
mount(el: HTMLElement, kind: ReactSlotKind, props: Record<string, unknown>): ReactSlotHandle;
|
|
17
|
+
}
|
|
18
|
+
export declare const DYRECTED_REACT_SLOTS_KEY: InjectionKey<ReactSlotRegistry>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renders one built-in input, wired to the form. Keeps the field's label,
|
|
3
|
+
* validation message, conditions, read-only state and `admin.component` override.
|
|
4
|
+
*/
|
|
5
|
+
export declare const DyrectedField: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {
|
|
8
|
+
[x: string]: any;
|
|
9
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
10
|
+
/** Renders several built-in inputs with the schema's layout rules. Pass `names`, or `exclude` to render the rest. */
|
|
11
|
+
export declare const DyrectedFields: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {
|
|
14
|
+
[x: string]: any;
|
|
15
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
16
|
+
/** Renders the whole built-in form body. Pass `exclude` to leave some fields to your own markup. */
|
|
17
|
+
export declare const DyrectedDefaultForm: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {
|
|
20
|
+
[x: string]: any;
|
|
21
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -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,30 @@
|
|
|
1
|
+
import { ComputedRef, InjectionKey, ShallowRef } from 'vue';
|
|
2
|
+
import { DocumentContextValue, DocumentFormApi, SubmitOptions, SubmitResult } from '@dyrected/admin/public';
|
|
3
|
+
import { VueStateify } from './useAdminSchemas';
|
|
4
|
+
export type { DocumentFormApi, SubmitOptions, SubmitResult };
|
|
5
|
+
/**
|
|
6
|
+
* Ambient key the bridge provides inside custom create and edit forms. The value
|
|
7
|
+
* is a ref the bridge keeps current, so the document and permissions stay reactive.
|
|
8
|
+
*/
|
|
9
|
+
export declare const DYRECTED_DOCUMENT_KEY: InjectionKey<ShallowRef<DocumentContextValue>>;
|
|
10
|
+
/** Same shape as `DocumentFormApi`, with the state fields as refs. */
|
|
11
|
+
export interface VueDocumentFormApi {
|
|
12
|
+
mode: ComputedRef<DocumentFormApi['mode']>;
|
|
13
|
+
collection: ComputedRef<DocumentFormApi['collection']>;
|
|
14
|
+
document: ComputedRef<DocumentFormApi['document']>;
|
|
15
|
+
isLoadingDocument: ComputedRef<boolean>;
|
|
16
|
+
presentation: ComputedRef<DocumentFormApi['presentation']>;
|
|
17
|
+
permissions: ComputedRef<DocumentFormApi['permissions']>;
|
|
18
|
+
urls: ComputedRef<DocumentFormApi['urls']>;
|
|
19
|
+
/** Same as `useDyrectedForm()`: values, errors, `setValue` and the rest, as refs. */
|
|
20
|
+
form: VueStateify<DocumentFormApi['form']>;
|
|
21
|
+
submit: (options?: SubmitOptions) => Promise<SubmitResult>;
|
|
22
|
+
cancel: () => void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Vue composable for custom create and edit forms. Mirrors `useDocumentForm()` in
|
|
26
|
+
* `@dyrected/react`; read state through `.value`.
|
|
27
|
+
*
|
|
28
|
+
* @experimental
|
|
29
|
+
*/
|
|
30
|
+
export declare function useDocumentForm(): VueDocumentFormApi;
|
|
@@ -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;
|