@session-services/web-elements 0.1.19 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-C6e98Atu.js → index-BYBgrATL.js} +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/session-services-elements.cjs.js +2 -2
- package/dist/cjs/session-services-formatted-text.cjs.entry.js +181 -165
- package/dist/cjs/session-services-ticketing.cjs.entry.js +24398 -19366
- package/dist/collection/components/session-services-formatted-text/session-services-formatted-text.js +33 -34
- package/dist/collection/components/session-services-ticketing/session-services-ticketing.css +401 -339
- package/dist/collection/components/session-services-ticketing/session-services-ticketing.js +1087 -269
- package/dist/collection/components/session-services-ticketing/session-services-ticketing.logic.js +263 -0
- package/dist/collection/components/session-services-ticketing/session-services-ticketing.logic.test.js +276 -0
- package/dist/collection/components/session-services-ticketing/session-services-ticketing.test.js +264 -0
- package/dist/components/session-services-formatted-text.js +180 -164
- package/dist/components/session-services-ticketing.js +24442 -19392
- package/dist/esm/{index-CeXOR4aK.js → index-CNOpF6tk.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/session-services-elements.js +3 -3
- package/dist/esm/session-services-formatted-text.entry.js +181 -165
- package/dist/esm/session-services-ticketing.entry.js +24406 -19374
- package/dist/session-services-elements/{p-a2404c46.entry.js → p-703444ed.entry.js} +1 -1
- package/dist/session-services-elements/p-CNOpF6tk.js +2 -0
- package/dist/session-services-elements/p-b8703bf3.entry.js +1 -0
- package/dist/session-services-elements/session-services-elements.esm.js +1 -1
- package/dist/sst-env.d.ts +1 -0
- package/dist/types/components/session-services-formatted-text/session-services-formatted-text.d.ts +3 -0
- package/dist/types/components/session-services-ticketing/session-services-ticketing.d.ts +117 -3
- package/dist/types/components/session-services-ticketing/session-services-ticketing.logic.d.ts +193 -0
- package/dist/types/components/session-services-ticketing/session-services-ticketing.logic.test.d.ts +1 -0
- package/dist/types/components/session-services-ticketing/session-services-ticketing.test.d.ts +1 -0
- package/dist/types/components.d.ts +18 -0
- package/package.json +8 -7
- package/dist/session-services-elements/p-62a8e2cc.entry.js +0 -1
- package/dist/session-services-elements/p-CeXOR4aK.js +0 -2
|
@@ -1518,4 +1518,4 @@ function transformTag(tag) {
|
|
|
1518
1518
|
return tag;
|
|
1519
1519
|
}
|
|
1520
1520
|
|
|
1521
|
-
export { Host as H, bootstrapLazy as b, createEvent as c, h, promiseResolve as p, registerInstance as r, setNonce as s };
|
|
1521
|
+
export { Host as H, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
|
package/dist/esm/loader.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { b as bootstrapLazy } from './index-
|
|
2
|
-
export { s as setNonce } from './index-
|
|
1
|
+
import { b as bootstrapLazy } from './index-CNOpF6tk.js';
|
|
2
|
+
export { s as setNonce } from './index-CNOpF6tk.js';
|
|
3
3
|
import { g as globalScripts } from './app-globals-DQuL1Twl.js';
|
|
4
4
|
|
|
5
5
|
const defineCustomElements = async (win, options) => {
|
|
6
6
|
if (typeof window === 'undefined') return undefined;
|
|
7
7
|
await globalScripts();
|
|
8
|
-
return bootstrapLazy([["session-services-formatted-text",[[769,"session-services-formatted-text",{"text":[1],"theme":[1],"currentTheme":[32],"segments":[32]},null,{"text":["textChanged"],"theme":["themeChanged"]}]]],["session-services-ticketing",[[769,"session-services-ticketing",{"tenantId":[1,"tenant-id"],"eventId":[1,"event-id"],"apiUrl":[1,"api-url"],"locale":[1],"returnUrl":[1,"return-url"],"theme":[1],"enableAnalytics":[4,"enable-analytics"],"debugAnalytics":[4,"debug-analytics"],"event":[32],"selectedItems":[32],"quote":[32],"loading":[32],"error":[32],"quoteLoading":[32],"quoteError":[32],"checkoutLoading":[32],"currentTheme":[32],"openModalAdmissionId":[32]},null,{"tenantId":["propsChanged"],"eventId":["propsChanged"],"apiUrl":["propsChanged"],"theme":["themeChanged"]}]]]], options);
|
|
8
|
+
return bootstrapLazy([["session-services-formatted-text",[[769,"session-services-formatted-text",{"text":[1],"theme":[1],"currentTheme":[32],"segments":[32]},null,{"text":["textChanged"],"theme":["themeChanged"]}]]],["session-services-ticketing",[[769,"session-services-ticketing",{"tenantId":[1,"tenant-id"],"eventId":[1,"event-id"],"apiUrl":[1,"api-url"],"locale":[1],"returnUrl":[1,"return-url"],"couponCode":[1,"coupon-code"],"initialAdmissionPrices":[1,"initial-admission-prices"],"initialPreviewQuote":[1,"initial-preview-quote"],"passcode":[1],"stickyCheckout":[4,"sticky-checkout"],"theme":[1],"enableAnalytics":[4,"enable-analytics"],"debugAnalytics":[4,"debug-analytics"],"event":[32],"selectedItems":[32],"quote":[32],"previewQuote":[32],"loading":[32],"error":[32],"quoteLoading":[32],"previewLoading":[32],"quoteError":[32],"couponError":[32],"couponInput":[32],"appliedCouponCode":[32],"passcodeInput":[32],"activePasscode":[32],"passcodeDenied":[32],"selectionPrompt":[32],"checkoutLoading":[32],"currentTheme":[32],"openModalAdmissionId":[32]},null,{"tenantId":["propsChanged"],"eventId":["propsChanged"],"apiUrl":["propsChanged"],"passcode":["propsChanged"],"couponCode":["couponCodeChanged"],"initialAdmissionPrices":["couponCodeChanged"],"initialPreviewQuote":["couponCodeChanged"],"theme":["themeChanged"]}]]]], options);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export { defineCustomElements };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
2
|
-
export { s as setNonce } from './index-
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-CNOpF6tk.js';
|
|
2
|
+
export { s as setNonce } from './index-CNOpF6tk.js';
|
|
3
3
|
import { g as globalScripts } from './app-globals-DQuL1Twl.js';
|
|
4
4
|
|
|
5
5
|
/*
|
|
@@ -17,5 +17,5 @@ var patchBrowser = () => {
|
|
|
17
17
|
|
|
18
18
|
patchBrowser().then(async (options) => {
|
|
19
19
|
await globalScripts();
|
|
20
|
-
return bootstrapLazy([["session-services-formatted-text",[[769,"session-services-formatted-text",{"text":[1],"theme":[1],"currentTheme":[32],"segments":[32]},null,{"text":["textChanged"],"theme":["themeChanged"]}]]],["session-services-ticketing",[[769,"session-services-ticketing",{"tenantId":[1,"tenant-id"],"eventId":[1,"event-id"],"apiUrl":[1,"api-url"],"locale":[1],"returnUrl":[1,"return-url"],"theme":[1],"enableAnalytics":[4,"enable-analytics"],"debugAnalytics":[4,"debug-analytics"],"event":[32],"selectedItems":[32],"quote":[32],"loading":[32],"error":[32],"quoteLoading":[32],"quoteError":[32],"checkoutLoading":[32],"currentTheme":[32],"openModalAdmissionId":[32]},null,{"tenantId":["propsChanged"],"eventId":["propsChanged"],"apiUrl":["propsChanged"],"theme":["themeChanged"]}]]]], options);
|
|
20
|
+
return bootstrapLazy([["session-services-formatted-text",[[769,"session-services-formatted-text",{"text":[1],"theme":[1],"currentTheme":[32],"segments":[32]},null,{"text":["textChanged"],"theme":["themeChanged"]}]]],["session-services-ticketing",[[769,"session-services-ticketing",{"tenantId":[1,"tenant-id"],"eventId":[1,"event-id"],"apiUrl":[1,"api-url"],"locale":[1],"returnUrl":[1,"return-url"],"couponCode":[1,"coupon-code"],"initialAdmissionPrices":[1,"initial-admission-prices"],"initialPreviewQuote":[1,"initial-preview-quote"],"passcode":[1],"stickyCheckout":[4,"sticky-checkout"],"theme":[1],"enableAnalytics":[4,"enable-analytics"],"debugAnalytics":[4,"debug-analytics"],"event":[32],"selectedItems":[32],"quote":[32],"previewQuote":[32],"loading":[32],"error":[32],"quoteLoading":[32],"previewLoading":[32],"quoteError":[32],"couponError":[32],"couponInput":[32],"appliedCouponCode":[32],"passcodeInput":[32],"activePasscode":[32],"passcodeDenied":[32],"selectionPrompt":[32],"checkoutLoading":[32],"currentTheme":[32],"openModalAdmissionId":[32]},null,{"tenantId":["propsChanged"],"eventId":["propsChanged"],"apiUrl":["propsChanged"],"passcode":["propsChanged"],"couponCode":["couponCodeChanged"],"initialAdmissionPrices":["couponCodeChanged"],"initialPreviewQuote":["couponCodeChanged"],"theme":["themeChanged"]}]]]], options);
|
|
21
21
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host } from './index-
|
|
1
|
+
import { r as registerInstance, h, H as Host } from './index-CNOpF6tk.js';
|
|
2
2
|
|
|
3
3
|
var tlds = [
|
|
4
4
|
"aaa",
|
|
@@ -1443,7 +1443,7 @@ var tlds = [
|
|
|
1443
1443
|
|
|
1444
1444
|
const URL_WITH_PROTOCOL = /https?:\/\/[^\s<>"]+/gi;
|
|
1445
1445
|
const EMAIL = /[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}/gi;
|
|
1446
|
-
const INSTAGRAM =
|
|
1446
|
+
const INSTAGRAM = /@([a-z0-9][a-z0-9._]{0,29})\b/gi;
|
|
1447
1447
|
const SOUNDCLOUD = /https?:\/\/(?:www\.)?soundcloud\.com\/[a-z0-9_-]+(?:\/[^\s<>"]*)?/gi;
|
|
1448
1448
|
const DIVIDER = /^[-=]{3,}$/gm;
|
|
1449
1449
|
let bareDomainPattern = null;
|
|
@@ -1461,6 +1461,9 @@ const MAX_TEXT_LENGTH_FOR_BARE_DOMAIN = 2048;
|
|
|
1461
1461
|
function cleanUrl(url) {
|
|
1462
1462
|
return url.replace(/[.,;:!?)]+$/, "");
|
|
1463
1463
|
}
|
|
1464
|
+
function matchIndex(match) {
|
|
1465
|
+
return match.index ?? 0;
|
|
1466
|
+
}
|
|
1464
1467
|
function isSoundCloudUrl(url) {
|
|
1465
1468
|
try {
|
|
1466
1469
|
const parsed = new URL(url);
|
|
@@ -1469,86 +1472,105 @@ function isSoundCloudUrl(url) {
|
|
|
1469
1472
|
return false;
|
|
1470
1473
|
}
|
|
1471
1474
|
}
|
|
1472
|
-
function
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1475
|
+
function isLinkMatch(match) {
|
|
1476
|
+
return Boolean(match);
|
|
1477
|
+
}
|
|
1478
|
+
function isInstagramBoundary(text, index) {
|
|
1479
|
+
if (index === 0) return true;
|
|
1480
|
+
const prev = text[index - 1];
|
|
1481
|
+
return prev ? !/[a-z0-9._%+-]/i.test(prev) : true;
|
|
1482
|
+
}
|
|
1483
|
+
function soundCloudMatch(_text, match) {
|
|
1484
|
+
const index = matchIndex(match);
|
|
1485
|
+
const url = cleanUrl(match[0]);
|
|
1486
|
+
return {
|
|
1487
|
+
type: "soundcloud",
|
|
1488
|
+
start: index,
|
|
1489
|
+
end: index + url.length,
|
|
1490
|
+
text: url,
|
|
1491
|
+
href: url
|
|
1479
1492
|
};
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1493
|
+
}
|
|
1494
|
+
function urlMatch(_text, match) {
|
|
1495
|
+
const url = cleanUrl(match[0]);
|
|
1496
|
+
if (isSoundCloudUrl(url)) return void 0;
|
|
1497
|
+
const index = matchIndex(match);
|
|
1498
|
+
return {
|
|
1499
|
+
type: "url",
|
|
1500
|
+
start: index,
|
|
1501
|
+
end: index + url.length,
|
|
1502
|
+
text: url,
|
|
1503
|
+
href: url
|
|
1485
1504
|
};
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
href: `https://${domain}`
|
|
1547
|
-
});
|
|
1548
|
-
}
|
|
1505
|
+
}
|
|
1506
|
+
function emailMatch(_text, match) {
|
|
1507
|
+
const index = matchIndex(match);
|
|
1508
|
+
return {
|
|
1509
|
+
type: "email",
|
|
1510
|
+
start: index,
|
|
1511
|
+
end: index + match[0].length,
|
|
1512
|
+
text: match[0],
|
|
1513
|
+
href: `mailto:${match[0]}`
|
|
1514
|
+
};
|
|
1515
|
+
}
|
|
1516
|
+
function instagramMatch(text, match) {
|
|
1517
|
+
const index = matchIndex(match);
|
|
1518
|
+
if (!isInstagramBoundary(text, index)) return void 0;
|
|
1519
|
+
const username = match[1];
|
|
1520
|
+
return {
|
|
1521
|
+
type: "instagram",
|
|
1522
|
+
start: index,
|
|
1523
|
+
end: index + match[0].length,
|
|
1524
|
+
text: match[0],
|
|
1525
|
+
href: `https://instagram.com/${username}`
|
|
1526
|
+
};
|
|
1527
|
+
}
|
|
1528
|
+
function bareDomainMatch(_text, match) {
|
|
1529
|
+
const index = matchIndex(match);
|
|
1530
|
+
const domain = cleanUrl(match[0]);
|
|
1531
|
+
return {
|
|
1532
|
+
type: "url",
|
|
1533
|
+
start: index,
|
|
1534
|
+
end: index + domain.length,
|
|
1535
|
+
text: domain,
|
|
1536
|
+
href: `https://${domain}`
|
|
1537
|
+
};
|
|
1538
|
+
}
|
|
1539
|
+
const BASE_LINK_EXTRACTORS = [
|
|
1540
|
+
{ pattern: SOUNDCLOUD, toMatch: soundCloudMatch },
|
|
1541
|
+
{ pattern: URL_WITH_PROTOCOL, toMatch: urlMatch },
|
|
1542
|
+
{ pattern: EMAIL, toMatch: emailMatch },
|
|
1543
|
+
{ pattern: INSTAGRAM, toMatch: instagramMatch }
|
|
1544
|
+
];
|
|
1545
|
+
function bareDomainExtractor() {
|
|
1546
|
+
return { pattern: getBareDomainPattern(), toMatch: bareDomainMatch };
|
|
1547
|
+
}
|
|
1548
|
+
function matchesForExtractor(text, extractor) {
|
|
1549
|
+
extractor.pattern.lastIndex = 0;
|
|
1550
|
+
return Array.from(
|
|
1551
|
+
text.matchAll(extractor.pattern),
|
|
1552
|
+
(match) => extractor.toMatch(text, match)
|
|
1553
|
+
).filter(isLinkMatch);
|
|
1554
|
+
}
|
|
1555
|
+
function rangesOverlap(a, b) {
|
|
1556
|
+
return a.start < b.end && a.end > b.start;
|
|
1557
|
+
}
|
|
1558
|
+
function withoutOverlaps(candidates) {
|
|
1559
|
+
const matches = [];
|
|
1560
|
+
const used = [];
|
|
1561
|
+
for (const candidate of candidates) {
|
|
1562
|
+
if (used.some((range) => rangesOverlap(candidate, range))) continue;
|
|
1563
|
+
matches.push(candidate);
|
|
1564
|
+
used.push(candidate);
|
|
1549
1565
|
}
|
|
1550
1566
|
return matches.sort((a, b) => a.start - b.start);
|
|
1551
1567
|
}
|
|
1568
|
+
function findLinks(text) {
|
|
1569
|
+
const extractors = text.length <= MAX_TEXT_LENGTH_FOR_BARE_DOMAIN ? [...BASE_LINK_EXTRACTORS, bareDomainExtractor()] : BASE_LINK_EXTRACTORS;
|
|
1570
|
+
return withoutOverlaps(
|
|
1571
|
+
extractors.flatMap((extractor) => matchesForExtractor(text, extractor))
|
|
1572
|
+
);
|
|
1573
|
+
}
|
|
1552
1574
|
function findDividers(text) {
|
|
1553
1575
|
const dividers = [];
|
|
1554
1576
|
DIVIDER.lastIndex = 0;
|
|
@@ -1573,72 +1595,67 @@ function parseFormattedText(text) {
|
|
|
1573
1595
|
if (!text) {
|
|
1574
1596
|
return [];
|
|
1575
1597
|
}
|
|
1576
|
-
const links = findLinks(text);
|
|
1577
|
-
const dividers = findDividers(text);
|
|
1578
1598
|
const segments = [];
|
|
1579
|
-
const markers =
|
|
1580
|
-
...links.map((l) => ({
|
|
1581
|
-
type: "link",
|
|
1582
|
-
data: l,
|
|
1583
|
-
start: l.start,
|
|
1584
|
-
end: l.end
|
|
1585
|
-
})),
|
|
1586
|
-
...dividers.map((d) => ({
|
|
1587
|
-
type: "divider",
|
|
1588
|
-
start: d.start,
|
|
1589
|
-
end: d.end
|
|
1590
|
-
}))
|
|
1591
|
-
].sort((a, b) => a.start - b.start);
|
|
1599
|
+
const markers = buildMarkers(findLinks(text), findDividers(text));
|
|
1592
1600
|
let lastEnd = 0;
|
|
1593
1601
|
let lastWasDivider = false;
|
|
1594
1602
|
for (const marker of markers) {
|
|
1595
1603
|
if (marker.start < lastEnd) continue;
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
if (marker.type === "divider") {
|
|
1602
|
-
textContent = textContent.replace(/\n+$/, "");
|
|
1603
|
-
}
|
|
1604
|
-
if (textContent) {
|
|
1605
|
-
segments.push({ type: "text", content: textContent });
|
|
1606
|
-
}
|
|
1607
|
-
}
|
|
1608
|
-
if (marker.type === "link") {
|
|
1609
|
-
const link = marker.data;
|
|
1610
|
-
if (link.type === "soundcloud") {
|
|
1611
|
-
segments.push({
|
|
1612
|
-
type: "soundcloud",
|
|
1613
|
-
content: link.text,
|
|
1614
|
-
href: link.href
|
|
1615
|
-
});
|
|
1616
|
-
} else {
|
|
1617
|
-
segments.push({
|
|
1618
|
-
type: "link",
|
|
1619
|
-
content: link.text,
|
|
1620
|
-
href: link.href,
|
|
1621
|
-
linkType: link.type
|
|
1622
|
-
});
|
|
1623
|
-
}
|
|
1624
|
-
lastWasDivider = false;
|
|
1625
|
-
} else {
|
|
1626
|
-
segments.push({ type: "divider", content: "" });
|
|
1627
|
-
lastWasDivider = true;
|
|
1628
|
-
}
|
|
1604
|
+
appendTextSegment(segments, text, lastEnd, marker.start, {
|
|
1605
|
+
trimLeading: lastWasDivider,
|
|
1606
|
+
trimTrailing: marker.type === "divider"
|
|
1607
|
+
});
|
|
1608
|
+
segments.push(markerSegment(marker));
|
|
1629
1609
|
lastEnd = marker.end;
|
|
1610
|
+
lastWasDivider = marker.type === "divider";
|
|
1630
1611
|
}
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
}
|
|
1636
|
-
if (textContent) {
|
|
1637
|
-
segments.push({ type: "text", content: textContent });
|
|
1638
|
-
}
|
|
1639
|
-
}
|
|
1612
|
+
appendTextSegment(segments, text, lastEnd, text.length, {
|
|
1613
|
+
trimLeading: lastWasDivider,
|
|
1614
|
+
trimTrailing: false
|
|
1615
|
+
});
|
|
1640
1616
|
return segments;
|
|
1641
1617
|
}
|
|
1618
|
+
function buildMarkers(links, dividers) {
|
|
1619
|
+
return [
|
|
1620
|
+
...links.map((link) => ({
|
|
1621
|
+
type: "link",
|
|
1622
|
+
data: link,
|
|
1623
|
+
start: link.start,
|
|
1624
|
+
end: link.end
|
|
1625
|
+
})),
|
|
1626
|
+
...dividers.map((divider) => ({
|
|
1627
|
+
type: "divider",
|
|
1628
|
+
start: divider.start,
|
|
1629
|
+
end: divider.end
|
|
1630
|
+
}))
|
|
1631
|
+
].sort((a, b) => a.start - b.start);
|
|
1632
|
+
}
|
|
1633
|
+
function trimTextSegment(content, opts) {
|
|
1634
|
+
const leading = opts.trimLeading ? content.replace(/^\n+/, "") : content;
|
|
1635
|
+
return opts.trimTrailing ? leading.replace(/\n+$/, "") : leading;
|
|
1636
|
+
}
|
|
1637
|
+
function appendTextSegment(segments, text, start, end, opts) {
|
|
1638
|
+
if (start >= end) return;
|
|
1639
|
+
const content = trimTextSegment(text.slice(start, end), opts);
|
|
1640
|
+
if (content) segments.push({ type: "text", content });
|
|
1641
|
+
}
|
|
1642
|
+
function markerSegment(marker) {
|
|
1643
|
+
if (marker.type === "divider") return { type: "divider", content: "" };
|
|
1644
|
+
const link = marker.data;
|
|
1645
|
+
if (link.type === "soundcloud") {
|
|
1646
|
+
return {
|
|
1647
|
+
type: "soundcloud",
|
|
1648
|
+
content: link.text,
|
|
1649
|
+
href: link.href
|
|
1650
|
+
};
|
|
1651
|
+
}
|
|
1652
|
+
return {
|
|
1653
|
+
type: "link",
|
|
1654
|
+
content: link.text,
|
|
1655
|
+
href: link.href,
|
|
1656
|
+
linkType: link.type
|
|
1657
|
+
};
|
|
1658
|
+
}
|
|
1642
1659
|
|
|
1643
1660
|
const sessionServicesFormattedTextCss = () => `:host{--foreground:oklch(0.145 0 0);--muted-foreground:oklch(0.556 0 0);--primary:oklch(0.42 0.24 264.376);--border:oklch(0.922 0 0);--ring:oklch(0.708 0 0);--radius:0.5rem;--spacing-md:1rem;--spacing-lg:1.5rem;--font-family:ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
|
|
1644
1661
|
"Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;--transition-fast:150ms cubic-bezier(0.4, 0, 0.2, 1);--internal-foreground:var(--foreground, oklch(0.145 0 0));--internal-muted-foreground:var(--muted-foreground, oklch(0.556 0 0));--internal-primary:var(--primary, oklch(0.42 0.24 264.376));--internal-border:var(--border, oklch(0.922 0 0));--internal-ring:var(--ring, oklch(0.708 0 0));--internal-radius:var(--radius, 0.5rem);--internal-spacing-md:var(--spacing-md, 1rem);--internal-spacing-lg:var(--spacing-lg, 1.5rem);--internal-font-family:var(
|
|
@@ -1678,28 +1695,27 @@ const SessionServicesFormattedText = class {
|
|
|
1678
1695
|
this.setupTheme();
|
|
1679
1696
|
}
|
|
1680
1697
|
disconnectedCallback() {
|
|
1681
|
-
|
|
1682
|
-
this.mediaQueryList.removeEventListener("change", this.handleSystemThemeChange);
|
|
1683
|
-
}
|
|
1698
|
+
this.removeThemeListener();
|
|
1684
1699
|
}
|
|
1685
1700
|
setupTheme() {
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
}
|
|
1689
|
-
if (this.theme === "system") {
|
|
1690
|
-
// Guard for testing environments (JSDOM) where matchMedia may not exist
|
|
1691
|
-
if (typeof globalThis.matchMedia === "function") {
|
|
1692
|
-
this.mediaQueryList = globalThis.matchMedia("(prefers-color-scheme: dark)");
|
|
1693
|
-
this.currentTheme = this.mediaQueryList.matches ? "dark" : "light";
|
|
1694
|
-
this.mediaQueryList.addEventListener("change", this.handleSystemThemeChange);
|
|
1695
|
-
}
|
|
1696
|
-
else {
|
|
1697
|
-
this.currentTheme = "light";
|
|
1698
|
-
}
|
|
1699
|
-
}
|
|
1700
|
-
else {
|
|
1701
|
+
this.removeThemeListener();
|
|
1702
|
+
if (this.theme !== "system") {
|
|
1701
1703
|
this.currentTheme = this.theme;
|
|
1704
|
+
return;
|
|
1702
1705
|
}
|
|
1706
|
+
this.setupSystemTheme();
|
|
1707
|
+
}
|
|
1708
|
+
removeThemeListener() {
|
|
1709
|
+
this.mediaQueryList?.removeEventListener("change", this.handleSystemThemeChange);
|
|
1710
|
+
}
|
|
1711
|
+
setupSystemTheme() {
|
|
1712
|
+
if (typeof globalThis.matchMedia !== "function") {
|
|
1713
|
+
this.currentTheme = "light";
|
|
1714
|
+
return;
|
|
1715
|
+
}
|
|
1716
|
+
this.mediaQueryList = globalThis.matchMedia("(prefers-color-scheme: dark)");
|
|
1717
|
+
this.currentTheme = this.mediaQueryList.matches ? "dark" : "light";
|
|
1718
|
+
this.mediaQueryList.addEventListener("change", this.handleSystemThemeChange);
|
|
1703
1719
|
}
|
|
1704
1720
|
handleSystemThemeChange = (e) => {
|
|
1705
1721
|
if (this.theme === "system") {
|
|
@@ -1731,21 +1747,21 @@ const SessionServicesFormattedText = class {
|
|
|
1731
1747
|
return (h("div", { key: key, class: "soundcloud-embed" }, h("iframe", { width: "100%", height: "166", scrolling: "no", allow: "autoplay", sandbox: "allow-scripts allow-same-origin allow-popups", src: embedUrl, title: iframeTitle, loading: "lazy" })));
|
|
1732
1748
|
}
|
|
1733
1749
|
renderSegment(segment, index) {
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1750
|
+
if (segment.type === "text")
|
|
1751
|
+
return h("span", { key: index }, segment.content);
|
|
1752
|
+
if (segment.type === "link")
|
|
1753
|
+
return this.renderLink(segment, index);
|
|
1754
|
+
if (segment.type === "divider")
|
|
1755
|
+
return h("hr", { key: index, class: "formatted-divider" });
|
|
1756
|
+
return this.renderMediaSegment(segment, index);
|
|
1757
|
+
}
|
|
1758
|
+
renderMediaSegment(segment, index) {
|
|
1759
|
+
if (segment.type !== "soundcloud")
|
|
1760
|
+
return null;
|
|
1761
|
+
return this.renderSoundCloudEmbed(segment.href || "", index, segment.content);
|
|
1746
1762
|
}
|
|
1747
1763
|
render() {
|
|
1748
|
-
return (h(Host, { key: '
|
|
1764
|
+
return (h(Host, { key: '3b477ff5db918a1b3b6872f48d330305d320ae3b', "data-theme": this.currentTheme }, h("div", { key: 'efe7fc93f9f1c2b38271a30e4a8fdf7306793d6e', class: "formatted-text" }, this.segments.map((segment, index) => this.renderSegment(segment, index)))));
|
|
1749
1765
|
}
|
|
1750
1766
|
static get watchers() { return {
|
|
1751
1767
|
"text": ["textChanged"],
|