@uibit/carousel 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.
@@ -1,33 +1,195 @@
1
- import { defineComponent, h } from 'vue';
1
+ import { defineComponent, h, ref, watch } from 'vue';
2
2
  import type { UIBitCarousel as HTMLElementClass } from '@uibit/carousel';
3
3
  import '@uibit/carousel';
4
-
5
4
  export const UIBitCarousel = defineComponent({
6
- name: 'UIBitCarousel',
7
- props: {
8
- autoPlay: { type: [String, Number, Boolean, Array, Object] as any },
9
- autoPlayInterval: { type: [String, Number, Boolean, Array, Object] as any },
10
- loop: { type: [String, Number, Boolean, Array, Object] as any },
11
- content: { type: [String, Number, Boolean, Array, Object] as any },
12
- viewport: { type: [String, Number, Boolean, Array, Object] as any },
13
- slotElement: { type: [String, Number, Boolean, Array, Object] as any },
14
- currentIndex: { type: [String, Number, Boolean, Array, Object] as any },
15
- totalSlides: { type: [String, Number, Boolean, Array, Object] as any },
16
- canPrev: { type: [String, Number, Boolean, Array, Object] as any },
17
- canNext: { type: [String, Number, Boolean, Array, Object] as any }
18
- },
19
- emits: ['slide-change'],
20
- setup(props, { slots, emit }) {
21
- return () => {
22
- const eventListeners: Record<string, any> = {};
23
- eventListeners['onSlide-change'] = (event: Event) => {
24
- emit('slide-change', event);
25
- };
26
-
27
- return h('uibit-carousel', {
28
- ...props,
29
- ...eventListeners
30
- }, slots.default?.());
31
- };
32
- }
5
+ name: 'UIBitCarousel',
6
+ props: {
7
+ autoPlay: {
8
+ type: [
9
+ String,
10
+ Number,
11
+ Boolean,
12
+ Array,
13
+ Object
14
+ ] as any
15
+ },
16
+ autoPlayInterval: {
17
+ type: [
18
+ String,
19
+ Number,
20
+ Boolean,
21
+ Array,
22
+ Object
23
+ ] as any
24
+ },
25
+ loop: {
26
+ type: [
27
+ String,
28
+ Number,
29
+ Boolean,
30
+ Array,
31
+ Object
32
+ ] as any
33
+ },
34
+ content: {
35
+ type: [
36
+ String,
37
+ Number,
38
+ Boolean,
39
+ Array,
40
+ Object
41
+ ] as any
42
+ },
43
+ viewport: {
44
+ type: [
45
+ String,
46
+ Number,
47
+ Boolean,
48
+ Array,
49
+ Object
50
+ ] as any
51
+ },
52
+ slotElement: {
53
+ type: [
54
+ String,
55
+ Number,
56
+ Boolean,
57
+ Array,
58
+ Object
59
+ ] as any
60
+ },
61
+ currentIndex: {
62
+ type: [
63
+ String,
64
+ Number,
65
+ Boolean,
66
+ Array,
67
+ Object
68
+ ] as any
69
+ },
70
+ totalSlides: {
71
+ type: [
72
+ String,
73
+ Number,
74
+ Boolean,
75
+ Array,
76
+ Object
77
+ ] as any
78
+ },
79
+ canPrev: {
80
+ type: [
81
+ String,
82
+ Number,
83
+ Boolean,
84
+ Array,
85
+ Object
86
+ ] as any
87
+ },
88
+ canNext: {
89
+ type: [
90
+ String,
91
+ Number,
92
+ Boolean,
93
+ Array,
94
+ Object
95
+ ] as any
96
+ },
97
+ locale: {
98
+ type: [
99
+ String,
100
+ Number,
101
+ Boolean,
102
+ Array,
103
+ Object
104
+ ] as any
105
+ }
106
+ },
107
+ emits: [
108
+ 'slide-change'
109
+ ],
110
+ setup (props, { slots, emit }) {
111
+ const elementRef = ref<HTMLElementClass | null>(null);
112
+ if (false) {
113
+ watch(()=>props.modelValue, (newVal)=>{
114
+ if (elementRef.value && newVal !== undefined && elementRef.value.value !== newVal) {
115
+ elementRef.value.value = newVal;
116
+ }
117
+ });
118
+ watch(()=>props.value, (newVal)=>{
119
+ if (elementRef.value && newVal !== undefined && elementRef.value.value !== newVal) {
120
+ elementRef.value.value = newVal;
121
+ }
122
+ });
123
+ }
124
+ watch(()=>props.autoPlay, (newVal)=>{
125
+ if (elementRef.value && newVal !== undefined) {
126
+ (elementRef.value as any).autoPlay = newVal;
127
+ }
128
+ });
129
+ watch(()=>props.autoPlayInterval, (newVal)=>{
130
+ if (elementRef.value && newVal !== undefined) {
131
+ (elementRef.value as any).autoPlayInterval = newVal;
132
+ }
133
+ });
134
+ watch(()=>props.loop, (newVal)=>{
135
+ if (elementRef.value && newVal !== undefined) {
136
+ (elementRef.value as any).loop = newVal;
137
+ }
138
+ });
139
+ watch(()=>props.content, (newVal)=>{
140
+ if (elementRef.value && newVal !== undefined) {
141
+ (elementRef.value as any).content = newVal;
142
+ }
143
+ });
144
+ watch(()=>props.viewport, (newVal)=>{
145
+ if (elementRef.value && newVal !== undefined) {
146
+ (elementRef.value as any).viewport = newVal;
147
+ }
148
+ });
149
+ watch(()=>props.slotElement, (newVal)=>{
150
+ if (elementRef.value && newVal !== undefined) {
151
+ (elementRef.value as any).slotElement = newVal;
152
+ }
153
+ });
154
+ watch(()=>props.currentIndex, (newVal)=>{
155
+ if (elementRef.value && newVal !== undefined) {
156
+ (elementRef.value as any).currentIndex = newVal;
157
+ }
158
+ });
159
+ watch(()=>props.totalSlides, (newVal)=>{
160
+ if (elementRef.value && newVal !== undefined) {
161
+ (elementRef.value as any).totalSlides = newVal;
162
+ }
163
+ });
164
+ watch(()=>props.canPrev, (newVal)=>{
165
+ if (elementRef.value && newVal !== undefined) {
166
+ (elementRef.value as any).canPrev = newVal;
167
+ }
168
+ });
169
+ watch(()=>props.canNext, (newVal)=>{
170
+ if (elementRef.value && newVal !== undefined) {
171
+ (elementRef.value as any).canNext = newVal;
172
+ }
173
+ });
174
+ watch(()=>props.locale, (newVal)=>{
175
+ if (elementRef.value && newVal !== undefined) {
176
+ (elementRef.value as any).locale = newVal;
177
+ }
178
+ });
179
+ return ()=>{
180
+ const eventListeners: Record<string, any> = {};
181
+ eventListeners['onSlide-change'] = (event: Event)=>{
182
+ emit('slide-change', event);
183
+ };
184
+ const mergedProps = {
185
+ ...props,
186
+ ...eventListeners,
187
+ ref: elementRef
188
+ };
189
+ if (false && props.modelValue !== undefined) {
190
+ (mergedProps as any).value = props.modelValue;
191
+ }
192
+ return h('uibit-carousel', mergedProps, slots.default?.());
193
+ };
194
+ }
33
195
  });
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { UIBitCarousel as default } from './carousel';
1
+ export { UIBitCarousel as default, UIBitCarousel } from './carousel';
2
2
  export type { CarouselConfig, SlideChangeEvent } from './types';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC;AACtD,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACrE,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { UIBitCarousel as default } from './carousel';
