@ember-joinery/carousel 0.0.0-stage → 1.0.1
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/CHANGELOG.md +153 -0
- package/LICENSE.md +9 -0
- package/NOTICE +532 -0
- package/README.md +41 -2
- package/addon-main.cjs +4 -0
- package/declarations/-private/direction.d.ts +7 -0
- package/declarations/-private/direction.d.ts.map +1 -0
- package/declarations/-private/waiter.d.ts +12 -0
- package/declarations/-private/waiter.d.ts.map +1 -0
- package/declarations/components/carousel/content.d.ts +28 -0
- package/declarations/components/carousel/content.d.ts.map +1 -0
- package/declarations/components/carousel/index.d.ts +104 -0
- package/declarations/components/carousel/index.d.ts.map +1 -0
- package/declarations/components/carousel/item.d.ts +33 -0
- package/declarations/components/carousel/item.d.ts.map +1 -0
- package/declarations/components/carousel/state.d.ts +58 -0
- package/declarations/components/carousel/state.d.ts.map +1 -0
- package/declarations/components/carousel/step.d.ts +59 -0
- package/declarations/components/carousel/step.d.ts.map +1 -0
- package/declarations/components/carousel.d.ts +3 -0
- package/declarations/embla.d.ts +49 -0
- package/declarations/embla.d.ts.map +1 -0
- package/declarations/index.d.ts +5 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/messages.d.ts +30 -0
- package/declarations/messages.d.ts.map +1 -0
- package/declarations/test-support/carousel.d.ts +84 -0
- package/declarations/test-support/carousel.d.ts.map +1 -0
- package/declarations/test-support/index.d.ts +2 -0
- package/declarations/test-support/index.d.ts.map +1 -0
- package/declarations/test-support.d.ts +2 -0
- package/dist/components/carousel.js +383 -0
- package/dist/components/carousel.js.map +1 -0
- package/dist/embla-C9buOK_5.js +186 -0
- package/dist/embla-C9buOK_5.js.map +1 -0
- package/dist/embla.js +7 -0
- package/dist/embla.js.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/messages.js +32 -0
- package/dist/messages.js.map +1 -0
- package/dist/test-support.js +215 -0
- package/dist/test-support.js.map +1 -0
- package/package.json +116 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embla-C9buOK_5.js","sources":["../src/-private/direction.ts","../src/-private/waiter.ts","../src/embla.ts"],"sourcesContent":["import { isUndefined } from '@sindresorhus/is'\n/** Callbacks to call when any element's `dir` changes. */\nconst listeners = new Set<() => void>()\n\nlet observer: MutationObserver | undefined\n\n/**\n * Calls `callback` whenever a `dir` attribute changes anywhere in the document, as the guide's\n * RTL switch or an app's language picker does, until the returned function is called. One\n * observer serves every carousel, and it watches only while one is listening.\n */\nexport function watchDirection(callback: () => void): () => void {\n if (isUndefined(globalThis.MutationObserver)) return () => {}\n if (!listeners.size) {\n observer ??= new MutationObserver(() => {\n for (const listener of [...listeners]) listener()\n })\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['dir'],\n subtree: true,\n })\n }\n listeners.add(callback)\n return () => {\n listeners.delete(callback)\n if (!listeners.size) observer?.disconnect()\n }\n}\n","import { register, type TestWaiterDebugInfo, type Waiter } from '@ember/test-waiters'\nimport type { EmblaCarouselType } from 'embla-carousel'\n\n/** Every carousel on the page, while it lives. */\nconst live = new Set<EmblaCarouselType>()\n\n/** Work put off past the current render, which `settled()` waits for. */\nlet deferred = 0\n\n/** How close (in pixels, and pixels a step) a carousel must be to its target to be at rest. */\nconst REST = 0.5\n\n/**\n * Whether a carousel has come to rest where a user sees it: not being dragged, and within half\n * a pixel of where it is going, barely moving. Embla's own `settle` comes a good while later,\n * once its easing is within a thousandth of a pixel (and not always after a jump), so tests\n * would wait for nothing anyone can see.\n */\nfunction isAtRest(api: EmblaCarouselType): boolean {\n const engine = api.internalEngine()\n if (engine.dragHandler.pointerDown()) return false\n const distance = Math.abs(engine.target.get() - engine.location.get())\n return distance < REST && Math.abs(engine.scrollBody.velocity()) < REST\n}\n\n/**\n * One test waiter for every carousel: `settled()` (and so every `@ember/test-helpers` action)\n * waits while one is scrolling to a slide or being dragged, and for the state a carousel puts\n * off past rendering. So a test reads the slides where they come to rest. Outside tests it\n * costs one entry in the waiters' map.\n */\nconst waiter: Waiter = {\n name: '@ember-joinery/carousel',\n waitUntil: () => deferred === 0 && [...live].every(isAtRest),\n debugInfo: (): TestWaiterDebugInfo[] => [\n ...(deferred\n ? [{ label: `${deferred} carousel update(s) put off past rendering`, stack: undefined }]\n : []),\n ...[...live]\n .filter(api => !isAtRest(api))\n .map(() => ({ label: 'a carousel still moving', stack: undefined })),\n ],\n}\n\nlet registered = false\n\n/** Counts a carousel in, for the waiter, until `untrack`. */\nexport function track(api: EmblaCarouselType): void {\n if (!registered) {\n register(waiter)\n registered = true\n }\n live.add(api)\n}\n\n/** Counts a carousel out. */\nexport function untrack(api: EmblaCarouselType): void {\n live.delete(api)\n}\n\n/**\n * Runs `callback` once the current render is done (in a microtask), for work that sets tracked\n * state: a modifier, or an Embla event fired while the carousel reinitializes during a render,\n * mustn't set state the render has read. The waiter waits for it.\n */\nexport function defer(callback: () => void): void {\n deferred += 1\n void Promise.resolve()\n .then(callback)\n .finally(() => {\n deferred -= 1\n })\n}\n","import Modifier, { type ArgsFor, type NamedArgs } from 'ember-modifier'\nimport { registerDestructor } from '@ember/destroyable'\nimport type Owner from '@ember/owner'\nimport EmblaCarousel, {\n type EmblaCarouselType,\n type EmblaOptionsType,\n type EmblaPluginType,\n} from 'embla-carousel'\nimport { areOptionsEqual, arePluginsEqual } from 'embla-carousel-reactive-utils'\nimport { getDirection } from '@ember-joinery/primitives/direction'\nimport { watchDirection } from './-private/direction.ts'\nimport { defer, track, untrack } from './-private/waiter.ts'\n\n/** What `{{embla}}` takes. */\nexport interface EmblaOptions {\n /**\n * Embla's options (`align`, `loop`, `axis`…; see embla-carousel.com/api/options). Without a\n * `direction`, the carousel takes the text direction at its element, from the nearest `dir`,\n * and follows it when it changes.\n */\n options?: EmblaOptionsType\n /** Embla plugins, such as `embla-carousel-autoplay`'s `Autoplay()`. */\n plugins?: EmblaPluginType[]\n /**\n * Called with the carousel's API once it exists, after the render that made it, so it may\n * set tracked state.\n */\n onInit?: (api: EmblaCarouselType) => void\n}\n\nexport interface EmblaSignature {\n Element: HTMLElement\n Args: { Named: EmblaOptions }\n}\n\n/**\n * Makes an element an Embla carousel's viewport, the way `embla-carousel-react`'s\n * `useEmblaCarousel` does: the element clips, its first child is the track Embla moves, and\n * that child's children are the slides. It is the headless part of `<Carousel>`, for a\n * carousel with markup of your own:\n *\n * <div class=\"overflow-hidden\" {{embla options=(hash loop=true) onInit=this.setApi}}>\n * <div class=\"flex\">\n * {{#each this.slides as |slide|}}<div class=\"min-w-0 shrink-0 basis-full\">…</div>{{/each}}\n * </div>\n * </div>\n *\n * When `options` or `plugins` change to something different, the carousel reinitializes and\n * keeps its place (`api.reInit`), as the React hook does; it goes when the element does. While\n * it moves to a slide, or is dragged, `settled()` waits for it in tests.\n */\nclass EmblaModifier extends Modifier<EmblaSignature> {\n #api: EmblaCarouselType | undefined\n #element: HTMLElement | undefined\n #options: EmblaOptionsType = {}\n #plugins: EmblaPluginType[] = []\n /** The options Embla has now: the caller's, with the direction filled in. */\n #resolved: EmblaOptionsType = {}\n #unwatch: (() => void) | undefined\n #destroyed = false\n\n constructor(owner: Owner, args: ArgsFor<EmblaSignature>) {\n super(owner, args)\n registerDestructor(this, () => {\n this.#destroyed = true\n this.#unwatch?.()\n const api = this.#api\n if (!api) return\n untrack(api)\n api.destroy()\n })\n }\n\n modify(element: HTMLElement, _positional: [], named: NamedArgs<EmblaSignature>): void {\n const { options = {}, plugins = [], onInit } = named\n this.#element = element\n this.#options = options\n if (!this.#api) {\n this.#plugins = plugins\n this.#resolved = this.#resolve()\n const api = EmblaCarousel(element, this.#resolved, plugins)\n this.#api = api\n track(api)\n this.#unwatch = watchDirection(() => this.#update(this.#plugins))\n if (onInit) defer(() => !this.#destroyed && onInit(api))\n return\n }\n this.#update(plugins)\n }\n\n /** The caller's options, with the text direction at the element when they don't give one. */\n #resolve(): EmblaOptionsType {\n const options = this.#options\n if (options.direction) return options\n return { ...options, direction: getDirection(this.#element) }\n }\n\n /** Reinitializes the carousel if its options (its direction included) or plugins changed. */\n #update(plugins: EmblaPluginType[]): void {\n const api = this.#api\n if (!api || this.#destroyed) return\n const resolved = this.#resolve()\n if (areOptionsEqual(this.#resolved, resolved) && arePluginsEqual(this.#plugins, plugins)) return\n this.#resolved = resolved\n this.#plugins = plugins\n api.reInit(resolved, plugins)\n }\n}\n\n/** The `{{embla}}` modifier: see `EmblaModifier`. */\nexport { EmblaModifier as embla }\n"],"names":["listeners","Set","observer","watchDirection","callback","isUndefined","globalThis","MutationObserver","size","listener","observe","document","documentElement","attributes","attributeFilter","subtree","add","delete","disconnect","live","deferred","REST","isAtRest","api","engine","internalEngine","dragHandler","pointerDown","distance","Math","abs","target","get","location","scrollBody","velocity","waiter","name","waitUntil","every","debugInfo","label","stack","undefined","filter","map","registered","track","register","untrack","defer","Promise","resolve","then","finally","EmblaModifier","Modifier","constructor","owner","args","registerDestructor","destroy","modify","element","_positional","named","options","plugins","onInit","EmblaCarousel","#resolve","direction","getDirection","#update","resolved","areOptionsEqual","arePluginsEqual","reInit"],"mappings":";;;;;;;;AACA;AACA,MAAMA,SAAS,GAAG,IAAIC,GAAG,EAAc;AAEvC,IAAIC,QAAsC;;AAE1C;AACA;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAACC,QAAoB,EAAc;EAC/D,IAAIC,WAAW,CAACC,UAAU,CAACC,gBAAgB,CAAC,EAAE,OAAO,MAAM,CAAC,CAAC;AAC7D,EAAA,IAAI,CAACP,SAAS,CAACQ,IAAI,EAAE;AACnBN,IAAAA,QAAQ,KAAK,IAAIK,gBAAgB,CAAC,MAAM;MACtC,KAAK,MAAME,QAAQ,IAAI,CAAC,GAAGT,SAAS,CAAC,EAAES,QAAQ,EAAE;AACnD,IAAA,CAAC,CAAC;AACFP,IAAAA,QAAQ,CAACQ,OAAO,CAACC,QAAQ,CAACC,eAAe,EAAE;AACzCC,MAAAA,UAAU,EAAE,IAAI;MAChBC,eAAe,EAAE,CA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IAAI,CAAC,OAAO,CAAC4C,OAAO,CAAC;AACvB,EAAA;;AAEA;EACA,QAAQG,GAAqB;AAC3B,IAAA,MAAMJ,OAAO,GAAG,IAAI,CAAC,QAAQ;AAC7B,IAAA,IAAIA,OAAO,CAACK,SAAS,EAAE,OAAOL,OAAO;IACrC,OAAO;AAAE,MAAA,GAAGA,OAAO;AAAEK,MAAAA,SAAS,EAAEC,YAAY,CAAC,IAAI,CAAC,QAAQ;KAAG;AAC/D,EAAA;;AAEA;EACA,OAAOC,CAACN,OAA0B,EAAQ;AACxC,IAAA,MAAM5C,GAAG,GAAG,IAAI,CAAC,IAAI;AACrB,IAAA,IAAI,CAACA,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE;AAC7B,IAAA,MAAMmD,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE;AAChC,IAAA,IAAIC,eAAe,CAAC,IAAI,CAAC,SAAS,EAAED,QAAQ,CAAC,IAAIE,eAAe,CAAC,IAAI,CAAC,QAAQ,EAAET,OAAO,CAAC,EAAE;AAC1F,IAAA,IAAI,CAAC,SAAS,GAAGO,QAAQ;AACzB,IAAA,IAAI,CAAC,QAAQ,GAAGP,OAAO;AACvB5C,IAAAA,GAAG,CAACsD,MAAM,CAACH,QAAQ,EAAEP,OAAO,CAAC;AAC/B,EAAA;AACF;;"}
|
package/dist/embla.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embla.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
package/dist/messages.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every string `@ember-joinery/carousel` shows or announces itself, in English, for a
|
|
3
|
+
* translation catalog. An argument (`@label`, `@slideLabel`) still beats each one.
|
|
4
|
+
*/
|
|
5
|
+
const messages = {
|
|
6
|
+
carousel: {
|
|
7
|
+
id: 'joinery.carousel.roleDescription',
|
|
8
|
+
message: 'carousel',
|
|
9
|
+
description: "What a screen reader calls the carousel's region."
|
|
10
|
+
},
|
|
11
|
+
slide: {
|
|
12
|
+
id: 'joinery.carousel.slideRoleDescription',
|
|
13
|
+
message: 'slide',
|
|
14
|
+
description: 'What a screen reader calls each slide.'
|
|
15
|
+
},
|
|
16
|
+
slideLabel: {
|
|
17
|
+
id: 'joinery.carousel.slideLabel',
|
|
18
|
+
message: '{index} of {count}',
|
|
19
|
+
description: "A slide's name, by its place: {index} of the {count} slides."
|
|
20
|
+
},
|
|
21
|
+
previous: {
|
|
22
|
+
id: 'joinery.carousel.previous',
|
|
23
|
+
message: 'Previous slide'
|
|
24
|
+
},
|
|
25
|
+
next: {
|
|
26
|
+
id: 'joinery.carousel.next',
|
|
27
|
+
message: 'Next slide'
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { messages };
|
|
32
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sources":["../src/messages.ts"],"sourcesContent":["import type { Message } from '@ember-joinery/primitives/i18n'\n\n/**\n * Every string `@ember-joinery/carousel` shows or announces itself, in English, for a\n * translation catalog. An argument (`@label`, `@slideLabel`) still beats each one.\n */\nexport const messages = {\n carousel: {\n id: 'joinery.carousel.roleDescription',\n message: 'carousel',\n description: \"What a screen reader calls the carousel's region.\",\n },\n slide: {\n id: 'joinery.carousel.slideRoleDescription',\n message: 'slide',\n description: 'What a screen reader calls each slide.',\n },\n slideLabel: {\n id: 'joinery.carousel.slideLabel',\n message: '{index} of {count}',\n description: \"A slide's name, by its place: {index} of the {count} slides.\",\n },\n previous: { id: 'joinery.carousel.previous', message: 'Previous slide' },\n next: { id: 'joinery.carousel.next', message: 'Next slide' },\n} satisfies Record<string, Message>\n"],"names":["messages","carousel","id","message","description","slide","slideLabel","previous","next"],"mappings":"AAEA;AACA;AACA;AACA;AACO,MAAMA,QAAQ,GAAG;AACtBC,EAAAA,QAAQ,EAAE;AACRC,IAAAA,EAAE,EAAE,kCAAkC;AACtCC,IAAAA,OAAO,EAAE,UAAU;AACnBC,IAAAA,WAAW,EAAE;GACd;AACDC,EAAAA,KAAK,EAAE;AACLH,IAAAA,EAAE,EAAE,uCAAuC;AAC3CC,IAAAA,OAAO,EAAE,OAAO;AAChBC,IAAAA,WAAW,EAAE;GACd;AACDE,EAAAA,UAAU,EAAE;AACVJ,IAAAA,EAAE,EAAE,6BAA6B;AACjCC,IAAAA,OAAO,EAAE,oBAAoB;AAC7BC,IAAAA,WAAW,EAAE;GACd;AACDG,EAAAA,QAAQ,EAAE;AAAEL,IAAAA,EAAE,EAAE,2BAA2B;AAAEC,IAAAA,OAAO,EAAE;GAAkB;AACxEK,EAAAA,IAAI,EAAE;AAAEN,IAAAA,EAAE,EAAE,uBAAuB;AAAEC,IAAAA,OAAO,EAAE;AAAa;AAC7D;;"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { click, focus, settled, waitUntil } from '@ember/test-helpers';
|
|
2
|
+
import { Harness, pressKey } from '@ember-joinery/test-support';
|
|
3
|
+
|
|
4
|
+
const collapse = value => (value ?? '').replace(/\s+/g, ' ').trim();
|
|
5
|
+
|
|
6
|
+
/** What can take focus inside a carousel when none of its buttons can. */
|
|
7
|
+
const FOCUSABLE = 'button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Drives a `<Carousel>` from `@ember-joinery/carousel`. It reads the slides, which of them are
|
|
11
|
+
* in view (from where they are drawn, as a user sees them), the orientation and each slide's
|
|
12
|
+
* name, and moves the carousel the ways a user does: with its buttons, the arrow keys, or a
|
|
13
|
+
* swipe.
|
|
14
|
+
*
|
|
15
|
+
* const carousel = new CarouselHarness('gallery') // <Carousel @name="gallery">
|
|
16
|
+
* assert.deepEqual(carousel.slidesInView, [0])
|
|
17
|
+
* await carousel.scrollNext()
|
|
18
|
+
* assert.deepEqual(carousel.slidesInView, [1])
|
|
19
|
+
* assert.false(carousel.canScrollNext)
|
|
20
|
+
*
|
|
21
|
+
* Every action waits for the carousel to come to rest, so a test reads the slides where they
|
|
22
|
+
* stop.
|
|
23
|
+
*/
|
|
24
|
+
class CarouselHarness extends Harness {
|
|
25
|
+
static component = 'carousel';
|
|
26
|
+
|
|
27
|
+
/** `horizontal` or `vertical`. */
|
|
28
|
+
get orientation() {
|
|
29
|
+
return this.element.getAttribute('data-orientation') === 'vertical' ? 'vertical' : 'horizontal';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** The text direction the slides run in: `ltr` or `rtl`. */
|
|
33
|
+
get direction() {
|
|
34
|
+
return getComputedStyle(this.content).direction === 'rtl' ? 'rtl' : 'ltr';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** How assistive technology describes it (`aria-roledescription`): `carousel`. */
|
|
38
|
+
get roleDescription() {
|
|
39
|
+
return this.element.getAttribute('aria-roledescription');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Its accessible name: `aria-label`, or the text of what `aria-labelledby` names; `''` without. */
|
|
43
|
+
get label() {
|
|
44
|
+
const element = this.element;
|
|
45
|
+
const label = element.getAttribute('aria-label');
|
|
46
|
+
if (label) return label.trim();
|
|
47
|
+
return (element.getAttribute('aria-labelledby') ?? '').split(/\s+/).map(id => id ? element.ownerDocument.getElementById(id) : null).filter(found => Boolean(found)).map(found => collapse(found.textContent)).join(' ');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The content: Embla's viewport, which clips the slides. */
|
|
51
|
+
get content() {
|
|
52
|
+
return this.part('content');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** The row (or column) of slides inside the content, which Embla moves. */
|
|
56
|
+
get container() {
|
|
57
|
+
return this.part('container');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** The slides, in order. */
|
|
61
|
+
get slides() {
|
|
62
|
+
return this.parts('item');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** How many slides it has. */
|
|
66
|
+
get slideCount() {
|
|
67
|
+
return this.slides.length;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Each slide's accessible name (`1 of 5` by default), in order. */
|
|
71
|
+
get slideLabels() {
|
|
72
|
+
return this.slides.map(slide => slide.getAttribute('aria-label') ?? '');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Each slide's text, whitespace collapsed, in order. */
|
|
76
|
+
get slideTexts() {
|
|
77
|
+
return this.slides.map(slide => collapse(slide.textContent));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The slides in view, by index: those with at least half of their box inside the content,
|
|
82
|
+
* where they are drawn now.
|
|
83
|
+
*/
|
|
84
|
+
get slidesInView() {
|
|
85
|
+
const view = this.content.getBoundingClientRect();
|
|
86
|
+
const vertical = this.orientation === 'vertical';
|
|
87
|
+
const [viewStart, viewEnd] = vertical ? [view.top, view.bottom] : [view.left, view.right];
|
|
88
|
+
return this.slides.flatMap((slide, index) => {
|
|
89
|
+
const box = slide.getBoundingClientRect();
|
|
90
|
+
const [start, end, size] = vertical ? [box.top, box.bottom, box.height] : [box.left, box.right, box.width];
|
|
91
|
+
const shown = Math.min(end, viewEnd) - Math.max(start, viewStart);
|
|
92
|
+
return size > 0 && shown >= size / 2 ? [index] : [];
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** The first slide in view, by index, or `-1` when none is. */
|
|
97
|
+
get currentSlide() {
|
|
98
|
+
return this.slidesInView[0] ?? -1;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** The previous slide's button, or `null` without one. */
|
|
102
|
+
get previous() {
|
|
103
|
+
return this.queryPart('previous');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** The next slide's button, or `null` without one. */
|
|
107
|
+
get next() {
|
|
108
|
+
return this.queryPart('next');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Whether the previous button can be used (it is disabled at the first slide). */
|
|
112
|
+
get canScrollPrev() {
|
|
113
|
+
return isEnabled(this.previous);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** Whether the next button can be used (it is disabled at the last slide). */
|
|
117
|
+
get canScrollNext() {
|
|
118
|
+
return isEnabled(this.next);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Clicks the previous button, and waits for the carousel to come to rest. */
|
|
122
|
+
async scrollPrev() {
|
|
123
|
+
await click(this.#button('previous'));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** Clicks the next button, and waits for the carousel to come to rest. */
|
|
127
|
+
async scrollNext() {
|
|
128
|
+
await click(this.#button('next'));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Presses a key inside the carousel, as a keyboard user does once they have tabbed into it:
|
|
133
|
+
* when focus is outside, it first moves to a button (or anything else) inside that can take
|
|
134
|
+
* it. Returns whether the carousel called `preventDefault()`.
|
|
135
|
+
*/
|
|
136
|
+
async press(key) {
|
|
137
|
+
const root = this.element;
|
|
138
|
+
if (!root.contains(root.ownerDocument.activeElement)) {
|
|
139
|
+
const target = [this.next, this.previous].find(isEnabled) ?? root.querySelector(FOCUSABLE);
|
|
140
|
+
if (target) await focus(target);
|
|
141
|
+
}
|
|
142
|
+
return pressKey(key);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Drags the slides with a mouse, `distance` pixels along the carousel's axis (negative is
|
|
147
|
+
* left, or up), and lets go, then waits for the carousel to come to rest.
|
|
148
|
+
*/
|
|
149
|
+
async drag(distance) {
|
|
150
|
+
const content = this.content;
|
|
151
|
+
const target = this.slides[this.currentSlide] ?? content;
|
|
152
|
+
const box = content.getBoundingClientRect();
|
|
153
|
+
const x = box.left + box.width / 2;
|
|
154
|
+
const y = box.top + box.height / 2;
|
|
155
|
+
const vertical = this.orientation === 'vertical';
|
|
156
|
+
const at = moved => vertical ? {
|
|
157
|
+
clientX: x,
|
|
158
|
+
clientY: y + moved
|
|
159
|
+
} : {
|
|
160
|
+
clientX: x + moved,
|
|
161
|
+
clientY: y
|
|
162
|
+
};
|
|
163
|
+
const document = content.ownerDocument;
|
|
164
|
+
const mouse = (node, type, moved, buttons) => node.dispatchEvent(new MouseEvent(type, {
|
|
165
|
+
bubbles: true,
|
|
166
|
+
cancelable: true,
|
|
167
|
+
view: document.defaultView,
|
|
168
|
+
button: 0,
|
|
169
|
+
buttons,
|
|
170
|
+
...at(moved)
|
|
171
|
+
}));
|
|
172
|
+
// One gesture, sent at once: settled() would wait for the drag to end between events.
|
|
173
|
+
mouse(target, 'mousedown', 0, 1);
|
|
174
|
+
for (const share of [0.25, 0.5, 0.75, 1]) mouse(document, 'mousemove', distance * share, 1);
|
|
175
|
+
mouse(document, 'mouseup', distance, 0);
|
|
176
|
+
await settled();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Swipes to the next or previous slide: drags the slides most of the content's length, the
|
|
181
|
+
* way that brings that slide in (to the left for the next, or up; to the right right to
|
|
182
|
+
* left), and waits for them to come to rest.
|
|
183
|
+
*/
|
|
184
|
+
async swipe(to) {
|
|
185
|
+
const content = this.content;
|
|
186
|
+
const vertical = this.orientation === 'vertical';
|
|
187
|
+
// Embla moves the slides by the pointer's pixels, so the length is the layout's own.
|
|
188
|
+
const length = (vertical ? content.offsetHeight : content.offsetWidth) * 0.6;
|
|
189
|
+
const forward = vertical || this.direction === 'ltr' ? -1 : 1;
|
|
190
|
+
await this.drag(length * (to === 'next' ? forward : -forward));
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Waits until the slide at `index` is in view, as when a plugin (autoplay) moves the
|
|
195
|
+
* carousel on its own. Fails after `timeout` milliseconds (default 5000).
|
|
196
|
+
*/
|
|
197
|
+
async waitForSlide(index, {
|
|
198
|
+
timeout = 5000
|
|
199
|
+
} = {}) {
|
|
200
|
+
await waitUntil(() => this.slidesInView.includes(index), {
|
|
201
|
+
timeout,
|
|
202
|
+
timeoutMessage: `slide ${index} of ${this} didn't come into view`
|
|
203
|
+
});
|
|
204
|
+
await settled();
|
|
205
|
+
}
|
|
206
|
+
#button(step) {
|
|
207
|
+
return this.part(step);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
function isEnabled(button) {
|
|
211
|
+
return Boolean(button) && !button.disabled && button.getAttribute('aria-disabled') !== 'true';
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export { CarouselHarness };
|
|
215
|
+
//# sourceMappingURL=test-support.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-support.js","sources":["../src/test-support/carousel.ts"],"sourcesContent":["import { click, focus, settled, waitUntil } from '@ember/test-helpers'\nimport { Harness, pressKey } from '@ember-joinery/test-support'\n\nconst collapse = (value: string | null | undefined): string =>\n (value ?? '').replace(/\\s+/g, ' ').trim()\n\n/** What can take focus inside a carousel when none of its buttons can. */\nconst FOCUSABLE =\n 'button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])'\n\n/**\n * Drives a `<Carousel>` from `@ember-joinery/carousel`. It reads the slides, which of them are\n * in view (from where they are drawn, as a user sees them), the orientation and each slide's\n * name, and moves the carousel the ways a user does: with its buttons, the arrow keys, or a\n * swipe.\n *\n * const carousel = new CarouselHarness('gallery') // <Carousel @name=\"gallery\">\n * assert.deepEqual(carousel.slidesInView, [0])\n * await carousel.scrollNext()\n * assert.deepEqual(carousel.slidesInView, [1])\n * assert.false(carousel.canScrollNext)\n *\n * Every action waits for the carousel to come to rest, so a test reads the slides where they\n * stop.\n */\nexport class CarouselHarness extends Harness {\n static override component = 'carousel'\n\n /** `horizontal` or `vertical`. */\n get orientation(): 'horizontal' | 'vertical' {\n return this.element.getAttribute('data-orientation') === 'vertical' ? 'vertical' : 'horizontal'\n }\n\n /** The text direction the slides run in: `ltr` or `rtl`. */\n get direction(): 'ltr' | 'rtl' {\n return getComputedStyle(this.content).direction === 'rtl' ? 'rtl' : 'ltr'\n }\n\n /** How assistive technology describes it (`aria-roledescription`): `carousel`. */\n get roleDescription(): string | null {\n return this.element.getAttribute('aria-roledescription')\n }\n\n /** Its accessible name: `aria-label`, or the text of what `aria-labelledby` names; `''` without. */\n get label(): string {\n const element = this.element\n const label = element.getAttribute('aria-label')\n if (label) return label.trim()\n return (element.getAttribute('aria-labelledby') ?? '')\n .split(/\\s+/)\n .map(id => (id ? element.ownerDocument.getElementById(id) : null))\n .filter((found): found is HTMLElement => Boolean(found))\n .map(found => collapse(found.textContent))\n .join(' ')\n }\n\n /** The content: Embla's viewport, which clips the slides. */\n get content(): HTMLElement {\n return this.part('content')\n }\n\n /** The row (or column) of slides inside the content, which Embla moves. */\n get container(): HTMLElement {\n return this.part('container')\n }\n\n /** The slides, in order. */\n get slides(): HTMLElement[] {\n return this.parts('item')\n }\n\n /** How many slides it has. */\n get slideCount(): number {\n return this.slides.length\n }\n\n /** Each slide's accessible name (`1 of 5` by default), in order. */\n get slideLabels(): string[] {\n return this.slides.map(slide => slide.getAttribute('aria-label') ?? '')\n }\n\n /** Each slide's text, whitespace collapsed, in order. */\n get slideTexts(): string[] {\n return this.slides.map(slide => collapse(slide.textContent))\n }\n\n /**\n * The slides in view, by index: those with at least half of their box inside the content,\n * where they are drawn now.\n */\n get slidesInView(): number[] {\n const view = this.content.getBoundingClientRect()\n const vertical = this.orientation === 'vertical'\n const [viewStart, viewEnd] = vertical ? [view.top, view.bottom] : [view.left, view.right]\n return this.slides.flatMap((slide, index) => {\n const box = slide.getBoundingClientRect()\n const [start, end, size] = vertical\n ? [box.top, box.bottom, box.height]\n : [box.left, box.right, box.width]\n const shown = Math.min(end, viewEnd) - Math.max(start, viewStart)\n return size > 0 && shown >= size / 2 ? [index] : []\n })\n }\n\n /** The first slide in view, by index, or `-1` when none is. */\n get currentSlide(): number {\n return this.slidesInView[0] ?? -1\n }\n\n /** The previous slide's button, or `null` without one. */\n get previous(): HTMLButtonElement | null {\n return this.queryPart<HTMLButtonElement>('previous')\n }\n\n /** The next slide's button, or `null` without one. */\n get next(): HTMLButtonElement | null {\n return this.queryPart<HTMLButtonElement>('next')\n }\n\n /** Whether the previous button can be used (it is disabled at the first slide). */\n get canScrollPrev(): boolean {\n return isEnabled(this.previous)\n }\n\n /** Whether the next button can be used (it is disabled at the last slide). */\n get canScrollNext(): boolean {\n return isEnabled(this.next)\n }\n\n /** Clicks the previous button, and waits for the carousel to come to rest. */\n async scrollPrev(): Promise<void> {\n await click(this.#button('previous'))\n }\n\n /** Clicks the next button, and waits for the carousel to come to rest. */\n async scrollNext(): Promise<void> {\n await click(this.#button('next'))\n }\n\n /**\n * Presses a key inside the carousel, as a keyboard user does once they have tabbed into it:\n * when focus is outside, it first moves to a button (or anything else) inside that can take\n * it. Returns whether the carousel called `preventDefault()`.\n */\n async press(key: string): Promise<boolean> {\n const root = this.element\n if (!root.contains(root.ownerDocument.activeElement)) {\n const target =\n [this.next, this.previous].find(isEnabled) ?? root.querySelector<HTMLElement>(FOCUSABLE)\n if (target) await focus(target)\n }\n return pressKey(key)\n }\n\n /**\n * Drags the slides with a mouse, `distance` pixels along the carousel's axis (negative is\n * left, or up), and lets go, then waits for the carousel to come to rest.\n */\n async drag(distance: number): Promise<void> {\n const content = this.content\n const target = this.slides[this.currentSlide] ?? content\n const box = content.getBoundingClientRect()\n const x = box.left + box.width / 2\n const y = box.top + box.height / 2\n const vertical = this.orientation === 'vertical'\n const at = (moved: number) =>\n vertical ? { clientX: x, clientY: y + moved } : { clientX: x + moved, clientY: y }\n const document = content.ownerDocument\n const mouse = (node: EventTarget, type: string, moved: number, buttons: number) =>\n node.dispatchEvent(\n new MouseEvent(type, {\n bubbles: true,\n cancelable: true,\n view: document.defaultView,\n button: 0,\n buttons,\n ...at(moved),\n }),\n )\n // One gesture, sent at once: settled() would wait for the drag to end between events.\n mouse(target, 'mousedown', 0, 1)\n for (const share of [0.25, 0.5, 0.75, 1]) mouse(document, 'mousemove', distance * share, 1)\n mouse(document, 'mouseup', distance, 0)\n await settled()\n }\n\n /**\n * Swipes to the next or previous slide: drags the slides most of the content's length, the\n * way that brings that slide in (to the left for the next, or up; to the right right to\n * left), and waits for them to come to rest.\n */\n async swipe(to: 'next' | 'previous'): Promise<void> {\n const content = this.content\n const vertical = this.orientation === 'vertical'\n // Embla moves the slides by the pointer's pixels, so the length is the layout's own.\n const length = (vertical ? content.offsetHeight : content.offsetWidth) * 0.6\n const forward = vertical || this.direction === 'ltr' ? -1 : 1\n await this.drag(length * (to === 'next' ? forward : -forward))\n }\n\n /**\n * Waits until the slide at `index` is in view, as when a plugin (autoplay) moves the\n * carousel on its own. Fails after `timeout` milliseconds (default 5000).\n */\n async waitForSlide(index: number, { timeout = 5000 }: { timeout?: number } = {}): Promise<void> {\n await waitUntil(() => this.slidesInView.includes(index), {\n timeout,\n timeoutMessage: `slide ${index} of ${this} didn't come into view`,\n })\n await settled()\n }\n\n #button(step: 'previous' | 'next'): HTMLButtonElement {\n return this.part<HTMLButtonElement>(step)\n }\n}\n\nfunction isEnabled(button: HTMLButtonElement | null | undefined): button is HTMLButtonElement {\n return Boolean(button) && !button!.disabled && button!.getAttribute('aria-disabled') !== 'true'\n}\n"],"names":["collapse","value","replace","trim","FOCUSABLE","CarouselHarness","Harness","component","orientation","element","getAttribute","direction","getComputedStyle","content","roleDescription","label","split","map","id","ownerDocument","getElementById","filter","found","Boolean","textContent","join","part","container","slides","parts","slideCount","length","slideLabels","slide","slideTexts","slidesInView","view","getBoundingClientRect","vertical","viewStart","viewEnd","top","bottom","left","right","flatMap","index","box","start","end","size","height","width","shown","Math","min","max","currentSlide","previous","queryPart","next","canScrollPrev","isEnabled","canScrollNext","scrollPrev","click","scrollNext","press","key","root","contains","activeElement","target","find","querySelector","focus","pressKey","drag","distance","x","y","at","moved","clientX","clientY","document","mouse","node","type","buttons","dispatchEvent","MouseEvent","bubbles","cancelable","defaultView","button","share","settled","swipe","to","offsetHeight","offsetWidth","forward","waitForSlide","timeout","waitUntil","includes","timeoutMessage","#button","step","disabled"],"mappings":";;;AAGA,MAAMA,QAAQ,GAAIC,KAAgC,IAChD,CAACA,KAAK,IAAI,EAAE,EAAEC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAACC,IAAI,EAAE;;AAE3C;AACA,MAAMC,SAAS,GACb,sIAAsI;;AAExI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,eAAe,SAASC,OAAO,CAAC;EAC3C,OAAgBC,SAAS,GAAG,UAAU;;AAEtC;EACA,IAAIC,WAAWA,GAA8B;AAC3C,IAAA,OAAO,IAAI,CAACC,OAAO,CAACC,YAAY,CAAC,kBAAkB,CAAC,KAAK,UAAU,GAAG,UAAU,GAAG,YAAY;AACjG,EAAA;;AAEA;EACA,IAAIC,SAASA,GAAkB;AAC7B,IAAA,OAAOC,gBAAgB,CAAC,IAAI,CAACC,OAAO,CAAC,CAACF,SAAS,KAAK,KAAK,GAAG,KAAK,GAAG,KAAK;AAC3E,EAAA;;AAEA;EACA,IAAIG,eAAeA,GAAkB;AACnC,IAAA,OAAO,IAAI,CAACL,OAAO,CAACC,YAAY,CAAC,sBAAsB,CAAC;AAC1D,EAAA;;AAEA;EACA,IAAIK,KAAKA,GAAW;AAClB,IAAA,MAAMN,OAAO,GAAG,IAAI,CAACA,OAAO;AAC5B,IAAA,MAAMM,KAAK,GAAGN,OAAO,CAACC,YAAY,CAAC,YAAY,CAAC;AAChD,IAAA,IAAIK,KAAK,EAAE,OAAOA,KAAK,CAACZ,IAAI,EAAE;IAC9B,OAAO,CAACM,OAAO,CAACC,YAAY,CAAC,iBAAiB,CAAC,IAAI,EAAE,EAClDM,KAAK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3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "shadcn/ui's Carousel for Ember: slides with motion, swipe and keyboard control, on Embla Carousel.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ember-addon",
|
|
7
|
+
"ember",
|
|
8
|
+
"shadcn",
|
|
9
|
+
"carousel",
|
|
10
|
+
"slider",
|
|
11
|
+
"embla-carousel"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": "Joe Gaudet <joe@joegaudet.com>",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/joegaudet/ember-joinery.git",
|
|
18
|
+
"directory": "packages/carousel"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://joegaudet.com/ember-joinery/",
|
|
21
|
+
"bugs": "https://github.com/joegaudet/ember-joinery/issues",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./declarations/index.d.ts",
|
|
25
|
+
"default": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./*": {
|
|
28
|
+
"types": "./declarations/*.d.ts",
|
|
29
|
+
"default": "./dist/*.js"
|
|
30
|
+
},
|
|
31
|
+
"./addon-main.js": "./addon-main.cjs"
|
|
32
|
+
},
|
|
33
|
+
"typesVersions": {
|
|
34
|
+
"*": {
|
|
35
|
+
"*": [
|
|
36
|
+
"declarations/*"
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"addon-main.cjs",
|
|
42
|
+
"declarations",
|
|
43
|
+
"dist",
|
|
44
|
+
"README.md",
|
|
45
|
+
"CHANGELOG.md",
|
|
46
|
+
"LICENSE.md",
|
|
47
|
+
"NOTICE"
|
|
48
|
+
],
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@ember/test-waiters": "^4.1.2",
|
|
51
|
+
"@embroider/addon-shim": "^1.10.3",
|
|
52
|
+
"@sindresorhus/is": "^8.1.0",
|
|
53
|
+
"decorator-transforms": "^2.4.0",
|
|
54
|
+
"ember-modifier": "^4.3.0",
|
|
55
|
+
"embla-carousel": "^8.5.2",
|
|
56
|
+
"embla-carousel-reactive-utils": "^8.5.2",
|
|
57
|
+
"lucide": "^0.474.0",
|
|
58
|
+
"@ember-joinery/primitives": "1.0.1"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"@ember/test-helpers": ">= 5.0.0",
|
|
62
|
+
"@glimmer/component": ">= 2.0.0",
|
|
63
|
+
"ember-source": ">= 6.12.0",
|
|
64
|
+
"@ember-joinery/test-support": "^1.0.1",
|
|
65
|
+
"@ember-joinery/ember": "^1.0.1"
|
|
66
|
+
},
|
|
67
|
+
"peerDependenciesMeta": {
|
|
68
|
+
"@ember-joinery/test-support": {
|
|
69
|
+
"optional": true
|
|
70
|
+
},
|
|
71
|
+
"@ember/test-helpers": {
|
|
72
|
+
"optional": true
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"devDependencies": {
|
|
76
|
+
"@babel/core": "^7.29.7",
|
|
77
|
+
"@babel/plugin-transform-typescript": "^7.29.7",
|
|
78
|
+
"@babel/runtime": "^7.29.7",
|
|
79
|
+
"@ember/library-tsconfig": "^3.0.0",
|
|
80
|
+
"@ember/test-helpers": "^5.7.0",
|
|
81
|
+
"@embroider/addon-dev": "^8.4.2",
|
|
82
|
+
"@glimmer/component": "^2.2.1",
|
|
83
|
+
"@glimmer/tracking": "^1.1.2",
|
|
84
|
+
"@glint/ember-tsc": "^1.14.2",
|
|
85
|
+
"@glint/template": "^1.9.0",
|
|
86
|
+
"@rollup/plugin-babel": "^7.1.0",
|
|
87
|
+
"babel-plugin-ember-template-compilation": "^4.0.1",
|
|
88
|
+
"ember-source": "~7.3.0",
|
|
89
|
+
"rollup": "^4.64.6",
|
|
90
|
+
"typescript": "~6.0.3",
|
|
91
|
+
"@ember-joinery/ember": "1.0.1",
|
|
92
|
+
"@ember-joinery/test-support": "1.0.1"
|
|
93
|
+
},
|
|
94
|
+
"publishConfig": {
|
|
95
|
+
"access": "public"
|
|
96
|
+
},
|
|
97
|
+
"engines": {
|
|
98
|
+
"node": ">=22.12.0"
|
|
99
|
+
},
|
|
100
|
+
"ember": {
|
|
101
|
+
"edition": "octane"
|
|
102
|
+
},
|
|
103
|
+
"ember-addon": {
|
|
104
|
+
"version": 2,
|
|
105
|
+
"type": "addon",
|
|
106
|
+
"main": "addon-main.cjs"
|
|
107
|
+
},
|
|
108
|
+
"joinery": {
|
|
109
|
+
"barrels": [
|
|
110
|
+
"src",
|
|
111
|
+
"src/test-support"
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
"scripts": {
|
|
115
|
+
"build": "node ../../scripts/gen-barrels.mjs . && rm -rf declarations && rollup --config",
|
|
116
|
+
"start": "node ../../scripts/gen-barrels.mjs . && rm -rf declarations && rollup --config --watch",
|
|
117
|
+
"typecheck": "node ../../scripts/gen-barrels.mjs . && ember-tsc --noEmit"
|
|
118
|
+
}
|
|
6
119
|
}
|