@molecule/app-carousel-vue 0.0.0-stage → 1.1.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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,181 @@
1
- # Temporary Holding Version
1
+ <!--
2
+ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
+ Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
+ Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
+ To change this document, edit the module-level JSDoc in src/index.ts.
6
+ Generated: 2026-11-18T23:41:37.424Z
7
+ -->
2
8
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
9
+ # @molecule/app-carousel-vue
10
+
11
+ Vue image / card carousel.
12
+
13
+ Exports `<Carousel>` — arrows + dots + optional autoplay; controlled-optional.
14
+ It is the Vue counterpart of `@molecule/app-carousel-react`: the same props
15
+ and the same DOM for the same input.
16
+
17
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
18
+ > It is written to be read by coding agents as much as by people, and is generated from this
19
+ > package's source — edit `src/index.ts` JSDoc, not this file.
20
+
21
+ ## Quick Start
22
+
23
+ ```ts
24
+ import { createApp, h } from 'vue'
25
+ import { Carousel } from '@molecule/app-carousel-vue'
26
+
27
+ createApp({
28
+ render: () =>
29
+ h(
30
+ Carousel,
31
+ { autoplayMs: 4000, showDots: true, showArrows: true },
32
+ {
33
+ default: () => [
34
+ h('img', { src: '/slides/one.jpg', alt: 'Slide 1' }),
35
+ h('img', { src: '/slides/two.jpg', alt: 'Slide 2' }),
36
+ h('img', { src: '/slides/three.jpg', alt: 'Slide 3' }),
37
+ ],
38
+ },
39
+ ),
40
+ }).mount('#app')
41
+ ```
42
+
43
+ ## Type
44
+
45
+ `feature`
46
+
47
+ ## Installation
48
+
49
+ ```bash
50
+ npm install @molecule/app-carousel-vue @molecule/app-ui @molecule/app-ui-vue @molecule/app-vue vue
51
+ ```
52
+
53
+ ## API
54
+
55
+ ### Interfaces
56
+
57
+ #### `CarouselProps`
58
+
59
+ Props accepted by the {@link Carousel} component.
60
+
61
+ ```typescript
62
+ interface CarouselProps {
63
+ /**
64
+ * Slides — each child is one frame. Passed as the default slot (or the
65
+ * `children` prop); both spellings work.
66
+ */
67
+ children?: VNodeChild
68
+ /** Controlled active index — caller owns state. */
69
+ index?: number
70
+ /** Called when the active index changes. */
71
+ onChange?: (index: number) => void
72
+ /** Show prev/next arrows. Defaults to true. */
73
+ showArrows?: boolean
74
+ /** Show dot indicator strip. Defaults to true. */
75
+ showDots?: boolean
76
+ /** Auto-advance interval in ms (set 0 to disable). */
77
+ autoplayMs?: number
78
+ /** Pause autoplay on mouseover. Defaults to true. */
79
+ pauseOnHover?: boolean
80
+ /** Loop back to start at end. Defaults to true. */
81
+ loop?: boolean
82
+ /** Extra classes. */
83
+ className?: string
84
+ }
85
+ ```
86
+
87
+ ### Constants
88
+
89
+ #### `Carousel`
90
+
91
+ Generic image / card carousel with arrows + dots + optional autoplay.
92
+ Controlled-optional: omit `index` to let the component manage its own state.
93
+
94
+ ```typescript
95
+ const Carousel: DefineComponent<
96
+ ExtractPropTypes<{
97
+ children: null
98
+ index: { type: PropType<number | undefined>; default: undefined }
99
+ onChange: PropType<CarouselProps['onChange']>
100
+ showArrows: { type: PropType<boolean | undefined>; default: undefined }
101
+ showDots: { type: PropType<boolean | undefined>; default: undefined }
102
+ autoplayMs: { type: PropType<number | undefined>; default: undefined }
103
+ pauseOnHover: { type: PropType<boolean | undefined>; default: undefined }
104
+ loop: { type: PropType<boolean | undefined>; default: undefined }
105
+ className: StringConstructor
106
+ }>,
107
+ () => VNode | null,
108
+ {},
109
+ {},
110
+ {},
111
+ ComponentOptionsMixin,
112
+ ComponentOptionsMixin,
113
+ {},
114
+ string,
115
+ PublicProps,
116
+ Readonly<
117
+ ExtractPropTypes<{
118
+ children: null
119
+ index: { type: PropType<number | undefined>; default: undefined }
120
+ onChange: PropType<CarouselProps['onChange']>
121
+ showArrows: { type: PropType<boolean | undefined>; default: undefined }
122
+ showDots: { type: PropType<boolean | undefined>; default: undefined }
123
+ autoplayMs: { type: PropType<number | undefined>; default: undefined }
124
+ pauseOnHover: { type: PropType<boolean | undefined>; default: undefined }
125
+ loop: { type: PropType<boolean | undefined>; default: undefined }
126
+ className: StringConstructor
127
+ }>
128
+ > &
129
+ Readonly<{}>,
130
+ {
131
+ index: number | undefined
132
+ showArrows: boolean | undefined
133
+ showDots: boolean | undefined
134
+ autoplayMs: number | undefined
135
+ pauseOnHover: boolean | undefined
136
+ loop: boolean | undefined
137
+ },
138
+ {},
139
+ {},
140
+ {},
141
+ string,
142
+ ComponentProvideOptions,
143
+ true,
144
+ {},
145
+ any
146
+ >
147
+ ```
148
+
149
+ - `props` — Component props (see {@link CarouselProps}).
150
+
151
+ **Returns:** The carousel component.
152
+
153
+ ## Injection Notes
154
+
155
+ ### Requirements
156
+
157
+ Peer dependencies:
158
+
159
+ - `@molecule/app-ui` ^1.3.11
160
+ - `@molecule/app-ui-vue` ^1.1.0
161
+ - `@molecule/app-vue` ^3.5.0
162
+ - `vue` ^3.4.0
163
+
164
+ ### Runtime Dependencies
165
+
166
+ - `@molecule/app-ui`
167
+ - `@molecule/app-ui-vue`
168
+ - `@molecule/app-vue`
169
+ - `vue`
170
+
171
+ Controlled-optional: omit `index` for internal state; pass `index` +
172
+ `onChange` to own it. `autoplayMs={0}` (the default) disables
173
+ autoplay; autoplay pauses on hover unless `pauseOnHover={false}`.
174
+ `loop` (default `true`) wraps at the ends. Slides are equal-width
175
+ children of a translated flex track — give each child its own aspect
176
+ ratio/height. Translations come from the companion
177
+ `@molecule/app-locales-carousel` locale bond.
178
+
179
+ ## Translations
180
+
181
+ Translation strings are provided by `@molecule/app-locales-carousel`.
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Vue carousel: generic image / card carousel with arrows, dots and optional
3
+ * autoplay — the Vue counterpart of `@molecule/app-carousel-react`'s
4
+ * `Carousel`: the same props (React names), the same DOM for the same input,
5
+ * and the same callbacks.
6
+ *
7
+ * @module
8
+ */
9
+ import { type PropType, type VNode } from 'vue';
10
+ import type { CarouselProps } from './types.js';
11
+ /**
12
+ * Generic image / card carousel with arrows + dots + optional autoplay.
13
+ * Controlled-optional: omit `index` to let the component manage its own state.
14
+ *
15
+ * @param props - Component props (see {@link CarouselProps}).
16
+ * @returns The carousel component.
17
+ */
18
+ export declare const Carousel: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
19
+ children: null;
20
+ index: {
21
+ type: PropType<number | undefined>;
22
+ default: undefined;
23
+ };
24
+ onChange: PropType<CarouselProps["onChange"]>;
25
+ showArrows: {
26
+ type: PropType<boolean | undefined>;
27
+ default: undefined;
28
+ };
29
+ showDots: {
30
+ type: PropType<boolean | undefined>;
31
+ default: undefined;
32
+ };
33
+ autoplayMs: {
34
+ type: PropType<number | undefined>;
35
+ default: undefined;
36
+ };
37
+ pauseOnHover: {
38
+ type: PropType<boolean | undefined>;
39
+ default: undefined;
40
+ };
41
+ loop: {
42
+ type: PropType<boolean | undefined>;
43
+ default: undefined;
44
+ };
45
+ className: StringConstructor;
46
+ }>, () => VNode | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
47
+ children: null;
48
+ index: {
49
+ type: PropType<number | undefined>;
50
+ default: undefined;
51
+ };
52
+ onChange: PropType<CarouselProps["onChange"]>;
53
+ showArrows: {
54
+ type: PropType<boolean | undefined>;
55
+ default: undefined;
56
+ };
57
+ showDots: {
58
+ type: PropType<boolean | undefined>;
59
+ default: undefined;
60
+ };
61
+ autoplayMs: {
62
+ type: PropType<number | undefined>;
63
+ default: undefined;
64
+ };
65
+ pauseOnHover: {
66
+ type: PropType<boolean | undefined>;
67
+ default: undefined;
68
+ };
69
+ loop: {
70
+ type: PropType<boolean | undefined>;
71
+ default: undefined;
72
+ };
73
+ className: StringConstructor;
74
+ }>> & Readonly<{}>, {
75
+ index: number | undefined;
76
+ showArrows: boolean | undefined;
77
+ showDots: boolean | undefined;
78
+ autoplayMs: number | undefined;
79
+ pauseOnHover: boolean | undefined;
80
+ loop: boolean | undefined;
81
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
82
+ //# sourceMappingURL=Carousel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Carousel.d.ts","sourceRoot":"","sources":["../src/Carousel.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAIL,KAAK,QAAQ,EAEb,KAAK,KAAK,EAGX,MAAM,KAAK,CAAA;AAMZ,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAuB/C;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ;;;cAKC,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;cAGxB,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;;cAEtC,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;;;;cAI7B,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;;;;cAI9B,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;;cAI3B,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;;;;cAI7B,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;;;;UAgDrC,KAAK,GAAG,IAAI;;;cArEL,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;cAGxB,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;;cAEtC,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;;;;cAI7B,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;;;;cAI9B,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;;cAI3B,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;;;;cAI7B,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;;;;;;;;;;;4EAkLlD,CAAA"}
@@ -0,0 +1,199 @@
1
+ /**
2
+ * Vue carousel: generic image / card carousel with arrows, dots and optional
3
+ * autoplay — the Vue counterpart of `@molecule/app-carousel-react`'s
4
+ * `Carousel`: the same props (React names), the same DOM for the same input,
5
+ * and the same callbacks.
6
+ *
7
+ * @module
8
+ */
9
+ import { computed, defineComponent, h, ref, watchEffect, } from 'vue';
10
+ import { getClassMap } from '@molecule/app-ui';
11
+ import { Button } from '@molecule/app-ui-vue';
12
+ import { useTranslation } from '@molecule/app-vue';
13
+ // Arrow offsets + vertical centering, exactly as React writes them: the
14
+ // ClassMap contract exposes no left/right/top or translate resolver (only
15
+ // `position` + `inset0`), so the edge offsets and the -50% Y translate that
16
+ // centers each arrow are inline — a sanctioned "ClassMap can't express it"
17
+ // case. Left arrow pins to the left edge, right arrow to the right edge; both
18
+ // sit at the vertical middle.
19
+ const arrowLeftStyle = { left: '8px', top: '50%', transform: 'translateY(-50%)' };
20
+ const arrowRightStyle = { right: '8px', top: '50%', transform: 'translateY(-50%)' };
21
+ /**
22
+ * Normalizes the slides to a child list: an array stays as it is, and the values
23
+ * React renders as nothing (`null`, `undefined`, `false`) contribute nothing.
24
+ *
25
+ * @param value - The children, from the default slot or the `children` prop.
26
+ * @returns The slide nodes, in order.
27
+ */
28
+ const childList = (value) => {
29
+ const list = Array.isArray(value) ? value : value == null || value === false ? [] : [value];
30
+ return list.filter((child) => child !== null && child !== undefined && child !== false);
31
+ };
32
+ /**
33
+ * Generic image / card carousel with arrows + dots + optional autoplay.
34
+ * Controlled-optional: omit `index` to let the component manage its own state.
35
+ *
36
+ * @param props - Component props (see {@link CarouselProps}).
37
+ * @returns The carousel component.
38
+ */
39
+ export const Carousel = defineComponent({
40
+ name: 'Carousel',
41
+ props: {
42
+ children: null,
43
+ index: {
44
+ type: Number,
45
+ default: undefined,
46
+ },
47
+ onChange: Function,
48
+ showArrows: {
49
+ type: Boolean,
50
+ default: undefined,
51
+ },
52
+ showDots: {
53
+ type: Boolean,
54
+ default: undefined,
55
+ },
56
+ autoplayMs: {
57
+ type: Number,
58
+ default: undefined,
59
+ },
60
+ pauseOnHover: {
61
+ type: Boolean,
62
+ default: undefined,
63
+ },
64
+ loop: {
65
+ type: Boolean,
66
+ default: undefined,
67
+ },
68
+ className: String,
69
+ },
70
+ setup(props, { slots }) {
71
+ const cm = getClassMap();
72
+ const { t } = useTranslation();
73
+ // React's `useState(0)`: the uncontrolled active index.
74
+ const internal = ref(0);
75
+ // React's `useState(false)`: the pointer-over state autoplay pauses on.
76
+ const hovered = ref(false);
77
+ // React's `children.length`, read during render and used by `setIdx` when a
78
+ // control is clicked.
79
+ const total = ref(0);
80
+ /** React's `const active = index ?? internal`. */
81
+ const active = computed(() => props.index ?? internal.value);
82
+ /**
83
+ * Moves to an index, clamping or wrapping exactly as React's `setIdx` does,
84
+ * then reports the clamped value through `onChange` (also when controlled).
85
+ *
86
+ * @param next - The requested index.
87
+ */
88
+ const setIdx = (next) => {
89
+ const count = total.value;
90
+ const clamp = props.loop ?? true;
91
+ const clamped = clamp ? (next + count) % count : Math.max(0, Math.min(count - 1, next));
92
+ if (props.index === undefined)
93
+ internal.value = clamped;
94
+ props.onChange?.(clamped);
95
+ };
96
+ // React's autoplay effect: an interval that advances by one and restarts on
97
+ // every change of the index, the interval, the hover state or the prop
98
+ // values `setIdx` closes over (React lists `setIdx` itself as a dependency).
99
+ watchEffect((onCleanup) => {
100
+ const autoplayMs = props.autoplayMs ?? 0;
101
+ const pauseOnHover = props.pauseOnHover ?? true;
102
+ const current = active.value;
103
+ // Read the values `setIdx` closes over so a change re-runs the effect.
104
+ void props.index;
105
+ void props.loop;
106
+ void total.value;
107
+ if (!autoplayMs || (pauseOnHover && hovered.value))
108
+ return;
109
+ const id = setInterval(() => setIdx(current + 1), autoplayMs);
110
+ onCleanup(() => clearInterval(id));
111
+ });
112
+ return () => {
113
+ const kids = childList(slots.default?.() ?? props.children);
114
+ total.value = kids.length;
115
+ if (kids.length === 0)
116
+ return null;
117
+ const count = kids.length;
118
+ const current = active.value;
119
+ const showArrows = props.showArrows ?? true;
120
+ const showDots = props.showDots ?? true;
121
+ return h('div', {
122
+ class: cm.cn(cm.position('relative'), props.className),
123
+ onMouseenter: () => {
124
+ hovered.value = true;
125
+ },
126
+ onMouseleave: () => {
127
+ hovered.value = false;
128
+ },
129
+ }, [
130
+ h('div', { style: { overflow: 'hidden' } }, [
131
+ h('div', {
132
+ style: {
133
+ display: 'flex',
134
+ width: `${count * 100}%`,
135
+ transform: `translateX(-${(current / count) * 100}%)`,
136
+ transition: 'transform 250ms ease',
137
+ },
138
+ }, kids.map((child, i) => h('div', {
139
+ key: i,
140
+ 'data-mol-id': 'carousel-slide',
141
+ 'aria-hidden': i !== current ? 'true' : 'false',
142
+ style: { width: `${100 / count}%`, flexShrink: 0 },
143
+ }, [child]))),
144
+ ]),
145
+ ...(showArrows && count > 1
146
+ ? [
147
+ h(Button, {
148
+ variant: 'ghost',
149
+ size: 'sm',
150
+ onClick: () => setIdx(current - 1),
151
+ 'aria-label': t('carousel.previous', {}, { defaultValue: 'Previous' }),
152
+ class: cm.position('absolute'),
153
+ style: arrowLeftStyle,
154
+ }, { default: () => ['‹'] }),
155
+ h(Button, {
156
+ variant: 'ghost',
157
+ size: 'sm',
158
+ onClick: () => setIdx(current + 1),
159
+ 'aria-label': t('carousel.next', {}, { defaultValue: 'Next' }),
160
+ class: cm.position('absolute'),
161
+ style: arrowRightStyle,
162
+ }, { default: () => ['›'] }),
163
+ ]
164
+ : []),
165
+ ...(showDots && count > 1
166
+ ? [
167
+ h('div', {
168
+ class: cm.cn(cm.flex({ align: 'center', justify: 'center', gap: 'xs' }), cm.sp('py', 2)),
169
+ }, kids.map((_, i) => h('button', {
170
+ key: i,
171
+ type: 'button',
172
+ 'data-mol-id': 'carousel-dot',
173
+ 'data-active': i === current ? 'true' : 'false',
174
+ 'aria-label': t('carousel.goToSlide', { index: i + 1 }, { defaultValue: 'Go to slide {{index}}' }),
175
+ 'aria-current': i === current ? 'true' : undefined,
176
+ onClick: () => setIdx(i),
177
+ class: cm.cn(cm.cursorPointer, cm.touchTargetCompact, cm.flex({ align: 'center', justify: 'center' })),
178
+ style: { background: 'transparent', border: 'none', padding: '4px' },
179
+ }, [
180
+ h('span', {
181
+ 'aria-hidden': 'true',
182
+ style: {
183
+ display: 'block',
184
+ width: '8px',
185
+ height: '8px',
186
+ borderRadius: '50%',
187
+ background: i === current
188
+ ? 'var(--mol-color-primary, currentColor)'
189
+ : 'var(--mol-color-border, rgba(128,128,128,0.4))',
190
+ },
191
+ }),
192
+ ]))),
193
+ ]
194
+ : []),
195
+ ]);
196
+ };
197
+ },
198
+ });
199
+ //# sourceMappingURL=Carousel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Carousel.js","sourceRoot":"","sources":["../src/Carousel.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,QAAQ,EACR,eAAe,EACf,CAAC,EAED,GAAG,EAGH,WAAW,GACZ,MAAM,KAAK,CAAA;AAEZ,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAIlD,wEAAwE;AACxE,0EAA0E;AAC1E,4EAA4E;AAC5E,2EAA2E;AAC3E,8EAA8E;AAC9E,8BAA8B;AAC9B,MAAM,cAAc,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAA;AACjF,MAAM,eAAe,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAA;AA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C,IAAI,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAChD;4BACD,KAAK,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE;yBACrE,EACD;4BACE,CAAC,CAAC,MAAM,EAAE;gCACR,aAAa,EAAE,MAAM;gCACrB,KAAK,EAAE;oCACL,OAAO,EAAE,OAAO;oCAChB,KAAK,EAAE,KAAK;oCACZ,MAAM,EAAE,KAAK;oCACb,YAAY,EAAE,KAAK;oCACnB,UAAU,EACR,CAAC,KAAK,OAAO;wCACX,CAAC,CAAC,wCAAwC;wCAC1C,CAAC,CAAC,gDAAgD;iCACvD;6BACF,CAAC;yBACH,CACF,CACF,CACF;qBACF;oBACH,CAAC,CAAC,EAAE,CAAC;aACR,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Vue image / card carousel.
3
+ *
4
+ * Exports `<Carousel>` — arrows + dots + optional autoplay; controlled-optional.
5
+ * It is the Vue counterpart of `@molecule/app-carousel-react`: the same props
6
+ * and the same DOM for the same input.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { createApp, h } from 'vue'
11
+ * import { Carousel } from '@molecule/app-carousel-vue'
12
+ *
13
+ * createApp({
14
+ * render: () =>
15
+ * h(Carousel, { autoplayMs: 4000, showDots: true, showArrows: true }, {
16
+ * default: () => [
17
+ * h('img', { src: '/slides/one.jpg', alt: 'Slide 1' }),
18
+ * h('img', { src: '/slides/two.jpg', alt: 'Slide 2' }),
19
+ * h('img', { src: '/slides/three.jpg', alt: 'Slide 3' }),
20
+ * ],
21
+ * }),
22
+ * }).mount('#app')
23
+ * ```
24
+ *
25
+ * @remarks
26
+ * Controlled-optional: omit `index` for internal state; pass `index` +
27
+ * `onChange` to own it. `autoplayMs={0}` (the default) disables
28
+ * autoplay; autoplay pauses on hover unless `pauseOnHover={false}`.
29
+ * `loop` (default `true`) wraps at the ends. Slides are equal-width
30
+ * children of a translated flex track — give each child its own aspect
31
+ * ratio/height. Translations come from the companion
32
+ * `@molecule/app-locales-carousel` locale bond.
33
+ *
34
+ * @module
35
+ */
36
+ export * from './Carousel.js';
37
+ export * from './types.js';
38
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Vue image / card carousel.
3
+ *
4
+ * Exports `<Carousel>` — arrows + dots + optional autoplay; controlled-optional.
5
+ * It is the Vue counterpart of `@molecule/app-carousel-react`: the same props
6
+ * and the same DOM for the same input.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { createApp, h } from 'vue'
11
+ * import { Carousel } from '@molecule/app-carousel-vue'
12
+ *
13
+ * createApp({
14
+ * render: () =>
15
+ * h(Carousel, { autoplayMs: 4000, showDots: true, showArrows: true }, {
16
+ * default: () => [
17
+ * h('img', { src: '/slides/one.jpg', alt: 'Slide 1' }),
18
+ * h('img', { src: '/slides/two.jpg', alt: 'Slide 2' }),
19
+ * h('img', { src: '/slides/three.jpg', alt: 'Slide 3' }),
20
+ * ],
21
+ * }),
22
+ * }).mount('#app')
23
+ * ```
24
+ *
25
+ * @remarks
26
+ * Controlled-optional: omit `index` for internal state; pass `index` +
27
+ * `onChange` to own it. `autoplayMs={0}` (the default) disables
28
+ * autoplay; autoplay pauses on hover unless `pauseOnHover={false}`.
29
+ * `loop` (default `true`) wraps at the ends. Slides are equal-width
30
+ * children of a translated flex track — give each child its own aspect
31
+ * ratio/height. Translations come from the companion
32
+ * `@molecule/app-locales-carousel` locale bond.
33
+ *
34
+ * @module
35
+ */
36
+ export * from './Carousel.js';
37
+ export * from './types.js';
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Types for the Vue carousel: the same props `@molecule/app-carousel-react`'s
3
+ * `Carousel` accepts (React names), with node values typed as Vue's.
4
+ *
5
+ * @module
6
+ */
7
+ import type { VNodeChild } from 'vue';
8
+ /** Props accepted by the {@link Carousel} component. */
9
+ export interface CarouselProps {
10
+ /**
11
+ * Slides — each child is one frame. Passed as the default slot (or the
12
+ * `children` prop); both spellings work.
13
+ */
14
+ children?: VNodeChild;
15
+ /** Controlled active index — caller owns state. */
16
+ index?: number;
17
+ /** Called when the active index changes. */
18
+ onChange?: (index: number) => void;
19
+ /** Show prev/next arrows. Defaults to true. */
20
+ showArrows?: boolean;
21
+ /** Show dot indicator strip. Defaults to true. */
22
+ showDots?: boolean;
23
+ /** Auto-advance interval in ms (set 0 to disable). */
24
+ autoplayMs?: number;
25
+ /** Pause autoplay on mouseover. Defaults to true. */
26
+ pauseOnHover?: boolean;
27
+ /** Loop back to start at end. Defaults to true. */
28
+ loop?: boolean;
29
+ /** Extra classes. */
30
+ className?: string;
31
+ }
32
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAErC,wDAAwD;AACxD,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,UAAU,CAAA;IACrB,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,+CAA+C;IAC/C,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,qDAAqD;IACrD,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,mDAAmD;IACnD,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Types for the Vue carousel: the same props `@molecule/app-carousel-react`'s
3
+ * `Carousel` accepts (React names), with node values typed as Vue's.
4
+ *
5
+ * @module
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
package/package.json CHANGED
@@ -1,6 +1,65 @@
1
1
  {
2
2
  "name": "@molecule/app-carousel-vue",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.1.0",
4
+ "description": "Image / card carousel with arrows, dots, autoplay, controlled-optional index",
5
+ "homepage": "https://www.molecule.dev/packages/app-carousel-vue",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "dev": "vue-tsc --watch",
22
+ "test": "vitest run",
23
+ "test:watch": "vitest"
24
+ },
25
+ "keywords": [
26
+ "molecule",
27
+ "carousel",
28
+ "vue"
29
+ ],
30
+ "author": "Molecule Dev, Inc. (https://molecule.dev)",
31
+ "license": "Apache-2.0",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/molecule-dev/molecule.git",
35
+ "directory": "packages/app/features/carousel-vue"
36
+ },
37
+ "engines": {
38
+ "node": ">=20"
39
+ },
40
+ "bugs": "https://github.com/molecule-dev/molecule/issues",
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "peerDependencies": {
45
+ "@molecule/app-ui": "^1.3.11",
46
+ "@molecule/app-ui-vue": "^1.1.0",
47
+ "@molecule/app-vue": "^3.5.0",
48
+ "vue": "^3.4.0"
49
+ },
50
+ "devDependencies": {
51
+ "@molecule/app-framework-conformance": "0.0.0",
52
+ "@molecule/app-i18n": "1.2.2",
53
+ "@molecule/app-icons": "1.0.4",
54
+ "@molecule/app-ui": "1.4.0",
55
+ "@molecule/app-ui-vue": "1.1.5",
56
+ "@molecule/app-vue": "3.7.2",
57
+ "@types/node": "26.6.5",
58
+ "jsdom": "30.1.3",
59
+ "typescript": "6.0.3",
60
+ "vite": "8.3.5",
61
+ "vitest": "4.1.12",
62
+ "vue": "3.5.44",
63
+ "vue-tsc": "3.3.13"
64
+ }
65
+ }