vviinn-widgets 2.40.2 → 2.40.4
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/dist/cjs/{package-66fc2d42.js → package-d2581f68.js} +1 -1
- package/dist/cjs/vviinn-carousel_4.cjs.entry.js +1 -1
- package/dist/cjs/vviinn-vpr-button.cjs.entry.js +1 -1
- package/dist/cjs/vviinn-vps-button.cjs.entry.js +1 -1
- package/dist/cjs/vviinn-vps-widget.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/image-search/search-filters/search-filters.js +2 -2
- package/dist/collection/components/vviinn-carousel/vviinn-carousel.js +2 -2
- package/dist/collection/components/vviinn-example-image/vviinn-example-image.js +3 -3
- package/dist/collection/components/vviinn-image-selector/vviinn-image-selector.js +3 -3
- package/dist/collection/components/vviinn-image-view/vviinn-detected-object/vviinn-detected-object.js +2 -2
- package/dist/collection/components/vviinn-image-view/vviinn-image-view.js +2 -2
- package/dist/collection/components/vviinn-modal/vviinn-modal.js +1 -1
- package/dist/collection/components/vviinn-product-card/vviinn-product-card.js +5 -5
- package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.js +1 -1
- package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.js +10 -10
- package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-vidget.js +11 -11
- package/dist/collection/components/vviinn-vps-button/vviinn-vps-button.js +13 -13
- package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.js +13 -13
- package/dist/collection/interfaces/generated.js +1 -0
- package/dist/esm/{package-e0b16841.js → package-a3630ee2.js} +1 -1
- package/dist/esm/vviinn-carousel_4.entry.js +1 -1
- package/dist/esm/vviinn-vpr-button.entry.js +1 -1
- package/dist/esm/vviinn-vps-button.entry.js +1 -1
- package/dist/esm/vviinn-vps-widget.entry.js +1 -1
- package/dist/stencil-react-generated/index.ts +35 -0
- package/dist/stencil-react-generated/react-component-lib/createComponent.tsx +106 -0
- package/dist/stencil-react-generated/react-component-lib/createOverlayComponent.tsx +142 -0
- package/dist/stencil-react-generated/react-component-lib/index.ts +2 -0
- package/dist/stencil-react-generated/react-component-lib/interfaces.ts +34 -0
- package/dist/stencil-react-generated/react-component-lib/utils/attachProps.ts +125 -0
- package/dist/stencil-react-generated/react-component-lib/utils/case.ts +7 -0
- package/dist/stencil-react-generated/react-component-lib/utils/dev.ts +14 -0
- package/dist/stencil-react-generated/react-component-lib/utils/index.tsx +50 -0
- package/dist/types/analytics/GAnalytics.d.ts +4 -4
- package/dist/types/interfaces/generated.d.ts +869 -0
- package/{www/build/p-28feba37.entry.js → dist/vviinn-widgets/p-0da483ad.entry.js} +1 -1
- package/dist/vviinn-widgets/p-3d0dd3d8.js +1 -0
- package/dist/vviinn-widgets/{p-c6e8ddfb.entry.js → p-5d0b378d.entry.js} +1 -1
- package/dist/vviinn-widgets/{p-e12ab596.entry.js → p-8e621b0d.entry.js} +1 -1
- package/dist/vviinn-widgets/{p-f2486332.entry.js → p-a02841dd.entry.js} +1 -1
- package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
- package/package.json +2 -1
- package/{dist/vviinn-widgets/p-28feba37.entry.js → www/build/p-0da483ad.entry.js} +1 -1
- package/www/build/p-3d0dd3d8.js +1 -0
- package/www/build/p-51b897be.js +1 -0
- package/www/build/{p-c6e8ddfb.entry.js → p-5d0b378d.entry.js} +1 -1
- package/www/build/{p-e12ab596.entry.js → p-8e621b0d.entry.js} +1 -1
- package/www/build/{p-f2486332.entry.js → p-a02841dd.entry.js} +1 -1
- package/www/build/p-a67898be.css +1 -0
- package/www/build/vviinn-widgets.esm.js +1 -1
- package/www/index.html +2 -2
- package/dist/vviinn-widgets/p-b51f27f5.js +0 -1
- package/www/build/p-b51f27f5.js +0 -1
|
@@ -785,7 +785,7 @@ export class VviinnVpsWidget {
|
|
|
785
785
|
},
|
|
786
786
|
"complexType": {
|
|
787
787
|
"original": "BasicEventData",
|
|
788
|
-
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"
|
|
788
|
+
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"VPS\" | \"VCS\"; campaignTypeName: \"Similar Products\" | \"Visual Search\" | \"Cross-Selling\"; widgetId: string; widgetVersion: string; }",
|
|
789
789
|
"references": {
|
|
790
790
|
"BasicEventData": {
|
|
791
791
|
"location": "import",
|
|
@@ -805,7 +805,7 @@ export class VviinnVpsWidget {
|
|
|
805
805
|
},
|
|
806
806
|
"complexType": {
|
|
807
807
|
"original": "BasicEventData",
|
|
808
|
-
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"
|
|
808
|
+
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"VPS\" | \"VCS\"; campaignTypeName: \"Similar Products\" | \"Visual Search\" | \"Cross-Selling\"; widgetId: string; widgetVersion: string; }",
|
|
809
809
|
"references": {
|
|
810
810
|
"BasicEventData": {
|
|
811
811
|
"location": "import",
|
|
@@ -825,7 +825,7 @@ export class VviinnVpsWidget {
|
|
|
825
825
|
},
|
|
826
826
|
"complexType": {
|
|
827
827
|
"original": "BasicEventData",
|
|
828
|
-
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"
|
|
828
|
+
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"VPS\" | \"VCS\"; campaignTypeName: \"Similar Products\" | \"Visual Search\" | \"Cross-Selling\"; widgetId: string; widgetVersion: string; }",
|
|
829
829
|
"references": {
|
|
830
830
|
"BasicEventData": {
|
|
831
831
|
"location": "import",
|
|
@@ -845,7 +845,7 @@ export class VviinnVpsWidget {
|
|
|
845
845
|
},
|
|
846
846
|
"complexType": {
|
|
847
847
|
"original": "BasicEventData",
|
|
848
|
-
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"
|
|
848
|
+
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"VPS\" | \"VCS\"; campaignTypeName: \"Similar Products\" | \"Visual Search\" | \"Cross-Selling\"; widgetId: string; widgetVersion: string; }",
|
|
849
849
|
"references": {
|
|
850
850
|
"BasicEventData": {
|
|
851
851
|
"location": "import",
|
|
@@ -865,7 +865,7 @@ export class VviinnVpsWidget {
|
|
|
865
865
|
},
|
|
866
866
|
"complexType": {
|
|
867
867
|
"original": "ProductCardEventData",
|
|
868
|
-
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"
|
|
868
|
+
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"VPS\" | \"VCS\"; campaignTypeName: \"Similar Products\" | \"Visual Search\" | \"Cross-Selling\"; widgetId: string; widgetVersion: string; productId: string; productRank: number; productName: string; productType: string; clickEvent?: MouseEvent; }",
|
|
869
869
|
"references": {
|
|
870
870
|
"ProductCardEventData": {
|
|
871
871
|
"location": "import",
|
|
@@ -885,7 +885,7 @@ export class VviinnVpsWidget {
|
|
|
885
885
|
},
|
|
886
886
|
"complexType": {
|
|
887
887
|
"original": "ProductCardEventData",
|
|
888
|
-
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"
|
|
888
|
+
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"VPS\" | \"VCS\"; campaignTypeName: \"Similar Products\" | \"Visual Search\" | \"Cross-Selling\"; widgetId: string; widgetVersion: string; productId: string; productRank: number; productName: string; productType: string; clickEvent?: MouseEvent; }",
|
|
889
889
|
"references": {
|
|
890
890
|
"ProductCardEventData": {
|
|
891
891
|
"location": "import",
|
|
@@ -905,7 +905,7 @@ export class VviinnVpsWidget {
|
|
|
905
905
|
},
|
|
906
906
|
"complexType": {
|
|
907
907
|
"original": "ProductCardEventData",
|
|
908
|
-
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"
|
|
908
|
+
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"VPS\" | \"VCS\"; campaignTypeName: \"Similar Products\" | \"Visual Search\" | \"Cross-Selling\"; widgetId: string; widgetVersion: string; productId: string; productRank: number; productName: string; productType: string; clickEvent?: MouseEvent; }",
|
|
909
909
|
"references": {
|
|
910
910
|
"ProductCardEventData": {
|
|
911
911
|
"location": "import",
|
|
@@ -925,7 +925,7 @@ export class VviinnVpsWidget {
|
|
|
925
925
|
},
|
|
926
926
|
"complexType": {
|
|
927
927
|
"original": "BasicEventData",
|
|
928
|
-
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"
|
|
928
|
+
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"VPS\" | \"VCS\"; campaignTypeName: \"Similar Products\" | \"Visual Search\" | \"Cross-Selling\"; widgetId: string; widgetVersion: string; }",
|
|
929
929
|
"references": {
|
|
930
930
|
"BasicEventData": {
|
|
931
931
|
"location": "import",
|
|
@@ -945,7 +945,7 @@ export class VviinnVpsWidget {
|
|
|
945
945
|
},
|
|
946
946
|
"complexType": {
|
|
947
947
|
"original": "BasicEventData",
|
|
948
|
-
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"
|
|
948
|
+
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"VPS\" | \"VCS\"; campaignTypeName: \"Similar Products\" | \"Visual Search\" | \"Cross-Selling\"; widgetId: string; widgetVersion: string; }",
|
|
949
949
|
"references": {
|
|
950
950
|
"BasicEventData": {
|
|
951
951
|
"location": "import",
|
|
@@ -965,7 +965,7 @@ export class VviinnVpsWidget {
|
|
|
965
965
|
},
|
|
966
966
|
"complexType": {
|
|
967
967
|
"original": "BasicEventData",
|
|
968
|
-
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"
|
|
968
|
+
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"VPS\" | \"VCS\"; campaignTypeName: \"Similar Products\" | \"Visual Search\" | \"Cross-Selling\"; widgetId: string; widgetVersion: string; }",
|
|
969
969
|
"references": {
|
|
970
970
|
"BasicEventData": {
|
|
971
971
|
"location": "import",
|
|
@@ -985,7 +985,7 @@ export class VviinnVpsWidget {
|
|
|
985
985
|
},
|
|
986
986
|
"complexType": {
|
|
987
987
|
"original": "BasicEventData",
|
|
988
|
-
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"
|
|
988
|
+
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"VPS\" | \"VCS\"; campaignTypeName: \"Similar Products\" | \"Visual Search\" | \"Cross-Selling\"; widgetId: string; widgetVersion: string; }",
|
|
989
989
|
"references": {
|
|
990
990
|
"BasicEventData": {
|
|
991
991
|
"location": "import",
|
|
@@ -1005,7 +1005,7 @@ export class VviinnVpsWidget {
|
|
|
1005
1005
|
},
|
|
1006
1006
|
"complexType": {
|
|
1007
1007
|
"original": "SelectObjectEventData",
|
|
1008
|
-
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"
|
|
1008
|
+
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"VPS\" | \"VCS\"; campaignTypeName: \"Similar Products\" | \"Visual Search\" | \"Cross-Selling\"; widgetId: string; widgetVersion: string; detectedObject: ValueObject<DetectedObject>; }",
|
|
1009
1009
|
"references": {
|
|
1010
1010
|
"SelectObjectEventData": {
|
|
1011
1011
|
"location": "import",
|
|
@@ -1025,7 +1025,7 @@ export class VviinnVpsWidget {
|
|
|
1025
1025
|
},
|
|
1026
1026
|
"complexType": {
|
|
1027
1027
|
"original": "SelectFilterEventData",
|
|
1028
|
-
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"
|
|
1028
|
+
"resolved": "{ widgetType: \"VPR\" | \"VPS\"; campaignTypeId: \"VPR\" | \"VPS\" | \"VCS\"; campaignTypeName: \"Similar Products\" | \"Visual Search\" | \"Cross-Selling\"; widgetId: string; widgetVersion: string; action: FilterAction; kind: FilterKind; filterName?: string; }",
|
|
1029
1029
|
"references": {
|
|
1030
1030
|
"SelectFilterEventData": {
|
|
1031
1031
|
"location": "import",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import { _ as _Array, O as Option, S as Semigroup, a as _function, h as has, t a
|
|
|
3
3
|
import { C as ChevronIcon, U as UpdateIcon } from './index-dac5d1c8.js';
|
|
4
4
|
import { i as instance } from './i18next-387f2b0a.js';
|
|
5
5
|
import { s as slotChangeListener, c as campaignTypeNames, f as fromString, a as fold, S as SlotSkeleton } from './customized-slots-6b70a8f6.js';
|
|
6
|
-
import { v as version } from './package-
|
|
6
|
+
import { v as version } from './package-a3630ee2.js';
|
|
7
7
|
import { v as v4, c as createTrackingApi, a as createAddToBasketVpcEvent, b as createAddToBasketVprEvent, d as createWidgetVpcEvent, e as createWidgetVprEvent, f as createResultVpcEventByType, g as createResultVprEventByType, h as createProductVpcEventByType, i as createProductVprEventByType } from './index-53105ad4.js';
|
|
8
8
|
|
|
9
9
|
const vviinnCarouselCss = ":host{--vviinn-progressbar-width:0;--vviinn-carousel-item-width:150px;--vviinn-carousel-columns-internal:var(--vviinn-carousel-columns, 4);--vviinn-carousel-image-width-system:140px}.body{display:flex;position:relative;width:var(--vviinn-carousel-content-width);flex-direction:column}.content-wrapper *{box-sizing:border-box}.content-wrapper{overflow-y:hidden;overflow-x:auto;flex-grow:1}.bullets{margin-top:16px;display:flex;flex-direction:row;grid-gap:24px;justify-content:center}.bullet{width:10px;height:10px;background:#e0e0e0;border-radius:50%;cursor:pointer}.bullet.active{background:#161616}.content:not(.show-scrollbar),.content.grid{scrollbar-color:#fff0 #fff0}.content:not(.show-scrollbar)::-webkit-scrollbar,.content.grid::-webkit-scrollbar{opacity:0}.content{display:flex;flex-direction:row;grid-gap:8px;overflow-y:hidden;overflow-x:auto;flex-grow:1;padding-bottom:16px}.content.left>*{scroll-snap-align:start}.content.right>*{scroll-snap-align:end}:host(.continuity) .prev,:host(.continuity) .next{border-radius:2px}:host(.grid) .prev,:host(.grid) .next{border-radius:50%}.prev,.next{align-items:center;background-color:white;border:none;box-shadow:0px 2px 6px rgba(0, 0, 0, 0.15);fill:#525252;cursor:pointer;display:grid;height:40px;justify-items:center;position:absolute;top:calc(50% - 20px);width:40px;z-index:1;padding:0;margin:0}.next:disabled,.prev:disabled{display:none}.prev svg{transform:rotate(180deg);margin-left:-5px}.prev{left:0}.next{right:0}.items-group{display:grid;grid-gap:16px;grid-template-columns:repeat(var(--vviinn-carousel-columns-internal), 1fr);min-width:100%}vviinn-product-card::part(price-container){text-align:center}:host(.classic) vviinn-product-card::part(title),:host(.classic) vviinn-product-card::part(brand),:host(.classic) vviinn-product-card::part(type){text-align:center}@media (max-width: 480px){:host(.modern) button{display:none}.items-group{grid-template-columns:repeat(2, 1fr)}}";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-1f3eaf12.js';
|
|
2
|
-
import { v as version } from './package-
|
|
2
|
+
import { v as version } from './package-a3630ee2.js';
|
|
3
3
|
import { V as VisualSearchIcon } from './index-dac5d1c8.js';
|
|
4
4
|
|
|
5
5
|
const vviinnVprButtonCss = ":host{display:block}";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-1f3eaf12.js';
|
|
2
|
-
import { v as version } from './package-
|
|
2
|
+
import { v as version } from './package-a3630ee2.js';
|
|
3
3
|
import { a as CameraIcon } from './index-dac5d1c8.js';
|
|
4
4
|
import { c as campaignTypeNames, S as SlotSkeleton } from './customized-slots-6b70a8f6.js';
|
|
5
5
|
import { D as DEFAULT_EXAMPLE_IMAGE } from './constants-8bf233a9.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-1f3eaf12.js';
|
|
2
2
|
import { i as imageSearchState, s as state, a as _function, O as Option, k as parseExcluded, q as isEmpty } from './imageSearch.store-c0f2a178.js';
|
|
3
3
|
import { i as instance } from './i18next-387f2b0a.js';
|
|
4
|
-
import { v as version } from './package-
|
|
4
|
+
import { v as version } from './package-a3630ee2.js';
|
|
5
5
|
import { c as campaignTypeNames, s as slotChangeListener, S as SlotSkeleton } from './customized-slots-6b70a8f6.js';
|
|
6
6
|
import { j as createSearchEvent, k as createFilterEvent, v as v4, c as createTrackingApi, l as createWidgetVpsEvent, m as createProductVpsEventByType, n as createResultVpsEventByType } from './index-53105ad4.js';
|
|
7
7
|
import { c as CameraActionIcon, d as UploadActionIcon } from './index-dac5d1c8.js';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* auto-generated react proxies */
|
|
4
|
+
import { createReactComponent } from './react-component-lib';
|
|
5
|
+
|
|
6
|
+
import type { JSX } from 'stencil-library';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export const SearchFilters = /*@__PURE__*/createReactComponent<JSX.SearchFilters, HTMLSearchFiltersElement>('search-filters');
|
|
11
|
+
export const VviinnButton = /*@__PURE__*/createReactComponent<JSX.VviinnButton, HTMLVviinnButtonElement>('vviinn-button');
|
|
12
|
+
export const VviinnCarousel = /*@__PURE__*/createReactComponent<JSX.VviinnCarousel, HTMLVviinnCarouselElement>('vviinn-carousel');
|
|
13
|
+
export const VviinnDetectedObject = /*@__PURE__*/createReactComponent<JSX.VviinnDetectedObject, HTMLVviinnDetectedObjectElement>('vviinn-detected-object');
|
|
14
|
+
export const VviinnEmptyResults = /*@__PURE__*/createReactComponent<JSX.VviinnEmptyResults, HTMLVviinnEmptyResultsElement>('vviinn-empty-results');
|
|
15
|
+
export const VviinnError = /*@__PURE__*/createReactComponent<JSX.VviinnError, HTMLVviinnErrorElement>('vviinn-error');
|
|
16
|
+
export const VviinnExampleImage = /*@__PURE__*/createReactComponent<JSX.VviinnExampleImage, HTMLVviinnExampleImageElement>('vviinn-example-image');
|
|
17
|
+
export const VviinnImageSelector = /*@__PURE__*/createReactComponent<JSX.VviinnImageSelector, HTMLVviinnImageSelectorElement>('vviinn-image-selector');
|
|
18
|
+
export const VviinnImageView = /*@__PURE__*/createReactComponent<JSX.VviinnImageView, HTMLVviinnImageViewElement>('vviinn-image-view');
|
|
19
|
+
export const VviinnModal = /*@__PURE__*/createReactComponent<JSX.VviinnModal, HTMLVviinnModalElement>('vviinn-modal');
|
|
20
|
+
export const VviinnOverlay = /*@__PURE__*/createReactComponent<JSX.VviinnOverlay, HTMLVviinnOverlayElement>('vviinn-overlay');
|
|
21
|
+
export const VviinnOverlayedModal = /*@__PURE__*/createReactComponent<JSX.VviinnOverlayedModal, HTMLVviinnOverlayedModalElement>('vviinn-overlayed-modal');
|
|
22
|
+
export const VviinnPreloader = /*@__PURE__*/createReactComponent<JSX.VviinnPreloader, HTMLVviinnPreloaderElement>('vviinn-preloader');
|
|
23
|
+
export const VviinnPrivacyBadge = /*@__PURE__*/createReactComponent<JSX.VviinnPrivacyBadge, HTMLVviinnPrivacyBadgeElement>('vviinn-privacy-badge');
|
|
24
|
+
export const VviinnProductCard = /*@__PURE__*/createReactComponent<JSX.VviinnProductCard, HTMLVviinnProductCardElement>('vviinn-product-card');
|
|
25
|
+
export const VviinnRecommendationsSidebar = /*@__PURE__*/createReactComponent<JSX.VviinnRecommendationsSidebar, HTMLVviinnRecommendationsSidebarElement>('vviinn-recommendations-sidebar');
|
|
26
|
+
export const VviinnServerError = /*@__PURE__*/createReactComponent<JSX.VviinnServerError, HTMLVviinnServerErrorElement>('vviinn-server-error');
|
|
27
|
+
export const VviinnSkeleton = /*@__PURE__*/createReactComponent<JSX.VviinnSkeleton, HTMLVviinnSkeletonElement>('vviinn-skeleton');
|
|
28
|
+
export const VviinnSlide = /*@__PURE__*/createReactComponent<JSX.VviinnSlide, HTMLVviinnSlideElement>('vviinn-slide');
|
|
29
|
+
export const VviinnSlider = /*@__PURE__*/createReactComponent<JSX.VviinnSlider, HTMLVviinnSliderElement>('vviinn-slider');
|
|
30
|
+
export const VviinnTeaser = /*@__PURE__*/createReactComponent<JSX.VviinnTeaser, HTMLVviinnTeaserElement>('vviinn-teaser');
|
|
31
|
+
export const VviinnVprButton = /*@__PURE__*/createReactComponent<JSX.VviinnVprButton, HTMLVviinnVprButtonElement>('vviinn-vpr-button');
|
|
32
|
+
export const VviinnVprWidget = /*@__PURE__*/createReactComponent<JSX.VviinnVprWidget, HTMLVviinnVprWidgetElement>('vviinn-vpr-widget');
|
|
33
|
+
export const VviinnVpsButton = /*@__PURE__*/createReactComponent<JSX.VviinnVpsButton, HTMLVviinnVpsButtonElement>('vviinn-vps-button');
|
|
34
|
+
export const VviinnVpsWidget = /*@__PURE__*/createReactComponent<JSX.VviinnVpsWidget, HTMLVviinnVpsWidgetElement>('vviinn-vps-widget');
|
|
35
|
+
export const VviinnWrongFormat = /*@__PURE__*/createReactComponent<JSX.VviinnWrongFormat, HTMLVviinnWrongFormatElement>('vviinn-wrong-format');
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React, { createElement } from 'react';
|
|
2
|
+
|
|
3
|
+
import { attachProps, camelToDashCase, createForwardRef, dashToPascalCase, isCoveredByReact, mergeRefs } from './utils';
|
|
4
|
+
|
|
5
|
+
export interface HTMLStencilElement extends HTMLElement {
|
|
6
|
+
componentOnReady(): Promise<this>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface StencilReactInternalProps<ElementType> extends React.HTMLAttributes<ElementType> {
|
|
10
|
+
forwardedRef: React.RefObject<ElementType>;
|
|
11
|
+
ref?: React.Ref<any>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const createReactComponent = <
|
|
15
|
+
PropType,
|
|
16
|
+
ElementType extends HTMLStencilElement,
|
|
17
|
+
ContextStateType = {},
|
|
18
|
+
ExpandedPropsTypes = {}
|
|
19
|
+
>(
|
|
20
|
+
tagName: string,
|
|
21
|
+
ReactComponentContext?: React.Context<ContextStateType>,
|
|
22
|
+
manipulatePropsFunction?: (
|
|
23
|
+
originalProps: StencilReactInternalProps<ElementType>,
|
|
24
|
+
propsToPass: any
|
|
25
|
+
) => ExpandedPropsTypes,
|
|
26
|
+
defineCustomElement?: () => void
|
|
27
|
+
) => {
|
|
28
|
+
if (defineCustomElement !== undefined) {
|
|
29
|
+
defineCustomElement();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const displayName = dashToPascalCase(tagName);
|
|
33
|
+
const ReactComponent = class extends React.Component<StencilReactInternalProps<ElementType>> {
|
|
34
|
+
componentEl!: ElementType;
|
|
35
|
+
|
|
36
|
+
setComponentElRef = (element: ElementType) => {
|
|
37
|
+
this.componentEl = element;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
constructor(props: StencilReactInternalProps<ElementType>) {
|
|
41
|
+
super(props);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
componentDidMount() {
|
|
45
|
+
this.componentDidUpdate(this.props);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
componentDidUpdate(prevProps: StencilReactInternalProps<ElementType>) {
|
|
49
|
+
attachProps(this.componentEl, this.props, prevProps);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
render() {
|
|
53
|
+
const { children, forwardedRef, style, className, ref, ...cProps } = this.props;
|
|
54
|
+
|
|
55
|
+
let propsToPass = Object.keys(cProps).reduce((acc: any, name) => {
|
|
56
|
+
const value = (cProps as any)[name];
|
|
57
|
+
|
|
58
|
+
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
|
|
59
|
+
const eventName = name.substring(2).toLowerCase();
|
|
60
|
+
if (typeof document !== 'undefined' && isCoveredByReact(eventName)) {
|
|
61
|
+
acc[name] = value;
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
// we should only render strings, booleans, and numbers as attrs in html.
|
|
65
|
+
// objects, functions, arrays etc get synced via properties on mount.
|
|
66
|
+
const type = typeof value;
|
|
67
|
+
|
|
68
|
+
if (type === 'string' || type === 'boolean' || type === 'number') {
|
|
69
|
+
acc[camelToDashCase(name)] = value;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return acc;
|
|
73
|
+
}, {} as ExpandedPropsTypes);
|
|
74
|
+
|
|
75
|
+
if (manipulatePropsFunction) {
|
|
76
|
+
propsToPass = manipulatePropsFunction(this.props, propsToPass);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const newProps: Omit<StencilReactInternalProps<ElementType>, 'forwardedRef'> = {
|
|
80
|
+
...propsToPass,
|
|
81
|
+
ref: mergeRefs(forwardedRef, this.setComponentElRef),
|
|
82
|
+
style,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* We use createElement here instead of
|
|
87
|
+
* React.createElement to work around a
|
|
88
|
+
* bug in Vite (https://github.com/vitejs/vite/issues/6104).
|
|
89
|
+
* React.createElement causes all elements to be rendered
|
|
90
|
+
* as <tagname> instead of the actual Web Component.
|
|
91
|
+
*/
|
|
92
|
+
return createElement(tagName, newProps, children);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
static get displayName() {
|
|
96
|
+
return displayName;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// If context was passed to createReactComponent then conditionally add it to the Component Class
|
|
101
|
+
if (ReactComponentContext) {
|
|
102
|
+
ReactComponent.contextType = ReactComponentContext;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return createForwardRef<PropType, ElementType>(ReactComponent, displayName);
|
|
106
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
|
|
4
|
+
import { OverlayEventDetail } from './interfaces';
|
|
5
|
+
import { StencilReactForwardedRef, attachProps, dashToPascalCase, defineCustomElement, setRef } from './utils';
|
|
6
|
+
|
|
7
|
+
interface OverlayElement extends HTMLElement {
|
|
8
|
+
present: () => Promise<void>;
|
|
9
|
+
dismiss: (data?: any, role?: string | undefined) => Promise<boolean>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ReactOverlayProps {
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
isOpen: boolean;
|
|
15
|
+
onDidDismiss?: (event: CustomEvent<OverlayEventDetail>) => void;
|
|
16
|
+
onDidPresent?: (event: CustomEvent<OverlayEventDetail>) => void;
|
|
17
|
+
onWillDismiss?: (event: CustomEvent<OverlayEventDetail>) => void;
|
|
18
|
+
onWillPresent?: (event: CustomEvent<OverlayEventDetail>) => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const createOverlayComponent = <OverlayComponent extends object, OverlayType extends OverlayElement>(
|
|
22
|
+
tagName: string,
|
|
23
|
+
controller: { create: (options: any) => Promise<OverlayType> },
|
|
24
|
+
customElement?: any
|
|
25
|
+
) => {
|
|
26
|
+
defineCustomElement(tagName, customElement);
|
|
27
|
+
|
|
28
|
+
const displayName = dashToPascalCase(tagName);
|
|
29
|
+
const didDismissEventName = `on${displayName}DidDismiss`;
|
|
30
|
+
const didPresentEventName = `on${displayName}DidPresent`;
|
|
31
|
+
const willDismissEventName = `on${displayName}WillDismiss`;
|
|
32
|
+
const willPresentEventName = `on${displayName}WillPresent`;
|
|
33
|
+
|
|
34
|
+
type Props = OverlayComponent &
|
|
35
|
+
ReactOverlayProps & {
|
|
36
|
+
forwardedRef?: StencilReactForwardedRef<OverlayType>;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
let isDismissing = false;
|
|
40
|
+
|
|
41
|
+
class Overlay extends React.Component<Props> {
|
|
42
|
+
overlay?: OverlayType;
|
|
43
|
+
el!: HTMLDivElement;
|
|
44
|
+
|
|
45
|
+
constructor(props: Props) {
|
|
46
|
+
super(props);
|
|
47
|
+
if (typeof document !== 'undefined') {
|
|
48
|
+
this.el = document.createElement('div');
|
|
49
|
+
}
|
|
50
|
+
this.handleDismiss = this.handleDismiss.bind(this);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static get displayName() {
|
|
54
|
+
return displayName;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
componentDidMount() {
|
|
58
|
+
if (this.props.isOpen) {
|
|
59
|
+
this.present();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
componentWillUnmount() {
|
|
64
|
+
if (this.overlay) {
|
|
65
|
+
this.overlay.dismiss();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
handleDismiss(event: CustomEvent<OverlayEventDetail<any>>) {
|
|
70
|
+
if (this.props.onDidDismiss) {
|
|
71
|
+
this.props.onDidDismiss(event);
|
|
72
|
+
}
|
|
73
|
+
setRef(this.props.forwardedRef, null);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
shouldComponentUpdate(nextProps: Props) {
|
|
77
|
+
// Check if the overlay component is about to dismiss
|
|
78
|
+
if (this.overlay && nextProps.isOpen !== this.props.isOpen && nextProps.isOpen === false) {
|
|
79
|
+
isDismissing = true;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async componentDidUpdate(prevProps: Props) {
|
|
86
|
+
if (this.overlay) {
|
|
87
|
+
attachProps(this.overlay, this.props, prevProps);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (prevProps.isOpen !== this.props.isOpen && this.props.isOpen === true) {
|
|
91
|
+
this.present(prevProps);
|
|
92
|
+
}
|
|
93
|
+
if (this.overlay && prevProps.isOpen !== this.props.isOpen && this.props.isOpen === false) {
|
|
94
|
+
await this.overlay.dismiss();
|
|
95
|
+
isDismissing = false;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Now that the overlay is dismissed
|
|
99
|
+
* we need to render again so that any
|
|
100
|
+
* inner components will be unmounted
|
|
101
|
+
*/
|
|
102
|
+
this.forceUpdate();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async present(prevProps?: Props) {
|
|
107
|
+
const { children, isOpen, onDidDismiss, onDidPresent, onWillDismiss, onWillPresent, ...cProps } = this.props;
|
|
108
|
+
const elementProps = {
|
|
109
|
+
...cProps,
|
|
110
|
+
ref: this.props.forwardedRef,
|
|
111
|
+
[didDismissEventName]: this.handleDismiss,
|
|
112
|
+
[didPresentEventName]: (e: CustomEvent) => this.props.onDidPresent && this.props.onDidPresent(e),
|
|
113
|
+
[willDismissEventName]: (e: CustomEvent) => this.props.onWillDismiss && this.props.onWillDismiss(e),
|
|
114
|
+
[willPresentEventName]: (e: CustomEvent) => this.props.onWillPresent && this.props.onWillPresent(e),
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
this.overlay = await controller.create({
|
|
118
|
+
...elementProps,
|
|
119
|
+
component: this.el,
|
|
120
|
+
componentProps: {},
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
setRef(this.props.forwardedRef, this.overlay);
|
|
124
|
+
attachProps(this.overlay, elementProps, prevProps);
|
|
125
|
+
|
|
126
|
+
await this.overlay.present();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
render() {
|
|
130
|
+
/**
|
|
131
|
+
* Continue to render the component even when
|
|
132
|
+
* overlay is dismissing otherwise component
|
|
133
|
+
* will be hidden before animation is done.
|
|
134
|
+
*/
|
|
135
|
+
return ReactDOM.createPortal(this.props.isOpen || isDismissing ? this.props.children : null, this.el);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return React.forwardRef<OverlayType, Props>((props, ref) => {
|
|
140
|
+
return <Overlay {...props} forwardedRef={ref} />;
|
|
141
|
+
});
|
|
142
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// General types important to applications using stencil built components
|
|
2
|
+
export interface EventEmitter<T = any> {
|
|
3
|
+
emit: (data?: T) => CustomEvent<T>;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface StyleReactProps {
|
|
7
|
+
class?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
style?: { [key: string]: any };
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface OverlayEventDetail<T = any> {
|
|
13
|
+
data?: T;
|
|
14
|
+
role?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface OverlayInterface {
|
|
18
|
+
el: HTMLElement;
|
|
19
|
+
animated: boolean;
|
|
20
|
+
keyboardClose: boolean;
|
|
21
|
+
overlayIndex: number;
|
|
22
|
+
presented: boolean;
|
|
23
|
+
|
|
24
|
+
enterAnimation?: any;
|
|
25
|
+
leaveAnimation?: any;
|
|
26
|
+
|
|
27
|
+
didPresent: EventEmitter<void>;
|
|
28
|
+
willPresent: EventEmitter<void>;
|
|
29
|
+
willDismiss: EventEmitter<OverlayEventDetail>;
|
|
30
|
+
didDismiss: EventEmitter<OverlayEventDetail>;
|
|
31
|
+
|
|
32
|
+
present(): Promise<void>;
|
|
33
|
+
dismiss(data?: any, role?: string): Promise<boolean>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { camelToDashCase } from './case';
|
|
2
|
+
|
|
3
|
+
export const attachProps = (node: HTMLElement, newProps: any, oldProps: any = {}) => {
|
|
4
|
+
// some test frameworks don't render DOM elements, so we test here to make sure we are dealing with DOM first
|
|
5
|
+
if (node instanceof Element) {
|
|
6
|
+
// add any classes in className to the class list
|
|
7
|
+
const className = getClassName(node.classList, newProps, oldProps);
|
|
8
|
+
if (className !== '') {
|
|
9
|
+
node.className = className;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
Object.keys(newProps).forEach((name) => {
|
|
13
|
+
if (
|
|
14
|
+
name === 'children' ||
|
|
15
|
+
name === 'style' ||
|
|
16
|
+
name === 'ref' ||
|
|
17
|
+
name === 'class' ||
|
|
18
|
+
name === 'className' ||
|
|
19
|
+
name === 'forwardedRef'
|
|
20
|
+
) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
|
|
24
|
+
const eventName = name.substring(2);
|
|
25
|
+
const eventNameLc = eventName[0].toLowerCase() + eventName.substring(1);
|
|
26
|
+
|
|
27
|
+
if (!isCoveredByReact(eventNameLc)) {
|
|
28
|
+
syncEvent(node, eventNameLc, newProps[name]);
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
(node as any)[name] = newProps[name];
|
|
32
|
+
const propType = typeof newProps[name];
|
|
33
|
+
if (propType === 'string') {
|
|
34
|
+
node.setAttribute(camelToDashCase(name), newProps[name]);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const getClassName = (classList: DOMTokenList, newProps: any, oldProps: any) => {
|
|
42
|
+
const newClassProp: string = newProps.className || newProps.class;
|
|
43
|
+
const oldClassProp: string = oldProps.className || oldProps.class;
|
|
44
|
+
// map the classes to Maps for performance
|
|
45
|
+
const currentClasses = arrayToMap(classList);
|
|
46
|
+
const incomingPropClasses = arrayToMap(newClassProp ? newClassProp.split(' ') : []);
|
|
47
|
+
const oldPropClasses = arrayToMap(oldClassProp ? oldClassProp.split(' ') : []);
|
|
48
|
+
const finalClassNames: string[] = [];
|
|
49
|
+
// loop through each of the current classes on the component
|
|
50
|
+
// to see if it should be a part of the classNames added
|
|
51
|
+
currentClasses.forEach((currentClass) => {
|
|
52
|
+
if (incomingPropClasses.has(currentClass)) {
|
|
53
|
+
// add it as its already included in classnames coming in from newProps
|
|
54
|
+
finalClassNames.push(currentClass);
|
|
55
|
+
incomingPropClasses.delete(currentClass);
|
|
56
|
+
} else if (!oldPropClasses.has(currentClass)) {
|
|
57
|
+
// add it as it has NOT been removed by user
|
|
58
|
+
finalClassNames.push(currentClass);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
incomingPropClasses.forEach((s) => finalClassNames.push(s));
|
|
62
|
+
return finalClassNames.join(' ');
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Transforms a React event name to a browser event name.
|
|
67
|
+
*/
|
|
68
|
+
export const transformReactEventName = (eventNameSuffix: string) => {
|
|
69
|
+
switch (eventNameSuffix) {
|
|
70
|
+
case 'doubleclick':
|
|
71
|
+
return 'dblclick';
|
|
72
|
+
}
|
|
73
|
+
return eventNameSuffix;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Checks if an event is supported in the current execution environment.
|
|
78
|
+
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
79
|
+
*/
|
|
80
|
+
export const isCoveredByReact = (eventNameSuffix: string) => {
|
|
81
|
+
if (typeof document === 'undefined') {
|
|
82
|
+
return true;
|
|
83
|
+
} else {
|
|
84
|
+
const eventName = 'on' + transformReactEventName(eventNameSuffix);
|
|
85
|
+
let isSupported = eventName in document;
|
|
86
|
+
|
|
87
|
+
if (!isSupported) {
|
|
88
|
+
const element = document.createElement('div');
|
|
89
|
+
element.setAttribute(eventName, 'return;');
|
|
90
|
+
isSupported = typeof (element as any)[eventName] === 'function';
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return isSupported;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const syncEvent = (
|
|
98
|
+
node: Element & { __events?: { [key: string]: ((e: Event) => any) | undefined } },
|
|
99
|
+
eventName: string,
|
|
100
|
+
newEventHandler?: (e: Event) => any
|
|
101
|
+
) => {
|
|
102
|
+
const eventStore = node.__events || (node.__events = {});
|
|
103
|
+
const oldEventHandler = eventStore[eventName];
|
|
104
|
+
|
|
105
|
+
// Remove old listener so they don't double up.
|
|
106
|
+
if (oldEventHandler) {
|
|
107
|
+
node.removeEventListener(eventName, oldEventHandler);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Bind new listener.
|
|
111
|
+
node.addEventListener(
|
|
112
|
+
eventName,
|
|
113
|
+
(eventStore[eventName] = function handler(e: Event) {
|
|
114
|
+
if (newEventHandler) {
|
|
115
|
+
newEventHandler.call(this, e);
|
|
116
|
+
}
|
|
117
|
+
})
|
|
118
|
+
);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const arrayToMap = (arr: string[] | DOMTokenList) => {
|
|
122
|
+
const map = new Map<string, string>();
|
|
123
|
+
(arr as string[]).forEach((s: string) => map.set(s, s));
|
|
124
|
+
return map;
|
|
125
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const dashToPascalCase = (str: string) =>
|
|
2
|
+
str
|
|
3
|
+
.toLowerCase()
|
|
4
|
+
.split('-')
|
|
5
|
+
.map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
|
|
6
|
+
.join('');
|
|
7
|
+
export const camelToDashCase = (str: string) => str.replace(/([A-Z])/g, (m: string) => `-${m[0].toLowerCase()}`);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const isDevMode = () => {
|
|
2
|
+
return process && process.env && process.env.NODE_ENV === 'development';
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
const warnings: { [key: string]: boolean } = {};
|
|
6
|
+
|
|
7
|
+
export const deprecationWarning = (key: string, message: string) => {
|
|
8
|
+
if (isDevMode()) {
|
|
9
|
+
if (!warnings[key]) {
|
|
10
|
+
console.warn(message);
|
|
11
|
+
warnings[key] = true;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|