Skip to content

Commit 79802da

Browse files
committed
fix: align embla hook namespace
1 parent 6a2b1e8 commit 79802da

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
@@ -810,10 +810,10 @@ describe( 'Carousel View Module', () => {
810810
mockVisibleViewport( viewport );
811811

812812
const applyFilters = jest.fn( ( hookName, value ) => {
813-
if ( hookName === 'rtcamp.carouselKit.emblaOptions' ) {
813+
if ( hookName === 'rtcamp.rtCarousel.emblaOptions' ) {
814814
return { ...value, duration: 40 };
815815
}
816-
if ( hookName === 'rtcamp.carouselKit.emblaPlugins' ) {
816+
if ( hookName === 'rtcamp.rtCarousel.emblaPlugins' ) {
817817
return [ ...value, extraPlugin ];
818818
}
819819
return value;
@@ -837,7 +837,7 @@ describe( 'Carousel View Module', () => {
837837
expect( applyFilters ).toHaveBeenCalledTimes( 2 );
838838
expect( applyFilters ).toHaveBeenNthCalledWith(
839839
1,
840-
'rtcamp.carouselKit.emblaOptions',
840+
'rtcamp.rtCarousel.emblaOptions',
841841
expect.objectContaining( { duration: 25 } ),
842842
expect.objectContaining( { context: mockContext, root: wrapper, viewport } ),
843843
);
@@ -847,7 +847,7 @@ describe( 'Carousel View Module', () => {
847847
[ extraPlugin ],
848848
);
849849
expect( doAction ).toHaveBeenCalledWith(
850-
'rtcamp.carouselKit.emblaInit',
850+
'rtcamp.rtCarousel.emblaInit',
851851
mockEmbla,
852852
expect.objectContaining( {
853853
context: mockContext,
@@ -872,7 +872,7 @@ describe( 'Carousel View Module', () => {
872872
const mockEmbla = createMockEmblaInstance();
873873
const originalIntersectionObserver = window.IntersectionObserver;
874874
const applyFilters = jest.fn( ( hookName, value ) => {
875-
if ( hookName === 'rtcamp.carouselKit.emblaOptions' ) {
875+
if ( hookName === 'rtcamp.rtCarousel.emblaOptions' ) {
876876
return undefined;
877877
}
878878
return value;
@@ -917,7 +917,7 @@ describe( 'Carousel View Module', () => {
917917
const mockEmbla = createMockEmblaInstance();
918918
const originalIntersectionObserver = window.IntersectionObserver;
919919
const applyFilters = jest.fn( ( hookName, value ) => {
920-
if ( hookName === 'rtcamp.carouselKit.emblaPlugins' ) {
920+
if ( hookName === 'rtcamp.rtCarousel.emblaPlugins' ) {
921921
return 'not-an-array';
922922
}
923923
return value;

src/blocks/carousel/view.ts

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

332332
const filteredOptions = applyEmblaFilter(
333-
'rtcamp.carouselKit.emblaOptions',
333+
'rtcamp.rtCarousel.emblaOptions',
334334
options,
335335
filterContext,
336336
);
337337

338338
const filteredPlugins = applyEmblaFilter(
339-
'rtcamp.carouselKit.emblaPlugins',
339+
'rtcamp.rtCarousel.emblaPlugins',
340340
plugins,
341341
{ ...filterContext, options: filteredOptions },
342342
);
@@ -383,7 +383,7 @@ store( 'rt-carousel/carousel', {
383383

384384
updateState();
385385
doEmblaAction(
386-
'rtcamp.carouselKit.emblaInit',
386+
'rtcamp.rtCarousel.emblaInit',
387387
embla,
388388
{
389389
...filterContext,

0 commit comments

Comments
 (0)