@draftably/vue 0.4.0 → 0.5.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/README.md CHANGED
@@ -5,13 +5,14 @@ Draftably diagrams in Vue. `DraftDiagram` wraps the `<draft-diagram>` element fr
5
5
  cleanup when it unmounts. Any number of diagrams can share a page.
6
6
 
7
7
  ```sh
8
- pnpm add @draftably/vue
8
+ pnpm add @draftably/vue @draftably/runtime
9
9
  ```
10
10
 
11
11
  Import `@draftably/runtime/host.css` once in your client entry: it reserves each element's height
12
- and hides slot content until the element loads. With Vite, add
13
- `optimizeDeps: { exclude: ['@draftably/runtime', '@draftably/editor'] }` to `vite.config`.
12
+ and hides slot content until the element loads, and it lets marked content take the pointer. With
13
+ Vite 5–7, add `optimizeDeps: { exclude: ['@draftably/runtime', '@draftably/editor'] }` to
14
+ `vite.config`.
14
15
 
15
- The [Vue recipe](https://draftably.dev/docs/frameworks#vue) is a complete, type-checked app: both
16
- components, an event, your content on a node, a dark theme and server rendering with the `svg`
17
- prop. CI compiles it from the packed packages.
16
+ [Vue and Nuxt](https://draftably.dev/docs/vue) has a complete, type-checked app: both components,
17
+ an event, your content on a node, a dark page and server rendering with the `svg` prop. CI
18
+ compiles it from the packed packages. The same page has the Nuxt server and strict-CSP code.
package/dist/editor.d.ts CHANGED
@@ -30,7 +30,7 @@ export declare const DraftEditor: import("vue").DefineComponent<import("vue").Ex
30
30
  onAnchors?: ((detail: {
31
31
  anchors: readonly import("@draftably/runtime/viewer").Anchor[];
32
32
  }) => any) | undefined;
33
- onUpdate?: ((detail: import("@draftably/runtime/viewer").UpdateResult) => any) | undefined;
33
+ onUpdate?: ((detail: import("@draftably/runtime/viewer").UpdateResult | import("@draftably/runtime/host").EditorUpdate) => any) | undefined;
34
34
  onRender?: ((detail: {
35
35
  revision: number;
36
36
  value: Extract<import("@draftably/runtime").RenderResult, {
@@ -58,14 +58,18 @@ export declare const DraftEditor: import("vue").DefineComponent<import("vue").Ex
58
58
  href: string;
59
59
  target: "_self" | "_blank";
60
60
  preventDefault(): void;
61
- }, "preventDefault">) => any) | undefined;
61
+ }, "preventDefault"> & {
62
+ preventDefault(): void;
63
+ }) => any) | undefined;
62
64
  onContextmenu?: ((detail: Omit<{
63
65
  id: string | null;
64
66
  kind?: import("@draftably/runtime/viewer").ItemKind;
65
67
  clientX: number;
66
68
  clientY: number;
67
69
  preventDefault(): void;
68
- }, "preventDefault">) => any) | undefined;
70
+ }, "preventDefault"> & {
71
+ preventDefault(): void;
72
+ }) => any) | undefined;
69
73
  onSelect?: ((detail: {
70
74
  ids: readonly string[];
71
75
  reason: "user" | "api";
package/dist/events.d.ts CHANGED
@@ -1,9 +1,12 @@
1
1
  /** Emits from the runtime's one list of events: a new event adds no lines here. */
2
- import { type HostEventName, type HostEvents } from '@draftably/runtime/host';
3
- export type { HostEventName, HostEvents };
4
- /** `@camera`, `@select`, … : each receives the event's `detail`. */
2
+ import { type HostEventDetail, type HostEventName, type HostEvents } from '@draftably/runtime/host';
3
+ export type { HostEventDetail, HostEventName, HostEvents };
4
+ /**
5
+ * `@camera`, `@select`, … : each receives the event's `detail`. `@link` and `@contextmenu` also
6
+ * get `preventDefault()`.
7
+ */
5
8
  export type HostEmits = {
6
- [K in HostEventName]: (detail: HostEvents[K]) => true;
9
+ [K in HostEventName]: (detail: HostEventDetail<K>) => true;
7
10
  };
8
11
  export declare const hostEmits: HostEmits;
9
12
  /** Re-emit every host event from `node`. */
package/dist/events.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /** Emits from the runtime's one list of events: a new event adds no lines here. */
2
- import { HOST_EVENTS } from '@draftably/runtime/host';
2
+ import { HOST_EVENTS, hostDetail, } from '@draftably/runtime/host';
3
3
  export const hostEmits = Object.fromEntries(HOST_EVENTS.map(name => [name, null]));
4
4
  /** Re-emit every host event from `node`. */
5
5
  export function listenHostEvents(node, emit) {
6
6
  for (const name of HOST_EVENTS)
7
- node.addEventListener(`draft-${name}`, event => emit(name, event.detail));
7
+ node.addEventListener(`draft-${name}`, event => emit(name, hostDetail(event)));
8
8
  }
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import type { UpdateResult, ViewerOptions } from '@draftably/runtime/viewer';
5
5
  import { type PropType } from 'vue';
6
6
  export { renderSvg } from '@draftably/runtime';
7
7
  export { HOST_EVENTS } from '@draftably/runtime/host';
8
- export type { HostEmits, HostEventName, HostEvents } from './events.js';
8
+ export type { HostEmits, HostEventDetail, HostEventName, HostEvents } from './events.js';
9
9
  export type { DraftDiagramElement, UpdateResult, ViewerOptions };
10
10
  export declare const DraftDiagram: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
11
11
  /** `.draft` source. A change redraws the diagram and keeps the camera. */
@@ -75,7 +75,7 @@ export declare const DraftDiagram: import("vue").DefineComponent<import("vue").E
75
75
  onAnchors?: ((detail: {
76
76
  anchors: readonly import("@draftably/runtime/viewer").Anchor[];
77
77
  }) => any) | undefined;
78
- onUpdate?: ((detail: UpdateResult) => any) | undefined;
78
+ onUpdate?: ((detail: UpdateResult | import("@draftably/runtime/host").EditorUpdate) => any) | undefined;
79
79
  onRender?: ((detail: {
80
80
  revision: number;
81
81
  value: Extract<import("@draftably/runtime").RenderResult, {
@@ -103,14 +103,18 @@ export declare const DraftDiagram: import("vue").DefineComponent<import("vue").E
103
103
  href: string;
104
104
  target: "_self" | "_blank";
105
105
  preventDefault(): void;
106
- }, "preventDefault">) => any) | undefined;
106
+ }, "preventDefault"> & {
107
+ preventDefault(): void;
108
+ }) => any) | undefined;
107
109
  onContextmenu?: ((detail: Omit<{
108
110
  id: string | null;
109
111
  kind?: import("@draftably/runtime/viewer").ItemKind;
110
112
  clientX: number;
111
113
  clientY: number;
112
114
  preventDefault(): void;
113
- }, "preventDefault">) => any) | undefined;
115
+ }, "preventDefault"> & {
116
+ preventDefault(): void;
117
+ }) => any) | undefined;
114
118
  onSelect?: ((detail: {
115
119
  ids: readonly string[];
116
120
  reason: "user" | "api";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftably/vue",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Vue components for Draftably diagrams.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -23,8 +23,8 @@
23
23
  },
24
24
  "sideEffects": false,
25
25
  "dependencies": {
26
- "@draftably/runtime": "0.4.0",
27
- "@draftably/editor": "0.4.0"
26
+ "@draftably/runtime": "0.5.0",
27
+ "@draftably/editor": "0.5.0"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "vue": "^3.4"