@empathyco/x-components 3.0.0-alpha.141 → 3.0.0-alpha.142
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 +13 -0
- package/core/index.d.ts +0 -1
- package/core/index.js +0 -1
- package/core/index.js.map +1 -1
- package/design-system/default-theme.css +13 -13
- package/design-system/full-theme.css +57 -58
- package/docs/API-reference/api/x-components.md +0 -1
- package/js/index.js +0 -1
- package/js/index.js.map +1 -1
- package/js/plugins/x-plugin.js +0 -10
- package/js/plugins/x-plugin.js.map +1 -1
- package/package.json +2 -2
- package/report/x-components.api.json +0 -63
- package/report/x-components.api.md +0 -5
- package/types/index.d.ts +0 -1
- package/types/index.d.ts.map +1 -1
- package/types/plugins/x-plugin.d.ts +0 -6
- package/types/plugins/x-plugin.d.ts.map +1 -1
- package/docs/API-reference/api/x-components.compilemessage.md +0 -27
- package/js/filters/compile-message.filter.js +0 -26
- package/js/filters/compile-message.filter.js.map +0 -1
- package/js/filters/filters.registry.js +0 -9
- package/js/filters/filters.registry.js.map +0 -1
- package/types/filters/compile-message.filter.d.ts +0 -11
- package/types/filters/compile-message.filter.d.ts.map +0 -1
- package/types/filters/filters.registry.d.ts +0 -7
- package/types/filters/filters.registry.d.ts.map +0 -1
- package/types/filters/index.d.ts +0 -2
- package/types/filters/index.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See
|
|
4
4
|
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.0.0-alpha.142](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.141...@empathyco/x-components@3.0.0-alpha.142) (2022-07-29)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- Remove vue filters (#635)
|
|
11
|
+
([5026e84](https://github.com/empathyco/x/commit/5026e84b7dec3a283af8fdd2f68f84b49d332911)),
|
|
12
|
+
closes [EX-6508](https://searchbroker.atlassian.net/browse/EX-6508)
|
|
13
|
+
|
|
14
|
+
# Change Log
|
|
15
|
+
|
|
16
|
+
All notable changes to this project will be documented in this file. See
|
|
17
|
+
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
18
|
+
|
|
6
19
|
## [3.0.0-alpha.141](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.140...@empathyco/x-components@3.0.0-alpha.141) (2022-07-28)
|
|
7
20
|
|
|
8
21
|
### Features
|
package/core/index.d.ts
CHANGED
package/core/index.js
CHANGED
|
@@ -125,7 +125,6 @@ export { ItemsListInjectionMixin } from '../js/components/items-list-injection.m
|
|
|
125
125
|
export { xComponentMixin } from '../js/components/x-component.mixin.js';
|
|
126
126
|
export { getXComponentXModuleName, isXComponent } from '../js/components/x-component.utils.js';
|
|
127
127
|
export { infiniteScroll } from '../js/directives/infinite-scroll/infinite-scroll.js';
|
|
128
|
-
export { compileMessage } from '../js/filters/compile-message.filter.js';
|
|
129
128
|
export { BaseXBus, bus } from '../js/plugins/x-bus.js';
|
|
130
129
|
export { XPlugin, xPlugin } from '../js/plugins/x-plugin.js';
|
|
131
130
|
export { createXComponentAPIMixin, getBusAPI, getRootXComponent } from '../js/plugins/x-plugin.mixin.js';
|
package/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -2858,19 +2858,6 @@
|
|
|
2858
2858
|
--x-size-border-radius-base-pill: 99999px;
|
|
2859
2859
|
--x-size-border-width-base: 1px;
|
|
2860
2860
|
}
|
|
2861
|
-
:root {
|
|
2862
|
-
--x-color-base-lead: #36515b;
|
|
2863
|
-
--x-color-base-auxiliary: #667981;
|
|
2864
|
-
--x-color-base-neutral-10: #1a1a1a;
|
|
2865
|
-
--x-color-base-neutral-35: #595959;
|
|
2866
|
-
--x-color-base-neutral-70: #b3b3b3;
|
|
2867
|
-
--x-color-base-neutral-95: #f2f2f2;
|
|
2868
|
-
--x-color-base-neutral-100: #ffffff;
|
|
2869
|
-
--x-color-base-accent: #b90276;
|
|
2870
|
-
--x-color-base-enable: #00705c;
|
|
2871
|
-
--x-color-base-disable: #e11f26;
|
|
2872
|
-
--x-color-base-transparent: transparent;
|
|
2873
|
-
}
|
|
2874
2861
|
:root {
|
|
2875
2862
|
--x-size-base-01: 2px;
|
|
2876
2863
|
--x-size-base-02: 4px;
|
|
@@ -2906,4 +2893,17 @@
|
|
|
2906
2893
|
--x-size-line-height-base-s: 16px;
|
|
2907
2894
|
--x-size-line-height-base-m: 24px;
|
|
2908
2895
|
--x-size-line-height-base-l: 32px;
|
|
2896
|
+
}
|
|
2897
|
+
:root {
|
|
2898
|
+
--x-color-base-lead: #36515b;
|
|
2899
|
+
--x-color-base-auxiliary: #667981;
|
|
2900
|
+
--x-color-base-neutral-10: #1a1a1a;
|
|
2901
|
+
--x-color-base-neutral-35: #595959;
|
|
2902
|
+
--x-color-base-neutral-70: #b3b3b3;
|
|
2903
|
+
--x-color-base-neutral-95: #f2f2f2;
|
|
2904
|
+
--x-color-base-neutral-100: #ffffff;
|
|
2905
|
+
--x-color-base-accent: #b90276;
|
|
2906
|
+
--x-color-base-enable: #00705c;
|
|
2907
|
+
--x-color-base-disable: #e11f26;
|
|
2908
|
+
--x-color-base-transparent: transparent;
|
|
2909
2909
|
}
|
|
@@ -898,6 +898,20 @@
|
|
|
898
898
|
--x-size-border-width-bottom-facet-header-line: var(--x-size-border-width-facet-header-line);
|
|
899
899
|
--x-size-border-width-left-facet-header-line: 0;
|
|
900
900
|
}
|
|
901
|
+
.x-facet--outlined.x-facet,
|
|
902
|
+
.x-facet--outlined .x-facet {
|
|
903
|
+
--x-color-border-facet-default: var(--x-color-border-facet-outlined);
|
|
904
|
+
--x-size-border-width-facet-default: var(--x-size-border-width-facet-outlined);
|
|
905
|
+
--x-size-border-width-top-facet-default: var(--x-size-border-width-top-facet-outlined);
|
|
906
|
+
--x-size-border-width-right-facet-default: var(--x-size-border-width-right-facet-outlined);
|
|
907
|
+
--x-size-border-width-bottom-facet-default: var(--x-size-border-width-bottom-facet-outlined);
|
|
908
|
+
--x-size-border-width-left-facet-default: var(--x-size-border-width-left-facet-outlined);
|
|
909
|
+
--x-size-padding-facet-header-default: var(--x-size-padding-facet-header-outlined);
|
|
910
|
+
--x-size-padding-top-facet-header-default: var(--x-size-padding-top-facet-header-outlined);
|
|
911
|
+
--x-size-padding-right-facet-header-default: var(--x-size-padding-right-facet-header-outlined);
|
|
912
|
+
--x-size-padding-bottom-facet-header-default: var(--x-size-padding-bottom-facet-header-outlined);
|
|
913
|
+
--x-size-padding-left-facet-header-default: var(--x-size-padding-left-facet-header-outlined);
|
|
914
|
+
}
|
|
901
915
|
:root {
|
|
902
916
|
--x-color-border-facet-outlined: var(--x-color-base-neutral-70);
|
|
903
917
|
--x-size-border-width-facet-outlined: var(--x-size-border-width-base);
|
|
@@ -6454,49 +6468,6 @@
|
|
|
6454
6468
|
.x-self-baseline {
|
|
6455
6469
|
align-self: baseline !important;
|
|
6456
6470
|
}
|
|
6457
|
-
.x-font-color--lead {
|
|
6458
|
-
color: var(--x-color-base-lead) !important;
|
|
6459
|
-
}
|
|
6460
|
-
|
|
6461
|
-
.x-font-color--auxiliary {
|
|
6462
|
-
color: var(--x-color-base-auxiliary) !important;
|
|
6463
|
-
}
|
|
6464
|
-
|
|
6465
|
-
.x-font-color--neutral-10 {
|
|
6466
|
-
color: var(--x-color-base-neutral-10) !important;
|
|
6467
|
-
}
|
|
6468
|
-
|
|
6469
|
-
.x-font-color--neutral-35 {
|
|
6470
|
-
color: var(--x-color-base-neutral-35) !important;
|
|
6471
|
-
}
|
|
6472
|
-
|
|
6473
|
-
.x-font-color--neutral-70 {
|
|
6474
|
-
color: var(--x-color-base-neutral-70) !important;
|
|
6475
|
-
}
|
|
6476
|
-
|
|
6477
|
-
.x-font-color--neutral-95 {
|
|
6478
|
-
color: var(--x-color-base-neutral-95) !important;
|
|
6479
|
-
}
|
|
6480
|
-
|
|
6481
|
-
.x-font-color--neutral-100 {
|
|
6482
|
-
color: var(--x-color-base-neutral-100) !important;
|
|
6483
|
-
}
|
|
6484
|
-
|
|
6485
|
-
.x-font-color--accent {
|
|
6486
|
-
color: var(--x-color-base-accent) !important;
|
|
6487
|
-
}
|
|
6488
|
-
|
|
6489
|
-
.x-font-color--enable {
|
|
6490
|
-
color: var(--x-color-base-enable) !important;
|
|
6491
|
-
}
|
|
6492
|
-
|
|
6493
|
-
.x-font-color--disable {
|
|
6494
|
-
color: var(--x-color-base-disable) !important;
|
|
6495
|
-
}
|
|
6496
|
-
|
|
6497
|
-
.x-font-color--transparent {
|
|
6498
|
-
color: var(--x-color-base-transparent) !important;
|
|
6499
|
-
}
|
|
6500
6471
|
.x-font-size--01 {
|
|
6501
6472
|
font-size: var(--x-size-base-01) !important;
|
|
6502
6473
|
line-height: 1.5;
|
|
@@ -6643,6 +6614,49 @@
|
|
|
6643
6614
|
.x-line-height--loose {
|
|
6644
6615
|
line-height: 2 !important;
|
|
6645
6616
|
}
|
|
6617
|
+
.x-font-color--lead {
|
|
6618
|
+
color: var(--x-color-base-lead) !important;
|
|
6619
|
+
}
|
|
6620
|
+
|
|
6621
|
+
.x-font-color--auxiliary {
|
|
6622
|
+
color: var(--x-color-base-auxiliary) !important;
|
|
6623
|
+
}
|
|
6624
|
+
|
|
6625
|
+
.x-font-color--neutral-10 {
|
|
6626
|
+
color: var(--x-color-base-neutral-10) !important;
|
|
6627
|
+
}
|
|
6628
|
+
|
|
6629
|
+
.x-font-color--neutral-35 {
|
|
6630
|
+
color: var(--x-color-base-neutral-35) !important;
|
|
6631
|
+
}
|
|
6632
|
+
|
|
6633
|
+
.x-font-color--neutral-70 {
|
|
6634
|
+
color: var(--x-color-base-neutral-70) !important;
|
|
6635
|
+
}
|
|
6636
|
+
|
|
6637
|
+
.x-font-color--neutral-95 {
|
|
6638
|
+
color: var(--x-color-base-neutral-95) !important;
|
|
6639
|
+
}
|
|
6640
|
+
|
|
6641
|
+
.x-font-color--neutral-100 {
|
|
6642
|
+
color: var(--x-color-base-neutral-100) !important;
|
|
6643
|
+
}
|
|
6644
|
+
|
|
6645
|
+
.x-font-color--accent {
|
|
6646
|
+
color: var(--x-color-base-accent) !important;
|
|
6647
|
+
}
|
|
6648
|
+
|
|
6649
|
+
.x-font-color--enable {
|
|
6650
|
+
color: var(--x-color-base-enable) !important;
|
|
6651
|
+
}
|
|
6652
|
+
|
|
6653
|
+
.x-font-color--disable {
|
|
6654
|
+
color: var(--x-color-base-disable) !important;
|
|
6655
|
+
}
|
|
6656
|
+
|
|
6657
|
+
.x-font-color--transparent {
|
|
6658
|
+
color: var(--x-color-base-transparent) !important;
|
|
6659
|
+
}
|
|
6646
6660
|
.x-margin--auto {
|
|
6647
6661
|
margin: auto !important;
|
|
6648
6662
|
}
|
|
@@ -7599,18 +7613,3 @@
|
|
|
7599
7613
|
.x-normal-case {
|
|
7600
7614
|
text-transform: none;
|
|
7601
7615
|
}
|
|
7602
|
-
|
|
7603
|
-
.x-facet--outlined.x-facet,
|
|
7604
|
-
.x-facet--outlined .x-facet {
|
|
7605
|
-
--x-color-border-facet-default: var(--x-color-border-facet-outlined);
|
|
7606
|
-
--x-size-border-width-facet-default: var(--x-size-border-width-facet-outlined);
|
|
7607
|
-
--x-size-border-width-top-facet-default: var(--x-size-border-width-top-facet-outlined);
|
|
7608
|
-
--x-size-border-width-right-facet-default: var(--x-size-border-width-right-facet-outlined);
|
|
7609
|
-
--x-size-border-width-bottom-facet-default: var(--x-size-border-width-bottom-facet-outlined);
|
|
7610
|
-
--x-size-border-width-left-facet-default: var(--x-size-border-width-left-facet-outlined);
|
|
7611
|
-
--x-size-padding-facet-header-default: var(--x-size-padding-facet-header-outlined);
|
|
7612
|
-
--x-size-padding-top-facet-header-default: var(--x-size-padding-top-facet-header-outlined);
|
|
7613
|
-
--x-size-padding-right-facet-header-default: var(--x-size-padding-right-facet-header-outlined);
|
|
7614
|
-
--x-size-padding-bottom-facet-header-default: var(--x-size-padding-bottom-facet-header-outlined);
|
|
7615
|
-
--x-size-padding-left-facet-header-default: var(--x-size-padding-left-facet-header-outlined);
|
|
7616
|
-
}
|
|
@@ -150,7 +150,6 @@ X-Components is a library usable everywhere not only for search experiences.
|
|
|
150
150
|
| [arrayToObject(array, key)](./x-components.arraytoobject_1.md) | Reduce an array of objects to an object which properties names are the value of each object\[key\], and the value under that property are each object. 'key' is the the parameter passed to this function. |
|
|
151
151
|
| [capitalize(str)](./x-components.capitalize.md) | Util to capitalize a string . |
|
|
152
152
|
| [clone(something)](./x-components.clone.md) | Deeply clones an object or an array. |
|
|
153
|
-
| [compileMessage(message, params)](./x-components.compilemessage.md) | Replaces each key in compiledMessage for the provided key's value. |
|
|
154
153
|
| [createCollapseAnimationMixin(property)](./x-components.createcollapseanimationmixin.md) | Adds parametrized methods to a component to allow the collapsing of the provided property. |
|
|
155
154
|
| [createFetchAndSaveActions({ fetch, onSuccess, onError, onCancel })](./x-components.createfetchandsaveactions.md) | Utility to create an action that requests and save some data asynchronously, with the option to cancel the request at any moment. This factory provides with the standard flow for requesting, cancelling, handling errors for a module, while also taking care of its status. |
|
|
156
155
|
| [createRawFilters(filterIds)](./x-components.createrawfilters.md) | Helper method which creates the filter entity from the filter ir of the url. |
|
package/js/index.js
CHANGED
|
@@ -125,7 +125,6 @@ export { ItemsListInjectionMixin } from './components/items-list-injection.mixin
|
|
|
125
125
|
export { xComponentMixin } from './components/x-component.mixin.js';
|
|
126
126
|
export { getXComponentXModuleName, isXComponent } from './components/x-component.utils.js';
|
|
127
127
|
export { infiniteScroll } from './directives/infinite-scroll/infinite-scroll.js';
|
|
128
|
-
export { compileMessage } from './filters/compile-message.filter.js';
|
|
129
128
|
export { BaseXBus, bus } from './plugins/x-bus.js';
|
|
130
129
|
export { XPlugin, xPlugin } from './plugins/x-plugin.js';
|
|
131
130
|
export { createXComponentAPIMixin, getBusAPI, getRootXComponent } from './plugins/x-plugin.mixin.js';
|
package/js/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/js/plugins/x-plugin.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { deepMerge } from '@empathyco/x-deep-merge';
|
|
2
2
|
import { forEach } from '@empathyco/x-utils';
|
|
3
3
|
import Vuex, { Store } from 'vuex';
|
|
4
|
-
import { FILTERS_REGISTRY } from '../filters/filters.registry.js';
|
|
5
4
|
import { cleanGettersProxyCache } from '../store/utils/getters-proxy.utils.js';
|
|
6
5
|
import { RootXStoreModule } from '../store/x.module.js';
|
|
7
6
|
import { bus } from './x-bus.js';
|
|
@@ -147,7 +146,6 @@ class XPlugin {
|
|
|
147
146
|
this.adapter = options.adapter;
|
|
148
147
|
this.registerStore();
|
|
149
148
|
this.applyMixins();
|
|
150
|
-
this.registerFilters();
|
|
151
149
|
this.registerInitialModules();
|
|
152
150
|
this.registerPendingXModules();
|
|
153
151
|
this.isInstalled = true;
|
|
@@ -303,14 +301,6 @@ class XPlugin {
|
|
|
303
301
|
});
|
|
304
302
|
XPlugin.pendingXModules = {};
|
|
305
303
|
}
|
|
306
|
-
/**
|
|
307
|
-
* Registers filters globally.
|
|
308
|
-
*
|
|
309
|
-
* @internal
|
|
310
|
-
*/
|
|
311
|
-
registerFilters() {
|
|
312
|
-
forEach(FILTERS_REGISTRY, (filterName, filterFunction) => this.vue.filter(filterName, filterFunction));
|
|
313
|
-
}
|
|
314
304
|
}
|
|
315
305
|
/**
|
|
316
306
|
* Record of modules that have been tried to be installed before the installation of the plugin.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"x-plugin.js","sources":["../../../src/plugins/x-plugin.ts"],"sourcesContent":["import { deepMerge } from '@empathyco/x-deep-merge';\nimport { forEach, Dictionary } from '@empathyco/x-utils';\nimport { PluginObject, VueConstructor } from 'vue';\nimport Vuex, { Module, Store } from 'vuex';\nimport { XComponentsAdapter } from '@empathyco/x-types';\nimport { FILTERS_REGISTRY } from '../filters/filters.registry';\nimport { AnyXStoreModule, RootXStoreState } from '../store/store.types';\nimport { cleanGettersProxyCache } from '../store/utils/getters-proxy.utils';\nimport { RootXStoreModule } from '../store/x.module';\nimport { AnyWire } from '../wiring/wiring.types';\nimport { AnyXModule, XModuleName } from '../x-modules/x-modules.types';\nimport { bus } from './x-bus';\nimport { XBus } from './x-bus.types';\nimport { registerStoreEmitters } from './x-emitters';\nimport { createXComponentAPIMixin } from './x-plugin.mixin';\nimport { AnyXStoreModuleOption, XModuleOptions, XPluginOptions } from './x-plugin.types';\nimport { assertXPluginOptionsAreValid } from './x-plugin.utils';\n\n/**\n * Vue plugin that initializes the properties needed by the x-components, and exposes the events bus\n * and the adapter after it has been installed.\n *\n * @public\n */\nexport class XPlugin implements PluginObject<XPluginOptions> {\n /**\n * {@link @empathyco/x-typesm#XComponentsAdapter | XComponentsAdapter} Is the middleware\n * between the components and our API where data can be mapped to client needs.\n * This property is only available after installing the plugin.\n *\n * @returns The installed adapter.\n * @throws If this property is accessed before calling `Vue.use(xPlugin)`.\n * @public\n */\n public static get adapter(): XComponentsAdapter {\n return this.getInstance().adapter;\n }\n\n /**\n * Exposed {@link XBus}, so any kind of application can subscribe to {@link XEventsTypes}\n * without having to pass through a component.\n * This property is only available after installing the plugin.\n *\n * @returns The installed bus.\n * @throws If this property is accessed before calling `Vue.use(xPlugin)`.\n * @public\n */\n public static get bus(): XBus {\n return this.getInstance().bus;\n }\n\n /**\n * {@link https://vuex.vuejs.org | Vuex Store} Is the place where all shared data\n * is saved.\n *\n * @returns The installed store.\n * @throws If this property is accessed before calling `Vue.use(xPlugin)`.\n * @public\n */\n public static get store(): Store<RootXStoreState> {\n return this.getInstance().store;\n }\n\n /**\n * Safely retrieves the installed instance of the XPlugin.\n *\n * @returns The installed instance of the XPlugin.\n * @throws If this method is called before calling `Vue.use(xPlugin)`.\n * @internal\n */\n protected static getInstance(): XPlugin {\n if (!this.instance) {\n throw Error(\"XPlugin must be installed before accessing it's API.\");\n }\n return this.instance;\n }\n\n /**\n * Record of modules that have been tried to be installed before the installation of the plugin.\n *\n * @internal\n */\n protected static pendingXModules: Partial<Record<XModuleName, AnyXModule>> = {};\n\n /**\n * Instance of the installed plugin. Used to expose the bus and the adapter.\n *\n * @internal\n */\n protected static instance?: XPlugin;\n\n /**\n * Bus for retrieving the observables when registering the wiring.\n *\n * @internal\n */\n protected bus: XBus;\n\n /**\n * Adapter for the API, responsible for transforming requests and responses.\n *\n * @internal\n */\n protected adapter!: XComponentsAdapter;\n\n /**\n * Set of the already installed {@link XModule | XModules} to avoid re-registering them.\n *\n * @internal\n */\n protected installedXModules = new Set<string>();\n\n /**\n * True if the plugin has been installed in a Vue instance, in this case\n * {@link XModule |Xmodules} will be installed immediately. False otherwise, in this case\n * {@link XModule | XModules} will be installed lazily when the {@link XPlugin#install} method\n * is called.\n *\n * @internal\n */\n protected isInstalled = false;\n\n /**\n * The installation options of the plugin, where all the customization of\n * {@link XModule | XModules} is done.\n *\n * @internal\n */\n protected options!: XPluginOptions;\n\n /**\n * The Vuex store, to pass to the wires for its registration, and to register the store\n * modules on it.\n *\n * @internal\n */\n protected store!: Store<any>;\n /**\n * The global Vue, passed by the installation method. Used to apply the global mixin\n * {@link createXComponentAPIMixin}, and install the {@link https://vuex.vuejs.org/ | Vuex}\n * plugin.\n *\n * @internal\n */\n protected vue!: VueConstructor;\n\n /**\n * Creates a new instance of the XPlugin with the given bus passed as parameter.\n *\n * @param bus - The {@link XBus} implementation to use for the plugin.\n *\n * @public\n */\n public constructor(bus: XBus) {\n this.bus = bus;\n }\n\n /**\n * If the plugin has already been installed, it immediately registers a {@link XModule}. If it\n * has not been installed yet, it stores the module in a list until the plugin is installed.\n *\n * @param xModule - The module to register.\n *\n * @public\n */\n static registerXModule(xModule: AnyXModule): void {\n if (this.instance) {\n this.instance.registerXModule(xModule);\n } else {\n this.lazyRegisterXModule(xModule);\n }\n }\n\n /**\n * Utility method for resetting the installed instance of the plugin.\n *\n * @remarks Use only for testing.\n *\n * @internal\n */\n static resetInstance(): void {\n cleanGettersProxyCache();\n this.instance = undefined;\n }\n\n /**\n * Stores the {@link XModule} in a dictionary, so it can be registered later in the installation\n * process.\n *\n * @param xModule - The module to register.\n *\n * @internal\n */\n protected static lazyRegisterXModule(xModule: AnyXModule): void {\n this.pendingXModules[xModule.name] = xModule;\n }\n\n /**\n * Installs the plugin into the Vue instance.\n *\n * @param vue - The GlobalVue object.\n * @param options - The options to install this plugin with.\n * @throws If the XPlugin has already been installed, or the options are not valid.\n *\n * @internal\n */\n install(vue: VueConstructor, options?: XPluginOptions): void {\n if (this.isInstalled) {\n throw new Error('XPlugin has already been installed');\n }\n assertXPluginOptionsAreValid(options);\n XPlugin.instance = this;\n this.vue = vue;\n this.options = options;\n this.adapter = options.adapter;\n this.registerStore();\n this.applyMixins();\n this.registerFilters();\n this.registerInitialModules();\n this.registerPendingXModules();\n this.isInstalled = true;\n }\n\n /**\n * Performs the registration of a {@link XModule}.\n *\n * @param xModule - The module to register.\n *\n * @internal\n */\n protected registerXModule(xModule: AnyXModule): void {\n if (!this.installedXModules.has(xModule.name)) {\n const customizedXModule = this.customizeXModule(xModule);\n this.registerStoreModule(customizedXModule);\n this.registerStoreEmitters(customizedXModule);\n // The wiring must be registered after the store emitters\n // to allow lazy loaded modules work properly.\n this.registerWiring(customizedXModule);\n this.installedXModules.add(xModule.name);\n }\n }\n\n /**\n * Performs a customization of a {@link XModule} using the XPlugin public and private options.\n *\n * @param xModule - The module to customize.\n * @returns The customized xModule.\n *\n * @internal\n */\n protected customizeXModule({\n name,\n wiring,\n storeModule,\n storeEmitters,\n ...restXModule\n }: AnyXModule): AnyXModule {\n const { wiring: wiringOptions, config }: XModuleOptions<XModuleName> =\n this.options.xModules?.[name] ?? {};\n\n const { storeModule: storeModuleOptions, storeEmitters: emittersOptions } =\n this.options.__PRIVATE__xModules?.[name] ?? {};\n\n return {\n name,\n wiring: wiringOptions ? deepMerge({}, wiring, wiringOptions) : wiring,\n storeModule: this.customizeStoreModule(storeModule, storeModuleOptions ?? {}, config),\n storeEmitters: emittersOptions\n ? deepMerge({}, storeEmitters, emittersOptions)\n : storeEmitters,\n ...restXModule\n };\n }\n\n /**\n * Performs the registration of the wiring, retrieving the observable for each event, and\n * executing each wire.\n *\n * @param xModule - The {@link XModule} to register its wiring.\n *\n * @internal\n */\n protected registerWiring({ wiring }: AnyXModule): void {\n forEach(wiring, (event, wires: Dictionary<AnyWire>) => {\n // Obtain the observable\n const observable = this.bus.on(event, true);\n // Register event wires\n forEach(wires, (_, wire) => {\n wire(observable, this.store, this.bus.on.bind(this.bus));\n });\n });\n }\n\n /**\n * Registers a {@link https://vuex.vuejs.org/ | Vuex} store module under the 'x' module.\n *\n * @param xModule - The {@link XModule} to register its Store Module.\n *\n * @internal\n */\n protected registerStoreModule({ name, storeModule }: AnyXModule): void {\n (storeModule as Module<any, any>).namespaced = true;\n this.store.registerModule(['x', name], storeModule);\n }\n\n /**\n * Overrides a {@link https://vuex.vuejs.org/ | Vuex} store module definition.\n *\n * Priority of configuration merging.\n * 1st {@link XPluginOptions.xModules | xModules XPlugin option}.\n * 2nd {@link XPluginOptions.__PRIVATE__xModules | Private xModules XPlugin option}.\n * 3rd {@link XStoreModule.state | Default state of the xModule}.\n *\n * @param defaultModule - The default store module to override.\n * @param moduleOptions - The state, actions, mutations and getters to override the defaultModule.\n * @param configOptions - The state config to override the moduleOptions.\n * @returns The {@link XStoreModule} customized.\n *\n * @internal\n */\n protected customizeStoreModule(\n { state: defaultState, ...actionsGettersMutations }: AnyXStoreModule,\n { state: xModuleState, ...newActionsGettersMutations }: AnyXStoreModuleOption,\n configOptions: unknown\n ): AnyXStoreModule {\n const configOptionsObject = configOptions ? { config: configOptions } : {};\n const customizedModule = deepMerge({}, actionsGettersMutations, newActionsGettersMutations);\n customizedModule.state = deepMerge(defaultState(), xModuleState, configOptionsObject);\n return customizedModule;\n }\n\n /**\n * Registers the store emitters, making them emit the event when the part of the state selected\n * changes.\n *\n * @param xModule - The {@link XModule} to register its Store Emitters.\n *\n * @internal\n */\n protected registerStoreEmitters(xModule: AnyXModule): void {\n registerStoreEmitters(xModule, this.bus, this.store);\n }\n\n /**\n * Registers the {@link https://vuex.vuejs.org/ | Vuex} store. If the store has not been passed\n * through the {@link XPluginOptions} object, it creates one, and injects it in the Vue\n * prototype. Then it registers an x module in the store, to safe scope all the\n * {@link XModule | XModules} dynamically installed.\n *\n * @internal\n */\n protected registerStore(): void {\n this.vue.use(Vuex); // We can safely install Vuex because if it is already installed Vue\n // will simply ignore it\n this.store =\n this.options.store ??\n new Store({\n strict: process.env.NODE_ENV !== 'production'\n });\n if (!this.options.store) {\n this.vue.prototype.$store = this.store;\n }\n this.store.registerModule('x', RootXStoreModule);\n }\n\n /**\n * Applies the {@link createXComponentAPIMixin} mixin in the global Vue.\n *\n * @internal\n */\n protected applyMixins(): void {\n this.vue.mixin(createXComponentAPIMixin(this.bus));\n }\n\n /**\n * Registers the initial {@link XModule | XModules} during the {@link XPlugin} installation.\n *\n * @internal\n */\n protected registerInitialModules(): void {\n this.options.initialXModules?.forEach(xModule => {\n this.registerXModule(xModule);\n });\n }\n\n /**\n * Registers the pending {@link XModule | XModules}, that requested to be registered before the\n * installation of the plugin.\n *\n * @internal\n */\n protected registerPendingXModules(): void {\n forEach(XPlugin.pendingXModules, (_, xModule) => {\n this.registerXModule(xModule);\n });\n XPlugin.pendingXModules = {};\n }\n\n /**\n * Registers filters globally.\n *\n * @internal\n */\n protected registerFilters(): void {\n forEach(FILTERS_REGISTRY, (filterName, filterFunction) =>\n this.vue.filter(filterName, filterFunction)\n );\n }\n}\n\n/**\n * Vue plugin that modifies each component instance, extending them with the\n * {@link XComponentAPI | X Component API }.\n *\n * @example\n * Minimal installation example. An API adapter is needed to connect the X Components with the\n * suggestions, search, or tagging APIs. In this example we are using the default Empathy's platform\n * adapter.\n *\n * ```typescript\n * import { platformAdapter } from '@empathyco/x-adapter-platform';\n * Vue.use(xPlugin, { adapter: platformAdapter });\n * ```\n *\n * @example\n * If you are using {@link https://vuex.vuejs.org/ | Vuex} in your project you must install its\n * plugin, and instantiate a store before installing the XPlugin:\n * ```typescript\n * Vue.use(Vuex);\n * const store = new Store({ ... });\n * Vue.use(xPlugin, { adapter, store });\n * ```\n * @public\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E,OAAO;YAC1C,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;SAC/B,CAAC,CAAC;QACH,OAAO,CAAC,eAAe,GAAG,EAAE,CAAC;KAC9B;;;;;;IAOS,eAAe;QACvB,OAAO,CAAC,gBAAgB,EAAE,CAAC,UAAU,EAAE,cAAc,KACnD,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,CAC5C,CAAC;KACH;;AA1UD;;;;;AAKiB,uBAAe,GAA6C,EAAE,CAAC;AAwUlF;;;;;;;;;;;;;;;;;;;;;;;;MAwBa,OAAO,GAAG,IAAI,OAAO,CAAC,GAAG;;;;"}
|
|
1
|
+
{"version":3,"file":"x-plugin.js","sources":["../../../src/plugins/x-plugin.ts"],"sourcesContent":["import { deepMerge } from '@empathyco/x-deep-merge';\nimport { forEach, Dictionary } from '@empathyco/x-utils';\nimport { PluginObject, VueConstructor } from 'vue';\nimport Vuex, { Module, Store } from 'vuex';\nimport { XComponentsAdapter } from '@empathyco/x-types';\nimport { AnyXStoreModule, RootXStoreState } from '../store/store.types';\nimport { cleanGettersProxyCache } from '../store/utils/getters-proxy.utils';\nimport { RootXStoreModule } from '../store/x.module';\nimport { AnyWire } from '../wiring/wiring.types';\nimport { AnyXModule, XModuleName } from '../x-modules/x-modules.types';\nimport { bus } from './x-bus';\nimport { XBus } from './x-bus.types';\nimport { registerStoreEmitters } from './x-emitters';\nimport { createXComponentAPIMixin } from './x-plugin.mixin';\nimport { AnyXStoreModuleOption, XModuleOptions, XPluginOptions } from './x-plugin.types';\nimport { assertXPluginOptionsAreValid } from './x-plugin.utils';\n\n/**\n * Vue plugin that initializes the properties needed by the x-components, and exposes the events bus\n * and the adapter after it has been installed.\n *\n * @public\n */\nexport class XPlugin implements PluginObject<XPluginOptions> {\n /**\n * {@link @empathyco/x-typesm#XComponentsAdapter | XComponentsAdapter} Is the middleware\n * between the components and our API where data can be mapped to client needs.\n * This property is only available after installing the plugin.\n *\n * @returns The installed adapter.\n * @throws If this property is accessed before calling `Vue.use(xPlugin)`.\n * @public\n */\n public static get adapter(): XComponentsAdapter {\n return this.getInstance().adapter;\n }\n\n /**\n * Exposed {@link XBus}, so any kind of application can subscribe to {@link XEventsTypes}\n * without having to pass through a component.\n * This property is only available after installing the plugin.\n *\n * @returns The installed bus.\n * @throws If this property is accessed before calling `Vue.use(xPlugin)`.\n * @public\n */\n public static get bus(): XBus {\n return this.getInstance().bus;\n }\n\n /**\n * {@link https://vuex.vuejs.org | Vuex Store} Is the place where all shared data\n * is saved.\n *\n * @returns The installed store.\n * @throws If this property is accessed before calling `Vue.use(xPlugin)`.\n * @public\n */\n public static get store(): Store<RootXStoreState> {\n return this.getInstance().store;\n }\n\n /**\n * Safely retrieves the installed instance of the XPlugin.\n *\n * @returns The installed instance of the XPlugin.\n * @throws If this method is called before calling `Vue.use(xPlugin)`.\n * @internal\n */\n protected static getInstance(): XPlugin {\n if (!this.instance) {\n throw Error(\"XPlugin must be installed before accessing it's API.\");\n }\n return this.instance;\n }\n\n /**\n * Record of modules that have been tried to be installed before the installation of the plugin.\n *\n * @internal\n */\n protected static pendingXModules: Partial<Record<XModuleName, AnyXModule>> = {};\n\n /**\n * Instance of the installed plugin. Used to expose the bus and the adapter.\n *\n * @internal\n */\n protected static instance?: XPlugin;\n\n /**\n * Bus for retrieving the observables when registering the wiring.\n *\n * @internal\n */\n protected bus: XBus;\n\n /**\n * Adapter for the API, responsible for transforming requests and responses.\n *\n * @internal\n */\n protected adapter!: XComponentsAdapter;\n\n /**\n * Set of the already installed {@link XModule | XModules} to avoid re-registering them.\n *\n * @internal\n */\n protected installedXModules = new Set<string>();\n\n /**\n * True if the plugin has been installed in a Vue instance, in this case\n * {@link XModule |Xmodules} will be installed immediately. False otherwise, in this case\n * {@link XModule | XModules} will be installed lazily when the {@link XPlugin#install} method\n * is called.\n *\n * @internal\n */\n protected isInstalled = false;\n\n /**\n * The installation options of the plugin, where all the customization of\n * {@link XModule | XModules} is done.\n *\n * @internal\n */\n protected options!: XPluginOptions;\n\n /**\n * The Vuex store, to pass to the wires for its registration, and to register the store\n * modules on it.\n *\n * @internal\n */\n protected store!: Store<any>;\n /**\n * The global Vue, passed by the installation method. Used to apply the global mixin\n * {@link createXComponentAPIMixin}, and install the {@link https://vuex.vuejs.org/ | Vuex}\n * plugin.\n *\n * @internal\n */\n protected vue!: VueConstructor;\n\n /**\n * Creates a new instance of the XPlugin with the given bus passed as parameter.\n *\n * @param bus - The {@link XBus} implementation to use for the plugin.\n *\n * @public\n */\n public constructor(bus: XBus) {\n this.bus = bus;\n }\n\n /**\n * If the plugin has already been installed, it immediately registers a {@link XModule}. If it\n * has not been installed yet, it stores the module in a list until the plugin is installed.\n *\n * @param xModule - The module to register.\n *\n * @public\n */\n static registerXModule(xModule: AnyXModule): void {\n if (this.instance) {\n this.instance.registerXModule(xModule);\n } else {\n this.lazyRegisterXModule(xModule);\n }\n }\n\n /**\n * Utility method for resetting the installed instance of the plugin.\n *\n * @remarks Use only for testing.\n *\n * @internal\n */\n static resetInstance(): void {\n cleanGettersProxyCache();\n this.instance = undefined;\n }\n\n /**\n * Stores the {@link XModule} in a dictionary, so it can be registered later in the installation\n * process.\n *\n * @param xModule - The module to register.\n *\n * @internal\n */\n protected static lazyRegisterXModule(xModule: AnyXModule): void {\n this.pendingXModules[xModule.name] = xModule;\n }\n\n /**\n * Installs the plugin into the Vue instance.\n *\n * @param vue - The GlobalVue object.\n * @param options - The options to install this plugin with.\n * @throws If the XPlugin has already been installed, or the options are not valid.\n *\n * @internal\n */\n install(vue: VueConstructor, options?: XPluginOptions): void {\n if (this.isInstalled) {\n throw new Error('XPlugin has already been installed');\n }\n assertXPluginOptionsAreValid(options);\n XPlugin.instance = this;\n this.vue = vue;\n this.options = options;\n this.adapter = options.adapter;\n this.registerStore();\n this.applyMixins();\n this.registerInitialModules();\n this.registerPendingXModules();\n this.isInstalled = true;\n }\n\n /**\n * Performs the registration of a {@link XModule}.\n *\n * @param xModule - The module to register.\n *\n * @internal\n */\n protected registerXModule(xModule: AnyXModule): void {\n if (!this.installedXModules.has(xModule.name)) {\n const customizedXModule = this.customizeXModule(xModule);\n this.registerStoreModule(customizedXModule);\n this.registerStoreEmitters(customizedXModule);\n // The wiring must be registered after the store emitters\n // to allow lazy loaded modules work properly.\n this.registerWiring(customizedXModule);\n this.installedXModules.add(xModule.name);\n }\n }\n\n /**\n * Performs a customization of a {@link XModule} using the XPlugin public and private options.\n *\n * @param xModule - The module to customize.\n * @returns The customized xModule.\n *\n * @internal\n */\n protected customizeXModule({\n name,\n wiring,\n storeModule,\n storeEmitters,\n ...restXModule\n }: AnyXModule): AnyXModule {\n const { wiring: wiringOptions, config }: XModuleOptions<XModuleName> =\n this.options.xModules?.[name] ?? {};\n\n const { storeModule: storeModuleOptions, storeEmitters: emittersOptions } =\n this.options.__PRIVATE__xModules?.[name] ?? {};\n\n return {\n name,\n wiring: wiringOptions ? deepMerge({}, wiring, wiringOptions) : wiring,\n storeModule: this.customizeStoreModule(storeModule, storeModuleOptions ?? {}, config),\n storeEmitters: emittersOptions\n ? deepMerge({}, storeEmitters, emittersOptions)\n : storeEmitters,\n ...restXModule\n };\n }\n\n /**\n * Performs the registration of the wiring, retrieving the observable for each event, and\n * executing each wire.\n *\n * @param xModule - The {@link XModule} to register its wiring.\n *\n * @internal\n */\n protected registerWiring({ wiring }: AnyXModule): void {\n forEach(wiring, (event, wires: Dictionary<AnyWire>) => {\n // Obtain the observable\n const observable = this.bus.on(event, true);\n // Register event wires\n forEach(wires, (_, wire) => {\n wire(observable, this.store, this.bus.on.bind(this.bus));\n });\n });\n }\n\n /**\n * Registers a {@link https://vuex.vuejs.org/ | Vuex} store module under the 'x' module.\n *\n * @param xModule - The {@link XModule} to register its Store Module.\n *\n * @internal\n */\n protected registerStoreModule({ name, storeModule }: AnyXModule): void {\n (storeModule as Module<any, any>).namespaced = true;\n this.store.registerModule(['x', name], storeModule);\n }\n\n /**\n * Overrides a {@link https://vuex.vuejs.org/ | Vuex} store module definition.\n *\n * Priority of configuration merging.\n * 1st {@link XPluginOptions.xModules | xModules XPlugin option}.\n * 2nd {@link XPluginOptions.__PRIVATE__xModules | Private xModules XPlugin option}.\n * 3rd {@link XStoreModule.state | Default state of the xModule}.\n *\n * @param defaultModule - The default store module to override.\n * @param moduleOptions - The state, actions, mutations and getters to override the defaultModule.\n * @param configOptions - The state config to override the moduleOptions.\n * @returns The {@link XStoreModule} customized.\n *\n * @internal\n */\n protected customizeStoreModule(\n { state: defaultState, ...actionsGettersMutations }: AnyXStoreModule,\n { state: xModuleState, ...newActionsGettersMutations }: AnyXStoreModuleOption,\n configOptions: unknown\n ): AnyXStoreModule {\n const configOptionsObject = configOptions ? { config: configOptions } : {};\n const customizedModule = deepMerge({}, actionsGettersMutations, newActionsGettersMutations);\n customizedModule.state = deepMerge(defaultState(), xModuleState, configOptionsObject);\n return customizedModule;\n }\n\n /**\n * Registers the store emitters, making them emit the event when the part of the state selected\n * changes.\n *\n * @param xModule - The {@link XModule} to register its Store Emitters.\n *\n * @internal\n */\n protected registerStoreEmitters(xModule: AnyXModule): void {\n registerStoreEmitters(xModule, this.bus, this.store);\n }\n\n /**\n * Registers the {@link https://vuex.vuejs.org/ | Vuex} store. If the store has not been passed\n * through the {@link XPluginOptions} object, it creates one, and injects it in the Vue\n * prototype. Then it registers an x module in the store, to safe scope all the\n * {@link XModule | XModules} dynamically installed.\n *\n * @internal\n */\n protected registerStore(): void {\n this.vue.use(Vuex); // We can safely install Vuex because if it is already installed Vue\n // will simply ignore it\n this.store =\n this.options.store ??\n new Store({\n strict: process.env.NODE_ENV !== 'production'\n });\n if (!this.options.store) {\n this.vue.prototype.$store = this.store;\n }\n this.store.registerModule('x', RootXStoreModule);\n }\n\n /**\n * Applies the {@link createXComponentAPIMixin} mixin in the global Vue.\n *\n * @internal\n */\n protected applyMixins(): void {\n this.vue.mixin(createXComponentAPIMixin(this.bus));\n }\n\n /**\n * Registers the initial {@link XModule | XModules} during the {@link XPlugin} installation.\n *\n * @internal\n */\n protected registerInitialModules(): void {\n this.options.initialXModules?.forEach(xModule => {\n this.registerXModule(xModule);\n });\n }\n\n /**\n * Registers the pending {@link XModule | XModules}, that requested to be registered before the\n * installation of the plugin.\n *\n * @internal\n */\n protected registerPendingXModules(): void {\n forEach(XPlugin.pendingXModules, (_, xModule) => {\n this.registerXModule(xModule);\n });\n XPlugin.pendingXModules = {};\n }\n}\n\n/**\n * Vue plugin that modifies each component instance, extending them with the\n * {@link XComponentAPI | X Component API }.\n *\n * @example\n * Minimal installation example. An API adapter is needed to connect the X Components with the\n * suggestions, search, or tagging APIs. In this example we are using the default Empathy's platform\n * adapter.\n *\n * ```typescript\n * import { platformAdapter } from '@empathyco/x-adapter-platform';\n * Vue.use(xPlugin, { adapter: platformAdapter });\n * ```\n *\n * @example\n * If you are using {@link https://vuex.vuejs.org/ | Vuex} in your project you must install its\n * plugin, and instantiate a store before installing the XPlugin:\n * ```typescript\n * Vue.use(Vuex);\n * const store = new Store({ ... });\n * Vue.use(xPlugin, { adapter, store });\n * ```\n * @public\n */\nexport const xPlugin = new XPlugin(bus);\n"],"names":[],"mappings":";;;;;;;;;;AAiBA;;;;;;MAMa,OAAO;;;;;;;;IAiIlB,YAAmB,GAAS;;;;;;QA3ClB,sBAAiB,GAAG,IAAI,GAAG,EAAU,CAAC;;;;;;;;;QAUtC,gBAAW,GAAG,KAAK,CAAC;QAkC5B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;KAChB;;;;;;;;;;IAzHM,WAAW,OAAO;QACvB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC;KACnC;;;;;;;;;;IAWM,WAAW,GAAG;QACnB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC;KAC/B;;;;;;;;;IAUM,WAAW,KAAK;QACrB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC;KACjC;;;;;;;;IASS,OAAO,WAAW;QAC1B,IAAI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AO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;iBAC9C,CAAC,CAAC;QACL,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;YACvB,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC;SACxC;QACD,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;KAClD;;;;;;IAOS,WAAW;QACnB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;KACpD;;;;;;IAOS,sBAAsB;QAC9B,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,OAAO,CAAC,OAAO;YAC3C,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;SAC/B,CAAC,CAAC;KACJ;;;;;;;IAQS,uBAAuB;QAC/B,OAAO,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC,EAAE,OAAO;YAC1C,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;SAC/B,CAAC,CAAC;QACH,OAAO,CAAC,eAAe,GAAG,EAAE,CAAC;KAC9B;;AA9TD;;;;;AAKiB,uBAAe,GAA6C,EAAE,CAAC;AA4TlF;;;;;;;;;;;;;;;;;;;;;;;;MAwBa,OAAO,GAAG,IAAI,OAAO,CAAC,GAAG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empathyco/x-components",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.142",
|
|
4
4
|
"description": "Empathy X Components",
|
|
5
5
|
"author": "Empathy Systems Corporation S.L.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -125,5 +125,5 @@
|
|
|
125
125
|
"access": "public",
|
|
126
126
|
"directory": "dist"
|
|
127
127
|
},
|
|
128
|
-
"gitHead": "
|
|
128
|
+
"gitHead": "e9cc9a0b4467dfef61680a9f7214d01cfea3986b"
|
|
129
129
|
}
|
|
@@ -8211,69 +8211,6 @@
|
|
|
8211
8211
|
},
|
|
8212
8212
|
"implementsTokenRanges": []
|
|
8213
8213
|
},
|
|
8214
|
-
{
|
|
8215
|
-
"kind": "Function",
|
|
8216
|
-
"canonicalReference": "@empathyco/x-components!compileMessage:function(1)",
|
|
8217
|
-
"docComment": "/**\n * Replaces each key in compiledMessage for the provided key's value.\n *\n * @param message - String containing the keys to be replaced.\n *\n * @param params - Dictionary of key-values that will be used to format compiledMessage.\n *\n * @returns Formatted string.\n *\n * @public\n */\n",
|
|
8218
|
-
"excerptTokens": [
|
|
8219
|
-
{
|
|
8220
|
-
"kind": "Content",
|
|
8221
|
-
"text": "export declare function compileMessage(message: "
|
|
8222
|
-
},
|
|
8223
|
-
{
|
|
8224
|
-
"kind": "Content",
|
|
8225
|
-
"text": "string"
|
|
8226
|
-
},
|
|
8227
|
-
{
|
|
8228
|
-
"kind": "Content",
|
|
8229
|
-
"text": ", params: "
|
|
8230
|
-
},
|
|
8231
|
-
{
|
|
8232
|
-
"kind": "Reference",
|
|
8233
|
-
"text": "Dictionary",
|
|
8234
|
-
"canonicalReference": "@empathyco/x-utils!Dictionary:type"
|
|
8235
|
-
},
|
|
8236
|
-
{
|
|
8237
|
-
"kind": "Content",
|
|
8238
|
-
"text": "<string | number>"
|
|
8239
|
-
},
|
|
8240
|
-
{
|
|
8241
|
-
"kind": "Content",
|
|
8242
|
-
"text": "): "
|
|
8243
|
-
},
|
|
8244
|
-
{
|
|
8245
|
-
"kind": "Content",
|
|
8246
|
-
"text": "string"
|
|
8247
|
-
},
|
|
8248
|
-
{
|
|
8249
|
-
"kind": "Content",
|
|
8250
|
-
"text": ";"
|
|
8251
|
-
}
|
|
8252
|
-
],
|
|
8253
|
-
"returnTypeTokenRange": {
|
|
8254
|
-
"startIndex": 6,
|
|
8255
|
-
"endIndex": 7
|
|
8256
|
-
},
|
|
8257
|
-
"releaseTag": "Public",
|
|
8258
|
-
"overloadIndex": 1,
|
|
8259
|
-
"parameters": [
|
|
8260
|
-
{
|
|
8261
|
-
"parameterName": "message",
|
|
8262
|
-
"parameterTypeTokenRange": {
|
|
8263
|
-
"startIndex": 1,
|
|
8264
|
-
"endIndex": 2
|
|
8265
|
-
}
|
|
8266
|
-
},
|
|
8267
|
-
{
|
|
8268
|
-
"parameterName": "params",
|
|
8269
|
-
"parameterTypeTokenRange": {
|
|
8270
|
-
"startIndex": 3,
|
|
8271
|
-
"endIndex": 5
|
|
8272
|
-
}
|
|
8273
|
-
}
|
|
8274
|
-
],
|
|
8275
|
-
"name": "compileMessage"
|
|
8276
|
-
},
|
|
8277
8214
|
{
|
|
8278
8215
|
"kind": "Function",
|
|
8279
8216
|
"canonicalReference": "@empathyco/x-components!createCollapseAnimationMixin:function(1)",
|
|
@@ -840,9 +840,6 @@ export class ColumnPickerMixin extends Vue_2 {
|
|
|
840
840
|
protected value?: number;
|
|
841
841
|
}
|
|
842
842
|
|
|
843
|
-
// @public
|
|
844
|
-
export function compileMessage(message: string, params: Dictionary<string | number>): string;
|
|
845
|
-
|
|
846
843
|
// Warning: (ae-forgotten-export) The symbol "AnimatedProperty" needs to be exported by the entry point index.d.ts
|
|
847
844
|
//
|
|
848
845
|
// @public
|
|
@@ -5112,8 +5109,6 @@ export class XPlugin implements PluginObject<XPluginOptions> {
|
|
|
5112
5109
|
// @internal
|
|
5113
5110
|
protected static pendingXModules: Partial<Record<XModuleName, AnyXModule>>;
|
|
5114
5111
|
// @internal
|
|
5115
|
-
protected registerFilters(): void;
|
|
5116
|
-
// @internal
|
|
5117
5112
|
protected registerInitialModules(): void;
|
|
5118
5113
|
// @internal
|
|
5119
5114
|
protected registerPendingXModules(): void;
|
package/types/index.d.ts
CHANGED
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC"}
|
|
@@ -241,12 +241,6 @@ export declare class XPlugin implements PluginObject<XPluginOptions> {
|
|
|
241
241
|
* @internal
|
|
242
242
|
*/
|
|
243
243
|
protected registerPendingXModules(): void;
|
|
244
|
-
/**
|
|
245
|
-
* Registers filters globally.
|
|
246
|
-
*
|
|
247
|
-
* @internal
|
|
248
|
-
*/
|
|
249
|
-
protected registerFilters(): void;
|
|
250
244
|
}
|
|
251
245
|
/**
|
|
252
246
|
* Vue plugin that modifies each component instance, extending them with the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"x-plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/x-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AACnD,OAAa,EAAU,KAAK,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"x-plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/x-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AACnD,OAAa,EAAU,KAAK,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAIxE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAGrC,OAAO,EAAE,qBAAqB,EAAkB,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGzF;;;;;GAKG;AACH,qBAAa,OAAQ,YAAW,YAAY,CAAC,cAAc,CAAC;IAC1D;;;;;;;;OAQG;IACH,WAAkB,OAAO,IAAI,kBAAkB,CAE9C;IAED;;;;;;;;OAQG;IACH,WAAkB,GAAG,IAAI,IAAI,CAE5B;IAED;;;;;;;OAOG;IACH,WAAkB,KAAK,IAAI,KAAK,CAAC,eAAe,CAAC,CAEhD;IAED;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,CAAC,WAAW,IAAI,OAAO;IAOvC;;;;OAIG;IACH,SAAS,CAAC,MAAM,CAAC,eAAe,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,CAAM;IAEhF;;;;OAIG;IACH,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC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;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,oBAAoB,CAC5B,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,uBAAuB,EAAE,EAAE,eAAe,EACpE,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,0BAA0B,EAAE,EAAE,qBAAqB,EAC7E,aAAa,EAAE,OAAO,GACrB,eAAe;IAOlB;;;;;;;OAOG;IACH,SAAS,CAAC,qBAAqB,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI;IAI1D;;;;;;;OAOG;IACH,SAAS,CAAC,aAAa,IAAI,IAAI;IAc/B;;;;OAIG;IACH,SAAS,CAAC,WAAW,IAAI,IAAI;IAI7B;;;;OAIG;IACH,SAAS,CAAC,sBAAsB,IAAI,IAAI;IAMxC;;;;;OAKG;IACH,SAAS,CAAC,uBAAuB,IAAI,IAAI;CAM1C;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,OAAO,SAAmB,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [compileMessage](./x-components.compilemessage.md)
|
|
4
|
-
|
|
5
|
-
## compileMessage() function
|
|
6
|
-
|
|
7
|
-
Replaces each key in compiledMessage for the provided key's value.
|
|
8
|
-
|
|
9
|
-
<b>Signature:</b>
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
export declare function compileMessage(message: string, params: Dictionary<string | number>): string;
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Parameters
|
|
16
|
-
|
|
17
|
-
| Parameter | Type | Description |
|
|
18
|
-
| --- | --- | --- |
|
|
19
|
-
| message | string | String containing the keys to be replaced. |
|
|
20
|
-
| params | Dictionary<string \| number> | Dictionary of key-values that will be used to format compiledMessage. |
|
|
21
|
-
|
|
22
|
-
<b>Returns:</b>
|
|
23
|
-
|
|
24
|
-
string
|
|
25
|
-
|
|
26
|
-
Formatted string.
|
|
27
|
-
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Replaces a key in compiledMessage for the provided key's value.
|
|
3
|
-
*
|
|
4
|
-
* @param compiledMessage - String containing the key to be replaced.
|
|
5
|
-
* @param keyValueEntry - Key would be the string replaced in compiledMessage and value the
|
|
6
|
-
* string that will get replaced with.
|
|
7
|
-
* @returns Formatted string.
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
const replaceParams = (compiledMessage, [key, value]) => compiledMessage.replace(new RegExp(`{${key}}`, 'g'), value.toString());
|
|
11
|
-
/**
|
|
12
|
-
* Replaces each key in compiledMessage for the provided key's value.
|
|
13
|
-
*
|
|
14
|
-
* @param message - String containing the keys to be replaced.
|
|
15
|
-
* @param params - Dictionary of key-values that will be used to format compiledMessage.
|
|
16
|
-
* @returns Formatted string.
|
|
17
|
-
* @public
|
|
18
|
-
*/
|
|
19
|
-
function compileMessage(message, params) {
|
|
20
|
-
return message && params
|
|
21
|
-
? Object.entries(params).reduce(replaceParams, message)
|
|
22
|
-
: message;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export { compileMessage };
|
|
26
|
-
//# sourceMappingURL=compile-message.filter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compile-message.filter.js","sources":["../../../src/filters/compile-message.filter.ts"],"sourcesContent":["import { Dictionary } from '@empathyco/x-utils';\n\n/**\n * Replaces a key in compiledMessage for the provided key's value.\n *\n * @param compiledMessage - String containing the key to be replaced.\n * @param keyValueEntry - Key would be the string replaced in compiledMessage and value the\n * string that will get replaced with.\n * @returns Formatted string.\n * @internal\n */\nconst replaceParams = (compiledMessage: string, [key, value]: [string, string | number]): string =>\n compiledMessage.replace(new RegExp(`{${key}}`, 'g'), value.toString());\n\n/**\n * Replaces each key in compiledMessage for the provided key's value.\n *\n * @param message - String containing the keys to be replaced.\n * @param params - Dictionary of key-values that will be used to format compiledMessage.\n * @returns Formatted string.\n * @public\n */\nexport function compileMessage(message: string, params: Dictionary<string | number>): string {\n return message && params\n ? Object.entries<string | number>(params).reduce(replaceParams, message)\n : message;\n}\n"],"names":[],"mappings":"AAEA;;;;;;;;;AASA,MAAM,aAAa,GAAG,CAAC,eAAuB,EAAE,CAAC,GAAG,EAAE,KAAK,CAA4B,KACrF,eAAe,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,IAAI,GAAG,GAAG,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;AAEzE;;;;;;;;SAQgB,cAAc,CAAC,OAAe,EAAE,MAAmC;IACjF,OAAO,OAAO,IAAI,MAAM;UACpB,MAAM,CAAC,OAAO,CAAkB,MAAM,CAAC,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC;UACtE,OAAO,CAAC;AACd;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filters.registry.js","sources":["../../../src/filters/filters.registry.ts"],"sourcesContent":["/**\n * List of filters that can be used to apply common text formatting.\n *\n * @internal\n */\nexport const FILTERS_REGISTRY = {};\n"],"names":[],"mappings":"AAAA;;;;;MAKa,gBAAgB,GAAG;;;;"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Dictionary } from '@empathyco/x-utils';
|
|
2
|
-
/**
|
|
3
|
-
* Replaces each key in compiledMessage for the provided key's value.
|
|
4
|
-
*
|
|
5
|
-
* @param message - String containing the keys to be replaced.
|
|
6
|
-
* @param params - Dictionary of key-values that will be used to format compiledMessage.
|
|
7
|
-
* @returns Formatted string.
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export declare function compileMessage(message: string, params: Dictionary<string | number>): string;
|
|
11
|
-
//# sourceMappingURL=compile-message.filter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compile-message.filter.d.ts","sourceRoot":"","sources":["../../../src/filters/compile-message.filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAchD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAI3F"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filters.registry.d.ts","sourceRoot":"","sources":["../../../src/filters/filters.registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,IAAK,CAAC"}
|
package/types/filters/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/filters/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|