@dyrected/vue 2.5.60 → 2.5.62
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 +11 -4
- package/dist/components/DyrectedAdmin.vue.d.ts +0 -5
- package/dist/composables/useDyrected.d.ts +15 -6
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3486 -3490
- package/package.json +4 -4
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import { Component } from 'vue';
|
|
1
|
+
import { AppContext, Component } from 'vue';
|
|
2
2
|
import * as ReactModule from 'react';
|
|
3
3
|
/**
|
|
4
4
|
* wrapVueComponent — Higher-order component that wraps a Vue 3 component
|
|
5
5
|
* so it can be rendered within a React component tree.
|
|
6
6
|
*
|
|
7
|
+
* Rather than spinning up a full `createApp()` per rendered instance, each
|
|
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.
|
|
12
|
+
*
|
|
7
13
|
* React is imported from the host dependency graph. The Nuxt adapter dedupes
|
|
8
14
|
* React resolution so custom Vue field components share the admin's React copy.
|
|
9
15
|
*/
|
|
10
|
-
export declare function wrapVueComponent(VueComp: Component): {
|
|
16
|
+
export declare function wrapVueComponent(VueComp: Component, appContext?: AppContext | null): {
|
|
11
17
|
(props: any): ReactModule.DetailedReactHTMLElement<{
|
|
12
18
|
ref: ReactModule.RefObject<HTMLDivElement | null>;
|
|
13
19
|
className: string;
|
|
@@ -19,6 +25,7 @@ export declare function wrapVueComponent(VueComp: Component): {
|
|
|
19
25
|
};
|
|
20
26
|
/**
|
|
21
27
|
* wrapComponents — Recursively wraps all components in a nested object.
|
|
22
|
-
* Useful for the `components` prop in DyrectedAdmin.
|
|
28
|
+
* Useful for the `components` prop in DyrectedAdmin. The optional `appContext`
|
|
29
|
+
* is threaded down so every wrapped island shares the host app's context.
|
|
23
30
|
*/
|
|
24
|
-
export declare function wrapComponents(components: any): any;
|
|
31
|
+
export declare function wrapComponents(components: any, appContext?: AppContext | null): any;
|
|
@@ -7,11 +7,6 @@ type __VLS_Props = {
|
|
|
7
7
|
siteId: string;
|
|
8
8
|
baseUrl: string;
|
|
9
9
|
};
|
|
10
|
-
/**
|
|
11
|
-
* The base path where the admin is mounted.
|
|
12
|
-
* @default "/admin"
|
|
13
|
-
*/
|
|
14
|
-
basename?: string;
|
|
15
10
|
/**
|
|
16
11
|
* Custom components to inject into the Admin UI.
|
|
17
12
|
* Can be raw Vue components; they will be automatically wrapped.
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import { Ref, InjectionKey } from 'vue';
|
|
2
|
-
import { DyrectedClient,
|
|
2
|
+
import { DyrectedClient, SchemaShape, RegisteredSchema } from '@dyrected/sdk';
|
|
3
|
+
/** A collection slug from your registered schema (or any string until types are generated). */
|
|
4
|
+
type CollectionSlug = keyof RegisteredSchema['collections'] & string;
|
|
5
|
+
/** The document type for a given collection slug. */
|
|
6
|
+
type CollectionDoc<K extends CollectionSlug> = RegisteredSchema['collections'][K];
|
|
7
|
+
/** A global slug from your registered schema. */
|
|
8
|
+
type GlobalSlug = keyof RegisteredSchema['globals'] & string;
|
|
9
|
+
/** The data type for a given global slug. */
|
|
10
|
+
type GlobalData<K extends GlobalSlug> = RegisteredSchema['globals'][K];
|
|
3
11
|
export declare const DYRECTED_CLIENT_KEY: InjectionKey<DyrectedClient>;
|
|
4
12
|
/**
|
|
5
13
|
* useDyrectedClient — Returns the injected Dyrected client.
|
|
6
14
|
*/
|
|
7
|
-
export declare function useDyrectedClient<TSchema extends
|
|
15
|
+
export declare function useDyrectedClient<TSchema extends SchemaShape = RegisteredSchema>(): DyrectedClient<TSchema>;
|
|
8
16
|
/**
|
|
9
17
|
* provideDyrectedClient — Provides a Dyrected client to the Vue app.
|
|
10
18
|
*/
|
|
11
19
|
export declare function provideDyrectedClient(client: DyrectedClient): {
|
|
12
|
-
[x: number]: DyrectedClient<BaseSchema>;
|
|
20
|
+
[x: number]: DyrectedClient<import('@dyrected/sdk').BaseSchema>;
|
|
13
21
|
};
|
|
14
22
|
export interface UseDyrectedOptions {
|
|
15
23
|
depth?: number;
|
|
@@ -18,7 +26,7 @@ export interface UseDyrectedOptions {
|
|
|
18
26
|
/**
|
|
19
27
|
* useDyrected — Reactive composable for fetching a single document.
|
|
20
28
|
*/
|
|
21
|
-
export declare function useDyrected<T =
|
|
29
|
+
export declare function useDyrected<K extends CollectionSlug, T = CollectionDoc<K>>(collection: K, idOrSlug: string, options?: UseDyrectedOptions): {
|
|
22
30
|
doc: Ref<T | null, T | null>;
|
|
23
31
|
pending: Ref<boolean, boolean>;
|
|
24
32
|
error: Ref<any, any>;
|
|
@@ -27,7 +35,7 @@ export declare function useDyrected<T = any>(collection: string, idOrSlug: strin
|
|
|
27
35
|
/**
|
|
28
36
|
* useDyrectedCollection — Reactive composable for fetching a collection.
|
|
29
37
|
*/
|
|
30
|
-
export declare function useDyrectedCollection<T =
|
|
38
|
+
export declare function useDyrectedCollection<K extends CollectionSlug, T = CollectionDoc<K>>(collection: K, options?: UseDyrectedOptions): {
|
|
31
39
|
docs: Ref<T[], T[]>;
|
|
32
40
|
pending: Ref<boolean, boolean>;
|
|
33
41
|
error: Ref<any, any>;
|
|
@@ -36,9 +44,10 @@ export declare function useDyrectedCollection<T = any>(collection: string, optio
|
|
|
36
44
|
/**
|
|
37
45
|
* useDyrectedGlobal — Reactive composable for fetching a global.
|
|
38
46
|
*/
|
|
39
|
-
export declare function useDyrectedGlobal<T =
|
|
47
|
+
export declare function useDyrectedGlobal<K extends GlobalSlug, T = GlobalData<K>>(slug: K, options?: UseDyrectedOptions): {
|
|
40
48
|
data: Ref<T | null, T | null>;
|
|
41
49
|
pending: Ref<boolean, boolean>;
|
|
42
50
|
error: Ref<any, any>;
|
|
43
51
|
refresh: () => Promise<void>;
|
|
44
52
|
};
|
|
53
|
+
export {};
|