@c4h/chuci 0.1.0 → 0.2.1
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/CHANGELOG.md +32 -32
- package/LICENSE +20 -20
- package/README.ja.md +143 -143
- package/README.md +224 -224
- package/dist/chuci.js +9068 -6596
- package/dist/chuci.umd.js +165 -166
- package/dist/index.d.ts +1 -0
- package/package.json +36 -33
- package/src/components/swiper/cc-swiper-slide.ts +49 -49
- package/src/components/swiper/cc-swiper-styles.ts +28 -28
- package/src/components/swiper/cc-swiper.ts +379 -361
- package/src/components/swiper/swiper-styles.css +4 -4
- package/src/components/viewer/cc-viewer-3dmodel.ts +491 -491
- package/src/components/viewer/cc-viewer-base.ts +278 -278
- package/src/components/viewer/cc-viewer-gaussian.ts +380 -380
- package/src/components/viewer/cc-viewer-image.ts +189 -189
- package/src/components/viewer/cc-viewer-panorama.ts +85 -85
- package/src/components/viewer/cc-viewer-styles.ts +55 -55
- package/src/components/viewer/cc-viewer-video.ts +109 -109
- package/src/components/viewer/cc-viewer-youtube.ts +75 -75
- package/src/components/viewer/cc-viewer.ts +290 -290
- package/src/index.ts +24 -24
- package/src/types/css-modules.d.ts +1 -1
- package/src/types/global.d.ts +10 -10
- package/src/utils/base-element.ts +76 -76
- package/dist/assets/azumaya_panorama1.png +0 -0
- package/dist/chuci.cjs +0 -4483
- package/dist/index-8VMexD2a.cjs +0 -255
- package/dist/index-kvsisbKS.js +0 -2125
- package/dist/index.html +0 -241
- package/dist/test-image.html +0 -63
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base class for Chuci web components without Lit dependency
|
|
3
|
-
*/
|
|
4
|
-
export abstract class ChuciElement extends HTMLElement {
|
|
5
|
-
private _shadowRoot: ShadowRoot
|
|
6
|
-
private _connected = false
|
|
7
|
-
|
|
8
|
-
constructor() {
|
|
9
|
-
super()
|
|
10
|
-
this._shadowRoot = this.attachShadow({ mode: 'open' })
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
connectedCallback() {
|
|
14
|
-
if (!this._connected) {
|
|
15
|
-
this._connected = true
|
|
16
|
-
this.render()
|
|
17
|
-
this.firstUpdated()
|
|
18
|
-
} else {
|
|
19
|
-
this.render()
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
disconnectedCallback() {
|
|
24
|
-
this._connected = false
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null) {
|
|
28
|
-
if (oldValue !== newValue) {
|
|
29
|
-
this.render()
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
protected firstUpdated(): void {
|
|
34
|
-
// Override in subclasses for initialization logic
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
protected abstract render(): void
|
|
38
|
-
|
|
39
|
-
// Template literal values can be any type that can be converted to string
|
|
40
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
|
-
protected html(strings: TemplateStringsArray, ...values: any[]): string {
|
|
42
|
-
return strings.reduce((result, str, i) => {
|
|
43
|
-
return result + str + (values[i] || '')
|
|
44
|
-
}, '')
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Template literal values can be any type that can be converted to string
|
|
48
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
49
|
-
protected css(strings: TemplateStringsArray, ...values: any[]): string {
|
|
50
|
-
const cssText = strings.reduce((result, str, i) => {
|
|
51
|
-
return result + str + (values[i] || '')
|
|
52
|
-
}, '')
|
|
53
|
-
return `<style>${cssText}</style>`
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
protected updateShadowRoot(content: string) {
|
|
57
|
-
this._shadowRoot.innerHTML = content
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
protected query<T extends HTMLElement>(selector: string): T | null {
|
|
61
|
-
return this._shadowRoot.querySelector<T>(selector)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
protected queryAll<T extends HTMLElement>(selector: string): NodeListOf<T> {
|
|
65
|
-
return this._shadowRoot.querySelectorAll<T>(selector)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Custom event detail can be any type
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
|
-
protected dispatch(eventName: string, detail?: any) {
|
|
71
|
-
this.dispatchEvent(new CustomEvent(eventName, {
|
|
72
|
-
detail,
|
|
73
|
-
bubbles: true,
|
|
74
|
-
composed: true
|
|
75
|
-
}))
|
|
76
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Base class for Chuci web components without Lit dependency
|
|
3
|
+
*/
|
|
4
|
+
export abstract class ChuciElement extends HTMLElement {
|
|
5
|
+
private _shadowRoot: ShadowRoot
|
|
6
|
+
private _connected = false
|
|
7
|
+
|
|
8
|
+
constructor() {
|
|
9
|
+
super()
|
|
10
|
+
this._shadowRoot = this.attachShadow({ mode: 'open' })
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
connectedCallback() {
|
|
14
|
+
if (!this._connected) {
|
|
15
|
+
this._connected = true
|
|
16
|
+
this.render()
|
|
17
|
+
this.firstUpdated()
|
|
18
|
+
} else {
|
|
19
|
+
this.render()
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
disconnectedCallback() {
|
|
24
|
+
this._connected = false
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null) {
|
|
28
|
+
if (oldValue !== newValue) {
|
|
29
|
+
this.render()
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
protected firstUpdated(): void {
|
|
34
|
+
// Override in subclasses for initialization logic
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
protected abstract render(): void
|
|
38
|
+
|
|
39
|
+
// Template literal values can be any type that can be converted to string
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
|
+
protected html(strings: TemplateStringsArray, ...values: any[]): string {
|
|
42
|
+
return strings.reduce((result, str, i) => {
|
|
43
|
+
return result + str + (values[i] || '')
|
|
44
|
+
}, '')
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Template literal values can be any type that can be converted to string
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
49
|
+
protected css(strings: TemplateStringsArray, ...values: any[]): string {
|
|
50
|
+
const cssText = strings.reduce((result, str, i) => {
|
|
51
|
+
return result + str + (values[i] || '')
|
|
52
|
+
}, '')
|
|
53
|
+
return `<style>${cssText}</style>`
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
protected updateShadowRoot(content: string) {
|
|
57
|
+
this._shadowRoot.innerHTML = content
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
protected query<T extends HTMLElement>(selector: string): T | null {
|
|
61
|
+
return this._shadowRoot.querySelector<T>(selector)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
protected queryAll<T extends HTMLElement>(selector: string): NodeListOf<T> {
|
|
65
|
+
return this._shadowRoot.querySelectorAll<T>(selector)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Custom event detail can be any type
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
|
+
protected dispatch(eventName: string, detail?: any) {
|
|
71
|
+
this.dispatchEvent(new CustomEvent(eventName, {
|
|
72
|
+
detail,
|
|
73
|
+
bubbles: true,
|
|
74
|
+
composed: true
|
|
75
|
+
}))
|
|
76
|
+
}
|
|
77
77
|
}
|
|
Binary file
|