lunchboxjs 2.1.14 → 2.1.15
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/package.json +1 -1
- package/src/html-anchor.ts +4 -4
- package/src/index.ts +6 -6
- package/src/three-lunchbox.ts +4 -4
package/package.json
CHANGED
package/src/html-anchor.ts
CHANGED
|
@@ -54,7 +54,7 @@ export class HtmlAnchor extends LitElement {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
// Setup - save local parent and try adding update
|
|
57
|
-
connectedCallback() {
|
|
57
|
+
override connectedCallback() {
|
|
58
58
|
super.connectedCallback();
|
|
59
59
|
|
|
60
60
|
const parent = this.parentNode as Lunchbox<THREE.Object3D>;
|
|
@@ -73,16 +73,16 @@ export class HtmlAnchor extends LitElement {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
// Teardown
|
|
76
|
-
disconnectedCallback(): void {
|
|
76
|
+
override disconnectedCallback(): void {
|
|
77
77
|
if (this.frame !== -1) cancelAnimationFrame(this.frame);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
override render(): unknown {
|
|
82
82
|
return html`<slot></slot>`
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
override createRenderRoot() {
|
|
86
86
|
return this;
|
|
87
87
|
}
|
|
88
88
|
}
|
package/src/index.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { autoComponents } from './auto-components';
|
|
|
2
2
|
import { buildClass } from './three-base';
|
|
3
3
|
import { ThreeLunchbox } from './three-lunchbox';
|
|
4
4
|
import { IsClass } from './utils';
|
|
5
|
-
import * as THREE from '../node_modules/@types/three';
|
|
6
5
|
import { HtmlAnchor } from './html-anchor';
|
|
6
|
+
import type { Intersection, Object3DEventMap, Scene, Object3D } from 'three';
|
|
7
7
|
|
|
8
8
|
export * from './three-lunchbox';
|
|
9
9
|
export * from './html-anchor';
|
|
@@ -29,9 +29,9 @@ export { ThreeBase } from './three-base';
|
|
|
29
29
|
* mesh?.instance.position.set(0, 1, 0); // - or anything else you can do with a mesh
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
export type Lunchbox<T =
|
|
32
|
+
export type Lunchbox<T = Object3D> = Element & LunchboxProperties<T>
|
|
33
33
|
|
|
34
|
-
export type LunchboxProperties<T =
|
|
34
|
+
export type LunchboxProperties<T = Object3D> = {
|
|
35
35
|
instance: T;
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -65,7 +65,7 @@ export const initLunchbox = ({
|
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
const result = buildClass(className as
|
|
68
|
+
const result = buildClass(className as any);
|
|
69
69
|
if (result) {
|
|
70
70
|
customElements.define(kebabCase, result);
|
|
71
71
|
}
|
|
@@ -111,14 +111,14 @@ export const THREE_CLICK_EVENT_NAME = 'threeclick';
|
|
|
111
111
|
export const BEFORE_RENDER_EVENT_NAME = 'beforerender';
|
|
112
112
|
export const AFTER_RENDER_EVENT_NAME = 'afterrender';
|
|
113
113
|
export type ThreeIntersectEvent = {
|
|
114
|
-
intersect:
|
|
114
|
+
intersect: Intersection<Object3D<Object3DEventMap>>;
|
|
115
115
|
element: Element | null;
|
|
116
116
|
}
|
|
117
117
|
export interface InstanceEvent<T = unknown> {
|
|
118
118
|
instance: T;
|
|
119
119
|
}
|
|
120
120
|
export type InstanceAddedEvent<T = unknown> = InstanceEvent<T> & {
|
|
121
|
-
parent:
|
|
121
|
+
parent: Scene | Object3D
|
|
122
122
|
}
|
|
123
123
|
export interface LoadedEvent<T = unknown> {
|
|
124
124
|
loaded: T;
|
package/src/three-lunchbox.ts
CHANGED
|
@@ -101,7 +101,7 @@ export class ThreeLunchbox extends LitElement {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
/** To run on start. */
|
|
104
|
-
connectedCallback(): void {
|
|
104
|
+
override connectedCallback(): void {
|
|
105
105
|
super.connectedCallback();
|
|
106
106
|
if (this.dpr === DEFAULT_DPR) {
|
|
107
107
|
this.dpr = window.devicePixelRatio;
|
|
@@ -150,7 +150,7 @@ export class ThreeLunchbox extends LitElement {
|
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
disconnectedCallback(): void {
|
|
153
|
+
override disconnectedCallback(): void {
|
|
154
154
|
this.three.renderer?.domElement.removeEventListener('pointermove', this.onPointerMove.bind(this));
|
|
155
155
|
this.three.renderer?.domElement.removeEventListener('mousemove', this.onPointerMove.bind(this));
|
|
156
156
|
this.three.renderer?.domElement.removeEventListener('click', this.onClick.bind(this));
|
|
@@ -245,7 +245,7 @@ export class ThreeLunchbox extends LitElement {
|
|
|
245
245
|
|
|
246
246
|
/** Container styles */
|
|
247
247
|
// TODO: fill window, fit-to-container
|
|
248
|
-
static styles = css`
|
|
248
|
+
static override styles = css`
|
|
249
249
|
:host {
|
|
250
250
|
width: 100%;
|
|
251
251
|
height: 100%;
|
|
@@ -284,7 +284,7 @@ export class ThreeLunchbox extends LitElement {
|
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
render() {
|
|
287
|
+
override render() {
|
|
288
288
|
// TODO: more robust slot changes
|
|
289
289
|
return html`
|
|
290
290
|
<slot @slotchange=${this.handleDefaultSlotChange}></slot>
|