@foxy.io/elements 1.15.0-beta.2 → 1.15.0-beta.5
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/cdn/foxy-access-recovery-form.js +1 -1
- package/dist/cdn/foxy-address-card.js +1 -1
- package/dist/cdn/foxy-address-form.js +1 -1
- package/dist/cdn/foxy-applied-tax-card.js +1 -1
- package/dist/cdn/foxy-attribute-card.js +1 -1
- package/dist/cdn/foxy-attribute-form.js +1 -1
- package/dist/cdn/foxy-cancellation-form.js +1 -1
- package/dist/cdn/foxy-collection-page.js +1 -1
- package/dist/cdn/foxy-collection-pages.js +1 -1
- package/dist/cdn/foxy-coupon-card.js +1 -1
- package/dist/cdn/foxy-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-coupon-codes-form.js +1 -1
- package/dist/cdn/foxy-coupon-form.js +1 -1
- package/dist/cdn/foxy-custom-field-card.js +1 -1
- package/dist/cdn/foxy-custom-field-form.js +1 -1
- package/dist/cdn/foxy-customer-api.js +1 -1
- package/dist/cdn/foxy-customer-card.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings.js +1 -169
- package/dist/cdn/foxy-customer-portal.js +1 -1
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-customers-table.js +1 -1
- package/dist/cdn/foxy-discount-card.js +1 -1
- package/dist/cdn/foxy-donation.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -1
- package/dist/cdn/foxy-error-entry-card.js +1 -1
- package/dist/cdn/foxy-form-dialog.js +1 -1
- package/dist/cdn/foxy-generate-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-card.js +1 -0
- package/dist/cdn/foxy-gift-card-code-form.js +1 -0
- package/dist/cdn/foxy-gift-card-codes-form.js +1 -0
- package/dist/cdn/foxy-gift-card-form.js +1 -0
- package/dist/cdn/foxy-i18n.js +1 -1
- package/dist/cdn/foxy-items-form.js +1 -1
- package/dist/cdn/foxy-nucleon-element.js +1 -1
- package/dist/cdn/foxy-pagination.js +1 -1
- package/dist/cdn/foxy-payment-card.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-query-builder.js +1 -1
- package/dist/cdn/foxy-sign-in-form.js +1 -1
- package/dist/cdn/foxy-spinner.js +1 -1
- package/dist/cdn/foxy-subscription-card.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +1 -1
- package/dist/cdn/foxy-subscriptions-table.js +1 -1
- package/dist/cdn/foxy-table.js +1 -1
- package/dist/cdn/foxy-tax-card.js +1 -1
- package/dist/cdn/foxy-tax-form.js +1 -1
- package/dist/cdn/foxy-template-config-form.js +1 -1
- package/dist/cdn/foxy-template-form.js +1 -1
- package/dist/cdn/foxy-transaction-card.js +1 -1
- package/dist/cdn/foxy-transactions-table.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/shared-0032dc09.js +302 -0
- package/dist/cdn/{shared-9af7b5f0.js → shared-02945b27.js} +1 -1
- package/dist/cdn/{shared-c6a4b2d6.js → shared-05488216.js} +1 -1
- package/dist/cdn/{shared-b03b6d72.js → shared-07049bfe.js} +1 -1
- package/dist/cdn/{shared-ccea5a33.js → shared-08c63028.js} +1 -1
- package/dist/cdn/shared-09069d7c.js +1 -0
- package/dist/cdn/shared-0e4d19e2.js +1 -0
- package/dist/cdn/{shared-d3831f99.js → shared-21419f10.js} +1 -1
- package/dist/cdn/{shared-423a4840.js → shared-39e3ae67.js} +1 -1
- package/dist/cdn/{shared-51b5e223.js → shared-40b5267a.js} +1 -1
- package/dist/cdn/{shared-d9a260f0.js → shared-43abbdd9.js} +1 -1
- package/dist/cdn/{shared-fb403e1f.js → shared-448781f9.js} +1 -1
- package/dist/cdn/{shared-a8d96c23.js → shared-4cc1da27.js} +1 -1
- package/dist/cdn/{shared-8f7a66c4.js → shared-4dc6d228.js} +1 -1
- package/dist/cdn/{shared-c1dadefe.js → shared-5535f38f.js} +1 -1
- package/dist/cdn/{shared-a11160e7.js → shared-5639389e.js} +1 -1
- package/dist/cdn/shared-66633ff7.js +1 -0
- package/dist/cdn/{shared-0bda8ecb.js → shared-67ca44d2.js} +1 -1
- package/dist/cdn/{shared-30131f76.js → shared-756034e4.js} +1 -1
- package/dist/cdn/shared-7f0a9790.js +1 -0
- package/dist/cdn/shared-8a5ec3cf.js +1 -0
- package/dist/cdn/{shared-b2330475.js → shared-a23cf7c8.js} +1 -1
- package/dist/cdn/{shared-ff149b55.js → shared-b30bc42d.js} +1 -1
- package/dist/cdn/{shared-a4e6ecb0.js → shared-b9f18aaa.js} +1 -1
- package/dist/cdn/{shared-f875a4f8.js → shared-cf6751d3.js} +1 -1
- package/dist/cdn/{shared-51e28c83.js → shared-df730f90.js} +1 -1
- package/dist/cdn/{shared-4038cb18.js → shared-e209cb55.js} +1 -1
- package/dist/cdn/{shared-cd3c902e.js → shared-e68b9c83.js} +1 -1
- package/dist/cdn/translations/shared/en.json +178 -0
- package/dist/cdn/translations/shared/zh-hk.json +179 -0
- package/dist/elements/private/EditableList/EditableList.js +1 -0
- package/dist/elements/private/EditableList/EditableList.js.map +1 -1
- package/dist/elements/private/FrequencyInput/FrequencyInput.d.ts +2 -1
- package/dist/elements/private/FrequencyInput/FrequencyInput.js +3 -1
- package/dist/elements/private/FrequencyInput/FrequencyInput.js.map +1 -1
- package/dist/elements/public/CollectionPage/CollectionPage.js +3 -1
- package/dist/elements/public/CollectionPage/CollectionPage.js.map +1 -1
- package/dist/elements/public/CollectionPage/types.d.ts +2 -0
- package/dist/elements/public/CollectionPage/types.js.map +1 -1
- package/dist/elements/public/CouponCard/CouponCard.js +2 -2
- package/dist/elements/public/CouponCard/CouponCard.js.map +1 -1
- package/dist/elements/public/CouponCodesForm/CouponCodesForm.d.ts +2 -0
- package/dist/elements/public/CouponCodesForm/CouponCodesForm.js +7 -1
- package/dist/elements/public/CouponCodesForm/CouponCodesForm.js.map +1 -1
- package/dist/elements/public/CouponForm/CouponForm.js +0 -2
- package/dist/elements/public/CouponForm/CouponForm.js.map +1 -1
- package/dist/elements/public/GiftCardCard/GiftCardCard.d.ts +26 -0
- package/dist/elements/public/GiftCardCard/GiftCardCard.js +118 -0
- package/dist/elements/public/GiftCardCard/GiftCardCard.js.map +1 -0
- package/dist/elements/public/GiftCardCard/index.d.ts +5 -0
- package/dist/elements/public/GiftCardCard/index.js +7 -0
- package/dist/elements/public/GiftCardCard/index.js.map +1 -0
- package/dist/elements/public/GiftCardCard/types.d.ts +11 -0
- package/dist/elements/public/GiftCardCard/types.js +2 -0
- package/dist/elements/public/GiftCardCard/types.js.map +1 -0
- package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.d.ts +55 -0
- package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js +292 -0
- package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js.map +1 -0
- package/dist/elements/public/GiftCardCodeForm/index.d.ts +10 -0
- package/dist/elements/public/GiftCardCodeForm/index.js +12 -0
- package/dist/elements/public/GiftCardCodeForm/index.js.map +1 -0
- package/dist/elements/public/GiftCardCodeForm/types.d.ts +19 -0
- package/dist/elements/public/GiftCardCodeForm/types.js +2 -0
- package/dist/elements/public/GiftCardCodeForm/types.js.map +1 -0
- package/dist/elements/public/GiftCardCodesForm/GiftCardCodesForm.d.ts +31 -0
- package/dist/elements/public/GiftCardCodesForm/GiftCardCodesForm.js +215 -0
- package/dist/elements/public/GiftCardCodesForm/GiftCardCodesForm.js.map +1 -0
- package/dist/elements/public/GiftCardCodesForm/index.d.ts +8 -0
- package/dist/elements/public/GiftCardCodesForm/index.js +12 -0
- package/dist/elements/public/GiftCardCodesForm/index.js.map +1 -0
- package/dist/elements/public/GiftCardCodesForm/internal/InternalGiftCardCodesFormListItem.d.ts +19 -0
- package/dist/elements/public/GiftCardCodesForm/internal/InternalGiftCardCodesFormListItem.js +48 -0
- package/dist/elements/public/GiftCardCodesForm/internal/InternalGiftCardCodesFormListItem.js.map +1 -0
- package/dist/elements/public/GiftCardCodesForm/types.d.ts +16 -0
- package/dist/elements/public/GiftCardCodesForm/types.js +2 -0
- package/dist/elements/public/GiftCardCodesForm/types.js.map +1 -0
- package/dist/elements/public/GiftCardForm/GiftCardForm.d.ts +66 -0
- package/dist/elements/public/GiftCardForm/GiftCardForm.js +650 -0
- package/dist/elements/public/GiftCardForm/GiftCardForm.js.map +1 -0
- package/dist/elements/public/GiftCardForm/currencies.d.ts +1 -0
- package/dist/elements/public/GiftCardForm/currencies.js +173 -0
- package/dist/elements/public/GiftCardForm/currencies.js.map +1 -0
- package/dist/elements/public/GiftCardForm/index.d.ts +18 -0
- package/dist/elements/public/GiftCardForm/index.js +20 -0
- package/dist/elements/public/GiftCardForm/index.js.map +1 -0
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPage.d.ts +20 -0
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPage.js +99 -0
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPage.js.map +1 -0
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItem.d.ts +20 -0
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItem.js +52 -0
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItem.js.map +1 -0
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItemContent.d.ts +20 -0
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItemContent.js +53 -0
- package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItemContent.js.map +1 -0
- package/dist/elements/public/GiftCardForm/types.d.ts +28 -0
- package/dist/elements/public/GiftCardForm/types.js +2 -0
- package/dist/elements/public/GiftCardForm/types.js.map +1 -0
- package/dist/elements/public/NucleonElement/NucleonElement.js +4 -4
- package/dist/elements/public/NucleonElement/NucleonElement.js.map +1 -1
- package/dist/elements/public/index.d.ts +4 -0
- package/dist/elements/public/index.defined.d.ts +4 -0
- package/dist/elements/public/index.defined.js +4 -0
- package/dist/elements/public/index.defined.js.map +1 -1
- package/dist/elements/public/index.js +4 -0
- package/dist/elements/public/index.js.map +1 -1
- package/dist/mixins/themeable.js +12 -0
- package/dist/mixins/themeable.js.map +1 -1
- package/dist/utils/parse-duration.d.ts +1 -1
- package/dist/utils/parse-duration.js +7 -3
- package/dist/utils/parse-duration.js.map +1 -1
- package/package.json +2 -2
- package/dist/cdn/shared-0fcdd1c4.js +0 -1
- package/dist/cdn/shared-4fa5f144.js +0 -1
- package/dist/cdn/shared-6b7602c7.js +0 -1
- package/dist/cdn/shared-710ed658.js +0 -134
- package/dist/cdn/shared-800a5471.js +0 -1
- package/dist/cdn/shared-87ca7818.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CategoryRestrictionsPageItemContent.js","sourceRoot":"","sources":["../../../../../src/elements/public/GiftCardForm/private/CategoryRestrictionsPageItemContent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,8CAA2C;AAE9D,OAAO,EAAE,iBAAiB,EAAE,2CAAwC;AACpE,OAAO,EAAE,cAAc,EAAE,+CAA4C;AAIrE,OAAO,EAAE,cAAc,EAAE,wCAAqC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,2CAAwC;AAGpE,MAAM,IAAI,GAAG,iBAAiB,CAC5B,mBAAmB,CAAC,cAAc,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC,CACvE,CAAC;AAEF,MAAM,OAAO,mCAAoC,SAAQ,IAAU;IAAnE;;QAeE,iBAAY,GAAG,EAAE,CAAC;QAElB,aAAQ,GAAG,EAAE,CAAC;IA2BhB,CAAC;IA3CC,MAAM,KAAK,cAAc;QACvB,OAAO;YACL,YAAY,EAAE,QAAQ;SACvB,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,YAAY,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE;YAC1D,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE;SACnD,CAAC;IACJ,CAAC;IAMD,MAAM;QACJ,OAAO,IAAI,CAAA;;;sBAGO,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ;sBACjC,IAAI,CAAC,QAAQ;qBACd,CAAC,CAAC,IAAI,CAAC,IAAI;oBACZ,CAAC,GAAwB,EAAE,EAAE;YACrC,IAAI,GAAG,CAAC,MAAM,EAAE;gBACd,IAAI,CAAC,IAAI,CAAC;oBACR,iBAAiB,EAAE,IAAI,CAAC,YAAY;oBACpC,aAAa,EAAE,IAAI,CAAC,QAAQ;iBAC7B,CAAC,CAAC;gBAEH,IAAI,CAAC,MAAM,EAAE,CAAC;aACf;iBAAM;gBACL,IAAI,CAAC,MAAM,EAAE,CAAC;aACf;QACH,CAAC;;;;;KAKN,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { ScopedElementsMap, ScopedElementsMixin } from '@open-wc/scoped-elements';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { Checkbox } from '../../../private/Checkbox/Checkbox';\nimport { CheckboxChangeEvent } from '../../../private/events';\nimport { ConfigurableMixin } from '../../../../mixins/configurable';\nimport { NucleonElement } from '../../NucleonElement/NucleonElement';\nimport { PropertyDeclarations } from 'lit-element';\nimport { Rels } from '@foxy.io/sdk/backend';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { ThemeableMixin } from '../../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../../mixins/translatable';\n\ntype Data = Resource<Rels.GiftCardItemCategory>;\nconst Base = ConfigurableMixin(\n ScopedElementsMixin(ThemeableMixin(TranslatableMixin(NucleonElement)))\n);\n\nexport class CategoryRestrictionsPageItemContent extends Base<Data> {\n static get scopedElements(): ScopedElementsMap {\n return {\n 'x-checkbox': Checkbox,\n };\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n itemCategory: { type: String, attribute: 'item-category' },\n giftCard: { type: String, attribute: 'gift-card' },\n };\n }\n\n itemCategory = '';\n\n giftCard = '';\n\n render(): TemplateResult {\n return html`\n <div class=\"h-full flex items-center\">\n <x-checkbox\n ?disabled=${!this.in('idle') || this.disabled}\n ?readonly=${this.readonly}\n ?checked=${!!this.data}\n @change=${(evt: CheckboxChangeEvent) => {\n if (evt.detail) {\n this.edit({\n item_category_uri: this.itemCategory,\n gift_card_uri: this.giftCard,\n });\n\n this.submit();\n } else {\n this.delete();\n }\n }}\n >\n <slot></slot>\n </x-checkbox>\n </div>\n `;\n }\n}\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Rels } from '@foxy.io/sdk/backend';
|
|
2
|
+
import { Resource } from '@foxy.io/sdk/core';
|
|
3
|
+
export declare type Data = Resource<Rels.GiftCard>;
|
|
4
|
+
export declare type GiftCardCodes = Resource<Rels.GiftCardCodes>;
|
|
5
|
+
export declare type RulesTierParams = {
|
|
6
|
+
source: string;
|
|
7
|
+
method: string;
|
|
8
|
+
units: string;
|
|
9
|
+
tier?: string;
|
|
10
|
+
onChange: (newParams: Partial<RulesTierParams>) => void;
|
|
11
|
+
onDelete: () => void;
|
|
12
|
+
};
|
|
13
|
+
export declare type RulesTierFieldParams = {
|
|
14
|
+
value: string;
|
|
15
|
+
label: string;
|
|
16
|
+
onChange: (newValue: string) => void;
|
|
17
|
+
};
|
|
18
|
+
export declare type RulesTierSwitchParams = {
|
|
19
|
+
value: number;
|
|
20
|
+
options: [string, string];
|
|
21
|
+
onChange: (newValueIndex: number) => void;
|
|
22
|
+
};
|
|
23
|
+
export declare type RulesTierSelectParams = {
|
|
24
|
+
label: string;
|
|
25
|
+
value: string;
|
|
26
|
+
options: Record<string, string>;
|
|
27
|
+
onChange: (newValue: string) => void;
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/GiftCardForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Rels } from '@foxy.io/sdk/backend';\nimport { Resource } from '@foxy.io/sdk/core';\n\nexport type Data = Resource<Rels.GiftCard>;\nexport type GiftCardCodes = Resource<Rels.GiftCardCodes>;\n\nexport type RulesTierParams = {\n source: string;\n method: string;\n units: string;\n tier?: string;\n onChange: (newParams: Partial<RulesTierParams>) => void;\n onDelete: () => void;\n};\n\nexport type RulesTierFieldParams = {\n value: string;\n label: string;\n onChange: (newValue: string) => void;\n};\n\nexport type RulesTierSwitchParams = {\n value: number;\n options: [string, string];\n onChange: (newValueIndex: number) => void;\n};\n\nexport type RulesTierSelectParams = {\n label: string;\n value: string;\n options: Record<string, string>;\n onChange: (newValue: string) => void;\n};\n"]}
|
|
@@ -219,40 +219,40 @@ export class NucleonElement extends LitElement {
|
|
|
219
219
|
}
|
|
220
220
|
/** POSTs to `element.parent`, shares response with the Rumour group and returns parsed JSON. */
|
|
221
221
|
async _sendPost(edits) {
|
|
222
|
+
this.__destroyRumour();
|
|
222
223
|
const body = JSON.stringify(edits);
|
|
223
224
|
const data = await this._fetch(this.parent, { body, method: 'POST' });
|
|
224
225
|
const rumour = NucleonElement.Rumour(this.group);
|
|
225
226
|
const related = [...this.related, this.parent];
|
|
226
|
-
this.__destroyRumour();
|
|
227
227
|
rumour.share({ data, related, source: data._links.self.href });
|
|
228
228
|
this.__createRumour();
|
|
229
229
|
return data;
|
|
230
230
|
}
|
|
231
231
|
/** GETs `element.href`, shares response with the Rumour group and returns parsed JSON. */
|
|
232
232
|
async _sendGet() {
|
|
233
|
+
this.__destroyRumour();
|
|
233
234
|
const data = await this._fetch(this.href);
|
|
234
235
|
const rumour = NucleonElement.Rumour(this.group);
|
|
235
|
-
this.__destroyRumour();
|
|
236
236
|
rumour.share({ data, source: this.href });
|
|
237
237
|
this.__createRumour();
|
|
238
238
|
return data;
|
|
239
239
|
}
|
|
240
240
|
/** PATCHes `element.href`, shares response with the Rumour group and returns parsed JSON. */
|
|
241
241
|
async _sendPatch(edits) {
|
|
242
|
+
this.__destroyRumour();
|
|
242
243
|
const body = JSON.stringify(edits);
|
|
243
244
|
const data = await this._fetch(this.href, { body, method: 'PATCH' });
|
|
244
245
|
const rumour = NucleonElement.Rumour(this.group);
|
|
245
|
-
this.__destroyRumour();
|
|
246
246
|
rumour.share({ data, source: this.href, related: this.related });
|
|
247
247
|
this.__createRumour();
|
|
248
248
|
return data;
|
|
249
249
|
}
|
|
250
250
|
/** DELETEs `element.href`, shares response with the Rumour group and returns parsed JSON. */
|
|
251
251
|
async _sendDelete() {
|
|
252
|
+
this.__destroyRumour();
|
|
252
253
|
const data = await this._fetch(this.href, { method: 'DELETE' });
|
|
253
254
|
const rumour = NucleonElement.Rumour(this.group);
|
|
254
255
|
const related = [...this.related, this.parent];
|
|
255
|
-
this.__destroyRumour();
|
|
256
256
|
rumour.share({ data: null, source: this.href, related });
|
|
257
257
|
this.__createRumour();
|
|
258
258
|
return data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NucleonElement.js","sourceRoot":"","sources":["../../../../src/elements/public/NucleonElement/NucleonElement.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAwB,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE3C,OAAO,EAAE,GAAG,EAAE,iBAAc;AAC5B,OAAO,EAAE,UAAU,EAAE,wBAAqB;AAC1C,OAAO,EAAE,WAAW,EAAE,yBAAsB;AAC5C,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,4BAAyB;AA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AEO,sBAAsB,CAAC,YAAoB;QACjD,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACrC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAC;IAC9B,CAAC;IAEO,kBAAkB,CAAC,KAAY;QACrC,IAAI,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC;YAAE,OAAO;QAC3C,IAAI,KAAK,CAAC,gBAAgB;YAAE,OAAO;QACnC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,KAAK,KAAK;YAAE,OAAO;QAC3C,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC;YAAE,OAAO;QACpD,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI;YAAE,OAAO;QAE7C,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAEnC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC;YAAE,IAAI,CAAC,wBAAwB,EAAE,CAAC;IACxD,CAAC;;AA3ZD;;;;;GAKG;AACa,0BAAW,GAAG,WAAW,CAAC;AAE1C;;;;;GAKG;AACa,qBAAM,GAAG,OAAO,CAA4B,GAAG,EAAE,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC;AAEhF;;;;GAIG;AACa,kBAAG,GAAG,GAAG,CAAC","sourcesContent":["import { ComputedElementProperties, HALJSONResource, NucleonMachine, NucleonV8N } from './types';\nimport { LitElement, PropertyDeclarations } from 'lit-element';\nimport { Nucleon, Rumour } from '@foxy.io/sdk/core';\nimport { assign, interpret } from 'xstate';\n\nimport { API } from './API';\nimport { FetchEvent } from './FetchEvent';\nimport { UpdateEvent } from './UpdateEvent';\nimport memoize from 'lodash-es/memoize';\nimport { serveFromCache } from './serveFromCache';\n\n/**\n * Base class for custom elements working with remote HAL+JSON resources.\n *\n * @fires NucleonElement#update - Instance of `NucleonElement.UpdateEvent`. Dispatched on an element whenever it changes its state.\n * @fires NucleonElement#fetch - Instance of `NucleonElement.API.FetchEvent`. Emitted before each API request.\n *\n * @element foxy-nucleon\n * @since 1.1.0\n */\nexport class NucleonElement<TData extends HALJSONResource> extends LitElement {\n /**\n * Instances of this event are dispatched on an element whenever it changes its\n * state (e.g. when going from `busy` to `idle` or on `form` data change).\n * This event isn't cancelable, and it does not bubble.\n * @readonly\n */\n static readonly UpdateEvent = UpdateEvent;\n\n /**\n * Creates a tagged [Rumour](https://sdk.foxy.dev/classes/_core_index_.rumour.html)\n * instance if it doesn't exist or returns cached one otherwise. NucleonElements\n * use empty Rumour group by default.\n * @readonly\n */\n static readonly Rumour = memoize<(group: string) => Rumour>(() => new Rumour());\n\n /**\n * Universal [API](https://sdk.foxy.dev/classes/_core_index_.api.html) client\n * that dispatches cancellable `FetchEvent` on an element before each request.\n * @readonly\n */\n static readonly API = API;\n\n /** @readonly */\n static get properties(): PropertyDeclarations {\n return {\n related: { type: Array },\n parent: { type: String },\n group: { type: String, noAccessor: true },\n href: { type: String, noAccessor: true },\n lang: { type: String },\n };\n }\n\n /**\n * Array of validation functions. Each function accepts `element.form` and must return\n * either an error code string if form data fails the check or `true` otherwise.\n * Error codes are collected in `element.errors`. Empty by default.\n */\n static get v8n(): NucleonV8N<any> {\n return [];\n }\n\n /**\n * Optional ISO 639-1 code describing the language element content is written in.\n * Changing the `lang` attribute will update the value of this property.\n */\n lang = '';\n\n /**\n * Optional URL of the collection this element's resource belongs to.\n * Changing the `parent` attribute will update the value of this property.\n */\n parent = '';\n\n /**\n * Optional URI list of the related resources. If Rumour encounters a related\n * resource on creation or deletion, it will be reloaded from source.\n */\n related: string[] = [];\n\n private __href = '';\n\n private __group = '';\n\n private __unsubscribeFromRumour!: () => void;\n\n private __fetchEventHandler!: (evt: Event) => void;\n\n private __fetchEventQueue: FetchEvent[] = [];\n\n private readonly __service = interpret(\n (Nucleon.machine as NucleonMachine<TData>).withConfig({\n services: {\n sendDelete: () => this._sendDelete(),\n sendPatch: ({ edits }) => this._sendPatch(edits!),\n sendPost: ({ edits }) => this._sendPost(edits!),\n sendGet: () => this._sendGet(),\n },\n\n actions: {\n validate: assign<Nucleon.Context<TData, string>, Nucleon.Event<TData>>({\n errors: context => {\n const rules = (this.constructor as typeof NucleonElement).v8n;\n const form = { ...context.data, ...context.edits };\n\n return rules\n .map(validate => validate(form))\n .filter(v8nResult => typeof v8nResult === 'string')\n .filter((err, errIndex, errs) => errs.indexOf(err) === errIndex) as string[];\n },\n }),\n },\n })\n );\n\n /**\n * If network request returns non-2XX code, the entire error response\n * will be available via this getter.\n *\n * This property is readonly. Changing failure records via this property is\n * not guaranteed to work. NucleonElement does not provide a way to override error status.\n *\n * @since 1.4.0\n */\n get failure(): Response | null {\n return this.__service.state.context.failure;\n }\n\n /**\n * Array of validation errors returned from `NucleonElement.v8n` checks.\n *\n * This property is readonly. Adding or removing error codes via this property is\n * not guaranteed to work. NucleonElement does not provide a way to override validity status.\n */\n get errors(): string[] {\n return this.__service.state.context.errors;\n }\n\n /**\n * Resource snapshot with edits applied. Empty object if unavailable.\n *\n * This property and its value are readonly. Assignments like `element.data.foo = 'bar'`\n * are not guaranteed to work. Please use `element.edit({ foo: 'bar' })` instead.\n * If you need to replace the entire data object, consider using `element.data`.\n */\n get form(): Partial<TData> {\n const { data, edits } = this.__service.state.context;\n return { ...data, ...edits } as Partial<TData>;\n }\n\n /**\n * Resource snapshot as-is, no edits applied. Null if unavailable.\n *\n * Returned value is not reactive. Assignments like `element.data.foo = 'bar'`\n * are not guaranteed to work. Please set the property instead: `element.data = { ...element.data, foo: 'bar' }`.\n * If you're processing user input, consider using `element.form` and `element.edit()` instead.\n */\n get data(): TData | null {\n return this.__service.state.context.data;\n }\n\n set data(data: TData | null) {\n this.__service.send({ type: 'SET_DATA', data });\n this.__href = data?._links.self.href ?? '';\n }\n\n /**\n * Rumour group. Elements in different groups will not share updates. Empty by default.\n * @example element.group = 'my-group'\n */\n get group(): string {\n return this.__group;\n }\n\n set group(value: string) {\n this.__group = value;\n this.__destroyRumour();\n this.__createRumour();\n }\n\n /**\n * Optional URL of the resource to load. Switches element to `idle.template` state if empty (default).\n * @example element.href = 'https://demo.foxycart.com/s/customer/attributes/0'\n */\n get href(): string {\n return this.__href;\n }\n\n set href(value: string) {\n this.__href = value;\n\n if (value) {\n this.__service.send({ type: 'FETCH' });\n } else {\n this.__service.send({ type: 'SET_DATA', data: null });\n }\n }\n\n /**\n * Checks if this element is in the given state.\n * @example element.in({ idle: 'snapshot' })\n */\n in<TStateValue extends Nucleon.State<TData, string>['value']>(\n stateValue: TStateValue\n ): this is this & ComputedElementProperties<TData, TStateValue> {\n return this.__service.state.matches(stateValue);\n }\n\n /**\n * Clears all edits and emits the `update` event.\n * @example element.undo()\n */\n undo(): void {\n this.__service.send({ type: 'UNDO' });\n }\n\n /**\n * Applies an edit to the local resource snapshot or its template and emits the `update` event.\n * @example element.edit({ first_name: 'Alex' })\n */\n edit(data: Partial<TData>): void {\n this.__service.send({ type: 'EDIT', data });\n }\n\n /**\n * Submits the form, updating the resource if href isn't empty or creating it otherwise.\n * Emits multiple `update` events as element state changes. Has no effect on invalid forms.\n * @example element.submit()\n */\n submit(): void {\n this.__service.send({ type: 'SUBMIT' });\n }\n\n /**\n * Sends a DELETE request to `element.href` and clears local data on success.\n * Emits multiple update events as element state changes.\n * @example element.delete()\n */\n delete(): void {\n this.__service.send({ type: 'DELETE' });\n }\n\n /**\n * Fetches data from `element.href` in background, keeping the edits and v8n errors.\n * @example element.refresh()\n */\n refresh(): void {\n this.__service.send({ type: 'REFRESH' });\n }\n\n /** @readonly */\n connectedCallback(): void {\n super.connectedCallback();\n\n this.__createService();\n this.__createRumour();\n this.__createServer();\n this.__processFetchEventQueue();\n }\n\n /** @readonly */\n disconnectedCallback(): void {\n super.disconnectedCallback();\n\n this.__destroyService();\n this.__destroyRumour();\n this.__destroyServer();\n this.__flushFetchEventQueue('parent element was disconnected');\n }\n\n /** Sends API request. Throws an error on non-2XX response. */\n protected async _fetch<TResult = TData>(...args: Parameters<Window['fetch']>): Promise<TResult> {\n const response = await new API(this).fetch(...args);\n if (!response.ok) throw response;\n return response.json();\n }\n\n /** POSTs to `element.parent`, shares response with the Rumour group and returns parsed JSON. */\n protected async _sendPost(edits: Partial<TData>): Promise<TData> {\n const body = JSON.stringify(edits);\n const data = await this._fetch(this.parent, { body, method: 'POST' });\n const rumour = NucleonElement.Rumour(this.group);\n const related = [...this.related, this.parent];\n\n this.__destroyRumour();\n rumour.share({ data, related, source: data._links.self.href });\n this.__createRumour();\n\n return data;\n }\n\n /** GETs `element.href`, shares response with the Rumour group and returns parsed JSON. */\n protected async _sendGet(): Promise<TData> {\n const data = await this._fetch(this.href);\n const rumour = NucleonElement.Rumour(this.group);\n\n this.__destroyRumour();\n rumour.share({ data, source: this.href });\n this.__createRumour();\n\n return data;\n }\n\n /** PATCHes `element.href`, shares response with the Rumour group and returns parsed JSON. */\n protected async _sendPatch(edits: Partial<TData>): Promise<TData> {\n const body = JSON.stringify(edits);\n const data = await this._fetch(this.href, { body, method: 'PATCH' });\n const rumour = NucleonElement.Rumour(this.group);\n\n this.__destroyRumour();\n rumour.share({ data, source: this.href, related: this.related });\n this.__createRumour();\n\n return data;\n }\n\n /** DELETEs `element.href`, shares response with the Rumour group and returns parsed JSON. */\n protected async _sendDelete(): Promise<TData> {\n const data = await this._fetch(this.href, { method: 'DELETE' });\n const rumour = NucleonElement.Rumour(this.group);\n const related = [...this.related, this.parent];\n\n this.__destroyRumour();\n rumour.share({ data: null, source: this.href, related });\n this.__createRumour();\n\n return data;\n }\n\n private __createService() {\n this.__service.onTransition(state => {\n if (!state.changed) return;\n\n const flags = state.toStrings().reduce((p, c) => [...p, ...c.split('.')], [] as string[]);\n this.setAttribute('state', [...new Set(flags)].join(' '));\n\n this.requestUpdate();\n this.dispatchEvent(new UpdateEvent());\n\n if (!state.matches('busy')) this.__processFetchEventQueue();\n });\n\n this.__service.onChange(() => {\n this.requestUpdate();\n this.dispatchEvent(new UpdateEvent());\n });\n\n this.__service.start();\n }\n\n private __destroyService() {\n this.__service.stop();\n }\n\n private __createRumour() {\n const rumour = NucleonElement.Rumour(this.group);\n this.__unsubscribeFromRumour = rumour.track(update => this.__handleRumourUpdate(update));\n }\n\n private __destroyRumour() {\n this.__unsubscribeFromRumour?.();\n }\n\n private __createServer() {\n this.__fetchEventHandler = this.__handleFetchEvent.bind(this);\n this.addEventListener('fetch', this.__fetchEventHandler);\n }\n\n private __destroyServer() {\n this.removeEventListener('fetch', this.__fetchEventHandler);\n }\n\n private __handleRumourUpdate(update: (oldData: TData) => TData | null) {\n try {\n const oldData = this.__service.state?.context.data;\n if (!oldData) return;\n\n const newData = update(oldData);\n if (newData !== oldData) this.__service.send({ data: newData, type: 'SET_DATA' });\n } catch (err) {\n if (err instanceof Rumour.UpdateError) {\n this.__service.send({ type: 'REFRESH' });\n } else {\n throw err;\n }\n }\n }\n\n private __processFetchEventQueue() {\n const api = new NucleonElement.API(this);\n\n this.__fetchEventQueue.forEach(event => {\n const request = event.request;\n const cacheResponse = serveFromCache(request.url, this.data);\n const whenResponseReady = cacheResponse.ok ? cacheResponse : api.fetch(request);\n\n event.respondWith(Promise.resolve(whenResponseReady));\n\n if (cacheResponse.ok) {\n console.debug(\n `%c@foxy.io/elements::${this.localName}\\n%c200%c GET ${request.url}`,\n 'color: gray',\n `background: gray; padding: 0 .2em; border-radius: .2em; color: white;`,\n ''\n );\n }\n });\n\n this.__fetchEventQueue = [];\n }\n\n private __flushFetchEventQueue(errorMessage: string) {\n this.__fetchEventQueue.forEach(event => {\n event.respondWith(Promise.reject(new Error(errorMessage)));\n });\n\n this.__fetchEventQueue = [];\n }\n\n private __handleFetchEvent(event: Event) {\n if (!(event instanceof FetchEvent)) return;\n if (event.defaultPrevented) return;\n if (event.request.method !== 'GET') return;\n if (event.request.url.startsWith('foxy://')) return;\n if (event.composedPath()[0] === this) return;\n\n event.preventDefault();\n this.__fetchEventQueue.push(event);\n\n if (!this.in('busy')) this.__processFetchEventQueue();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"NucleonElement.js","sourceRoot":"","sources":["../../../../src/elements/public/NucleonElement/NucleonElement.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAwB,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE3C,OAAO,EAAE,GAAG,EAAE,iBAAc;AAC5B,OAAO,EAAE,UAAU,EAAE,wBAAqB;AAC1C,OAAO,EAAE,WAAW,EAAE,yBAAsB;AAC5C,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,4BAAyB;AAElD;;;;;;;;GAQG;AACH,MAAM,OAAO,cAA8C,SAAQ,UAAU;IAA7E;;QA4CE;;;WAGG;QACH,SAAI,GAAG,EAAE,CAAC;QAEV;;;WAGG;QACH,WAAM,GAAG,EAAE,CAAC;QAEZ;;;WAGG;QACH,YAAO,GAAa,EAAE,CAAC;QAEf,WAAM,GAAG,EAAE,CAAC;QAEZ,YAAO,GAAG,EAAE,CAAC;QAMb,sBAAiB,GAAiB,EAAE,CAAC;QAE5B,cAAS,GAAG,SAAS,CACnC,OAAO,CAAC,OAAiC,CAAC,UAAU,CAAC;YACpD,QAAQ,EAAE;gBACR,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE;gBACpC,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,KAAM,CAAC;gBACjD,QAAQ,EAAE,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,OAAO;QACpD,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI;YAAE,OAAO;QAE7C,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAEnC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC;YAAE,IAAI,CAAC,wBAAwB,EAAE,CAAC;IACxD,CAAC;;AA/ZD;;;;;GAKG;AACa,0BAAW,GAAG,WAAW,CAAC;AAE1C;;;;;GAKG;AACa,qBAAM,GAAG,OAAO,CAA4B,GAAG,EAAE,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC;AAEhF;;;;GAIG;AACa,kBAAG,GAAG,GAAG,CAAC","sourcesContent":["import { ComputedElementProperties, HALJSONResource, NucleonMachine, NucleonV8N } from './types';\nimport { LitElement, PropertyDeclarations } from 'lit-element';\nimport { Nucleon, Rumour } from '@foxy.io/sdk/core';\nimport { assign, interpret } from 'xstate';\n\nimport { API } from './API';\nimport { FetchEvent } from './FetchEvent';\nimport { UpdateEvent } from './UpdateEvent';\nimport memoize from 'lodash-es/memoize';\nimport { serveFromCache } from './serveFromCache';\n\n/**\n * Base class for custom elements working with remote HAL+JSON resources.\n *\n * @fires NucleonElement#update - Instance of `NucleonElement.UpdateEvent`. Dispatched on an element whenever it changes its state.\n * @fires NucleonElement#fetch - Instance of `NucleonElement.API.FetchEvent`. Emitted before each API request.\n *\n * @element foxy-nucleon\n * @since 1.1.0\n */\nexport class NucleonElement<TData extends HALJSONResource> extends LitElement {\n /**\n * Instances of this event are dispatched on an element whenever it changes its\n * state (e.g. when going from `busy` to `idle` or on `form` data change).\n * This event isn't cancelable, and it does not bubble.\n * @readonly\n */\n static readonly UpdateEvent = UpdateEvent;\n\n /**\n * Creates a tagged [Rumour](https://sdk.foxy.dev/classes/_core_index_.rumour.html)\n * instance if it doesn't exist or returns cached one otherwise. NucleonElements\n * use empty Rumour group by default.\n * @readonly\n */\n static readonly Rumour = memoize<(group: string) => Rumour>(() => new Rumour());\n\n /**\n * Universal [API](https://sdk.foxy.dev/classes/_core_index_.api.html) client\n * that dispatches cancellable `FetchEvent` on an element before each request.\n * @readonly\n */\n static readonly API = API;\n\n /** @readonly */\n static get properties(): PropertyDeclarations {\n return {\n related: { type: Array },\n parent: { type: String },\n group: { type: String, noAccessor: true },\n href: { type: String, noAccessor: true },\n lang: { type: String },\n };\n }\n\n /**\n * Array of validation functions. Each function accepts `element.form` and must return\n * either an error code string if form data fails the check or `true` otherwise.\n * Error codes are collected in `element.errors`. Empty by default.\n */\n static get v8n(): NucleonV8N<any> {\n return [];\n }\n\n /**\n * Optional ISO 639-1 code describing the language element content is written in.\n * Changing the `lang` attribute will update the value of this property.\n */\n lang = '';\n\n /**\n * Optional URL of the collection this element's resource belongs to.\n * Changing the `parent` attribute will update the value of this property.\n */\n parent = '';\n\n /**\n * Optional URI list of the related resources. If Rumour encounters a related\n * resource on creation or deletion, it will be reloaded from source.\n */\n related: string[] = [];\n\n private __href = '';\n\n private __group = '';\n\n private __unsubscribeFromRumour!: () => void;\n\n private __fetchEventHandler!: (evt: Event) => void;\n\n private __fetchEventQueue: FetchEvent[] = [];\n\n private readonly __service = interpret(\n (Nucleon.machine as NucleonMachine<TData>).withConfig({\n services: {\n sendDelete: () => this._sendDelete(),\n sendPatch: ({ edits }) => this._sendPatch(edits!),\n sendPost: ({ edits }) => this._sendPost(edits!),\n sendGet: () => this._sendGet(),\n },\n\n actions: {\n validate: assign<Nucleon.Context<TData, string>, Nucleon.Event<TData>>({\n errors: context => {\n const rules = (this.constructor as typeof NucleonElement).v8n;\n const form = { ...context.data, ...context.edits };\n\n return rules\n .map(validate => validate(form))\n .filter(v8nResult => typeof v8nResult === 'string')\n .filter((err, errIndex, errs) => errs.indexOf(err) === errIndex) as string[];\n },\n }),\n },\n })\n );\n\n /**\n * If network request returns non-2XX code, the entire error response\n * will be available via this getter.\n *\n * This property is readonly. Changing failure records via this property is\n * not guaranteed to work. NucleonElement does not provide a way to override error status.\n *\n * @since 1.4.0\n */\n get failure(): Response | null {\n return this.__service.state.context.failure;\n }\n\n /**\n * Array of validation errors returned from `NucleonElement.v8n` checks.\n *\n * This property is readonly. Adding or removing error codes via this property is\n * not guaranteed to work. NucleonElement does not provide a way to override validity status.\n */\n get errors(): string[] {\n return this.__service.state.context.errors;\n }\n\n /**\n * Resource snapshot with edits applied. Empty object if unavailable.\n *\n * This property and its value are readonly. Assignments like `element.data.foo = 'bar'`\n * are not guaranteed to work. Please use `element.edit({ foo: 'bar' })` instead.\n * If you need to replace the entire data object, consider using `element.data`.\n */\n get form(): Partial<TData> {\n const { data, edits } = this.__service.state.context;\n return { ...data, ...edits } as Partial<TData>;\n }\n\n /**\n * Resource snapshot as-is, no edits applied. Null if unavailable.\n *\n * Returned value is not reactive. Assignments like `element.data.foo = 'bar'`\n * are not guaranteed to work. Please set the property instead: `element.data = { ...element.data, foo: 'bar' }`.\n * If you're processing user input, consider using `element.form` and `element.edit()` instead.\n */\n get data(): TData | null {\n return this.__service.state.context.data;\n }\n\n set data(data: TData | null) {\n this.__service.send({ type: 'SET_DATA', data });\n this.__href = data?._links.self.href ?? '';\n }\n\n /**\n * Rumour group. Elements in different groups will not share updates. Empty by default.\n * @example element.group = 'my-group'\n */\n get group(): string {\n return this.__group;\n }\n\n set group(value: string) {\n this.__group = value;\n this.__destroyRumour();\n this.__createRumour();\n }\n\n /**\n * Optional URL of the resource to load. Switches element to `idle.template` state if empty (default).\n * @example element.href = 'https://demo.foxycart.com/s/customer/attributes/0'\n */\n get href(): string {\n return this.__href;\n }\n\n set href(value: string) {\n this.__href = value;\n\n if (value) {\n this.__service.send({ type: 'FETCH' });\n } else {\n this.__service.send({ type: 'SET_DATA', data: null });\n }\n }\n\n /**\n * Checks if this element is in the given state.\n * @example element.in({ idle: 'snapshot' })\n */\n in<TStateValue extends Nucleon.State<TData, string>['value']>(\n stateValue: TStateValue\n ): this is this & ComputedElementProperties<TData, TStateValue> {\n return this.__service.state.matches(stateValue);\n }\n\n /**\n * Clears all edits and emits the `update` event.\n * @example element.undo()\n */\n undo(): void {\n this.__service.send({ type: 'UNDO' });\n }\n\n /**\n * Applies an edit to the local resource snapshot or its template and emits the `update` event.\n * @example element.edit({ first_name: 'Alex' })\n */\n edit(data: Partial<TData>): void {\n this.__service.send({ type: 'EDIT', data });\n }\n\n /**\n * Submits the form, updating the resource if href isn't empty or creating it otherwise.\n * Emits multiple `update` events as element state changes. Has no effect on invalid forms.\n * @example element.submit()\n */\n submit(): void {\n this.__service.send({ type: 'SUBMIT' });\n }\n\n /**\n * Sends a DELETE request to `element.href` and clears local data on success.\n * Emits multiple update events as element state changes.\n * @example element.delete()\n */\n delete(): void {\n this.__service.send({ type: 'DELETE' });\n }\n\n /**\n * Fetches data from `element.href` in background, keeping the edits and v8n errors.\n * @example element.refresh()\n */\n refresh(): void {\n this.__service.send({ type: 'REFRESH' });\n }\n\n /** @readonly */\n connectedCallback(): void {\n super.connectedCallback();\n\n this.__createService();\n this.__createRumour();\n this.__createServer();\n this.__processFetchEventQueue();\n }\n\n /** @readonly */\n disconnectedCallback(): void {\n super.disconnectedCallback();\n\n this.__destroyService();\n this.__destroyRumour();\n this.__destroyServer();\n this.__flushFetchEventQueue('parent element was disconnected');\n }\n\n /** Sends API request. Throws an error on non-2XX response. */\n protected async _fetch<TResult = TData>(...args: Parameters<Window['fetch']>): Promise<TResult> {\n const response = await new API(this).fetch(...args);\n if (!response.ok) throw response;\n return response.json();\n }\n\n /** POSTs to `element.parent`, shares response with the Rumour group and returns parsed JSON. */\n protected async _sendPost(edits: Partial<TData>): Promise<TData> {\n this.__destroyRumour();\n\n const body = JSON.stringify(edits);\n const data = await this._fetch(this.parent, { body, method: 'POST' });\n const rumour = NucleonElement.Rumour(this.group);\n const related = [...this.related, this.parent];\n\n rumour.share({ data, related, source: data._links.self.href });\n this.__createRumour();\n\n return data;\n }\n\n /** GETs `element.href`, shares response with the Rumour group and returns parsed JSON. */\n protected async _sendGet(): Promise<TData> {\n this.__destroyRumour();\n\n const data = await this._fetch(this.href);\n const rumour = NucleonElement.Rumour(this.group);\n\n rumour.share({ data, source: this.href });\n this.__createRumour();\n\n return data;\n }\n\n /** PATCHes `element.href`, shares response with the Rumour group and returns parsed JSON. */\n protected async _sendPatch(edits: Partial<TData>): Promise<TData> {\n this.__destroyRumour();\n\n const body = JSON.stringify(edits);\n const data = await this._fetch(this.href, { body, method: 'PATCH' });\n const rumour = NucleonElement.Rumour(this.group);\n\n rumour.share({ data, source: this.href, related: this.related });\n this.__createRumour();\n\n return data;\n }\n\n /** DELETEs `element.href`, shares response with the Rumour group and returns parsed JSON. */\n protected async _sendDelete(): Promise<TData> {\n this.__destroyRumour();\n\n const data = await this._fetch(this.href, { method: 'DELETE' });\n const rumour = NucleonElement.Rumour(this.group);\n const related = [...this.related, this.parent];\n\n rumour.share({ data: null, source: this.href, related });\n this.__createRumour();\n\n return data;\n }\n\n private __createService() {\n this.__service.onTransition(state => {\n if (!state.changed) return;\n\n const flags = state.toStrings().reduce((p, c) => [...p, ...c.split('.')], [] as string[]);\n this.setAttribute('state', [...new Set(flags)].join(' '));\n\n this.requestUpdate();\n this.dispatchEvent(new UpdateEvent());\n\n if (!state.matches('busy')) this.__processFetchEventQueue();\n });\n\n this.__service.onChange(() => {\n this.requestUpdate();\n this.dispatchEvent(new UpdateEvent());\n });\n\n this.__service.start();\n }\n\n private __destroyService() {\n this.__service.stop();\n }\n\n private __createRumour() {\n const rumour = NucleonElement.Rumour(this.group);\n this.__unsubscribeFromRumour = rumour.track(update => this.__handleRumourUpdate(update));\n }\n\n private __destroyRumour() {\n this.__unsubscribeFromRumour?.();\n }\n\n private __createServer() {\n this.__fetchEventHandler = this.__handleFetchEvent.bind(this);\n this.addEventListener('fetch', this.__fetchEventHandler);\n }\n\n private __destroyServer() {\n this.removeEventListener('fetch', this.__fetchEventHandler);\n }\n\n private __handleRumourUpdate(update: (oldData: TData) => TData | null) {\n try {\n const oldData = this.__service.state?.context.data;\n if (!oldData) return;\n\n const newData = update(oldData);\n if (newData !== oldData) this.__service.send({ data: newData, type: 'SET_DATA' });\n } catch (err) {\n if (err instanceof Rumour.UpdateError) {\n this.__service.send({ type: 'REFRESH' });\n } else {\n throw err;\n }\n }\n }\n\n private __processFetchEventQueue() {\n const api = new NucleonElement.API(this);\n\n this.__fetchEventQueue.forEach(event => {\n const request = event.request;\n const cacheResponse = serveFromCache(request.url, this.data);\n const whenResponseReady = cacheResponse.ok ? cacheResponse : api.fetch(request);\n\n event.respondWith(Promise.resolve(whenResponseReady));\n\n if (cacheResponse.ok) {\n console.debug(\n `%c@foxy.io/elements::${this.localName}\\n%c200%c GET ${request.url}`,\n 'color: gray',\n `background: gray; padding: 0 .2em; border-radius: .2em; color: white;`,\n ''\n );\n }\n });\n\n this.__fetchEventQueue = [];\n }\n\n private __flushFetchEventQueue(errorMessage: string) {\n this.__fetchEventQueue.forEach(event => {\n event.respondWith(Promise.reject(new Error(errorMessage)));\n });\n\n this.__fetchEventQueue = [];\n }\n\n private __handleFetchEvent(event: Event) {\n if (!(event instanceof FetchEvent)) return;\n if (event.defaultPrevented) return;\n if (event.request.method !== 'GET') return;\n if (event.request.url.startsWith('foxy://')) return;\n if (event.composedPath()[0] === this) return;\n\n event.preventDefault();\n this.__fetchEventQueue.push(event);\n\n if (!this.in('busy')) this.__processFetchEventQueue();\n }\n}\n"]}
|
|
@@ -26,6 +26,10 @@ export { EmailTemplateForm } from './EmailTemplateForm/EmailTemplateForm';
|
|
|
26
26
|
export { ErrorEntryCard } from './ErrorEntryCard/ErrorEntryCard';
|
|
27
27
|
export { FormDialog } from './FormDialog/FormDialog';
|
|
28
28
|
export { GenerateCodesForm } from './GenerateCodesForm/GenerateCodesForm';
|
|
29
|
+
export { GiftCardCard } from './GiftCardCard/GiftCardCard';
|
|
30
|
+
export { GiftCardCodeForm } from './GiftCardCodeForm/GiftCardCodeForm';
|
|
31
|
+
export { GiftCardCodesForm } from './GiftCardCodesForm/GiftCardCodesForm';
|
|
32
|
+
export { GiftCardForm } from './GiftCardForm/GiftCardForm';
|
|
29
33
|
export { I18n } from './I18n/I18n';
|
|
30
34
|
export { ItemsForm, Item } from './ItemsForm/ItemsForm';
|
|
31
35
|
export { NucleonElement } from './NucleonElement/NucleonElement';
|
|
@@ -26,6 +26,10 @@ export { EmailTemplateForm } from './EmailTemplateForm/index';
|
|
|
26
26
|
export { ErrorEntryCard } from './ErrorEntryCard/index';
|
|
27
27
|
export { FormDialog } from './FormDialog/index';
|
|
28
28
|
export { GenerateCodesForm } from './GenerateCodesForm/index';
|
|
29
|
+
export { GiftCardCard } from './GiftCardCard/index';
|
|
30
|
+
export { GiftCardCodeForm } from './GiftCardCodeForm/index';
|
|
31
|
+
export { GiftCardCodesForm } from './GiftCardCodesForm/index';
|
|
32
|
+
export { GiftCardForm } from './GiftCardForm/index';
|
|
29
33
|
export { I18n } from './I18n/index';
|
|
30
34
|
export { ItemsForm, Item } from './ItemsForm/index';
|
|
31
35
|
export { NucleonElement } from './NucleonElement/index';
|
|
@@ -26,6 +26,10 @@ export { EmailTemplateForm } from "./EmailTemplateForm/index.js";
|
|
|
26
26
|
export { ErrorEntryCard } from "./ErrorEntryCard/index.js";
|
|
27
27
|
export { FormDialog } from "./FormDialog/index.js";
|
|
28
28
|
export { GenerateCodesForm } from "./GenerateCodesForm/index.js";
|
|
29
|
+
export { GiftCardCard } from "./GiftCardCard/index.js";
|
|
30
|
+
export { GiftCardCodeForm } from "./GiftCardCodeForm/index.js";
|
|
31
|
+
export { GiftCardCodesForm } from "./GiftCardCodesForm/index.js";
|
|
32
|
+
export { GiftCardForm } from "./GiftCardForm/index.js";
|
|
29
33
|
export { I18n } from "./I18n/index.js";
|
|
30
34
|
export { ItemsForm, Item } from "./ItemsForm/index.js";
|
|
31
35
|
export { NucleonElement } from "./NucleonElement/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.defined.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EAAE,6BAA0B;AACpD,OAAO,EAAE,cAAc,EAAE,kCAA+B;AACxD,OAAO,EAAE,UAAU,EAAE,8BAA2B;AAChD,OAAO,EAAE,WAAW,EAAE,+BAA4B;AAClD,OAAO,EAAE,iBAAiB,EAAE,qCAAkC;AAC9D,OAAO,EAAE,YAAY,EAAE,gCAA6B;AACpD,OAAO,EAAE,UAAU,EAAE,8BAA2B;AAChD,OAAO,EAAE,OAAO,EAAE,2BAAwB;AAC1C,OAAO,EAAE,gBAAgB,EAAE,oCAAiC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,oCAAiC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,sCAAmC;AAChE,OAAO,EAAE,KAAK,EAAE,yBAAsB;AACtC,OAAO,EAAE,OAAO,EAAE,2BAAwB;AAC1C,OAAO,EAAE,OAAO,EAAE,2BAAwB;AAC1C,OAAO,EAAE,kBAAkB,EAAE,sCAAmC;AAChE,OAAO,EAAE,YAAY,EAAE,gCAA6B;AACpD,OAAO,EAAE,eAAe,EAAE,mCAAgC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,qCAAkC;AAC9D,OAAO,EAAE,QAAQ,EAAE,4BAAyB;AAC5C,OAAO,EAAE,UAAU,EAAE,8BAA2B","sourcesContent":["export { AccessRecoveryForm } from './AccessRecoveryForm/index';\nexport { AddressCard } from './AddressCard/index';\nexport { AddressForm } from './AddressForm/index';\nexport { AppliedTaxCard } from './AppliedTaxCard/index';\nexport { AttributeCard } from './AttributeCard/index';\nexport { AttributeForm } from './AttributeForm/index';\nexport { CancellationForm } from './CancellationForm/index';\nexport { CollectionPage } from './CollectionPage/index';\nexport { CollectionPages } from './CollectionPages/index';\nexport { CouponCard } from './CouponCard/index';\nexport { CouponCodeForm } from './CouponCodeForm/index';\nexport { CouponCodesForm } from './CouponCodesForm/index';\nexport { CouponForm } from './CouponForm/index';\nexport { Customer } from './Customer/index';\nexport { CustomerApi } from './CustomerApi/index';\nexport { CustomerCard } from './CustomerCard/index';\nexport { CustomerForm } from './CustomerForm/index';\nexport { CustomerPortal } from './CustomerPortal/index';\nexport { CustomerPortalSettings } from './CustomerPortalSettings/index';\nexport { CustomersTable } from './CustomersTable/index';\nexport { CustomFieldCard } from './CustomFieldCard/index';\nexport { CustomFieldForm } from './CustomFieldForm/index';\nexport { DiscountCard } from './DiscountCard/index';\nexport { Donation } from './Donation/index';\nexport { EmailTemplateForm } from './EmailTemplateForm/index';\nexport { ErrorEntryCard } from './ErrorEntryCard/index';\nexport { FormDialog } from './FormDialog/index';\nexport { GenerateCodesForm } from './GenerateCodesForm/index';\nexport { I18n } from './I18n/index';\nexport { ItemsForm, Item } from './ItemsForm/index';\nexport { NucleonElement } from './NucleonElement/index';\nexport { Pagination } from './Pagination/index';\nexport { PaymentCard } from './PaymentCard/index';\nexport { PaymentMethodCard } from './PaymentMethodCard/index';\nexport { QueryBuilder } from './QueryBuilder/index';\nexport { SignInForm } from './SignInForm/index';\nexport { Spinner } from './Spinner/index';\nexport { SubscriptionCard } from './SubscriptionCard/index';\nexport { SubscriptionForm } from './SubscriptionForm/index';\nexport { SubscriptionsTable } from './SubscriptionsTable/index';\nexport { Table } from './Table/index';\nexport { TaxCard } from './TaxCard/index';\nexport { TaxForm } from './TaxForm/index';\nexport { TemplateConfigForm } from './TemplateConfigForm/index';\nexport { TemplateForm } from './TemplateForm/index';\nexport { TransactionCard } from './TransactionCard/index';\nexport { TransactionsTable } from './TransactionsTable/index';\nexport { UserForm } from './UserForm/index';\nexport { UsersTable } from './UsersTable/index';\n"]}
|
|
1
|
+
{"version":3,"file":"index.defined.js","sourceRoot":"","sources":["../../../src/elements/public/index.defined.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,sCAAmC;AAChE,OAAO,EAAE,WAAW,EAAE,+BAA4B;AAClD,OAAO,EAAE,WAAW,EAAE,+BAA4B;AAClD,OAAO,EAAE,cAAc,EAAE,kCAA+B;AACxD,OAAO,EAAE,aAAa,EAAE,iCAA8B;A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B;AAChD,OAAO,EAAE,WAAW,EAAE,+BAA4B;AAClD,OAAO,EAAE,iBAAiB,EAAE,qCAAkC;AAC9D,OAAO,EAAE,YAAY,EAAE,gCAA6B;AACpD,OAAO,EAAE,UAAU,EAAE,8BAA2B;AAChD,OAAO,EAAE,OAAO,EAAE,2BAAwB;AAC1C,OAAO,EAAE,gBAAgB,EAAE,oCAAiC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,oCAAiC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,sCAAmC;AAChE,OAAO,EAAE,KAAK,EAAE,yBAAsB;AACtC,OAAO,EAAE,OAAO,EAAE,2BAAwB;AAC1C,OAAO,EAAE,OAAO,EAAE,2BAAwB;AAC1C,OAAO,EAAE,kBAAkB,EAAE,sCAAmC;AAChE,OAAO,EAAE,YAAY,EAAE,gCAA6B;AACpD,OAAO,EAAE,eAAe,EAAE,mCAAgC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,qCAAkC;AAC9D,OAAO,EAAE,QAAQ,EAAE,4BAAyB;AAC5C,OAAO,EAAE,UAAU,EAAE,8BAA2B","sourcesContent":["export { AccessRecoveryForm } from './AccessRecoveryForm/index';\nexport { AddressCard } from './AddressCard/index';\nexport { AddressForm } from './AddressForm/index';\nexport { AppliedTaxCard } from './AppliedTaxCard/index';\nexport { AttributeCard } from './AttributeCard/index';\nexport { AttributeForm } from './AttributeForm/index';\nexport { CancellationForm } from './CancellationForm/index';\nexport { CollectionPage } from './CollectionPage/index';\nexport { CollectionPages } from './CollectionPages/index';\nexport { CouponCard } from './CouponCard/index';\nexport { CouponCodeForm } from './CouponCodeForm/index';\nexport { CouponCodesForm } from './CouponCodesForm/index';\nexport { CouponForm } from './CouponForm/index';\nexport { Customer } from './Customer/index';\nexport { CustomerApi } from './CustomerApi/index';\nexport { CustomerCard } from './CustomerCard/index';\nexport { CustomerForm } from './CustomerForm/index';\nexport { CustomerPortal } from './CustomerPortal/index';\nexport { CustomerPortalSettings } from './CustomerPortalSettings/index';\nexport { CustomersTable } from './CustomersTable/index';\nexport { CustomFieldCard } from './CustomFieldCard/index';\nexport { CustomFieldForm } from './CustomFieldForm/index';\nexport { DiscountCard } from './DiscountCard/index';\nexport { Donation } from './Donation/index';\nexport { EmailTemplateForm } from './EmailTemplateForm/index';\nexport { ErrorEntryCard } from './ErrorEntryCard/index';\nexport { FormDialog } from './FormDialog/index';\nexport { GenerateCodesForm } from './GenerateCodesForm/index';\nexport { GiftCardCard } from './GiftCardCard/index';\nexport { GiftCardCodeForm } from './GiftCardCodeForm/index';\nexport { GiftCardCodesForm } from './GiftCardCodesForm/index';\nexport { GiftCardForm } from './GiftCardForm/index';\nexport { I18n } from './I18n/index';\nexport { ItemsForm, Item } from './ItemsForm/index';\nexport { NucleonElement } from './NucleonElement/index';\nexport { Pagination } from './Pagination/index';\nexport { PaymentCard } from './PaymentCard/index';\nexport { PaymentMethodCard } from './PaymentMethodCard/index';\nexport { QueryBuilder } from './QueryBuilder/index';\nexport { SignInForm } from './SignInForm/index';\nexport { Spinner } from './Spinner/index';\nexport { SubscriptionCard } from './SubscriptionCard/index';\nexport { SubscriptionForm } from './SubscriptionForm/index';\nexport { SubscriptionsTable } from './SubscriptionsTable/index';\nexport { Table } from './Table/index';\nexport { TaxCard } from './TaxCard/index';\nexport { TaxForm } from './TaxForm/index';\nexport { TemplateConfigForm } from './TemplateConfigForm/index';\nexport { TemplateForm } from './TemplateForm/index';\nexport { TransactionCard } from './TransactionCard/index';\nexport { TransactionsTable } from './TransactionsTable/index';\nexport { UserForm } from './UserForm/index';\nexport { UsersTable } from './UsersTable/index';\n"]}
|
|
@@ -26,6 +26,10 @@ export { EmailTemplateForm } from "./EmailTemplateForm/EmailTemplateForm.js";
|
|
|
26
26
|
export { ErrorEntryCard } from "./ErrorEntryCard/ErrorEntryCard.js";
|
|
27
27
|
export { FormDialog } from "./FormDialog/FormDialog.js";
|
|
28
28
|
export { GenerateCodesForm } from "./GenerateCodesForm/GenerateCodesForm.js";
|
|
29
|
+
export { GiftCardCard } from "./GiftCardCard/GiftCardCard.js";
|
|
30
|
+
export { GiftCardCodeForm } from "./GiftCardCodeForm/GiftCardCodeForm.js";
|
|
31
|
+
export { GiftCardCodesForm } from "./GiftCardCodesForm/GiftCardCodesForm.js";
|
|
32
|
+
export { GiftCardForm } from "./GiftCardForm/GiftCardForm.js";
|
|
29
33
|
export { I18n } from "./I18n/I18n.js";
|
|
30
34
|
export { ItemsForm, Item } from "./ItemsForm/ItemsForm.js";
|
|
31
35
|
export { NucleonElement } from "./NucleonElement/NucleonElement.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/elements/public/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,mDAAgD;AAC7E,OAAO,EAAE,WAAW,EAAE,qCAAkC;AACxD,OAAO,EAAE,WAAW,EAAE,qCAAkC;AACxD,OAAO,EAAE,cAAc,EAAE,2CAAwC;AACjE,OAAO,EAAE,aAAa,EAAE,yCAAsC;AAC9D,OAAO,EAAE,aAAa,EAAE,yCAAsC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,+CAA4C;AACvE,OAAO,EAAE,cAAc,EAAE,2CAAwC;AACjE,OAAO,EAAE,eAAe,EAAE,6CAA0C;AACpE,OAAO,EAAE,UAAU,EAAE,mCAAgC;AACrD,OAAO,EAAE,cAAc,EAAE,2CAAwC;AACjE,OAAO,EAAE,eAAe,EAAE,6CAA0C;AACpE,OAAO,EAAE,UAAU,EAAE,mCAAgC;AACrD,OAAO,EAAE,QAAQ,EAAE,+BAA4B;AAC/C,OAAO,EAAE,WAAW,EAAE,qCAAkC;AACxD,OAAO,EAAE,YAAY,EAAE,uCAAoC;AAC3D,OAAO,EAAE,YAAY,EAAE,uCAAoC;AAC3D,OAAO,EAAE,cAAc,EAAE,2CAAwC;AACjE,OAAO,EAAE,sBAAsB,EAAE,2DAAwD;AACzF,OAAO,EAAE,cAAc,EAAE,2C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{ AddressCard } from './AddressCard/AddressCard';\nexport { AddressForm } from './AddressForm/AddressForm';\nexport { AppliedTaxCard } from './AppliedTaxCard/AppliedTaxCard';\nexport { AttributeCard } from './AttributeCard/AttributeCard';\nexport { AttributeForm } from './AttributeForm/AttributeForm';\nexport { CancellationForm } from './CancellationForm/CancellationForm';\nexport { CollectionPage } from './CollectionPage/CollectionPage';\nexport { CollectionPages } from './CollectionPages/CollectionPages';\nexport { CouponCard } from './CouponCard/CouponCard';\nexport { CouponCodeForm } from './CouponCodeForm/CouponCodeForm';\nexport { CouponCodesForm } from './CouponCodesForm/CouponCodesForm';\nexport { CouponForm } from './CouponForm/CouponForm';\nexport { Customer } from './Customer/Customer';\nexport { CustomerApi } from './CustomerApi/CustomerApi';\nexport { CustomerCard } from './CustomerCard/CustomerCard';\nexport { CustomerForm } from './CustomerForm/CustomerForm';\nexport { CustomerPortal } from './CustomerPortal/CustomerPortal';\nexport { CustomerPortalSettings } from './CustomerPortalSettings/CustomerPortalSettings';\nexport { CustomersTable } from './CustomersTable/CustomersTable';\nexport { CustomFieldCard } from './CustomFieldCard/CustomFieldCard';\nexport { CustomFieldForm } from './CustomFieldForm/CustomFieldForm';\nexport { DiscountCard } from './DiscountCard/DiscountCard';\nexport { Donation } from './Donation/Donation';\nexport { EmailTemplateForm } from './EmailTemplateForm/EmailTemplateForm';\nexport { ErrorEntryCard } from './ErrorEntryCard/ErrorEntryCard';\nexport { FormDialog } from './FormDialog/FormDialog';\nexport { GenerateCodesForm } from './GenerateCodesForm/GenerateCodesForm';\nexport { I18n } from './I18n/I18n';\nexport { ItemsForm, Item } from './ItemsForm/ItemsForm';\nexport { NucleonElement } from './NucleonElement/NucleonElement';\nexport { Pagination } from './Pagination/Pagination';\nexport { PaymentCard } from './PaymentCard/PaymentCard';\nexport { PaymentMethodCard } from './PaymentMethodCard/PaymentMethodCard';\nexport { QueryBuilder } from './QueryBuilder/QueryBuilder';\nexport { SignInForm } from './SignInForm/SignInForm';\nexport { Spinner } from './Spinner/Spinner';\nexport { SubscriptionCard } from './SubscriptionCard/SubscriptionCard';\nexport { SubscriptionForm } from './SubscriptionForm/SubscriptionForm';\nexport { SubscriptionsTable } from './SubscriptionsTable/SubscriptionsTable';\nexport { Table } from './Table/Table';\nexport { TaxCard } from './TaxCard/TaxCard';\nexport { TaxForm } from './TaxForm/TaxForm';\nexport { TemplateForm } from './TemplateForm/TemplateForm';\nexport { TemplateConfigForm } from './TemplateConfigForm/TemplateConfigForm';\nexport { TransactionCard } from './TransactionCard/TransactionCard';\nexport { TransactionsTable } from './TransactionsTable/TransactionsTable';\nexport { UserForm } from './UserForm/UserForm';\nexport { UsersTable } from './UsersTable/UsersTable';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/elements/public/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,mDAAgD;AAC7E,OAAO,EAAE,WAAW,EAAE,qCAAkC;AACxD,OAAO,EAAE,WAAW,EAAE,qCAAkC;AACxD,OAAO,EAAE,cAAc,EAAE,2CAAwC;AACjE,OAAO,EAAE,aAAa,EAAE,yCAAsC;AAC9D,OAAO,EAAE,aAAa,EAAE,yCAAsC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,+CAA4C;AACvE,OAAO,EAAE,cAAc,EAAE,2CAAwC;AACjE,OAAO,EAAE,eAAe,EAAE,6CAA0C;AACpE,OAAO,EAAE,UAAU,EAAE,mCAAgC;AACrD,OAAO,EAAE,cAAc,EAAE,2CAAwC;AACjE,OAAO,EAAE,eAAe,EAAE,6CAA0C;AACpE,OAAO,EAAE,UAAU,EAAE,mCAAgC;AACrD,OAAO,EAAE,QAAQ,EAAE,+BAA4B;AAC/C,OAAO,EAAE,WAAW,EAAE,qCAAkC;AACxD,OAAO,EAAE,YAAY,EAAE,uCAAoC;AAC3D,OAAO,EAAE,YAAY,EAAE,uCAAoC;AAC3D,OAAO,EAAE,cAAc,EAAE,2CAAwC;AACjE,OAAO,EA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;AAC7E,OAAO,EAAE,eAAe,EAAE,6CAA0C;AACpE,OAAO,EAAE,iBAAiB,EAAE,iDAA8C;AAC1E,OAAO,EAAE,QAAQ,EAAE,+BAA4B;AAC/C,OAAO,EAAE,UAAU,EAAE,mCAAgC","sourcesContent":["export { AccessRecoveryForm } from './AccessRecoveryForm/AccessRecoveryForm';\nexport { AddressCard } from './AddressCard/AddressCard';\nexport { AddressForm } from './AddressForm/AddressForm';\nexport { AppliedTaxCard } from './AppliedTaxCard/AppliedTaxCard';\nexport { AttributeCard } from './AttributeCard/AttributeCard';\nexport { AttributeForm } from './AttributeForm/AttributeForm';\nexport { CancellationForm } from './CancellationForm/CancellationForm';\nexport { CollectionPage } from './CollectionPage/CollectionPage';\nexport { CollectionPages } from './CollectionPages/CollectionPages';\nexport { CouponCard } from './CouponCard/CouponCard';\nexport { CouponCodeForm } from './CouponCodeForm/CouponCodeForm';\nexport { CouponCodesForm } from './CouponCodesForm/CouponCodesForm';\nexport { CouponForm } from './CouponForm/CouponForm';\nexport { Customer } from './Customer/Customer';\nexport { CustomerApi } from './CustomerApi/CustomerApi';\nexport { CustomerCard } from './CustomerCard/CustomerCard';\nexport { CustomerForm } from './CustomerForm/CustomerForm';\nexport { CustomerPortal } from './CustomerPortal/CustomerPortal';\nexport { CustomerPortalSettings } from './CustomerPortalSettings/CustomerPortalSettings';\nexport { CustomersTable } from './CustomersTable/CustomersTable';\nexport { CustomFieldCard } from './CustomFieldCard/CustomFieldCard';\nexport { CustomFieldForm } from './CustomFieldForm/CustomFieldForm';\nexport { DiscountCard } from './DiscountCard/DiscountCard';\nexport { Donation } from './Donation/Donation';\nexport { EmailTemplateForm } from './EmailTemplateForm/EmailTemplateForm';\nexport { ErrorEntryCard } from './ErrorEntryCard/ErrorEntryCard';\nexport { FormDialog } from './FormDialog/FormDialog';\nexport { GenerateCodesForm } from './GenerateCodesForm/GenerateCodesForm';\nexport { GiftCardCard } from './GiftCardCard/GiftCardCard';\nexport { GiftCardCodeForm } from './GiftCardCodeForm/GiftCardCodeForm';\nexport { GiftCardCodesForm } from './GiftCardCodesForm/GiftCardCodesForm';\nexport { GiftCardForm } from './GiftCardForm/GiftCardForm';\nexport { I18n } from './I18n/I18n';\nexport { ItemsForm, Item } from './ItemsForm/ItemsForm';\nexport { NucleonElement } from './NucleonElement/NucleonElement';\nexport { Pagination } from './Pagination/Pagination';\nexport { PaymentCard } from './PaymentCard/PaymentCard';\nexport { PaymentMethodCard } from './PaymentMethodCard/PaymentMethodCard';\nexport { QueryBuilder } from './QueryBuilder/QueryBuilder';\nexport { SignInForm } from './SignInForm/SignInForm';\nexport { Spinner } from './Spinner/Spinner';\nexport { SubscriptionCard } from './SubscriptionCard/SubscriptionCard';\nexport { SubscriptionForm } from './SubscriptionForm/SubscriptionForm';\nexport { SubscriptionsTable } from './SubscriptionsTable/SubscriptionsTable';\nexport { Table } from './Table/Table';\nexport { TaxCard } from './TaxCard/TaxCard';\nexport { TaxForm } from './TaxForm/TaxForm';\nexport { TemplateForm } from './TemplateForm/TemplateForm';\nexport { TemplateConfigForm } from './TemplateConfigForm/TemplateConfigForm';\nexport { TransactionCard } from './TransactionCard/TransactionCard';\nexport { TransactionsTable } from './TransactionsTable/TransactionsTable';\nexport { UserForm } from './UserForm/UserForm';\nexport { UsersTable } from './UsersTable/UsersTable';\n"]}
|
package/dist/mixins/themeable.js
CHANGED
|
@@ -463,6 +463,10 @@ input::-webkit-date-and-time-value{
|
|
|
463
463
|
grid-column: span 2 / span 2;
|
|
464
464
|
}
|
|
465
465
|
|
|
466
|
+
:host([md]) .md-col-span-2 {
|
|
467
|
+
grid-column: span 2 / span 2;
|
|
468
|
+
}
|
|
469
|
+
|
|
466
470
|
.float-left {
|
|
467
471
|
float: left;
|
|
468
472
|
}
|
|
@@ -1076,10 +1080,18 @@ input::-webkit-date-and-time-value{
|
|
|
1076
1080
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
1077
1081
|
}
|
|
1078
1082
|
|
|
1083
|
+
:host([sm]) .sm-grid-cols-3 {
|
|
1084
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1079
1087
|
:host([md]) .md-grid-cols-2 {
|
|
1080
1088
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
1081
1089
|
}
|
|
1082
1090
|
|
|
1091
|
+
:host([md]) .md-grid-cols-4 {
|
|
1092
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1083
1095
|
.grid-rows-2 {
|
|
1084
1096
|
grid-template-rows: repeat(2, minmax(0, 1fr));
|
|
1085
1097
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeable.js","sourceRoot":"","sources":["../../src/mixins/themeable.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,OAAO,EAA0C,UAAU,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAEtF,OAAO,EAAE,eAAe,EAAE,wBAAqB;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAI/D,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,WAAkB,EACkB,EAAE;IACtC,OAAO,MAAM,gBAAiB,SAAQ,WAAW;QAC/C,MAAM,KAAK,MAAM;YACf,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC;YAEjC,OAAO;gBACL,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAClF,GAAG
|
|
1
|
+
{"version":3,"file":"themeable.js","sourceRoot":"","sources":["../../src/mixins/themeable.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,OAAO,EAA0C,UAAU,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAEtF,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAqHF;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,OAAgB,SAAU,SAAQ,mBAAmB,CACzD,eAAe,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAC5C;CAAG","sourcesContent":["/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n\nimport { CSSResult, CSSResultArray, Constructor, LitElement, css } from 'lit-element';\n\nimport { ResponsiveMixin } from './responsive';\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements';\n\ntype Base = Constructor<LitElement> & { styles?: CSSResult | CSSResultArray | CSSStyleSheet };\n\nexport const ThemeableMixin = <TBase extends Base>(\n BaseElement: TBase\n): TBase & { styles: CSSResultArray } => {\n return class ThemeableElement extends BaseElement {\n static get styles(): CSSResultArray {\n const originalCSS = super.styles;\n\n return [\n ...(originalCSS ? (Array.isArray(originalCSS) ? originalCSS : [originalCSS]) : []),\n css`\n @tailwind base;\n\n * {\n -webkit-tap-highlight-color: transparent;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n }\n\n :host {\n display: block;\n }\n\n details > summary::-webkit-details-marker {\n display: none;\n }\n\n details > summary {\n list-style: none;\n }\n\n vaadin-select {\n margin-top: -4px;\n margin-bottom: -4px;\n }\n\n vaadin-text-area,\n vaadin-text-field,\n vaadin-date-picker,\n vaadin-email-field,\n vaadin-number-field,\n vaadin-custom-field,\n vaadin-integer-field,\n vaadin-password-field,\n vaadin-combo-box::part(text-field) {\n padding-top: 0;\n padding-bottom: 0;\n }\n\n vaadin-date-picker::part(text-field) {\n padding-top: 0;\n padding-bottom: 0;\n }\n\n vaadin-button {\n margin: 0;\n }\n\n vaadin-checkbox::part(checkbox) {\n margin: 0;\n }\n\n vaadin-checkbox::part(label) {\n margin: 0.1875em var(--lumo-space-m);\n }\n\n .appearance-none {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n }\n\n .appearance-none::-webkit-calendar-picker-indicator,\n .appearance-none::-webkit-outer-spin-button,\n .appearance-none::-webkit-inner-spin-button,\n .appearance-none::-webkit-list-button {\n opacity: 0 !important;\n width: 0 !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n\n input::-webkit-date-and-time-value {\n text-align: inherit !important;\n }\n\n @tailwind components;\n\n @tailwind utilities;\n\n @layer utilities {\n .border-radius-overflow-fix {\n -webkit-mask-image: -webkit-radial-gradient(white, black);\n }\n\n @variants sm, md, lg, xl {\n .grid-rows-auto {\n grid-auto-rows: 1fr;\n }\n\n .icon-inline {\n --iron-icon-height: 1em;\n --iron-icon-width: 1em;\n }\n\n .bg-blurred {\n backdrop-filter: blur(25px);\n background: var(--lumo-tint-80pct);\n }\n\n .max-w-modal {\n max-width: 28rem;\n }\n\n .w-narrow-modal {\n width: 18rem;\n }\n\n .snap-x-mandatory {\n scroll-snap-type: x mandatory;\n }\n\n .snap-start {\n scroll-snap-align: start;\n }\n }\n }\n `,\n ];\n }\n };\n};\n\n/**\n * One of the base classes for each rel-specific element in the collection\n * providing shared TailwindCSS styles for Shadow DOM content.\n * This class MUST NOT be used on its own (hence the `abstract` keyword) or\n * referenced externally (outside of the package).\n *\n * @deprecated\n */\nexport abstract class Themeable extends ScopedElementsMixin(\n ResponsiveMixin(ThemeableMixin(LitElement))\n) {}\n"]}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
export function parseDuration(value) {
|
|
1
|
+
export function parseDuration(value, full = false) {
|
|
2
|
+
var _a;
|
|
3
|
+
const unitsMap = { y: 'year', m: 'month', w: 'week', d: 'day' };
|
|
4
|
+
const count = value.replace(/(y|m|w|d)/, '');
|
|
5
|
+
const unit = value.replace(/\.?\d+/, '');
|
|
2
6
|
return {
|
|
3
|
-
count:
|
|
4
|
-
units:
|
|
7
|
+
count: count === '.5' ? 0.5 : parseInt(count),
|
|
8
|
+
units: full ? (_a = unitsMap[unit]) !== null && _a !== void 0 ? _a : unit : unit,
|
|
5
9
|
};
|
|
6
10
|
}
|
|
7
11
|
//# sourceMappingURL=parse-duration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-duration.js","sourceRoot":"","sources":["../../src/utils/parse-duration.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,aAAa,CAAC,KAAa
|
|
1
|
+
{"version":3,"file":"parse-duration.js","sourceRoot":"","sources":["../../src/utils/parse-duration.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,aAAa,CAAC,KAAa,EAAE,IAAI,GAAG,KAAK;;IACvD,MAAM,QAAQ,GAA2B,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC;IACxF,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAEzC,OAAO;QACL,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;QAC7C,KAAK,EAAE,IAAI,CAAC,CAAC,OAAC,QAAQ,CAAC,IAAI,CAAC,mCAAI,IAAI,CAAC,CAAC,CAAC,IAAI;KAC5C,CAAC;AACJ,CAAC","sourcesContent":["export interface Duration {\n count: number;\n units: string;\n}\n\nexport function parseDuration(value: string, full = false): Duration {\n const unitsMap: Record<string, string> = { y: 'year', m: 'month', w: 'week', d: 'day' };\n const count = value.replace(/(y|m|w|d)/, '');\n const unit = value.replace(/\\.?\\d+/, '');\n\n return {\n count: count === '.5' ? 0.5 : parseInt(count),\n units: full ? unitsMap[unit] ?? unit : unit,\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foxy.io/elements",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.15.0-beta.
|
|
4
|
+
"version": "1.15.0-beta.5",
|
|
5
5
|
"description": "E-commerce web components by Foxy.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"prepack": "npm run lint && rimraf dist && node ./.build/compile-for-npm.js && rollup -c"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@foxy.io/sdk": "^1.
|
|
29
|
+
"@foxy.io/sdk": "^1.8.0",
|
|
30
30
|
"@open-wc/lit-helpers": "^0.3.11",
|
|
31
31
|
"@open-wc/scoped-elements": "1.2.1",
|
|
32
32
|
"@polymer/iron-icons": "^3.0.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{L as e,j as t,_ as s,h as i}from"./shared-63eaded9.js";import{A as a}from"./shared-4fa5f144.js";import{C as o}from"./shared-51e28c83.js";import{T as n,R as l,a as d}from"./shared-cd3c902e.js";import{F as r}from"./shared-c1dadefe.js";import{c}from"./shared-4e709717.js";class h extends CustomEvent{constructor(e=!1){super("hide",{detail:{cancelled:e}})}}class u extends CustomEvent{constructor(){super("show")}}let p,m=e=>e;class v extends(n(l(e))){static get styles(){return[super.styles,t(p||(p=m`:host{position:relative;z-index:200}`))]}}let b,_,y,g,f,w,x,$=e=>e;class D extends(d(o(n(e)))){constructor(){super(...arguments),this.closable=!1,this.editable=!1,this.header="",this.alert=!1,this.__handleKeyDown=e=>{"Escape"===e.key&&D.openDialogs[0]===this&&this.closable&&this.hide(this.editable)},this.__connected=!1,this.__visible=!1}static get properties(){return s(s({},super.properties),{},{__connected:{attribute:!1},__visible:{attribute:!1},centered:{type:Boolean},closable:{type:Boolean},editable:{type:Boolean},header:{type:String},alert:{type:Boolean},open:{type:Boolean,noAccessor:!0}})}static get styles(){return[super.styles,t(b||(b=$`.grid-cols-header{grid-template-columns:1fr auto 1fr}.scale-85{--tw-scale-x:0.85;--tw-scale-y:0.85}`))]}get open(){return this.__visible&&this.__connected}set open(e){e===this.open||(e?this.show():this.hide(this.editable))}connectedCallback(){super.connectedCallback(),addEventListener("keydown",this.__handleKeyDown)}disconnectedCallback(){var e;super.disconnectedCallback(),removeEventListener("keydown",this.__handleKeyDown),null===(e=D.dialogWindows.get(this))||void 0===e||e.remove(),D.dialogWindows.delete(this)}createRenderRoot(){const e=new v,t=document.querySelectorAll(D.dialogWindowsHost),s=Array.from(t).pop();return e.addEventListener("fetch",(e=>{e instanceof r&&(e.stopImmediatePropagation(),e.preventDefault(),e.respondWith(new a(this).fetch(e.request)))})),null==s||s.appendChild(e),D.dialogWindows.set(this,e),e.shadowRoot}render(e){if(!this.__connected)return i(_||(_=$``));const t=D.openDialogs[0]===this,s=D.openDialogs[1]===this,a=D.openDialogs[2]===this,o=!t&&!s&&!a;return i(y||(y=$` <div class="${0}"> <div id="backdrop" class="${0}" tabindex="-1" @click="${0}"></div> <div role="dialog" aria-labelledby="dialog-title" class="${0}"> <div class="${0}"> <div class="h-l grid grid-cols-header text-m font-lumo font-medium border-b border-contrast-10"> ${0} <h1 id="dialog-title" class="truncate self-center text-center"> <foxy-i18n ns="${0}" lang="${0}" key="${0}"></foxy-i18n> </h1> ${0} </div> <div class="flex-1 overflow-y-auto overflow-x-hidden overscroll-contain"> <div class="p-m relative">${0}</div> </div> </div> </div> </div> `),c({"z-50 fixed inset-0":!0,"pointer-events-none":!this.__visible}),c({"select-none ease-in-out transition duration-500 absolute inset-0 bg-shade-50 focus-outline-none":!0,"opacity-100":this.__visible,"opacity-0":!this.__visible}),(()=>this.closable&&this.hide(this.editable)),c({"transform origin-bottom ease-in-out transition duration-500 relative h-full ml-auto sm-origin-center sm-max-w-modal":!0,"flex justify-center items-end sm-items-center mr-auto":this.alert,"translate-y-full sm-translate-y-0":!this.__visible,"sm-translate-x-full":!this.alert&&!this.__visible,"sm-opacity-0 sm-scale-110":this.alert&&!this.__visible,"translate-y-0 translate-x-0":t&&this.__visible,"scale-95 -translate-y-s sm-translate-y-0":s&&this.__visible,"scale-90 -translate-y-m sm-translate-y-0":a&&this.__visible,"opacity-0 scale-85 -translate-y-l sm-translate-y-0":o&&this.__visible}),c({"overflow-hidden flex flex-col bg-base rounded-t-l sm-rounded-b-l":!0,"absolute inset-0 mt-xl sm-m-xl":!this.alert,"shadow-xxl":this.__visible}),this.closable&&!this.hiddenSelector.matches("close-button",!0)?i(g||(g=$` <vaadin-button id="close-button" theme="tertiary-inline" class="mr-auto m-s px-s" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> </vaadin-button> `),this.disabledSelector.matches("close-button",!0),(()=>this.hide(this.editable)),this.lang,this.editable?"cancel":"close",this.ns):i(f||(f=$`<div></div>`)),this.ns,this.lang,this.header,this.editable&&!this.hiddenSelector.matches("save-button",!0)?i(w||(w=$` <vaadin-button data-testid="save-button" ?disabled="${0}" theme="primary" class="ml-auto h-auto min-h-0 min-w-0 m-xs px-m" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="save"></foxy-i18n> </vaadin-button> `),this.disabledSelector.matches("save-button",!0),this.save,this.ns,this.lang):i(x||(x=$`<div></div>`)),null==e?void 0:e())}async hide(e=!1){var t;null===(t=this.__returnFocusTo)||void 0===t||t.focus(),await this.__setOpenDialogs(D.openDialogs.filter((e=>e!==this))),await this.__setConnected(!1),this.dispatchEvent(new D.HideEvent(!!e))}async show(e){this.__returnFocusTo=e,await this.__setConnected(!0),await this.__setOpenDialogs([this,...D.openDialogs]);const t=this.renderRoot.querySelector("#close-button");null==t||t.focus(),this.dispatchEvent(new D.ShowEvent)}async save(){await this.hide(!1)}async __setOpenDialogs(e){D.openDialogs.length=0,D.openDialogs.push(...e),await Promise.all([Promise.all(D.openDialogs.map((e=>e.requestUpdate()))),new Promise((e=>{this.renderRoot.querySelector("#backdrop").addEventListener("transitionend",e,{once:!0}),this.__visible=D.openDialogs.includes(this)}))])}async __setConnected(e){this.__connected=e,await this.updateComplete.then((()=>this.getBoundingClientRect()))}}D.dialogWindowsHost="#foxy-dialog-windows-host, body",D.dialogWindows=new WeakMap,D.openDialogs=[],D.ShowEvent=u,D.HideEvent=h,customElements.define("foxy-dialog-window",v);export{D};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{F as e,A as t}from"./shared-c1dadefe.js";class s extends t{constructor(t){super({base:new URL(document.baseURI),fetch:(...c)=>new Promise(((n,a)=>{const o="string"==typeof c[0]?new s.WHATWGRequest(...c):c[0];o.headers.set("Content-Type","application/json"),o.headers.set("FOXY-API-VERSION","1");const r=new e("fetch",{cancelable:!0,composed:!0,bubbles:!0,request:o,resolve:n,reject:a});t.dispatchEvent(r),r.defaultPrevented||fetch(o).then(n).catch(a)}))})}}s.FetchEvent=e;export{s as A};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as r}from"./shared-63eaded9.js";import{p as s}from"./shared-87ca7818.js";function a(a){var t;const e=s(a),n=null!==(t={y:"yearly",m:"monthly",w:"weekly",d:"daily"}[e.units])&&void 0!==t?t:e.units;return r(r({},e),{},{units:n})}export{a as p};
|