kritzel-vue 0.3.14 → 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.
- package/dist/components.d.ts +1 -0
- package/dist/components.js +54 -0
- package/dist/composables.d.ts +37 -0
- package/dist/composables.js +62 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/package.json +2 -2
package/dist/components.d.ts
CHANGED
|
@@ -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>;
|
package/dist/components.js
CHANGED
|
@@ -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',
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves the native Kritzel editor element from a specific Vue template ref.
|
|
3
|
+
*
|
|
4
|
+
* Because `<KritzelEditor>` is a Vue component (not a raw custom element),
|
|
5
|
+
* a template ref points to the component instance rather than the DOM element.
|
|
6
|
+
* Pass the same ref that is bound in your template to make sure the resolved
|
|
7
|
+
* editor always belongs to that exact component instance.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```vue
|
|
11
|
+
* <script setup lang="ts">
|
|
12
|
+
* import { KritzelEditor, getEditorRef } from 'kritzel-vue'
|
|
13
|
+
* import { ref, type ComponentPublicInstance } from 'vue'
|
|
14
|
+
*
|
|
15
|
+
* const editorComponent = ref<ComponentPublicInstance | null>(null)
|
|
16
|
+
* const editor = getEditorRef(editorComponent)
|
|
17
|
+
*
|
|
18
|
+
* async function onReady() {
|
|
19
|
+
* await editor.value?.addObject(...)
|
|
20
|
+
* }
|
|
21
|
+
* </script>
|
|
22
|
+
*
|
|
23
|
+
* <template>
|
|
24
|
+
* <KritzelEditor ref="editor" @isReady="onReady" />
|
|
25
|
+
* </template>
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
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>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { computed, useTemplateRef, } from "vue";
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the native Kritzel editor element from a specific Vue template ref.
|
|
4
|
+
*
|
|
5
|
+
* Because `<KritzelEditor>` is a Vue component (not a raw custom element),
|
|
6
|
+
* a template ref points to the component instance rather than the DOM element.
|
|
7
|
+
* Pass the same ref that is bound in your template to make sure the resolved
|
|
8
|
+
* editor always belongs to that exact component instance.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```vue
|
|
12
|
+
* <script setup lang="ts">
|
|
13
|
+
* import { KritzelEditor, getEditorRef } from 'kritzel-vue'
|
|
14
|
+
* import { ref, type ComponentPublicInstance } from 'vue'
|
|
15
|
+
*
|
|
16
|
+
* const editorComponent = ref<ComponentPublicInstance | null>(null)
|
|
17
|
+
* const editor = getEditorRef(editorComponent)
|
|
18
|
+
*
|
|
19
|
+
* async function onReady() {
|
|
20
|
+
* await editor.value?.addObject(...)
|
|
21
|
+
* }
|
|
22
|
+
* </script>
|
|
23
|
+
*
|
|
24
|
+
* <template>
|
|
25
|
+
* <KritzelEditor ref="editor" @isReady="onReady" />
|
|
26
|
+
* </template>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export function getEditorRef(componentRef) {
|
|
30
|
+
const editorComponent = useTemplateRef(componentRef);
|
|
31
|
+
return computed(() => {
|
|
32
|
+
var _a;
|
|
33
|
+
const value = editorComponent.value;
|
|
34
|
+
if (!value) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return "$el" in value
|
|
38
|
+
? ((_a = value.$el) !== null && _a !== void 0 ? _a : null)
|
|
39
|
+
: value;
|
|
40
|
+
});
|
|
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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './components';
|
|
2
|
+
export * from './composables';
|
|
2
3
|
export * from './plugin';
|
|
3
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';
|
|
4
|
-
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/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export * from './components';
|
|
2
|
+
export * from './composables';
|
|
2
3
|
export * from './plugin';
|
|
3
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';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kritzel-vue",
|
|
3
|
-
"version": "0.3.
|
|
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.
|
|
37
|
+
"kritzel-stencil": "^0.3.16"
|
|
38
38
|
}
|
|
39
39
|
}
|