Skip to content

Commit

Permalink
feat(queries-preview): create queriesPreview module (#670)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnavarroespinosa authored Aug 24, 2022
1 parent 0b04253 commit 317d961
Show file tree
Hide file tree
Showing 13 changed files with 136 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/x-components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export * from './x-modules/history-queries';
export * from './x-modules/identifier-results';
export * from './x-modules/next-queries';
export * from './x-modules/popular-searches';
export * from './x-modules/queries-preview';
export * from './x-modules/query-suggestions';
export * from './x-modules/recommendations';
export * from './x-modules/related-tags';
Expand Down
1 change: 1 addition & 0 deletions packages/x-components/src/store/x.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const RootXStoreModule: Module<XModuleState, any> = {
identifierResults: null,
nextQueries: null,
popularSearches: null,
queriesPreview: null,
querySuggestions: null,
recommendations: null,
relatedTags: null,
Expand Down
3 changes: 3 additions & 0 deletions packages/x-components/src/wiring/events.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { HistoryQueriesXEvents } from '../x-modules/history-queries/events.types
import { IdentifierResultsXEvents } from '../x-modules/identifier-results/events.types';
import { NextQueriesXEvents } from '../x-modules/next-queries/events.types';
import { PopularSearchesXEvents } from '../x-modules/popular-searches/events.types';
import { QueriesPreviewXEvents } from '../x-modules/queries-preview/events.types';
import { QuerySuggestionsXEvents } from '../x-modules/query-suggestions/events.types';
import { RecommendationsXEvents } from '../x-modules/recommendations/events.types';
import { RelatedTagsXEvents } from '../x-modules/related-tags/events.types';
Expand All @@ -34,6 +35,7 @@ import { WireMetadata } from './wiring.types';
* {@link IdentifierResultsXEvents}
* {@link NextQueriesXEvents}
* {@link PopularSearchesXEvents}
* {@link QueriesPreviewXEvents},
* {@link QuerySuggestionsXEvents},
* {@link RecommendationsXEvents}
* {@link RelatedTagsXEvents}
Expand All @@ -54,6 +56,7 @@ export interface XEventsTypes
IdentifierResultsXEvents,
NextQueriesXEvents,
PopularSearchesXEvents,
QueriesPreviewXEvents,
QuerySuggestionsXEvents,
RecommendationsXEvents,
RelatedTagsXEvents,
Expand Down
4 changes: 3 additions & 1 deletion packages/x-components/src/x-modules/extra-params/x-module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { XModule } from '../x-modules.types';
import { extraParamsEmitters, ExtraParamsXStoreModule, extraParamsXStoreModule } from './store';
import { extraParamsEmitters } from './store/emitters';
import { extraParamsXStoreModule } from './store/module';
import { ExtraParamsXStoreModule } from './store/types';
import { extraParamsWiring } from './wiring';

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* Dictionary of the events of QueriesPreview XModule, where each key is the event name, and the
* value is the event payload type or `void` if it has no payload.
*
* @public
*/
export interface QueriesPreviewXEvents {}
4 changes: 4 additions & 0 deletions packages/x-components/src/x-modules/queries-preview/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './events.types';
export * from './store';
export * from './x-module';
export * from './wiring';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { createStoreEmitters } from '../../../store';
import { queriesPreviewXStoreModule } from './module';

/**
* {@link StoreEmitters} For the queries-preview module.
*
* @internal
*/
export const queriesPreviewEmitters = createStoreEmitters(queriesPreviewXStoreModule, {});
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './emitters';
export * from './module';
export * from './types';
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { QueriesPreviewXStoreModule } from './types';

/**
* {@link XStoreModule} For the queries-preview module.
*
* @internal
*/
export const queriesPreviewXStoreModule: QueriesPreviewXStoreModule = {
state: () => ({}),
getters: {},
mutations: {},
actions: {}
};
53 changes: 53 additions & 0 deletions packages/x-components/src/x-modules/queries-preview/store/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { XActionContext, XStoreModule } from '../../../store/index';

/**
* QueriesPreview store state.
*
* @public
*/
export interface QueriesPreviewState {}

/**
* QueriesPreview store getters.
*
* @public
*/
export interface QueriesPreviewGetters {}

/**
* QueriesPreview store mutations.
*
* @public
*/
export interface QueriesPreviewMutations {}

/**
* QueriesPreview store actions.
*
* @public
*/
export interface QueriesPreviewActions {}

/**
* QueriesPreview type safe store module.
*
* @public
*/
export type QueriesPreviewXStoreModule = XStoreModule<
QueriesPreviewState,
QueriesPreviewGetters,
QueriesPreviewMutations,
QueriesPreviewActions
>;

/**
* Alias type for actions context of the {@link QueriesPreviewXStoreModule}.
*
* @public
*/
export type QueriesPreviewActionContext = XActionContext<
QueriesPreviewState,
QueriesPreviewGetters,
QueriesPreviewMutations,
QueriesPreviewActions
>;
8 changes: 8 additions & 0 deletions packages/x-components/src/x-modules/queries-preview/wiring.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { createWiring } from '../../wiring/wiring.utils';

/**
* Wiring configuration for the {@link QueriesPreviewXModule | queriesPreview module}.
*
* @internal
*/
export const queriesPreviewWiring = createWiring({});
25 changes: 25 additions & 0 deletions packages/x-components/src/x-modules/queries-preview/x-module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { XModule } from '../x-modules.types';
import { queriesPreviewEmitters } from './store/emitters';
import { queriesPreviewXStoreModule } from './store/module';
import { QueriesPreviewXStoreModule } from './store/types';
import { queriesPreviewWiring } from './wiring';

/**
* QueriesPreview {@link XModule} alias.
*
* @public
*/
export type QueriesPreviewXModule = XModule<QueriesPreviewXStoreModule>;

/**
* QueriesPreview {@link XModule} implementation. This module is auto-registered as soon as you
* import any component from the `queries-preview` entry point.
*
* @public
*/
export const queriesPreviewXModule: QueriesPreviewXModule = {
name: 'queriesPreview',
storeModule: queriesPreviewXStoreModule,
storeEmitters: queriesPreviewEmitters,
wiring: queriesPreviewWiring
};
8 changes: 6 additions & 2 deletions packages/x-components/src/x-modules/x-modules.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { HistoryQueriesXModule } from './history-queries/x-module';
import { IdentifierResultsXModule } from './identifier-results/x-module';
import { NextQueriesXModule } from './next-queries/x-module';
import { PopularSearchesXModule } from './popular-searches/x-module';
import { QueriesPreviewXModule } from './queries-preview/x-module';
import { QuerySuggestionsXModule } from './query-suggestions/x-module';
import { RecommendationsXModule } from './recommendations/x-module';
import { RelatedTagsXModule } from './related-tags/x-module';
Expand All @@ -32,6 +33,7 @@ export interface XModulesTree {
identifierResults: IdentifierResultsXModule;
nextQueries: NextQueriesXModule;
popularSearches: PopularSearchesXModule;
queriesPreview: QueriesPreviewXModule;
querySuggestions: QuerySuggestionsXModule;
recommendations: RecommendationsXModule;
relatedTags: RelatedTagsXModule;
Expand Down Expand Up @@ -62,8 +64,10 @@ export interface XModule<StoreModule extends AnyXStoreModule> {
storeEmitters: StoreEmitters<StoreModule>;
/** The Vuex Store module associated to this module. */
storeModule: StoreModule;
/** The wiring associated to this module. It must only access to the store module of this
* XModule. */
/**
* The wiring associated to this module. It must only access to the store module of this
* XModule.
*/
wiring: Partial<Wiring>;
}

Expand Down

0 comments on commit 317d961

Please sign in to comment.