kritzel-vue 0.3.15 → 0.3.16

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.
@@ -6,6 +6,7 @@ export declare const KritzelButton: StencilVueComponent<JSX.KritzelButton>;
6
6
  export declare const KritzelCurrentUserDialog: StencilVueComponent<JSX.KritzelCurrentUserDialog>;
7
7
  export declare const KritzelDialog: StencilVueComponent<JSX.KritzelDialog>;
8
8
  export declare const KritzelEditor: StencilVueComponent<JSX.KritzelEditor>;
9
+ export declare const KritzelEngine: StencilVueComponent<JSX.KritzelEngine>;
9
10
  export declare const KritzelExport: StencilVueComponent<JSX.KritzelExport>;
10
11
  export declare const KritzelInput: StencilVueComponent<JSX.KritzelInput>;
11
12
  export declare const KritzelLineEndings: StencilVueComponent<JSX.KritzelLineEndings>;
@@ -8,6 +8,7 @@ import { defineCustomElement as defineKritzelButton } from '../../kritzel-stenci
8
8
  import { defineCustomElement as defineKritzelCurrentUserDialog } from '../../kritzel-stencil/dist/components/kritzel-current-user-dialog.js';
9
9
  import { defineCustomElement as defineKritzelDialog } from '../../kritzel-stencil/dist/components/kritzel-dialog.js';
10
10
  import { defineCustomElement as defineKritzelEditor } from '../../kritzel-stencil/dist/components/kritzel-editor.js';
11
+ import { defineCustomElement as defineKritzelEngine } from '../../kritzel-stencil/dist/components/kritzel-engine.js';
11
12
  import { defineCustomElement as defineKritzelExport } from '../../kritzel-stencil/dist/components/kritzel-export.js';
12
13
  import { defineCustomElement as defineKritzelInput } from '../../kritzel-stencil/dist/components/kritzel-input.js';
13
14
  import { defineCustomElement as defineKritzelLineEndings } from '../../kritzel-stencil/dist/components/kritzel-line-endings.js';
@@ -115,6 +116,59 @@ export const KritzelEditor = /*@__PURE__*/ defineContainer('kritzel-editor', def
115
116
  'isPublicChange',
116
117
  'awarenessChange'
117
118
  ]);
119
+ export const KritzelEngine = /*@__PURE__*/ defineContainer('kritzel-engine', defineKritzelEngine, [
120
+ 'workspace',
121
+ 'editorId',
122
+ 'activeWorkspaceId',
123
+ 'syncConfig',
124
+ 'assetStorageConfig',
125
+ 'user',
126
+ 'globalContextMenuItems',
127
+ 'objectContextMenuItems',
128
+ 'scaleMax',
129
+ 'scaleMin',
130
+ 'cursorTarget',
131
+ 'lockDrawingScale',
132
+ 'isObjectDistanceFadingActive',
133
+ 'theme',
134
+ 'themes',
135
+ 'viewportBoundaryLeft',
136
+ 'viewportBoundaryRight',
137
+ 'viewportBoundaryTop',
138
+ 'viewportBoundaryBottom',
139
+ 'debugInfo',
140
+ 'wheelEnabled',
141
+ 'isLoading',
142
+ 'isEngineReady',
143
+ 'activeToolChange',
144
+ 'objectsSelectionChange',
145
+ 'workspacesChange',
146
+ 'activeWorkspaceChange',
147
+ 'longpress',
148
+ 'objectsChange',
149
+ 'objectsAdded',
150
+ 'objectsRemoved',
151
+ 'objectsUpdated',
152
+ 'undoStateChange',
153
+ 'objectsInViewportChange',
154
+ 'viewportChange',
155
+ 'awarenessChange'
156
+ ], [
157
+ 'isEngineReady',
158
+ 'activeToolChange',
159
+ 'objectsSelectionChange',
160
+ 'workspacesChange',
161
+ 'activeWorkspaceChange',
162
+ 'longpress',
163
+ 'objectsChange',
164
+ 'objectsAdded',
165
+ 'objectsRemoved',
166
+ 'objectsUpdated',
167
+ 'undoStateChange',
168
+ 'objectsInViewportChange',
169
+ 'viewportChange',
170
+ 'awarenessChange'
171
+ ]);
118
172
  export const KritzelExport = /*@__PURE__*/ defineContainer('kritzel-export', defineKritzelExport, [
119
173
  'workspaceName',
120
174
  'exportPng',
@@ -21,8 +21,17 @@
21
21
  * </script>
22
22
  *
23
23
  * <template>
24
- * <KritzelEditor ref="editorComponent" @isReady="onReady" />
24
+ * <KritzelEditor ref="editor" @isReady="onReady" />
25
25
  * </template>
26
26
  * ```
27
27
  */
28
28
  export declare function getEditorRef(componentRef: string): import("vue").ComputedRef<HTMLKritzelEditorElement | null>;
29
+ /**
30
+ * Resolves the native Kritzel engine element from a specific Vue template ref.
31
+ *
32
+ * Because `<KritzelEngine>` is a Vue component (not a raw custom element),
33
+ * a template ref points to the component instance rather than the DOM element.
34
+ * Pass the same ref that is bound in your template to make sure the resolved
35
+ * engine always belongs to that exact component instance.
36
+ */
37
+ export declare function getEngineRef(componentRef: string): import("vue").ComputedRef<HTMLKritzelEngineElement | null>;
@@ -22,7 +22,7 @@ import { computed, useTemplateRef, } from "vue";
22
22
  * </script>
23
23
  *
24
24
  * <template>
25
- * <KritzelEditor ref="editorComponent" @isReady="onReady" />
25
+ * <KritzelEditor ref="editor" @isReady="onReady" />
26
26
  * </template>
27
27
  * ```
28
28
  */
@@ -39,3 +39,24 @@ export function getEditorRef(componentRef) {
39
39
  : value;
40
40
  });
41
41
  }
