@wow-two-beta/fe 0.0.50 → 0.0.51
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/index.js +392 -383
- package/dist/index.js.map +1 -1
- package/dist/presentation/actions/button/Button.variants.d.ts +12 -0
- package/dist/presentation/actions/button/Button.variants.js +18 -2
- package/dist/presentation/actions/button/Button.variants.js.map +1 -1
- package/dist/presentation/actions/button/Button.vue.d.ts +8 -1
- package/dist/presentation/actions/button/Button.vue.js +106 -58
- package/dist/presentation/actions/button/Button.vue.js.map +1 -1
- package/dist/presentation/actions/refreshButton/RefreshButton.vue.js.map +1 -1
- package/dist/presentation/display/badge/Badge.variants.d.ts +23 -1
- package/dist/presentation/display/badge/Badge.variants.js +18 -3
- package/dist/presentation/display/badge/Badge.variants.js.map +1 -1
- package/dist/presentation/display/badge/Badge.vue.d.ts +3 -0
- package/dist/presentation/display/badge/Badge.vue.js +10 -4
- package/dist/presentation/display/badge/Badge.vue.js.map +1 -1
- package/dist/presentation/display/carousel/Carousel.variants.d.ts +65 -0
- package/dist/presentation/display/carousel/Carousel.variants.js +56 -0
- package/dist/presentation/display/carousel/Carousel.variants.js.map +1 -0
- package/dist/presentation/display/carousel/Carousel.vue.d.ts +7 -0
- package/dist/presentation/display/carousel/Carousel.vue.js +7 -2
- package/dist/presentation/display/carousel/Carousel.vue.js.map +1 -1
- package/dist/presentation/display/carousel/CarouselContext.d.ts +10 -0
- package/dist/presentation/display/carousel/CarouselContext.js.map +1 -1
- package/dist/presentation/display/carousel/CarouselNext.vue.d.ts +6 -2
- package/dist/presentation/display/carousel/CarouselNext.vue.js +12 -4
- package/dist/presentation/display/carousel/CarouselNext.vue.js.map +1 -1
- package/dist/presentation/display/carousel/CarouselPrev.vue.d.ts +6 -2
- package/dist/presentation/display/carousel/CarouselPrev.vue.js +12 -4
- package/dist/presentation/display/carousel/CarouselPrev.vue.js.map +1 -1
- package/dist/presentation/display/carousel/CarouselViewport.vue.d.ts +13 -2
- package/dist/presentation/display/carousel/CarouselViewport.vue.js +54 -2
- package/dist/presentation/display/carousel/CarouselViewport.vue.js.map +1 -1
- package/dist/presentation/display/carousel/index.d.ts +1 -0
- package/dist/presentation/display/index.d.ts +1 -0
- package/dist/presentation/display/index.js +120 -111
- package/dist/presentation/display/index.js.map +1 -1
- package/dist/presentation/display/mediaCard/MediaCard.vue.d.ts +41 -0
- package/dist/presentation/display/mediaCard/MediaCard.vue.js +108 -0
- package/dist/presentation/display/mediaCard/MediaCard.vue.js.map +1 -0
- package/dist/presentation/display/mediaCard/MediaCard2.vue.js +5 -0
- package/dist/presentation/display/mediaCard/MediaCard2.vue.js.map +1 -0
- package/dist/presentation/display/mediaCard/index.d.ts +1 -0
- package/dist/presentation/display/metaInlineText/MetaInlineItem.vue.d.ts +37 -0
- package/dist/presentation/display/metaInlineText/MetaInlineItem.vue.js +72 -0
- package/dist/presentation/display/metaInlineText/MetaInlineItem.vue.js.map +1 -0
- package/dist/presentation/display/metaInlineText/MetaInlineItem2.vue.js +7 -0
- package/dist/presentation/display/metaInlineText/MetaInlineItem2.vue.js.map +1 -0
- package/dist/presentation/display/metaInlineText/index.d.ts +1 -0
- package/dist/presentation/layout/navbar/Navbar.vue.js.map +1 -1
- package/dist/presentation/nav/accountMenu/AccountMenu.vue.d.ts +1 -1
- package/dist/presentation/overlays/hoverCard/HoverCard.vue.d.ts +1 -1
- package/dist/presentation/overlays/tooltip/Tooltip.vue.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CarouselControls } from './Carousel.variants';
|
|
1
2
|
export interface CarouselProps {
|
|
2
3
|
/** The controlled active slide index. */
|
|
3
4
|
readonly index?: number;
|
|
@@ -13,6 +14,11 @@ export interface CarouselProps {
|
|
|
13
14
|
readonly resumeLabel?: string;
|
|
14
15
|
/** The explicit slide count — overrides the automatic count (use for virtualised slides). */
|
|
15
16
|
readonly slidesCount?: number;
|
|
17
|
+
/**
|
|
18
|
+
* When `CarouselPrev` / `CarouselNext` show — `hover` reveals them while the carousel is hovered or holds focus, and
|
|
19
|
+
* always on a device that cannot hover. Default `always`.
|
|
20
|
+
*/
|
|
21
|
+
readonly controls?: CarouselControls;
|
|
16
22
|
}
|
|
17
23
|
declare const _default: __VLS_WithSlots<import('vue').DefineComponent<CarouselProps, {
|
|
18
24
|
el: Readonly<import('vue').ShallowRef<HTMLDivElement | null>>;
|
|
@@ -23,6 +29,7 @@ declare const _default: __VLS_WithSlots<import('vue').DefineComponent<CarouselPr
|
|
|
23
29
|
}>, {
|
|
24
30
|
readonly index: number;
|
|
25
31
|
readonly canLoop: boolean;
|
|
32
|
+
readonly controls: CarouselControls;
|
|
26
33
|
readonly defaultIndex: number;
|
|
27
34
|
readonly autoPlay: number;
|
|
28
35
|
readonly slidesCount: number;
|
|
@@ -4,6 +4,7 @@ import { cn } from "../../../foundation/styles/Cn.js";
|
|
|
4
4
|
import { useControlled } from "../../../foundation/state/hooks/UseControlled.js";
|
|
5
5
|
import { useReducedMotion } from "../../../foundation/device/hooks/UseReducedMotion.js";
|
|
6
6
|
import { CarouselKey } from "./CarouselContext.js";
|
|
7
|
+
import { CarouselControls } from "./Carousel.variants.js";
|
|
7
8
|
const _hoisted_1 = ["aria-pressed"];
|
|
8
9
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
9
10
|
...{ name: "Carousel", inheritAttrs: false },
|
|
@@ -15,7 +16,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
15
16
|
autoPlay: { default: void 0 },
|
|
16
17
|
pauseLabel: {},
|
|
17
18
|
resumeLabel: {},
|
|
18
|
-
slidesCount: { default: void 0 }
|
|
19
|
+
slidesCount: { default: void 0 },
|
|
20
|
+
controls: { default: CarouselControls.Always }
|
|
19
21
|
},
|
|
20
22
|
emits: ["update:index"],
|
|
21
23
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -99,9 +101,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
99
101
|
setPaused,
|
|
100
102
|
get autoPlay() {
|
|
101
103
|
return props.autoPlay;
|
|
104
|
+
},
|
|
105
|
+
get controls() {
|
|
106
|
+
return props.controls;
|
|
102
107
|
}
|
|
103
108
|
});
|
|
104
|
-
const classes = computed(() => cn("relative", attrs.class));
|
|
109
|
+
const classes = computed(() => cn("group/carousel relative", attrs.class));
|
|
105
110
|
const rest = computed(() => {
|
|
106
111
|
const { class: _class, ...others } = attrs;
|
|
107
112
|
return others;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Carousel.vue.js","sources":["../../../../src/presentation/display/carousel/Carousel.vue"],"sourcesContent":["<script lang=\"ts\">\nexport interface CarouselProps {\n /** The controlled active slide index. */\n readonly index?: number;\n /** The uncontrolled initial slide index. Default `0`. */\n readonly defaultIndex?: number;\n /** The wrap-around state. Default `false`. */\n readonly canLoop?: boolean;\n /** The auto-advance interval in ms. Omit to disable. */\n readonly autoPlay?: number;\n /** The localized pause action label. */\n readonly pauseLabel?: string;\n /** The localized resume action label. */\n readonly resumeLabel?: string;\n /** The explicit slide count — overrides the automatic count (use for virtualised slides). */\n readonly slidesCount?: number;\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { useLocaleDefaults } from '../../../foundation/i18n';\nimport { computed, onMounted, provide, ref, useAttrs, useTemplateRef, watch, watchEffect } from 'vue';\nimport { cn } from '../../../foundation/styles';\nimport { useControlled } from '../../../foundation/state';\nimport { useReducedMotion } from '../../../foundation/device';\nimport { CarouselKey, type CarouselContextValue } from './CarouselContext';\n\n/**\n * Renders the carousel root that owns the index, the slide count, and the auto-play pause flag.\n *\n * The parts read them through injection — `CarouselViewport` / `CarouselSlides` / `CarouselPrev` / `CarouselNext` /\n * `CarouselDots` / `CarouselDot` — because an SFC's default export cannot carry React's statics.\n */\ndefineOptions({ name: 'Carousel', inheritAttrs: false });\n\n/** The viewport, nav buttons and dots — React's required `children`. */\ndefineSlots<{ default(): unknown }>();\n\nconst componentProps = withDefaults(defineProps<CarouselProps>(), {\n index: undefined,\n defaultIndex: 0,\n canLoop: false,\n autoPlay: undefined,\n slidesCount: undefined,\n});\nconst props = useLocaleDefaults(componentProps, 'Carousel', {\n pauseLabel: 'Pause slides',\n resumeLabel: 'Resume slides',\n});\n\nconst emit = defineEmits<{\n /** Fires when the reader moves to a different slide, with the new index. */\n 'update:index': [index: number];\n}>();\n\nconst attrs = useAttrs();\nconst el = useTemplateRef<HTMLDivElement>('el');\n\nconst { value: activeIndex, setValue: setIndexState } = useControlled<number>({\n controlled: () => props.index,\n default: props.defaultIndex,\n onChange: (next) => emit('update:index', next),\n});\n\nconst count = ref(props.slidesCount ?? 0);\nconst paused = ref(false);\nconst pointerPaused = ref(false);\nconst focusPaused = ref(false);\nconst mounted = ref(false);\nconst reducedMotion = useReducedMotion();\nonMounted(() => {\n mounted.value = true;\n});\n\n// External override.\nwatch(\n () => props.slidesCount,\n (value) => {\n if (value != null) count.value = value;\n },\n);\n\nfunction setCount(next: number): void {\n count.value = next;\n}\n\nfunction setIndex(target: number): void {\n if (count.value === 0) {\n setIndexState(0);\n return;\n }\n const next = props.canLoop\n ? ((target % count.value) + count.value) % count.value\n : Math.max(0, Math.min(count.value - 1, target));\n setIndexState(next);\n}\n\nfunction prev(): void {\n setIndex(activeIndex.value - 1);\n}\n\nfunction next(): void {\n setIndex(activeIndex.value + 1);\n}\n\nfunction setPaused(value: boolean): void {\n paused.value = value;\n}\n\n// Auto-play. `watchEffect` rather than `watch` so the tracked set matches React's\n// dependency array exactly — every value below is read up front, which is what\n// makes the interval restart on an index change the way React's effect did.\nwatchEffect((onCleanup) => {\n const interval = props.autoPlay;\n const loop = props.canLoop;\n const total = count.value;\n const current = activeIndex.value;\n if (\n !mounted.value ||\n !interval ||\n interval <= 0 ||\n paused.value ||\n pointerPaused.value ||\n focusPaused.value ||\n reducedMotion.value ||\n total === 0\n )\n return;\n const handle = window.setInterval(() => {\n setIndex(loop ? current + 1 : Math.min(total - 1, current + 1));\n }, interval);\n onCleanup(() => window.clearInterval(handle));\n});\n\n/* Live getters, not a snapshot — index, count and pause state have to reach\n every already-mounted child. */\nprovide<CarouselContextValue>(CarouselKey, {\n get index() {\n return activeIndex.value;\n },\n setIndex,\n get count() {\n return count.value;\n },\n setCount,\n get loop() {\n return props.canLoop;\n },\n prev,\n next,\n get paused() {\n return paused.value || pointerPaused.value || focusPaused.value;\n },\n setPaused,\n get autoPlay() {\n return props.autoPlay;\n },\n});\n\nconst classes = computed(() => cn('relative', attrs.class as string | undefined));\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\ndefineExpose({ el });\n</script>\n\n<template>\n <!-- `focusin` / `focusout`, not `focus` / `blur`: React's `onFocus` / `onBlur`\n on a container bubble from descendants, and the native pair does not. -->\n <div\n ref=\"el\"\n v-bind=\"rest\"\n :class=\"classes\"\n @mouseenter=\"pointerPaused = true\"\n @mouseleave=\"pointerPaused = false\"\n @focusin=\"focusPaused = true\"\n @focusout=\"focusPaused = el?.contains($event.relatedTarget as Node) ?? false\"\n >\n <button\n v-if=\"props.autoPlay && !reducedMotion\"\n type=\"button\"\n :aria-pressed=\"paused\"\n class=\"mb-2 rounded border px-2 py-1 text-sm\"\n @click=\"setPaused(!paused)\"\n >\n {{ paused ? props.resumeLabel : props.pauseLabel }}\n </button>\n <slot />\n </div>\n</template>\n"],"names":["next","_openBlock","_createElementBlock","_mergeProps","_unref","_toDisplayString","_renderSlot"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Carousel.vue.js","sources":["../../../../src/presentation/display/carousel/Carousel.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { CarouselControls } from './Carousel.variants';\n\nexport interface CarouselProps {\n /** The controlled active slide index. */\n readonly index?: number;\n /** The uncontrolled initial slide index. Default `0`. */\n readonly defaultIndex?: number;\n /** The wrap-around state. Default `false`. */\n readonly canLoop?: boolean;\n /** The auto-advance interval in ms. Omit to disable. */\n readonly autoPlay?: number;\n /** The localized pause action label. */\n readonly pauseLabel?: string;\n /** The localized resume action label. */\n readonly resumeLabel?: string;\n /** The explicit slide count — overrides the automatic count (use for virtualised slides). */\n readonly slidesCount?: number;\n /**\n * When `CarouselPrev` / `CarouselNext` show — `hover` reveals them while the carousel is hovered or holds focus, and\n * always on a device that cannot hover. Default `always`.\n */\n readonly controls?: CarouselControls;\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { useLocaleDefaults } from '../../../foundation/i18n';\nimport { computed, onMounted, provide, ref, useAttrs, useTemplateRef, watch, watchEffect } from 'vue';\nimport { cn } from '../../../foundation/styles';\nimport { useControlled } from '../../../foundation/state';\nimport { useReducedMotion } from '../../../foundation/device';\nimport { CarouselKey, type CarouselContextValue } from './CarouselContext';\n\n/**\n * Renders the carousel root that owns the index, the slide count, and the auto-play pause flag.\n *\n * The parts read them through injection — `CarouselViewport` / `CarouselSlides` / `CarouselPrev` / `CarouselNext` /\n * `CarouselDots` / `CarouselDot` — because an SFC's default export cannot carry React's statics.\n */\ndefineOptions({ name: 'Carousel', inheritAttrs: false });\n\n/** The viewport, nav buttons and dots — React's required `children`. */\ndefineSlots<{ default(): unknown }>();\n\nconst componentProps = withDefaults(defineProps<CarouselProps>(), {\n index: undefined,\n defaultIndex: 0,\n canLoop: false,\n autoPlay: undefined,\n slidesCount: undefined,\n controls: CarouselControls.Always,\n});\nconst props = useLocaleDefaults(componentProps, 'Carousel', {\n pauseLabel: 'Pause slides',\n resumeLabel: 'Resume slides',\n});\n\nconst emit = defineEmits<{\n /** Fires when the reader moves to a different slide, with the new index. */\n 'update:index': [index: number];\n}>();\n\nconst attrs = useAttrs();\nconst el = useTemplateRef<HTMLDivElement>('el');\n\nconst { value: activeIndex, setValue: setIndexState } = useControlled<number>({\n controlled: () => props.index,\n default: props.defaultIndex,\n onChange: (next) => emit('update:index', next),\n});\n\nconst count = ref(props.slidesCount ?? 0);\nconst paused = ref(false);\nconst pointerPaused = ref(false);\nconst focusPaused = ref(false);\nconst mounted = ref(false);\nconst reducedMotion = useReducedMotion();\nonMounted(() => {\n mounted.value = true;\n});\n\n// External override.\nwatch(\n () => props.slidesCount,\n (value) => {\n if (value != null) count.value = value;\n },\n);\n\nfunction setCount(next: number): void {\n count.value = next;\n}\n\nfunction setIndex(target: number): void {\n if (count.value === 0) {\n setIndexState(0);\n return;\n }\n const next = props.canLoop\n ? ((target % count.value) + count.value) % count.value\n : Math.max(0, Math.min(count.value - 1, target));\n setIndexState(next);\n}\n\nfunction prev(): void {\n setIndex(activeIndex.value - 1);\n}\n\nfunction next(): void {\n setIndex(activeIndex.value + 1);\n}\n\nfunction setPaused(value: boolean): void {\n paused.value = value;\n}\n\n// Auto-play. `watchEffect` rather than `watch` so the tracked set matches React's\n// dependency array exactly — every value below is read up front, which is what\n// makes the interval restart on an index change the way React's effect did.\nwatchEffect((onCleanup) => {\n const interval = props.autoPlay;\n const loop = props.canLoop;\n const total = count.value;\n const current = activeIndex.value;\n if (\n !mounted.value ||\n !interval ||\n interval <= 0 ||\n paused.value ||\n pointerPaused.value ||\n focusPaused.value ||\n reducedMotion.value ||\n total === 0\n )\n return;\n const handle = window.setInterval(() => {\n setIndex(loop ? current + 1 : Math.min(total - 1, current + 1));\n }, interval);\n onCleanup(() => window.clearInterval(handle));\n});\n\n/* Live getters, not a snapshot — index, count and pause state have to reach\n every already-mounted child. */\nprovide<CarouselContextValue>(CarouselKey, {\n get index() {\n return activeIndex.value;\n },\n setIndex,\n get count() {\n return count.value;\n },\n setCount,\n get loop() {\n return props.canLoop;\n },\n prev,\n next,\n get paused() {\n return paused.value || pointerPaused.value || focusPaused.value;\n },\n setPaused,\n get autoPlay() {\n return props.autoPlay;\n },\n get controls() {\n return props.controls;\n },\n});\n\n/* `group/carousel` is what a hover-revealed arrow listens to — named, so a consumer's own `group` stays theirs. */\nconst classes = computed(() => cn('group/carousel relative', attrs.class as string | undefined));\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\ndefineExpose({ el });\n</script>\n\n<template>\n <!-- `focusin` / `focusout`, not `focus` / `blur`: React's `onFocus` / `onBlur`\n on a container bubble from descendants, and the native pair does not. -->\n <div\n ref=\"el\"\n v-bind=\"rest\"\n :class=\"classes\"\n @mouseenter=\"pointerPaused = true\"\n @mouseleave=\"pointerPaused = false\"\n @focusin=\"focusPaused = true\"\n @focusout=\"focusPaused = el?.contains($event.relatedTarget as Node) ?? false\"\n >\n <button\n v-if=\"props.autoPlay && !reducedMotion\"\n type=\"button\"\n :aria-pressed=\"paused\"\n class=\"mb-2 rounded border px-2 py-1 text-sm\"\n @click=\"setPaused(!paused)\"\n >\n {{ paused ? props.resumeLabel : props.pauseLabel }}\n </button>\n <slot />\n </div>\n</template>\n"],"names":["next","_openBlock","_createElementBlock","_mergeProps","_unref","_toDisplayString","_renderSlot"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA6CA,UAAM,iBAAiB;AAQvB,UAAM,QAAQ,kBAAkB,gBAAgB,YAAY;AAAA,MAC1D,YAAY;AAAA,MACZ,aAAa;AAAA,IAAA,CACd;AAED,UAAM,OAAO;AAKb,UAAM,QAAQ,SAAA;AACd,UAAM,KAAK,eAA+B,IAAI;AAE9C,UAAM,EAAE,OAAO,aAAa,UAAU,cAAA,IAAkB,cAAsB;AAAA,MAC5E,YAAY,MAAM,MAAM;AAAA,MACxB,SAAS,MAAM;AAAA,MACf,UAAU,CAACA,UAAS,KAAK,gBAAgBA,KAAI;AAAA,IAAA,CAC9C;AAED,UAAM,QAAQ,IAAI,MAAM,eAAe,CAAC;AACxC,UAAM,SAAS,IAAI,KAAK;AACxB,UAAM,gBAAgB,IAAI,KAAK;AAC/B,UAAM,cAAc,IAAI,KAAK;AAC7B,UAAM,UAAU,IAAI,KAAK;AACzB,UAAM,gBAAgB,iBAAA;AACtB,cAAU,MAAM;AACd,cAAQ,QAAQ;AAAA,IAClB,CAAC;AAGD;A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NavVariant } from './Carousel.variants';
|
|
2
3
|
/**
|
|
3
4
|
* The seam between `Carousel` and its `Viewport` / `Slides` / `Prev` / `Next` /
|
|
4
5
|
* `Dots` / `Dot` children.
|
|
@@ -31,8 +32,17 @@ export interface CarouselContextValue {
|
|
|
31
32
|
setPaused: (paused: boolean) => void;
|
|
32
33
|
/** The auto-play interval in ms, when enabled. */
|
|
33
34
|
readonly autoPlay: number | undefined;
|
|
35
|
+
/** When the arrows show — always, or on hover and focus. */
|
|
36
|
+
readonly controls: CarouselControls;
|
|
34
37
|
}
|
|
35
38
|
export declare const CarouselKey: InjectionKey<CarouselContextValue>;
|
|
36
39
|
export declare function useCarouselContext(): CarouselContextValue;
|
|
40
|
+
/**
|
|
41
|
+
* The props `CarouselPrev` and `CarouselNext` share, so it lives here rather than in either SFC. `aria-label` stays a
|
|
42
|
+
* FALLTHROUGH attr — declaring a hyphenated prop name would have Vue camelize it to `ariaLabel`, and the localized
|
|
43
|
+
* default would never apply.
|
|
44
|
+
*/
|
|
37
45
|
export interface CarouselNavButtonProps {
|
|
46
|
+
/** The arrow's surface — `glass` reads over a photo. Default `surface`. */
|
|
47
|
+
readonly variant?: CarouselNavVariant;
|
|
38
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CarouselContext.js","sources":["../../../../src/presentation/display/carousel/CarouselContext.ts"],"sourcesContent":["import { inject, type InjectionKey } from 'vue';\n\n/**\n * The seam between `Carousel` and its `Viewport` / `Slides` / `Prev` / `Next` /\n * `Dots` / `Dot` children.\n *\n * React attached those as `Carousel.Viewport` / `.Slides` / … statics over a\n * `createContext`. An SFC's generated default export cannot carry statics\n * cleanly, so they ship as sibling components and share state through\n * provide/inject instead.\n *\n * Every non-function field is a live getter — read it, don't destructure.\n */\nexport interface CarouselContextValue {\n /** The active slide index. */\n readonly index: number;\n /** Moves to a slide, clamped or wrapped per `loop`. */\n setIndex: (index: number) => void;\n /** The slide count. */\n readonly count: number;\n /** Publishes the slide count — `CarouselSlides` owns this. */\n setCount: (count: number) => void;\n /** The wrap-around state. */\n readonly loop: boolean;\n /** Moves one slide back. */\n prev: () => void;\n /** Moves one slide forward. */\n next: () => void;\n /** The auto-play pause state — hover / focus sets it. */\n readonly paused: boolean;\n /** Sets the pause state. */\n setPaused: (paused: boolean) => void;\n /** The auto-play interval in ms, when enabled. */\n readonly autoPlay: number | undefined;\n}\n\nexport const CarouselKey: InjectionKey<CarouselContextValue> = Symbol('wow-two.carousel');\n\nexport function useCarouselContext(): CarouselContextValue {\n const context = inject(CarouselKey, null);\n if (!context) throw new Error('Carousel.* must be used inside <Carousel>');\n return context;\n}\n\n
|
|
1
|
+
{"version":3,"file":"CarouselContext.js","sources":["../../../../src/presentation/display/carousel/CarouselContext.ts"],"sourcesContent":["import { inject, type InjectionKey } from 'vue';\nimport type { CarouselControls, CarouselNavVariant } from './Carousel.variants';\n\n/**\n * The seam between `Carousel` and its `Viewport` / `Slides` / `Prev` / `Next` /\n * `Dots` / `Dot` children.\n *\n * React attached those as `Carousel.Viewport` / `.Slides` / … statics over a\n * `createContext`. An SFC's generated default export cannot carry statics\n * cleanly, so they ship as sibling components and share state through\n * provide/inject instead.\n *\n * Every non-function field is a live getter — read it, don't destructure.\n */\nexport interface CarouselContextValue {\n /** The active slide index. */\n readonly index: number;\n /** Moves to a slide, clamped or wrapped per `loop`. */\n setIndex: (index: number) => void;\n /** The slide count. */\n readonly count: number;\n /** Publishes the slide count — `CarouselSlides` owns this. */\n setCount: (count: number) => void;\n /** The wrap-around state. */\n readonly loop: boolean;\n /** Moves one slide back. */\n prev: () => void;\n /** Moves one slide forward. */\n next: () => void;\n /** The auto-play pause state — hover / focus sets it. */\n readonly paused: boolean;\n /** Sets the pause state. */\n setPaused: (paused: boolean) => void;\n /** The auto-play interval in ms, when enabled. */\n readonly autoPlay: number | undefined;\n /** When the arrows show — always, or on hover and focus. */\n readonly controls: CarouselControls;\n}\n\nexport const CarouselKey: InjectionKey<CarouselContextValue> = Symbol('wow-two.carousel');\n\nexport function useCarouselContext(): CarouselContextValue {\n const context = inject(CarouselKey, null);\n if (!context) throw new Error('Carousel.* must be used inside <Carousel>');\n return context;\n}\n\n/**\n * The props `CarouselPrev` and `CarouselNext` share, so it lives here rather than in either SFC. `aria-label` stays a\n * FALLTHROUGH attr — declaring a hyphenated prop name would have Vue camelize it to `ariaLabel`, and the localized\n * default would never apply.\n */\nexport interface CarouselNavButtonProps {\n /** The arrow's surface — `glass` reads over a photo. Default `surface`. */\n readonly variant?: CarouselNavVariant;\n}\n"],"names":[],"mappings":";AAuCO,MAAM,cAAkD,OAAO,kBAAkB;AAEjF,SAAS,qBAA2C;AACzD,QAAM,UAAU,OAAO,aAAa,IAAI;AACxC,MAAI,CAAC,QAAS,OAAM,IAAI,MAAM,2CAA2C;AACzE,SAAO;AACT;"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { CarouselNavButtonProps } from './CarouselContext';
|
|
2
|
+
import { CarouselNavVariant } from './Carousel.variants';
|
|
3
|
+
declare const _default: __VLS_WithSlots<import('vue').DefineComponent<CarouselNavButtonProps, {
|
|
2
4
|
el: Readonly<import('vue').ShallowRef<HTMLButtonElement | null>>;
|
|
3
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<
|
|
5
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<CarouselNavButtonProps> & Readonly<{}>, {
|
|
6
|
+
readonly variant: CarouselNavVariant;
|
|
7
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
|
|
4
8
|
default(): unknown;
|
|
5
9
|
}>;
|
|
6
10
|
export default _default;
|
|
@@ -3,24 +3,31 @@ import { useLocale } from "../../../foundation/i18n/providers/LocaleContext.js";
|
|
|
3
3
|
import { ChevronRight } from "lucide-vue-next";
|
|
4
4
|
import { cn } from "../../../foundation/styles/Cn.js";
|
|
5
5
|
import { useCarouselContext } from "./CarouselContext.js";
|
|
6
|
+
import { CarouselNavVariant, carouselNavVariants } from "./Carousel.variants.js";
|
|
6
7
|
import _sfc_main$1 from "../../../foundation/icons/icon/Icon.vue.js";
|
|
7
|
-
const _hoisted_1 = ["aria-label", "disabled"];
|
|
8
|
+
const _hoisted_1 = ["aria-label", "disabled", "inert"];
|
|
8
9
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
9
10
|
...{ name: "CarouselNext", inheritAttrs: false },
|
|
10
11
|
__name: "CarouselNext",
|
|
12
|
+
props: {
|
|
13
|
+
variant: { default: CarouselNavVariant.Surface }
|
|
14
|
+
},
|
|
11
15
|
setup(__props, { expose: __expose }) {
|
|
12
16
|
const locale = useLocale();
|
|
17
|
+
const props = __props;
|
|
13
18
|
const attrs = useAttrs();
|
|
14
19
|
const el = useTemplateRef("el");
|
|
15
20
|
const carousel = useCarouselContext();
|
|
16
|
-
const
|
|
21
|
+
const isSingle = computed(() => carousel.count <= 1);
|
|
22
|
+
const isDisabled = computed(() => isSingle.value || !carousel.loop && carousel.index === carousel.count - 1);
|
|
17
23
|
function onClick(event) {
|
|
18
24
|
if (event.defaultPrevented) return;
|
|
19
25
|
carousel.next();
|
|
20
26
|
}
|
|
21
27
|
const classes = computed(
|
|
22
28
|
() => cn(
|
|
23
|
-
|
|
29
|
+
carouselNavVariants({ variant: props.variant, controls: carousel.controls, isDisabled: isDisabled.value }),
|
|
30
|
+
"right-2",
|
|
24
31
|
attrs.class
|
|
25
32
|
)
|
|
26
33
|
);
|
|
@@ -35,7 +42,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
35
42
|
ref: el,
|
|
36
43
|
type: "button",
|
|
37
44
|
"aria-label": unref(locale).t("CarouselNext.nextSlide", void 0, "Next slide"),
|
|
38
|
-
disabled: isDisabled.value
|
|
45
|
+
disabled: isDisabled.value,
|
|
46
|
+
inert: isSingle.value || void 0
|
|
39
47
|
}, rest.value, {
|
|
40
48
|
class: classes.value,
|
|
41
49
|
onClick
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CarouselNext.vue.js","sources":["../../../../src/presentation/display/carousel/CarouselNext.vue"],"sourcesContent":["<script lang=\"ts\">\
|
|
1
|
+
{"version":3,"file":"CarouselNext.vue.js","sources":["../../../../src/presentation/display/carousel/CarouselNext.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { CarouselNavVariant } from './Carousel.variants';\n/* `aria-label` and `type` stay FALLTHROUGH attrs; the props are the shared `CarouselNavButtonProps` in\n `CarouselContext.ts`. The block is load-bearing besides: in a `<script setup>`-only SFC, `vue-eslint-parser` loses\n `ignoreRestSiblings` and the `const { class: _class, ...others }` omission below trips `no-unused-vars`. */\n</script>\n\n<script setup lang=\"ts\">\nimport { useLocale } from '../../../foundation/i18n';\nimport { computed, useAttrs, useTemplateRef } from 'vue';\nimport { ChevronRight } from 'lucide-vue-next';\nimport { cn } from '../../../foundation/styles';\nimport { Icon } from '../../../foundation/icons';\nimport { useCarouselContext, type CarouselNavButtonProps } from './CarouselContext';\nimport { carouselNavVariants } from './Carousel.variants';\n\nconst locale = useLocale();\n\n/** Renders the step-forward nav button; React shipped it as `Carousel.Next`. */\ndefineOptions({ name: 'CarouselNext', inheritAttrs: false });\n\n/** Overrides the chevron — React's `children ?? <Icon …>`. */\ndefineSlots<{ default(): unknown }>();\n\nconst props = withDefaults(defineProps<CarouselNavButtonProps>(), { variant: CarouselNavVariant.Surface });\n\nconst attrs = useAttrs();\nconst el = useTemplateRef<HTMLButtonElement>('el');\nconst carousel = useCarouselContext();\n\n/** One slide (or none yet) has nowhere to go, looping or not; past the edge only an unlooped carousel stops. */\nconst isSingle = computed(() => carousel.count <= 1);\nconst isDisabled = computed(() => isSingle.value || (!carousel.loop && carousel.index === carousel.count - 1));\n\n/**\n * Runs after a consumer's own `click` — `rest` sits ahead of this binding in the\n * template, which is what makes the `defaultPrevented` check meaningful, the same\n * way React's explicit `onClick?.(e)` call did.\n */\nfunction onClick(event: MouseEvent): void {\n if (event.defaultPrevented) return;\n carousel.next();\n}\n\nconst classes = computed(() =>\n cn(\n carouselNavVariants({ variant: props.variant, controls: carousel.controls, isDisabled: isDisabled.value }),\n 'right-2',\n attrs.class as string | undefined,\n ),\n);\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\ndefineExpose({ el });\n</script>\n\n<template>\n <!-- `type` and `aria-label` sit ahead of `rest`, so a consumer's own value wins —\n React's `type = 'button'` / `'aria-label' = 'Next slide'` destructured defaults. -->\n <button\n ref=\"el\"\n type=\"button\"\n :aria-label=\"locale.t('CarouselNext.nextSlide', undefined, 'Next slide')\"\n :disabled=\"isDisabled\"\n :inert=\"isSingle || undefined\"\n v-bind=\"rest\"\n :class=\"classes\"\n @click=\"onClick\"\n >\n <slot><Icon :icon=\"ChevronRight\" :size=\"16\" /></slot>\n </button>\n</template>\n"],"names":["_openBlock","_createElementBlock","_mergeProps","_unref","_renderSlot","_createVNode","Icon"],"mappings":";;;;;;;;;;;;;;;AAgBA,UAAM,SAAS,UAAA;AAQf,UAAM,QAAQ;AAEd,UAAM,QAAQ,SAAA;AACd,UAAM,KAAK,eAAkC,IAAI;AACjD,UAAM,WAAW,mBAAA;AAGjB,UAAM,WAAW,SAAS,MAAM,SAAS,SAAS,CAAC;AACnD,UAAM,aAAa,SAAS,MAAM,SAAS,SAAU,CAAC,SAAS,QAAQ,SAAS,UAAU,SAAS,QAAQ,CAAE;AAO7G,aAAS,QAAQ,OAAyB;AACxC,UAAI,MAAM,iBAAkB;AAC5B,eAAS,KAAA;AAAA,IACX;AAEA,UAAM,UAAU;AAAA,MAAS,MACvB;AAAA,QACE,oBAAoB,EAAE,SAAS,MAAM,SAAS,UAAU,SAAS,UAAU,YAAY,WAAW,MAAA,CAAO;AAAA,QACzG;AAAA,QACA,MAAM;AAAA,MAAA;AAAA,IACR;AAIF,UAAM,OAAO,SAAS,MAAM;AAC1B,YAAM,EAAE,OAAO,QAAQ,GAAG,WAAW;AACrC,aAAO;AAAA,IACT,CAAC;AAED,aAAa,EAAE,IAAI;;AAMjB,aAAAA,UAAA,GAAAC,mBAWS,UAXTC,WAWS;AAAA,iBAVH;AAAA,QAAJ,KAAI;AAAA,QACJ,MAAK;AAAA,QACJ,cAAYC,MAAA,MAAA,EAAO,4BAA4B,QAAS,YAAA;AAAA,QACxD,UAAU,WAAA;AAAA,QACV,OAAO,SAAA,SAAY;AAAA,MAAA,GACZ,KAAA,OAAI;AAAA,QACX,OAAO,QAAA;AAAA,QACP;AAAA,MAAA;QAEDC,WAAqD,4BAArD,MAAqD;AAAA,UAA/CC,YAAwCF,MAAAG,WAAA,GAAA;AAAA,YAAjC,MAAMH,MAAA,YAAA;AAAA,YAAe,MAAM;AAAA,UAAA;;;;;;"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { CarouselNavButtonProps } from './CarouselContext';
|
|
2
|
+
import { CarouselNavVariant } from './Carousel.variants';
|
|
3
|
+
declare const _default: __VLS_WithSlots<import('vue').DefineComponent<CarouselNavButtonProps, {
|
|
2
4
|
el: Readonly<import('vue').ShallowRef<HTMLButtonElement | null>>;
|
|
3
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<
|
|
5
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<CarouselNavButtonProps> & Readonly<{}>, {
|
|
6
|
+
readonly variant: CarouselNavVariant;
|
|
7
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
|
|
4
8
|
default(): unknown;
|
|
5
9
|
}>;
|
|
6
10
|
export default _default;
|
|
@@ -3,24 +3,31 @@ import { useLocale } from "../../../foundation/i18n/providers/LocaleContext.js";
|
|
|
3
3
|
import { ChevronLeft } from "lucide-vue-next";
|
|
4
4
|
import { cn } from "../../../foundation/styles/Cn.js";
|
|
5
5
|
import { useCarouselContext } from "./CarouselContext.js";
|
|
6
|
+
import { CarouselNavVariant, carouselNavVariants } from "./Carousel.variants.js";
|
|
6
7
|
import _sfc_main$1 from "../../../foundation/icons/icon/Icon.vue.js";
|
|
7
|
-
const _hoisted_1 = ["aria-label", "disabled"];
|
|
8
|
+
const _hoisted_1 = ["aria-label", "disabled", "inert"];
|
|
8
9
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
9
10
|
...{ name: "CarouselPrev", inheritAttrs: false },
|
|
10
11
|
__name: "CarouselPrev",
|
|
12
|
+
props: {
|
|
13
|
+
variant: { default: CarouselNavVariant.Surface }
|
|
14
|
+
},
|
|
11
15
|
setup(__props, { expose: __expose }) {
|
|
12
16
|
const locale = useLocale();
|
|
17
|
+
const props = __props;
|
|
13
18
|
const attrs = useAttrs();
|
|
14
19
|
const el = useTemplateRef("el");
|
|
15
20
|
const carousel = useCarouselContext();
|
|
16
|
-
const
|
|
21
|
+
const isSingle = computed(() => carousel.count <= 1);
|
|
22
|
+
const isDisabled = computed(() => isSingle.value || !carousel.loop && carousel.index === 0);
|
|
17
23
|
function onClick(event) {
|
|
18
24
|
if (event.defaultPrevented) return;
|
|
19
25
|
carousel.prev();
|
|
20
26
|
}
|
|
21
27
|
const classes = computed(
|
|
22
28
|
() => cn(
|
|
23
|
-
|
|
29
|
+
carouselNavVariants({ variant: props.variant, controls: carousel.controls, isDisabled: isDisabled.value }),
|
|
30
|
+
"left-2",
|
|
24
31
|
attrs.class
|
|
25
32
|
)
|
|
26
33
|
);
|
|
@@ -35,7 +42,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
35
42
|
ref: el,
|
|
36
43
|
type: "button",
|
|
37
44
|
"aria-label": unref(locale).t("CarouselPrev.previousSlide", void 0, "Previous slide"),
|
|
38
|
-
disabled: isDisabled.value
|
|
45
|
+
disabled: isDisabled.value,
|
|
46
|
+
inert: isSingle.value || void 0
|
|
39
47
|
}, rest.value, {
|
|
40
48
|
class: classes.value,
|
|
41
49
|
onClick
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CarouselPrev.vue.js","sources":["../../../../src/presentation/display/carousel/CarouselPrev.vue"],"sourcesContent":["<script lang=\"ts\">\
|
|
1
|
+
{"version":3,"file":"CarouselPrev.vue.js","sources":["../../../../src/presentation/display/carousel/CarouselPrev.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { CarouselNavVariant } from './Carousel.variants';\n/* `aria-label` and `type` stay FALLTHROUGH attrs; the props are the shared `CarouselNavButtonProps` in\n `CarouselContext.ts`. The block is load-bearing besides: in a `<script setup>`-only SFC, `vue-eslint-parser` loses\n `ignoreRestSiblings` and the `const { class: _class, ...others }` omission below trips `no-unused-vars`. */\n</script>\n\n<script setup lang=\"ts\">\nimport { useLocale } from '../../../foundation/i18n';\nimport { computed, useAttrs, useTemplateRef } from 'vue';\nimport { ChevronLeft } from 'lucide-vue-next';\nimport { cn } from '../../../foundation/styles';\nimport { Icon } from '../../../foundation/icons';\nimport { useCarouselContext, type CarouselNavButtonProps } from './CarouselContext';\nimport { carouselNavVariants } from './Carousel.variants';\n\nconst locale = useLocale();\n\n/** Renders the step-back nav button; React shipped it as `Carousel.Prev`. */\ndefineOptions({ name: 'CarouselPrev', inheritAttrs: false });\n\n/** Overrides the chevron — React's `children ?? <Icon …>`. */\ndefineSlots<{ default(): unknown }>();\n\nconst props = withDefaults(defineProps<CarouselNavButtonProps>(), { variant: CarouselNavVariant.Surface });\n\nconst attrs = useAttrs();\nconst el = useTemplateRef<HTMLButtonElement>('el');\nconst carousel = useCarouselContext();\n\n/** One slide (or none yet) has nowhere to go, looping or not; past the edge only an unlooped carousel stops. */\nconst isSingle = computed(() => carousel.count <= 1);\nconst isDisabled = computed(() => isSingle.value || (!carousel.loop && carousel.index === 0));\n\n/**\n * Runs after a consumer's own `click` — `rest` sits ahead of this binding in the\n * template, which is what makes the `defaultPrevented` check meaningful, the same\n * way React's explicit `onClick?.(e)` call did.\n */\nfunction onClick(event: MouseEvent): void {\n if (event.defaultPrevented) return;\n carousel.prev();\n}\n\nconst classes = computed(() =>\n cn(\n carouselNavVariants({ variant: props.variant, controls: carousel.controls, isDisabled: isDisabled.value }),\n 'left-2',\n attrs.class as string | undefined,\n ),\n);\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\ndefineExpose({ el });\n</script>\n\n<template>\n <!-- `type` and `aria-label` sit ahead of `rest`, so a consumer's own value wins —\n React's `type = 'button'` / `'aria-label' = 'Previous slide'` destructured defaults. -->\n <button\n ref=\"el\"\n type=\"button\"\n :aria-label=\"locale.t('CarouselPrev.previousSlide', undefined, 'Previous slide')\"\n :disabled=\"isDisabled\"\n :inert=\"isSingle || undefined\"\n v-bind=\"rest\"\n :class=\"classes\"\n @click=\"onClick\"\n >\n <slot><Icon :icon=\"ChevronLeft\" :size=\"16\" /></slot>\n </button>\n</template>\n"],"names":["_openBlock","_createElementBlock","_mergeProps","_unref","_renderSlot","_createVNode","Icon"],"mappings":";;;;;;;;;;;;;;;AAgBA,UAAM,SAAS,UAAA;AAQf,UAAM,QAAQ;AAEd,UAAM,QAAQ,SAAA;AACd,UAAM,KAAK,eAAkC,IAAI;AACjD,UAAM,WAAW,mBAAA;AAGjB,UAAM,WAAW,SAAS,MAAM,SAAS,SAAS,CAAC;AACnD,UAAM,aAAa,SAAS,MAAM,SAAS,SAAU,CAAC,SAAS,QAAQ,SAAS,UAAU,CAAE;AAO5F,aAAS,QAAQ,OAAyB;AACxC,UAAI,MAAM,iBAAkB;AAC5B,eAAS,KAAA;AAAA,IACX;AAEA,UAAM,UAAU;AAAA,MAAS,MACvB;AAAA,QACE,oBAAoB,EAAE,SAAS,MAAM,SAAS,UAAU,SAAS,UAAU,YAAY,WAAW,MAAA,CAAO;AAAA,QACzG;AAAA,QACA,MAAM;AAAA,MAAA;AAAA,IACR;AAIF,UAAM,OAAO,SAAS,MAAM;AAC1B,YAAM,EAAE,OAAO,QAAQ,GAAG,WAAW;AACrC,aAAO;AAAA,IACT,CAAC;AAED,aAAa,EAAE,IAAI;;AAMjB,aAAAA,UAAA,GAAAC,mBAWS,UAXTC,WAWS;AAAA,iBAVH;AAAA,QAAJ,KAAI;AAAA,QACJ,MAAK;AAAA,QACJ,cAAYC,MAAA,MAAA,EAAO,gCAAgC,QAAS,gBAAA;AAAA,QAC5D,UAAU,WAAA;AAAA,QACV,OAAO,SAAA,SAAY;AAAA,MAAA,GACZ,KAAA,OAAI;AAAA,QACX,OAAO,QAAA;AAAA,QACP;AAAA,MAAA;QAEDC,WAAoD,4BAApD,MAAoD;AAAA,UAA9CC,YAAuCF,MAAAG,WAAA,GAAA;AAAA,YAAhC,MAAMH,MAAA,WAAA;AAAA,YAAc,MAAM;AAAA,UAAA;;;;;;"}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `aria-label` stays a FALLTHROUGH attr — declaring a hyphenated prop name would have Vue camelize it to
|
|
3
|
+
* `ariaLabel`, so the `'Carousel'` default below would never apply.
|
|
4
|
+
*/
|
|
1
5
|
export interface CarouselViewportProps {
|
|
6
|
+
/**
|
|
7
|
+
* Lets a horizontal touch or pen swipe step one slide. Default `true`; turn it off when a slide owns horizontal
|
|
8
|
+
* drags itself, such as a map.
|
|
9
|
+
*/
|
|
10
|
+
readonly canSwipe?: boolean;
|
|
2
11
|
}
|
|
3
|
-
declare const _default: __VLS_WithSlots<import('vue').DefineComponent<
|
|
12
|
+
declare const _default: __VLS_WithSlots<import('vue').DefineComponent<CarouselViewportProps, {
|
|
4
13
|
el: Readonly<import('vue').ShallowRef<HTMLDivElement | null>>;
|
|
5
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<
|
|
14
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<CarouselViewportProps> & Readonly<{}>, {
|
|
15
|
+
readonly canSwipe: boolean;
|
|
16
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
|
|
6
17
|
default(): unknown;
|
|
7
18
|
}>;
|
|
8
19
|
export default _default;
|
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
import { defineComponent, useAttrs, useTemplateRef, computed, openBlock, createElementBlock, mergeProps, unref, renderSlot } from "vue";
|
|
1
|
+
import { defineComponent, useAttrs, useTemplateRef, computed, onBeforeUnmount, openBlock, createElementBlock, mergeProps, unref, renderSlot } from "vue";
|
|
2
2
|
import { useLocale } from "../../../foundation/i18n/providers/LocaleContext.js";
|
|
3
3
|
import { AriaAttribute } from "../../../foundation/dom/enums/AriaAttribute.js";
|
|
4
4
|
import { cn } from "../../../foundation/styles/Cn.js";
|
|
5
5
|
import { useCarouselContext } from "./CarouselContext.js";
|
|
6
6
|
const _hoisted_1 = ["aria-roledescription", "aria-label"];
|
|
7
|
+
const SwipeDistance = 48;
|
|
8
|
+
const SwipeExempt = 'input, textarea, select, [contenteditable]:not([contenteditable="false"])';
|
|
7
9
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
10
|
...{ name: "CarouselViewport", inheritAttrs: false },
|
|
9
11
|
__name: "CarouselViewport",
|
|
12
|
+
props: {
|
|
13
|
+
canSwipe: { type: Boolean, default: true }
|
|
14
|
+
},
|
|
10
15
|
setup(__props, { expose: __expose }) {
|
|
11
16
|
const locale = useLocale();
|
|
17
|
+
const props = __props;
|
|
12
18
|
const attrs = useAttrs();
|
|
13
19
|
const el = useTemplateRef("el");
|
|
14
20
|
const carousel = useCarouselContext();
|
|
21
|
+
const isSwipeable = computed(() => props.canSwipe && carousel.count > 1);
|
|
15
22
|
const ariaLabel = computed(
|
|
16
23
|
() => attrs[AriaAttribute.Label] ?? locale.t("CarouselViewport.label", void 0, "Carousel")
|
|
17
24
|
);
|
|
@@ -25,9 +32,50 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
25
32
|
carousel.next();
|
|
26
33
|
}
|
|
27
34
|
}
|
|
35
|
+
let swipe = null;
|
|
36
|
+
let isClickSwallowed = false;
|
|
37
|
+
let swallowTimer;
|
|
38
|
+
function onPointerdown(event) {
|
|
39
|
+
if (swipe !== null && swipe.pointerId !== event.pointerId) {
|
|
40
|
+
swipe = null;
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const target = event.target instanceof Element ? event.target : null;
|
|
44
|
+
if (event.defaultPrevented || !isSwipeable.value || event.pointerType === "mouse" || !event.isPrimary || target?.closest(SwipeExempt))
|
|
45
|
+
return;
|
|
46
|
+
swipe = { x: event.clientX, y: event.clientY, pointerId: event.pointerId };
|
|
47
|
+
}
|
|
48
|
+
function onPointerup(event) {
|
|
49
|
+
const start = swipe;
|
|
50
|
+
swipe = null;
|
|
51
|
+
if (event.defaultPrevented || start === null || start.pointerId !== event.pointerId) return;
|
|
52
|
+
const travel = event.clientX - start.x;
|
|
53
|
+
if (Math.abs(travel) < SwipeDistance || Math.abs(travel) < Math.abs(event.clientY - start.y)) return;
|
|
54
|
+
if (travel < 0) carousel.next();
|
|
55
|
+
else carousel.prev();
|
|
56
|
+
isClickSwallowed = true;
|
|
57
|
+
window.clearTimeout(swallowTimer);
|
|
58
|
+
swallowTimer = window.setTimeout(() => {
|
|
59
|
+
isClickSwallowed = false;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function onPointercancel() {
|
|
63
|
+
swipe = null;
|
|
64
|
+
}
|
|
65
|
+
function onClickCapture(event) {
|
|
66
|
+
if (!isClickSwallowed) return;
|
|
67
|
+
isClickSwallowed = false;
|
|
68
|
+
event.preventDefault();
|
|
69
|
+
event.stopPropagation();
|
|
70
|
+
}
|
|
71
|
+
onBeforeUnmount(() => {
|
|
72
|
+
swipe = null;
|
|
73
|
+
if (swallowTimer !== void 0) window.clearTimeout(swallowTimer);
|
|
74
|
+
});
|
|
28
75
|
const classes = computed(
|
|
29
76
|
() => cn(
|
|
30
77
|
"relative overflow-hidden rounded-md focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",
|
|
78
|
+
isSwipeable.value && "touch-pan-y touch-pinch-zoom",
|
|
31
79
|
attrs.class
|
|
32
80
|
)
|
|
33
81
|
);
|
|
@@ -46,7 +94,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
46
94
|
tabindex: 0
|
|
47
95
|
}, rest.value, {
|
|
48
96
|
class: classes.value,
|
|
49
|
-
onKeydown
|
|
97
|
+
onKeydown,
|
|
98
|
+
onPointerdown,
|
|
99
|
+
onPointerup,
|
|
100
|
+
onPointercancel,
|
|
101
|
+
onClickCapture
|
|
50
102
|
}), [
|
|
51
103
|
renderSlot(_ctx.$slots, "default")
|
|
52
104
|
], 16, _hoisted_1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CarouselViewport.vue.js","sources":["../../../../src/presentation/display/carousel/CarouselViewport.vue"],"sourcesContent":["<script lang=\"ts\">\n
|
|
1
|
+
{"version":3,"file":"CarouselViewport.vue.js","sources":["../../../../src/presentation/display/carousel/CarouselViewport.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * `aria-label` stays a FALLTHROUGH attr — declaring a hyphenated prop name would have Vue camelize it to\n * `ariaLabel`, so the `'Carousel'` default below would never apply.\n */\nexport interface CarouselViewportProps {\n /**\n * Lets a horizontal touch or pen swipe step one slide. Default `true`; turn it off when a slide owns horizontal\n * drags itself, such as a map.\n */\n readonly canSwipe?: boolean;\n}\n\n/** @internal The horizontal travel, in CSS pixels, that turns a touch drag into a swipe — `LightboxModal`'s step. */\nconst SwipeDistance = 48;\n\n/** @internal Presses that start on these keep their own horizontal drag — a range, a caret, a selection. */\nconst SwipeExempt = 'input, textarea, select, [contenteditable]:not([contenteditable=\"false\"])';\n</script>\n\n<script setup lang=\"ts\">\nimport { useLocale } from '../../../foundation/i18n';\nimport { computed, onBeforeUnmount, useAttrs, useTemplateRef } from 'vue';\nimport { AriaAttribute } from '../../../foundation/dom';\nimport { cn } from '../../../foundation/styles';\nimport { useCarouselContext } from './CarouselContext';\n\nconst locale = useLocale();\n\n/**\n * Renders the clipping frame and owns the arrow-key and swipe seams; React shipped it as `Carousel.Viewport`.\n *\n * The swipe never captures the pointer: a press on a link or button inside a slide stays that element's press, so a tap\n * still clicks it. Only touch and pen swipe — a mouse has the arrows and the keys, and a mouse drag selects text.\n */\ndefineOptions({ name: 'CarouselViewport', inheritAttrs: false });\n\n/** The `CarouselSlides` content — React's `children`. */\ndefineSlots<{ default(): unknown }>();\n\nconst props = withDefaults(defineProps<CarouselViewportProps>(), { canSwipe: true });\n\nconst attrs = useAttrs();\nconst el = useTemplateRef<HTMLDivElement>('el');\nconst carousel = useCarouselContext();\n\n/** A swipe needs somewhere to go; until then the frame keeps the page's own touch handling. */\nconst isSwipeable = computed(() => props.canSwipe && carousel.count > 1);\n\n/** The accessible label for the viewport. Default `'Carousel'`. */\nconst ariaLabel = computed(\n () => (attrs[AriaAttribute.Label] as string | undefined) ?? locale.t('CarouselViewport.label', undefined, 'Carousel'),\n);\n\n/**\n * Runs after a consumer's own `keydown` — `rest` sits ahead of this binding in\n * the template, which is what makes the `defaultPrevented` check meaningful, the\n * same way React's explicit `onKeyDown?.(e)` call did.\n */\nfunction onKeydown(event: KeyboardEvent): void {\n if (event.defaultPrevented || event.isComposing || event.target !== event.currentTarget) return;\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n carousel.prev();\n } else if (event.key === 'ArrowRight') {\n event.preventDefault();\n carousel.next();\n }\n}\n\n/** Where the press began; `null` between gestures and after a second finger lands. */\nlet swipe: { readonly x: number; readonly y: number; readonly pointerId: number } | null = null;\n/** Set by a swipe's release, so the click a pen fires on the element it lifted from does not also activate it. */\nlet isClickSwallowed = false;\nlet swallowTimer: number | undefined;\n\n/**\n * Records the press without capturing it — capture would retarget the release to this frame, and the browser then\n * fires the click here rather than on the link or button that was pressed.\n */\nfunction onPointerdown(event: PointerEvent): void {\n if (swipe !== null && swipe.pointerId !== event.pointerId) {\n swipe = null; // A second finger: a pinch, not a swipe.\n return;\n }\n const target = event.target instanceof Element ? event.target : null;\n if (\n event.defaultPrevented ||\n !isSwipeable.value ||\n event.pointerType === 'mouse' ||\n !event.isPrimary ||\n target?.closest(SwipeExempt)\n )\n return;\n swipe = { x: event.clientX, y: event.clientY, pointerId: event.pointerId };\n}\n\n/** Steps one slide when the release travelled far enough, and further across than down. */\nfunction onPointerup(event: PointerEvent): void {\n const start = swipe;\n swipe = null;\n if (event.defaultPrevented || start === null || start.pointerId !== event.pointerId) return;\n const travel = event.clientX - start.x;\n if (Math.abs(travel) < SwipeDistance || Math.abs(travel) < Math.abs(event.clientY - start.y)) return;\n if (travel < 0) carousel.next();\n else carousel.prev();\n isClickSwallowed = true;\n window.clearTimeout(swallowTimer);\n /* The release's own click arrives in the same task; anything later is a new activation. */\n swallowTimer = window.setTimeout(() => {\n isClickSwallowed = false;\n });\n}\n\n/** The browser took the pointer — a vertical scroll under `touch-action: pan-y`, or a lost contact. */\nfunction onPointercancel(): void {\n swipe = null;\n}\n\nfunction onClickCapture(event: MouseEvent): void {\n if (!isClickSwallowed) return;\n isClickSwallowed = false;\n event.preventDefault();\n event.stopPropagation();\n}\n\nonBeforeUnmount(() => {\n swipe = null;\n if (swallowTimer !== undefined) window.clearTimeout(swallowTimer);\n});\n\n/* `pan-y` leaves vertical page scroll and pinch zoom to the browser and hands the horizontal stroke to the swipe;\n without it the browser claims the stroke and cancels the pointer. */\nconst classes = computed(() =>\n cn(\n 'relative overflow-hidden rounded-md focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring',\n isSwipeable.value && 'touch-pan-y touch-pinch-zoom',\n attrs.class as string | undefined,\n ),\n);\n\n/** Everything but `class` and `aria-label`, both re-applied explicitly above. */\nconst rest = computed(() => {\n const { class: _class, [AriaAttribute.Label]: _ariaLabel, ...others } = attrs;\n return others;\n});\n\ndefineExpose({ el });\n</script>\n\n<template>\n <div\n ref=\"el\"\n role=\"group\"\n :aria-roledescription=\"locale.t('CarouselViewport.carousel', undefined, 'carousel')\"\n :aria-label=\"ariaLabel\"\n :tabindex=\"0\"\n v-bind=\"rest\"\n :class=\"classes\"\n @keydown=\"onKeydown\"\n @pointerdown=\"onPointerdown\"\n @pointerup=\"onPointerup\"\n @pointercancel=\"onPointercancel\"\n @click.capture=\"onClickCapture\"\n >\n <slot />\n </div>\n</template>\n"],"names":["_openBlock","_createElementBlock","_mergeProps","_unref","_renderSlot"],"mappings":";;;;;;AAcA,MAAM,gBAAgB;AAGtB,MAAM,cAAc;;;;;;;;AAUpB,UAAM,SAAS,UAAA;AAaf,UAAM,QAAQ;AAEd,UAAM,QAAQ,SAAA;AACd,UAAM,KAAK,eAA+B,IAAI;AAC9C,UAAM,WAAW,mBAAA;AAGjB,UAAM,cAAc,SAAS,MAAM,MAAM,YAAY,SAAS,QAAQ,CAAC;AAGvE,UAAM,YAAY;AAAA,MAChB,MAAO,MAAM,cAAc,KAAK,KAA4B,OAAO,EAAE,0BAA0B,QAAW,UAAU;AAAA,IAAA;AAQtH,aAAS,UAAU,OAA4B;AAC7C,UAAI,MAAM,oBAAoB,MAAM,eAAe,MAAM,WAAW,MAAM,cAAe;AACzF,UAAI,MAAM,QAAQ,aAAa;AAC7B,cAAM,eAAA;AACN,iBAAS,KAAA;AAAA,MACX,WAAW,MAAM,QAAQ,cAAc;AACrC,cAAM,eAAA;AACN,iBAAS,KAAA;AAAA,MACX;AAAA,IACF;AAGA,QAAI,QAAuF;AAE3F,QAAI,mBAAmB;AACvB,QAAI;AAMJ,aAAS,cAAc,OAA2B;AAChD,UAAI,UAAU,QAAQ,MAAM,cAAc,MAAM,WAAW;AACzD,gBAAQ;AACR;AAAA,MACF;AACA,YAAM,SAAS,MAAM,kBAAkB,UAAU,MAAM,SAAS;AAChE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A,QACJ,MAAK;AAAA,QACJ,wBAAsBC,MAAA,MAAA,EAAO,+BAA+B,QAAS,UAAA;AAAA,QACrE,cAAY,UAAA;AAAA,QACZ,UAAU;AAAA,MAAA,GACH,KAAA,OAAI;AAAA,QACX,OAAO,QAAA;AAAA,QACP;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;;QAGDC,WAAQ,KAAA,QAAA,SAAA;AAAA,MAAA;;;;"}
|
|
@@ -7,4 +7,5 @@ export { default as CarouselNext } from './CarouselNext.vue';
|
|
|
7
7
|
export { default as CarouselDots, type CarouselDotsProps } from './CarouselDots.vue';
|
|
8
8
|
export { default as CarouselDot, type CarouselDotProps } from './CarouselDot.vue';
|
|
9
9
|
export { useCarouselContext, type CarouselContextValue, type CarouselNavButtonProps } from './CarouselContext';
|
|
10
|
+
export { CarouselControls, CarouselNavVariant, carouselNavVariants } from './Carousel.variants';
|
|
10
11
|
export { default } from './Carousel.vue';
|
|
@@ -64,6 +64,7 @@ export * from './threadView';
|
|
|
64
64
|
export * from './commentThreadGroup';
|
|
65
65
|
export * from './activityTimeline';
|
|
66
66
|
export * from './featureCard';
|
|
67
|
+
export * from './mediaCard';
|
|
67
68
|
export * from './stepCard';
|
|
68
69
|
export * from './pricingCard';
|
|
69
70
|
export * from './legendText';
|