@foxy.io/elements 1.16.0-beta.8 → 1.17.0
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 +2 -2
- package/dist/cdn/foxy-address-form.js +1 -1
- package/dist/cdn/foxy-api-browser.js +3 -3
- 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-copy-to-clipboard.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-detail-card.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 -1
- 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-builder.js +1 -1
- package/dist/cdn/foxy-discount-card.js +1 -1
- package/dist/cdn/foxy-discount-detail-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 -1
- package/dist/cdn/foxy-gift-card-code-form.js +1 -1
- package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-form.js +1 -1
- package/dist/cdn/foxy-i18n.js +1 -1
- package/dist/cdn/foxy-item-card.js +1 -1
- package/dist/cdn/foxy-item-form.js +1 -1
- package/dist/cdn/foxy-item-option-card.js +1 -1
- package/dist/cdn/foxy-item-option-form.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-report-form.js +9 -9
- package/dist/cdn/foxy-reports-table.js +3 -3
- package/dist/cdn/foxy-shipment-card.js +3 -7
- 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 +4 -4
- 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-transaction.js +1 -64
- 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/foxy-webhook-card.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +7 -156
- package/dist/cdn/foxy-webhook-log-card.js +1 -1
- package/dist/cdn/foxy-webhook-status-card.js +1 -1
- package/dist/cdn/{shared-3b318016.js → shared-195fd5af.js} +1 -1
- package/dist/cdn/{shared-f0ba30e8.js → shared-1bbd9b73.js} +1 -1
- package/dist/cdn/{shared-4764b995.js → shared-2188d5f7.js} +4 -4
- package/dist/cdn/{shared-40315eea.js → shared-26ce8d23.js} +1 -1
- package/dist/cdn/{shared-15d04c73.js → shared-2bdd4f74.js} +1 -1
- package/dist/cdn/{shared-f2a561f7.js → shared-31c43743.js} +1 -1
- package/dist/cdn/{shared-e9967127.js → shared-322e7efb.js} +5 -5
- package/dist/cdn/{shared-95b0cdf1.js → shared-39f2c345.js} +1 -1
- package/dist/cdn/{shared-eb1d4a32.js → shared-3b2dedf9.js} +1 -1
- package/dist/cdn/shared-45feee83.js +1 -0
- package/dist/cdn/{shared-addf6302.js → shared-4e201e09.js} +1 -1
- package/dist/cdn/{shared-5cb2c769.js → shared-5c3a88d2.js} +1 -1
- package/dist/cdn/{shared-855a1983.js → shared-62169210.js} +2 -2
- package/dist/cdn/{shared-3e14ffe1.js → shared-63685d2e.js} +2 -2
- package/dist/cdn/{shared-78adab3d.js → shared-6d104622.js} +1 -1
- package/dist/cdn/{shared-e6be392d.js → shared-7474af47.js} +1 -1
- package/dist/cdn/shared-7c612495.js +1 -0
- package/dist/cdn/shared-7c8bb60c.js +1 -0
- package/dist/cdn/shared-8d4fef94.js +1 -0
- package/dist/cdn/{shared-c0deb4cf.js → shared-8d937ae4.js} +3 -3
- package/dist/cdn/{shared-c6ed5394.js → shared-8e9a3bbb.js} +1 -1
- package/dist/cdn/shared-92327224.js +15 -0
- package/dist/cdn/shared-98497473.js +1 -0
- package/dist/cdn/{shared-107acd1f.js → shared-a052131e.js} +2 -2
- package/dist/cdn/{shared-e0a54dfc.js → shared-a0836fa5.js} +1 -1
- package/dist/cdn/{shared-d08fcc29.js → shared-a5e52b8f.js} +3 -3
- package/dist/cdn/shared-ac44429d.js +1 -0
- package/dist/cdn/{shared-abfe9262.js → shared-ae415a98.js} +2 -2
- package/dist/cdn/shared-b3df4f38.js +1 -0
- package/dist/cdn/{shared-85d4b53e.js → shared-baf79b0b.js} +1 -1
- package/dist/cdn/{shared-cea659c8.js → shared-bb686fc6.js} +1 -1
- package/dist/cdn/{shared-3474279e.js → shared-bf6fb415.js} +1 -1
- package/dist/cdn/shared-c309e0ef.js +1 -0
- package/dist/cdn/{shared-73cfd096.js → shared-c5c60417.js} +1 -1
- package/dist/cdn/{shared-e21c712d.js → shared-c8677ba3.js} +1 -1
- package/dist/cdn/{shared-c9757355.js → shared-c89ba319.js} +1 -1
- package/dist/cdn/{shared-8c41299f.js → shared-d28ac9dc.js} +1 -1
- package/dist/cdn/{shared-9e0387e6.js → shared-d699348f.js} +2 -2
- package/dist/cdn/shared-dc1c6edd.js +1 -0
- package/dist/cdn/{shared-78a2c66f.js → shared-dc23b751.js} +1 -1
- package/dist/cdn/shared-dc3ffd38.js +1 -0
- package/dist/cdn/{shared-5e228fca.js → shared-dd6d3c18.js} +1 -1
- package/dist/cdn/{shared-21f6c806.js → shared-dda2a74d.js} +1 -1
- package/dist/cdn/{shared-40c5712e.js → shared-e9a4a204.js} +1 -1
- package/dist/cdn/{shared-a2f5defb.js → shared-f1317609.js} +1 -1
- package/dist/cdn/{shared-af60799b.js → shared-f84686a8.js} +4 -4
- package/dist/cdn/{shared-2eee69db.js → shared-fadcb2e1.js} +0 -0
- package/dist/cdn/translations/api-browser/en.json +3 -0
- package/dist/cdn/translations/customer-portal/se.json +223 -0
- package/dist/cdn/translations/discount-builder/en.json +14 -0
- package/dist/cdn/translations/item-form/en.json +24 -0
- package/dist/cdn/translations/transaction/en.json +28 -4
- package/dist/elements/internal/InternalAsyncComboBoxControl/InternalAsyncComboBoxControl.d.ts +1 -1
- package/dist/elements/internal/InternalAsyncComboBoxControl/InternalAsyncComboBoxControl.js +1 -1
- package/dist/elements/internal/InternalAsyncComboBoxControl/InternalAsyncComboBoxControl.js.map +1 -1
- package/dist/elements/internal/InternalAsyncDetailsControl/InternalAsyncDetailsControl.d.ts +2 -1
- package/dist/elements/internal/InternalAsyncDetailsControl/InternalAsyncDetailsControl.js +11 -2
- package/dist/elements/internal/InternalAsyncDetailsControl/InternalAsyncDetailsControl.js.map +1 -1
- package/dist/elements/internal/InternalAsyncDetailsControl/index.d.ts +1 -0
- package/dist/elements/internal/InternalAsyncDetailsControl/index.js +1 -0
- package/dist/elements/internal/InternalAsyncDetailsControl/index.js.map +1 -1
- package/dist/elements/internal/InternalCard/InternalCard.d.ts +1 -1
- package/dist/elements/internal/InternalCard/InternalCard.js +1 -1
- package/dist/elements/internal/InternalCard/InternalCard.js.map +1 -1
- package/dist/elements/internal/InternalControl/InternalControl.d.ts +22 -2
- package/dist/elements/internal/InternalControl/InternalControl.js +29 -8
- package/dist/elements/internal/InternalControl/InternalControl.js.map +1 -1
- package/dist/elements/internal/InternalControl/index.d.ts +2 -0
- package/dist/elements/internal/InternalControl/index.js +2 -0
- package/dist/elements/internal/InternalControl/index.js.map +1 -1
- package/dist/elements/internal/InternalCreateControl/InternalCreateControl.d.ts +1 -1
- package/dist/elements/internal/InternalCreateControl/InternalCreateControl.js +1 -1
- package/dist/elements/internal/InternalCreateControl/InternalCreateControl.js.map +1 -1
- package/dist/elements/internal/InternalCreateControl/index.d.ts +2 -1
- package/dist/elements/internal/InternalCreateControl/index.js +2 -1
- package/dist/elements/internal/InternalCreateControl/index.js.map +1 -1
- package/dist/elements/internal/InternalDateControl/InternalDateControl.d.ts +1 -1
- package/dist/elements/internal/InternalDateControl/InternalDateControl.js +1 -1
- package/dist/elements/internal/InternalDateControl/InternalDateControl.js.map +1 -1
- package/dist/elements/internal/InternalDeleteControl/InternalDeleteControl.d.ts +8 -1
- package/dist/elements/internal/InternalDeleteControl/InternalDeleteControl.js +10 -5
- package/dist/elements/internal/InternalDeleteControl/InternalDeleteControl.js.map +1 -1
- package/dist/elements/internal/InternalDeleteControl/index.d.ts +3 -2
- package/dist/elements/internal/InternalDeleteControl/index.js +3 -2
- package/dist/elements/internal/InternalDeleteControl/index.js.map +1 -1
- package/dist/elements/internal/InternalDetails/InternalDetails.d.ts +1 -1
- package/dist/elements/internal/InternalDetails/InternalDetails.js +1 -1
- package/dist/elements/internal/InternalDetails/InternalDetails.js.map +1 -1
- package/dist/elements/internal/InternalEditableControl/InternalEditableControl.d.ts +52 -0
- package/dist/elements/internal/InternalEditableControl/InternalEditableControl.js +82 -7
- package/dist/elements/internal/InternalEditableControl/InternalEditableControl.js.map +1 -1
- package/dist/elements/internal/InternalForm/InternalForm.d.ts +16 -0
- package/dist/elements/internal/InternalForm/InternalForm.js +17 -0
- package/dist/elements/internal/InternalForm/InternalForm.js.map +1 -1
- package/dist/elements/internal/InternalForm/index.d.ts +2 -2
- package/dist/elements/internal/InternalForm/index.js +2 -2
- package/dist/elements/internal/InternalForm/index.js.map +1 -1
- package/dist/elements/internal/InternalFrequencyControl/InternalFrequencyControl.d.ts +1 -1
- package/dist/elements/internal/InternalFrequencyControl/InternalFrequencyControl.js +1 -1
- package/dist/elements/internal/InternalFrequencyControl/InternalFrequencyControl.js.map +1 -1
- package/dist/elements/internal/InternalIntegerControl/InternalIntegerControl.d.ts +1 -1
- package/dist/elements/internal/InternalIntegerControl/InternalIntegerControl.js +1 -1
- package/dist/elements/internal/InternalIntegerControl/InternalIntegerControl.js.map +1 -1
- package/dist/elements/internal/InternalNumberControl/InternalNumberControl.d.ts +1 -1
- package/dist/elements/internal/InternalNumberControl/InternalNumberControl.js +1 -1
- package/dist/elements/internal/InternalNumberControl/InternalNumberControl.js.map +1 -1
- package/dist/elements/internal/InternalRadioGroupControl/InternalRadioGroupControl.d.ts +1 -1
- package/dist/elements/internal/InternalRadioGroupControl/InternalRadioGroupControl.js +1 -1
- package/dist/elements/internal/InternalRadioGroupControl/InternalRadioGroupControl.js.map +1 -1
- package/dist/elements/internal/InternalTextControl/InternalTextControl.d.ts +1 -1
- package/dist/elements/internal/InternalTextControl/InternalTextControl.js +1 -1
- package/dist/elements/internal/InternalTextControl/InternalTextControl.js.map +1 -1
- package/dist/elements/internal/InternalTimestampsControl/InternalTimestampsControl.d.ts +14 -0
- package/dist/elements/internal/{InternalForm/internal/InternalTimestampsControl → InternalTimestampsControl}/InternalTimestampsControl.js +12 -11
- package/dist/elements/internal/InternalTimestampsControl/InternalTimestampsControl.js.map +1 -0
- package/dist/elements/internal/{InternalForm/internal/InternalTimestampsControl → InternalTimestampsControl}/index.d.ts +2 -0
- package/dist/elements/internal/{InternalForm/internal/InternalTimestampsControl → InternalTimestampsControl}/index.js +2 -0
- package/dist/elements/internal/InternalTimestampsControl/index.js.map +1 -0
- package/dist/elements/public/ApiBrowser/ApiBrowser.d.ts +1 -1
- package/dist/elements/public/ApiBrowser/ApiBrowser.js +12 -6
- package/dist/elements/public/ApiBrowser/ApiBrowser.js.map +1 -1
- package/dist/elements/public/ApiBrowser/index.d.ts +1 -0
- package/dist/elements/public/ApiBrowser/index.js +1 -0
- package/dist/elements/public/ApiBrowser/index.js.map +1 -1
- package/dist/elements/public/ApiBrowser/internal/InternalApiBrowserResourceForm/InternalApiBrowserResourceForm.d.ts +7 -0
- package/dist/elements/public/ApiBrowser/internal/InternalApiBrowserResourceForm/InternalApiBrowserResourceForm.js +15 -3
- package/dist/elements/public/ApiBrowser/internal/InternalApiBrowserResourceForm/InternalApiBrowserResourceForm.js.map +1 -1
- package/dist/elements/public/ApiBrowser/internal/InternalApiBrowserResourceForm/index.d.ts +1 -0
- package/dist/elements/public/ApiBrowser/internal/InternalApiBrowserResourceForm/index.js +1 -0
- package/dist/elements/public/ApiBrowser/internal/InternalApiBrowserResourceForm/index.js.map +1 -1
- package/dist/elements/public/CopyToClipboard/CopyToClipboard.d.ts +9 -1
- package/dist/elements/public/CopyToClipboard/CopyToClipboard.js +11 -2
- package/dist/elements/public/CopyToClipboard/CopyToClipboard.js.map +1 -1
- package/dist/elements/public/CopyToClipboard/index.d.ts +1 -0
- package/dist/elements/public/CopyToClipboard/index.js +1 -0
- package/dist/elements/public/CopyToClipboard/index.js.map +1 -1
- package/dist/elements/public/CouponForm/CouponForm.js +1 -0
- package/dist/elements/public/CouponForm/CouponForm.js.map +1 -1
- package/dist/elements/public/DiscountBuilder/DiscountBuilder.d.ts +21 -9
- package/dist/elements/public/DiscountBuilder/DiscountBuilder.js +33 -30
- package/dist/elements/public/DiscountBuilder/DiscountBuilder.js.map +1 -1
- package/dist/elements/public/DiscountBuilder/index.d.ts +1 -0
- package/dist/elements/public/DiscountBuilder/index.js +1 -0
- package/dist/elements/public/DiscountBuilder/index.js.map +1 -1
- package/dist/elements/public/DiscountBuilder/types.d.ts +32 -0
- package/dist/elements/public/DiscountBuilder/types.js +2 -0
- package/dist/elements/public/DiscountBuilder/types.js.map +1 -0
- package/dist/elements/public/I18n/format/discount.js +1 -0
- package/dist/elements/public/I18n/format/discount.js.map +1 -1
- package/dist/elements/public/ItemCard/ItemCard.d.ts +6 -0
- package/dist/elements/public/ItemCard/ItemCard.js +10 -1
- package/dist/elements/public/ItemCard/ItemCard.js.map +1 -1
- package/dist/elements/public/ItemForm/ItemForm.d.ts +45 -3
- package/dist/elements/public/ItemForm/ItemForm.js +50 -8
- package/dist/elements/public/ItemForm/ItemForm.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/InternalItemFormCartControl.js +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/InternalItemFormCartControl.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/index.d.ts +2 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/index.js +2 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/index.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/InternalItemFormInventoryControl.js +3 -3
- package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/InternalItemFormInventoryControl.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/index.d.ts +2 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/index.js +2 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/index.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/InternalItemFormLineItemDiscountControl.js +16 -6
- package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/InternalItemFormLineItemDiscountControl.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/InternalItemFormShippingControl.js +3 -3
- package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/InternalItemFormShippingControl.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/index.d.ts +2 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/index.js +2 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/index.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/InternalItemFormSubscriptionControl.js +3 -8
- package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/InternalItemFormSubscriptionControl.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/index.d.ts +2 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/index.js +2 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/index.js.map +1 -1
- package/dist/elements/public/ItemOptionForm/ItemOptionForm.d.ts +18 -0
- package/dist/elements/public/ItemOptionForm/ItemOptionForm.js +18 -0
- package/dist/elements/public/ItemOptionForm/ItemOptionForm.js.map +1 -1
- package/dist/elements/public/ShipmentCard/ShipmentCard.d.ts +6 -0
- package/dist/elements/public/ShipmentCard/ShipmentCard.js +7 -5
- package/dist/elements/public/ShipmentCard/ShipmentCard.js.map +1 -1
- package/dist/elements/public/ShipmentCard/index.d.ts +1 -0
- package/dist/elements/public/ShipmentCard/index.js +1 -0
- package/dist/elements/public/ShipmentCard/index.js.map +1 -1
- package/dist/elements/public/SwipeActions/SwipeActions.d.ts +16 -1
- package/dist/elements/public/SwipeActions/SwipeActions.js +15 -1
- package/dist/elements/public/SwipeActions/SwipeActions.js.map +1 -1
- package/dist/elements/public/Transaction/Transaction.d.ts +6 -0
- package/dist/elements/public/Transaction/Transaction.js +8 -2
- package/dist/elements/public/Transaction/Transaction.js.map +1 -1
- package/dist/elements/public/Transaction/index.d.ts +2 -4
- package/dist/elements/public/Transaction/index.js +2 -4
- package/dist/elements/public/Transaction/index.js.map +1 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.js +8 -12
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.js.map +1 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionCustomerControl/InternalTransactionCustomerControl.js +1 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionCustomerControl/InternalTransactionCustomerControl.js.map +1 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/InternalTransactionPostActionControl.d.ts +4 -5
- package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/InternalTransactionPostActionControl.js +27 -16
- package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/InternalTransactionPostActionControl.js.map +1 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/index.d.ts +1 -0
- package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/index.js +1 -0
- package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/index.js.map +1 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionSummaryControl/InternalTransactionSummaryControl.js +12 -23
- package/dist/elements/public/Transaction/internal/InternalTransactionSummaryControl/InternalTransactionSummaryControl.js.map +1 -1
- package/dist/elements/public/WebhookCard/WebhookCard.d.ts +6 -0
- package/dist/elements/public/WebhookCard/WebhookCard.js +8 -2
- package/dist/elements/public/WebhookCard/WebhookCard.js.map +1 -1
- package/dist/elements/public/WebhookForm/WebhookForm.d.ts +33 -0
- package/dist/elements/public/WebhookForm/WebhookForm.js +33 -0
- package/dist/elements/public/WebhookForm/WebhookForm.js.map +1 -1
- package/dist/elements/public/WebhookForm/index.d.ts +1 -3
- package/dist/elements/public/WebhookForm/index.js +1 -3
- package/dist/elements/public/WebhookForm/index.js.map +1 -1
- package/dist/elements/public/WebhookLogCard/WebhookLogCard.d.ts +6 -0
- package/dist/elements/public/WebhookLogCard/WebhookLogCard.js +11 -6
- package/dist/elements/public/WebhookLogCard/WebhookLogCard.js.map +1 -1
- package/dist/elements/public/WebhookStatusCard/WebhookStatusCard.d.ts +6 -0
- package/dist/elements/public/WebhookStatusCard/WebhookStatusCard.js +6 -0
- package/dist/elements/public/WebhookStatusCard/WebhookStatusCard.js.map +1 -1
- package/dist/mixins/configurable.js +1 -0
- package/dist/mixins/configurable.js.map +1 -1
- package/dist/mixins/inferrable.js +1 -0
- package/dist/mixins/inferrable.js.map +1 -1
- package/dist/mixins/translatable.js +4 -2
- package/dist/mixins/translatable.js.map +1 -1
- package/package.json +9 -7
- package/dist/cdn/shared-25ef9e09.js +0 -1
- package/dist/cdn/shared-39b61999.js +0 -1
- package/dist/cdn/shared-567c8c48.js +0 -1
- package/dist/cdn/shared-58a9174f.js +0 -1
- package/dist/cdn/shared-64657919.js +0 -1
- package/dist/cdn/shared-67651931.js +0 -1
- package/dist/cdn/shared-6a0012d6.js +0 -1
- package/dist/cdn/shared-6eb57269.js +0 -15
- package/dist/cdn/shared-7a084a40.js +0 -1
- package/dist/cdn/shared-85618a7a.js +0 -1
- package/dist/cdn/shared-968add7f.js +0 -1
- package/dist/cdn/shared-eb0e1f48.js +0 -1
- package/dist/elements/internal/InternalForm/internal/InternalTimestampsControl/InternalTimestampsControl.d.ts +0 -8
- package/dist/elements/internal/InternalForm/internal/InternalTimestampsControl/InternalTimestampsControl.js.map +0 -1
- package/dist/elements/internal/InternalForm/internal/InternalTimestampsControl/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebhookStatusCard.js","sourceRoot":"","sources":["../../../../src/elements/public/WebhookStatusCard/WebhookStatusCard.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD,MAAM,EAAE,GAAG,qBAAqB,CAAC;AACjC,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAEjD,MAAM,OAAO,iBAAkB,SAAQ,IAAU;IAC/C,UAAU;;QACR,MAAM,MAAM,SAAG,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC;QAEjC,OAAO,IAAI,CAAA;;;qBAGM,EAAE,KAAK,QAAE,IAAI,CAAC,IAAI,0CAAE,YAAY,EAAE;;;;;;;;kBAQrC,QAAQ,CAAC;YACf,YAAY,EAAE,MAAM,KAAK,QAAQ;YACjC,eAAe,EAAE,MAAM,KAAK,SAAS;YACrC,cAAc,EAAE,MAAM,KAAK,YAAY;SACxC,CAAC;;wBAEY,MAAM;;;;KAIzB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { TemplateResult } from 'lit-html';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InternalCard } from '../../internal/InternalCard/InternalCard';\nimport { html } from 'lit-html';\nimport { classMap } from '../../../utils/class-map';\n\nconst NS = 'webhook-status-card';\nconst Base = TranslatableMixin(InternalCard, NS);\n\nexport class WebhookStatusCard extends Base<Data> {\n renderBody(): TemplateResult {\n const status = this.data?.status;\n\n return html`\n <p class=\"flex justify-between items-center leading-none\">\n <foxy-i18n\n .options=${{ value: this.data?.date_created }}\n class=\"font-semibold\"\n infer=\"\"\n key=\"date\"\n >\n </foxy-i18n>\n\n <foxy-i18n\n class=${classMap({\n 'text-error': status === 'failed',\n 'text-tertiary': status === 'pending',\n 'text-success': status === 'successful',\n })}\n infer=\"\"\n key=\"status_${status}\"\n >\n </foxy-i18n>\n </p>\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"WebhookStatusCard.js","sourceRoot":"","sources":["../../../../src/elements/public/WebhookStatusCard/WebhookStatusCard.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD,MAAM,EAAE,GAAG,qBAAqB,CAAC;AACjC,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,OAAO,iBAAkB,SAAQ,IAAU;IAC/C,UAAU;;QACR,MAAM,MAAM,SAAG,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC;QAEjC,OAAO,IAAI,CAAA;;;qBAGM,EAAE,KAAK,QAAE,IAAI,CAAC,IAAI,0CAAE,YAAY,EAAE;;;;;;;;kBAQrC,QAAQ,CAAC;YACf,YAAY,EAAE,MAAM,KAAK,QAAQ;YACjC,eAAe,EAAE,MAAM,KAAK,SAAS;YACrC,cAAc,EAAE,MAAM,KAAK,YAAY;SACxC,CAAC;;wBAEY,MAAM;;;;KAIzB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { TemplateResult } from 'lit-html';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InternalCard } from '../../internal/InternalCard/InternalCard';\nimport { html } from 'lit-html';\nimport { classMap } from '../../../utils/class-map';\n\nconst NS = 'webhook-status-card';\nconst Base = TranslatableMixin(InternalCard, NS);\n\n/**\n * Basic card displaying webhook status (`fx:webhook_status`) info.\n *\n * @element foxy-webhook-status-card\n * @since 1.17.0\n */\nexport class WebhookStatusCard extends Base<Data> {\n renderBody(): TemplateResult {\n const status = this.data?.status;\n\n return html`\n <p class=\"flex justify-between items-center leading-none\">\n <foxy-i18n\n .options=${{ value: this.data?.date_created }}\n class=\"font-semibold\"\n infer=\"\"\n key=\"date\"\n >\n </foxy-i18n>\n\n <foxy-i18n\n class=${classMap({\n 'text-error': status === 'failed',\n 'text-tertiary': status === 'pending',\n 'text-success': status === 'successful',\n })}\n infer=\"\"\n key=\"status_${status}\"\n >\n </foxy-i18n>\n </p>\n `;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configurable.js","sourceRoot":"","sources":["../../src/mixins/configurable.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,OAAO,EAAiE,IAAI,EAAE,MAAM,aAAa,CAAC;AAElG,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAgI3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,WAAkB,EAC0B,EAAE;IAC9C,OAAO,MAAM,mBAAoB,SAAQ,WAAW;QAA7C;;YA0CL,cAAS,GAAG,EAA4C,CAAC;YAEzD,SAAI,GAAiC,YAAY,CAAC;YAElD,aAAQ,GAAG,KAAK,CAAC;YAEjB,qBAAgB,GAAoB,eAAe,CAAC,KAAK,CAAC;YAE1D,aAAQ,GAAG,KAAK,CAAC;YAEjB,qBAAgB,GAAoB,eAAe,CAAC,KAAK,CAAC;YAE1D,WAAM,GAAG,KAAK,CAAC;YAEf,mBAAc,GAAoB,eAAe,CAAC,KAAK,CAAC;YAEvC,eAAU,GAAG,IAAI,gBAAgB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;QA6JhF,CAAC;QAtNC,MAAM,KAAK,kBAAkB;YAC3B,OAAO;gBACL,GAAG,KAAK,CAAC,kBAAkB;gBAC3B,kBAAkB;gBAClB,kBAAkB;gBAClB,gBAAgB;gBAChB,WAAW;gBACX,UAAU;gBACV,UAAU;gBACV,QAAQ;gBACR,MAAM;aACP,CAAC;QACJ,CAAC;QAED,MAAM,KAAK,UAAU;YACn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C,YAAY,EAAE,CAAC;QACtB,CAAC;QAEO,YAAY;YAClB,MAAM,MAAM,GAAyB;gBACnC,aAAa,EAAE,IAAI;gBACnB,UAAU,EAAE,IAAI;gBAChB,SAAS,EAAE,IAAI;gBACf,OAAO,EAAE,IAAI;aACd,CAAC;YAEF,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;YAC7B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAEtC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBACxC,IAAI,KAAK,CAAC,SAAS,KAAK,UAAU,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC;oBAAE,OAAO;gBAC1E,IAAI,CAAC,UAAU,CAAC,OAAO,CAAE,KAA6B,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC1E,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n\nimport { Constructor, LitElement, PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { InferrableMixinHost } from './inferrable';\n\nexport declare class ConfigurableMixinHost {\n /** Template render functions mapped to their name. */\n templates: Partial<Record<string, Renderer<any>>>;\n\n /**\n * Toggles additional functionality for developers on and off. In particular,\n * setting this property (or attribute with the same name) to \"development\" will\n * start tracking changes in templates, allowing developers to edit HTML in the browser\n * and see results without having to refresh the page every time.\n */\n mode: 'development' | 'production';\n\n /**\n * If true, makes every editable control inside of this element read-only.\n * This property is reflected to the `readonly` boolean attribute.\n *\n * @since 1.4.0\n */\n readonly: boolean;\n\n /**\n * [BooleanSelector](https://sdk.foxy.dev/classes/_core_index_.booleanselector.html) selecting\n * controls to render as read-only. Parsed version of the `readonlycontrols` attribute value.\n *\n * @type {BooleanSelector}\n * @since 1.4.0\n * @default BooleanSelector.False\n */\n readonlyControls: BooleanSelector;\n\n /**\n * If true, disables every interactive control inside of this element.\n * This property is reflected to the `disabled` boolean attribute.\n *\n * @since 1.4.0\n */\n disabled: boolean;\n\n /**\n * [BooleanSelector](https://sdk.foxy.dev/classes/_core_index_.booleanselector.html) selecting\n * controls to render as disabled. Parsed version of the `disabledcontrols` attribute value.\n *\n * @type {BooleanSelector}\n * @since 1.4.0\n * @default BooleanSelector.False\n */\n disabledControls: BooleanSelector;\n\n /**\n * If true, hides every configurable control inside of this element.\n * This property is reflected to the `hidden` boolean attribute.\n *\n * @since 1.4.0\n */\n hidden: boolean;\n\n /**\n * [BooleanSelector](https://sdk.foxy.dev/classes/_core_index_.booleanselector.html) selecting\n * controls to hide. Parsed version of the `hiddencontrols` attribute value.\n *\n * @type {BooleanSelector}\n * @since 1.4.0\n * @default BooleanSelector.False\n */\n hiddenControls: BooleanSelector;\n\n /**\n * Combined [BooleanSelector](https://sdk.foxy.dev/classes/_core_index_.booleanselector.html) for `readonlyControls`\n * and `readonly` properties. If `readonly` is true, this selector will match any control,\n * otherwise it will match the same controls as in `readonlyControls`.\n *\n * @since 1.4.0\n */\n get readonlySelector(): BooleanSelector;\n\n /**\n * Combined [BooleanSelector](https://sdk.foxy.dev/classes/_core_index_.booleanselector.html) for `disabledControls`\n * and `disabled` properties. If `disabled` is true, this selector will match any control,\n * otherwise it will match the same controls as in `disabledControls`.\n *\n * @since 1.4.0\n */\n get disabledSelector(): BooleanSelector;\n\n /**\n * Combined [BooleanSelector](https://sdk.foxy.dev/classes/_core_index_.booleanselector.html) for `hiddenControls`\n * and `hidden` properties. If `hidden` is true, this selector will match any control,\n * otherwise it will match the same controls as in `hiddenControls`.\n *\n * @since 1.4.0\n */\n get hiddenSelector(): BooleanSelector;\n\n /**\n * Looks for templates in element's children and compiles them to render functions.\n *\n * @param replace If true, all existing templates will be removed.\n */\n compileTemplates(replace?: boolean): void;\n\n /**\n * Renders a template with the given name if available and a slot otherwise.\n * For empty name looks for a \"default\" template first and renders it if found – otherwise renders a default slot.\n *\n * @param name Name of the template/slot to render.\n * @param context Context to provide template renderer with.\n */\n renderTemplateOrSlot(name?: string, context?: any): void;\n\n /**\n * Zooms into templates with complex names. For example, zooming on `customer` in `customer:header:before`\n * will return `header:before`.\n *\n * @param id Name to zoom on.\n */\n getNestedTemplates<T extends Partial<Record<string, Renderer<any>>>>(id: string): T;\n}\n\ntype Base = Constructor<InferrableMixinHost> &\n Constructor<LitElement> & { properties?: PropertyDeclarations; inferredProperties: string[] };\n\ntype TemplateFunction = typeof html;\n\nexport type Renderer<THost> = (html: TemplateFunction, host: THost) => TemplateResult;\n\nexport const ConfigurableMixin = <TBase extends Base>(\n BaseElement: TBase\n): TBase & Constructor<ConfigurableMixinHost> => {\n return class ConfigurableElement extends BaseElement {\n static get inferredProperties(): string[] {\n return [\n ...super.inferredProperties,\n 'disabledSelector',\n 'readonlySelector',\n 'hiddenSelector',\n 'templates',\n 'disabled',\n 'readonly',\n 'hidden',\n 'mode',\n ];\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n\n templates: { attribute: false },\n mode: { type: String },\n\n readonly: { type: Boolean, reflect: true },\n readonlyControls: {\n attribute: 'readonlycontrols',\n converter: { fromAttribute: value => new BooleanSelector(value ?? '') },\n },\n\n disabled: { type: Boolean, reflect: true },\n disabledControls: {\n attribute: 'disabledcontrols',\n converter: { fromAttribute: value => new BooleanSelector(value ?? '') },\n },\n\n hidden: { type: Boolean, reflect: true },\n hiddenControls: {\n attribute: 'hiddencontrols',\n converter: { fromAttribute: value => new BooleanSelector(value ?? '') },\n },\n };\n }\n\n templates = {} as Partial<Record<string, Renderer<any>>>;\n\n mode: 'development' | 'production' = 'production';\n\n readonly = false;\n\n readonlyControls: BooleanSelector = BooleanSelector.False;\n\n disabled = false;\n\n disabledControls: BooleanSelector = BooleanSelector.False;\n\n hidden = false;\n\n hiddenControls: BooleanSelector = BooleanSelector.False;\n\n private readonly __observer = new MutationObserver(() => this.__onMutation());\n\n get readonlySelector(): BooleanSelector {\n return this.readonly ? BooleanSelector.True : this.readonlyControls;\n }\n\n get disabledSelector(): BooleanSelector {\n return this.disabled ? BooleanSelector.True : this.disabledControls;\n }\n\n get hiddenSelector(): BooleanSelector {\n return this.hidden ? BooleanSelector.True : this.hiddenControls;\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n if (this.mode === 'development') this.__observe();\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.__observer.disconnect();\n }\n\n protected firstUpdated(...args: Parameters<LitElement['firstUpdated']>): void {\n super.firstUpdated(...args);\n if (this.mode === 'production') this.compileTemplates();\n }\n\n protected updated(changes: Map<keyof this, unknown>): void {\n super.updated(changes);\n\n if (changes.has('mode')) {\n this.__observer.disconnect();\n if (this.mode === 'development') this.__observe();\n }\n }\n\n compileTemplates(replace = false): void {\n const templates = replace ? {} : { ...this.templates };\n\n Array.from(this.children).forEach(child => {\n if (child.localName !== 'template') return;\n const slot = child.getAttribute('slot') ?? 'default';\n\n try {\n const script = `return html\\`${child.innerHTML}\\``;\n templates[slot] = new Function('html', 'host', script) as () => TemplateResult;\n } catch (err) {\n console.error(err);\n }\n });\n\n this.templates = templates;\n }\n\n renderTemplateOrSlot(name?: string, context?: any) {\n const templateName = name ?? 'default';\n const template = this.templates[templateName];\n\n if (!template) return html`<slot name=${ifDefined(name)}></slot>`;\n\n const renderer = () => {\n try {\n const target = {} as unknown as this;\n const resolvedContext = context ?? this;\n const proxy = new Proxy(target, { get: (_, key) => resolvedContext[key] });\n\n return template?.(html, proxy);\n } catch (err) {\n console.error(err);\n }\n };\n\n return html`\n <foxy-internal-sandbox data-testid=${templateName} .render=${renderer}>\n </foxy-internal-sandbox>\n `;\n }\n\n getNestedTemplates<T extends Partial<Record<string, Renderer<any>>>>(id: string): T {\n const nestedTemplates = {} as T;\n\n Object.entries(this.templates).forEach(([key, value]) => {\n if (key.startsWith(`${id}:`)) {\n const zoomedKey = key.replace(`${id}:`, '');\n nestedTemplates[zoomedKey as keyof T] = value as T[keyof T];\n }\n });\n\n return nestedTemplates;\n }\n\n applyInferredProperties(context: Map<string, unknown>): void {\n super.applyInferredProperties(context);\n\n type Templates = ConfigurableMixinHost['templates'];\n type Mode = ConfigurableMixinHost['mode'];\n\n if (this.infer === null) return;\n\n const disabledSelector = context.get('disabledSelector') as BooleanSelector | undefined;\n const disabled = context.get('disabled') as boolean | undefined;\n\n const readonlySelector = context.get('readonlySelector') as BooleanSelector | undefined;\n const readonly = context.get('readonly') as boolean | undefined;\n\n const hiddenSelector = context.get('hiddenSelector') as BooleanSelector | undefined;\n const hidden = context.get('hidden') as boolean | undefined;\n\n const templates = context.get('templates') as Templates | undefined;\n const mode = context.get('mode') as Mode | undefined;\n\n this.disabledControls = disabledSelector?.zoom(this.infer) ?? BooleanSelector.False;\n this.disabled = disabledSelector?.matches(this.infer, true) ?? disabled ?? false;\n\n this.readonlyControls = readonlySelector?.zoom(this.infer) ?? BooleanSelector.False;\n this.readonly = readonlySelector?.matches(this.infer, true) ?? readonly ?? false;\n\n this.hiddenControls = hiddenSelector?.zoom(this.infer) ?? BooleanSelector.False;\n this.hidden = hiddenSelector?.matches(this.infer, true) ?? hidden ?? false;\n\n this.templates = templates ?? {};\n this.templates = this.getNestedTemplates(this.infer);\n\n this.mode = mode ?? 'production';\n }\n\n private __observe() {\n this.__observer.observe(this, {\n characterData: true,\n attributes: true,\n childList: true,\n subtree: true,\n });\n\n this.__onMutation();\n }\n\n private __onMutation() {\n const config: MutationObserverInit = {\n characterData: true,\n attributes: true,\n childList: true,\n subtree: true,\n };\n\n this.__observer.disconnect();\n this.__observer.observe(this, config);\n\n Array.from(this.children).forEach(child => {\n if (child.localName !== 'template' || !child.hasAttribute('slot')) return;\n this.__observer.observe((child as HTMLTemplateElement).content, config);\n });\n\n this.compileTemplates(true);\n }\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"configurable.js","sourceRoot":"","sources":["../../src/mixins/configurable.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,OAAO,EAAiE,IAAI,EAAE,MAAM,aAAa,CAAC;AAElG,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAgI3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,WAAkB,EAC0B,EAAE;IAC9C,OAAO,MAAM,mBAAoB,SAAQ,WAAW;QAA7C;;YA0CL,cAAS,GAAG,EAA4C,CAAC;YAEzD,SAAI,GAAiC,YAAY,CAAC;YAElD,aAAQ,GAAG,KAAK,CAAC;YAEjB,qBAAgB,GAAoB,eAAe,CAAC,KAAK,CAAC;YAE1D,aAAQ,GAAG,KAAK,CAAC;YAEjB,qBAAgB,GAAoB,eAAe,CAAC,KAAK,CAAC;YAE1D,WAAM,GAAG,KAAK,CAAC;YAEf,mBAAc,GAAoB,eAAe,CAAC,KAAK,CAAC;YAEvC,eAAU,GAAG,IAAI,gBAAgB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;QA+JhF,CAAC;QAxNC,MAAM,KAAK,kBAAkB;YAC3B,OAAO;gBACL,GAAG,KAAK,CAAC,kBAAkB;gBAC3B,kBAAkB;gBAClB,kBAAkB;gBAClB,gBAAgB;gBAChB,WAAW;gBACX,UAAU;gBACV,UAAU;gBACV,QAAQ;gBACR,MAAM;aACP,CAAC;QACJ,CAAC;QAED,MAAM,KAAK,UAAU;YACnB,OAAO;gBACL,GAAG,KAAK,CAAC,UAAU;gBAEnB,SAAS,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;gBAC/B,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;gBAEtB,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EA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ACnC,aAAa,EAAE,IAAI;gBACnB,UAAU,EAAE,IAAI;gBAChB,SAAS,EAAE,IAAI;gBACf,OAAO,EAAE,IAAI;aACd,CAAC;YAEF,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;YAC7B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAEtC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBACxC,IAAI,KAAK,CAAC,SAAS,KAAK,UAAU,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC;oBAAE,OAAO;gBAC1E,IAAI,CAAC,UAAU,CAAC,OAAO,CAAE,KAA6B,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC1E,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n\nimport { Constructor, LitElement, PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { InferrableMixinHost } from './inferrable';\n\nexport declare class ConfigurableMixinHost {\n /** Template render functions mapped to their name. */\n templates: Partial<Record<string, Renderer<any>>>;\n\n /**\n * Toggles additional functionality for developers on and off. In particular,\n * setting this property (or attribute with the same name) to \"development\" will\n * start tracking changes in templates, allowing developers to edit HTML in the browser\n * and see results without having to refresh the page every time.\n */\n mode: 'development' | 'production';\n\n /**\n * If true, makes every editable control inside of this element read-only.\n * This property is reflected to the `readonly` boolean attribute.\n *\n * @since 1.4.0\n */\n readonly: boolean;\n\n /**\n * [BooleanSelector](https://sdk.foxy.dev/classes/_core_index_.booleanselector.html) selecting\n * controls to render as read-only. Parsed version of the `readonlycontrols` attribute value.\n *\n * @type {BooleanSelector}\n * @since 1.4.0\n * @default BooleanSelector.False\n */\n readonlyControls: BooleanSelector;\n\n /**\n * If true, disables every interactive control inside of this element.\n * This property is reflected to the `disabled` boolean attribute.\n *\n * @since 1.4.0\n */\n disabled: boolean;\n\n /**\n * [BooleanSelector](https://sdk.foxy.dev/classes/_core_index_.booleanselector.html) selecting\n * controls to render as disabled. Parsed version of the `disabledcontrols` attribute value.\n *\n * @type {BooleanSelector}\n * @since 1.4.0\n * @default BooleanSelector.False\n */\n disabledControls: BooleanSelector;\n\n /**\n * If true, hides every configurable control inside of this element.\n * This property is reflected to the `hidden` boolean attribute.\n *\n * @since 1.4.0\n */\n hidden: boolean;\n\n /**\n * [BooleanSelector](https://sdk.foxy.dev/classes/_core_index_.booleanselector.html) selecting\n * controls to hide. Parsed version of the `hiddencontrols` attribute value.\n *\n * @type {BooleanSelector}\n * @since 1.4.0\n * @default BooleanSelector.False\n */\n hiddenControls: BooleanSelector;\n\n /**\n * Combined [BooleanSelector](https://sdk.foxy.dev/classes/_core_index_.booleanselector.html) for `readonlyControls`\n * and `readonly` properties. If `readonly` is true, this selector will match any control,\n * otherwise it will match the same controls as in `readonlyControls`.\n *\n * @since 1.4.0\n */\n get readonlySelector(): BooleanSelector;\n\n /**\n * Combined [BooleanSelector](https://sdk.foxy.dev/classes/_core_index_.booleanselector.html) for `disabledControls`\n * and `disabled` properties. If `disabled` is true, this selector will match any control,\n * otherwise it will match the same controls as in `disabledControls`.\n *\n * @since 1.4.0\n */\n get disabledSelector(): BooleanSelector;\n\n /**\n * Combined [BooleanSelector](https://sdk.foxy.dev/classes/_core_index_.booleanselector.html) for `hiddenControls`\n * and `hidden` properties. If `hidden` is true, this selector will match any control,\n * otherwise it will match the same controls as in `hiddenControls`.\n *\n * @since 1.4.0\n */\n get hiddenSelector(): BooleanSelector;\n\n /**\n * Looks for templates in element's children and compiles them to render functions.\n *\n * @param replace If true, all existing templates will be removed.\n */\n compileTemplates(replace?: boolean): void;\n\n /**\n * Renders a template with the given name if available and a slot otherwise.\n * For empty name looks for a \"default\" template first and renders it if found – otherwise renders a default slot.\n *\n * @param name Name of the template/slot to render.\n * @param context Context to provide template renderer with.\n */\n renderTemplateOrSlot(name?: string, context?: any): void;\n\n /**\n * Zooms into templates with complex names. For example, zooming on `customer` in `customer:header:before`\n * will return `header:before`.\n *\n * @param id Name to zoom on.\n */\n getNestedTemplates<T extends Partial<Record<string, Renderer<any>>>>(id: string): T;\n}\n\ntype Base = Constructor<InferrableMixinHost> &\n Constructor<LitElement> & { properties?: PropertyDeclarations; inferredProperties: string[] };\n\ntype TemplateFunction = typeof html;\n\nexport type Renderer<THost> = (html: TemplateFunction, host: THost) => TemplateResult;\n\nexport const ConfigurableMixin = <TBase extends Base>(\n BaseElement: TBase\n): TBase & Constructor<ConfigurableMixinHost> => {\n return class ConfigurableElement extends BaseElement {\n static get inferredProperties(): string[] {\n return [\n ...super.inferredProperties,\n 'disabledSelector',\n 'readonlySelector',\n 'hiddenSelector',\n 'templates',\n 'disabled',\n 'readonly',\n 'hidden',\n 'mode',\n ];\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n\n templates: { attribute: false },\n mode: { type: String },\n\n readonly: { type: Boolean, reflect: true },\n readonlyControls: {\n attribute: 'readonlycontrols',\n converter: { fromAttribute: value => new BooleanSelector(value ?? '') },\n },\n\n disabled: { type: Boolean, reflect: true },\n disabledControls: {\n attribute: 'disabledcontrols',\n converter: { fromAttribute: value => new BooleanSelector(value ?? '') },\n },\n\n hidden: { type: Boolean, reflect: true },\n hiddenControls: {\n attribute: 'hiddencontrols',\n converter: { fromAttribute: value => new BooleanSelector(value ?? '') },\n },\n };\n }\n\n templates = {} as Partial<Record<string, Renderer<any>>>;\n\n mode: 'development' | 'production' = 'production';\n\n readonly = false;\n\n readonlyControls: BooleanSelector = BooleanSelector.False;\n\n disabled = false;\n\n disabledControls: BooleanSelector = BooleanSelector.False;\n\n hidden = false;\n\n hiddenControls: BooleanSelector = BooleanSelector.False;\n\n private readonly __observer = new MutationObserver(() => this.__onMutation());\n\n get readonlySelector(): BooleanSelector {\n return this.readonly ? BooleanSelector.True : this.readonlyControls;\n }\n\n get disabledSelector(): BooleanSelector {\n return this.disabled ? BooleanSelector.True : this.disabledControls;\n }\n\n get hiddenSelector(): BooleanSelector {\n return this.hidden ? BooleanSelector.True : this.hiddenControls;\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n if (this.mode === 'development') this.__observe();\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.__observer.disconnect();\n }\n\n protected firstUpdated(...args: Parameters<LitElement['firstUpdated']>): void {\n super.firstUpdated(...args);\n if (this.mode === 'production') this.compileTemplates();\n }\n\n protected updated(changes: Map<keyof this, unknown>): void {\n super.updated(changes);\n\n this.style.display = this.hidden ? 'none' : '';\n\n if (changes.has('mode')) {\n this.__observer.disconnect();\n if (this.mode === 'development') this.__observe();\n }\n }\n\n compileTemplates(replace = false): void {\n const templates = replace ? {} : { ...this.templates };\n\n Array.from(this.children).forEach(child => {\n if (child.localName !== 'template') return;\n const slot = child.getAttribute('slot') ?? 'default';\n\n try {\n const script = `return html\\`${child.innerHTML}\\``;\n templates[slot] = new Function('html', 'host', script) as () => TemplateResult;\n } catch (err) {\n console.error(err);\n }\n });\n\n this.templates = templates;\n }\n\n renderTemplateOrSlot(name?: string, context?: any) {\n const templateName = name ?? 'default';\n const template = this.templates[templateName];\n\n if (!template) return html`<slot name=${ifDefined(name)}></slot>`;\n\n const renderer = () => {\n try {\n const target = {} as unknown as this;\n const resolvedContext = context ?? this;\n const proxy = new Proxy(target, { get: (_, key) => resolvedContext[key] });\n\n return template?.(html, proxy);\n } catch (err) {\n console.error(err);\n }\n };\n\n return html`\n <foxy-internal-sandbox data-testid=${templateName} .render=${renderer}>\n </foxy-internal-sandbox>\n `;\n }\n\n getNestedTemplates<T extends Partial<Record<string, Renderer<any>>>>(id: string): T {\n const nestedTemplates = {} as T;\n\n Object.entries(this.templates).forEach(([key, value]) => {\n if (key.startsWith(`${id}:`)) {\n const zoomedKey = key.replace(`${id}:`, '');\n nestedTemplates[zoomedKey as keyof T] = value as T[keyof T];\n }\n });\n\n return nestedTemplates;\n }\n\n applyInferredProperties(context: Map<string, unknown>): void {\n super.applyInferredProperties(context);\n\n type Templates = ConfigurableMixinHost['templates'];\n type Mode = ConfigurableMixinHost['mode'];\n\n if (this.infer === null) return;\n\n const disabledSelector = context.get('disabledSelector') as BooleanSelector | undefined;\n const disabled = context.get('disabled') as boolean | undefined;\n\n const readonlySelector = context.get('readonlySelector') as BooleanSelector | undefined;\n const readonly = context.get('readonly') as boolean | undefined;\n\n const hiddenSelector = context.get('hiddenSelector') as BooleanSelector | undefined;\n const hidden = context.get('hidden') as boolean | undefined;\n\n const templates = context.get('templates') as Templates | undefined;\n const mode = context.get('mode') as Mode | undefined;\n\n this.disabledControls = disabledSelector?.zoom(this.infer) ?? BooleanSelector.False;\n this.disabled = disabledSelector?.matches(this.infer, true) ?? disabled ?? false;\n\n this.readonlyControls = readonlySelector?.zoom(this.infer) ?? BooleanSelector.False;\n this.readonly = readonlySelector?.matches(this.infer, true) ?? readonly ?? false;\n\n this.hiddenControls = hiddenSelector?.zoom(this.infer) ?? BooleanSelector.False;\n this.hidden = hiddenSelector?.matches(this.infer, true) ?? hidden ?? false;\n\n this.templates = templates ?? {};\n this.templates = this.getNestedTemplates(this.infer);\n\n this.mode = mode ?? 'production';\n }\n\n private __observe() {\n this.__observer.observe(this, {\n characterData: true,\n attributes: true,\n childList: true,\n subtree: true,\n });\n\n this.__onMutation();\n }\n\n private __onMutation() {\n const config: MutationObserverInit = {\n characterData: true,\n attributes: true,\n childList: true,\n subtree: true,\n };\n\n this.__observer.disconnect();\n this.__observer.observe(this, config);\n\n Array.from(this.children).forEach(child => {\n if (child.localName !== 'template' || !child.hasAttribute('slot')) return;\n this.__observer.observe((child as HTMLTemplateElement).content, config);\n });\n\n this.compileTemplates(true);\n }\n };\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inferrable.js","sourceRoot":"","sources":["../../src/mixins/inferrable.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,WAAkB,EAC2D,EAAE;IAC/E,OAAO,MAAM,iBAAkB,SAAQ,WAAW;QAA3C;;YAYL,+FAA+F;YAC/F,UAAK,GAAkB,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"inferrable.js","sourceRoot":"","sources":["../../src/mixins/inferrable.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,WAAkB,EAC2D,EAAE;IAC/E,OAAO,MAAM,iBAAkB,SAAQ,WAAW;QAA3C;;YAYL,+FAA+F;YAC/F,UAAK,GAAkB,IAAI,CAAC;QAyD9B,CAAC;QArEC,MAAM,KAAK,kBAAkB;YAC3B,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,KAAK,UAAU;YACnB,OAAO;gBACL,GAAG,KAAK,CAAC,UAAU;gBACnB,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;aACvC,CAAC;QACJ,CAAC;QAKD,gBAAgB,CAAC,GAAW,EAAE,OAAoB;YAChD,IAAI,GAAG,IAAI,OAAO;gBAAE,OAAQ,OAAe,CAAC,GAAG,CAAC,CAAC;QACnD,CAAC;QAED,eAAe;;YACb,MAAM,OAAO,GAAG,IAAI,GAAG,EAAmB,CAAC;YAC3C,MAAM,WAAW,GAAG,IAAI,CAAC,WAAuC,CAAC;YACjE,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;YAEnE,MAAM,WAAW,GAAG,CAAC,IAAiB,EAAQ,EAAE;gBAC9C,IAAI,IAAI,EAAE;oBACR,IAAI,IAAI,YAAY,UAAU,EAAE;wBAC9B,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;qBACxB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,IAAI,CAAC,4BAA4B,EAAE,CAAC;QACtC,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Constructor, LitElement, PropertyDeclarations } from 'lit-element';\n\ntype Base = Constructor<LitElement> & { properties?: PropertyDeclarations };\n\nexport declare class InferrableMixinHost {\n infer: string | null;\n\n inferProperties(): void;\n\n inferFromElement(key: string, element: HTMLElement): unknown | undefined;\n\n inferPropertiesInDescendants(): void;\n\n applyInferredProperties(context: Map<string, unknown>): void;\n}\n\nexport const InferrableMixin = <TBase extends Base>(\n BaseElement: TBase\n): TBase & Constructor<InferrableMixinHost> & { inferredProperties: string[] } => {\n return class InferrableElement extends BaseElement {\n static get inferredProperties(): string[] {\n return [];\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n infer: { type: String, reflect: true },\n };\n }\n\n /** Set a name for this element here to enable property inference. Set to `null` to disable. */\n infer: string | null = null;\n\n inferFromElement(key: string, element: HTMLElement): unknown | undefined {\n if (key in element) return (element as any)[key];\n }\n\n inferProperties(): void {\n const context = new Map<string, unknown>();\n const constructor = this.constructor as typeof InferrableElement;\n const contextKeysToInfer = new Set(constructor.inferredProperties);\n\n const processNode = (node: Node | null): void => {\n if (node) {\n if (node instanceof ShadowRoot) {\n processNode(node.host);\n } else if (node instanceof HTMLElement) {\n contextKeysToInfer.forEach(key => {\n const value = this.inferFromElement(key, node);\n if (value !== undefined) {\n context.set(key, value);\n contextKeysToInfer.delete(key);\n }\n });\n\n if (contextKeysToInfer.size > 0) processNode(node.parentNode);\n }\n }\n };\n\n processNode(this.parentNode);\n this.applyInferredProperties?.(context);\n }\n\n inferPropertiesInDescendants(): void {\n const roots = this.renderRoot === this ? [this.renderRoot] : [this.renderRoot, this];\n\n roots.forEach(root =>\n root\n .querySelectorAll<InferrableMixinHost & HTMLElement>('[infer]')\n .forEach(inferrable => inferrable.inferProperties())\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n applyInferredProperties(context: Map<string, unknown>): void {\n //\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.inferPropertiesInDescendants();\n }\n\n updated(changes: Map<keyof this, unknown>): void {\n super.updated(changes);\n this.inferPropertiesInDescendants();\n }\n };\n};\n"]}
|
|
@@ -72,7 +72,7 @@ export class Translatable extends Themeable {
|
|
|
72
72
|
this.__i18n.use(HttpApi);
|
|
73
73
|
this.__whenI18NReady = this.__i18n.init({
|
|
74
74
|
ns: ['global'],
|
|
75
|
-
supportedLngs: ['nl', 'en', 'es', 'sv', 'fi', 'fr', 'de', 'zh', 'no', 'it', 'pl'],
|
|
75
|
+
supportedLngs: ['nl', 'en', 'es', 'sv', 'fi', 'fr', 'de', 'zh', 'no', 'it', 'pl', 'se'],
|
|
76
76
|
interpolation: { format: Translatable.__f },
|
|
77
77
|
fallbackLng: 'en',
|
|
78
78
|
fallbackNS: 'global',
|
|
@@ -157,7 +157,9 @@ export const TranslatableMixin = (BaseElement, defaultNS = '') => {
|
|
|
157
157
|
if (!I18nElement)
|
|
158
158
|
return key;
|
|
159
159
|
const keys = [
|
|
160
|
-
...
|
|
160
|
+
...this.ns
|
|
161
|
+
.split(' ')
|
|
162
|
+
.reverse()
|
|
161
163
|
.map(v => v.trim())
|
|
162
164
|
.filter(v => v.length > 0)
|
|
163
165
|
.reverse()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translatable.js","sourceRoot":"","sources":["../../src/mixins/translatable.ts"],"names":[],"mappings":"AACA,OAAO,OAAuD,MAAM,SAAS,CAAC;AAE9E,OAAO,OAAO,MAAM,sBAAsB,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,uBAAoB;AACxC,OAAO,EAAE,GAAG,EAAE,kBAAe;AAG7B;;;;;;;GAOG;AACH,MAAM,OAAgB,YAAa,SAAQ,SAAS;IA+DlD;;;;;OAKG;IACH,YAAY,SAAS,GAAG,QAAQ;QAC9B,KAAK,EAAE,CAAC;QAXF,WAAM,GAAI,IAAI,CAAC,KAAK,CA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;QAED,uBAAuB,CAAC,OAA6B;YACnD,KAAK,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;YACvC,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI;gBAAE,OAAO;YAEhC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAuB,CAAC;YACvD,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAuB,CAAC;YAEnD,IAAI,CAAC,IAAI,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAC;YACvB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QAC1D,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Constructor, LitElement, PropertyDeclarations } from 'lit-element';\nimport i18next, { FormatFunction, StringMap, TFunction, i18n } from 'i18next';\n\nimport HttpApi from 'i18next-http-backend';\nimport { I18n } from '../elements/public/I18n/I18n';\nimport { Themeable } from './themeable';\nimport { cdn } from '../env';\nimport { InferrableMixinHost } from './inferrable';\n\n/**\n * One of the base classes for each rel-specific element in the collection,\n * providing internationalization capabilities to the derived components.\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 Translatable extends Themeable {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n lang: { type: String, noAccessor: true },\n ns: { type: String, noAccessor: true },\n };\n }\n\n /**\n * i18next formatter that converts given value to lowecase.\n * @see https://www.i18next.com/translation-function/formatting\n */\n private static __fLowercase: FormatFunction = (value): string => {\n return value.toLowerCase();\n };\n\n /**\n * i18next formatter that presents an array of serializable items\n * as `[0], [1], [...] and [length - 1]`. For example, given an array like\n * the following: `['a', 'b', 'c']`, it will output `'a, b and c'`.\n * @see https://www.i18next.com/translation-function/formatting\n */\n private static __fList: FormatFunction = (value): string => {\n return (value as string[])\n .map((v, i, a) => {\n if (i === 0) return v;\n const part = i === a.length - 1 ? ` $t(and) ` : ',';\n return `${part} ${v}`;\n })\n .join('');\n };\n\n /**\n * Chooses the right i18next formatter for the given template.\n * @see https://www.i18next.com/translation-function/formatting\n */\n private static __f: FormatFunction = (...args): string => {\n const value = args[0];\n const formats = args[1]?.split(' ') ?? [];\n\n return formats.reduce((result, format) => {\n switch (format) {\n case 'lowercase':\n return Translatable.__fLowercase(result);\n case 'list':\n return Translatable.__fList(result);\n default:\n return result;\n }\n }, value);\n };\n\n private static __whenI18NReady: Promise<TFunction>;\n\n private static __isI18NReady = false;\n\n private static __i18n: i18n;\n\n private __lang = (this._i18n.options.fallbackLng as string[])[0];\n\n private __ns = (this._i18n.options.fallbackNS as string[])[0];\n\n /**\n * Creates class instance and starts loading missing translations\n * in background. Triggers render when ready.\n *\n * @param defaultNS Name of the folder translations for this component are stored in. Usually a node name without vendor prefix.\n */\n constructor(defaultNS = 'global') {\n super();\n this.ns = defaultNS;\n this._whenI18nReady.then(() => this.requestUpdate());\n }\n\n /**\n * Contains the language this component presents its translatable\n * content in. Assigning a value to this property will load new\n * translations in background and trigger a render afterwards.\n *\n * **Example:** `\"en\"`\n */\n public get lang(): string {\n return this.__lang;\n }\n\n public set lang(value: string) {\n if (!value || value === 'undefined') return;\n this.__lang = value;\n this._i18n.loadLanguages(value).then(() => {\n if (this.__lang === value) this.requestUpdate();\n });\n }\n\n /**\n * The namespace to look for the translations in. We use this property to\n * sync namespace settings with the parent element and it's highly unlikely\n * that you'll ever need to set or read it in your code.\n *\n * **Example:** `\"admin\"`\n */\n public get ns(): string {\n return this.__ns;\n }\n\n public set ns(value: string) {\n this.__ns = value;\n this._i18n.loadNamespaces(value).then(() => {\n if (this.__ns === value) this.requestUpdate();\n });\n }\n\n private static __initI18N() {\n this.__i18n = i18next.createInstance();\n this.__i18n.use(HttpApi);\n\n this.__whenI18NReady = this.__i18n.init({\n ns: ['global'],\n supportedLngs: ['nl', 'en', 'es', 'sv', 'fi', 'fr', 'de', 'zh', 'no', 'it', 'pl'],\n interpolation: { format: Translatable.__f },\n fallbackLng: 'en',\n fallbackNS: 'global',\n defaultNS: 'global',\n detection: {\n order: ['querystring', 'navigator', 'htmlTag', 'path', 'subdomain'],\n caches: [],\n },\n backend: {\n loadPath: `${cdn}/translations/{{ns}}/{{lng}}.json`,\n },\n });\n\n this.__whenI18NReady.then(() => (this.__isI18NReady = true));\n\n return this.__i18n;\n }\n\n protected get _i18n(): i18n {\n return Translatable.__i18n ?? Translatable.__initI18N();\n }\n\n protected get _whenI18nReady(): Promise<TFunction> {\n return Translatable.__whenI18NReady;\n }\n\n protected get _isI18nReady(): boolean {\n return Translatable.__isI18NReady;\n }\n\n protected get _t(): TFunction {\n const ns = [this.__ns, this._i18n.options.fallbackNS as string];\n return this._i18n.getFixedT(this.__lang, ns);\n }\n}\n\ntype Base = Constructor<InferrableMixinHost> &\n Constructor<LitElement> & { properties?: PropertyDeclarations; inferredProperties: string[] };\n\ntype Translator = (key: string, options?: StringMap) => string;\n\nexport declare class TranslatableMixinHost {\n /** Optional ISO 639-1 code describing the language element content is written in. */\n lang: string;\n\n /**\n * Namespace used by this element.\n * @since 1.4.0\n */\n ns: string;\n\n /**\n * Translation function from i18next fixed to the current language and element namespace.\n * @since 1.4.0\n */\n get t(): Translator;\n}\n\nexport const TranslatableMixin = <T extends Base>(\n BaseElement: T,\n defaultNS = ''\n): T & Constructor<TranslatableMixinHost> & { defaultNS: string } => {\n return class TranslatableElement extends BaseElement {\n static get inferredProperties(): string[] {\n return [...super.inferredProperties, 'lang', 'ns'];\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n lang: { type: String },\n ns: { type: String },\n };\n }\n\n static get defaultNS(): string {\n return defaultNS;\n }\n\n lang = '';\n\n ns = defaultNS;\n\n t: Translator = (key, options) => {\n const I18nElement = customElements.get('foxy-i18n') as typeof I18n | undefined;\n\n if (!I18nElement) return key;\n\n const keys = [\n ...[defaultNS, ...this.ns.split(' ').reverse()]\n .map(v => v.trim())\n .filter(v => v.length > 0)\n .reverse()\n .map((v, i, a) => `${v}:${[...a.slice(i + 1), key].join('.')}`),\n `shared:${key}`,\n ];\n\n return I18nElement.i18next.t(keys, { lng: this.lang, ...options }).toString();\n };\n\n private __untrackTranslations?: () => void;\n\n connectedCallback(): void {\n super.connectedCallback();\n const I18nElement = customElements.get('foxy-i18n') as typeof I18n | undefined;\n this.__untrackTranslations = I18nElement?.onTranslationChange(() => this.requestUpdate());\n }\n\n /** @readonly */\n updated(changedProperties: Map<keyof I18n, unknown>): void {\n super.updated(changedProperties);\n\n const I18nElement = customElements.get('foxy-i18n') as typeof I18n | undefined;\n if (!I18nElement) return;\n\n if (changedProperties.has('lang')) I18nElement.i18next.loadLanguages(this.lang);\n if (changedProperties.has('ns')) I18nElement.i18next.loadNamespaces(this.ns.split(' '));\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.__untrackTranslations?.();\n }\n\n applyInferredProperties(context: Map<string, unknown>): void {\n super.applyInferredProperties(context);\n if (this.infer === null) return;\n\n const lang = context.get('lang') as string | undefined;\n const ns = context.get('ns') as string | undefined;\n\n this.lang = lang ?? '';\n this.ns = ns ? `${ns} ${this.infer}`.trim() : defaultNS;\n }\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"translatable.js","sourceRoot":"","sources":["../../src/mixins/translatable.ts"],"names":[],"mappings":"AACA,OAAO,OAAuD,MAAM,SAAS,CAAC;AAE9E,OAAO,OAAO,MAAM,sBAAsB,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,uBAAoB;AACxC,OAAO,EAAE,GAAG,EAAE,kBAAe;AAG7B;;;;;;;GAOG;AACH,MAAM,OAAgB,YAAa,SAAQ,SAAS;IA+DlD;;;;;OAKG;IACH,YAAY,SAAS,GAAG,QAAQ;QAC9B,KAAK,EAAE,CAAC;QAXF,WAAM,GAAI,IAAI,CAAC,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B,CAAC,OAA6B;YACnD,KAAK,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;YACvC,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI;gBAAE,OAAO;YAEhC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAuB,CAAC;YACvD,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAuB,CAAC;YAEnD,IAAI,CAAC,IAAI,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAC;YACvB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QAC1D,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Constructor, LitElement, PropertyDeclarations } from 'lit-element';\nimport i18next, { FormatFunction, StringMap, TFunction, i18n } from 'i18next';\n\nimport HttpApi from 'i18next-http-backend';\nimport { I18n } from '../elements/public/I18n/I18n';\nimport { Themeable } from './themeable';\nimport { cdn } from '../env';\nimport { InferrableMixinHost } from './inferrable';\n\n/**\n * One of the base classes for each rel-specific element in the collection,\n * providing internationalization capabilities to the derived components.\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 Translatable extends Themeable {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n lang: { type: String, noAccessor: true },\n ns: { type: String, noAccessor: true },\n };\n }\n\n /**\n * i18next formatter that converts given value to lowecase.\n * @see https://www.i18next.com/translation-function/formatting\n */\n private static __fLowercase: FormatFunction = (value): string => {\n return value.toLowerCase();\n };\n\n /**\n * i18next formatter that presents an array of serializable items\n * as `[0], [1], [...] and [length - 1]`. For example, given an array like\n * the following: `['a', 'b', 'c']`, it will output `'a, b and c'`.\n * @see https://www.i18next.com/translation-function/formatting\n */\n private static __fList: FormatFunction = (value): string => {\n return (value as string[])\n .map((v, i, a) => {\n if (i === 0) return v;\n const part = i === a.length - 1 ? ` $t(and) ` : ',';\n return `${part} ${v}`;\n })\n .join('');\n };\n\n /**\n * Chooses the right i18next formatter for the given template.\n * @see https://www.i18next.com/translation-function/formatting\n */\n private static __f: FormatFunction = (...args): string => {\n const value = args[0];\n const formats = args[1]?.split(' ') ?? [];\n\n return formats.reduce((result, format) => {\n switch (format) {\n case 'lowercase':\n return Translatable.__fLowercase(result);\n case 'list':\n return Translatable.__fList(result);\n default:\n return result;\n }\n }, value);\n };\n\n private static __whenI18NReady: Promise<TFunction>;\n\n private static __isI18NReady = false;\n\n private static __i18n: i18n;\n\n private __lang = (this._i18n.options.fallbackLng as string[])[0];\n\n private __ns = (this._i18n.options.fallbackNS as string[])[0];\n\n /**\n * Creates class instance and starts loading missing translations\n * in background. Triggers render when ready.\n *\n * @param defaultNS Name of the folder translations for this component are stored in. Usually a node name without vendor prefix.\n */\n constructor(defaultNS = 'global') {\n super();\n this.ns = defaultNS;\n this._whenI18nReady.then(() => this.requestUpdate());\n }\n\n /**\n * Contains the language this component presents its translatable\n * content in. Assigning a value to this property will load new\n * translations in background and trigger a render afterwards.\n *\n * **Example:** `\"en\"`\n */\n public get lang(): string {\n return this.__lang;\n }\n\n public set lang(value: string) {\n if (!value || value === 'undefined') return;\n this.__lang = value;\n this._i18n.loadLanguages(value).then(() => {\n if (this.__lang === value) this.requestUpdate();\n });\n }\n\n /**\n * The namespace to look for the translations in. We use this property to\n * sync namespace settings with the parent element and it's highly unlikely\n * that you'll ever need to set or read it in your code.\n *\n * **Example:** `\"admin\"`\n */\n public get ns(): string {\n return this.__ns;\n }\n\n public set ns(value: string) {\n this.__ns = value;\n this._i18n.loadNamespaces(value).then(() => {\n if (this.__ns === value) this.requestUpdate();\n });\n }\n\n private static __initI18N() {\n this.__i18n = i18next.createInstance();\n this.__i18n.use(HttpApi);\n\n this.__whenI18NReady = this.__i18n.init({\n ns: ['global'],\n supportedLngs: ['nl', 'en', 'es', 'sv', 'fi', 'fr', 'de', 'zh', 'no', 'it', 'pl', 'se'],\n interpolation: { format: Translatable.__f },\n fallbackLng: 'en',\n fallbackNS: 'global',\n defaultNS: 'global',\n detection: {\n order: ['querystring', 'navigator', 'htmlTag', 'path', 'subdomain'],\n caches: [],\n },\n backend: {\n loadPath: `${cdn}/translations/{{ns}}/{{lng}}.json`,\n },\n });\n\n this.__whenI18NReady.then(() => (this.__isI18NReady = true));\n\n return this.__i18n;\n }\n\n protected get _i18n(): i18n {\n return Translatable.__i18n ?? Translatable.__initI18N();\n }\n\n protected get _whenI18nReady(): Promise<TFunction> {\n return Translatable.__whenI18NReady;\n }\n\n protected get _isI18nReady(): boolean {\n return Translatable.__isI18NReady;\n }\n\n protected get _t(): TFunction {\n const ns = [this.__ns, this._i18n.options.fallbackNS as string];\n return this._i18n.getFixedT(this.__lang, ns);\n }\n}\n\ntype Base = Constructor<InferrableMixinHost> &\n Constructor<LitElement> & { properties?: PropertyDeclarations; inferredProperties: string[] };\n\ntype Translator = (key: string, options?: StringMap) => string;\n\nexport declare class TranslatableMixinHost {\n /** Optional ISO 639-1 code describing the language element content is written in. */\n lang: string;\n\n /**\n * Namespace used by this element.\n * @since 1.4.0\n */\n ns: string;\n\n /**\n * Translation function from i18next fixed to the current language and element namespace.\n * @since 1.4.0\n */\n get t(): Translator;\n}\n\nexport const TranslatableMixin = <T extends Base>(\n BaseElement: T,\n defaultNS = ''\n): T & Constructor<TranslatableMixinHost> & { defaultNS: string } => {\n return class TranslatableElement extends BaseElement {\n static get inferredProperties(): string[] {\n return [...super.inferredProperties, 'lang', 'ns'];\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n lang: { type: String },\n ns: { type: String },\n };\n }\n\n static get defaultNS(): string {\n return defaultNS;\n }\n\n lang = '';\n\n ns = defaultNS;\n\n t: Translator = (key, options) => {\n const I18nElement = customElements.get('foxy-i18n') as typeof I18n | undefined;\n\n if (!I18nElement) return key;\n\n const keys = [\n ...this.ns\n .split(' ')\n .reverse()\n .map(v => v.trim())\n .filter(v => v.length > 0)\n .reverse()\n .map((v, i, a) => `${v}:${[...a.slice(i + 1), key].join('.')}`),\n `shared:${key}`,\n ];\n\n return I18nElement.i18next.t(keys, { lng: this.lang, ...options }).toString();\n };\n\n private __untrackTranslations?: () => void;\n\n connectedCallback(): void {\n super.connectedCallback();\n const I18nElement = customElements.get('foxy-i18n') as typeof I18n | undefined;\n this.__untrackTranslations = I18nElement?.onTranslationChange(() => this.requestUpdate());\n }\n\n /** @readonly */\n updated(changedProperties: Map<keyof I18n, unknown>): void {\n super.updated(changedProperties);\n\n const I18nElement = customElements.get('foxy-i18n') as typeof I18n | undefined;\n if (!I18nElement) return;\n\n if (changedProperties.has('lang')) I18nElement.i18next.loadLanguages(this.lang);\n if (changedProperties.has('ns')) I18nElement.i18next.loadNamespaces(this.ns.split(' '));\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.__untrackTranslations?.();\n }\n\n applyInferredProperties(context: Map<string, unknown>): void {\n super.applyInferredProperties(context);\n if (this.infer === null) return;\n\n const lang = context.get('lang') as string | undefined;\n const ns = context.get('ns') as string | undefined;\n\n this.lang = lang ?? '';\n this.ns = ns ? `${ns} ${this.infer}`.trim() : defaultNS;\n }\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.
|
|
4
|
+
"version": "1.17.0",
|
|
5
5
|
"description": "E-commerce web components by Foxy.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"format": "npm run format:eslint && npm run format:prettier",
|
|
22
22
|
"format:eslint": "eslint --ext .ts,.html . --fix --ignore-path .gitignore",
|
|
23
23
|
"format:prettier": "prettier \"**/*.js\" \"**/*.ts\" --write --ignore-path .gitignore",
|
|
24
|
-
"test": "wtr src
|
|
24
|
+
"test": "wtr src/**/*.test.ts",
|
|
25
25
|
"test:watch": "wtr src/**/*.test.ts --watch",
|
|
26
26
|
"prepack": "npm run lint && rimraf dist && node ./.build/compile-for-npm.js && rollup -c"
|
|
27
27
|
},
|
|
@@ -65,11 +65,13 @@
|
|
|
65
65
|
"@types/traverse": "^0.6.32",
|
|
66
66
|
"@typescript-eslint/eslint-plugin": "^4.0.1",
|
|
67
67
|
"@typescript-eslint/parser": "^4.0.1",
|
|
68
|
-
"@web/dev-server": "^0.1.
|
|
69
|
-
"@web/dev-server-esbuild": "^0.
|
|
70
|
-
"@web/dev-server-rollup": "^0.3.
|
|
71
|
-
"@web/dev-server-storybook": "^0.
|
|
72
|
-
"@web/test-runner": "^0.
|
|
68
|
+
"@web/dev-server": "^0.1.32",
|
|
69
|
+
"@web/dev-server-esbuild": "^0.3.1",
|
|
70
|
+
"@web/dev-server-rollup": "^0.3.18",
|
|
71
|
+
"@web/dev-server-storybook": "^0.5.1",
|
|
72
|
+
"@web/test-runner": "^0.13.31",
|
|
73
|
+
"@web/test-runner-commands": "^0.6.3",
|
|
74
|
+
"@web/test-runner-puppeteer": "^0.10.5",
|
|
73
75
|
"@xstate/test": "^0.4.1",
|
|
74
76
|
"@zoltu/typescript-transformer-append-js-extension": "^1.0.1",
|
|
75
77
|
"autoprefixer": "^10.2.5",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as e,_ as t}from"./shared-2eee69db.js";import{L as s}from"./shared-dc73b9a5.js";import{t as r,m as i,a as n,b as o,R as h}from"./shared-6eb57269.js";import{A as a}from"./shared-567c8c48.js";import{F as u}from"./shared-64657919.js";import{U as d}from"./shared-7684cb05.js";import{i as _}from"./shared-968add7f.js";function c(e,t){let s=null;return r(t).forEach((function(){var t,r,i,n,o,h,a,u,d,_,c;if(null===(i=null===(r=null===(t=this.node)||void 0===t?void 0:t._links)||void 0===r?void 0:r.self)||void 0===i?void 0:i.href){const t=null===(h=null===(o=null===(n=this.node)||void 0===n?void 0:n._links)||void 0===o?void 0:o.self)||void 0===h?void 0:h.href,r=new URL(null===(d=null===(u=null===(a=this.node)||void 0===a?void 0:a._links)||void 0===u?void 0:u.self)||void 0===d?void 0:d.href);if(r.searchParams.delete("zoom"),e===t||e===r.toString())return s=JSON.stringify(this.node),void this.stop()}Object.entries(null!==(c=null===(_=this.node)||void 0===_?void 0:_._links)&&void 0!==c?c:{}).some((([t,r])=>{var i,n;if(r.href!==e)return!1;const o=null===(n=null===(i=this.node)||void 0===i?void 0:i._embedded)||void 0===n?void 0:n[t];if(!o||!Array.isArray(o))return!1;const h=o.length<20?o.length:21,a=new URL(e),u=new URL(e);return a.searchParams.set("offset",o.length.toString()),u.searchParams.set("offset",h.toString()),s=JSON.stringify({returned_items:o.length,total_items:h,offset:0,limit:20,_embedded:{[t]:o},_links:{curies:this.node._links.curies,first:{href:e},last:{href:u.toString()},prev:{href:e},next:{href:a.toString()},self:{href:e}}}),this.stop(),!0}))})),new Response(s,{status:s?200:404})}class l extends(e(s)){constructor(){super(...arguments),this.lang="",this.parent="",this.related=[],this.__href="",this.__group="",this.__fetchEventQueue=[],this.__service=_(n.withConfig({services:{sendDelete:()=>this._sendDelete(),sendPatch:({edits:e})=>this._sendPatch(e),sendPost:({edits:e})=>this._sendPost(e),sendGet:()=>this._sendGet()},actions:{validate:o({errors:e=>{const s=this.constructor.v8n,r=t(t({},e.data),e.edits);return s.map((e=>e(r))).filter((e=>"string"==typeof e)).filter(((e,t,s)=>s.indexOf(e)===t))}})}}))}static get inferredProperties(){return[...super.inferredProperties,"group","lang"]}static get properties(){return{related:{type:Array},parent:{type:String},group:{type:String,noAccessor:!0},href:{type:String,noAccessor:!0},lang:{type:String}}}static get v8n(){return[]}get failure(){return this.__service.state.context.failure}get errors(){return this.__service.state.context.errors}get form(){const{data:e,edits:s}=this.__service.state.context;return t(t({},e),s)}get data(){return this.__service.state.context.data}set data(e){var t;this.__service.send({type:"SET_DATA",data:e}),this.__href=null!==(t=null==e?void 0:e._links.self.href)&&void 0!==t?t:""}get group(){return this.__group}set group(e){this.__group=e,this.__destroyRumour(),this.__createRumour()}get href(){return this.__href}set href(e){this.__href=e,e?this.__service.send({type:"FETCH"}):this.__service.send({type:"SET_DATA",data:null})}in(e){return this.__service.state.matches(e)}undo(){this.__service.send({type:"UNDO"})}edit(e){this.__service.send({type:"EDIT",data:e})}submit(){this.__service.send({type:"SUBMIT"})}delete(){this.__service.send({type:"DELETE"})}refresh(){this.__service.send({type:"REFRESH"})}connectedCallback(){super.connectedCallback(),this.__createService(),this.__createRumour(),this.__createServer(),this.__processFetchEventQueue()}disconnectedCallback(){super.disconnectedCallback(),this.__destroyService(),this.__destroyRumour(),this.__destroyServer(),this.__flushFetchEventQueue("parent element was disconnected")}applyInferredProperties(e){var t,s;super.applyInferredProperties(e),null!==this.infer&&(this.group=null!==(t=e.get("group"))&&void 0!==t?t:"",this.lang=null!==(s=e.get("lang"))&&void 0!==s?s:"")}async _fetch(...e){const t=await new a(this).fetch(...e);if(!t.ok)throw t;return t.json()}async _sendPost(e){this.__destroyRumour();const t=JSON.stringify(e),s=await this._fetch(this.parent,{body:t,method:"POST"}),r=l.Rumour(this.group),i=[...this.related,this.parent];return r.share({data:s,related:i,source:s._links.self.href}),this.__createRumour(),s}async _sendGet(){this.__destroyRumour();const e=await this._fetch(this.href);return l.Rumour(this.group).share({data:e,source:this.href}),this.__createRumour(),e}async _sendPatch(e){this.__destroyRumour();const t=JSON.stringify(e),s=await this._fetch(this.href,{body:t,method:"PATCH"});return l.Rumour(this.group).share({data:s,source:this.href,related:this.related}),this.__createRumour(),s}async _sendDelete(){this.__destroyRumour();const e=await this._fetch(this.href,{method:"DELETE"}),t=l.Rumour(this.group),s=[...this.related,this.parent];return t.share({data:null,source:this.href,related:s}),this.__createRumour(),e}__createService(){this.__service.onTransition((e=>{if(!e.changed)return;const t=e.toStrings().reduce(((e,t)=>[...e,...t.split(".")]),[]);this.setAttribute("state",[...new Set(t)].join(" ")),this.requestUpdate(),this.dispatchEvent(new d),e.matches("busy")||this.__processFetchEventQueue()})),this.__service.onChange((()=>{this.requestUpdate(),this.dispatchEvent(new d)})),this.__service.start()}__destroyService(){this.__service.stop()}__createRumour(){const e=l.Rumour(this.group);this.__unsubscribeFromRumour=e.track((e=>this.__handleRumourUpdate(e)))}__destroyRumour(){var e;null===(e=this.__unsubscribeFromRumour)||void 0===e||e.call(this)}__createServer(){this.__fetchEventHandler=this.__handleFetchEvent.bind(this),this.addEventListener("fetch",this.__fetchEventHandler)}__destroyServer(){this.removeEventListener("fetch",this.__fetchEventHandler)}__handleRumourUpdate(e){var t;try{const s=null===(t=this.__service.state)||void 0===t?void 0:t.context.data;if(!s)return;const r=e(s);r!==s&&this.__service.send({data:r,type:"SET_DATA"})}catch(e){if(!(e instanceof h.UpdateError))throw e;this.__service.send({type:"REFRESH"})}}__processFetchEventQueue(){const e=new l.API(this);this.__fetchEventQueue.forEach((t=>{const s=t.request,r=c(s.url,this.data),i=r.ok?r:e.fetch(s);t.respondWith(Promise.resolve(i)),r.ok&&console.debug(`%c@foxy.io/elements::${this.localName}\n%c200%c GET ${s.url}`,"color: gray","background: gray; padding: 0 .2em; border-radius: .2em; color: white;","")})),this.__fetchEventQueue=[]}__flushFetchEventQueue(e){this.__fetchEventQueue.forEach((t=>{t.respondWith(Promise.reject(new Error(e)))})),this.__fetchEventQueue=[]}__handleFetchEvent(e){e instanceof u&&(e.defaultPrevented||"GET"===e.request.method&&(e.request.url.startsWith("foxy://")||e.composedPath()[0]!==this&&(e.preventDefault(),this.__fetchEventQueue.push(e),this.in("busy")||this.__processFetchEventQueue())))}}l.UpdateEvent=d,l.Rumour=i((()=>new h)),l.API=a;export{l as N,c as s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./shared-8c41299f.js";import{a as e}from"./shared-6a0012d6.js";import{_ as t}from"./shared-2eee69db.js";import{i as r}from"./shared-9803aa7c.js";import{h as s}from"./shared-dc73b9a5.js";customElements.define("foxy-internal-control",e);class i extends e{constructor(){super(...arguments),this.__placeholder=null,this.__helperText=null,this.__v8nPrefix=null,this.__property=null,this.__label=null}static get properties(){return t(t({},super.properties),{},{__placeholder:{attribute:!1},__helperText:{attribute:!1},__v8nPrefix:{attribute:!1},__property:{attribute:!1},__label:{attribute:!1},placeholder:{type:String,noAccessor:!0},helperText:{type:String,attribute:"helper-text",noAccessor:!0},v8nPrefix:{type:String,attribute:"v8n-prefix",noAccessor:!0},property:{type:String,noAccessor:!0},label:{type:String,noAccessor:!0}})}get placeholder(){return"string"==typeof this.__placeholder?this.__placeholder:this.t("placeholder")}set placeholder(e){this.__placeholder=e}get helperText(){return"string"==typeof this.__helperText?this.__helperText:this.t("helper_text")}set helperText(e){this.__helperText=e}get v8nPrefix(){return"string"==typeof this.__v8nPrefix?this.__v8nPrefix:`${this.infer}:`}set v8nPrefix(e){this.__v8nPrefix=e}get property(){return"string"==typeof this.__property?this.__property:this.infer.replace(/-/g,"_")}set property(e){this.__property=e}get label(){return"string"==typeof this.__label?this.__label:this.t("label")}set label(e){this.__label=e}get _value(){var e;return null===(e=this.nucleon)||void 0===e?void 0:e.form[this.property]}set _value(e){var t;const r=new CustomEvent("change",{cancelable:!0,detail:e});this.dispatchEvent(r)&&(null===(t=this.nucleon)||void 0===t||t.edit({[this.property]:e}))}get _error(){var e;return null===(e=this.nucleon)||void 0===e?void 0:e.errors.find((e=>e.startsWith(this.v8nPrefix)))}get _errorMessage(){return this._error?this.t(this._error.substring(this.v8nPrefix.length)):void 0}get _checkValidity(){return()=>!this._error}}customElements.define("foxy-internal-editable-control",i);let l,n=e=>e;customElements.define("foxy-internal-text-control",class extends i{renderControl(){return s(l||(l=n` <vaadin-text-field error-message="${0}" helper-text="${0}" placeholder="${0}" label="${0}" class="w-full" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" @keydown="${0}" @input="${0}"> </vaadin-text-field> `),r(this._errorMessage),this.helperText,this.placeholder,this.label,this.disabled,this.readonly,this._checkValidity,this._value,(e=>{var t;return"Enter"===e.key&&(null===(t=this.nucleon)||void 0===t?void 0:t.submit())}),(e=>{const t=e.currentTarget;this._value=t.value}))}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:""}set _value(e){super._value=e}});export{i as I};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e}from"./shared-6eb57269.js";import{F as t}from"./shared-64657919.js";class s extends e{constructor(e){super({base:new URL(document.baseURI),fetch:(...n)=>new Promise(((c,o)=>{const r="string"==typeof n[0]?new s.WHATWGRequest(...n):n[0];r.headers.set("Content-Type","application/json"),r.headers.set("FOXY-API-VERSION","1");const a=new t("fetch",{cancelable:!0,composed:!0,bubbles:!0,request:r,resolve:c,reject:o});e.dispatchEvent(a),a.defaultPrevented||fetch(r).then(c).catch(o)}))})}}s.FetchEvent=t;export{s as A};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e}from"./shared-2eee69db.js";import{h as t}from"./shared-dc73b9a5.js";import{B as r}from"./shared-6eb57269.js";import{i as s}from"./shared-9803aa7c.js";let o,i,l=e=>e;const n=n=>class extends n{constructor(){super(...arguments),this.templates={},this.mode="production",this.readonly=!1,this.readonlyControls=r.False,this.disabled=!1,this.disabledControls=r.False,this.hidden=!1,this.hiddenControls=r.False,this.__observer=new MutationObserver((()=>this.__onMutation()))}static get inferredProperties(){return[...super.inferredProperties,"disabledSelector","readonlySelector","hiddenSelector","templates","disabled","readonly","hidden","mode"]}static get properties(){return e(e({},super.properties),{},{templates:{attribute:!1},mode:{type:String},readonly:{type:Boolean,reflect:!0},readonlyControls:{attribute:"readonlycontrols",converter:{fromAttribute:e=>new r(null!=e?e:"")}},disabled:{type:Boolean,reflect:!0},disabledControls:{attribute:"disabledcontrols",converter:{fromAttribute:e=>new r(null!=e?e:"")}},hidden:{type:Boolean,reflect:!0},hiddenControls:{attribute:"hiddencontrols",converter:{fromAttribute:e=>new r(null!=e?e:"")}}})}get readonlySelector(){return this.readonly?r.True:this.readonlyControls}get disabledSelector(){return this.disabled?r.True:this.disabledControls}get hiddenSelector(){return this.hidden?r.True:this.hiddenControls}connectedCallback(){super.connectedCallback(),"development"===this.mode&&this.__observe()}disconnectedCallback(){super.disconnectedCallback(),this.__observer.disconnect()}firstUpdated(...e){super.firstUpdated(...e),"production"===this.mode&&this.compileTemplates()}updated(e){super.updated(e),e.has("mode")&&(this.__observer.disconnect(),"development"===this.mode&&this.__observe())}compileTemplates(t=!1){const r=t?{}:e({},this.templates);Array.from(this.children).forEach((e=>{var t;if("template"!==e.localName)return;const s=null!==(t=e.getAttribute("slot"))&&void 0!==t?t:"default";try{const t=`return html\`${e.innerHTML}\``;r[s]=new Function("html","host",t)}catch(e){console.error(e)}})),this.templates=r}renderTemplateOrSlot(e,r){const n=null!=e?e:"default",d=this.templates[n];if(!d)return t(o||(o=l`<slot name="${0}"></slot>`),s(e));return t(i||(i=l` <foxy-internal-sandbox data-testid="${0}" .render="${0}"> </foxy-internal-sandbox> `),n,(()=>{try{const e=null!=r?r:this,s=new Proxy({},{get:(t,r)=>e[r]});return null==d?void 0:d(t,s)}catch(e){console.error(e)}}))}getNestedTemplates(e){const t={};return Object.entries(this.templates).forEach((([r,s])=>{if(r.startsWith(`${e}:`)){const o=r.replace(`${e}:`,"");t[o]=s}})),t}applyInferredProperties(e){var t,s,o,i,l,n,d,a,h;if(super.applyInferredProperties(e),null===this.infer)return;const c=e.get("disabledSelector"),u=e.get("disabled"),p=e.get("readonlySelector"),m=e.get("readonly"),b=e.get("hiddenSelector"),v=e.get("hidden"),f=e.get("templates"),y=e.get("mode");this.disabledControls=null!==(t=null==c?void 0:c.zoom(this.infer))&&void 0!==t?t:r.False,this.disabled=null!==(o=null!==(s=null==c?void 0:c.matches(this.infer,!0))&&void 0!==s?s:u)&&void 0!==o&&o,this.readonlyControls=null!==(i=null==p?void 0:p.zoom(this.infer))&&void 0!==i?i:r.False,this.readonly=null!==(n=null!==(l=null==p?void 0:p.matches(this.infer,!0))&&void 0!==l?l:m)&&void 0!==n&&n,this.hiddenControls=null!==(d=null==b?void 0:b.zoom(this.infer))&&void 0!==d?d:r.False,this.hidden=null!==(h=null!==(a=null==b?void 0:b.matches(this.infer,!0))&&void 0!==a?a:v)&&void 0!==h&&h,this.templates=null!=f?f:{},this.templates=this.getNestedTemplates(this.infer),this.mode=null!=y?y:"production"}__observe(){this.__observer.observe(this,{characterData:!0,attributes:!0,childList:!0,subtree:!0}),this.__onMutation()}__onMutation(){const e={characterData:!0,attributes:!0,childList:!0,subtree:!0};this.__observer.disconnect(),this.__observer.observe(this,e),Array.from(this.children).forEach((t=>{"template"===t.localName&&t.hasAttribute("slot")&&this.__observer.observe(t.content,e)})),this.compileTemplates(!0)}};export{n as C};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
class e extends Event{constructor(e,t){super(e,t),this.request=t.request,this.__reject=t.reject,this.__resolve=t.resolve}respondWith(e){this.preventDefault(),this.stopImmediatePropagation(),e.then(this.__resolve).catch(this.__reject)}}export{e as F};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./shared-8c41299f.js";import"./shared-73cfd096.js";import"./shared-cea659c8.js";import"./foxy-spinner.js";import"./shared-7a084a40.js";import{C as e}from"./shared-a2f5defb.js";import"./shared-3e14ffe1.js";import"./shared-e21c712d.js";import"./shared-15d04c73.js";import{s,h as t}from"./shared-dc73b9a5.js";import{S as i,T as a,a as r}from"./shared-855a1983.js";import"./shared-addf6302.js";import"./shared-78a2c66f.js";import"./shared-107acd1f.js";import{m as n}from"./shared-6eb57269.js";import{G as l}from"./shared-78adab3d.js";import"./shared-3b318016.js";import"./shared-4764b995.js";import"./shared-f2a561f7.js";import{c as o}from"./shared-4e709717.js";import{C as d}from"./shared-58a9174f.js";import{N as h}from"./shared-25ef9e09.js";import{i as m}from"./shared-9803aa7c.js";import{v as c}from"./shared-b738ee96.js";let f,C,p,g,u=e=>e;const v=[{property:"is_merchant",icon:s(f||(f=u`<svg class="fill-current h-full w-full" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M22.8961 8.89L21.7932 4.52C21.5622 3.62 20.7429 3 19.7871 3H5.1979C4.25259 3 3.42283 3.63 3.20225 4.52L2.0994 8.89C1.84732 9.91 2.07839 10.95 2.75061 11.77C2.83464 11.88 2.95017 11.96 3.0447 12.06V19C3.0447 20.1 3.99001 21 5.14538 21H19.8501C21.0055 21 21.9508 20.1 21.9508 19V12.06C22.0453 11.97 22.1609 11.88 22.2449 11.78C22.9171 10.96 23.1587 9.91 22.8961 8.89ZM19.7556 4.99L20.8584 9.36C20.9635 9.78 20.8689 10.2 20.5958 10.53C20.4488 10.71 20.1337 11 19.6085 11C18.9678 11 18.4111 10.51 18.3376 9.86L17.7284 5L19.7556 4.99ZM13.5481 5H15.6067L16.1739 9.52C16.2264 9.91 16.1004 10.3 15.8273 10.59C15.5962 10.85 15.2601 11 14.8295 11C14.1258 11 13.5481 10.41 13.5481 9.69V5ZM8.81106 9.52L9.38874 5H11.4474V9.69C11.4474 10.41 10.8697 11 10.0925 11C9.73536 11 9.40975 10.85 9.15767 10.59C8.89509 10.3 8.76905 9.91 8.81106 9.52ZM4.13705 9.36L5.1979 5H7.26706L6.65787 9.86C6.57384 10.51 6.02766 11 5.38696 11C4.87229 11 4.54669 10.71 4.41014 10.53C4.12655 10.21 4.03202 9.78 4.13705 9.36ZM5.14538 19V12.97C5.22941 12.98 5.30293 13 5.38696 13C6.30075 13 7.13052 12.64 7.73971 12.05C8.36992 12.65 9.21019 13 10.166 13C11.0798 13 11.8991 12.64 12.5082 12.07C13.1279 12.64 13.9682 13 14.9135 13C15.7958 13 16.6361 12.65 17.2663 12.05C17.8755 12.64 18.7052 13 19.619 13C19.7031 13 19.7766 12.98 19.8606 12.97V19H5.14538Z" /></svg>`)),key:"merchant"},{property:"is_programmer",icon:s(C||(C=u`<svg class="fill-current h-full w-full" viewBox="0 0 20 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M0 3C0 1.34315 1.34315 0 3 0H17C18.6569 0 20 1.34315 20 3V15C20 16.6569 18.6569 18 17 18H3C1.34315 18 0 16.6569 0 15V3ZM3 2C2.44772 2 2 2.44772 2 3V15C2 15.5523 2.44772 16 3 16H17C17.5523 16 18 15.5523 18 15V3C18 2.44772 17.5523 2 17 2H3ZM4.29289 4.29289C4.68342 3.90237 5.31658 3.90237 5.70711 4.29289L9.70711 8.29289C9.89464 8.48043 10 8.73478 10 9C10 9.26522 9.89464 9.51957 9.70711 9.70711L5.70711 13.7071C5.31658 14.0976 4.68342 14.0976 4.29289 13.7071C3.90237 13.3166 3.90237 12.6834 4.29289 12.2929L7.58579 9L4.29289 5.70711C3.90237 5.31658 3.90237 4.68342 4.29289 4.29289ZM9 13C9 12.4477 9.44771 12 10 12H15C15.5523 12 16 12.4477 16 13C16 13.5523 15.5523 14 15 14H10C9.44771 14 9 13.5523 9 13Z"/></svg>`)),key:"backend_developer"},{property:"is_front_end_developer",icon:s(p||(p=u`<svg class="fill-current h-full w-full" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M14.2747 4.03847C14.8058 4.1902 15.1132 4.74368 14.9615 5.27472L10.9615 19.2747C10.8098 19.8058 10.2563 20.1132 9.72528 19.9615C9.19424 19.8098 8.88675 19.2563 9.03848 18.7253L13.0385 4.72528C13.1902 4.19424 13.7437 3.88675 14.2747 4.03847ZM6.70711 7.29289C7.09763 7.68342 7.09763 8.31658 6.70711 8.7071L3.41421 12L6.70711 15.2929C7.09763 15.6834 7.09763 16.3166 6.70711 16.7071C6.31658 17.0976 5.68342 17.0976 5.29289 16.7071L1.29289 12.7071C0.902369 12.3166 0.902369 11.6834 1.29289 11.2929L5.29289 7.29289C5.68342 6.90237 6.31658 6.90237 6.70711 7.29289ZM17.2929 7.29289C17.6834 6.90237 18.3166 6.90237 18.7071 7.29289L22.7071 11.2929C22.8946 11.4804 23 11.7348 23 12C23 12.2652 22.8946 12.5196 22.7071 12.7071L18.7071 16.7071C18.3166 17.0976 17.6834 17.0976 17.2929 16.7071C16.9024 16.3166 16.9024 15.6834 17.2929 15.2929L20.5858 12L17.2929 8.70711C16.9024 8.31658 16.9024 7.68342 17.2929 7.29289Z" /></svg>`)),key:"frontend_developer"},{property:"is_designer",icon:s(g||(g=u`<svg class="fill-current h-full w-full" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10 20C4.49 20 0 15.51 0 10C0 4.49 4.49 0 10 0C15.51 0 20 4.04 20 9C20 12.31 17.31 15 14 15H12.23C11.95 15 11.73 15.22 11.73 15.5C11.73 15.62 11.78 15.73 11.86 15.83C12.27 16.3 12.5 16.89 12.5 17.5C12.5 18.88 11.38 20 10 20ZM10 2C5.59 2 2 5.59 2 10C2 14.41 5.59 18 10 18C10.28 18 10.5 17.78 10.5 17.5C10.5 17.34 10.42 17.22 10.36 17.15C9.95 16.69 9.73 16.1 9.73 15.5C9.73 14.12 10.85 13 12.23 13H14C16.21 13 18 11.21 18 9C18 5.14 14.41 2 10 2Z" /><path d="M4.5 11C5.32843 11 6 10.3284 6 9.5C6 8.67157 5.32843 8 4.5 8C3.67157 8 3 8.67157 3 9.5C3 10.3284 3.67157 11 4.5 11Z" /><path d="M7.5 7C8.32843 7 9 6.32843 9 5.5C9 4.67157 8.32843 4 7.5 4C6.67157 4 6 4.67157 6 5.5C6 6.32843 6.67157 7 7.5 7Z" /><path d="M12.5 7C13.3284 7 14 6.32843 14 5.5C14 4.67157 13.3284 4 12.5 4C11.6716 4 11 4.67157 11 5.5C11 6.32843 11.6716 7 12.5 7Z" /><path d="M15.5 11C16.3284 11 17 10.3284 17 9.5C17 8.67157 16.3284 8 15.5 8C14.6716 8 14 8.67157 14 9.5C14 10.3284 14.6716 11 15.5 11Z" /></svg>`)),key:"designer"}];let y,x,_,$=e=>e;const w=i(a(d(r(h,"user-form"))));class b extends w{constructor(){super(...arguments),this.__getValidator=n((e=>()=>!this.errors.some((s=>s.startsWith(e))))),this.__bindField=n((e=>s=>{const t=s.target;this.edit({[e]:t.value})}))}static get scopedElements(){return{"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-button":customElements.get("vaadin-button"),"foxy-spinner":customElements.get("foxy-spinner"),"x-checkbox":e,"foxy-i18n":customElements.get("foxy-i18n"),"x-group":l}}static get v8n(){return[({first_name:e})=>!e||e.length<=50||"first_name_too_long",({last_name:e})=>!e||e.length<=50||"last_name_too_long",({email:e})=>e&&e.length>0||"email_required",({email:e})=>e&&e.length<=100||"email_too_long",({email:e})=>e&&c(e)||"email_invalid_email",({phone:e})=>!e||e.length<=50||"phone_too_long"]}render(){var e,s;const i=this.in({idle:{template:{dirty:"valid"}}}),a=this.in({idle:{snapshot:{dirty:"valid"}}}),r=i||a,n=this.in("busy"),l=this.in("fail"),d=n||l||this.disabled;return t(y||(y=$` <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <div data-testid="wrapper" aria-busy="${0}" aria-live="polite" class="space-y-l relative"> <div class="grid grid-cols-1 sm-grid-cols-2 gap-m"> ${0} </div> <x-group frame> ${0} </x-group> <vaadin-button data-testid="action" theme="${0}" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> </vaadin-button> <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.lang,this.ns,this.__handleConfirmHide,this.in("busy"),["first_name","last_name","email","phone"].map((e=>t(x||(x=$` <vaadin-text-field error-message="${0}" data-testid="${0}" ?disabled="${0}" ?readonly="${0}" class="w-full" label="${0}" value="${0}" .checkValidity="${0}" @input="${0}" @keydown="${0}"> </vaadin-text-field> `),this.__getErrorMessage(e),e,d,this.readonly,this.t(e),m(this.form[e]),this.__getValidator(e),this.__bindField(e),this.__handleKeyDown))),v.map(((e,s)=>t(_||(_=$` <hr class="${0}" style="margin-left:calc((var(--lumo-space-m) * 2) + 1.125rem)"> <x-checkbox class="w-full p-m" ?readonly="${0}" ?disabled="${0}" ?checked="${0}" @change="${0}"> <div class="flex items-start leading-s"> <div class="flex-1 flex flex-col"> <foxy-i18n key="${0}" lang="${0}" ns="${0}"></foxy-i18n> <foxy-i18n class="text-s text-secondary" lang="${0}" key="${0}_explainer" ns="${0}"> </foxy-i18n> </div> <div class="mt-xs" style="width:1.125rem;height:1.125rem">${0}</div> </div> </x-checkbox> `),s>0?"border-contrast-10":"hidden",this.readonly,d,this.form[e.property],(s=>{const t=s.target;this.edit({[e.property]:t.checked})}),e.key,this.lang,this.ns,this.lang,e.key,this.ns,e.icon))),this.in("idle")?"primary "+(this.href?"error":"success"):"",this.in({idle:"template"})&&!r||d,this.__handleActionClick,this.lang,this.href?"delete":"create",this.ns,o({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!n&&!l}),l?"error":n?"busy":"empty",this.lang,this.ns,null!==(s=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==s?s:"")}__getErrorMessage(e){const s=this.errors.find((s=>s.startsWith(e)));return s?this.t(s.replace(e,"v8n")):""}__handleActionClick(e){if(this.in({idle:"snapshot"})){this.renderRoot.querySelector("#confirm").show(e.currentTarget)}else this.submit()}__handleConfirmHide(e){e.detail.cancelled||this.delete()}__handleKeyDown(e){"Enter"===e.key&&this.submit()}}customElements.define("foxy-user-form",b);export{b as U,v as r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./foxy-spinner.js";import"./shared-7a084a40.js";import"./shared-73cfd096.js";import{I as e,_ as t}from"./shared-2eee69db.js";import{L as n,r as i,h as r,c as s}from"./shared-dc73b9a5.js";import{C as a}from"./shared-58a9174f.js";import{a as o,T as l}from"./shared-855a1983.js";import{N as d}from"./shared-25ef9e09.js";import"./shared-cea659c8.js";import{P as c}from"./shared-6eb57269.js";import{c as p}from"./shared-4e709717.js";let u,h,m,f,y=e=>e;class v extends(a(o(l(e(n))))){constructor(){super(...arguments),this.nucleon=null,this.infer=""}static get inferredProperties(){return[...super.inferredProperties,"nucleon"]}static get properties(){return t(t({},super.properties),{},{nucleon:{attribute:!1}})}inferFromElement(e,t){return"nucleon"===e&&t instanceof d?t:super.inferFromElement(e,t)}applyInferredProperties(e){var t;super.applyInferredProperties(e),this.nucleon=null!==(t=e.get("nucleon"))&&void 0!==t?t:null}updated(e){super.updated(e),this.style.display=this.hidden?"none":"",i(r(u||(u=y` <slot name="${0}:before" slot="before"></slot> <slot name="${0}:after" slot="after"></slot> `),this.infer,this.infer),this)}renderControl(){return r(h||(h=y``))}render(){return this.hidden?r(m||(m=y``)):r(f||(f=y` ${0} ${0} ${0} `),this.renderTemplateOrSlot("before",this.nucleon),this.renderControl(),this.renderTemplateOrSlot("after",this.nucleon))}}let x,g=e=>e;customElements.define("foxy-internal-delete-control",class extends v{constructor(){super(...arguments),this.infer="delete",this.theme="primary error"}static get properties(){return t(t({},super.properties),{},{theme:{type:String}})}renderControl(){return r(x||(x=g` <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <vaadin-button data-testid="delete" theme="${0}" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="delete" lang="${0}"></foxy-i18n> </vaadin-button> `),this.lang,this.ns,(e=>{var t;return!e.detail.cancelled&&(null===(t=this.nucleon)||void 0===t?void 0:t.delete())}),this.theme,this.disabled||this.readonly,(e=>{this.renderRoot.querySelector("#confirm").show(e.currentTarget)}),this.ns,this.lang)}});let _,$=e=>e;customElements.define("foxy-internal-create-control",class extends v{constructor(){super(...arguments),this.theme="primary success"}static get properties(){return t(t({},super.properties),{},{theme:{type:String}})}renderControl(){return r(_||(_=$` <vaadin-button class="w-full" theme="${0}" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="create"></foxy-i18n> </vaadin-button> `),this.theme,this.disabled||this.__isInvalid,(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.submit()}))}get __isCleanTemplateInvalid(){var e;return!!(null===(e=this.nucleon)||void 0===e?void 0:e.in({idle:{template:{clean:"invalid"}}}))}get __isDirtyTemplateInvalid(){var e;return!!(null===(e=this.nucleon)||void 0===e?void 0:e.in({idle:{template:{dirty:"invalid"}}}))}get __isCleanSnapshotInvalid(){var e;return!!(null===(e=this.nucleon)||void 0===e?void 0:e.in({idle:{snapshot:{clean:"invalid"}}}))}get __isDirtySnapshotInvalid(){var e;return!!(null===(e=this.nucleon)||void 0===e?void 0:e.in({idle:{snapshot:{dirty:"invalid"}}}))}get __isTemplateInvalid(){return this.__isCleanTemplateInvalid||this.__isDirtyTemplateInvalid}get __isSnapshotInvalid(){return this.__isCleanSnapshotInvalid||this.__isDirtySnapshotInvalid}get __isInvalid(){return this.__isSnapshotInvalid||this.__isTemplateInvalid}});let b,I,w=e=>e;customElements.define("foxy-internal-timestamps-control",class extends v{constructor(){super(...arguments),this.infer="timestamps"}static get styles(){return[super.styles,s(b||(b=w`.max-w-0{max-width:0}`))]}renderControl(){return r(I||(I=w` <table class="font-lumo text-m leading-m w-full"> <tbody class="divide-y divide-contrast-10"> <tr> <td class="max-w-0 truncate py-s text-secondary w-1-3 pr-m"> <foxy-i18n lang="${0}" key="date_created" ns="${0}"></foxy-i18n> </td> <td class="max-w-0 truncate py-s text-body w-2-3"> <foxy-i18n options="${0}" lang="${0}" key="date" ns="${0}"> </foxy-i18n> </td> </tr> <tr> <td class="max-w-0 truncate py-s text-secondary w-1-3 pr-m"> <foxy-i18n lang="${0}" key="date_modified" ns="${0}"></foxy-i18n> </td> <td class="max-w-0 truncate py-s text-body w-2-3"> <foxy-i18n options="${0}" lang="${0}" key="date" ns="${0}"> </foxy-i18n> </td> </tr> </tbody> </table> `),this.lang,this.ns,JSON.stringify({value:c(this,"nucleon.form.date_created")}),this.lang,this.ns,this.lang,this.ns,JSON.stringify({value:c(this,"nucleon.form.date_modified")}),this.lang,this.ns)}});let S,j,C,T=e=>e;const k=a(l(d));class E extends k{renderBody(){return this.data?r(S||(S=T` <foxy-internal-timestamps-control infer="timestamps"></foxy-internal-timestamps-control> <foxy-internal-delete-control infer="delete"></foxy-internal-delete-control> `)):r(j||(j=T`<foxy-internal-create-control infer="create"></foxy-internal-create-control>`))}render(){const e=!(this.in("idle")||this.in({busy:"fetching"})&&this.data);return r(C||(C=T` <div aria-busy="${0}" aria-live="polite" class="relative"> <div class="${0}"> ${0} </div> <div class="${0}"> <foxy-spinner layout="${0}" class="m-auto" state="${0}" infer="spinner"> </foxy-spinner> </div> </div> `),this.in("busy"),p({"grid grid-cols-1 gap-m":!0,"transition-opacity":!0,"opacity-0 pointer-events-none":e}),this.renderBody(),p({"transition-opacity absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!e}),this.in("fail")?"vertical":"no-label",this.in("fail")?"error":"busy")}}customElements.define("foxy-internal-form",E);export{E as I,v as a};
|