vviinn-widgets 2.0.0 → 2.2.1

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.
Files changed (106) hide show
  1. package/dist/cjs/Handler-d1a8a86a.js +329 -0
  2. package/dist/cjs/{app-globals-de6924b5.js → app-globals-d0251be8.js} +1 -1
  3. package/dist/cjs/cropper-handler.cjs.entry.js +27 -0
  4. package/dist/cjs/customized-slots-14b77e4a.js +53 -0
  5. package/dist/cjs/{cropper-handler_28.cjs.entry.js → highlight-box_22.cjs.entry.js} +48 -437
  6. package/dist/{esm/Array-e81cf4a3.js → cjs/imageSearch.store-d9ed1a5b.js} +10009 -3391
  7. package/dist/cjs/{index-7adce49f.js → index-141137b2.js} +14 -362
  8. package/dist/cjs/{index-8a276115.js → index-a5e15a0c.js} +7 -1
  9. package/dist/cjs/loader.cjs.js +3 -3
  10. package/dist/cjs/vviinn-carousel_5.cjs.entry.js +1232 -0
  11. package/dist/cjs/vviinn-error.cjs.entry.js +19 -0
  12. package/dist/cjs/vviinn-preloader.cjs.entry.js +26 -0
  13. package/dist/cjs/vviinn-vps-button.cjs.entry.js +43 -0
  14. package/dist/cjs/vviinn-vps-widget.cjs.entry.js +97 -0
  15. package/dist/cjs/vviinn-widgets.cjs.js +3 -3
  16. package/dist/collection/collection-manifest.json +2 -0
  17. package/dist/collection/components/vviinn-carousel/vviinn-carousel.css +22 -18
  18. package/dist/collection/components/vviinn-carousel/vviinn-carousel.js +78 -68
  19. package/dist/collection/components/vviinn-icons/index.js +4 -0
  20. package/dist/collection/components/vviinn-product-card/render-helpers.js +4 -4
  21. package/dist/collection/components/vviinn-product-card/vviinn-product-card.css +5 -6
  22. package/dist/collection/components/vviinn-product-card/vviinn-product-card.js +26 -5
  23. package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.css +238 -0
  24. package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.js +200 -0
  25. package/dist/collection/components/vviinn-vpr-button/stories/kek.stories.js +18 -0
  26. package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.css +35 -0
  27. package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.js +149 -0
  28. package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-vidget.js +148 -28
  29. package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-widget.css +31 -8
  30. package/dist/esm/Handler-639a4cb3.js +308 -0
  31. package/dist/esm/{app-globals-0a626970.js → app-globals-b6113170.js} +1 -1
  32. package/dist/esm/cropper-handler.entry.js +23 -0
  33. package/dist/esm/customized-slots-a952fb80.js +50 -0
  34. package/dist/esm/{cropper-handler_28.entry.js → highlight-box_22.entry.js} +21 -404
  35. package/dist/{cjs/Array-cce2fde8.js → esm/imageSearch.store-4ca31230.js} +8705 -2137
  36. package/dist/esm/{index-e77e65ae.js → index-017f18de.js} +6 -2
  37. package/dist/esm/{index-0ccfcee5.js → index-3e85e294.js} +14 -362
  38. package/dist/esm/loader.js +3 -3
  39. package/dist/esm/vviinn-carousel_5.entry.js +1224 -0
  40. package/dist/esm/vviinn-error.entry.js +15 -0
  41. package/dist/esm/vviinn-preloader.entry.js +22 -0
  42. package/dist/esm/vviinn-vps-button.entry.js +39 -0
  43. package/dist/esm/vviinn-vps-widget.entry.js +93 -0
  44. package/dist/esm/vviinn-widgets.js +3 -3
  45. package/dist/types/campaign/Campaign.d.ts +1 -1
  46. package/dist/types/components/vviinn-carousel/vviinn-carousel.d.ts +13 -7
  47. package/dist/types/components/vviinn-icons/index.d.ts +2 -0
  48. package/dist/types/components/vviinn-product-card/render-helpers.d.ts +3 -2
  49. package/dist/types/components/vviinn-product-card/vviinn-product-card.d.ts +2 -0
  50. package/dist/types/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.d.ts +25 -0
  51. package/dist/types/components/vviinn-vpr-button/stories/kek.stories.d.ts +7 -0
  52. package/dist/types/components/vviinn-vpr-button/vviinn-vpr-button.d.ts +14 -0
  53. package/dist/types/components/vviinn-vpr-widget/vviinn-vpr-vidget.d.ts +36 -8
  54. package/dist/types/components.d.ts +62 -10
  55. package/dist/vviinn-widgets/p-0ed1ef7e.entry.js +1 -0
  56. package/dist/vviinn-widgets/{p-6c4fd1db.js → p-16e49514.js} +1 -1
  57. package/dist/vviinn-widgets/p-3da18d7f.js +1 -0
  58. package/dist/vviinn-widgets/p-62a1b042.entry.js +1 -0
  59. package/dist/vviinn-widgets/p-68900093.entry.js +1 -0
  60. package/dist/vviinn-widgets/p-6c4c240d.entry.js +1 -0
  61. package/dist/vviinn-widgets/p-95e53d99.entry.js +1 -0
  62. package/dist/vviinn-widgets/p-9fee20e7.entry.js +1 -0
  63. package/dist/vviinn-widgets/p-d7894eaf.js +1 -0
  64. package/dist/vviinn-widgets/p-db0be4cd.js +1 -0
  65. package/dist/vviinn-widgets/p-eb15116d.entry.js +1 -0
  66. package/dist/vviinn-widgets/{p-489aee23.js → p-f00fddbb.js} +1 -1
  67. package/dist/vviinn-widgets/p-f582db5c.js +1 -0
  68. package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
  69. package/package.json +3 -1
  70. package/www/build/p-0ed1ef7e.entry.js +1 -0
  71. package/www/build/{p-6c4fd1db.js → p-16e49514.js} +1 -1
  72. package/www/build/p-1cc0cdfd.js +1 -0
  73. package/www/build/p-3da18d7f.js +1 -0
  74. package/www/build/p-62a1b042.entry.js +1 -0
  75. package/www/build/p-68900093.entry.js +1 -0
  76. package/www/build/p-6c4c240d.entry.js +1 -0
  77. package/www/build/p-95e53d99.entry.js +1 -0
  78. package/www/build/p-9fee20e7.entry.js +1 -0
  79. package/www/build/p-a67898be.css +1 -0
  80. package/www/build/p-d7894eaf.js +1 -0
  81. package/www/build/p-db0be4cd.js +1 -0
  82. package/www/build/p-eb15116d.entry.js +1 -0
  83. package/www/build/{p-489aee23.js → p-f00fddbb.js} +1 -1
  84. package/www/build/p-f582db5c.js +1 -0
  85. package/www/build/vviinn-widgets.esm.js +1 -1
  86. package/www/index.html +177 -8
  87. package/dist/cjs/imageSearch.store-39fce56c.js +0 -6926
  88. package/dist/cjs/vviinn-carousel.cjs.entry.js +0 -222
  89. package/dist/cjs/vviinn-vpr-widget.cjs.entry.js +0 -106
  90. package/dist/esm/imageSearch.store-b887ff78.js +0 -6893
  91. package/dist/esm/vviinn-carousel.entry.js +0 -218
  92. package/dist/esm/vviinn-vpr-widget.entry.js +0 -102
  93. package/dist/vviinn-widgets/p-2bf74c28.js +0 -1
  94. package/dist/vviinn-widgets/p-3063e23a.js +0 -1
  95. package/dist/vviinn-widgets/p-9145c82e.entry.js +0 -1
  96. package/dist/vviinn-widgets/p-ddcac3f8.js +0 -1
  97. package/dist/vviinn-widgets/p-f05da9f1.entry.js +0 -1
  98. package/dist/vviinn-widgets/p-f12f823d.entry.js +0 -1
  99. package/www/build/p-2bf74c28.js +0 -1
  100. package/www/build/p-3063e23a.js +0 -1
  101. package/www/build/p-9145c82e.entry.js +0 -1
  102. package/www/build/p-cbae3071.js +0 -125
  103. package/www/build/p-ddcac3f8.js +0 -1
  104. package/www/build/p-e0153ae2.css +0 -6
  105. package/www/build/p-f05da9f1.entry.js +0 -1
  106. package/www/build/p-f12f823d.entry.js +0 -1
