@uibit/effect-trigger 0.1.0 → 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/README.md +10 -0
- package/custom-elements.json +469 -0
- package/dist/effect-trigger.d.ts +4 -1
- package/dist/effect-trigger.d.ts.map +1 -1
- package/dist/effect-trigger.js +4 -1
- package/dist/effect-trigger.js.map +1 -1
- package/dist/frameworks/angular/index.ts +89 -78
- package/dist/frameworks/astro/index.d.ts +16 -1
- package/dist/frameworks/preact/index.d.ts +3 -0
- package/dist/frameworks/react/index.ts +196 -0
- package/dist/frameworks/solid/index.d.ts +2 -1
- package/dist/frameworks/stencil/index.d.ts +3 -0
- package/dist/frameworks/svelte/index.svelte +94 -33
- package/dist/frameworks/vue/index.ts +205 -30
- package/package.json +7 -7
- package/dist/frameworks/react/index.d.ts +0 -29
|
@@ -1,35 +1,210 @@
|
|
|
1
|
-
import { defineComponent, h } from 'vue';
|
|
1
|
+
import { defineComponent, h, ref, watch } from 'vue';
|
|
2
2
|
import type { EffectTrigger as HTMLElementClass } from '@uibit/effect-trigger';
|
|
3
3
|
import '@uibit/effect-trigger';
|
|
4
4
|
import type { EffectTriggerType, EffectBehaviorType } from '@uibit/effect-trigger';
|
|
5
|
-
|
|
6
5
|
export const EffectTrigger = defineComponent({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
6
|
+
name: 'EffectTrigger',
|
|
7
|
+
props: {
|
|
8
|
+
trigger: {
|
|
9
|
+
type: [
|
|
10
|
+
String,
|
|
11
|
+
Number,
|
|
12
|
+
Boolean,
|
|
13
|
+
Array,
|
|
14
|
+
Object
|
|
15
|
+
] as any
|
|
16
|
+
},
|
|
17
|
+
behavior: {
|
|
18
|
+
type: [
|
|
19
|
+
String,
|
|
20
|
+
Number,
|
|
21
|
+
Boolean,
|
|
22
|
+
Array,
|
|
23
|
+
Object
|
|
24
|
+
] as any
|
|
25
|
+
},
|
|
26
|
+
density: {
|
|
27
|
+
type: [
|
|
28
|
+
String,
|
|
29
|
+
Number,
|
|
30
|
+
Boolean,
|
|
31
|
+
Array,
|
|
32
|
+
Object
|
|
33
|
+
] as any
|
|
34
|
+
},
|
|
35
|
+
velocity: {
|
|
36
|
+
type: [
|
|
37
|
+
String,
|
|
38
|
+
Number,
|
|
39
|
+
Boolean,
|
|
40
|
+
Array,
|
|
41
|
+
Object
|
|
42
|
+
] as any
|
|
43
|
+
},
|
|
44
|
+
randomize: {
|
|
45
|
+
type: [
|
|
46
|
+
String,
|
|
47
|
+
Number,
|
|
48
|
+
Boolean,
|
|
49
|
+
Array,
|
|
50
|
+
Object
|
|
51
|
+
] as any
|
|
52
|
+
},
|
|
53
|
+
stagger: {
|
|
54
|
+
type: [
|
|
55
|
+
String,
|
|
56
|
+
Number,
|
|
57
|
+
Boolean,
|
|
58
|
+
Array,
|
|
59
|
+
Object
|
|
60
|
+
] as any
|
|
61
|
+
},
|
|
62
|
+
scaleRange: {
|
|
63
|
+
type: [
|
|
64
|
+
String,
|
|
65
|
+
Number,
|
|
66
|
+
Boolean,
|
|
67
|
+
Array,
|
|
68
|
+
Object
|
|
69
|
+
] as any
|
|
70
|
+
},
|
|
71
|
+
rotationRange: {
|
|
72
|
+
type: [
|
|
73
|
+
String,
|
|
74
|
+
Number,
|
|
75
|
+
Boolean,
|
|
76
|
+
Array,
|
|
77
|
+
Object
|
|
78
|
+
] as any
|
|
79
|
+
},
|
|
80
|
+
keyframes: {
|
|
81
|
+
type: [
|
|
82
|
+
String,
|
|
83
|
+
Number,
|
|
84
|
+
Boolean,
|
|
85
|
+
Array,
|
|
86
|
+
Object
|
|
87
|
+
] as any
|
|
88
|
+
},
|
|
89
|
+
targetSelector: {
|
|
90
|
+
type: [
|
|
91
|
+
String,
|
|
92
|
+
Number,
|
|
93
|
+
Boolean,
|
|
94
|
+
Array,
|
|
95
|
+
Object
|
|
96
|
+
] as any
|
|
97
|
+
},
|
|
98
|
+
destinationSelector: {
|
|
99
|
+
type: [
|
|
100
|
+
String,
|
|
101
|
+
Number,
|
|
102
|
+
Boolean,
|
|
103
|
+
Array,
|
|
104
|
+
Object
|
|
105
|
+
] as any
|
|
106
|
+
},
|
|
107
|
+
locale: {
|
|
108
|
+
type: [
|
|
109
|
+
String,
|
|
110
|
+
Number,
|
|
111
|
+
Boolean,
|
|
112
|
+
Array,
|
|
113
|
+
Object
|
|
114
|
+
] as any
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
emits: [
|
|
118
|
+
'uibit-particle-create'
|
|
119
|
+
],
|
|
120
|
+
setup (props, { slots, emit }) {
|
|
121
|
+
const elementRef = ref<HTMLElementClass | null>(null);
|
|
122
|
+
if (false) {
|
|
123
|
+
watch(()=>props.modelValue, (newVal)=>{
|
|
124
|
+
if (elementRef.value && newVal !== undefined && elementRef.value.value !== newVal) {
|
|
125
|
+
elementRef.value.value = newVal;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
watch(()=>props.value, (newVal)=>{
|
|
129
|
+
if (elementRef.value && newVal !== undefined && elementRef.value.value !== newVal) {
|
|
130
|
+
elementRef.value.value = newVal;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
watch(()=>props.trigger, (newVal)=>{
|
|
135
|
+
if (elementRef.value && newVal !== undefined) {
|
|
136
|
+
(elementRef.value as any).trigger = newVal;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
watch(()=>props.behavior, (newVal)=>{
|
|
140
|
+
if (elementRef.value && newVal !== undefined) {
|
|
141
|
+
(elementRef.value as any).behavior = newVal;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
watch(()=>props.density, (newVal)=>{
|
|
145
|
+
if (elementRef.value && newVal !== undefined) {
|
|
146
|
+
(elementRef.value as any).density = newVal;
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
watch(()=>props.velocity, (newVal)=>{
|
|
150
|
+
if (elementRef.value && newVal !== undefined) {
|
|
151
|
+
(elementRef.value as any).velocity = newVal;
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
watch(()=>props.randomize, (newVal)=>{
|
|
155
|
+
if (elementRef.value && newVal !== undefined) {
|
|
156
|
+
(elementRef.value as any).randomize = newVal;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
watch(()=>props.stagger, (newVal)=>{
|
|
160
|
+
if (elementRef.value && newVal !== undefined) {
|
|
161
|
+
(elementRef.value as any).stagger = newVal;
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
watch(()=>props.scaleRange, (newVal)=>{
|
|
165
|
+
if (elementRef.value && newVal !== undefined) {
|
|
166
|
+
(elementRef.value as any).scaleRange = newVal;
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
watch(()=>props.rotationRange, (newVal)=>{
|
|
170
|
+
if (elementRef.value && newVal !== undefined) {
|
|
171
|
+
(elementRef.value as any).rotationRange = newVal;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
watch(()=>props.keyframes, (newVal)=>{
|
|
175
|
+
if (elementRef.value && newVal !== undefined) {
|
|
176
|
+
(elementRef.value as any).keyframes = newVal;
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
watch(()=>props.targetSelector, (newVal)=>{
|
|
180
|
+
if (elementRef.value && newVal !== undefined) {
|
|
181
|
+
(elementRef.value as any).targetSelector = newVal;
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
watch(()=>props.destinationSelector, (newVal)=>{
|
|
185
|
+
if (elementRef.value && newVal !== undefined) {
|
|
186
|
+
(elementRef.value as any).destinationSelector = newVal;
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
watch(()=>props.locale, (newVal)=>{
|
|
190
|
+
if (elementRef.value && newVal !== undefined) {
|
|
191
|
+
(elementRef.value as any).locale = newVal;
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
return ()=>{
|
|
195
|
+
const eventListeners: Record<string, any> = {};
|
|
196
|
+
eventListeners['onUibit-particle-create'] = (event: Event)=>{
|
|
197
|
+
emit('uibit-particle-create', event);
|
|
198
|
+
};
|
|
199
|
+
const mergedProps = {
|
|
200
|
+
...props,
|
|
201
|
+
...eventListeners,
|
|
202
|
+
ref: elementRef
|
|
203
|
+
};
|
|
204
|
+
if (false && props.modelValue !== undefined) {
|
|
205
|
+
(mergedProps as any).value = props.modelValue;
|
|
206
|
+
}
|
|
207
|
+
return h('uibit-effect-trigger', mergedProps, slots.default?.());
|
|
208
|
+
};
|
|
209
|
+
}
|
|
35
210
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uibit/effect-trigger",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "A behavioral engine that intercepts user actions (click, hover, visible) on standard DOM elements to trigger custom particle animations, physics-based viewport crossings, or micro-feedback flows using slotted SVGs or markup templates.",
|
|
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",
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
"author": "Jonathan Rawlings",
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@uibit/core": "0.
|
|
43
|
+
"@uibit/core": "0.2.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "^20.19.43",
|
|
47
47
|
"lit": "^3.3.3",
|
|
48
48
|
"typescript": "7.0.2",
|
|
49
|
-
"@uibit/codegen": "0.
|
|
49
|
+
"@uibit/codegen": "0.2.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"lit": "^3.0.0",
|
|
@@ -82,9 +82,9 @@
|
|
|
82
82
|
"directory": "packages/components/effect-trigger"
|
|
83
83
|
},
|
|
84
84
|
"scripts": {
|
|
85
|
-
"build": "cem analyze --
|
|
86
|
-
"dev": "concurrently \"cem analyze --
|
|
87
|
-
"analyze": "cem analyze --
|
|
85
|
+
"build": "cem analyze --config ../custom-elements-manifest.config.js && uibit-codegen --package . && tsc",
|
|
86
|
+
"dev": "concurrently \"cem analyze --config ../custom-elements-manifest.config.js --watch\" \"tsc --watch\"",
|
|
87
|
+
"analyze": "cem analyze --config ../custom-elements-manifest.config.js",
|
|
88
88
|
"typecheck": "tsc --noEmit",
|
|
89
89
|
"test": "vitest run -c ../../../vitest.config.ts --passWithNoTests"
|
|
90
90
|
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes, ClassAttributes } from 'react';
|
|
2
|
-
import type { EffectTrigger as HTMLElementClass } from '@uibit/effect-trigger';
|
|
3
|
-
import '@uibit/effect-trigger';
|
|
4
|
-
import type { EffectTriggerType, EffectBehaviorType } from '@uibit/effect-trigger';
|
|
5
|
-
|
|
6
|
-
declare global {
|
|
7
|
-
namespace React {
|
|
8
|
-
namespace JSX {
|
|
9
|
-
interface IntrinsicElements {
|
|
10
|
-
'uibit-effect-trigger': ClassAttributes<HTMLElementClass> & HTMLAttributes<HTMLElementClass> & {
|
|
11
|
-
children?: React.ReactNode;
|
|
12
|
-
class?: string;
|
|
13
|
-
trigger?: EffectTriggerType;
|
|
14
|
-
behavior?: EffectBehaviorType;
|
|
15
|
-
density?: number;
|
|
16
|
-
velocity?: string;
|
|
17
|
-
randomize?: boolean;
|
|
18
|
-
stagger?: string;
|
|
19
|
-
scaleRange?: string;
|
|
20
|
-
rotationRange?: string;
|
|
21
|
-
keyframes?: string | undefined;
|
|
22
|
-
targetSelector?: string | undefined;
|
|
23
|
-
destinationSelector?: string | undefined;
|
|
24
|
-
onUibitParticleCreate?: (event: any) => void;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|