42
+ /**
43
+ * Resolves the native Kritzel engine element from a specific Vue template ref.
44
+ *
45
+ * Because `<KritzelEngine>` is a Vue component (not a raw custom element),
46
+ * a template ref points to the component instance rather than the DOM element.
47
+ * Pass the same ref that is bound in your template to make sure the resolved
48
+ * engine always belongs to that exact component instance.
49
+ */
50
+ export function getEngineRef(componentRef) {
51
+ const engineComponent = useTemplateRef(componentRef);
52
+ return computed(() => {
53
+ var _a;
54
+ const value = engineComponent.value;
55
+ if (!value) {
56
+ return null;
57
+ }
58
+ return "$el" in value
59
+ ? ((_a = value.$el) !== null && _a !== void 0 ? _a : null)
60
+ : value;
61
+ });
62
+ }
package/dist/index.d.ts CHANGED
@@ -2,4 +2,4 @@ export * from './components';
2
2
  export * from './composables';
3
3
  export * from './plugin';
4
4
  export { KritzelBaseObject, KritzelText, KritzelPath, KritzelImage, KritzelLine, KritzelShape, KritzelGroup, KritzelBrushTool, KritzelTextTool, KritzelLineTool, KritzelShapeTool, KritzelEraserTool, KritzelSelectionTool, KritzelImageTool, KritzelWorkspace, InMemorySyncProvider, IndexedDBSyncProvider, BroadcastSyncProvider, WebSocketSyncProvider, HocuspocusSyncProvider, KritzelThemeManager, ShapeType, KritzelAlignment, lightTheme, darkTheme, DEFAULT_BRUSH_CONFIG, DEFAULT_TEXT_CONFIG, } from 'kritzel-stencil';
5
- export type { KritzelToolbarControl, KritzelBrushToolConfig, KritzelLineToolConfig, KritzelShapeToolConfig, KritzelTextToolConfig, KritzelSyncConfig, KritzelTheme, KritzelViewportState, ContextMenuItem, ThemeAwareColor, ThemeName, LoginEvent, EditorIsReadyEvent, ActiveWorkspaceChangeEvent, ObjectsAddedEvent, ObjectsRemovedEvent, ObjectsUpdatedEvent, } from 'kritzel-stencil';
5
+ export type { HTMLKritzelEditorElement, HTMLKritzelEngineElement, KritzelToolbarControl, KritzelBrushToolConfig, KritzelLineToolConfig, KritzelShapeToolConfig, KritzelTextToolConfig, KritzelSyncConfig, KritzelTheme, KritzelViewportState, ContextMenuItem, ThemeAwareColor, ThemeName, LoginEvent, EditorIsReadyEvent, ActiveWorkspaceChangeEvent, ObjectsAddedEvent, ObjectsRemovedEvent, ObjectsUpdatedEvent, ObjectsInViewportChangeEvent, } from 'kritzel-stencil';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kritzel-vue",
3
- "version": "0.3.15",
3
+ "version": "0.3.16",
4
4
  "homepage": "https://github.com/kasual1/kritzel#readme",
5
5
  "license": "ISC",
6
6
  "main": "dist/index.js",
@@ -34,6 +34,6 @@
34
34
  "@stencil/vue-output-target": "0.11.8"
35
35
  },
36
36
  "peerDependencies": {
37
- "kritzel-stencil": "^0.3.15"
37
+ "kritzel-stencil": "^0.3.16"
38
38
  }
39
39
  }