@@ -1,4 +1,4 @@
1
- import { Component, Host, h, Prop, State, Element, Watch, } from "@stencil/core";
1
+ import { Component, Host, h, Prop, State, Element, Watch, Event, Listen } from "@stencil/core";
2
2
  import { pipe } from "fp-ts/lib/function";
3
3
  import * as TE from "fp-ts/lib/TaskEither";
4
4
  import * as E from "fp-ts/lib/Either";
@@ -6,6 +6,21 @@ import { createBearAuthedHeader } from "./token-helpers";
6
6
  import state from "../../store/store";
7
7
  import { getRecommendationsService } from "../../campaign/CampaignService";
8
8
  import { imageSearchState } from "../../store/imageSearch.store";
9
+ import { Subject } from "rxjs";
10
+ /**
11
+ * @part product-card - product card itself
12
+ * @part title - title inside product card
13
+ * @part brand - brand inside product card
14
+ * @part currency - brand inside product card
15
+ * @part image - product card image
16
+ * @part image-link - anchor element around product image
17
+ * @part price-amount - span element around every prices
18
+ * @part price-container - block of prices
19
+ * @part price-outdated - block for outdated price. rendered when product contains sale price
20
+ * @part price-prefix - block rendered before each price element (for ex. "from")
21
+ * @part price-regular - block for price if no sale price presented
22
+ * @part price-sale - block for sale price. rendered only if sale price presented
23
+ */
9
24
  export class VviinnVprWidget {
10
25
  constructor() {
11
26
  /** Title for recommendations widget */
@@ -17,18 +32,34 @@ export class VviinnVprWidget {
17
32
  /** Currency sign will shown after price */
18
33
  this.currencySign = "€";
19
34
  /** Use slider or grid view */
20
- this.mode = "modern";
35
+ this.mode = "continuity";
21
36
  /** Campaign type */
22
37
  this.campaignType = "VPR";
23
38
  /** Locale for currency formatting */
24
39
  this.locale = "de-DE";
40
+ /** @internal */
41
+ this.apiPath = "https://api.vviinn.com";
42
+ /** @internal */
43
+ this.useCarousel = true;
25
44
  this.showScroll = true;
45
+ this.cssUrl = null;
26
46
  this.recommendations = [];
27
47
  this.loaded = false;
48
+ this.productImageLoadedSubject = new Subject();
28
49
  }
29
50
  handleProductIdChange() {
30
51
  this.getRecommendations();
31
52
  }
53
+ handleCampaignTypeChange() {
54
+ this.getRecommendations();
55
+ }
56
+ handleApiPathChange(newPath) {
57
+ state.apiPath = newPath;
58
+ this.getRecommendations();
59
+ }
60
+ lol({ detail }) {
61
+ this.productImageLoadedSubject.next(detail);
62
+ }
32
63
  connectedCallback() {
33
64
  state.apiPath = this.apiPath;
34
65
  state.currencySign = this.currencySign;
@@ -42,8 +73,9 @@ export class VviinnVprWidget {
42
73
  async getRecommendations() {
43
74
  if (this.productId === undefined || this.token === undefined)
44
75
  return;
76
+ const campaignType = this.campaignType.length > 0 ? this.campaignType : "VPR";
45
77
  const headers = createBearAuthedHeader(this.token);
46
- const request = pipe(TE.of(getRecommendationsService(this.campaignType)), TE.ap(TE.of(this.productId)), TE.ap(TE.of(headers)), TE.flatten);
78
+ const request = pipe(TE.of(getRecommendationsService(campaignType)), TE.ap(TE.of(this.productId)), TE.ap(TE.of(headers)), TE.flatten);
47
79
  const runRequest = await request();
48
80
  pipe(runRequest, E.fold((error) => this.handleError(error), (data) => this.handleRecommendationsSucces(data)));
49
81
  }
@@ -55,12 +87,43 @@ export class VviinnVprWidget {
55
87
  this.recommendations = (_a = data === null || data === void 0 ? void 0 : data.extended) !== null && _a !== void 0 ? _a : data;
56
88
  imageSearchState.results = this.recommendations;
57
89
  this.loaded = true;
90
+ //this.recommendationsLoaded.emit();
91
+ this.productIds = this.recommendations.map(r => r.productId);
92
+ this.productImageLoadedSubject.subscribe((id) => {
93
+ this.productIds = this.productIds.filter(x => x !== id);
94
+ if (this.productIds.length === 0) {
95
+ this.recommendationsLoaded.emit();
96
+ }
97
+ });
98
+ }
99
+ isExternalCSS() {
100
+ return this.cssUrl && this.cssUrl.length > 0;
101
+ }
102
+ renderExternalCSS() {
103
+ return this.isExternalCSS() ? (h("link", { href: this.cssUrl, rel: "stylesheet" })) : ("");
58
104
  }
59
105
  render() {
60
- return (h(Host, { class: { loaded: this.loaded, empty: this.recommendations.length == 0, [this.mode]: true }, "aria-hidden": this.loaded ? "false" : "true" },
106
+ return (h(Host, { class: {
107
+ loaded: this.loaded,
108
+ empty: this.recommendations.length == 0,
109
+ [this.mode]: true,
110
+ }, "aria-hidden": this.loaded ? "false" : "true" },
111
+ this.renderExternalCSS(),
61
112
  h("style", null, state.fallbackStyles),
62
113
  h("h2", { part: "recommendations-title" }, this.blockTitle),
63
- h("vviinn-carousel", { exportparts: "brand, currency, deeplink, image, type, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title, title: product-title", mode: this.mode, imageWidth: this.imageWidth, showScroll: this.showScroll }, this.recommendations.map((r) => (h("vviinn-product-card", { productId: r.productId, productTitle: r.title, image: r.image.thumbnail, brand: r.brand, imageWidth: this.imageWidth, imageRatio: this.imageRatio, price: r.price.actual, salePrice: r.price.sale, responsive: this.mode === "classic", dimmedBackground: this.mode === "modern", exportparts: "title" }))))));
114
+ this.useCarousel ? this.renderCarousel() : this.renderResults()));
115
+ }
116
+ renderRecommendation(recommendation) {
117
+ return (h("vviinn-product-card", { part: "product-part", productId: recommendation.productId, productTitle: recommendation.title, deeplink: recommendation.deeplink, image: recommendation.image.thumbnail, brand: recommendation.brand, imageWidth: this.imageWidth, imageRatio: 1, price: recommendation.price.actual, salePrice: recommendation.price.sale, responsive: this.mode === "grid", dimmedBackground: this.useDimmedBackgroundInCard() }));
118
+ }
119
+ useDimmedBackgroundInCard() {
120
+ return this.mode === "continuity" || !this.useCarousel;
121
+ }
122
+ renderResults() {
123
+ return (h("div", { class: "recommendations-grid", part: "recommendations-grid" }, this.recommendations.map((r) => this.renderRecommendation(r))));
124
+ }
125
+ renderCarousel() {
126
+ return (h("vviinn-carousel", { mode: this.mode, imageWidth: this.imageWidth, showScroll: this.showScroll, recommendations: this.recommendations }));
64
127
  }
65
128
  static get is() { return "vviinn-vpr-widget"; }
66
129
  static get encapsulation() { return "shadow"; }
@@ -89,23 +152,6 @@ export class VviinnVprWidget {
89
152
  "reflect": false,
90
153
  "defaultValue": "\"Recommended products\""
91
154
  },
92
- "columns": {
93
- "type": "number",
94
- "mutable": false,
95
- "complexType": {
96
- "original": "number",
97
- "resolved": "number",
98
- "references": {}
99
- },
100
- "required": false,
101
- "optional": false,
102
- "docs": {
103
- "tags": [],
104
- "text": "Number of columns for recommendations"
105
- },
106
- "attribute": "columns",
107
- "reflect": false
108
- },
109
155
  "imageRatio": {
110
156
  "type": "number",
111
157
  "mutable": false,
@@ -215,9 +261,14 @@ export class VviinnVprWidget {
215
261
  "type": "string",
216
262
  "mutable": false,
217
263
  "complexType": {
218
- "original": "\"classic\" | \"modern\"",
219
- "resolved": "\"classic\" | \"modern\"",
220
- "references": {}
264
+ "original": "CarouselMode",
265
+ "resolved": "\"continuity\" | \"grid\"",
266
+ "references": {
267
+ "CarouselMode": {
268
+ "location": "import",
269
+ "path": "../vviinn-carousel/vviinn-carousel"
270
+ }
271
+ }
221
272
  },
222
273
  "required": false,
223
274
  "optional": false,
@@ -227,14 +278,14 @@ export class VviinnVprWidget {
227
278
  },
228
279
  "attribute": "mode",
229
280
  "reflect": false,
230
- "defaultValue": "\"modern\""
281
+ "defaultValue": "\"continuity\""
231
282
  },
232
283
  "campaignType": {
233
284
  "type": "string",
234
285
  "mutable": false,
235
286
  "complexType": {
236
287
  "original": "CampaignName",
237
- "resolved": "\"VPR\" | \"VSC\"",
288
+ "resolved": "\"VCS\" | \"VPR\"",
238
289
  "references": {
239
290
  "CampaignName": {
240
291
  "location": "import",
@@ -288,7 +339,29 @@ export class VviinnVprWidget {
288
339
  "text": ""
289
340
  },
290
341
  "attribute": "api-path",
291
- "reflect": false
342
+ "reflect": false,
343
+ "defaultValue": "\"https://api.vviinn.com\""
344
+ },
345
+ "useCarousel": {
346
+ "type": "boolean",
347
+ "mutable": false,
348
+ "complexType": {
349
+ "original": "boolean",
350
+ "resolved": "boolean",
351
+ "references": {}
352
+ },
353
+ "required": false,
354
+ "optional": false,
355
+ "docs": {
356
+ "tags": [{
357
+ "text": undefined,
358
+ "name": "internal"
359
+ }],
360
+ "text": ""
361
+ },
362
+ "attribute": "use-carousel",
363
+ "reflect": false,
364
+ "defaultValue": "true"
292
365
  },
293
366
  "showScroll": {
294
367
  "type": "boolean",
@@ -307,15 +380,62 @@ export class VviinnVprWidget {
307
380
  "attribute": "show-scroll",
308
381
  "reflect": false,
309
382
  "defaultValue": "true"
383
+ },
384
+ "cssUrl": {
385
+ "type": "string",
386
+ "mutable": false,
387
+ "complexType": {
388
+ "original": "string | null",
389
+ "resolved": "string",
390
+ "references": {}
391
+ },
392
+ "required": false,
393
+ "optional": false,
394
+ "docs": {
395
+ "tags": [],
396
+ "text": ""
397
+ },
398
+ "attribute": "css-url",
399
+ "reflect": false,
400
+ "defaultValue": "null"
310
401
  }
311
402
  }; }
312
403
  static get states() { return {
313
404
  "recommendations": {},
314
405
  "loaded": {}
315
406
  }; }
407
+ static get events() { return [{
408
+ "method": "recommendationsLoaded",
409
+ "name": "recommendationsLoaded",
410
+ "bubbles": true,
411
+ "cancelable": true,
412
+ "composed": true,
413
+ "docs": {
414
+ "tags": [],
415
+ "text": ""
416
+ },
417
+ "complexType": {
418
+ "original": "any",
419
+ "resolved": "any",
420
+ "references": {}
421
+ }
422
+ }]; }
316
423
  static get elementRef() { return "el"; }
317
424
  static get watchers() { return [{
318
425
  "propName": "productId",
319
426
  "methodName": "handleProductIdChange"
427
+ }, {
428
+ "propName": "campaignType",
429
+ "methodName": "handleCampaignTypeChange"
430
+ }, {
431
+ "propName": "apiPath",
432
+ "methodName": "handleApiPathChange"
433
+ }]; }
434
+ static get listeners() { return [{
435
+ "name": "productImageLoaded",
436
+ "method": "lol",
437
+ "target": undefined,
438
+ "capture": false,
439
+ "passive": false
320
440
  }]; }
321
441
  }
@@ -9,8 +9,13 @@
9
9
  visibility: hidden;
10
10
  }
11
11
 
12
- :host(.classic) vviinn-product-card::part(image) {
12
+ :host(.grid) vviinn-product-card::part(image) {
13
13
  border: 1px solid #DDDDDD;
14
+ width: 100%;
15
+ }
16
+
17
+ h2 {
18
+ margin: 0;
14
19
  }
15
20
 
16
21
  vviinn-product-card::part(price-container) {
@@ -33,19 +38,37 @@ vviinn-product-card::part(price-container) {
33
38
  width: 0;
34
39
  }
35
40
 
36
- :host(.classic) vviinn-product-card::part(title),
37
- :host(.classic) vviinn-product-card::part(brand),
38
- :host(.classic) vviinn-product-card::part(type) {
41
+ h2 {
42
+ margin: 0;
43
+ }
44
+
45
+ :host(.grid) h2 {
46
+ justify-content: center;
47
+ }
48
+
49
+ :host(.grid) vviinn-product-card::part(image) {
50
+ min-width: 100%;
51
+ }
52
+
53
+ :host(.grid) vviinn-product-card::part(image-link) {
54
+ width: 100%;
55
+ }
56
+
57
+ :host(.grid) vviinn-product-card::part(title),
58
+ :host(.grid) vviinn-product-card::part(brand),
59
+ :host(.grid) vviinn-product-card::part(type) {
39
60
  text-align: center;
40
61
  }
41
62
 
42
- :host(.classic) vviinn-product-card::part(price-container) {
63
+ :host(.grid) vviinn-product-card::part(price-container) {
43
64
  align-self: center;
44
65
  }
45
66
 
46
- :host(.modern) vviinn-product-card::part(title),
47
- :host(.modern) vviinn-product-card::part(brand),
48
- :host(.modern) vviinn-product-card::part(type) {
67
+ :host(.continuity) vviinn-product-card::part(title),
68
+ :host(.continuity) vviinn-product-card::part(brand),
69
+ :host(.continuity) vviinn-product-card::part(type),
70
+ :host(.continuity) vviinn-product-card::part(deeplink) {
49
71
  text-align: left;
50
72
  max-width: unset;
73
+ align-self: start;
51
74
  }
@@ -0,0 +1,308 @@
1
+ // -------------------------------------------------------------------------------------
2
+ /**
3
+ * @since 2.0.0
4
+ */
5
+ function identity(a) {
6
+ return a;
7
+ }
8
+ function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {
9
+ switch (arguments.length) {
10
+ case 1:
11
+ return ab;
12
+ case 2:
13
+ return function () {
14
+ return bc(ab.apply(this, arguments));
15
+ };
16
+ case 3:
17
+ return function () {
18
+ return cd(bc(ab.apply(this, arguments)));
19
+ };
20
+ case 4:
21
+ return function () {
22
+ return de(cd(bc(ab.apply(this, arguments))));
23
+ };
24
+ case 5:
25
+ return function () {
26
+ return ef(de(cd(bc(ab.apply(this, arguments)))));
27
+ };
28
+ case 6:
29
+ return function () {
30
+ return fg(ef(de(cd(bc(ab.apply(this, arguments))))));
31
+ };
32
+ case 7:
33
+ return function () {
34
+ return gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))));
35
+ };
36
+ case 8:
37
+ return function () {
38
+ return hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))));
39
+ };
40
+ case 9:
41
+ return function () {
42
+ return ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))));
43
+ };
44
+ }
45
+ return;
46
+ }
47
+ /**
48
+ * @since 2.0.0
49
+ */
50
+ function tuple() {
51
+ var t = [];
52
+ for (var _i = 0; _i < arguments.length; _i++) {
53
+ t[_i] = arguments[_i];
54
+ }
55
+ return t;
56
+ }
57
+ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
58
+ switch (arguments.length) {
59
+ case 1:
60
+ return a;
61
+ case 2:
62
+ return ab(a);
63
+ case 3:
64
+ return bc(ab(a));
65
+ case 4:
66
+ return cd(bc(ab(a)));
67
+ case 5:
68
+ return de(cd(bc(ab(a))));
69
+ case 6:
70
+ return ef(de(cd(bc(ab(a)))));
71
+ case 7:
72
+ return fg(ef(de(cd(bc(ab(a))))));
73
+ case 8:
74
+ return gh(fg(ef(de(cd(bc(ab(a)))))));
75
+ case 9:
76
+ return hi(gh(fg(ef(de(cd(bc(ab(a))))))));
77
+ default:
78
+ var ret = arguments[0];
79
+ for (var i = 1; i < arguments.length; i++) {
80
+ ret = arguments[i](ret);
81
+ }
82
+ return ret;
83
+ }
84
+ }
85
+
86
+ // -------------------------------------------------------------------------------------
87
+ // Option
88
+ // -------------------------------------------------------------------------------------
89
+ /** @internal */
90
+ var isNone = function (fa) { return fa._tag === 'None'; };
91
+ /** @internal */
92
+ var isSome = function (fa) { return fa._tag === 'Some'; };
93
+ /** @internal */
94
+ var none = { _tag: 'None' };
95
+ /** @internal */
96
+ var some = function (a) { return ({ _tag: 'Some', value: a }); };
97
+ // -------------------------------------------------------------------------------------
98
+ // Either
99
+ // -------------------------------------------------------------------------------------
100
+ /** @internal */
101
+ var isLeft = function (ma) { return ma._tag === 'Left'; };
102
+ /** @internal */
103
+ var left = function (e) { return ({ _tag: 'Left', left: e }); };
104
+ /** @internal */
105
+ var right = function (a) { return ({ _tag: 'Right', right: a }); };
106
+ // -------------------------------------------------------------------------------------
107
+ // Record
108
+ // -------------------------------------------------------------------------------------
109
+ /** @internal */
110
+ var has = Object.prototype.hasOwnProperty;
111
+
112
+ /**
113
+ * If a type `A` can form a `Semigroup` it has an **associative** binary operation.
114
+ *
115
+ * ```ts
116
+ * interface Semigroup<A> {
117
+ * readonly concat: (x: A, y: A) => A
118
+ * }
119
+ * ```
120
+ *
121
+ * Associativity means the following equality must hold for any choice of `x`, `y`, and `z`.
122
+ *
123
+ * ```ts
124
+ * concat(x, concat(y, z)) = concat(concat(x, y), z)
125
+ * ```
126
+ *
127
+ * A common example of a semigroup is the type `string` with the operation `+`.
128
+ *
129
+ * ```ts
130
+ * import { Semigroup } from 'fp-ts/Semigroup'
131
+ *
132
+ * const semigroupString: Semigroup<string> = {
133
+ * concat: (x, y) => x + y
134
+ * }
135
+ *
136
+ * const x = 'x'
137
+ * const y = 'y'
138
+ * const z = 'z'
139
+ *
140
+ * semigroupString.concat(x, y) // 'xy'
141
+ *
142
+ * semigroupString.concat(x, semigroupString.concat(y, z)) // 'xyz'
143
+ *
144
+ * semigroupString.concat(semigroupString.concat(x, y), z) // 'xyz'
145
+ * ```
146
+ *
147
+ * *Adapted from https://typelevel.org/cats*
148
+ *
149
+ * @since 2.0.0
150
+ */
151
+ /**
152
+ * Given a struct of semigroups returns a semigroup for the struct.
153
+ *
154
+ * @example
155
+ * import { struct } from 'fp-ts/Semigroup'
156
+ * import * as N from 'fp-ts/number'
157
+ *
158
+ * interface Point {
159
+ * readonly x: number
160
+ * readonly y: number
161
+ * }
162
+ *
163
+ * const S = struct<Point>({
164
+ * x: N.SemigroupSum,
165
+ * y: N.SemigroupSum
166
+ * })
167
+ *
168
+ * assert.deepStrictEqual(S.concat({ x: 1, y: 2 }, { x: 3, y: 4 }), { x: 4, y: 6 })
169
+ *
170
+ * @category combinators
171
+ * @since 2.10.0
172
+ */
173
+ var struct = function (semigroups) { return ({
174
+ concat: function (first, second) {
175
+ var r = {};
176
+ for (var k in semigroups) {
177
+ if (has.call(semigroups, k)) {
178
+ r[k] = semigroups[k].concat(first[k], second[k]);
179
+ }
180
+ }
181
+ return r;
182
+ }
183
+ }); };
184
+ // -------------------------------------------------------------------------------------
185
+ // instances
186
+ // -------------------------------------------------------------------------------------
187
+ /**
188
+ * Always return the first argument.
189
+ *
190
+ * @example
191
+ * import * as S from 'fp-ts/Semigroup'
192
+ *
193
+ * assert.deepStrictEqual(S.first<number>().concat(1, 2), 1)
194
+ *
195
+ * @category instances
196
+ * @since 2.10.0
197
+ */
198
+ var first = function () { return ({ concat: identity }); };
199
+ /**
200
+ * Always return the last argument.
201
+ *
202
+ * @example
203
+ * import * as S from 'fp-ts/Semigroup'
204
+ *
205
+ * assert.deepStrictEqual(S.last<number>().concat(1, 2), 2)
206
+ *
207
+ * @category instances
208
+ * @since 2.10.0
209
+ */
210
+ var last = function () { return ({ concat: function (_, y) { return y; } }); };
211
+ /**
212
+ * Use [`SemigroupSum`](./number.ts.html#SemigroupSum) instead.
213
+ *
214
+ * @category instances
215
+ * @since 2.0.0
216
+ * @deprecated
217
+ */
218
+ var semigroupSum = {
219
+ concat: function (x, y) { return x + y; }
220
+ };
221
+
222
+ const semigroupDiff = {
223
+ concat: (x, y) => x - y,
224
+ };
225
+
226
+ const fromRectangle$1 = ({ x, y }) => {
227
+ return {
228
+ x,
229
+ y,
230
+ };
231
+ };
232
+ const fromMouseEvent = ({ clientX, clientY }) => {
233
+ return {
234
+ x: clientX,
235
+ y: clientY,
236
+ };
237
+ };
238
+ const pointDiffSemigroup = struct({
239
+ x: semigroupDiff,
240
+ y: semigroupDiff,
241
+ });
242
+ const pointSumSemigroup = struct({
243
+ x: semigroupSum,
244
+ y: semigroupSum,
245
+ });
246
+
247
+ var HandlerDirection;
248
+ (function (HandlerDirection) {
249
+ HandlerDirection[HandlerDirection["East"] = 0] = "East";
250
+ HandlerDirection[HandlerDirection["North"] = 1] = "North";
251
+ HandlerDirection[HandlerDirection["NorthEast"] = 2] = "NorthEast";
252
+ HandlerDirection[HandlerDirection["NorthWest"] = 3] = "NorthWest";
253
+ HandlerDirection[HandlerDirection["South"] = 4] = "South";
254
+ HandlerDirection[HandlerDirection["SouthEast"] = 5] = "SouthEast";
255
+ HandlerDirection[HandlerDirection["SouthWest"] = 6] = "SouthWest";
256
+ HandlerDirection[HandlerDirection["West"] = 7] = "West";
257
+ })(HandlerDirection || (HandlerDirection = {}));
258
+ const getCursorValue = (direction) => {
259
+ switch (direction) {
260
+ case HandlerDirection.East:
261
+ return "e-resize";
262
+ case HandlerDirection.North:
263
+ return "n-resize";
264
+ case HandlerDirection.NorthEast:
265
+ return "ne-resize";
266
+ case HandlerDirection.NorthWest:
267
+ return "nw-resize";
268
+ case HandlerDirection.South:
269
+ return "s-resize";
270
+ case HandlerDirection.SouthEast:
271
+ return "se-resize";
272
+ case HandlerDirection.SouthWest:
273
+ return "sw-resize";
274
+ case HandlerDirection.West:
275
+ return "w-resize";
276
+ default:
277
+ return "pointer";
278
+ }
279
+ };
280
+ const fromRectangle = (r) => [
281
+ {
282
+ position: fromRectangle$1(r),
283
+ direction: HandlerDirection.NorthWest,
284
+ },
285
+ {
286
+ position: pointSumSemigroup.concat(fromRectangle$1(r), {
287
+ x: r.width,
288
+ y: 0,
289
+ }),
290
+ direction: HandlerDirection.NorthEast,
291
+ },
292
+ {
293
+ position: pointSumSemigroup.concat(fromRectangle$1(r), {
294
+ x: 0,
295
+ y: r.height,
296
+ }),
297
+ direction: HandlerDirection.SouthWest,
298
+ },
299
+ {
300
+ position: pointSumSemigroup.concat(fromRectangle$1(r), {
301
+ x: r.width,
302
+ y: r.height,
303
+ }),
304
+ direction: HandlerDirection.SouthEast,
305
+ },
306
+ ];
307
+
308
+ export { HandlerDirection as H, isLeft as a, identity as b, flow as c, struct as d, last as e, first as f, pointSumSemigroup as g, fromRectangle$1 as h, isNone as i, isSome as j, fromRectangle as k, left as l, pointDiffSemigroup as m, none as n, fromMouseEvent as o, pipe as p, getCursorValue as q, right as r, some as s, tuple as t };
@@ -1,4 +1,4 @@
1
- import { E as Env } from './index-0ccfcee5.js';
1
+ import { E as Env } from './index-3e85e294.js';
2
2
 
