@uibit/hotspot 0.1.1 → 0.2.0
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/frameworks/angular/index.ts +35 -36
- package/dist/frameworks/astro/index.d.ts +8 -1
- package/dist/frameworks/preact/index.d.ts +2 -0
- package/dist/frameworks/react/index.ts +100 -0
- package/dist/frameworks/solid/index.d.ts +1 -1
- package/dist/frameworks/stencil/index.d.ts +2 -0
- package/dist/frameworks/svelte/index.svelte +51 -19
- package/dist/frameworks/vue/index.ts +93 -23
- package/dist/hotspot.d.ts.map +1 -1
- package/dist/hotspot.js +17 -2
- package/dist/hotspot.js.map +1 -1
- package/package.json +3 -3
- package/dist/frameworks/react/index.d.ts +0 -22
|
@@ -2,44 +2,43 @@ import { Component, ChangeDetectionStrategy, ElementRef, input, effect, output,
|
|
|
2
2
|
import '@uibit/hotspot';
|
|
3
3
|
import type { Hotspot as HTMLElementClass } from '@uibit/hotspot';
|
|
4
4
|
import type { HotspotItem } from '@uibit/hotspot';
|
|
5
|
-
|
|
6
5
|
@Component({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
selector: 'uibit-hotspot',
|
|
7
|
+
template: '<ng-content></ng-content>',
|
|
8
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
9
|
+
standalone: true,
|
|
10
|
+
host: {
|
|
11
|
+
'(hotspot-click)': 'hotspotClick.emit($event)'
|
|
12
|
+
}
|
|
14
13
|
})
|
|
15
14
|
export class NgxHotspot {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
constructor(private el: ElementRef<HTMLElementClass>){
|
|
16
|
+
effect(()=>{
|
|
17
|
+
if (this.el.nativeElement) {
|
|
18
|
+
this.el.nativeElement.hotspots = this.hotspots();
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
effect(()=>{
|
|
22
|
+
if (this.el.nativeElement) {
|
|
23
|
+
this.el.nativeElement.interactive = this.interactive();
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
effect(()=>{
|
|
27
|
+
if (this.el.nativeElement) {
|
|
28
|
+
this.el.nativeElement.trigger = this.trigger();
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
effect(()=>{
|
|
32
|
+
if (this.el.nativeElement) {
|
|
33
|
+
this.el.nativeElement.locale = this.locale();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
readonly hotspots = input<HotspotItem[]>([]);
|
|
38
|
+
readonly interactive = input<boolean, any>(true, {
|
|
39
|
+
transform: booleanAttribute
|
|
21
40
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
effect(() => {
|
|
28
|
-
if (this.el.nativeElement) {
|
|
29
|
-
this.el.nativeElement.trigger = this.trigger();
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
effect(() => {
|
|
33
|
-
if (this.el.nativeElement) {
|
|
34
|
-
this.el.nativeElement.locale = this.locale();
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
readonly hotspots = input<HotspotItem[], any>([]);
|
|
40
|
-
readonly interactive = input<boolean, any>(true, { transform: booleanAttribute });
|
|
41
|
-
readonly trigger = input<'click' | 'hover', any>('click');
|
|
42
|
-
readonly locale = input<string, any>('');
|
|
43
|
-
|
|
44
|
-
readonly hotspotClick = output<CustomEvent<HotspotItem>>();
|
|
41
|
+
readonly trigger = input<'click' | 'hover'>('click');
|
|
42
|
+
readonly locale = input<string>('');
|
|
43
|
+
readonly hotspotClick = output<CustomEvent<HotspotItem>>();
|
|
45
44
|
}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import type { Hotspot as HTMLElementClass } from '@uibit/hotspot';
|
|
2
2
|
import '@uibit/hotspot';
|
|
3
|
+
import type { HotspotItem } from '@uibit/hotspot';
|
|
3
4
|
|
|
4
5
|
declare global {
|
|
5
6
|
namespace astroHTML.JSX {
|
|
6
7
|
interface IntrinsicElements {
|
|
7
|
-
'uibit-hotspot': Partial<HTMLElementClass> & astroHTML.JSX.HTMLAttributes
|
|
8
|
+
'uibit-hotspot': Partial<HTMLElementClass> & astroHTML.JSX.HTMLAttributes & {
|
|
9
|
+
hotspots?: HotspotItem[];
|
|
10
|
+
interactive?: boolean;
|
|
11
|
+
trigger?: 'click' | 'hover';
|
|
12
|
+
locale?: string;
|
|
13
|
+
"on:hotspot-click"?: (event: CustomEvent<HotspotItem>) => void;
|
|
14
|
+
};
|
|
8
15
|
}
|
|
9
16
|
}
|
|
10
17
|
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import React, { useRef, useEffect, useLayoutEffect, useImperativeHandle } from 'react';
|
|
2
|
+
import type { Hotspot as HTMLElementClass } from '@uibit/hotspot';
|
|
3
|
+
import '@uibit/hotspot';
|
|
4
|
+
import type { HotspotItem } from '@uibit/hotspot';
|
|
5
|
+
const useTypeOfLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
6
|
+
export interface HotspotProps extends Omit<React.HTMLAttributes<HTMLElementClass>, 'hotspots' | 'interactive' | 'trigger' | 'locale' | 'onHotspotClick'> {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
hotspots?: HotspotItem[] | string;
|
|
9
|
+
interactive?: boolean;
|
|
10
|
+
trigger?: 'click' | 'hover';
|
|
11
|
+
locale?: string;
|
|
12
|
+
onHotspotClick?: (event: CustomEvent<HotspotItem>) => void;
|
|
13
|
+
}
|
|
14
|
+
export const Hotspot = ({ ref, children, ...props }: HotspotProps & {
|
|
15
|
+
ref?: React.Ref<HTMLElementClass>;
|
|
16
|
+
})=>{
|
|
17
|
+
const innerRef = useRef<HTMLElementClass>(null);
|
|
18
|
+
const propsRef = useRef(props);
|
|
19
|
+
propsRef.current = props;
|
|
20
|
+
useImperativeHandle(ref, ()=>innerRef.current!);
|
|
21
|
+
useTypeOfLayoutEffect(()=>{
|
|
22
|
+
const element = innerRef.current;
|
|
23
|
+
if (element && props.hotspots !== undefined) {
|
|
24
|
+
(element as any).hotspots = props.hotspots;
|
|
25
|
+
}
|
|
26
|
+
}, [
|
|
27
|
+
props.hotspots
|
|
28
|
+
]);
|
|
29
|
+
useTypeOfLayoutEffect(()=>{
|
|
30
|
+
const element = innerRef.current;
|
|
31
|
+
if (element && props.interactive !== undefined) {
|
|
32
|
+
(element as any).interactive = props.interactive;
|
|
33
|
+
}
|
|
34
|
+
}, [
|
|
35
|
+
props.interactive
|
|
36
|
+
]);
|
|
37
|
+
useTypeOfLayoutEffect(()=>{
|
|
38
|
+
const element = innerRef.current;
|
|
39
|
+
if (element && props.trigger !== undefined) {
|
|
40
|
+
(element as any).trigger = props.trigger;
|
|
41
|
+
}
|
|
42
|
+
}, [
|
|
43
|
+
props.trigger
|
|
44
|
+
]);
|
|
45
|
+
useTypeOfLayoutEffect(()=>{
|
|
46
|
+
const element = innerRef.current;
|
|
47
|
+
if (element && props.locale !== undefined) {
|
|
48
|
+
(element as any).locale = props.locale;
|
|
49
|
+
}
|
|
50
|
+
}, [
|
|
51
|
+
props.locale
|
|
52
|
+
]);
|
|
53
|
+
useTypeOfLayoutEffect(()=>{
|
|
54
|
+
const element = innerRef.current;
|
|
55
|
+
if (!element) return;
|
|
56
|
+
const handleEvent = (event: Event)=>{
|
|
57
|
+
if (propsRef.current.onHotspotClick) {
|
|
58
|
+
propsRef.current.onHotspotClick(event as any);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
element.addEventListener('hotspot-click', handleEvent);
|
|
62
|
+
return ()=>{
|
|
63
|
+
element.removeEventListener('hotspot-click', handleEvent);
|
|
64
|
+
};
|
|
65
|
+
}, []);
|
|
66
|
+
const domProps = {
|
|
67
|
+
...props
|
|
68
|
+
};
|
|
69
|
+
const customPropNames = [
|
|
70
|
+
'hotspots',
|
|
71
|
+
'interactive',
|
|
72
|
+
'trigger',
|
|
73
|
+
'locale',
|
|
74
|
+
'onHotspotClick'
|
|
75
|
+
];
|
|
76
|
+
for (const key of customPropNames){
|
|
77
|
+
delete (domProps as any)[key];
|
|
78
|
+
}
|
|
79
|
+
return React.createElement('uibit-hotspot', {
|
|
80
|
+
ref: innerRef,
|
|
81
|
+
...domProps
|
|
82
|
+
}, children);
|
|
83
|
+
};
|
|
84
|
+
declare global {
|
|
85
|
+
namespace React {
|
|
86
|
+
namespace JSX {
|
|
87
|
+
interface IntrinsicElements {
|
|
88
|
+
'uibit-hotspot': React.ClassAttributes<HTMLElementClass> & React.HTMLAttributes<HTMLElementClass> & {
|
|
89
|
+
children?: React.ReactNode;
|
|
90
|
+
class?: string;
|
|
91
|
+
hotspots?: HotspotItem[] | string;
|
|
92
|
+
interactive?: boolean;
|
|
93
|
+
trigger?: 'click' | 'hover';
|
|
94
|
+
locale?: string;
|
|
95
|
+
onHotspotClick?: (event: CustomEvent<HotspotItem>) => void;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -2,43 +2,75 @@
|
|
|
2
2
|
import '@uibit/hotspot';
|
|
3
3
|
import type { Hotspot as HTMLElementClass } from '@uibit/hotspot';
|
|
4
4
|
import type { HotspotItem } from '@uibit/hotspot';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
hotspots =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
hotspots = $bindable(),
|
|
8
|
+
interactive = $bindable(),
|
|
9
|
+
trigger = $bindable(),
|
|
10
|
+
locale = $bindable(),
|
|
11
|
+
popover-{id} = undefined,
|
|
12
|
+
children,
|
|
13
|
+
...restProps
|
|
13
14
|
} = $props<{
|
|
14
|
-
children?:
|
|
15
|
+
children?: import('svelte').Snippet;
|
|
15
16
|
hotspots?: HotspotItem[];
|
|
16
17
|
interactive?: boolean;
|
|
17
18
|
trigger?: 'click' | 'hover';
|
|
18
19
|
locale?: string;
|
|
19
20
|
popover-{id}?: import('svelte').Snippet;
|
|
21
|
+
[key: string]: any;
|
|
20
22
|
}>();
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (elementRef && hotspots !== undefined) {
|
|
23
|
+
|
|
24
|
+
let elementRef: HTMLElementClass | null = $state(null);
|
|
25
|
+
|
|
26
|
+
$effect(() => {
|
|
27
|
+
if (elementRef && hotspots !== undefined && elementRef.hotspots !== hotspots) {
|
|
26
28
|
elementRef.hotspots = hotspots;
|
|
27
29
|
}
|
|
28
|
-
if (elementRef && interactive !== undefined) {
|
|
30
|
+
if (elementRef && interactive !== undefined && elementRef.interactive !== interactive) {
|
|
29
31
|
elementRef.interactive = interactive;
|
|
30
32
|
}
|
|
31
|
-
if (elementRef && trigger !== undefined) {
|
|
33
|
+
if (elementRef && trigger !== undefined && elementRef.trigger !== trigger) {
|
|
32
34
|
elementRef.trigger = trigger;
|
|
33
35
|
}
|
|
34
|
-
if (elementRef && locale !== undefined) {
|
|
36
|
+
if (elementRef && locale !== undefined && elementRef.locale !== locale) {
|
|
35
37
|
elementRef.locale = locale;
|
|
36
38
|
}
|
|
37
39
|
});
|
|
38
|
-
|
|
40
|
+
|
|
41
|
+
$effect(() => {
|
|
42
|
+
const element = elementRef;
|
|
43
|
+
if (!element) return;
|
|
44
|
+
|
|
45
|
+
const handleEvent = () => {
|
|
46
|
+
if (hotspots !== element.hotspots) {
|
|
47
|
+
hotspots = element.hotspots as any;
|
|
48
|
+
}
|
|
49
|
+
if (interactive !== element.interactive) {
|
|
50
|
+
interactive = element.interactive as any;
|
|
51
|
+
}
|
|
52
|
+
if (trigger !== element.trigger) {
|
|
53
|
+
trigger = element.trigger as any;
|
|
54
|
+
}
|
|
55
|
+
if (locale !== element.locale) {
|
|
56
|
+
locale = element.locale as any;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const events = ['change', 'input', 'hotspot-click'];
|
|
61
|
+
for (const event of events) {
|
|
62
|
+
element.addEventListener(event, handleEvent);
|
|
63
|
+
}
|
|
64
|
+
return () => {
|
|
65
|
+
for (const event of events) {
|
|
66
|
+
element.removeEventListener(event, handleEvent);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
|
|
39
71
|
</script>
|
|
40
72
|
|
|
41
|
-
<uibit-hotspot bind:this={elementRef} {
|
|
73
|
+
<uibit-hotspot bind:this={elementRef} {...restProps}>
|
|
42
74
|
{#if popover-{id}}
|
|
43
75
|
<div slot="popover-{id}">
|
|
44
76
|
{@render popover-{id}()}
|
|
@@ -1,28 +1,98 @@
|
|
|
1
|
-
import { defineComponent, h } from 'vue';
|
|
1
|
+
import { defineComponent, h, ref, watch } from 'vue';
|
|
2
2
|
import type { Hotspot as HTMLElementClass } from '@uibit/hotspot';
|
|
3
3
|
import '@uibit/hotspot';
|
|
4
4
|
import type { HotspotItem } from '@uibit/hotspot';
|
|
5
|
-
|
|
6
5
|
export const Hotspot = defineComponent({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
6
|
+
name: 'Hotspot',
|
|
7
|
+
props: {
|
|
8
|
+
hotspots: {
|
|
9
|
+
type: [
|
|
10
|
+
String,
|
|
11
|
+
Number,
|
|
12
|
+
Boolean,
|
|
13
|
+
Array,
|
|
14
|
+
Object
|
|
15
|
+
] as any
|
|
16
|
+
},
|
|
17
|
+
interactive: {
|
|
18
|
+
type: [
|
|
19
|
+
String,
|
|
20
|
+
Number,
|
|
21
|
+
Boolean,
|
|
22
|
+
Array,
|
|
23
|
+
Object
|
|
24
|
+
] as any
|
|
25
|
+
},
|
|
26
|
+
trigger: {
|
|
27
|
+
type: [
|
|
28
|
+
String,
|
|
29
|
+
Number,
|
|
30
|
+
Boolean,
|
|
31
|
+
Array,
|
|
32
|
+
Object
|
|
33
|
+
] as any
|
|
34
|
+
},
|
|
35
|
+
locale: {
|
|
36
|
+
type: [
|
|
37
|
+
String,
|
|
38
|
+
Number,
|
|
39
|
+
Boolean,
|
|
40
|
+
Array,
|
|
41
|
+
Object
|
|
42
|
+
] as any
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
emits: [
|
|
46
|
+
'hotspot-click'
|
|
47
|
+
],
|
|
48
|
+
setup (props, { slots, emit }) {
|
|
49
|
+
const elementRef = ref<HTMLElementClass | null>(null);
|
|
50
|
+
if (false) {
|
|
51
|
+
watch(()=>props.modelValue, (newVal)=>{
|
|
52
|
+
if (elementRef.value && newVal !== undefined && elementRef.value.value !== newVal) {
|
|
53
|
+
elementRef.value.value = newVal;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
watch(()=>props.value, (newVal)=>{
|
|
57
|
+
if (elementRef.value && newVal !== undefined && elementRef.value.value !== newVal) {
|
|
58
|
+
elementRef.value.value = newVal;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
watch(()=>props.hotspots, (newVal)=>{
|
|
63
|
+
if (elementRef.value && newVal !== undefined) {
|
|
64
|
+
(elementRef.value as any).hotspots = newVal;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
watch(()=>props.interactive, (newVal)=>{
|
|
68
|
+
if (elementRef.value && newVal !== undefined) {
|
|
69
|
+
(elementRef.value as any).interactive = newVal;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
watch(()=>props.trigger, (newVal)=>{
|
|
73
|
+
if (elementRef.value && newVal !== undefined) {
|
|
74
|
+
(elementRef.value as any).trigger = newVal;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
watch(()=>props.locale, (newVal)=>{
|
|
78
|
+
if (elementRef.value && newVal !== undefined) {
|
|
79
|
+
(elementRef.value as any).locale = newVal;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
return ()=>{
|
|
83
|
+
const eventListeners: Record<string, any> = {};
|
|
84
|
+
eventListeners['onHotspot-click'] = (event: Event)=>{
|
|
85
|
+
emit('hotspot-click', event);
|
|
86
|
+
};
|
|
87
|
+
const mergedProps = {
|
|
88
|
+
...props,
|
|
89
|
+
...eventListeners,
|
|
90
|
+
ref: elementRef
|
|
91
|
+
};
|
|
92
|
+
if (false && props.modelValue !== undefined) {
|
|
93
|
+
(mergedProps as any).value = props.modelValue;
|
|
94
|
+
}
|
|
95
|
+
return h('uibit-hotspot', mergedProps, slots.default?.());
|
|
96
|
+
};
|
|
97
|
+
}
|
|
28
98
|
});
|
package/dist/hotspot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hotspot.d.ts","sourceRoot":"","sources":["../src/hotspot.ts"],"names":[],"mappings":"AACA,OAAO,EAA2C,YAAY,EAAE,MAAM,aAAa,CAAC;AAGpF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oEA+BoE;AACpE,qBACa,OAAQ,SAAQ,YAAY;IACvC,MAAM,CAAC,MAAM,0BAAU;IAEvB,wHAAwH;
|
|
1
|
+
{"version":3,"file":"hotspot.d.ts","sourceRoot":"","sources":["../src/hotspot.ts"],"names":[],"mappings":"AACA,OAAO,EAA2C,YAAY,EAAE,MAAM,aAAa,CAAC;AAGpF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oEA+BoE;AACpE,qBACa,OAAQ,SAAQ,YAAY;IACvC,MAAM,CAAC,MAAM,0BAAU;IAEvB,wHAAwH;IAexH,QAAQ,EAAE,WAAW,EAAE,CAAM;IAC7B,0EAA0E;IAC7C,WAAW,UAAQ;IAChD,gDAAgD;IACpB,OAAO,EAAE,OAAO,GAAG,OAAO,CAAW;IAExD,OAAO,CAAC,eAAe,CAAuB;IAEvD,OAAO,CAAC,YAAY,CAAC,CAAS;IAE9B,iBAAiB,SAIhB;IAED,oBAAoB,SAKnB;IAED,OAAO,CAAC,qBAAqB,CAI3B;IAEF,OAAO,CAAC,mBAAmB,CAMzB;IAEF,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,uBAAuB;IAM/B,OAAO,CAAC,uBAAuB;IAK/B,OAAO,CAAC,uBAAuB;IAK/B,OAAO,CAAC,uBAAuB;IAK/B,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,cAAc;IAItB,MAAM,oCA+DL;CACF;eAEc,OAAO"}
|
package/dist/hotspot.js
CHANGED
|
@@ -134,7 +134,7 @@ let Hotspot = class Hotspot extends UIBitElement {
|
|
|
134
134
|
return html `
|
|
135
135
|
<div part="container" class="hotspot-container">
|
|
136
136
|
<slot></slot>
|
|
137
|
-
${this.hotspots.map((spot, index) => {
|
|
137
|
+
${(this.hotspots || []).map((spot, index) => {
|
|
138
138
|
const spotId = spot.id || String(index);
|
|
139
139
|
const isOpened = this.activeHotspotId === spotId;
|
|
140
140
|
const yVal = typeof spot.y === 'number' ? spot.y : parseFloat(String(spot.y || '0'));
|
|
@@ -193,7 +193,22 @@ let Hotspot = class Hotspot extends UIBitElement {
|
|
|
193
193
|
}
|
|
194
194
|
};
|
|
195
195
|
__decorate([
|
|
196
|
-
property({
|
|
196
|
+
property({
|
|
197
|
+
type: Array,
|
|
198
|
+
converter: {
|
|
199
|
+
fromAttribute: (value) => {
|
|
200
|
+
if (!value)
|
|
201
|
+
return [];
|
|
202
|
+
try {
|
|
203
|
+
return JSON.parse(value);
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
return [];
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
toAttribute: (value) => JSON.stringify(value),
|
|
210
|
+
},
|
|
211
|
+
})
|
|
197
212
|
], Hotspot.prototype, "hotspots", void 0);
|
|
198
213
|
__decorate([
|
|
199
214
|
property({ type: Boolean })
|
package/dist/hotspot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hotspot.js","sourceRoot":"","sources":["../src/hotspot.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oEA+BoE;AAE7D,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,YAAY;IAAlC;;QAGL,wHAAwH;
|
|
1
|
+
{"version":3,"file":"hotspot.js","sourceRoot":"","sources":["../src/hotspot.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;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a,CAAC,eAAe,CAAC;GAClB,OAAO,CAiLnB;;AAED,eAAe,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uibit/hotspot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Interactive hotspot annotations for images. Display contextual tooltip cards on click or hover with custom content overlays and animations.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"import": "./dist/index.js"
|
|
12
12
|
},
|
|
13
13
|
"./custom-elements.json": "./custom-elements.json",
|
|
14
|
-
"./react": "./dist/frameworks/react/index.
|
|
14
|
+
"./react": "./dist/frameworks/react/index.ts",
|
|
15
15
|
"./vue": "./dist/frameworks/vue/index.ts",
|
|
16
16
|
"./svelte": "./dist/frameworks/svelte/index.svelte",
|
|
17
17
|
"./angular": "./dist/frameworks/angular/index.ts",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@types/node": "^20.19.43",
|
|
52
52
|
"lit": "^3.3.3",
|
|
53
53
|
"typescript": "7.0.2",
|
|
54
|
-
"@uibit/codegen": "0.
|
|
54
|
+
"@uibit/codegen": "0.2.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"lit": "^3.0.0",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes, ClassAttributes } from 'react';
|
|
2
|
-
import type { Hotspot as HTMLElementClass } from '@uibit/hotspot';
|
|
3
|
-
import '@uibit/hotspot';
|
|
4
|
-
import type { HotspotItem } from '@uibit/hotspot';
|
|
5
|
-
|
|
6
|
-
declare global {
|
|
7
|
-
namespace React {
|
|
8
|
-
namespace JSX {
|
|
9
|
-
interface IntrinsicElements {
|
|
10
|
-
'uibit-hotspot': ClassAttributes<HTMLElementClass> & HTMLAttributes<HTMLElementClass> & {
|
|
11
|
-
children?: React.ReactNode;
|
|
12
|
-
class?: string;
|
|
13
|
-
hotspots?: HotspotItem[];
|
|
14
|
-
interactive?: boolean;
|
|
15
|
-
trigger?: 'click' | 'hover';
|
|
16
|
-
locale?: string;
|
|
17
|
-
onHotspotClick?: (event: any) => void;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|