vue-datocms 8.1.8 → 8.1.10

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/index.cjs.js CHANGED
@@ -124,8 +124,19 @@ const ContentLink = vue.defineComponent({
124
124
  required: false
125
125
  },
126
126
  /**
127
- * Enable click-to-edit on mount. Pass true for default behavior or an object with scrollToNearestTarget.
128
- * If undefined, click-to-edit is disabled and editors can use Alt/Option key for temporary activation.
127
+ * Whether to enable click-to-edit overlays on mount, or options to configure them.
128
+ *
129
+ * - `true`: Enable click-to-edit mode immediately
130
+ * - `{ scrollToNearestTarget: true }`: Enable and scroll to nearest editable if none visible
131
+ * - `{ hoverOnly: true }`: Only enable on devices with hover capability (non-touch)
132
+ * - `false`/`undefined`: Don't enable automatically (use Alt/Option key to toggle)
133
+ *
134
+ * @example
135
+ * ```vue
136
+ * <ContentLink :enable-click-to-edit="true" />
137
+ * <ContentLink :enable-click-to-edit="{ scrollToNearestTarget: true }" />
138
+ * <ContentLink :enable-click-to-edit="{ hoverOnly: true, scrollToNearestTarget: true }" />
139
+ * ```
129
140
  */
130
141
  enableClickToEdit: {
131
142
  type: [Boolean, Object],
@@ -146,7 +157,7 @@ const ContentLink = vue.defineComponent({
146
157
  root: props.root
147
158
  });
148
159
  vue.onMounted(() => {
149
- if (props.enableClickToEdit !== void 0) {
160
+ if (props.enableClickToEdit) {
150
161
  enableClickToEditFn(
151
162
  props.enableClickToEdit === true ? void 0 : props.enableClickToEdit
152
163
  );
package/dist/index.d.ts CHANGED
@@ -11,6 +11,29 @@ import { StreamTypes, MaxResolutionValue, MinResolutionValue, CmcdTypes, Playbac
11
11
  import MuxPlayerElement, { Tokens } from '@mux/mux-player';
12
12
  import { Options, ConnectionStatus } from 'datocms-listen';
13
13
 
14
+ interface ClickToEditOptions {
15
+ /**
16
+ * Whether to automatically scroll to the nearest editable element if none
17
+ * is currently visible in the viewport when click-to-edit mode is enabled.
18
+ *
19
+ * @default false
20
+ */
21
+ scrollToNearestTarget?: boolean;
22
+ /**
23
+ * Only enable click-to-edit on devices that support hover (i.e., non-touch devices).
24
+ * Uses `window.matchMedia('(hover: hover)')` to detect hover capability.
25
+ *
26
+ * This is useful to avoid showing overlays on touch devices where they may
27
+ * interfere with normal scrolling and tapping behavior.
28
+ *
29
+ * When set to `true` on a touch-only device, click-to-edit will not be
30
+ * automatically enabled, but users can still toggle it manually using
31
+ * the Alt/Option key.
32
+ *
33
+ * @default false
34
+ */
35
+ hoverOnly?: boolean;
36
+ }
14
37
  type UseContentLinkOptions = {
15
38
  /**
16
39
  * Whether the controller is enabled, or an options object.
@@ -38,9 +61,7 @@ type UseContentLinkResult = {
38
61
  /** The controller instance, or null if disabled */
39
62
  controller: Ref<Controller | null>;
40
63
  /** Enable click-to-edit overlays */
41
- enableClickToEdit: (options?: {
42
- scrollToNearestTarget: boolean;
43
- }) => void;
64
+ enableClickToEdit: (options?: ClickToEditOptions) => void;
44
65
  /** Disable click-to-edit overlays */
45
66
  disableClickToEdit: () => void;
46
67
  /** Check if click-to-edit is enabled */
@@ -94,10 +115,22 @@ declare function useContentLink(options?: UseContentLinkOptions): UseContentLink
94
115
  type ContentLinkProps = Omit<UseContentLinkOptions, 'enabled'> & {
95
116
  /** Current pathname to sync with Web Previews plugin */
96
117
  currentPath?: string;
97
- /** Enable click-to-edit on mount. Pass true for default behavior or an object with scrollToNearestTarget. If undefined, click-to-edit is disabled. */
98
- enableClickToEdit?: true | {
99
- scrollToNearestTarget: true;
100
- };
118
+ /**
119
+ * Whether to enable click-to-edit overlays on mount, or options to configure them.
120
+ *
121
+ * - `true`: Enable click-to-edit mode immediately
122
+ * - `{ scrollToNearestTarget: true }`: Enable and scroll to nearest editable if none visible
123
+ * - `{ hoverOnly: true }`: Only enable on devices with hover capability (non-touch)
124
+ * - `false`/`undefined`: Don't enable automatically (use Alt/Option key to toggle)
125
+ *
126
+ * @example
127
+ * ```vue
128
+ * <ContentLink :enable-click-to-edit="true" />
129
+ * <ContentLink :enable-click-to-edit="{ scrollToNearestTarget: true }" />
130
+ * <ContentLink :enable-click-to-edit="{ hoverOnly: true, scrollToNearestTarget: true }" />
131
+ * ```
132
+ */
133
+ enableClickToEdit?: boolean | ClickToEditOptions;
101
134
  /** Whether to strip stega encoding from text nodes after stamping. */
102
135
  stripStega?: boolean;
103
136
  };
@@ -225,13 +258,22 @@ declare const ContentLink: vue.DefineComponent<{
225
258
  required: false;
226
259
  };
227
260
  /**
228
- * Enable click-to-edit on mount. Pass true for default behavior or an object with scrollToNearestTarget.
229
- * If undefined, click-to-edit is disabled and editors can use Alt/Option key for temporary activation.
261
+ * Whether to enable click-to-edit overlays on mount, or options to configure them.
262
+ *
263
+ * - `true`: Enable click-to-edit mode immediately
264
+ * - `{ scrollToNearestTarget: true }`: Enable and scroll to nearest editable if none visible
265
+ * - `{ hoverOnly: true }`: Only enable on devices with hover capability (non-touch)
266
+ * - `false`/`undefined`: Don't enable automatically (use Alt/Option key to toggle)
267
+ *
268
+ * @example
269
+ * ```vue
270
+ * <ContentLink :enable-click-to-edit="true" />
271
+ * <ContentLink :enable-click-to-edit="{ scrollToNearestTarget: true }" />
272
+ * <ContentLink :enable-click-to-edit="{ hoverOnly: true, scrollToNearestTarget: true }" />
273
+ * ```
230
274
  */
231
275
  enableClickToEdit: {
232
- type: PropType<true | {
233
- scrollToNearestTarget: true;
234
- }>;
276
+ type: PropType<boolean | ClickToEditOptions>;
235
277
  required: false;
236
278
  };
237
279
  /**
@@ -275,13 +317,22 @@ declare const ContentLink: vue.DefineComponent<{
275
317
  required: false;
276
318
  };
277
319
  /**
278
- * Enable click-to-edit on mount. Pass true for default behavior or an object with scrollToNearestTarget.
279
- * If undefined, click-to-edit is disabled and editors can use Alt/Option key for temporary activation.
320
+ * Whether to enable click-to-edit overlays on mount, or options to configure them.
321
+ *
322
+ * - `true`: Enable click-to-edit mode immediately
323
+ * - `{ scrollToNearestTarget: true }`: Enable and scroll to nearest editable if none visible
324
+ * - `{ hoverOnly: true }`: Only enable on devices with hover capability (non-touch)
325
+ * - `false`/`undefined`: Don't enable automatically (use Alt/Option key to toggle)
326
+ *
327
+ * @example
328
+ * ```vue
329
+ * <ContentLink :enable-click-to-edit="true" />
330
+ * <ContentLink :enable-click-to-edit="{ scrollToNearestTarget: true }" />
331
+ * <ContentLink :enable-click-to-edit="{ hoverOnly: true, scrollToNearestTarget: true }" />
332
+ * ```
280
333
  */
281
334
  enableClickToEdit: {
282
- type: PropType<true | {
283
- scrollToNearestTarget: true;
284
- }>;
335
+ type: PropType<boolean | ClickToEditOptions>;
285
336
  required: false;
286
337
  };
287
338
  /**
@@ -1644,4 +1695,4 @@ declare const toHead: (...args: ToMetaTagsType[]) => {
1644
1695
  }[];
1645
1696
  };
1646
1697
 
1647
- export { ContentLink, ContentLinkProps, DatocmsContentLinkPlugin, DatocmsImagePlugin, DatocmsNakedImagePlugin, DatocmsStructuredTextPlugin, DatocmsVideoPlayerPlugin, DisabledQueryListenerOptions, EnabledQueryListenerOptions, GenericClient, Image, NakedImage, QueryListenerOptions, RawSearchResult, RenderBlockContext, RenderInlineRecordContext, RenderRecordLinkContext, ResponsiveImageType, SeoMetaTagType, StructuredText, SubscribeToQueryOptions, ToMetaTagsType, UseContentLinkOptions, UseContentLinkResult, UseSiteSearchConfig, UseSiteSearchData, UseSiteSearchResult, Video, VideoPlayer, appendKeyToValidElement, defaultAdapter, isKeyOf, isNil, toHead, toNativeAttrName, toNativeAttrValue, useContentLink, useQuerySubscription, useSiteSearch, useVideoPlayer };
1698
+ export { ClickToEditOptions, ContentLink, ContentLinkProps, DatocmsContentLinkPlugin, DatocmsImagePlugin, DatocmsNakedImagePlugin, DatocmsStructuredTextPlugin, DatocmsVideoPlayerPlugin, DisabledQueryListenerOptions, EnabledQueryListenerOptions, GenericClient, Image, NakedImage, QueryListenerOptions, RawSearchResult, RenderBlockContext, RenderInlineRecordContext, RenderRecordLinkContext, ResponsiveImageType, SeoMetaTagType, StructuredText, SubscribeToQueryOptions, ToMetaTagsType, UseContentLinkOptions, UseContentLinkResult, UseSiteSearchConfig, UseSiteSearchData, UseSiteSearchResult, Video, VideoPlayer, appendKeyToValidElement, defaultAdapter, isKeyOf, isNil, toHead, toNativeAttrName, toNativeAttrValue, useContentLink, useQuerySubscription, useSiteSearch, useVideoPlayer };
@@ -125,8 +125,19 @@ const ContentLink = defineComponent({
125
125
  required: false
126
126
  },
127
127
  /**
128
- * Enable click-to-edit on mount. Pass true for default behavior or an object with scrollToNearestTarget.
129
- * If undefined, click-to-edit is disabled and editors can use Alt/Option key for temporary activation.
128
+ * Whether to enable click-to-edit overlays on mount, or options to configure them.
129
+ *
130
+ * - `true`: Enable click-to-edit mode immediately
131
+ * - `{ scrollToNearestTarget: true }`: Enable and scroll to nearest editable if none visible
132
+ * - `{ hoverOnly: true }`: Only enable on devices with hover capability (non-touch)
133
+ * - `false`/`undefined`: Don't enable automatically (use Alt/Option key to toggle)
134
+ *
135
+ * @example
136
+ * ```vue
137
+ * <ContentLink :enable-click-to-edit="true" />
138
+ * <ContentLink :enable-click-to-edit="{ scrollToNearestTarget: true }" />
139
+ * <ContentLink :enable-click-to-edit="{ hoverOnly: true, scrollToNearestTarget: true }" />
140
+ * ```
130
141
  */
131
142
  enableClickToEdit: {
132
143
  type: [Boolean, Object],
@@ -147,7 +158,7 @@ const ContentLink = defineComponent({
147
158
  root: props.root
148
159
  });
149
160
  onMounted(() => {
150
- if (props.enableClickToEdit !== void 0) {
161
+ if (props.enableClickToEdit) {
151
162
  enableClickToEditFn(
152
163
  props.enableClickToEdit === true ? void 0 : props.enableClickToEdit
153
164
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-datocms",
3
- "version": "8.1.8",
3
+ "version": "8.1.10",
4
4
  "type": "module",
5
5
  "description": "A set of components and utilities to work faster with DatoCMS in Vue.js environments",
6
6
  "keywords": [