lunchboxjs 0.2.1016 → 0.2.1018
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/lunchboxjs.js +309 -499
- package/dist/lunchboxjs.min.js +1 -1
- package/dist/lunchboxjs.module.js +306 -493
- package/package.json +6 -3
- package/src/index.ts +7 -2
- package/extras/Gltf.vue +0 -34
- package/extras/OrbitControlsWrapper.vue +0 -39
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lunchboxjs",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1018",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite -c utils/vite.config.ts",
|
|
6
6
|
"build": "vue-tsc --noEmit && vite build -c utils/vite.config.ts",
|
|
7
7
|
"build:tsc": "tsc --project ./utils/tsconfig.lib.json",
|
|
8
|
-
"build:rollup": "rollup -c ./utils/lib-rollup.
|
|
8
|
+
"build:rollup": "rollup -c ./utils/lib-rollup.js",
|
|
9
9
|
"build:dts": "node utils/cp utils/lib-dts.d.ts dist/lunchboxjs.es.d.ts && node utils/cp utils/lib-dts.d.ts dist/lunchboxjs.umd.d.ts",
|
|
10
10
|
"build:lib": "node utils/rm js && npm run build:tsc && npm run build:rollup && npm run build:dts",
|
|
11
11
|
"prepare": "npm run build:lib",
|
|
@@ -32,11 +32,15 @@
|
|
|
32
32
|
"@vitejs/plugin-vue": "3.0.1",
|
|
33
33
|
"@vitejs/plugin-vue-jsx": "2.0.0",
|
|
34
34
|
"@vue/babel-plugin-jsx": "1.1.1",
|
|
35
|
+
"@vue/reactivity": "3.2.41",
|
|
35
36
|
"chroma-js": "2.1.2",
|
|
36
37
|
"kolorist": "1.5.1",
|
|
38
|
+
"lodash": "4.17.21",
|
|
39
|
+
"lunchboxjs-plugins": "workspace:*",
|
|
37
40
|
"nice-color-palettes": "3.0.0",
|
|
38
41
|
"prompt": "1.3.0",
|
|
39
42
|
"prompts": "2.4.2",
|
|
43
|
+
"rollup": "3.2.5",
|
|
40
44
|
"rollup-plugin-delete": "2.0.0",
|
|
41
45
|
"rollup-plugin-jsx": "1.0.3",
|
|
42
46
|
"rollup-plugin-terser": "7.0.2",
|
|
@@ -44,7 +48,6 @@
|
|
|
44
48
|
"typescript": "^4.4.3",
|
|
45
49
|
"vite": "3.0.4",
|
|
46
50
|
"vite-plugin-glsl": "0.0.5",
|
|
47
|
-
"vitepress": "0.20.1",
|
|
48
51
|
"vue-jsx-factory": "0.3.0",
|
|
49
52
|
"vue-tsc": "^0.3.0"
|
|
50
53
|
},
|
package/src/index.ts
CHANGED
|
@@ -198,9 +198,12 @@ export const getInstance = <T = unknown>(
|
|
|
198
198
|
|
|
199
199
|
// CREATE APP
|
|
200
200
|
// ====================
|
|
201
|
-
export const createApp = (
|
|
201
|
+
export const createApp = (
|
|
202
|
+
root: Component,
|
|
203
|
+
rootProps: Record<string, any> = {}
|
|
204
|
+
) => {
|
|
202
205
|
const { nodeOps, interactables } = createNodeOps()
|
|
203
|
-
const app = createRenderer(nodeOps).createApp(root) as Lunch.App
|
|
206
|
+
const app = createRenderer(nodeOps).createApp(root, rootProps) as Lunch.App
|
|
204
207
|
|
|
205
208
|
// provide Lunchbox interaction handlers flag (modified when user references events via
|
|
206
209
|
// @click, etc)
|
|
@@ -387,6 +390,8 @@ export const createApp = (root: Component) => {
|
|
|
387
390
|
computed(() => app.config.globalProperties.lunchbox.camera)
|
|
388
391
|
)
|
|
389
392
|
|
|
393
|
+
app._props
|
|
394
|
+
|
|
390
395
|
// done
|
|
391
396
|
return app
|
|
392
397
|
}
|
package/extras/Gltf.vue
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<group ref="container">
|
|
3
|
-
<gltfLoader :load="[props.src, onLoad, onProgress, onError]" />
|
|
4
|
-
</group>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script lang="ts" setup>
|
|
8
|
-
import { ref } from 'vue'
|
|
9
|
-
import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader'
|
|
10
|
-
import { Lunch } from '../src'
|
|
11
|
-
|
|
12
|
-
const props = defineProps<{
|
|
13
|
-
preventAdd?: boolean
|
|
14
|
-
src: string
|
|
15
|
-
}>()
|
|
16
|
-
|
|
17
|
-
const emit = defineEmits<{
|
|
18
|
-
(e: 'load', gltf: GLTF): void
|
|
19
|
-
(e: 'progress', evt: ProgressEvent): void
|
|
20
|
-
(e: 'error', evt: ErrorEvent): void
|
|
21
|
-
}>()
|
|
22
|
-
|
|
23
|
-
const container = ref<Lunch.LunchboxComponent<THREE.Group>>()
|
|
24
|
-
const onLoad = (gltf: GLTF) => {
|
|
25
|
-
if (!props.preventAdd) {
|
|
26
|
-
container.value?.$el?.instance?.add(gltf.scene)
|
|
27
|
-
}
|
|
28
|
-
emit('load', gltf)
|
|
29
|
-
}
|
|
30
|
-
const onProgress = (evt: ProgressEvent) => {
|
|
31
|
-
emit('progress', evt)
|
|
32
|
-
}
|
|
33
|
-
const onError = (evt: ErrorEvent) => emit('error', evt)
|
|
34
|
-
</script>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<OrbitControls
|
|
3
|
-
ref="controls"
|
|
4
|
-
v-if="ready"
|
|
5
|
-
:args="orbitArgs"
|
|
6
|
-
:autoRotate="false"
|
|
7
|
-
:enableDamping="true"
|
|
8
|
-
:dampingFactor="0.1"
|
|
9
|
-
v-bind="props.options ?? {}"
|
|
10
|
-
/>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script lang="ts" setup>
|
|
14
|
-
import { computed, ref } from 'vue'
|
|
15
|
-
import { onBeforeRender, Lunch, useCamera, useRenderer } from '../src'
|
|
16
|
-
|
|
17
|
-
// props
|
|
18
|
-
const props = defineProps<{
|
|
19
|
-
options?: object
|
|
20
|
-
}>()
|
|
21
|
-
|
|
22
|
-
// computed
|
|
23
|
-
const ready = computed(() => {
|
|
24
|
-
return camera.value !== null && renderer.value.domElement
|
|
25
|
-
})
|
|
26
|
-
const camera = useCamera()
|
|
27
|
-
const renderer = useRenderer()
|
|
28
|
-
const orbitArgs = computed(() => [camera.value, renderer.value?.domElement])
|
|
29
|
-
|
|
30
|
-
// update
|
|
31
|
-
const controls = ref<Lunch.LunchboxComponent>()
|
|
32
|
-
const update = () => {
|
|
33
|
-
const instance = controls.value?.$el.instance as any
|
|
34
|
-
if (instance && ready.value) {
|
|
35
|
-
instance.update()
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
onBeforeRender(update)
|
|
39
|
-
</script>
|