@dyrected/vue 2.5.51 → 2.5.53
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/components/Blocks.d.ts +57 -0
- package/dist/components/DyPathScope.d.ts +25 -0
- package/dist/components/DyrectedIcon.vue.d.ts +17 -0
- package/dist/composables/useDyPath.d.ts +30 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +32771 -90
- package/package.json +5 -3
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { PropType, Component } from 'vue';
|
|
2
|
+
export interface BlocksItem {
|
|
3
|
+
/** Discriminator selecting which component renders this item. */
|
|
4
|
+
blockType: string;
|
|
5
|
+
/**
|
|
6
|
+
* Selected presentation variant, when the block defines `variants` in its
|
|
7
|
+
* schema. Passed straight through to the component so it can switch layout.
|
|
8
|
+
*/
|
|
9
|
+
variant?: string;
|
|
10
|
+
/** Optional stable id; used as the render key when present. */
|
|
11
|
+
id?: string;
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Blocks — renders an array of block items by `blockType`, wrapping each in a
|
|
16
|
+
* `DyPathScope` scoped to `${path}.${index}` so child components can call
|
|
17
|
+
* `useDyPath('field')` without ever writing an index or full path.
|
|
18
|
+
*
|
|
19
|
+
* Render-function component (no template/JSX) so the package needs no extra
|
|
20
|
+
* build tooling.
|
|
21
|
+
*
|
|
22
|
+
* @example (render function usage in a page)
|
|
23
|
+
* h(Blocks, { items: data.body, components: { hero: HeroBlock } })
|
|
24
|
+
* @example (template usage)
|
|
25
|
+
* <Blocks :items="data.body" :components="{ hero: HeroBlock }" />
|
|
26
|
+
*/
|
|
27
|
+
export declare const Blocks: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
28
|
+
items: {
|
|
29
|
+
type: PropType<BlocksItem[]>;
|
|
30
|
+
required: true;
|
|
31
|
+
};
|
|
32
|
+
components: {
|
|
33
|
+
type: PropType<Record<string, Component>>;
|
|
34
|
+
required: true;
|
|
35
|
+
};
|
|
36
|
+
path: {
|
|
37
|
+
type: StringConstructor;
|
|
38
|
+
default: string;
|
|
39
|
+
};
|
|
40
|
+
}>, () => (import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
}> | null)[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
43
|
+
items: {
|
|
44
|
+
type: PropType<BlocksItem[]>;
|
|
45
|
+
required: true;
|
|
46
|
+
};
|
|
47
|
+
components: {
|
|
48
|
+
type: PropType<Record<string, Component>>;
|
|
49
|
+
required: true;
|
|
50
|
+
};
|
|
51
|
+
path: {
|
|
52
|
+
type: StringConstructor;
|
|
53
|
+
default: string;
|
|
54
|
+
};
|
|
55
|
+
}>> & Readonly<{}>, {
|
|
56
|
+
path: string;
|
|
57
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DyPathScope — a minimal wrapper component whose sole job is to own one
|
|
3
|
+
* `provide()` scope for the ambient base path.
|
|
4
|
+
*
|
|
5
|
+
* In Vue, `provide()` is bound to the calling component *instance*, not to a
|
|
6
|
+
* render position, so a single component cannot provide a distinct value per
|
|
7
|
+
* item in a loop. `<Blocks>` renders one `DyPathScope` per item to give each
|
|
8
|
+
* block its own scoped base path.
|
|
9
|
+
*
|
|
10
|
+
* Written as a render-function component (no template/JSX) so the package needs
|
|
11
|
+
* no extra build tooling.
|
|
12
|
+
*/
|
|
13
|
+
export declare const DyPathScope: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
14
|
+
path: {
|
|
15
|
+
type: StringConstructor;
|
|
16
|
+
required: true;
|
|
17
|
+
};
|
|
18
|
+
}>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}>[] | undefined, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
21
|
+
path: {
|
|
22
|
+
type: StringConstructor;
|
|
23
|
+
required: true;
|
|
24
|
+
};
|
|
25
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/**
|
|
3
|
+
* The value of an `icon` field — a Lucide icon name such as
|
|
4
|
+
* `"ChartNoAxesCombined"` or `"BellRing"`. See https://lucide.dev/icons.
|
|
5
|
+
* Typed as `string` rather than the 1700+ icon-name union to avoid a TS
|
|
6
|
+
* "union too complex" (TS2590) blow-up in the generated declarations.
|
|
7
|
+
*/
|
|
8
|
+
name?: string | null;
|
|
9
|
+
/**
|
|
10
|
+
* Icon name to render when `name` is missing or not a known icon.
|
|
11
|
+
* Renders nothing when omitted and `name` cannot be resolved.
|
|
12
|
+
*/
|
|
13
|
+
fallback?: string;
|
|
14
|
+
};
|
|
15
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { InjectionKey } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Injection key carrying the ambient base path for the block/section currently
|
|
4
|
+
* being rendered, e.g. "body.2". `provideDyPath` sets it; `useDyPath` reads it.
|
|
5
|
+
* Defaults to '' (document root).
|
|
6
|
+
*/
|
|
7
|
+
export declare const DY_PATH_KEY: InjectionKey<string>;
|
|
8
|
+
/**
|
|
9
|
+
* provideDyPath — set the ambient base path for the current component's
|
|
10
|
+
* subtree. Must be called in `setup()`. `<Blocks>` calls this for you via
|
|
11
|
+
* `DyPathScope`; use it directly only for a standalone section.
|
|
12
|
+
*/
|
|
13
|
+
export declare function provideDyPath(path: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* useDyPath — returns an attribute object annotating an element with its
|
|
16
|
+
* document value path, so the Dyrected live-preview editor can map a click in
|
|
17
|
+
* the preview back to the exact field. Spread it onto the element (render
|
|
18
|
+
* functions) or bind with `v-bind` in templates.
|
|
19
|
+
*
|
|
20
|
+
* Must be called in `setup()`. Authors pass only the field name relative to the
|
|
21
|
+
* current block; the ancestor `<Blocks>`/`provideDyPath` supplies the base path.
|
|
22
|
+
*
|
|
23
|
+
* @example (render function)
|
|
24
|
+
* h('h1', useDyPath('heading'), props.heading)
|
|
25
|
+
* @example (template)
|
|
26
|
+
* <h1 v-bind="useDyPath('heading')">{{ heading }}</h1>
|
|
27
|
+
*/
|
|
28
|
+
export declare function useDyPath(field?: string): {
|
|
29
|
+
'data-dy-path': string;
|
|
30
|
+
};
|