3
3
  /*! *****************************************************************************
4
4
  Copyright (c) Microsoft Corporation.
@@ -0,0 +1,23 @@
1
+ import { r as registerInstance, h, H as Host } from './index-3e85e294.js';
2
+ import { q as getCursorValue } from './Handler-639a4cb3.js';
3
+
4
+ const cropperHandlerCss = ":host{--size:20px;background:transparent;border:4px solid white;box-sizing:content-box;display:block;height:var(--size);touch-action:none;position:absolute;width:var(--size);z-index:4;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host(.disabled){opacity:0.25}:host(.nw-resize){border-bottom:none;border-right:none;top:0;left:0}:host(.ne-resize){border-left:none;border-bottom:none;right:0;top:0}:host(.sw-resize){border-right:none;border-top:none;left:0;bottom:0}:host(.se-resize){border-left:none;border-top:none;bottom:0;right:0}";
5
+
6
+ let CropperHandler = class {
7
+ constructor(hostRef) {
8
+ registerInstance(this, hostRef);
9
+ this.disabled = false;
10
+ }
11
+ render() {
12
+ return (h(Host, { part: `handle ${getCursorValue(this.handler.direction)}`, class: {
13
+ disabled: this.disabled,
14
+ [getCursorValue(this.handler.direction)]: true,
15
+ }, style: {
16
+ "--size": "20px",
17
+ cursor: getCursorValue(this.handler.direction),
18
+ }, draggable: false }));
19
+ }
20
+ };
21
+ CropperHandler.style = cropperHandlerCss;
22
+
23
+ export { CropperHandler as cropper_handler };