Skip to content

Commit 14c67c5

Browse files
committed
fix: align embla hook namespace
1 parent aa7d07d commit 14c67c5

3 files changed

Lines changed: 15 additions & 15 deletions

File tree

docs/API.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,27 @@ import { addFilter } from '@wordpress/hooks';
1414
import AutoHeight from 'embla-carousel-auto-height';
1515

1616
addFilter(
17-
'rtcamp.carouselKit.emblaOptions',
17+
'rtcamp.rtCarousel.emblaOptions',
1818
'my-plugin/custom-options',
1919
( options ) => ( { ...options, duration: 40 } )
2020
);
2121

2222
addFilter(
23-
'rtcamp.carouselKit.emblaPlugins',
23+
'rtcamp.rtCarousel.emblaPlugins',
2424
'my-plugin/auto-height',
2525
( plugins ) => [ ...plugins, AutoHeight() ]
2626
);
2727
```
2828

29-
Both filter callbacks receive the filtered value as their first argument and the filter context object as their second argument. `rtcamp.carouselKit.emblaPlugins` also receives the filtered options on the `options` property of this object.
29+
Both filter callbacks receive the filtered value as their first argument and the filter context object as their second argument. `rtcamp.rtCarousel.emblaPlugins` also receives the filtered options on the `options` property of this object.
3030

3131
rtCarousel also exposes an action after Embla has initialized so integrations can call Embla methods or subscribe to Embla events:
3232

3333
```js
3434
import { addAction } from '@wordpress/hooks';
3535

3636
addAction(
37-
'rtcamp.carouselKit.emblaInit',
37+
'rtcamp.rtCarousel.emblaInit',
3838
'my-plugin/custom-events',
3939
( embla, { root } ) => {
4040
embla.on( 'select', () => {
@@ -50,8 +50,8 @@ addAction(
5050
| `root` | `HTMLElement` | Root `.rt-carousel` element. |
5151
| `viewport` | `HTMLElement` | Embla viewport element. |
5252
| `dynamicListContainer` | `HTMLElement \| null` | Query Loop or Terms Query template container when present. |
53-
| `options` | `EmblaOptionsType` | Passed to `rtcamp.carouselKit.emblaPlugins` and `rtcamp.carouselKit.emblaInit`; contains filtered options. |
54-
| `plugins` | `EmblaPluginType[]` | Only passed to `rtcamp.carouselKit.emblaInit`; contains filtered plugins. |
53+
| `options` | `EmblaOptionsType` | Passed to `rtcamp.rtCarousel.emblaPlugins` and `rtcamp.rtCarousel.emblaInit`; contains filtered options. |
54+
| `plugins` | `EmblaPluginType[]` | Only passed to `rtcamp.rtCarousel.emblaInit`; contains filtered plugins. |
5555

5656
## Context (`CarouselContext`)
5757

src/blocks/carousel/__tests__/view.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -861,10 +861,10 @@ describe( 'Carousel View Module', () => {
861861
mockVisibleViewport( viewport );
862862

863863
const applyFilters = jest.fn( ( hookName, value ) => {
864-
if ( hookName === 'rtcamp.carouselKit.emblaOptions' ) {
864+
if ( hookName === 'rtcamp.rtCarousel.emblaOptions' ) {
865865
return { ...value, duration: 40 };
866866
}
867-
if ( hookName === 'rtcamp.carouselKit.emblaPlugins' ) {
867+
if ( hookName === 'rtcamp.rtCarousel.emblaPlugins' ) {
868868
return [ ...value, extraPlugin ];
869869
}
870870
return value;
@@ -888,7 +888,7 @@ describe( 'Carousel View Module', () => {
888888
expect( applyFilters ).toHaveBeenCalledTimes( 2 );
889889
expect( applyFilters ).toHaveBeenNthCalledWith(
890890
1,
891-
'rtcamp.carouselKit.emblaOptions',
891+
'rtcamp.rtCarousel.emblaOptions',
892892
expect.objectContaining( { duration: 25 } ),
893893
expect.objectContaining( { context: mockContext, root: wrapper, viewport } ),
894894
);
@@ -898,7 +898,7 @@ describe( 'Carousel View Module', () => {
898898
[ extraPlugin ],
899899
);
900900
expect( doAction ).toHaveBeenCalledWith(
901-
'rtcamp.carouselKit.emblaInit',
901+
'rtcamp.rtCarousel.emblaInit',
902902
mockEmbla,
903903
expect.objectContaining( {
904904
context: mockContext,
@@ -923,7 +923,7 @@ describe( 'Carousel View Module', () => {
923923
const mockEmbla = createMockEmblaInstance();
924924
const originalIntersectionObserver = window.IntersectionObserver;
925925
const applyFilters = jest.fn( ( hookName, value ) => {
926-
if ( hookName === 'rtcamp.carouselKit.emblaOptions' ) {
926+
if ( hookName === 'rtcamp.rtCarousel.emblaOptions' ) {
927927
return undefined;
928928
}
929929
return value;
@@ -968,7 +968,7 @@ describe( 'Carousel View Module', () => {
968968
const mockEmbla = createMockEmblaInstance();
969969
const originalIntersectionObserver = window.IntersectionObserver;
970970
const applyFilters = jest.fn( ( hookName, value ) => {
971-
if ( hookName === 'rtcamp.carouselKit.emblaPlugins' ) {
971+
if ( hookName === 'rtcamp.rtCarousel.emblaPlugins' ) {
972972
return 'not-an-array';
973973
}
974974
return value;

src/blocks/carousel/view.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,13 @@ store( 'rt-carousel/carousel', {
371371
};
372372

373373
const filteredOptions = applyEmblaFilter(
374-
'rtcamp.carouselKit.emblaOptions',
374+
'rtcamp.rtCarousel.emblaOptions',
375375
options,
376376
filterContext,
377377
);
378378

379379
const filteredPlugins = applyEmblaFilter(
380-
'rtcamp.carouselKit.emblaPlugins',
380+
'rtcamp.rtCarousel.emblaPlugins',
381381
plugins,
382382
{ ...filterContext, options: filteredOptions },
383383
);
@@ -424,7 +424,7 @@ store( 'rt-carousel/carousel', {
424424

425425
updateState();
426426
doEmblaAction(
427-
'rtcamp.carouselKit.emblaInit',
427+
'rtcamp.rtCarousel.emblaInit',
428428
embla,
429429
{
430430
...filterContext,

0 commit comments

Comments
 (0)