1
+ export { UIBitCarousel as default, UIBitCarousel } from './carousel';
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uibit/carousel",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Native, accessible carousel using CSS scroll-snap and scroll-driven animations. Perfect for image galleries, testimonials, and product showcases.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -12,7 +12,10 @@
12
12
  },
13
13
  "./carousel.css": "./dist/carousel.css",
14
14
  "./custom-elements.json": "./custom-elements.json",
15
- "./react": "./dist/frameworks/react/index.d.ts",
15
+ "./react": {
16
+ "types": "./dist/frameworks/react/index.ts",
17
+ "import": "./dist/frameworks/react/index.ts"
18
+ },
16
19
  "./vue": "./dist/frameworks/vue/index.ts",
17
20
  "./svelte": "./dist/frameworks/svelte/index.svelte",
18
21
  "./angular": "./dist/frameworks/angular/index.ts",
@@ -47,13 +50,13 @@
47
50
  },
48
51
  "dependencies": {
49
52
  "lucide": "^1.24.0",
50
- "@uibit/core": "0.1.0"
53
+ "@uibit/core": "0.2.0"
51
54
  },
52
55
  "devDependencies": {
53
56
  "@types/node": "^20.19.43",
54
57
  "lit": "^3.3.3",
55
58
  "typescript": "7.0.2",
56
- "@uibit/codegen": "0.1.0"
59
+ "@uibit/codegen": "0.2.0"
57
60
  },
58
61
  "peerDependencies": {
59
62
  "lit": "^3.0.0",
@@ -84,9 +87,9 @@
84
87
  "tagName": "uibit-carousel"
85
88
  },
86
89
  "scripts": {
87
- "build": "cem analyze --globs 'src/**/*.ts' --litelement && uibit-codegen --package . && tsc",
88
- "dev": "concurrently \"cem analyze --globs 'src/**/*.ts' --litelement --watch\" \"tsc --watch\"",
89
- "analyze": "cem analyze --globs 'src/**/*.ts' --litelement",
90
+ "build": "cem analyze --config ../custom-elements-manifest.config.js && uibit-codegen --package . && tsc",
91
+ "dev": "concurrently \"cem analyze --config ../custom-elements-manifest.config.js --watch\" \"tsc --watch\"",
92
+ "analyze": "cem analyze --config ../custom-elements-manifest.config.js",
90
93
  "typecheck": "tsc --noEmit"
91
94
  }
92
95
  }
@@ -1,27 +0,0 @@
1
- import type { HTMLAttributes, ClassAttributes } from 'react';
2
- import type { UIBitCarousel as HTMLElementClass } from '@uibit/carousel';
3
- import '@uibit/carousel';
4
-
5
- declare global {
6
- namespace React {
7
- namespace JSX {
8
- interface IntrinsicElements {
9
- 'uibit-carousel': ClassAttributes<HTMLElementClass> & HTMLAttributes<HTMLElementClass> & {
10
- children?: React.ReactNode;
11
- class?: string;
12
- autoPlay?: boolean;
13
- autoPlayInterval?: number;
14
- loop?: boolean;
15
- content?: HTMLElement | undefined;
16
- viewport?: HTMLElement | undefined;
17
- slotElement?: HTMLSlotElement | undefined;
18
- currentIndex?: number;
19
- totalSlides?: number;
20
- canPrev?: boolean;
21
- canNext?: boolean;
22
- onSlideChange?: (event: any) => void;
23
- };
24
- }
25
- }
26
- }
27
- }