@nymbalhq/web-components 1.3.0 → 1.4.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/chunk-5IO2QUHO.js +155 -0
- package/dist/chunk-5IO2QUHO.js.map +1 -0
- package/dist/chunk-ALPHUJIM.js +155 -0
- package/dist/chunk-ALPHUJIM.js.map +1 -0
- package/dist/chunk-T74ECICK.js +143 -0
- package/dist/chunk-T74ECICK.js.map +1 -0
- package/dist/{chunk-5G3C53A2.js → chunk-YQEMZOJL.js} +11 -8
- package/dist/chunk-YQEMZOJL.js.map +1 -0
- package/dist/{chunk-XPFGMYBV.js → chunk-YXAE7NDX.js} +31 -19
- package/dist/chunk-YXAE7NDX.js.map +1 -0
- package/dist/elements/nymbal-checkout.d.ts +4 -1
- package/dist/elements/nymbal-checkout.js +1 -1
- package/dist/elements/nymbal-notify-me.d.ts +29 -0
- package/dist/elements/nymbal-notify-me.js +13 -0
- package/dist/elements/nymbal-notify-me.js.map +1 -0
- package/dist/elements/nymbal-order-timeline.d.ts +16 -0
- package/dist/elements/nymbal-order-timeline.js +10 -0
- package/dist/elements/nymbal-order-timeline.js.map +1 -0
- package/dist/elements/nymbal-recently-viewed.d.ts +41 -0
- package/dist/elements/nymbal-recently-viewed.js +13 -0
- package/dist/elements/nymbal-recently-viewed.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +31 -19
- package/dist/register-components.d.ts +4 -1
- package/dist/register-components.js +12 -9
- package/dist/ssr/index.js +12 -9
- package/dist/ssr/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-5G3C53A2.js.map +0 -1
- package/dist/chunk-XPFGMYBV.js.map +0 -1
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
import '@lit-labs/ssr-client/lit-element-hydrate-support.js'
|
|
2
|
+
import {
|
|
3
|
+
NymbalSortDropdown
|
|
4
|
+
} from "./chunk-EBMA7JGV.js";
|
|
5
|
+
import {
|
|
6
|
+
NymbalStockBadge
|
|
7
|
+
} from "./chunk-O2YKCDR2.js";
|
|
8
|
+
import {
|
|
9
|
+
NymbalToast
|
|
10
|
+
} from "./chunk-2TPQNQYO.js";
|
|
2
11
|
import {
|
|
3
12
|
NymbalVariantSelector
|
|
4
13
|
} from "./chunk-H3ZBYNHV.js";
|
|
14
|
+
import {
|
|
15
|
+
NymbalRecentlyViewed
|
|
16
|
+
} from "./chunk-T74ECICK.js";
|
|
17
|
+
import {
|
|
18
|
+
NymbalRegisterForm
|
|
19
|
+
} from "./chunk-NW47OJVN.js";
|
|
20
|
+
import {
|
|
21
|
+
NymbalReviewForm
|
|
22
|
+
} from "./chunk-NE6UHTOT.js";
|
|
5
23
|
import {
|
|
6
24
|
NymbalReviewList
|
|
7
25
|
} from "./chunk-7JAAOVCE.js";
|
|
@@ -18,14 +36,11 @@ import {
|
|
|
18
36
|
NymbalSiteHeader
|
|
19
37
|
} from "./chunk-W23P7SI4.js";
|
|
20
38
|
import {
|
|
21
|
-
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import {
|
|
24
|
-
NymbalStockBadge
|
|
25
|
-
} from "./chunk-O2YKCDR2.js";
|
|
39
|
+
NymbalOrderTimeline
|
|
40
|
+
} from "./chunk-ALPHUJIM.js";
|
|
26
41
|
import {
|
|
27
|
-
|
|
28
|
-
} from "./chunk-
|
|
42
|
+
NymbalPaymentElement
|
|
43
|
+
} from "./chunk-W7D3STJH.js";
|
|
29
44
|
import {
|
|
30
45
|
NymbalProductFilter
|
|
31
46
|
} from "./chunk-WEEHXWM3.js";
|
|
@@ -41,12 +56,6 @@ import {
|
|
|
41
56
|
import {
|
|
42
57
|
NymbalProfileForm
|
|
43
58
|
} from "./chunk-WTEVTCIL.js";
|
|
44
|
-
import {
|
|
45
|
-
NymbalRegisterForm
|
|
46
|
-
} from "./chunk-NW47OJVN.js";
|
|
47
|
-
import {
|
|
48
|
-
NymbalReviewForm
|
|
49
|
-
} from "./chunk-NE6UHTOT.js";
|
|
50
59
|
import {
|
|
51
60
|
NymbalCartPage
|
|
52
61
|
} from "./chunk-VTQVGNVC.js";
|
|
@@ -58,7 +67,7 @@ import {
|
|
|
58
67
|
} from "./chunk-IYT7VXFS.js";
|
|
59
68
|
import {
|
|
60
69
|
NymbalCheckout
|
|
61
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-YQEMZOJL.js";
|
|
62
71
|
import {
|
|
63
72
|
NymbalImageGallery
|
|
64
73
|
} from "./chunk-U2PU4CWB.js";
|
|
@@ -68,12 +77,12 @@ import {
|
|
|
68
77
|
import {
|
|
69
78
|
NymbalMiniCart
|
|
70
79
|
} from "./chunk-2XXBQPDB.js";
|
|
80
|
+
import {
|
|
81
|
+
NymbalNotifyMe
|
|
82
|
+
} from "./chunk-5IO2QUHO.js";
|
|
71
83
|
import {
|
|
72
84
|
NymbalOrderSummary
|
|
73
85
|
} from "./chunk-SM7TASEW.js";
|
|
74
|
-
import {
|
|
75
|
-
NymbalPaymentElement
|
|
76
|
-
} from "./chunk-W7D3STJH.js";
|
|
77
86
|
import {
|
|
78
87
|
NymbalAddToCart
|
|
79
88
|
} from "./chunk-LHYXNQWY.js";
|
|
@@ -115,6 +124,7 @@ var ELEMENTS = [
|
|
|
115
124
|
NymbalAddressBook,
|
|
116
125
|
NymbalCheckout,
|
|
117
126
|
NymbalProductGrid,
|
|
127
|
+
NymbalRecentlyViewed,
|
|
118
128
|
NymbalProductPrice,
|
|
119
129
|
NymbalStockBadge,
|
|
120
130
|
NymbalBreadcrumb,
|
|
@@ -124,7 +134,9 @@ var ELEMENTS = [
|
|
|
124
134
|
NymbalCategoryNav,
|
|
125
135
|
NymbalReviewList,
|
|
126
136
|
NymbalReviewForm,
|
|
127
|
-
NymbalOrderSummary
|
|
137
|
+
NymbalOrderSummary,
|
|
138
|
+
NymbalNotifyMe,
|
|
139
|
+
NymbalOrderTimeline
|
|
128
140
|
];
|
|
129
141
|
function registerComponents() {
|
|
130
142
|
define(...ELEMENTS);
|
|
@@ -134,4 +146,4 @@ export {
|
|
|
134
146
|
ELEMENTS,
|
|
135
147
|
registerComponents
|
|
136
148
|
};
|
|
137
|
-
//# sourceMappingURL=chunk-
|
|
149
|
+
//# sourceMappingURL=chunk-YXAE7NDX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/register-components.ts"],"sourcesContent":["import './hydrate-support.js'\nimport { define } from './define.js'\nimport { NymbalAddToCart } from './components/add-to-cart.js'\nimport { NymbalCartDrawer } from './components/cart-drawer.js'\nimport { NymbalMiniCart } from './components/mini-cart.js'\nimport { NymbalVariantSelector } from './components/variant-selector.js'\nimport { NymbalQuantitySelector } from './components/quantity-selector.js'\nimport { NymbalSearchBar } from './components/search-bar.js'\nimport { NymbalProductFilter } from './components/product-filter.js'\nimport { NymbalToast } from './components/toast.js'\nimport { NymbalPaymentElement } from './components/payment-element.js'\nimport { NymbalSortDropdown } from './components/sort-dropdown.js'\nimport { NymbalCartPage } from './components/cart-page.js'\nimport { NymbalProductCard } from './components/product-card.js'\nimport { NymbalSearchResults } from './components/search-results.js'\nimport { NymbalLoginForm } from './components/login-form.js'\nimport { NymbalRegisterForm } from './components/register-form.js'\nimport { NymbalProfileForm } from './components/profile-form.js'\nimport { NymbalAddressForm } from './components/address-form.js'\nimport { NymbalAddressBook } from './components/address-book.js'\nimport { NymbalCheckout } from './components/checkout.js'\nimport { NymbalProductGrid } from './components/product-grid.js'\nimport { NymbalRecentlyViewed } from './components/recently-viewed.js'\nimport { NymbalProductPrice } from './components/product-price.js'\nimport { NymbalStockBadge } from './components/stock-badge.js'\nimport { NymbalBreadcrumb } from './components/breadcrumb.js'\nimport { NymbalImageGallery } from './components/image-gallery.js'\nimport { NymbalSiteHeader } from './components/site-header.js'\nimport { NymbalSiteFooter } from './components/site-footer.js'\nimport { NymbalCategoryNav } from './components/category-nav.js'\nimport { NymbalReviewList } from './components/review-list.js'\nimport { NymbalReviewForm } from './components/review-form.js'\nimport { NymbalOrderSummary } from './components/order-summary.js'\nimport { NymbalNotifyMe } from './components/notify-me.js'\nimport { NymbalOrderTimeline } from './components/order-timeline.js'\n\n/** Every element the package defines. */\nexport const ELEMENTS = [\n NymbalAddToCart,\n NymbalCartDrawer,\n NymbalMiniCart,\n NymbalVariantSelector,\n NymbalQuantitySelector,\n NymbalSearchBar,\n NymbalProductFilter,\n NymbalToast,\n NymbalPaymentElement,\n NymbalSortDropdown,\n NymbalCartPage,\n NymbalProductCard,\n NymbalSearchResults,\n NymbalLoginForm,\n NymbalRegisterForm,\n NymbalProfileForm,\n NymbalAddressForm,\n NymbalAddressBook,\n NymbalCheckout,\n NymbalProductGrid,\n NymbalRecentlyViewed,\n NymbalProductPrice,\n NymbalStockBadge,\n NymbalBreadcrumb,\n NymbalImageGallery,\n NymbalSiteHeader,\n NymbalSiteFooter,\n NymbalCategoryNav,\n NymbalReviewList,\n NymbalReviewForm,\n NymbalOrderSummary,\n NymbalNotifyMe,\n NymbalOrderTimeline,\n]\n\n/**\n * Defines every element, and registers the built-in payment drivers, except a tag or driver name the project has\n * already defined: the project's wins. A page that renders a few elements passes those to `define` instead.\n */\nexport function registerComponents(): void {\n define(...ELEMENTS)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCO,IAAM,WAAW;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAMO,SAAS,qBAA2B;AACzC,SAAO,GAAG,QAAQ;AACpB;","names":[]}
|
|
@@ -61,7 +61,10 @@ declare class NymbalCheckout extends NymbalElement {
|
|
|
61
61
|
private place;
|
|
62
62
|
private confirm;
|
|
63
63
|
private stay;
|
|
64
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* Place Order stays disabled from here through the page's navigation. `orderKey`, when the answer carried one, lets
|
|
66
|
+
* the order's page read it with no session.
|
|
67
|
+
*/
|
|
65
68
|
private leaveFor;
|
|
66
69
|
private readonly onBillingSame;
|
|
67
70
|
private back;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as lit from 'lit';
|
|
2
|
+
import { nothing } from 'lit';
|
|
3
|
+
import { ElementSchema } from '../index.js';
|
|
4
|
+
import { N as NymbalVariantElement } from '../selected-variant-Dym0shlJ.js';
|
|
5
|
+
import '@nymbalhq/sdk';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The alert form for the variant the page shows: "email me when it's back" for an out-of-stock variant, "email me if
|
|
9
|
+
* the price drops" for an in-stock one. One subscribe per submission: `requestSubmit()` and Enter fire `submit` while
|
|
10
|
+
* the button is disabled, so the pending flag, not the button, is the guard (as `NymbalFormElement`'s). An accepted
|
|
11
|
+
* request stays accepted for its variant and kind, so a second click cannot send a second confirmation.
|
|
12
|
+
*/
|
|
13
|
+
declare class NymbalNotifyMe extends NymbalVariantElement {
|
|
14
|
+
static schema: ElementSchema;
|
|
15
|
+
static properties: lit.PropertyDeclarations;
|
|
16
|
+
static styles: lit.CSSResult[];
|
|
17
|
+
variantId: string | undefined;
|
|
18
|
+
stock: number | undefined;
|
|
19
|
+
private pending;
|
|
20
|
+
private error;
|
|
21
|
+
/** `${variantId}:${kind}` of each accepted request. */
|
|
22
|
+
private readonly acceptedFor;
|
|
23
|
+
/** The variant the form is for and its stock: the store's selected one once it holds this product. */
|
|
24
|
+
private followed;
|
|
25
|
+
private readonly onSubmit;
|
|
26
|
+
protected render(): typeof nothing | lit.TemplateResult<1>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { NymbalNotifyMe };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import '@lit-labs/ssr-client/lit-element-hydrate-support.js'
|
|
2
|
+
import {
|
|
3
|
+
NymbalNotifyMe
|
|
4
|
+
} from "../chunk-5IO2QUHO.js";
|
|
5
|
+
import "../chunk-UYSZOEOA.js";
|
|
6
|
+
import "../chunk-PN6QKYE4.js";
|
|
7
|
+
import "../chunk-GHXTJ2CF.js";
|
|
8
|
+
import "../chunk-EYDMJNNK.js";
|
|
9
|
+
import "../chunk-UCEVCLQ7.js";
|
|
10
|
+
export {
|
|
11
|
+
NymbalNotifyMe
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=nymbal-notify-me.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as lit from 'lit';
|
|
2
|
+
import { nothing } from 'lit';
|
|
3
|
+
import { NymbalElement, ElementSchema } from '../index.js';
|
|
4
|
+
import '@nymbalhq/sdk';
|
|
5
|
+
|
|
6
|
+
/** What has happened to an order, oldest first, each entry with its time; the last is the order's current step. */
|
|
7
|
+
declare class NymbalOrderTimeline extends NymbalElement {
|
|
8
|
+
static schema: ElementSchema;
|
|
9
|
+
static properties: lit.PropertyDeclarations;
|
|
10
|
+
static styles: lit.CSSResult[];
|
|
11
|
+
entries: unknown;
|
|
12
|
+
timeZone: string | undefined;
|
|
13
|
+
protected render(): typeof nothing | lit.TemplateResult<1>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { NymbalOrderTimeline };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import '@lit-labs/ssr-client/lit-element-hydrate-support.js'
|
|
2
|
+
import {
|
|
3
|
+
NymbalOrderTimeline
|
|
4
|
+
} from "../chunk-ALPHUJIM.js";
|
|
5
|
+
import "../chunk-EYDMJNNK.js";
|
|
6
|
+
import "../chunk-UCEVCLQ7.js";
|
|
7
|
+
export {
|
|
8
|
+
NymbalOrderTimeline
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=nymbal-order-timeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as lit from 'lit';
|
|
2
|
+
import { PropertyValues, nothing } from 'lit';
|
|
3
|
+
import { NymbalElement, ElementSchema } from '../index.js';
|
|
4
|
+
import { cardProductOf } from '../ssr/index.js';
|
|
5
|
+
import { NymbalProductCard } from './nymbal-product-card.js';
|
|
6
|
+
import '@nymbalhq/sdk';
|
|
7
|
+
|
|
8
|
+
type Listed = Parameters<typeof cardProductOf>[0] & {
|
|
9
|
+
id: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The shopper's recently viewed products, from the store: one page view records `current` once, then reads the list
|
|
13
|
+
* once. It renders nothing until the list has something besides `current`, and nothing without a client (a server).
|
|
14
|
+
*/
|
|
15
|
+
declare class NymbalRecentlyViewed extends NymbalElement {
|
|
16
|
+
static schema: ElementSchema;
|
|
17
|
+
static uses: (typeof NymbalProductCard)[];
|
|
18
|
+
static properties: {
|
|
19
|
+
listed: {
|
|
20
|
+
state: boolean;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
static styles: lit.CSSResult[];
|
|
24
|
+
current: string | undefined;
|
|
25
|
+
limit: number | undefined;
|
|
26
|
+
listed: Listed[];
|
|
27
|
+
/** The last `current` recorded: a re-render, a reconnect or the same value again records nothing. */
|
|
28
|
+
private recorded;
|
|
29
|
+
private started;
|
|
30
|
+
/** Reads run one after another, so each new `current` is recorded before the list it changes is read. */
|
|
31
|
+
private reads;
|
|
32
|
+
constructor();
|
|
33
|
+
private get shown();
|
|
34
|
+
/** After the first update, so a `current` set as the element connects is recorded before the first read. */
|
|
35
|
+
protected updated(changed: PropertyValues): void;
|
|
36
|
+
private queueRead;
|
|
37
|
+
private read;
|
|
38
|
+
protected render(): typeof nothing | lit.TemplateResult<1>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { NymbalRecentlyViewed };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import '@lit-labs/ssr-client/lit-element-hydrate-support.js'
|
|
2
|
+
import {
|
|
3
|
+
NymbalRecentlyViewed
|
|
4
|
+
} from "../chunk-T74ECICK.js";
|
|
5
|
+
import "../chunk-RZVFA3N5.js";
|
|
6
|
+
import "../chunk-RVSKX2RX.js";
|
|
7
|
+
import "../chunk-LO2EW5YP.js";
|
|
8
|
+
import "../chunk-EYDMJNNK.js";
|
|
9
|
+
import "../chunk-UCEVCLQ7.js";
|
|
10
|
+
export {
|
|
11
|
+
NymbalRecentlyViewed
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=nymbal-recently-viewed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,9 @@ export { NymbalCategoryNav } from './elements/nymbal-category-nav.js';
|
|
|
31
31
|
export { NymbalReviewList } from './elements/nymbal-review-list.js';
|
|
32
32
|
export { NymbalReviewForm } from './elements/nymbal-review-form.js';
|
|
33
33
|
export { NymbalOrderSummary } from './elements/nymbal-order-summary.js';
|
|
34
|
+
export { NymbalNotifyMe } from './elements/nymbal-notify-me.js';
|
|
35
|
+
export { NymbalOrderTimeline } from './elements/nymbal-order-timeline.js';
|
|
36
|
+
export { NymbalRecentlyViewed } from './elements/nymbal-recently-viewed.js';
|
|
34
37
|
import 'lit';
|
|
35
38
|
import './form-element-C-qo3gpD.js';
|
|
36
39
|
import '@nymbalhq/types';
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
import '@lit-labs/ssr-client/lit-element-hydrate-support.js'
|
|
2
2
|
import {
|
|
3
3
|
registerComponents
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YXAE7NDX.js";
|
|
5
|
+
import {
|
|
6
|
+
NymbalSortDropdown
|
|
7
|
+
} from "./chunk-EBMA7JGV.js";
|
|
8
|
+
import {
|
|
9
|
+
NymbalStockBadge
|
|
10
|
+
} from "./chunk-O2YKCDR2.js";
|
|
11
|
+
import {
|
|
12
|
+
NymbalToast
|
|
13
|
+
} from "./chunk-2TPQNQYO.js";
|
|
5
14
|
import {
|
|
6
15
|
NymbalVariantSelector
|
|
7
16
|
} from "./chunk-H3ZBYNHV.js";
|
|
17
|
+
import {
|
|
18
|
+
NymbalRecentlyViewed
|
|
19
|
+
} from "./chunk-T74ECICK.js";
|
|
20
|
+
import {
|
|
21
|
+
NymbalRegisterForm
|
|
22
|
+
} from "./chunk-NW47OJVN.js";
|
|
23
|
+
import {
|
|
24
|
+
NymbalReviewForm
|
|
25
|
+
} from "./chunk-NE6UHTOT.js";
|
|
8
26
|
import {
|
|
9
27
|
NymbalReviewList
|
|
10
28
|
} from "./chunk-7JAAOVCE.js";
|
|
@@ -21,14 +39,11 @@ import {
|
|
|
21
39
|
NymbalSiteHeader
|
|
22
40
|
} from "./chunk-W23P7SI4.js";
|
|
23
41
|
import {
|
|
24
|
-
|
|
25
|
-
} from "./chunk-
|
|
42
|
+
NymbalOrderTimeline
|
|
43
|
+
} from "./chunk-ALPHUJIM.js";
|
|
26
44
|
import {
|
|
27
|
-
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import {
|
|
30
|
-
NymbalToast
|
|
31
|
-
} from "./chunk-2TPQNQYO.js";
|
|
45
|
+
NymbalPaymentElement
|
|
46
|
+
} from "./chunk-W7D3STJH.js";
|
|
32
47
|
import {
|
|
33
48
|
NymbalProductFilter
|
|
34
49
|
} from "./chunk-WEEHXWM3.js";
|
|
@@ -41,16 +56,9 @@ import {
|
|
|
41
56
|
import {
|
|
42
57
|
NymbalProductPrice
|
|
43
58
|
} from "./chunk-DXWMNB5F.js";
|
|
44
|
-
import "./chunk-UYSZOEOA.js";
|
|
45
59
|
import {
|
|
46
60
|
NymbalProfileForm
|
|
47
61
|
} from "./chunk-WTEVTCIL.js";
|
|
48
|
-
import {
|
|
49
|
-
NymbalRegisterForm
|
|
50
|
-
} from "./chunk-NW47OJVN.js";
|
|
51
|
-
import {
|
|
52
|
-
NymbalReviewForm
|
|
53
|
-
} from "./chunk-NE6UHTOT.js";
|
|
54
62
|
import {
|
|
55
63
|
NymbalCartPage
|
|
56
64
|
} from "./chunk-VTQVGNVC.js";
|
|
@@ -62,7 +70,7 @@ import {
|
|
|
62
70
|
} from "./chunk-IYT7VXFS.js";
|
|
63
71
|
import {
|
|
64
72
|
NymbalCheckout
|
|
65
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-YQEMZOJL.js";
|
|
66
74
|
import {
|
|
67
75
|
NymbalImageGallery
|
|
68
76
|
} from "./chunk-U2PU4CWB.js";
|
|
@@ -72,13 +80,14 @@ import {
|
|
|
72
80
|
import {
|
|
73
81
|
NymbalMiniCart
|
|
74
82
|
} from "./chunk-2XXBQPDB.js";
|
|
83
|
+
import {
|
|
84
|
+
NymbalNotifyMe
|
|
85
|
+
} from "./chunk-5IO2QUHO.js";
|
|
86
|
+
import "./chunk-UYSZOEOA.js";
|
|
75
87
|
import {
|
|
76
88
|
NymbalOrderSummary
|
|
77
89
|
} from "./chunk-SM7TASEW.js";
|
|
78
90
|
import "./chunk-RVSKX2RX.js";
|
|
79
|
-
import {
|
|
80
|
-
NymbalPaymentElement
|
|
81
|
-
} from "./chunk-W7D3STJH.js";
|
|
82
91
|
import {
|
|
83
92
|
NymbalAddToCart
|
|
84
93
|
} from "./chunk-LHYXNQWY.js";
|
|
@@ -118,7 +127,9 @@ export {
|
|
|
118
127
|
NymbalImageGallery,
|
|
119
128
|
NymbalLoginForm,
|
|
120
129
|
NymbalMiniCart,
|
|
130
|
+
NymbalNotifyMe,
|
|
121
131
|
NymbalOrderSummary,
|
|
132
|
+
NymbalOrderTimeline,
|
|
122
133
|
NymbalPaymentElement,
|
|
123
134
|
NymbalProductCard,
|
|
124
135
|
NymbalProductFilter,
|
|
@@ -126,6 +137,7 @@ export {
|
|
|
126
137
|
NymbalProductPrice,
|
|
127
138
|
NymbalProfileForm,
|
|
128
139
|
NymbalQuantitySelector,
|
|
140
|
+
NymbalRecentlyViewed,
|
|
129
141
|
NymbalRegisterForm,
|
|
130
142
|
NymbalReviewForm,
|
|
131
143
|
NymbalReviewList,
|
|
@@ -18,6 +18,7 @@ import { NymbalAddressForm } from './elements/nymbal-address-form.js';
|
|
|
18
18
|
import { NymbalAddressBook } from './elements/nymbal-address-book.js';
|
|
19
19
|
import { NymbalCheckout } from './elements/nymbal-checkout.js';
|
|
20
20
|
import { NymbalProductGrid } from './elements/nymbal-product-grid.js';
|
|
21
|
+
import { NymbalRecentlyViewed } from './elements/nymbal-recently-viewed.js';
|
|
21
22
|
import { NymbalProductPrice } from './elements/nymbal-product-price.js';
|
|
22
23
|
import { NymbalStockBadge } from './elements/nymbal-stock-badge.js';
|
|
23
24
|
import { NymbalBreadcrumb } from './elements/nymbal-breadcrumb.js';
|
|
@@ -28,6 +29,8 @@ import { NymbalCategoryNav } from './elements/nymbal-category-nav.js';
|
|
|
28
29
|
import { NymbalReviewList } from './elements/nymbal-review-list.js';
|
|
29
30
|
import { NymbalReviewForm } from './elements/nymbal-review-form.js';
|
|
30
31
|
import { NymbalOrderSummary } from './elements/nymbal-order-summary.js';
|
|
32
|
+
import { NymbalNotifyMe } from './elements/nymbal-notify-me.js';
|
|
33
|
+
import { NymbalOrderTimeline } from './elements/nymbal-order-timeline.js';
|
|
31
34
|
import '@nymbalhq/sdk';
|
|
32
35
|
import 'lit';
|
|
33
36
|
import './base-element-CPMgAdyQ.js';
|
|
@@ -36,7 +39,7 @@ import '@nymbalhq/types';
|
|
|
36
39
|
import './selected-variant-Dym0shlJ.js';
|
|
37
40
|
|
|
38
41
|
/** Every element the package defines. */
|
|
39
|
-
declare const ELEMENTS: (typeof NymbalAddToCart | typeof NymbalCartDrawer | typeof NymbalMiniCart | typeof NymbalVariantSelector | typeof NymbalQuantitySelector | typeof NymbalSearchBar | typeof NymbalProductFilter | typeof NymbalToast | typeof NymbalPaymentElement | typeof NymbalSortDropdown | typeof NymbalCartPage | typeof NymbalProductCard | typeof NymbalSearchResults | typeof NymbalLoginForm | typeof NymbalRegisterForm | typeof NymbalProfileForm | typeof NymbalAddressForm | typeof NymbalAddressBook | typeof NymbalCheckout | typeof NymbalProductGrid | typeof NymbalProductPrice | typeof NymbalStockBadge | typeof NymbalBreadcrumb | typeof NymbalImageGallery | typeof NymbalSiteHeader | typeof NymbalSiteFooter | typeof NymbalCategoryNav | typeof NymbalReviewList | typeof NymbalReviewForm | typeof NymbalOrderSummary)[];
|
|
42
|
+
declare const ELEMENTS: (typeof NymbalAddToCart | typeof NymbalCartDrawer | typeof NymbalMiniCart | typeof NymbalVariantSelector | typeof NymbalQuantitySelector | typeof NymbalSearchBar | typeof NymbalProductFilter | typeof NymbalToast | typeof NymbalPaymentElement | typeof NymbalSortDropdown | typeof NymbalCartPage | typeof NymbalProductCard | typeof NymbalSearchResults | typeof NymbalLoginForm | typeof NymbalRegisterForm | typeof NymbalProfileForm | typeof NymbalAddressForm | typeof NymbalAddressBook | typeof NymbalCheckout | typeof NymbalProductGrid | typeof NymbalRecentlyViewed | typeof NymbalProductPrice | typeof NymbalStockBadge | typeof NymbalBreadcrumb | typeof NymbalImageGallery | typeof NymbalSiteHeader | typeof NymbalSiteFooter | typeof NymbalCategoryNav | typeof NymbalReviewList | typeof NymbalReviewForm | typeof NymbalOrderSummary | typeof NymbalNotifyMe | typeof NymbalOrderTimeline)[];
|
|
40
43
|
/**
|
|
41
44
|
* Defines every element, and registers the built-in payment drivers, except a tag or driver name the project has
|
|
42
45
|
* already defined: the project's wins. A page that renders a few elements passes those to `define` instead.
|
|
@@ -2,34 +2,37 @@ import '@lit-labs/ssr-client/lit-element-hydrate-support.js'
|
|
|
2
2
|
import {
|
|
3
3
|
ELEMENTS,
|
|
4
4
|
registerComponents
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-YXAE7NDX.js";
|
|
6
|
+
import "./chunk-EBMA7JGV.js";
|
|
7
|
+
import "./chunk-O2YKCDR2.js";
|
|
8
|
+
import "./chunk-2TPQNQYO.js";
|
|
6
9
|
import "./chunk-H3ZBYNHV.js";
|
|
10
|
+
import "./chunk-T74ECICK.js";
|
|
11
|
+
import "./chunk-NW47OJVN.js";
|
|
12
|
+
import "./chunk-NE6UHTOT.js";
|
|
7
13
|
import "./chunk-7JAAOVCE.js";
|
|
8
14
|
import "./chunk-4COVK727.js";
|
|
9
15
|
import "./chunk-RAOGZH3Z.js";
|
|
10
16
|
import "./chunk-FIF6GQ6U.js";
|
|
11
17
|
import "./chunk-W23P7SI4.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-2TPQNQYO.js";
|
|
18
|
+
import "./chunk-ALPHUJIM.js";
|
|
19
|
+
import "./chunk-W7D3STJH.js";
|
|
15
20
|
import "./chunk-WEEHXWM3.js";
|
|
16
21
|
import "./chunk-5VWZ2U5K.js";
|
|
17
22
|
import "./chunk-RZVFA3N5.js";
|
|
18
23
|
import "./chunk-DXWMNB5F.js";
|
|
19
|
-
import "./chunk-UYSZOEOA.js";
|
|
20
24
|
import "./chunk-WTEVTCIL.js";
|
|
21
|
-
import "./chunk-NW47OJVN.js";
|
|
22
|
-
import "./chunk-NE6UHTOT.js";
|
|
23
25
|
import "./chunk-VTQVGNVC.js";
|
|
24
26
|
import "./chunk-HPBC3OG7.js";
|
|
25
27
|
import "./chunk-IYT7VXFS.js";
|
|
26
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-YQEMZOJL.js";
|
|
27
29
|
import "./chunk-U2PU4CWB.js";
|
|
28
30
|
import "./chunk-42SSME5H.js";
|
|
29
31
|
import "./chunk-2XXBQPDB.js";
|
|
32
|
+
import "./chunk-5IO2QUHO.js";
|
|
33
|
+
import "./chunk-UYSZOEOA.js";
|
|
30
34
|
import "./chunk-SM7TASEW.js";
|
|
31
35
|
import "./chunk-RVSKX2RX.js";
|
|
32
|
-
import "./chunk-W7D3STJH.js";
|
|
33
36
|
import "./chunk-LHYXNQWY.js";
|
|
34
37
|
import "./chunk-B73QVSA5.js";
|
|
35
38
|
import "./chunk-V55K2CS5.js";
|
package/dist/ssr/index.js
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import '@lit-labs/ssr-client/lit-element-hydrate-support.js'
|
|
2
2
|
import {
|
|
3
3
|
ELEMENTS
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-YXAE7NDX.js";
|
|
5
|
+
import "../chunk-EBMA7JGV.js";
|
|
6
|
+
import "../chunk-O2YKCDR2.js";
|
|
7
|
+
import "../chunk-2TPQNQYO.js";
|
|
5
8
|
import "../chunk-H3ZBYNHV.js";
|
|
9
|
+
import "../chunk-T74ECICK.js";
|
|
10
|
+
import "../chunk-NW47OJVN.js";
|
|
11
|
+
import "../chunk-NE6UHTOT.js";
|
|
6
12
|
import "../chunk-7JAAOVCE.js";
|
|
7
13
|
import "../chunk-4COVK727.js";
|
|
8
14
|
import "../chunk-RAOGZH3Z.js";
|
|
9
15
|
import "../chunk-FIF6GQ6U.js";
|
|
10
16
|
import "../chunk-W23P7SI4.js";
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-2TPQNQYO.js";
|
|
17
|
+
import "../chunk-ALPHUJIM.js";
|
|
18
|
+
import "../chunk-W7D3STJH.js";
|
|
14
19
|
import "../chunk-WEEHXWM3.js";
|
|
15
20
|
import "../chunk-5VWZ2U5K.js";
|
|
16
21
|
import {
|
|
@@ -18,20 +23,18 @@ import {
|
|
|
18
23
|
cardProductOf
|
|
19
24
|
} from "../chunk-RZVFA3N5.js";
|
|
20
25
|
import "../chunk-DXWMNB5F.js";
|
|
21
|
-
import "../chunk-UYSZOEOA.js";
|
|
22
26
|
import "../chunk-WTEVTCIL.js";
|
|
23
|
-
import "../chunk-NW47OJVN.js";
|
|
24
|
-
import "../chunk-NE6UHTOT.js";
|
|
25
27
|
import "../chunk-VTQVGNVC.js";
|
|
26
28
|
import "../chunk-HPBC3OG7.js";
|
|
27
29
|
import "../chunk-IYT7VXFS.js";
|
|
28
|
-
import "../chunk-
|
|
30
|
+
import "../chunk-YQEMZOJL.js";
|
|
29
31
|
import "../chunk-U2PU4CWB.js";
|
|
30
32
|
import "../chunk-42SSME5H.js";
|
|
31
33
|
import "../chunk-2XXBQPDB.js";
|
|
34
|
+
import "../chunk-5IO2QUHO.js";
|
|
35
|
+
import "../chunk-UYSZOEOA.js";
|
|
32
36
|
import "../chunk-SM7TASEW.js";
|
|
33
37
|
import "../chunk-RVSKX2RX.js";
|
|
34
|
-
import "../chunk-W7D3STJH.js";
|
|
35
38
|
import "../chunk-LHYXNQWY.js";
|
|
36
39
|
import "../chunk-B73QVSA5.js";
|
|
37
40
|
import "../chunk-V55K2CS5.js";
|
package/dist/ssr/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ssr/render-root.ts","../../src/ssr/index.ts"],"sourcesContent":["import { LitElement } from 'lit'\n\ntype WithRenderRoot = { createRenderRoot: () => HTMLElement | DocumentFragment }\n\n// Lit SSR replaces LitElement's createRenderRoot when it loads, dropping the hydrate support's, which is what makes a\n// client element take over a server's shadow root. A realm that both renders on the server and runs elements (a test,\n// a DOM-shimmed server) keeps the one it had: this module is imported before Lit SSR, and the ssr entry restores it.\nconst prototype = LitElement.prototype as unknown as WithRenderRoot\nconst createRenderRoot = prototype.createRenderRoot\n\nexport function restoreCreateRenderRoot(): void {\n prototype.createRenderRoot = createRenderRoot\n}\n","import { restoreCreateRenderRoot } from './render-root.js'\nimport type { RenderInfo } from '@lit-labs/ssr'\nimport { LitElementRenderer } from '@lit-labs/ssr/lib/lit-element-renderer.js'\nimport { collectResultSync } from '@lit-labs/ssr/lib/render-result.js'\nimport type { LitElement } from 'lit'\nimport { ELEMENTS } from '../register-components.js'\n\nexport { cardImageOf, cardProductOf, type CardProduct } from '../components/product-card.js'\n\nrestoreCreateRenderRoot()\n\n/** Thrown for a tag the server does not render: neither a package element nor one a project registered. */\nexport class UnknownElement extends Error {\n override name = 'UnknownElement'\n}\n\ntype LitElementClass = (new () => LitElement) & { _$litElement$?: boolean }\n\n/** Mounted by its payment driver in the browser, in the light DOM; a checkout's server render leaves its slot. */\nconst CLIENT_MOUNTED = new Set(['nymbal-payment-element'])\n\nconst PACKAGE = new Map<string, LitElementClass>(\n ELEMENTS.filter((e) => !CLIENT_MOUNTED.has(e.schema.tag)).map((e) => [\n e.schema.tag,\n e as unknown as LitElementClass,\n ]),\n)\n\n/** The project's elements by tag (its `serverElements`), which the server renders in place of the package's. */\nconst projectElements = new Map<string, LitElementClass>()\n\n/**\n * Registers a project's own element classes by tag, as its elements entry exports them: the server renders each in\n * place of the package's element under that tag, as the browser defines it there. A tag keeps the first class it was\n * registered with; a different class under it is refused, so the server and the browser cannot disagree.\n */\nexport function registerServerElements(map: Record<string, CustomElementConstructor>): void {\n for (const [tag, element] of Object.entries(map)) {\n const lit = element as unknown as LitElementClass\n if (lit._$litElement$ !== true) {\n throw new TypeError(`${tag}: the server renders Lit elements only`)\n }\n const registered = projectElements.get(tag)\n if (registered !== undefined && registered !== lit) {\n throw new Error(`${tag} is already registered for the server with another class`)\n }\n projectElements.set(tag, lit)\n }\n}\n\n/** The class the server renders under `tag`, resolved per call, so a registration after a first render wins. */\nfunction classFor(tag: string): LitElementClass | undefined {\n return projectElements.get(tag) ?? PACKAGE.get(tag)\n}\n\n/**\n * Lit SSR finds the elements a template renders, and constructs them, through `customElements`, which defines a tag\n * once per process. This renderer constructs the class `classFor` resolves instead, so a project's element renders\n * under its tag whatever `customElements` held first.\n */\nclass ServerElementRenderer extends LitElementRenderer {\n static override matchesClass(_ctor: typeof HTMLElement, tagName?: string): boolean {\n return tagName !== undefined && classFor(tagName) !== undefined\n }\n\n constructor(tagName: string) {\n super(tagName)\n const element = classFor(tagName)!\n if (this.element.constructor !== element) this.element = new element()\n }\n}\n\n/**\n * Every tag the server may render is known to `customElements`, which is where Lit SSR finds nested elements. A DOM\n * (not Lit's server shim) constructs only the classes it defined, so a project class whose tag already holds another\n * class is defined under a name of its own.\n */\nfunction defineAll(): void {\n for (const tag of new Set([...projectElements.keys(), ...PACKAGE.keys()])) {\n const element = classFor(tag)!\n if (customElements.get(tag) === undefined) customElements.define(tag, element)\n else if (customElements.getName(element) === null)\n customElements.define(`${tag}-server`, element)\n }\n}\n\n/**\n * The elements' styles, with their indentation collapsed: written for reading, they would otherwise be bytes a page\n * downloads before its first paint, once per element.\n */\nfunction compactStyles(html: string): string {\n return html.replace(\n /<style>([^<]*)<\\/style>/g,\n (_, css: string) => `<style>${css.replace(/\\s+/g, ' ').trim()}</style>`,\n )\n}\n\nexport interface RenderOptions {\n /** The host's attributes; a JSON attribute's value is its JSON text. */\n attributes?: Record<string, string> | undefined\n /** Light-DOM HTML after the shadow root: a slotted child, as the payment element is the checkout's. */\n children?: string | undefined\n}\n\n/**\n * One element as HTML: `<tag …attributes><template shadowrootmode=\"open\">…</template>…children</tag>`, the template\n * holding the element's first render from its attributes (no client, no store) with its styles, and the markers Lit's\n * hydration reads. The browser parses the template into the element's shadow root, and the element takes it over.\n */\nexport function renderElement(tag: string, options: RenderOptions = {}): string {\n if (CLIENT_MOUNTED.has(tag)) {\n throw new UnknownElement(`${tag} is client-mounted and is not server-rendered`)\n }\n if (classFor(tag) === undefined) {\n throw new UnknownElement(`${tag} is neither a Nymbal element nor a registered server element`)\n }\n defineAll()\n\n const renderer = new ServerElementRenderer(tag)\n for (const [name, value] of Object.entries(options.attributes ?? {})) {\n renderer.setAttribute(name, value)\n }\n renderer.connectedCallback()\n const renderInfo: RenderInfo = {\n elementRenderers: [ServerElementRenderer, LitElementRenderer],\n customElementInstanceStack: [renderer],\n customElementHostStack: [renderer],\n eventTargetStack: [renderer.element],\n slotStack: [],\n deferHydration: false,\n }\n const attributes = collectResultSync(renderer.renderAttributes())\n const shadow = compactStyles(collectResultSync(renderer.renderShadow(renderInfo)))\n const { mode = 'open' } = renderer.shadowRootOptions\n return `<${tag}${attributes}><template shadowrootmode=\"${mode}\">${shadow}</template>${options.children ?? ''}</${tag}>`\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/ssr/render-root.ts","../../src/ssr/index.ts"],"sourcesContent":["import { LitElement } from 'lit'\n\ntype WithRenderRoot = { createRenderRoot: () => HTMLElement | DocumentFragment }\n\n// Lit SSR replaces LitElement's createRenderRoot when it loads, dropping the hydrate support's, which is what makes a\n// client element take over a server's shadow root. A realm that both renders on the server and runs elements (a test,\n// a DOM-shimmed server) keeps the one it had: this module is imported before Lit SSR, and the ssr entry restores it.\nconst prototype = LitElement.prototype as unknown as WithRenderRoot\nconst createRenderRoot = prototype.createRenderRoot\n\nexport function restoreCreateRenderRoot(): void {\n prototype.createRenderRoot = createRenderRoot\n}\n","import { restoreCreateRenderRoot } from './render-root.js'\nimport type { RenderInfo } from '@lit-labs/ssr'\nimport { LitElementRenderer } from '@lit-labs/ssr/lib/lit-element-renderer.js'\nimport { collectResultSync } from '@lit-labs/ssr/lib/render-result.js'\nimport type { LitElement } from 'lit'\nimport { ELEMENTS } from '../register-components.js'\n\nexport { cardImageOf, cardProductOf, type CardProduct } from '../components/product-card.js'\n\nrestoreCreateRenderRoot()\n\n/** Thrown for a tag the server does not render: neither a package element nor one a project registered. */\nexport class UnknownElement extends Error {\n override name = 'UnknownElement'\n}\n\ntype LitElementClass = (new () => LitElement) & { _$litElement$?: boolean }\n\n/** Mounted by its payment driver in the browser, in the light DOM; a checkout's server render leaves its slot. */\nconst CLIENT_MOUNTED = new Set(['nymbal-payment-element'])\n\nconst PACKAGE = new Map<string, LitElementClass>(\n ELEMENTS.filter((e) => !CLIENT_MOUNTED.has(e.schema.tag)).map((e) => [\n e.schema.tag,\n e as unknown as LitElementClass,\n ]),\n)\n\n/** The project's elements by tag (its `serverElements`), which the server renders in place of the package's. */\nconst projectElements = new Map<string, LitElementClass>()\n\n/**\n * Registers a project's own element classes by tag, as its elements entry exports them: the server renders each in\n * place of the package's element under that tag, as the browser defines it there. A tag keeps the first class it was\n * registered with; a different class under it is refused, so the server and the browser cannot disagree.\n */\nexport function registerServerElements(map: Record<string, CustomElementConstructor>): void {\n for (const [tag, element] of Object.entries(map)) {\n const lit = element as unknown as LitElementClass\n if (lit._$litElement$ !== true) {\n throw new TypeError(`${tag}: the server renders Lit elements only`)\n }\n const registered = projectElements.get(tag)\n if (registered !== undefined && registered !== lit) {\n throw new Error(`${tag} is already registered for the server with another class`)\n }\n projectElements.set(tag, lit)\n }\n}\n\n/** The class the server renders under `tag`, resolved per call, so a registration after a first render wins. */\nfunction classFor(tag: string): LitElementClass | undefined {\n return projectElements.get(tag) ?? PACKAGE.get(tag)\n}\n\n/**\n * Lit SSR finds the elements a template renders, and constructs them, through `customElements`, which defines a tag\n * once per process. This renderer constructs the class `classFor` resolves instead, so a project's element renders\n * under its tag whatever `customElements` held first.\n */\nclass ServerElementRenderer extends LitElementRenderer {\n static override matchesClass(_ctor: typeof HTMLElement, tagName?: string): boolean {\n return tagName !== undefined && classFor(tagName) !== undefined\n }\n\n constructor(tagName: string) {\n super(tagName)\n const element = classFor(tagName)!\n if (this.element.constructor !== element) this.element = new element()\n }\n}\n\n/**\n * Every tag the server may render is known to `customElements`, which is where Lit SSR finds nested elements. A DOM\n * (not Lit's server shim) constructs only the classes it defined, so a project class whose tag already holds another\n * class is defined under a name of its own.\n */\nfunction defineAll(): void {\n for (const tag of new Set([...projectElements.keys(), ...PACKAGE.keys()])) {\n const element = classFor(tag)!\n if (customElements.get(tag) === undefined) customElements.define(tag, element)\n else if (customElements.getName(element) === null)\n customElements.define(`${tag}-server`, element)\n }\n}\n\n/**\n * The elements' styles, with their indentation collapsed: written for reading, they would otherwise be bytes a page\n * downloads before its first paint, once per element.\n */\nfunction compactStyles(html: string): string {\n return html.replace(\n /<style>([^<]*)<\\/style>/g,\n (_, css: string) => `<style>${css.replace(/\\s+/g, ' ').trim()}</style>`,\n )\n}\n\nexport interface RenderOptions {\n /** The host's attributes; a JSON attribute's value is its JSON text. */\n attributes?: Record<string, string> | undefined\n /** Light-DOM HTML after the shadow root: a slotted child, as the payment element is the checkout's. */\n children?: string | undefined\n}\n\n/**\n * One element as HTML: `<tag …attributes><template shadowrootmode=\"open\">…</template>…children</tag>`, the template\n * holding the element's first render from its attributes (no client, no store) with its styles, and the markers Lit's\n * hydration reads. The browser parses the template into the element's shadow root, and the element takes it over.\n */\nexport function renderElement(tag: string, options: RenderOptions = {}): string {\n if (CLIENT_MOUNTED.has(tag)) {\n throw new UnknownElement(`${tag} is client-mounted and is not server-rendered`)\n }\n if (classFor(tag) === undefined) {\n throw new UnknownElement(`${tag} is neither a Nymbal element nor a registered server element`)\n }\n defineAll()\n\n const renderer = new ServerElementRenderer(tag)\n for (const [name, value] of Object.entries(options.attributes ?? {})) {\n renderer.setAttribute(name, value)\n }\n renderer.connectedCallback()\n const renderInfo: RenderInfo = {\n elementRenderers: [ServerElementRenderer, LitElementRenderer],\n customElementInstanceStack: [renderer],\n customElementHostStack: [renderer],\n eventTargetStack: [renderer.element],\n slotStack: [],\n deferHydration: false,\n }\n const attributes = collectResultSync(renderer.renderAttributes())\n const shadow = compactStyles(collectResultSync(renderer.renderShadow(renderInfo)))\n const { mode = 'open' } = renderer.shadowRootOptions\n return `<${tag}${attributes}><template shadowrootmode=\"${mode}\">${shadow}</template>${options.children ?? ''}</${tag}>`\n}\n"],"mappings":"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","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nymbalhq/web-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Interactive commerce UI as native Web Components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro-component",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@lit-labs/ssr": "^3.3.1",
|
|
56
56
|
"@lit-labs/ssr-client": "^1.1.8",
|
|
57
|
-
"@nymbalhq/sdk": "1.
|
|
58
|
-
"@nymbalhq/types": "1.
|
|
57
|
+
"@nymbalhq/sdk": "1.4.0",
|
|
58
|
+
"@nymbalhq/types": "1.4.0",
|
|
59
59
|
"lit": "^3.3.3"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|