@empathyco/x-components 3.0.0-alpha.47 → 3.0.0-alpha.50
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 +53 -0
- package/build-helpers/plugins/polyfills-wrapper.plugin.js +4 -5
- package/build-helpers/utils/polyfills.util.js +1 -1
- package/core/index.js.map +1 -1
- package/design-system/default-theme.css +50 -2
- package/design-system/full-theme.css +45 -3
- package/design-system/tag-default.css +33 -1
- package/design-system/tag-ghost.css +12 -2
- package/docs/API-reference/api/x-components.md +0 -1
- package/docs/API-reference/api/x-components.snippetconfigextraparams.md +6 -0
- package/docs/API-reference/api/x-components.snippetconfigextraparams.values.md +13 -0
- package/docs/API-reference/components/extra-params/x-components.snippet-config-extra-params.md +6 -0
- package/docs/API-reference/components/facets/x-components.filters/number-range-filter.md +4 -3
- package/facets/index.js +1 -2
- package/js/index.js +1 -2
- package/js/index.js.map +1 -1
- package/js/plugins/x-plugin.js +3 -1
- package/js/plugins/x-plugin.js.map +1 -1
- package/js/x-modules/extra-params/components/snippet-config-extra-params.vue.js.map +1 -1
- package/js/x-modules/extra-params/components/snippet-config-extra-params.vue_rollup-plugin-vue=script.js +17 -6
- package/js/x-modules/extra-params/components/snippet-config-extra-params.vue_rollup-plugin-vue=script.js.map +1 -1
- package/js/x-modules/facets/components/filters/hierarchical-filter.vue_rollup-plugin-vue=script.js +1 -1
- package/js/x-modules/facets/components/filters/number-range-filter.vue.js +42 -4
- package/js/x-modules/facets/components/filters/number-range-filter.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/number-range-filter.vue_rollup-plugin-vue=script.js +2 -2
- package/js/x-modules/facets/components/filters/number-range-filter.vue_rollup-plugin-vue=script.js.map +1 -1
- package/js/x-modules/facets/components/filters/simple-filter.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/simple-filter.vue_rollup-plugin-vue=script.js +1 -2
- package/js/x-modules/facets/components/filters/simple-filter.vue_rollup-plugin-vue=script.js.map +1 -1
- package/js/x-modules/related-tags/wiring.js +3 -3
- package/js/x-modules/related-tags/wiring.js.map +1 -1
- package/package.json +3 -5
- package/report/x-components.api.json +34 -99
- package/report/x-components.api.md +6 -17
- package/types/plugins/x-plugin.d.ts.map +1 -1
- package/types/x-modules/extra-params/components/snippet-config-extra-params.vue.d.ts +7 -1
- package/types/x-modules/extra-params/components/snippet-config-extra-params.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/filters/number-range-filter.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/index.d.ts +0 -1
- package/types/x-modules/facets/components/index.d.ts.map +1 -1
- package/types/x-modules/related-tags/wiring.d.ts +3 -3
- package/docs/API-reference/api/x-components.basefilter.clickevents.md +0 -13
- package/docs/API-reference/api/x-components.basefilter.filter.md +0 -13
- package/docs/API-reference/api/x-components.basefilter.md +0 -22
- package/docs/API-reference/components/facets/x-components.filters/base-filter.md +0 -77
- package/js/x-modules/facets/components/filters/base-filter.vue.js +0 -69
- package/js/x-modules/facets/components/filters/base-filter.vue.js.map +0 -1
- package/js/x-modules/facets/components/filters/base-filter.vue_rollup-plugin-vue=script.js +0 -192
- package/js/x-modules/facets/components/filters/base-filter.vue_rollup-plugin-vue=script.js.map +0 -1
- package/types/x-modules/facets/components/filters/base-filter.vue.d.ts +0 -39
- package/types/x-modules/facets/components/filters/base-filter.vue.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,59 @@
|
|
|
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.50](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.49...@empathyco/x-components@3.0.0-alpha.50) (2022-02-04)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **design-system:** change curated tag toke values to reuse default ones.
|
|
11
|
+
([2fd261a](https://github.com/empathyco/x/commit/2fd261ae54ec3de8eabdbcd5611bf5e1416d37f8)),
|
|
12
|
+
closes [EX-5354](https://searchbroker.atlassian.net/browse/EX-5354)
|
|
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
|
+
|
|
19
|
+
## [3.0.0-alpha.49](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.48...@empathyco/x-components@3.0.0-alpha.49) (2022-02-03)
|
|
20
|
+
|
|
21
|
+
### Continuous Integration
|
|
22
|
+
|
|
23
|
+
- release alpha version on every push to main branch
|
|
24
|
+
([f86e0b3](https://github.com/empathyco/x/commit/f86e0b3ad14e7a9bd6d659219fe12f6d94ebdb94)),
|
|
25
|
+
closes [EX-5263](https://searchbroker.atlassian.net/browse/EX-5263)
|
|
26
|
+
|
|
27
|
+
# Change Log
|
|
28
|
+
|
|
29
|
+
All notable changes to this project will be documented in this file. See
|
|
30
|
+
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
31
|
+
|
|
32
|
+
## [3.0.0-alpha.48](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.47...@empathyco/x-components@3.0.0-alpha.48) (2022-02-02)
|
|
33
|
+
|
|
34
|
+
### ⚠ BREAKING CHANGES
|
|
35
|
+
|
|
36
|
+
- **facets:** Remove `BaseFilter` component. Use `RenderlessFilter`instead.
|
|
37
|
+
|
|
38
|
+
### Features
|
|
39
|
+
|
|
40
|
+
- **design-system:** add curated tags (#311)
|
|
41
|
+
([9f40c2b](https://github.com/empathyco/x/commit/9f40c2b17eb08353efc964dba075470877eead46)),
|
|
42
|
+
closes [EX-5089](https://searchbroker.atlassian.net/browse/EX-5089)
|
|
43
|
+
- **extra-params:** add option to add more extra params using a prop in `SnippetConfigExtraParams`
|
|
44
|
+
component
|
|
45
|
+
([7f9f8b2](https://github.com/empathyco/x/commit/7f9f8b2a7d2a78ed5a101f6e005fffa4f20d3594)),
|
|
46
|
+
closes [EX-5205](https://searchbroker.atlassian.net/browse/EX-5205)
|
|
47
|
+
- **facets:** change `NumberRangeFilter` component to use `RenderlessFilter` instead of `BaseFilter`
|
|
48
|
+
([f0edfac](https://github.com/empathyco/x/commit/f0edfac14a184ed7fefd27e1c1e700848ada4471)),
|
|
49
|
+
closes [EX-3953](https://searchbroker.atlassian.net/browse/EX-3953)
|
|
50
|
+
- update polyfills plugin to work with chunks
|
|
51
|
+
([54c1842](https://github.com/empathyco/x/commit/54c18420011e5e452bd8b48d640cbd067d0ce921)),
|
|
52
|
+
closes [EX-5278](https://searchbroker.atlassian.net/browse/EX-5278)
|
|
53
|
+
|
|
54
|
+
# Change Log
|
|
55
|
+
|
|
56
|
+
All notable changes to this project will be documented in this file. See
|
|
57
|
+
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
58
|
+
|
|
6
59
|
## [3.0.0-alpha.47](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.46...@empathyco/x-components@3.0.0-alpha.47) (2022-02-01)
|
|
7
60
|
|
|
8
61
|
### Features
|
|
@@ -20,12 +20,11 @@ export default function xComponentsPolyfillsWrapperPlugin(polyfillsOptions) {
|
|
|
20
20
|
if (!chunk.isEntry) {
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const importString = chunk.imports[0] ? `await import('./${chunk.imports[0]}')` : code;
|
|
24
|
+
const appMagicString = new MagicString(importString);
|
|
24
25
|
const [header, footer] = generateWrapperFunctionTuple(polyfillsOptions);
|
|
25
26
|
|
|
26
|
-
appMagicString
|
|
27
|
-
.prepend(`(${ header }`)
|
|
28
|
-
.append(`${ footer })()`);
|
|
27
|
+
appMagicString.prepend(`(${header}`).append(`${footer})()`);
|
|
29
28
|
|
|
30
29
|
return {
|
|
31
30
|
code: appMagicString.toString(),
|
|
@@ -33,4 +32,4 @@ export default function xComponentsPolyfillsWrapperPlugin(polyfillsOptions) {
|
|
|
33
32
|
};
|
|
34
33
|
}
|
|
35
34
|
};
|
|
36
|
-
}
|
|
35
|
+
}
|
|
@@ -43,7 +43,7 @@ export function generateWrapperFunctionTuple({
|
|
|
43
43
|
document.body.appendChild(polyfillsScript);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
function loadXComponents() {
|
|
46
|
+
async function loadXComponents() {
|
|
47
47
|
/* <InsertXComponents> */
|
|
48
48
|
const overrideOptions = options;
|
|
49
49
|
if (window.initX !== undefined) {
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -2076,6 +2076,12 @@
|
|
|
2076
2076
|
--x-color-background-tag-default-selected: var(--x-color-base-neutral-95);
|
|
2077
2077
|
--x-color-border-tag-default-selected: var(--x-color-border-tag-default);
|
|
2078
2078
|
--x-color-text-tag-default-selected: var(--x-color-text-tag-default);
|
|
2079
|
+
--x-color-background-tag-default-curated: var(--x-color-background-tag-default);
|
|
2080
|
+
--x-color-border-tag-default-curated: var(--x-color-border-tag-default);
|
|
2081
|
+
--x-color-text-tag-default-curated: var(--x-color-text-tag-default);
|
|
2082
|
+
--x-color-background-tag-default-curated-selected: var(--x-color-background-tag-default-selected);
|
|
2083
|
+
--x-color-border-tag-default-curated-selected: var(--x-color-border-tag-default-selected);
|
|
2084
|
+
--x-color-text-tag-default-curated-selected: var(--x-color-text-tag-default-selected);
|
|
2079
2085
|
--x-size-border-width-tag-default: var(--x-size-border-width-base);
|
|
2080
2086
|
--x-size-border-width-top-tag-default: var(--x-size-border-width-tag-default);
|
|
2081
2087
|
--x-size-border-width-right-tag-default: var(--x-size-border-width-tag-default);
|
|
@@ -2097,7 +2103,17 @@
|
|
|
2097
2103
|
--x-font-family-tag-default-selected: var(--x-font-family-tag-default);
|
|
2098
2104
|
--x-size-font-tag-default-selected: var(--x-size-font-tag-default);
|
|
2099
2105
|
--x-size-line-height-tag-default-selected: var(--x-size-line-height-tag-default);
|
|
2100
|
-
--x-number-font-weight-tag-default-selected: var(--x-number-font-weight-tag-default);
|
|
2106
|
+
--x-number-font-weight-tag-default-selected: var(--x-number-font-weight-tag-default);
|
|
2107
|
+
--x-font-family-tag-default-curated: var(--x-font-family-tag-default);
|
|
2108
|
+
--x-size-font-tag-default-curated: var(--x-size-font-tag-default);
|
|
2109
|
+
--x-size-line-height-tag-default-curated: var(--x-size-line-height-tag-default);
|
|
2110
|
+
--x-number-font-weight-tag-default-curated: var(--x-number-font-weight-tag-default);
|
|
2111
|
+
--x-font-family-tag-default-curated-selected: var(--x-font-family-tag-default-selected);
|
|
2112
|
+
--x-size-font-tag-default-curated-selected: var(--x-size-font-tag-default-selected);
|
|
2113
|
+
--x-size-line-height-tag-default-curated-selected: var(--x-size-line-height-tag-default-selected);
|
|
2114
|
+
--x-number-font-weight-tag-default-curated-selected: var(
|
|
2115
|
+
--x-number-font-weight-tag-default-selected
|
|
2116
|
+
); }
|
|
2101
2117
|
|
|
2102
2118
|
@use 'sass:string';
|
|
2103
2119
|
[dir="ltr"] .x-tag {
|
|
@@ -2199,6 +2215,14 @@
|
|
|
2199
2215
|
--x-size-font-filter-default: var(--x-size-font-tag-default);
|
|
2200
2216
|
--x-number-font-weight-filter-count-default: var(--x-number-font-weight-tag-default);
|
|
2201
2217
|
--x-size-line-height-filter-default: var(--x-size-line-height-tag-default); }
|
|
2218
|
+
.x-tag.x-tag.x-tag--is-curated {
|
|
2219
|
+
background-color: var(--x-color-background-tag-default-curated);
|
|
2220
|
+
border-color: var(--x-color-border-tag-default-curated);
|
|
2221
|
+
color: var(--x-color-text-tag-default-curated);
|
|
2222
|
+
line-height: var(--x-size-line-height-tag-default-curated);
|
|
2223
|
+
font-family: var(--x-font-family-tag-default-curated);
|
|
2224
|
+
font-size: var(--x-size-font-tag-default-curated);
|
|
2225
|
+
font-weight: var(--x-number-font-weight-tag-default-curated); }
|
|
2202
2226
|
.x-tag.x-tag.x-tag--is-selected {
|
|
2203
2227
|
background-color: var(--x-color-background-tag-default-selected);
|
|
2204
2228
|
border-color: var(--x-color-border-tag-default-selected);
|
|
@@ -2207,6 +2231,14 @@
|
|
|
2207
2231
|
font-family: var(--x-font-family-tag-default-selected);
|
|
2208
2232
|
font-size: var(--x-size-font-tag-default-selected);
|
|
2209
2233
|
font-weight: var(--x-number-font-weight-tag-default-selected); }
|
|
2234
|
+
.x-tag.x-tag.x-tag--is-selected.x-tag--is-curated {
|
|
2235
|
+
background-color: var(--x-color-background-tag-default-curated-selected);
|
|
2236
|
+
border-color: var(--x-color-border-tag-default-curated-selected);
|
|
2237
|
+
color: var(--x-color-text-tag-default-curated-selected);
|
|
2238
|
+
line-height: var(--x-size-line-height-tag-default-curated-selected);
|
|
2239
|
+
font-family: var(--x-font-family-tag-default-curated-selected);
|
|
2240
|
+
font-size: var(--x-size-font-tag-default-curated-selected);
|
|
2241
|
+
font-weight: var(--x-number-font-weight-tag-default-curated-selected); }
|
|
2210
2242
|
.x-tag.x-tag.x-tag--is-selected.x-filter {
|
|
2211
2243
|
--x-color-text-filter-default-selected: var(--x-color-text-tag-default-selected);
|
|
2212
2244
|
--x-font-family-filter-default-selected: var(--x-font-family-tag-default-selected);
|
|
@@ -2223,6 +2255,12 @@
|
|
|
2223
2255
|
--x-color-background-tag-default-selected: var(--x-color-base-neutral-95);
|
|
2224
2256
|
--x-color-border-tag-default-selected: var(--x-color-border-tag-default);
|
|
2225
2257
|
--x-color-text-tag-default-selected: var(--x-color-text-tag-default);
|
|
2258
|
+
--x-color-background-tag-default-curated: var(--x-color-background-tag-default);
|
|
2259
|
+
--x-color-border-tag-default-curated: var(--x-color-border-tag-default);
|
|
2260
|
+
--x-color-text-tag-default-curated: var(--x-color-text-tag-default);
|
|
2261
|
+
--x-color-background-tag-default-curated-selected: var(--x-color-background-tag-default-selected);
|
|
2262
|
+
--x-color-border-tag-default-curated-selected: var(--x-color-border-tag-default-selected);
|
|
2263
|
+
--x-color-text-tag-default-curated-selected: var(--x-color-text-tag-default-selected);
|
|
2226
2264
|
--x-size-border-width-tag-default: var(--x-size-border-width-base);
|
|
2227
2265
|
--x-size-border-width-top-tag-default: var(--x-size-border-width-tag-default);
|
|
2228
2266
|
--x-size-border-width-right-tag-default: var(--x-size-border-width-tag-default);
|
|
@@ -2244,7 +2282,17 @@
|
|
|
2244
2282
|
--x-font-family-tag-default-selected: var(--x-font-family-tag-default);
|
|
2245
2283
|
--x-size-font-tag-default-selected: var(--x-size-font-tag-default);
|
|
2246
2284
|
--x-size-line-height-tag-default-selected: var(--x-size-line-height-tag-default);
|
|
2247
|
-
--x-number-font-weight-tag-default-selected: var(--x-number-font-weight-tag-default);
|
|
2285
|
+
--x-number-font-weight-tag-default-selected: var(--x-number-font-weight-tag-default);
|
|
2286
|
+
--x-font-family-tag-default-curated: var(--x-font-family-tag-default);
|
|
2287
|
+
--x-size-font-tag-default-curated: var(--x-size-font-tag-default);
|
|
2288
|
+
--x-size-line-height-tag-default-curated: var(--x-size-line-height-tag-default);
|
|
2289
|
+
--x-number-font-weight-tag-default-curated: var(--x-number-font-weight-tag-default);
|
|
2290
|
+
--x-font-family-tag-default-curated-selected: var(--x-font-family-tag-default-selected);
|
|
2291
|
+
--x-size-font-tag-default-curated-selected: var(--x-size-font-tag-default-selected);
|
|
2292
|
+
--x-size-line-height-tag-default-curated-selected: var(--x-size-line-height-tag-default-selected);
|
|
2293
|
+
--x-number-font-weight-tag-default-curated-selected: var(
|
|
2294
|
+
--x-number-font-weight-tag-default-selected
|
|
2295
|
+
); }
|
|
2248
2296
|
|
|
2249
2297
|
:root {
|
|
2250
2298
|
--x-color-text-default: var(--x-color-base-neutral-10);
|
|
@@ -3354,6 +3354,14 @@
|
|
|
3354
3354
|
--x-size-font-filter-default: var(--x-size-font-tag-default);
|
|
3355
3355
|
--x-number-font-weight-filter-count-default: var(--x-number-font-weight-tag-default);
|
|
3356
3356
|
--x-size-line-height-filter-default: var(--x-size-line-height-tag-default); }
|
|
3357
|
+
.x-tag.x-tag.x-tag--is-curated {
|
|
3358
|
+
background-color: var(--x-color-background-tag-default-curated);
|
|
3359
|
+
border-color: var(--x-color-border-tag-default-curated);
|
|
3360
|
+
color: var(--x-color-text-tag-default-curated);
|
|
3361
|
+
line-height: var(--x-size-line-height-tag-default-curated);
|
|
3362
|
+
font-family: var(--x-font-family-tag-default-curated);
|
|
3363
|
+
font-size: var(--x-size-font-tag-default-curated);
|
|
3364
|
+
font-weight: var(--x-number-font-weight-tag-default-curated); }
|
|
3357
3365
|
.x-tag.x-tag.x-tag--is-selected {
|
|
3358
3366
|
background-color: var(--x-color-background-tag-default-selected);
|
|
3359
3367
|
border-color: var(--x-color-border-tag-default-selected);
|
|
@@ -3362,6 +3370,14 @@
|
|
|
3362
3370
|
font-family: var(--x-font-family-tag-default-selected);
|
|
3363
3371
|
font-size: var(--x-size-font-tag-default-selected);
|
|
3364
3372
|
font-weight: var(--x-number-font-weight-tag-default-selected); }
|
|
3373
|
+
.x-tag.x-tag.x-tag--is-selected.x-tag--is-curated {
|
|
3374
|
+
background-color: var(--x-color-background-tag-default-curated-selected);
|
|
3375
|
+
border-color: var(--x-color-border-tag-default-curated-selected);
|
|
3376
|
+
color: var(--x-color-text-tag-default-curated-selected);
|
|
3377
|
+
line-height: var(--x-size-line-height-tag-default-curated-selected);
|
|
3378
|
+
font-family: var(--x-font-family-tag-default-curated-selected);
|
|
3379
|
+
font-size: var(--x-size-font-tag-default-curated-selected);
|
|
3380
|
+
font-weight: var(--x-number-font-weight-tag-default-curated-selected); }
|
|
3365
3381
|
.x-tag.x-tag.x-tag--is-selected.x-filter {
|
|
3366
3382
|
--x-color-text-filter-default-selected: var(--x-color-text-tag-default-selected);
|
|
3367
3383
|
--x-font-family-filter-default-selected: var(--x-font-family-tag-default-selected);
|
|
@@ -3378,6 +3394,12 @@
|
|
|
3378
3394
|
--x-color-background-tag-default-selected: var(--x-color-base-neutral-95);
|
|
3379
3395
|
--x-color-border-tag-default-selected: var(--x-color-border-tag-default);
|
|
3380
3396
|
--x-color-text-tag-default-selected: var(--x-color-text-tag-default);
|
|
3397
|
+
--x-color-background-tag-default-curated: var(--x-color-background-tag-default);
|
|
3398
|
+
--x-color-border-tag-default-curated: var(--x-color-border-tag-default);
|
|
3399
|
+
--x-color-text-tag-default-curated: var(--x-color-text-tag-default);
|
|
3400
|
+
--x-color-background-tag-default-curated-selected: var(--x-color-background-tag-default-selected);
|
|
3401
|
+
--x-color-border-tag-default-curated-selected: var(--x-color-border-tag-default-selected);
|
|
3402
|
+
--x-color-text-tag-default-curated-selected: var(--x-color-text-tag-default-selected);
|
|
3381
3403
|
--x-size-border-width-tag-default: var(--x-size-border-width-base);
|
|
3382
3404
|
--x-size-border-width-top-tag-default: var(--x-size-border-width-tag-default);
|
|
3383
3405
|
--x-size-border-width-right-tag-default: var(--x-size-border-width-tag-default);
|
|
@@ -3399,22 +3421,42 @@
|
|
|
3399
3421
|
--x-font-family-tag-default-selected: var(--x-font-family-tag-default);
|
|
3400
3422
|
--x-size-font-tag-default-selected: var(--x-size-font-tag-default);
|
|
3401
3423
|
--x-size-line-height-tag-default-selected: var(--x-size-line-height-tag-default);
|
|
3402
|
-
--x-number-font-weight-tag-default-selected: var(--x-number-font-weight-tag-default);
|
|
3424
|
+
--x-number-font-weight-tag-default-selected: var(--x-number-font-weight-tag-default);
|
|
3425
|
+
--x-font-family-tag-default-curated: var(--x-font-family-tag-default);
|
|
3426
|
+
--x-size-font-tag-default-curated: var(--x-size-font-tag-default);
|
|
3427
|
+
--x-size-line-height-tag-default-curated: var(--x-size-line-height-tag-default);
|
|
3428
|
+
--x-number-font-weight-tag-default-curated: var(--x-number-font-weight-tag-default);
|
|
3429
|
+
--x-font-family-tag-default-curated-selected: var(--x-font-family-tag-default-selected);
|
|
3430
|
+
--x-size-font-tag-default-curated-selected: var(--x-size-font-tag-default-selected);
|
|
3431
|
+
--x-size-line-height-tag-default-curated-selected: var(--x-size-line-height-tag-default-selected);
|
|
3432
|
+
--x-number-font-weight-tag-default-curated-selected: var(
|
|
3433
|
+
--x-number-font-weight-tag-default-selected
|
|
3434
|
+
); }
|
|
3403
3435
|
|
|
3404
3436
|
.x-tag--ghost.x-tag,
|
|
3405
3437
|
.x-tag--ghost .x-tag {
|
|
3406
3438
|
--x-color-background-tag-default: var(--x-color-background-tag-ghost);
|
|
3407
3439
|
--x-color-border-tag-default: var(--x-color-border-tag-ghost);
|
|
3440
|
+
--x-color-background-tag-default-curated: var(--x-color-background-tag-curated-ghost);
|
|
3441
|
+
--x-color-border-tag-default-curated: var(--x-color-border-tag-curated-ghost);
|
|
3408
3442
|
--x-color-background-tag-default-selected: var(--x-color-background-tag-selected-ghost);
|
|
3409
3443
|
--x-color-border-tag-default-selected: var(--x-color-border-tag-selected-ghost);
|
|
3410
|
-
--x-
|
|
3444
|
+
--x-color-background-tag-default-curated-selected: var(--x-color-background-tag-curated-selected-ghost);
|
|
3445
|
+
--x-color-border-tag-default-curated-selected: var(--x-color-border-tag-curated-selected-ghost);
|
|
3446
|
+
--x-number-font-weight-tag-default-selected: var(--x-number-font-weight-tag-selected-ghost);
|
|
3447
|
+
--x-number-font-weight-tag-default-curated-selected: var(--x-number-font-weight-tag-curated-selected-ghost); }
|
|
3411
3448
|
|
|
3412
3449
|
:root {
|
|
3413
3450
|
--x-color-background-tag-ghost: transparent;
|
|
3414
3451
|
--x-color-border-tag-ghost: transparent;
|
|
3415
3452
|
--x-color-background-tag-selected-ghost: transparent;
|
|
3416
3453
|
--x-color-border-tag-selected-ghost: transparent;
|
|
3417
|
-
--x-
|
|
3454
|
+
--x-color-background-tag-curated-ghost: transparent;
|
|
3455
|
+
--x-color-border-tag-curated-ghost: transparent;
|
|
3456
|
+
--x-color-background-tag-curated-selected-ghost: transparent;
|
|
3457
|
+
--x-color-border-tag-curated-selected-ghost: transparent;
|
|
3458
|
+
--x-number-font-weight-tag-selected-ghost: var(--x-number-font-weight-base-bold);
|
|
3459
|
+
--x-number-font-weight-tag-curated-selected-ghost: var(--x-number-font-weight-base-bold); }
|
|
3418
3460
|
|
|
3419
3461
|
.x-tag--pill.x-tag,
|
|
3420
3462
|
.x-tag--pill .x-tag {
|
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
--x-color-background-tag-default-selected: var(--x-color-base-neutral-95);
|
|
6
6
|
--x-color-border-tag-default-selected: var(--x-color-border-tag-default);
|
|
7
7
|
--x-color-text-tag-default-selected: var(--x-color-text-tag-default);
|
|
8
|
+
--x-color-background-tag-default-curated: var(--x-color-background-tag-default);
|
|
9
|
+
--x-color-border-tag-default-curated: var(--x-color-border-tag-default);
|
|
10
|
+
--x-color-text-tag-default-curated: var(--x-color-text-tag-default);
|
|
11
|
+
--x-color-background-tag-default-curated-selected: var(--x-color-background-tag-default-selected);
|
|
12
|
+
--x-color-border-tag-default-curated-selected: var(--x-color-border-tag-default-selected);
|
|
13
|
+
--x-color-text-tag-default-curated-selected: var(--x-color-text-tag-default-selected);
|
|
8
14
|
--x-size-border-width-tag-default: var(--x-size-border-width-base);
|
|
9
15
|
--x-size-border-width-top-tag-default: var(--x-size-border-width-tag-default);
|
|
10
16
|
--x-size-border-width-right-tag-default: var(--x-size-border-width-tag-default);
|
|
@@ -26,7 +32,17 @@
|
|
|
26
32
|
--x-font-family-tag-default-selected: var(--x-font-family-tag-default);
|
|
27
33
|
--x-size-font-tag-default-selected: var(--x-size-font-tag-default);
|
|
28
34
|
--x-size-line-height-tag-default-selected: var(--x-size-line-height-tag-default);
|
|
29
|
-
--x-number-font-weight-tag-default-selected: var(--x-number-font-weight-tag-default);
|
|
35
|
+
--x-number-font-weight-tag-default-selected: var(--x-number-font-weight-tag-default);
|
|
36
|
+
--x-font-family-tag-default-curated: var(--x-font-family-tag-default);
|
|
37
|
+
--x-size-font-tag-default-curated: var(--x-size-font-tag-default);
|
|
38
|
+
--x-size-line-height-tag-default-curated: var(--x-size-line-height-tag-default);
|
|
39
|
+
--x-number-font-weight-tag-default-curated: var(--x-number-font-weight-tag-default);
|
|
40
|
+
--x-font-family-tag-default-curated-selected: var(--x-font-family-tag-default-selected);
|
|
41
|
+
--x-size-font-tag-default-curated-selected: var(--x-size-font-tag-default-selected);
|
|
42
|
+
--x-size-line-height-tag-default-curated-selected: var(--x-size-line-height-tag-default-selected);
|
|
43
|
+
--x-number-font-weight-tag-default-curated-selected: var(
|
|
44
|
+
--x-number-font-weight-tag-default-selected
|
|
45
|
+
); }
|
|
30
46
|
|
|
31
47
|
@use 'sass:string';
|
|
32
48
|
[dir="ltr"] .x-tag {
|
|
@@ -128,6 +144,14 @@
|
|
|
128
144
|
--x-size-font-filter-default: var(--x-size-font-tag-default);
|
|
129
145
|
--x-number-font-weight-filter-count-default: var(--x-number-font-weight-tag-default);
|
|
130
146
|
--x-size-line-height-filter-default: var(--x-size-line-height-tag-default); }
|
|
147
|
+
.x-tag.x-tag.x-tag--is-curated {
|
|
148
|
+
background-color: var(--x-color-background-tag-default-curated);
|
|
149
|
+
border-color: var(--x-color-border-tag-default-curated);
|
|
150
|
+
color: var(--x-color-text-tag-default-curated);
|
|
151
|
+
line-height: var(--x-size-line-height-tag-default-curated);
|
|
152
|
+
font-family: var(--x-font-family-tag-default-curated);
|
|
153
|
+
font-size: var(--x-size-font-tag-default-curated);
|
|
154
|
+
font-weight: var(--x-number-font-weight-tag-default-curated); }
|
|
131
155
|
.x-tag.x-tag.x-tag--is-selected {
|
|
132
156
|
background-color: var(--x-color-background-tag-default-selected);
|
|
133
157
|
border-color: var(--x-color-border-tag-default-selected);
|
|
@@ -136,6 +160,14 @@
|
|
|
136
160
|
font-family: var(--x-font-family-tag-default-selected);
|
|
137
161
|
font-size: var(--x-size-font-tag-default-selected);
|
|
138
162
|
font-weight: var(--x-number-font-weight-tag-default-selected); }
|
|
163
|
+
.x-tag.x-tag.x-tag--is-selected.x-tag--is-curated {
|
|
164
|
+
background-color: var(--x-color-background-tag-default-curated-selected);
|
|
165
|
+
border-color: var(--x-color-border-tag-default-curated-selected);
|
|
166
|
+
color: var(--x-color-text-tag-default-curated-selected);
|
|
167
|
+
line-height: var(--x-size-line-height-tag-default-curated-selected);
|
|
168
|
+
font-family: var(--x-font-family-tag-default-curated-selected);
|
|
169
|
+
font-size: var(--x-size-font-tag-default-curated-selected);
|
|
170
|
+
font-weight: var(--x-number-font-weight-tag-default-curated-selected); }
|
|
139
171
|
.x-tag.x-tag.x-tag--is-selected.x-filter {
|
|
140
172
|
--x-color-text-filter-default-selected: var(--x-color-text-tag-default-selected);
|
|
141
173
|
--x-font-family-filter-default-selected: var(--x-font-family-tag-default-selected);
|
|
@@ -3,12 +3,22 @@
|
|
|
3
3
|
--x-color-border-tag-ghost: transparent;
|
|
4
4
|
--x-color-background-tag-selected-ghost: transparent;
|
|
5
5
|
--x-color-border-tag-selected-ghost: transparent;
|
|
6
|
-
--x-
|
|
6
|
+
--x-color-background-tag-curated-ghost: transparent;
|
|
7
|
+
--x-color-border-tag-curated-ghost: transparent;
|
|
8
|
+
--x-color-background-tag-curated-selected-ghost: transparent;
|
|
9
|
+
--x-color-border-tag-curated-selected-ghost: transparent;
|
|
10
|
+
--x-number-font-weight-tag-selected-ghost: var(--x-number-font-weight-base-bold);
|
|
11
|
+
--x-number-font-weight-tag-curated-selected-ghost: var(--x-number-font-weight-base-bold); }
|
|
7
12
|
|
|
8
13
|
.x-tag--ghost.x-tag,
|
|
9
14
|
.x-tag--ghost .x-tag {
|
|
10
15
|
--x-color-background-tag-default: var(--x-color-background-tag-ghost);
|
|
11
16
|
--x-color-border-tag-default: var(--x-color-border-tag-ghost);
|
|
17
|
+
--x-color-background-tag-default-curated: var(--x-color-background-tag-curated-ghost);
|
|
18
|
+
--x-color-border-tag-default-curated: var(--x-color-border-tag-curated-ghost);
|
|
12
19
|
--x-color-background-tag-default-selected: var(--x-color-background-tag-selected-ghost);
|
|
13
20
|
--x-color-border-tag-default-selected: var(--x-color-border-tag-selected-ghost);
|
|
14
|
-
--x-
|
|
21
|
+
--x-color-background-tag-default-curated-selected: var(--x-color-background-tag-curated-selected-ghost);
|
|
22
|
+
--x-color-border-tag-default-curated-selected: var(--x-color-border-tag-curated-selected-ghost);
|
|
23
|
+
--x-number-font-weight-tag-default-selected: var(--x-number-font-weight-tag-selected-ghost);
|
|
24
|
+
--x-number-font-weight-tag-default-curated-selected: var(--x-number-font-weight-tag-curated-selected-ghost); }
|
|
@@ -25,7 +25,6 @@ X-Components is a library usable everywhere not only for search experiences.
|
|
|
25
25
|
| [BaseEventsModal](./x-components.baseeventsmodal.md) | Component containing a modal that emits a [XEventsTypes.UserClickedCloseEventsModal](./x-components.xeventstypes.userclickedcloseeventsmodal.md) when clicking outside the content rendered in the default slot and can receive, through the eventsToCloseModal prop, a list of [xEvents](./x-components.xevent.md) to listen to in order to close also the modal, eventsToOpenModal prop, another list of [xEvents](./x-components.xevent.md) to customize the events to listen to open the modal and a prop, displayOverlay, to display an overlay over the rest of the html. The default slot offers the possibility to customize the modal content. |
|
|
26
26
|
| [BaseEventsModalClose](./x-components.baseeventsmodalclose.md) | Component contains an event button that emits [XEventsTypes.UserClickedCloseEventsModal](./x-components.xeventstypes.userclickedcloseeventsmodal.md) when clicked. It has a default slot to customize its contents. |
|
|
27
27
|
| [BaseEventsModalOpen](./x-components.baseeventsmodalopen.md) | Component contains an event button that emits [XEventsTypes.UserClickedOpenEventsModal](./x-components.xeventstypes.userclickedopeneventsmodal.md) when clicked. It has a default slot to customize its contents. |
|
|
28
|
-
| [BaseFilter](./x-components.basefilter.md) | Renders a button with a default slot. It receives a [BooleanFilter](./x-types.booleanfilter.md) that will be used in the default slot and the [XEvents](./x-components.xevent.md) that will be emitted when clicking the button. |
|
|
29
28
|
| [BaseGrid](./x-components.basegrid.md) | Grid component that is able to render different items based on their modelName value. In order to achieve this, it exposes a scopedSlot for each different modelName. In case the items used do not have modelName property, the default slot is used instead. It has a required property: the <code>items</code> to render; and an optional one: the number <code>columns</code> the grid is divided in. If the number of columns is not specified, the grid automatically fills the rows with as many columns as it can fit. |
|
|
30
29
|
| [BaseHeaderTogglePanel](./x-components.baseheadertogglepanel.md) | Toggle panel which uses the base toggle panel, adds a header and manage the open / close state of the panel. |
|
|
31
30
|
| [BaseIdModal](./x-components.baseidmodal.md) | Component containing a modal expecting a required prop, named <code>modalId</code>. It reacts to <code>UserClickedOpenModal</code>, <code>UserClickedCloseModal</code> and <code>UserClickedOutOfModal</code> events, when their payload matches the component's 'modalId' prop, to handle its open/close state. The default slot offers the possibility to customise the modal content. |
|
|
@@ -13,3 +13,9 @@ export default class SnippetConfigExtraParams extends Vue
|
|
|
13
13
|
```
|
|
14
14
|
<b>Extends:</b> Vue
|
|
15
15
|
|
|
16
|
+
## Properties
|
|
17
|
+
|
|
18
|
+
| Property | Modifiers | Type | Description |
|
|
19
|
+
| --- | --- | --- | --- |
|
|
20
|
+
| [values?](./x-components.snippetconfigextraparams.values.md) | | [Dictionary](./x-components.dictionary.md)<!-- --><unknown> | <i>(Optional)</i> A Dictionary where the keys are the extra param names and its values. |
|
|
21
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [SnippetConfigExtraParams](./x-components.snippetconfigextraparams.md) > [values](./x-components.snippetconfigextraparams.values.md)
|
|
4
|
+
|
|
5
|
+
## SnippetConfigExtraParams.values property
|
|
6
|
+
|
|
7
|
+
A Dictionary where the keys are the extra param names and its values.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
protected values?: Dictionary<unknown>;
|
|
13
|
+
```
|
package/docs/API-reference/components/extra-params/x-components.snippet-config-extra-params.md
CHANGED
|
@@ -9,6 +9,12 @@ title: SnippetConfigExtraParams
|
|
|
9
9
|
Extracts the extra parameters from the {@link SnippetConfig} and syncs it with the request
|
|
10
10
|
objects of every x-module.
|
|
11
11
|
|
|
12
|
+
## Props
|
|
13
|
+
|
|
14
|
+
| Name | Description | Type | Default |
|
|
15
|
+
| ------------------- | --------------------------------------------------------------------- | ----------------------- | ------------- |
|
|
16
|
+
| <code>values</code> | A Dictionary where the keys are the extra param names and its values. | <code>Dictionary</code> | <code></code> |
|
|
17
|
+
|
|
12
18
|
## See it in action
|
|
13
19
|
|
|
14
20
|
_See how the snippet config is injected and passed to the SnippetConfigExtraParams component._
|
|
@@ -16,9 +16,10 @@ Renders a number range filter, emitting the needed events when clicked.
|
|
|
16
16
|
|
|
17
17
|
## Slots
|
|
18
18
|
|
|
19
|
-
| Name | Description | Bindings<br />(name - type - description)
|
|
20
|
-
| -------------------- | --------------------------------------- |
|
|
21
|
-
| <code>default</code> | The
|
|
19
|
+
| Name | Description | Bindings<br />(name - type - description) |
|
|
20
|
+
| -------------------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
21
|
+
| <code>default</code> | The control element to render | **filter** <code>Filter</code> - The filter data<br />**clickFilter** <code>() => void</code> - Method that will invoke the needed actions after the user<br /> clicks the filter.<br />**cssClasses** <code>Object</code> - Object containing CSS classes to add to the button<br />**isDisabled** <code>Boolean</code> - True if the filter shouldn't be able to be selected by the<br /> user |
|
|
22
|
+
| <code>label</code> | The content to render inside the button | **filter** <code>Filter</code> - The filter data |
|
|
22
23
|
|
|
23
24
|
## Examples
|
|
24
25
|
|
package/facets/index.js
CHANGED
|
@@ -17,12 +17,11 @@ export { SingleSelectModifier } from '../js/x-modules/facets/entities/single-sel
|
|
|
17
17
|
export { default as Facets } from '../js/x-modules/facets/components/facets/facets.vue.js';
|
|
18
18
|
export { default as FacetsProvider } from '../js/x-modules/facets/components/facets/facets-provider.vue.js';
|
|
19
19
|
export { default as AllFilter } from '../js/x-modules/facets/components/filters/all-filter.vue.js';
|
|
20
|
-
export { default as BaseFilter } from '../js/x-modules/facets/components/filters/base-filter.vue.js';
|
|
21
20
|
export { default as EditableNumberRangeFilter } from '../js/x-modules/facets/components/filters/editable-number-range-filter.vue.js';
|
|
21
|
+
export { default as RenderlessFilter } from '../js/x-modules/facets/components/filters/renderless-filter.vue.js';
|
|
22
22
|
export { default as NumberRangeFilter } from '../js/x-modules/facets/components/filters/number-range-filter.vue.js';
|
|
23
23
|
export { default as FiltersInjectionMixin } from '../js/x-modules/facets/components/lists/filters-injection.mixin.js';
|
|
24
24
|
export { default as FiltersList } from '../js/x-modules/facets/components/lists/filters-list.vue.js';
|
|
25
|
-
export { default as RenderlessFilter } from '../js/x-modules/facets/components/filters/renderless-filter.vue.js';
|
|
26
25
|
export { default as HierarchicalFilter } from '../js/x-modules/facets/components/filters/hierarchical-filter.vue.js';
|
|
27
26
|
export { default as SimpleFilter } from '../js/x-modules/facets/components/filters/simple-filter.vue.js';
|
|
28
27
|
export { default as ExcludeFiltersWithNoResults } from '../js/x-modules/facets/components/lists/exclude-filters-with-no-results.vue.js';
|
package/js/index.js
CHANGED
|
@@ -191,12 +191,11 @@ export { SingleSelectModifier } from './x-modules/facets/entities/single-select.
|
|
|
191
191
|
export { default as Facets } from './x-modules/facets/components/facets/facets.vue.js';
|
|
192
192
|
export { default as FacetsProvider } from './x-modules/facets/components/facets/facets-provider.vue.js';
|
|
193
193
|
export { default as AllFilter } from './x-modules/facets/components/filters/all-filter.vue.js';
|
|
194
|
-
export { default as BaseFilter } from './x-modules/facets/components/filters/base-filter.vue.js';
|
|
195
194
|
export { default as EditableNumberRangeFilter } from './x-modules/facets/components/filters/editable-number-range-filter.vue.js';
|
|
195
|
+
export { default as RenderlessFilter } from './x-modules/facets/components/filters/renderless-filter.vue.js';
|
|
196
196
|
export { default as NumberRangeFilter } from './x-modules/facets/components/filters/number-range-filter.vue.js';
|
|
197
197
|
export { default as FiltersInjectionMixin } from './x-modules/facets/components/lists/filters-injection.mixin.js';
|
|
198
198
|
export { default as FiltersList } from './x-modules/facets/components/lists/filters-list.vue.js';
|
|
199
|
-
export { default as RenderlessFilter } from './x-modules/facets/components/filters/renderless-filter.vue.js';
|
|
200
199
|
export { default as HierarchicalFilter } from './x-modules/facets/components/filters/hierarchical-filter.vue.js';
|
|
201
200
|
export { default as SimpleFilter } from './x-modules/facets/components/filters/simple-filter.vue.js';
|
|
202
201
|
export { default as ExcludeFiltersWithNoResults } from './x-modules/facets/components/lists/exclude-filters-with-no-results.vue.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
|
@@ -193,8 +193,10 @@ var XPlugin = /** @class */ (function () {
|
|
|
193
193
|
if (!this.installedXModules.has(xModule.name)) {
|
|
194
194
|
var customizedXModule = this.customizeXModule(xModule);
|
|
195
195
|
this.registerStoreModule(customizedXModule);
|
|
196
|
-
this.registerWiring(customizedXModule);
|
|
197
196
|
this.registerStoreEmitters(customizedXModule);
|
|
197
|
+
// The wiring must be registered after the store emitters
|
|
198
|
+
// to allow lazy loaded modules work properly.
|
|
199
|
+
this.registerWiring(customizedXModule);
|
|
198
200
|
this.installedXModules.add(xModule.name);
|
|
199
201
|
}
|
|
200
202
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"x-plugin.js","sources":["../../../src/plugins/x-plugin.ts"],"sourcesContent":["import { SearchAdapter } from '@empathyco/x-adapter';\nimport { deepMerge } from '@empathyco/x-deep-merge';\nimport { PluginObject, VueConstructor } from 'vue';\nimport Vuex, { Module, Store } from 'vuex';\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 { Dictionary, forEach } from '../utils';\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-adapter#SearchAdapter | SearchAdapter} Is the middleware between\n * 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(): SearchAdapter {\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!: SearchAdapter;\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 install 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 install 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 install\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.createAdapterConfigChangedListener();\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.registerWiring(customizedXModule);\n this.registerStoreEmitters(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 register 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 * If the received adapter supports it, it registers a listener to emit the\n * {@link XEventsTypes.AdapterConfigChanged} event whenever the config of it changes.\n *\n * @internal\n */\n protected createAdapterConfigChangedListener(): void {\n this.options.adapter.addConfigChangedListener?.(newAdapterConfig => {\n this.bus.emit('AdapterConfigChanged', newAdapterConfig);\n });\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. A search adapter is needed for the plugin to work, and connect to\n * the API.\n * ```typescript\n * const adapter = new EmpathyAdapterBuilder()\n * .withConfiguration({instance: 'my-instance-id'})\n * .build();\n * Vue.use(xPlugin, { adapter });\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 an 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA;;;;;;;;;;;;;;IAuIE,iBAAmB,GAAS;;;;;;QA3ClB,sBAAiB,GAAG,IAAI,GAA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AC,eAAe,0CAAE,OAAO,CAAC,UAAA,OAAO;YAC3C,KAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;SAC/B,CAAC,CAAC;KACJ;;;;;;;IAQS,yCAAuB,GAAjC;QAAA,iBAKC;QAJC,OAAO,CAAC,OAAO,CAAC,eAAe,EAAE,UAAC,CAAC,EAAE,OAAO;YAC1C,KAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;SAC/B,CAAC,CAAC;QACH,OAAO,CAAC,eAAe,GAAG,EAAE,CAAC;KAC9B;;;;;;;IAQS,oDAAkC,GAA5C;QAAA,iBAIC;;QAHC,MAAA,MAAA,IAAI,CAAC,OAAO,CAAC,OAAO,EAAC,wBAAwB,mDAAG,UAAA,gBAAgB;YAC9D,KAAI,CAAC,GAAG,CAAC,IAAI,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,CAAC;SACzD,CAAC,CAAC;KACJ;;;;;;IAOS,iCAAe,GAAzB;QAAA,iBAIC;QAHC,OAAO,CAAC,gBAAgB,EAAE,UAAC,UAAU,EAAE,cAAc;YACnD,OAAA,KAAI,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC;SAAA,CAC5C,CAAC;KACH;;;;;;IAhVgB,uBAAe,GAA6C,EAAE,CAAC;IAiVlF,cAAC;CA3YD,IA2YC;AAED;;;;;;;;;;;;;;;;;;;;;;;;IAwBa,OAAO,GAAG,IAAI,OAAO,CAAC,GAAG;;;;"}
|
|
1
|
+
{"version":3,"file":"x-plugin.js","sources":["../../../src/plugins/x-plugin.ts"],"sourcesContent":["import { SearchAdapter } from '@empathyco/x-adapter';\nimport { deepMerge } from '@empathyco/x-deep-merge';\nimport { PluginObject, VueConstructor } from 'vue';\nimport Vuex, { Module, Store } from 'vuex';\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 { Dictionary, forEach } from '../utils';\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-adapter#SearchAdapter | SearchAdapter} Is the middleware between\n * 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(): SearchAdapter {\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!: SearchAdapter;\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 install 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 install 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 install\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.createAdapterConfigChangedListener();\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 register 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 * If the received adapter supports it, it registers a listener to emit the\n * {@link XEventsTypes.AdapterConfigChanged} event whenever the config of it changes.\n *\n * @internal\n */\n protected createAdapterConfigChangedListener(): void {\n this.options.adapter.addConfigChangedListener?.(newAdapterConfig => {\n this.bus.emit('AdapterConfigChanged', newAdapterConfig);\n });\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. A search adapter is needed for the plugin to work, and connect to\n * the API.\n * ```typescript\n * const adapter = new EmpathyAdapterBuilder()\n * .withConfiguration({instance: 'my-instance-id'})\n * .build();\n * Vue.use(xPlugin, { adapter });\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 an 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA;;;;;;;;;;;;;;IAuIE,iBAAmB,GAAS;;;;;;QA3ClB,sBAAiB,GAAG,IAAI,GAAG,EAAU,CAAC;;;;;;;;;QAUtC,gBAAW,GAAG,KAAK,CAAC;QAkC5B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;KAChB;IAzHD,sBAAkB,kBAAO;;;;;;;;;;aAAzB;YACE,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC;SACnC;;;OAAA;IAWD,sBAAkB,cAAG;;;;;;;;;;aAArB;YACE,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC;SAC/B;;;OAAA;IAUD,sBAAkB,gBAAK;;;;;;;;;aAAvB;YACE,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC;SACjC;;;OAAA;;;;;;;;IASgB,mBAAW,GAA5B;QACE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,MAAM,KAAK,CAAC,sDAAsD,CAAC,CAAC;SACrE;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;KACtB;;;;;;;;;IA0FM,uBAAe,GAAtB,UAAuB,OAAmB;QACxC,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;SACxC;aAAM;YACL,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC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A6C,EAAE,CAAC;IAmVlF,cAAC;CA7YD,IA6YC;AAED;;;;;;;;;;;;;;;;;;;;;;;;IAwBa,OAAO,GAAG,IAAI,OAAO,CAAC,GAAG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snippet-config-extra-params.vue.js","sources":["../../../../../src/x-modules/extra-params/components/snippet-config-extra-params.vue"],"sourcesContent":["<template>\n <ExtraParams :values=\"extraParams\" />\n</template>\n\n<script lang=\"ts\">\n import Vue from 'vue';\n import { Component, Watch, Inject } from 'vue-property-decorator';\n import { xComponentMixin } from '../../../components';\n import { Dictionary, forEach } from '../../../utils';\n import { SnippetConfig } from '../../../x-installer';\n import { extraParamsXModule } from '../x-module';\n import ExtraParams from './extra-params.vue';\n\n /**\n * Extracts the extra parameters from the {@link SnippetConfig} and syncs it with the request\n * objects of every x-module.\n *\n * @public\n */\n @Component({\n components: { ExtraParams },\n mixins: [xComponentMixin(extraParamsXModule)]\n })\n export default class SnippetConfigExtraParams extends Vue {\n /**\n * It injects {@link SnippetConfig} provided by an ancestor as snippetConfig.\n *\n * @internal\n */\n @Inject('snippetConfig')\n public snippetConfig!: SnippetConfig;\n\n /**\n * Custom object containing the extra params from the snippet config.\n *\n * @remarks This object keeps manually the desired snippet config properties to avoid\n * unnecessary re-renders.\n *\n * @internal\n */\n protected extraParams: Dictionary<unknown> = {};\n\n /**\n * Collection of properties from the snippet config not allowed to be sent as extra params.\n *\n * @internal\n */\n protected notAllowedExtraParams: Array<keyof SnippetConfig> = ['callbacks'
|
|
1
|
+
{"version":3,"file":"snippet-config-extra-params.vue.js","sources":["../../../../../src/x-modules/extra-params/components/snippet-config-extra-params.vue"],"sourcesContent":["<template>\n <ExtraParams :values=\"extraParams\" />\n</template>\n\n<script lang=\"ts\">\n import Vue from 'vue';\n import { Component, Watch, Inject, Prop } from 'vue-property-decorator';\n import { xComponentMixin } from '../../../components';\n import { Dictionary, forEach } from '../../../utils';\n import { SnippetConfig } from '../../../x-installer';\n import { extraParamsXModule } from '../x-module';\n import ExtraParams from './extra-params.vue';\n\n /**\n * Extracts the extra parameters from the {@link SnippetConfig} and syncs it with the request\n * objects of every x-module.\n *\n * @public\n */\n @Component({\n components: { ExtraParams },\n mixins: [xComponentMixin(extraParamsXModule)]\n })\n export default class SnippetConfigExtraParams extends Vue {\n /**\n * It injects {@link SnippetConfig} provided by an ancestor as snippetConfig.\n *\n * @internal\n */\n @Inject('snippetConfig')\n public snippetConfig!: SnippetConfig;\n\n /**\n * A Dictionary where the keys are the extra param names and its values.\n *\n * @public\n */\n @Prop()\n protected values?: Dictionary<unknown>;\n\n /**\n * Custom object containing the extra params from the snippet config.\n *\n * @remarks This object keeps manually the desired snippet config properties to avoid\n * unnecessary re-renders.\n *\n * @internal\n */\n protected extraParams: Dictionary<unknown> = {};\n\n /**\n * Collection of properties from the snippet config not allowed to be sent as extra params.\n *\n * @internal\n */\n protected notAllowedExtraParams: Array<keyof SnippetConfig> = [\n 'callbacks',\n 'productId',\n 'instance',\n 'lang',\n 'searchLang',\n 'consent',\n 'documentDirection',\n 'currency'\n ];\n\n /**\n * Updates the extraParams object when the snippet config changes.\n *\n * @param snippetConfig - The new snippet config.\n *\n * @internal\n */\n @Watch('snippetConfig', { deep: true, immediate: true })\n syncExtraParams(snippetConfig: SnippetConfig): void {\n forEach({ ...snippetConfig, ...this.values }, (name, value) => {\n if (this.notAllowedExtraParams.includes(name)) {\n return;\n }\n this.$set(this.extraParams, name, value);\n });\n }\n }\n</script>\n\n<docs lang=\"mdx\">\n## See it in action\n\n_See how the snippet config is injected and passed to the SnippetConfigExtraParams component._\n\n```vue\n<template>\n <Provider>\n <SnippetConfigExtraParams />\n </Provider>\n</template>\n\n<script>\n import { SnippetConfigExtraParams } from '@empathyco/x-components/extra-params';\n\n const Provider = {\n provide: {\n snippetConfig: {\n instance: 'demo',\n lang: 'es',\n warehouse: 1234\n }\n }\n };\n\n export default {\n name: 'SnippetConfigExtraParamsDemo',\n components: {\n Provider,\n SnippetConfigExtraParams\n }\n };\n</script>\n```\n</docs>\n"],"names":["const"],"mappings":";;;;AAEAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|