@canvas3/nuxt 0.0.6 → 0.0.7
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/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/canvas3-image.vue +6 -5
- package/dist/runtime/components/canvas3-image.vue.d.ts +1 -1
- package/dist/runtime/layouts/canvas3-layout.vue +7 -4
- package/dist/runtime/layouts/canvas3-layout.vue.d.ts +6 -1
- package/dist/runtime/server/tsconfig.json +10 -1
- package/dist/runtime/types/types.d.ts +3 -8
- package/dist/runtime/types/types.js +0 -1
- package/dist/runtime/types/vue-directives.d.ts +13 -3
- package/dist/runtime/utils/canvas3/canvas3.js +3 -1
- package/package.json +3 -4
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineNuxtModule, createResolver, addTemplate, addLayout, addComponent, addPlugin, addImports } from '@nuxt/kit';
|
|
2
2
|
|
|
3
|
-
const module = defineNuxtModule({
|
|
3
|
+
const module$1 = defineNuxtModule({
|
|
4
4
|
meta: {
|
|
5
5
|
name: "canvas-nuxt-layout",
|
|
6
6
|
configKey: "canvas3Layout"
|
|
@@ -29,4 +29,4 @@ const module = defineNuxtModule({
|
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
export { module as default };
|
|
32
|
+
export { module$1 as default };
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { ref, computed, watch, onMounted, nextTick, onBeforeUnmount } from "vue";
|
|
17
17
|
import { Canvas3 } from "#canvas3-nuxt/utils/canvas3/canvas3";
|
|
18
18
|
const props = defineProps({
|
|
19
|
-
options: { type: Object, required:
|
|
19
|
+
options: { type: Object, required: false, default: () => ({
|
|
20
20
|
alt: "",
|
|
21
21
|
src: "",
|
|
22
22
|
loadStrategy: "lazy",
|
|
@@ -36,10 +36,10 @@ const addImageToCanvas = async () => {
|
|
|
36
36
|
image.value.dataset.meshId = generatedMeshId;
|
|
37
37
|
await Canvas3.addImageAsMesh(
|
|
38
38
|
image.value,
|
|
39
|
-
props.options.shaderName,
|
|
39
|
+
props.options.shaderName ?? null,
|
|
40
40
|
generatedMeshId,
|
|
41
|
-
props.options.uniforms,
|
|
42
|
-
props.options.activateMeshUniforms
|
|
41
|
+
props.options.uniforms ?? {},
|
|
42
|
+
props.options.activateMeshUniforms ?? {}
|
|
43
43
|
);
|
|
44
44
|
imgAddedToCanvas.value = true;
|
|
45
45
|
};
|
|
@@ -47,7 +47,8 @@ watch(() => Canvas3.canvasInitiated.value, (ready) => {
|
|
|
47
47
|
if (ready) addImageToCanvas();
|
|
48
48
|
});
|
|
49
49
|
watch(() => props.options.uniforms, (u) => {
|
|
50
|
-
|
|
50
|
+
if (u)
|
|
51
|
+
Canvas3.meshUniformsUpdate(generatedMeshId, u);
|
|
51
52
|
}, { deep: true });
|
|
52
53
|
watch(() => props.options.src, () => {
|
|
53
54
|
imgAddedToCanvas.value = false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Canvas3ImageBindType } from '#canvas3-nuxt/types/types';
|
|
2
2
|
type __VLS_Props = {
|
|
3
|
-
options
|
|
3
|
+
options?: Canvas3ImageBindType;
|
|
4
4
|
};
|
|
5
5
|
declare const _default: import("vue").DefineComponent<__VLS_Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
6
6
|
options: Canvas3ImageBindType;
|
|
@@ -21,13 +21,16 @@
|
|
|
21
21
|
import { ref, watch } from "vue";
|
|
22
22
|
import { Canvas3 } from "#canvas3-nuxt/utils/canvas3/canvas3";
|
|
23
23
|
const emit = defineEmits(["canvas3-ready"]);
|
|
24
|
-
const props =
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const props = defineProps({
|
|
25
|
+
canvas3enabled: { type: Boolean, required: true },
|
|
26
|
+
canvas3options: { type: Object, required: true }
|
|
27
|
+
});
|
|
28
|
+
const canvasEl = ref();
|
|
29
|
+
const scrollableContent = ref();
|
|
27
30
|
watch(
|
|
28
31
|
() => props.canvas3enabled,
|
|
29
32
|
async (newValue) => {
|
|
30
|
-
if (newValue) {
|
|
33
|
+
if (newValue && canvasEl.value && scrollableContent.value) {
|
|
31
34
|
await Canvas3.init(
|
|
32
35
|
canvasEl.value,
|
|
33
36
|
scrollableContent.value,
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import type { Canvas3OptionsType } from '#canvas3-nuxt/types/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
canvas3enabled: boolean;
|
|
4
|
+
canvas3options: Canvas3OptionsType;
|
|
5
|
+
};
|
|
1
6
|
declare var __VLS_1: {};
|
|
2
7
|
type __VLS_Slots = {} & {
|
|
3
8
|
default?: (props: typeof __VLS_1) => any;
|
|
4
9
|
};
|
|
5
|
-
declare const __VLS_component: import("vue").DefineComponent<
|
|
10
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
11
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
7
12
|
export default _default;
|
|
8
13
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Mesh, Vector2 } from 'three';
|
|
2
|
-
import type { DirectiveBinding
|
|
2
|
+
import type { DirectiveBinding } from 'vue';
|
|
3
3
|
type Shader = {
|
|
4
4
|
fragmentShader: string;
|
|
5
5
|
vertexShader: string;
|
|
@@ -108,14 +108,9 @@ export type Canvas3ImageBinding = {
|
|
|
108
108
|
export type Canvas3ImageBindType = {
|
|
109
109
|
alt: string;
|
|
110
110
|
src: string;
|
|
111
|
-
loadStrategy?: 'lazy' | 'eager' |
|
|
111
|
+
loadStrategy?: 'lazy' | 'eager' | undefined;
|
|
112
112
|
shaderName?: string;
|
|
113
|
-
uniforms?: MeshMaterialUniform;
|
|
113
|
+
uniforms?: MeshMaterialUniform | undefined;
|
|
114
114
|
activateMeshUniforms?: MeshMaterialUniform;
|
|
115
115
|
};
|
|
116
|
-
declare module 'vue' {
|
|
117
|
-
interface GlobalDirectives {
|
|
118
|
-
'canvas3-image': ObjectDirective<HTMLImageElement, Canvas3ImageBinding>;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
116
|
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
import type { ObjectDirective } from 'vue'
|
|
2
|
-
import type { Canvas3ImageBinding } from '~/src/runtime/types/types'
|
|
1
|
+
import type { DirectiveBinding, ObjectDirective } from 'vue'
|
|
2
|
+
import type { Canvas3ImageBinding, scrollActionBindOptionType } from '~/src/runtime/types/types'
|
|
3
|
+
|
|
4
|
+
// declare module '@vue/runtime-core' {
|
|
5
|
+
// export interface GlobalDirectives {
|
|
6
|
+
// vCanvas3Image: ObjectDirective<HTMLImageElement, Canvas3ImageBinding>
|
|
7
|
+
// vActionOnScroll: ObjectDirective<HTMLElement, scrollActionBindOptionType>
|
|
8
|
+
// vSetDataAttributes: ObjectDirective<HTMLElement, DirectiveBinding>
|
|
9
|
+
// }
|
|
10
|
+
// }
|
|
3
11
|
|
|
4
12
|
declare module 'vue' {
|
|
5
13
|
export interface GlobalDirectives {
|
|
6
|
-
|
|
14
|
+
vCanvas3Image: ObjectDirective<HTMLImageElement, Canvas3ImageBinding>
|
|
15
|
+
vActionOnScroll: ObjectDirective<HTMLElement, scrollActionBindOptionType>
|
|
16
|
+
vSetDataAttributes: ObjectDirective<HTMLElement, DirectiveBinding>
|
|
7
17
|
}
|
|
8
18
|
}
|
|
9
19
|
|
|
@@ -340,7 +340,9 @@ class Canvas3Class {
|
|
|
340
340
|
// }
|
|
341
341
|
// }
|
|
342
342
|
async addImageAsMesh(imgHtmlEl, shaderName, meshId, meshUniforms, activateMeshUniforms) {
|
|
343
|
-
|
|
343
|
+
if (activateMeshUniforms) {
|
|
344
|
+
this.activateMeshUniformMap.set(meshId, activateMeshUniforms);
|
|
345
|
+
}
|
|
344
346
|
let vertexShader = this.options.shaders.default.vertexShader;
|
|
345
347
|
let fragmentShader = this.options.shaders.default.fragmentShader;
|
|
346
348
|
if (shaderName && this.options.shaders[shaderName]) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canvas3/nuxt",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -47,16 +47,15 @@
|
|
|
47
47
|
"vue": "^3.5.18"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@nuxt/devtools": "
|
|
50
|
+
"@nuxt/devtools": "2.6.4",
|
|
51
51
|
"@nuxt/eslint-config": "^1.2.0",
|
|
52
52
|
"@nuxt/module-builder": "^1.0.1",
|
|
53
53
|
"@nuxt/schema": "^4.0.0",
|
|
54
54
|
"@nuxt/test-utils": "^3.19.2",
|
|
55
55
|
"@types/node": "latest",
|
|
56
56
|
"@types/three": "^0.178.1",
|
|
57
|
-
"changelogen": "^0.6.2",
|
|
58
57
|
"eslint": "^9.30.1",
|
|
59
|
-
"nuxt": "
|
|
58
|
+
"nuxt": "4.1.0",
|
|
60
59
|
"typescript": "~5.8.3",
|
|
61
60
|
"vitest": "^3.2.4",
|
|
62
61
|
"vue-tsc": "^3.0.1"
|