@usethrottle/builder-react 0.5.1 → 0.5.3
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-G6I4RIXU.js → chunk-HE6MD2RZ.js} +1673 -120
- package/dist/{chunk-UNL4JWZS.cjs → chunk-J2IHOBDX.cjs} +1690 -137
- package/dist/index.cjs +1716 -201
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +1672 -157
- package/dist/next.cjs +70 -36
- package/dist/next.d.cts +7 -1
- package/dist/next.d.ts +7 -1
- package/dist/next.js +46 -12
- package/dist/server.cjs +26 -24
- package/dist/server.d.cts +111 -86
- package/dist/server.d.ts +111 -86
- package/dist/server.js +3 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -615,12 +615,12 @@ var Boundary = class extends BoundaryBase {
|
|
|
615
615
|
}
|
|
616
616
|
};
|
|
617
617
|
function PartBoundary({
|
|
618
|
-
label,
|
|
618
|
+
label: label2,
|
|
619
619
|
resetKey,
|
|
620
620
|
children
|
|
621
621
|
}) {
|
|
622
622
|
const builder = useBuilder();
|
|
623
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Boundary, { label, resetKeys: [builder?.site, resetKey], onError: builder?.onError, children });
|
|
623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Boundary, { label: label2, resetKeys: [builder?.site, resetKey], onError: builder?.onError, children });
|
|
624
624
|
}
|
|
625
625
|
function contextData(context) {
|
|
626
626
|
if (typeof context !== "object" || context === null) return {};
|
|
@@ -672,9 +672,9 @@ function compileTemplate(snapshot, registry) {
|
|
|
672
672
|
return result;
|
|
673
673
|
}
|
|
674
674
|
function compile(snapshot, registry) {
|
|
675
|
-
const
|
|
675
|
+
const label2 = `${snapshot.type}@${String(snapshot.v)}`;
|
|
676
676
|
const refuse = (why) => {
|
|
677
|
-
warnOnce(`template:${
|
|
677
|
+
warnOnce(`template:${label2}`, `${label2} was refused (${why}); rendering nothing for it`);
|
|
678
678
|
return null;
|
|
679
679
|
};
|
|
680
680
|
if (snapshot.kind !== "template") return refuse("not a template widget");
|
|
@@ -846,10 +846,10 @@ function check(raw, registry) {
|
|
|
846
846
|
}
|
|
847
847
|
function verify(raw, registry) {
|
|
848
848
|
const snapshot = raw;
|
|
849
|
-
const
|
|
849
|
+
const label2 = `${String(snapshot.type)}@${String(snapshot.v)}`;
|
|
850
850
|
if (snapshot.disabled === true) return { status: "disabled" };
|
|
851
851
|
const refuse = (why) => {
|
|
852
|
-
warnOnce(`code:${
|
|
852
|
+
warnOnce(`code:${label2}`, `Code widget ${label2} was refused (${why}); rendering nothing for it`);
|
|
853
853
|
return { status: "invalid" };
|
|
854
854
|
};
|
|
855
855
|
if (snapshot.kind !== "code") return refuse("not a code widget");
|
|
@@ -900,7 +900,7 @@ function CodeWidget(props) {
|
|
|
900
900
|
const src = runs(props, result.snapshot.jsHash);
|
|
901
901
|
if (src !== null) markCodeEmitted();
|
|
902
902
|
const env = newEnv({ settings: props.props, data: props.data, locale: props.locale, mediaOrigin: props.mediaOrigin, budget: new RenderBudget() });
|
|
903
|
-
const
|
|
903
|
+
const label2 = `${node.type}@${String(node.v)}`;
|
|
904
904
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
905
905
|
NodeWrapper,
|
|
906
906
|
{
|
|
@@ -915,27 +915,27 @@ function CodeWidget(props) {
|
|
|
915
915
|
entrance,
|
|
916
916
|
attributes: src === null ? { "data-b-code-inert": "" } : { "data-b-code": result.snapshot.jsHash },
|
|
917
917
|
children: [
|
|
918
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PartBoundary, { label, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react7.Suspense, { fallback: null, children: [
|
|
918
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PartBoundary, { label: label2, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react7.Suspense, { fallback: null, children: [
|
|
919
919
|
template.css === "" ? null : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CustomCss, { css: template.css }),
|
|
920
920
|
renderTemplate(template.ast, env)
|
|
921
921
|
] }) }),
|
|
922
922
|
src === null && (edit !== void 0 || props.code?.preview === true) ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { "data-b-code-badge": "", style: BADGE, children: "Runs on your store" }) : null,
|
|
923
|
-
src === null ? null : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CodeInput, { props: props.props, data: props.data, label }),
|
|
923
|
+
src === null ? null : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CodeInput, { props: props.props, data: props.data, label: label2 }),
|
|
924
924
|
src === null ? null : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("script", { async: true, src })
|
|
925
925
|
]
|
|
926
926
|
}
|
|
927
927
|
);
|
|
928
928
|
}
|
|
929
|
-
function CodeInput({ props, data, label }) {
|
|
929
|
+
function CodeInput({ props, data, label: label2 }) {
|
|
930
930
|
let json = "";
|
|
931
931
|
try {
|
|
932
932
|
json = jsonForScript({ props, data });
|
|
933
933
|
if (json.length > MAX_INPUT_CHARS) {
|
|
934
|
-
warnOnce(`code-input:${
|
|
934
|
+
warnOnce(`code-input:${label2}`, `The data of ${label2} is too large for its code input; it gets its props only`);
|
|
935
935
|
json = jsonForScript({ props, data: {} });
|
|
936
936
|
}
|
|
937
937
|
} catch {
|
|
938
|
-
warnOnce(`code-input:${
|
|
938
|
+
warnOnce(`code-input:${label2}`, `The input of ${label2} cannot be written as JSON; it gets none`);
|
|
939
939
|
json = jsonForScript({ props: {}, data: {} });
|
|
940
940
|
}
|
|
941
941
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("script", { type: "application/json", "data-b-code-input": "", children: json });
|
|
@@ -1041,16 +1041,22 @@ function widgetDecls(node, device, registry) {
|
|
|
1041
1041
|
var ALIGN_ITEMS = { top: "flex-start", center: "center", bottom: "flex-end", stretch: "stretch" };
|
|
1042
1042
|
var BG_POSITION = /* @__PURE__ */ new Set(["center", "top", "bottom", "left", "right", "top left", "top right", "bottom left", "bottom right"]);
|
|
1043
1043
|
var BG_SIZE = /* @__PURE__ */ new Set(["cover", "contain", "auto"]);
|
|
1044
|
-
function backgroundDecls(out, bg, assets, mediaOrigin) {
|
|
1044
|
+
function backgroundDecls(out, bg, assets, mediaOrigin, device) {
|
|
1045
1045
|
if (bg === void 0) return;
|
|
1046
1046
|
put(out, "--tb-bg", bg.color === void 0 ? null : colour(bg.color));
|
|
1047
1047
|
put(out, "--tb-overlay", bg.overlay === void 0 ? null : colour(bg.overlay));
|
|
1048
1048
|
if (bg.position !== void 0 && BG_POSITION.has(bg.position)) put(out, "--tb-bgpos", bg.position);
|
|
1049
1049
|
if (bg.size !== void 0 && BG_SIZE.has(bg.size)) put(out, "--tb-bgsize", bg.size);
|
|
1050
|
-
const asset = bg
|
|
1051
|
-
if (asset !== void 0
|
|
1052
|
-
|
|
1053
|
-
|
|
1050
|
+
const asset = backgroundAsset(bg, device, assets, mediaOrigin);
|
|
1051
|
+
if (asset !== void 0) out.set("--tb-bgimg", `url("${asset.url}")`);
|
|
1052
|
+
}
|
|
1053
|
+
function backgroundAsset(bg, device, assets, mediaOrigin) {
|
|
1054
|
+
if (bg === void 0 || assets === void 0) return void 0;
|
|
1055
|
+
const usable = (id) => {
|
|
1056
|
+
const found = id === void 0 || !Object.hasOwn(assets, id) ? void 0 : assets[id];
|
|
1057
|
+
return found !== void 0 && (0, import_builder_schema10.safeUrl)(found.url, "src", { mediaOrigin }) !== null && URL_QUOTE_SAFE.test(found.url) ? found : void 0;
|
|
1058
|
+
};
|
|
1059
|
+
return (device === "phone" ? usable(bg.mobileImage) : void 0) ?? usable(bg.image);
|
|
1054
1060
|
}
|
|
1055
1061
|
function sectionDecls(section, device, assets, mediaOrigin) {
|
|
1056
1062
|
const out = /* @__PURE__ */ new Map();
|
|
@@ -1063,7 +1069,7 @@ function sectionDecls(section, device, assets, mediaOrigin) {
|
|
|
1063
1069
|
put(out, "--tb-padx", p.paddingX === void 0 ? null : spacing(p.paddingX));
|
|
1064
1070
|
if (typeof p.minHeight === "number" && p.minHeight > 0 && p.minHeight <= 2e3) put(out, "--tb-minh", px(p.minHeight));
|
|
1065
1071
|
if (typeof p.verticalAlign === "string" && Object.hasOwn(ALIGN_ITEMS, p.verticalAlign)) put(out, "--tb-valign", ALIGN_ITEMS[p.verticalAlign]);
|
|
1066
|
-
backgroundDecls(out, p.background, assets, mediaOrigin);
|
|
1072
|
+
backgroundDecls(out, p.background, assets, mediaOrigin, device);
|
|
1067
1073
|
const widths = (0, import_builder_schema10.resolveColumnWidths)(section, device);
|
|
1068
1074
|
const rows = (0, import_builder_schema10.wrapColumnRows)(widths);
|
|
1069
1075
|
const stacked = rows.every((row) => row.length === 1);
|
|
@@ -1088,7 +1094,7 @@ function columnDecls(section, index, device, assets, mediaOrigin, widths) {
|
|
|
1088
1094
|
if (p.hidden === true) put(out, "--tb-hide", "none");
|
|
1089
1095
|
if (typeof p.verticalAlign === "string" && Object.hasOwn(ALIGN_ITEMS, p.verticalAlign)) put(out, "--tb-self", ALIGN_ITEMS[p.verticalAlign]);
|
|
1090
1096
|
put(out, "--tb-pad", p.padding === void 0 ? null : spacing(p.padding));
|
|
1091
|
-
backgroundDecls(out, p.background, assets, mediaOrigin);
|
|
1097
|
+
backgroundDecls(out, p.background, assets, mediaOrigin, device);
|
|
1092
1098
|
return out;
|
|
1093
1099
|
}
|
|
1094
1100
|
function collect(doc, registry, assets, mediaOrigin) {
|
|
@@ -1407,7 +1413,7 @@ function startRuntime() {
|
|
|
1407
1413
|
document.addEventListener("keydown", onKey);
|
|
1408
1414
|
window.addEventListener("hashchange", onHash);
|
|
1409
1415
|
let beat = 0;
|
|
1410
|
-
const
|
|
1416
|
+
const clock2 = window.setInterval(() => {
|
|
1411
1417
|
const minute = ++beat % 60 === 0;
|
|
1412
1418
|
all("[data-b-cd]:not([data-b-ended])").forEach((el) => tick(el, minute));
|
|
1413
1419
|
}, 1e3);
|
|
@@ -1425,7 +1431,7 @@ function startRuntime() {
|
|
|
1425
1431
|
document.removeEventListener("click", onClick);
|
|
1426
1432
|
document.removeEventListener("keydown", onKey);
|
|
1427
1433
|
window.removeEventListener("hashchange", onHash);
|
|
1428
|
-
window.clearInterval(
|
|
1434
|
+
window.clearInterval(clock2);
|
|
1429
1435
|
watcher.disconnect();
|
|
1430
1436
|
autoplay.forEach((id) => window.clearInterval(id));
|
|
1431
1437
|
autoplay.clear();
|
|
@@ -1577,11 +1583,11 @@ function DrawerRuntime() {
|
|
|
1577
1583
|
return null;
|
|
1578
1584
|
}
|
|
1579
1585
|
function Collapse(props) {
|
|
1580
|
-
const { sectionId, id, px: px2, label, children } = props;
|
|
1586
|
+
const { sectionId, id, px: px2, label: label2, children } = props;
|
|
1581
1587
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1582
1588
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("style", { href: `tb-fr-${sectionId}`, precedence: "throttle", children: collapseCss(sectionId, px2) }),
|
|
1583
1589
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "tb-fr", "data-tb-collapse": "", children: [
|
|
1584
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: "tb-fr-open", "data-tb-drawer-open": "", "aria-expanded": "false", "aria-controls": id, children:
|
|
1590
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: "tb-fr-open", "data-tb-drawer-open": "", "aria-expanded": "false", "aria-controls": id, children: label2 }),
|
|
1585
1591
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { id, className: "tb-fr-body", children: [
|
|
1586
1592
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: "tb-fr-close", "data-tb-drawer-close": "", "aria-label": "Close", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { "aria-hidden": "true", children: "\xD7" }) }),
|
|
1587
1593
|
children
|
|
@@ -2074,7 +2080,34 @@ function renderSection(section, ctx, registry, nested = false) {
|
|
|
2074
2080
|
variant.devices.join("-")
|
|
2075
2081
|
);
|
|
2076
2082
|
});
|
|
2077
|
-
|
|
2083
|
+
const preloads = backgroundPreloads(section, ctx);
|
|
2084
|
+
return gated(section, ctx, marker === null && preloads.length === 0 ? copies : [...marker === null ? [] : [marker], ...preloads, ...copies]);
|
|
2085
|
+
}
|
|
2086
|
+
function backgroundPreloads(section, ctx) {
|
|
2087
|
+
if (ctx.edit !== void 0) return [];
|
|
2088
|
+
const on = (device) => (0, import_builder_schema13.resolveResponsive)(section.props, section.responsive, device);
|
|
2089
|
+
const desktopBg = on("desktop").background;
|
|
2090
|
+
const phoneBg = on("phone").background;
|
|
2091
|
+
if (desktopBg?.priority !== true && phoneBg?.priority !== true) return [];
|
|
2092
|
+
const main = backgroundAsset(desktopBg, "desktop", ctx.assets, ctx.mediaOrigin) ?? null;
|
|
2093
|
+
const mobile = backgroundAsset(phoneBg, "phone", ctx.assets, ctx.mediaOrigin) ?? null;
|
|
2094
|
+
const link = (key, asset, media) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2095
|
+
"link",
|
|
2096
|
+
{
|
|
2097
|
+
rel: "preload",
|
|
2098
|
+
as: "image",
|
|
2099
|
+
href: asset.url,
|
|
2100
|
+
fetchPriority: "high",
|
|
2101
|
+
...media === void 0 ? {} : { media }
|
|
2102
|
+
},
|
|
2103
|
+
key
|
|
2104
|
+
);
|
|
2105
|
+
if (main === null && mobile === null) return [];
|
|
2106
|
+
if (main !== null && mobile !== null && main.url === mobile.url) return [link(`bgp-${section.id}`, main, void 0)];
|
|
2107
|
+
return [
|
|
2108
|
+
...main === null ? [] : [link(`bgp-${section.id}`, main, "(min-width:768px)")],
|
|
2109
|
+
...mobile === null ? [] : [link(`bgpm-${section.id}`, mobile, "(max-width:767px)")]
|
|
2110
|
+
];
|
|
2078
2111
|
}
|
|
2079
2112
|
function needsRuntime(doc) {
|
|
2080
2113
|
let found = false;
|
|
@@ -2139,16 +2172,19 @@ function isFrozenAsset(value) {
|
|
|
2139
2172
|
const v = value;
|
|
2140
2173
|
return typeof v.url === "string" && typeof v.width === "number" && typeof v.height === "number" && Array.isArray(v.variants);
|
|
2141
2174
|
}
|
|
2175
|
+
function assetSrcSet(asset, mediaOrigin) {
|
|
2176
|
+
return asset.variants.flatMap((variant) => {
|
|
2177
|
+
const url = (0, import_builder_schema14.safeUrl)(variant.url, "src", { mediaOrigin });
|
|
2178
|
+
return url === null || url.includes(",") ? [] : [`${url} ${String(variant.width)}w`];
|
|
2179
|
+
}).join(", ");
|
|
2180
|
+
}
|
|
2142
2181
|
function AssetImage(props) {
|
|
2143
|
-
const { asset, alt, sizes, className, loading = "lazy", style, mediaOrigin } = props;
|
|
2182
|
+
const { asset, alt, sizes, className, loading = "lazy", fetchPriority, reserveSpace = true, style, mediaOrigin } = props;
|
|
2144
2183
|
const href = (url) => (0, import_builder_schema14.safeUrl)(url, "src", { mediaOrigin });
|
|
2145
2184
|
if (!isFrozenAsset(asset)) return null;
|
|
2146
2185
|
const src = href(asset.url);
|
|
2147
2186
|
if (src === null) return null;
|
|
2148
|
-
const srcSet = asset
|
|
2149
|
-
const url = href(variant.url);
|
|
2150
|
-
return url === null || url.includes(",") ? [] : [`${url} ${String(variant.width)}w`];
|
|
2151
|
-
}).join(", ");
|
|
2187
|
+
const srcSet = assetSrcSet(asset, mediaOrigin);
|
|
2152
2188
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2153
2189
|
"img",
|
|
2154
2190
|
{
|
|
@@ -2158,17 +2194,18 @@ function AssetImage(props) {
|
|
|
2158
2194
|
height: asset.height,
|
|
2159
2195
|
alt,
|
|
2160
2196
|
loading,
|
|
2197
|
+
...fetchPriority === void 0 ? {} : { fetchPriority },
|
|
2161
2198
|
decoding: "async",
|
|
2162
2199
|
...className === void 0 ? {} : { className },
|
|
2163
|
-
style: { aspectRatio: `${String(asset.width)} / ${String(asset.height)}
|
|
2200
|
+
style: { ...reserveSpace ? { aspectRatio: `${String(asset.width)} / ${String(asset.height)}` } : {}, ...style }
|
|
2164
2201
|
}
|
|
2165
2202
|
);
|
|
2166
2203
|
}
|
|
2167
2204
|
|
|
2168
2205
|
// src/provider.tsx
|
|
2169
|
-
var
|
|
2206
|
+
var import_react33 = require("react");
|
|
2170
2207
|
var import_builder2 = require("@usethrottle/builder");
|
|
2171
|
-
var
|
|
2208
|
+
var import_ui12 = require("@usethrottle/ui");
|
|
2172
2209
|
|
|
2173
2210
|
// src/page.tsx
|
|
2174
2211
|
var import_react13 = require("react");
|
|
@@ -2298,10 +2335,10 @@ function Redirect({ to }) {
|
|
|
2298
2335
|
}
|
|
2299
2336
|
|
|
2300
2337
|
// src/registry.ts
|
|
2301
|
-
var
|
|
2338
|
+
var import_builder_schema40 = require("@usethrottle/builder-schema");
|
|
2302
2339
|
|
|
2303
2340
|
// src/basics/index.ts
|
|
2304
|
-
var
|
|
2341
|
+
var import_builder_schema38 = require("@usethrottle/builder-schema");
|
|
2305
2342
|
|
|
2306
2343
|
// src/basics/announcement.tsx
|
|
2307
2344
|
var import_react14 = require("react");
|
|
@@ -2474,13 +2511,29 @@ function Announcement({ props, mediaOrigin, editMode }) {
|
|
|
2474
2511
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2475
2512
|
var STYLES = ["primary", "secondary", "outline", "link"];
|
|
2476
2513
|
var SIZES = ["s", "m", "l"];
|
|
2514
|
+
var REL = {
|
|
2515
|
+
nofollow: ["nofollow"],
|
|
2516
|
+
sponsored: ["sponsored"],
|
|
2517
|
+
ugc: ["ugc"],
|
|
2518
|
+
"nofollow-sponsored": ["nofollow", "sponsored"],
|
|
2519
|
+
"nofollow-ugc": ["nofollow", "ugc"],
|
|
2520
|
+
"sponsored-ugc": ["sponsored", "ugc"],
|
|
2521
|
+
"nofollow-sponsored-ugc": ["nofollow", "sponsored", "ugc"]
|
|
2522
|
+
};
|
|
2477
2523
|
function Button({ props, mediaOrigin, inlineEdit }) {
|
|
2478
2524
|
const href = hrefOf(props.link, mediaOrigin);
|
|
2479
2525
|
const className = `tb-b-button tb-b-button--${oneOf(props.style, STYLES, "primary")} tb-b-button--${oneOf(props.size, SIZES, "m")}`;
|
|
2480
|
-
const
|
|
2526
|
+
const label2 = inlineEdit?.("label") ?? str(props.label) ?? "";
|
|
2527
|
+
const tokens = [];
|
|
2528
|
+
if (href !== null) {
|
|
2529
|
+
const rel = typeof props.rel === "string" && Object.hasOwn(REL, props.rel) ? REL[props.rel] : void 0;
|
|
2530
|
+
if (rel !== void 0) tokens.push(...rel);
|
|
2531
|
+
if (props.newTab === true) tokens.push("noopener");
|
|
2532
|
+
}
|
|
2533
|
+
const linkAttrs = href === null ? {} : { href, ...props.newTab === true ? { target: "_blank" } : {}, ...tokens.length === 0 ? {} : { rel: tokens.join(" ") } };
|
|
2481
2534
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
2482
2535
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(BasicStyles, {}),
|
|
2483
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "tb-b-button-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("a", { className, ...
|
|
2536
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "tb-b-button-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("a", { className, ...linkAttrs, children: label2 }) })
|
|
2484
2537
|
] });
|
|
2485
2538
|
}
|
|
2486
2539
|
|
|
@@ -2667,16 +2720,42 @@ var RULES2 = [
|
|
|
2667
2720
|
{ key: "radius", property: "--bx-radius", values: { none: "0", s: "4px", m: "8px", l: "16px", full: "9999px" } },
|
|
2668
2721
|
{ key: "fit", property: "--bx-fit", values: { cover: "cover", contain: "contain" } }
|
|
2669
2722
|
];
|
|
2723
|
+
var NODE_ID = /^[a-z0-9]{8,24}(-[a-z0-9]{8,24})?$/;
|
|
2724
|
+
var RATIOS = { "1:1": "1 / 1", "4:3": "4 / 3", "3:4": "3 / 4", "16:9": "16 / 9" };
|
|
2670
2725
|
function Image({ node, props, mediaOrigin, editMode }) {
|
|
2671
2726
|
const href = hrefOf(props.link, mediaOrigin);
|
|
2672
2727
|
const decorative = props.decorative === true;
|
|
2673
2728
|
const alt = decorative ? "" : typeof props.alt === "string" ? props.alt : "";
|
|
2674
2729
|
const asset = isFrozenAsset(props.image) ? props.image : void 0;
|
|
2675
|
-
const
|
|
2730
|
+
const priority = props.priority === true;
|
|
2731
|
+
const ratio = typeof props.ratio === "string" && Object.hasOwn(RATIOS, props.ratio) ? RATIOS[props.ratio] : void 0;
|
|
2732
|
+
const sizes = "(max-width: 767px) 100vw, 50vw";
|
|
2733
|
+
const mobile = isFrozenAsset(props.mobileImage) ? props.mobileImage : void 0;
|
|
2734
|
+
const mobileSrc = mobile === void 0 ? null : (0, import_builder_schema19.safeUrl)(mobile.url, "src", { mediaOrigin });
|
|
2735
|
+
const directed = mobile !== void 0 && mobileSrc !== null && asset !== void 0;
|
|
2736
|
+
const perBreakpoint = directed && ratio === void 0;
|
|
2737
|
+
const raw = /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2738
|
+
AssetImage,
|
|
2739
|
+
{
|
|
2740
|
+
asset,
|
|
2741
|
+
mediaOrigin,
|
|
2742
|
+
alt,
|
|
2743
|
+
className: "tb-b-img",
|
|
2744
|
+
sizes,
|
|
2745
|
+
reserveSpace: !perBreakpoint,
|
|
2746
|
+
...priority ? { loading: "eager", fetchPriority: "high" } : {},
|
|
2747
|
+
...ratio === void 0 ? {} : { style: { aspectRatio: ratio } }
|
|
2748
|
+
}
|
|
2749
|
+
);
|
|
2750
|
+
const reserve = perBreakpoint && asset !== void 0 && mobile !== void 0 && NODE_ID.test(node.id) && [asset.width, asset.height, mobile.width, mobile.height].every((n) => Number.isInteger(n) && n > 0) ? `[data-b-id="${node.id}"] .tb-b-img{aspect-ratio:${String(asset.width)} / ${String(asset.height)}}@media (max-width:767px){[data-b-id="${node.id}"] .tb-b-img{aspect-ratio:${String(mobile.width)} / ${String(mobile.height)}}}` : "";
|
|
2751
|
+
const image = directed ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("picture", { children: [
|
|
2752
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("source", { media: "(max-width:767px)", srcSet: assetSrcSet(mobile, mediaOrigin) || mobileSrc, sizes: "100vw", width: mobile.width, height: mobile.height }),
|
|
2753
|
+
raw
|
|
2754
|
+
] }) : raw;
|
|
2676
2755
|
const shown2 = asset !== void 0 && (0, import_builder_schema19.safeUrl)(asset.url, "src", { mediaOrigin }) !== null;
|
|
2677
2756
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
2678
2757
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(BasicStyles, {}),
|
|
2679
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(WidgetStyle, { css: enumCss(node, RULES2) }),
|
|
2758
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(WidgetStyle, { css: enumCss(node, RULES2) + reserve }),
|
|
2680
2759
|
shown2 ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "tb-b-image", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "tb-b-image-box", children: href === null ? image : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("a", { href, children: image }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Placeholder, { editMode, children: asset === void 0 ? "Choose an image" : "Image unavailable" })
|
|
2681
2760
|
] });
|
|
2682
2761
|
}
|
|
@@ -2739,7 +2818,7 @@ function Menu({ props, mediaOrigin, editMode }) {
|
|
|
2739
2818
|
const menus = design?.menus;
|
|
2740
2819
|
const items = menus !== void 0 && Object.hasOwn(menus, name) ? menus[name] : void 0;
|
|
2741
2820
|
const strings = design?.strings;
|
|
2742
|
-
const
|
|
2821
|
+
const label2 = (strings !== void 0 && Object.hasOwn(strings, "nav.menu") ? str(strings["nav.menu"]) : void 0) ?? import_builder_schema21.SITE_STRING_DEFAULTS["nav.menu"];
|
|
2743
2822
|
if (items === void 0 || items.length === 0) {
|
|
2744
2823
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
2745
2824
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(BasicStyles, {}),
|
|
@@ -2759,7 +2838,7 @@ function Menu({ props, mediaOrigin, editMode }) {
|
|
|
2759
2838
|
"nav",
|
|
2760
2839
|
{
|
|
2761
2840
|
className: `tb-b-menu tb-b-menu--${layout}${layout === "vertical" ? "" : " tb-b-menu--h"}`,
|
|
2762
|
-
"aria-label":
|
|
2841
|
+
"aria-label": label2,
|
|
2763
2842
|
"data-open": drawer ? String(open) : void 0,
|
|
2764
2843
|
onKeyDown: drawer ? onKeyDown : void 0,
|
|
2765
2844
|
children: [
|
|
@@ -2772,7 +2851,7 @@ function Menu({ props, mediaOrigin, editMode }) {
|
|
|
2772
2851
|
"aria-expanded": open,
|
|
2773
2852
|
"aria-controls": listId,
|
|
2774
2853
|
onClick: () => setOpen2((value) => !value),
|
|
2775
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_ui4.Icon, { name: open ? "close" : "menu", size: 24, label })
|
|
2854
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_ui4.Icon, { name: open ? "close" : "menu", size: 24, label: label2 })
|
|
2776
2855
|
}
|
|
2777
2856
|
),
|
|
2778
2857
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(List, { items, mediaOrigin, id: listId, ...drawer ? { onNavigate: () => setOpen2(false) } : {} })
|
|
@@ -3006,11 +3085,58 @@ function Text({ props, mediaOrigin, editMode, inlineEdit }) {
|
|
|
3006
3085
|
|
|
3007
3086
|
// src/basics/video.tsx
|
|
3008
3087
|
var import_react17 = require("react");
|
|
3088
|
+
var import_builder_schema23 = require("@usethrottle/builder-schema");
|
|
3009
3089
|
var import_ui5 = require("@usethrottle/ui");
|
|
3090
|
+
|
|
3091
|
+
// src/server/jsonld.ts
|
|
3092
|
+
var CONTEXT = "https://schema.org";
|
|
3093
|
+
var isHttp = (value) => typeof value === "string" && /^https?:\/\/[^\s]+$/iu.test(value);
|
|
3094
|
+
function breadcrumbJsonLd(items) {
|
|
3095
|
+
return {
|
|
3096
|
+
"@context": CONTEXT,
|
|
3097
|
+
"@type": "BreadcrumbList",
|
|
3098
|
+
itemListElement: items.map((item, index) => ({
|
|
3099
|
+
"@type": "ListItem",
|
|
3100
|
+
position: index + 1,
|
|
3101
|
+
name: item.name,
|
|
3102
|
+
item: item.url
|
|
3103
|
+
}))
|
|
3104
|
+
};
|
|
3105
|
+
}
|
|
3106
|
+
function faqJsonLd(items) {
|
|
3107
|
+
return {
|
|
3108
|
+
"@context": CONTEXT,
|
|
3109
|
+
"@type": "FAQPage",
|
|
3110
|
+
mainEntity: items.map((item) => ({
|
|
3111
|
+
"@type": "Question",
|
|
3112
|
+
name: item.question,
|
|
3113
|
+
acceptedAnswer: { "@type": "Answer", text: item.answer }
|
|
3114
|
+
}))
|
|
3115
|
+
};
|
|
3116
|
+
}
|
|
3117
|
+
function videoJsonLd(input) {
|
|
3118
|
+
return {
|
|
3119
|
+
"@context": CONTEXT,
|
|
3120
|
+
"@type": "VideoObject",
|
|
3121
|
+
name: input.name,
|
|
3122
|
+
...input.description === void 0 || input.description === "" ? {} : { description: input.description },
|
|
3123
|
+
thumbnailUrl: [input.thumbnailUrl],
|
|
3124
|
+
uploadDate: input.uploadDate,
|
|
3125
|
+
...isHttp(input.embedUrl) ? { embedUrl: input.embedUrl } : {},
|
|
3126
|
+
...isHttp(input.contentUrl) ? { contentUrl: input.contentUrl } : {}
|
|
3127
|
+
};
|
|
3128
|
+
}
|
|
3129
|
+
function jsonLdString(value) {
|
|
3130
|
+
return JSON.stringify(value).replaceAll("<", "\\u003c");
|
|
3131
|
+
}
|
|
3132
|
+
|
|
3133
|
+
// src/basics/video.tsx
|
|
3010
3134
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3011
3135
|
var RULES3 = [
|
|
3012
3136
|
{ key: "ratio", property: "--bx-ratio", values: { "16:9": "16 / 9", "4:3": "4 / 3", "1:1": "1 / 1", "9:16": "9 / 16" } }
|
|
3013
3137
|
];
|
|
3138
|
+
var POSTER_STYLE = { position: "absolute", inset: 0, inlineSize: "100%", blockSize: "100%", objectFit: "cover" };
|
|
3139
|
+
var ISO_DATE = /^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:\d{2}))?$/;
|
|
3014
3140
|
var YOUTUBE_ID = /^[A-Za-z0-9_-]{11}$/;
|
|
3015
3141
|
var VIMEO_ID = /^\d{5,12}$/;
|
|
3016
3142
|
var YOUTUBE_HOSTS = /* @__PURE__ */ new Set(["youtube.com", "www.youtube.com", "m.youtube.com", "youtube-nocookie.com", "www.youtube-nocookie.com"]);
|
|
@@ -3046,32 +3172,72 @@ function parseVideoUrl(input) {
|
|
|
3046
3172
|
function embedSrc(video, muted) {
|
|
3047
3173
|
return video.provider === "youtube" ? `https://www.youtube-nocookie.com/embed/${video.id}?autoplay=1&rel=0&playsinline=1${muted ? "&mute=1" : ""}` : `https://player.vimeo.com/video/${video.id}?autoplay=1&dnt=1${muted ? "&muted=1" : ""}`;
|
|
3048
3174
|
}
|
|
3049
|
-
function Video({ node, props, editMode }) {
|
|
3175
|
+
function Video({ node, props, mediaOrigin, editMode }) {
|
|
3050
3176
|
const [loaded, setLoaded] = (0, import_react17.useState)(false);
|
|
3051
3177
|
const video = parseVideoUrl(str(props.url) ?? "");
|
|
3178
|
+
const title = str(props.title);
|
|
3179
|
+
const poster = isFrozenAsset(props.poster) ? props.poster : void 0;
|
|
3180
|
+
const posterSrc = poster === void 0 ? null : (0, import_builder_schema23.safeUrl)(poster.url, "src", { mediaOrigin });
|
|
3181
|
+
const priority = props.priority === true;
|
|
3182
|
+
const uploadDate = str(props.uploadDate);
|
|
3183
|
+
const jsonLd = video !== null && title !== void 0 && posterSrc !== null && uploadDate !== void 0 && ISO_DATE.test(uploadDate) && !Number.isNaN(Date.parse(uploadDate)) ? jsonLdString(
|
|
3184
|
+
videoJsonLd({
|
|
3185
|
+
name: title,
|
|
3186
|
+
thumbnailUrl: posterSrc,
|
|
3187
|
+
uploadDate,
|
|
3188
|
+
description: str(props.description),
|
|
3189
|
+
embedUrl: embedSrc(video, false).split("?")[0]
|
|
3190
|
+
})
|
|
3191
|
+
) : null;
|
|
3052
3192
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
3053
3193
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(BasicStyles, {}),
|
|
3054
3194
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(WidgetStyle, { css: enumCss(node, RULES3) }),
|
|
3055
|
-
video === null ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Placeholder, { editMode, children: "Paste a YouTube or Vimeo link" }) : /* @__PURE__ */ (0, import_jsx_runtime33.
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3195
|
+
video === null ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Placeholder, { editMode, children: "Paste a YouTube or Vimeo link" }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "tb-b-video", "data-provider": video.provider, children: [
|
|
3196
|
+
loaded && !editMode ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3197
|
+
"iframe",
|
|
3198
|
+
{
|
|
3199
|
+
src: embedSrc(video, props.autoplayMuted === true),
|
|
3200
|
+
title: title ?? "Video",
|
|
3201
|
+
allow: "autoplay; encrypted-media; picture-in-picture; fullscreen",
|
|
3202
|
+
referrerPolicy: "strict-origin-when-cross-origin",
|
|
3203
|
+
sandbox: "allow-scripts allow-same-origin allow-presentation allow-popups"
|
|
3204
|
+
}
|
|
3205
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
3206
|
+
posterSrc !== null && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3207
|
+
AssetImage,
|
|
3208
|
+
{
|
|
3209
|
+
asset: poster,
|
|
3210
|
+
mediaOrigin,
|
|
3211
|
+
alt: "",
|
|
3212
|
+
className: "tb-b-video-poster",
|
|
3213
|
+
style: POSTER_STYLE,
|
|
3214
|
+
sizes: "(max-width: 767px) 100vw, 50vw",
|
|
3215
|
+
...priority ? { loading: "eager", fetchPriority: "high" } : {}
|
|
3216
|
+
}
|
|
3217
|
+
),
|
|
3218
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3219
|
+
"button",
|
|
3220
|
+
{
|
|
3221
|
+
type: "button",
|
|
3222
|
+
className: "tb-b-play",
|
|
3223
|
+
"aria-label": title === void 0 ? "Play video" : `Play video: ${title}`,
|
|
3224
|
+
onClick: () => setLoaded(true),
|
|
3225
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_ui5.Icon, { name: "play", size: 28 }) })
|
|
3226
|
+
}
|
|
3227
|
+
)
|
|
3228
|
+
] }),
|
|
3229
|
+
jsonLd !== null && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("script", { type: "application/ld+json", children: jsonLd })
|
|
3230
|
+
] })
|
|
3065
3231
|
] });
|
|
3066
3232
|
}
|
|
3067
3233
|
|
|
3068
3234
|
// src/basics/v2/announcement-v2.tsx
|
|
3069
3235
|
var import_react19 = require("react");
|
|
3070
3236
|
var import_ui7 = require("@usethrottle/ui");
|
|
3071
|
-
var
|
|
3237
|
+
var import_builder_schema26 = require("@usethrottle/builder-schema");
|
|
3072
3238
|
|
|
3073
3239
|
// src/theme.ts
|
|
3074
|
-
var
|
|
3240
|
+
var import_builder_schema24 = require("@usethrottle/builder-schema");
|
|
3075
3241
|
var import_presets = require("@usethrottle/ui/presets");
|
|
3076
3242
|
var isRecord5 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
3077
3243
|
var str2 = (v) => typeof v === "string" && v !== "" ? v : void 0;
|
|
@@ -3120,7 +3286,7 @@ var SYSTEM_STACK = {
|
|
|
3120
3286
|
};
|
|
3121
3287
|
function fontStack(family) {
|
|
3122
3288
|
if (Object.hasOwn(SYSTEM_STACK, family)) return SYSTEM_STACK[family];
|
|
3123
|
-
const known =
|
|
3289
|
+
const known = import_builder_schema24.SITE_FONTS.find((f) => f.family === family);
|
|
3124
3290
|
if (known === void 0 || !/^[A-Za-z0-9 ]{1,60}$/.test(family)) return SYSTEM_STACK["system-sans"];
|
|
3125
3291
|
return `"${family}", ${Object.hasOwn(GENERIC, known.category) ? GENERIC[known.category] : "sans-serif"}`;
|
|
3126
3292
|
}
|
|
@@ -3169,14 +3335,14 @@ function customCssOf(settings, mediaOrigin = "") {
|
|
|
3169
3335
|
const theme = isRecord5(settings.theme) ? settings.theme : {};
|
|
3170
3336
|
const css = theme.customCss;
|
|
3171
3337
|
if (typeof css !== "string" || css.trim() === "") return "";
|
|
3172
|
-
return (0,
|
|
3338
|
+
return (0, import_builder_schema24.sanitizeSiteCss)(css, { mediaOrigin }).css;
|
|
3173
3339
|
}
|
|
3174
3340
|
var CUSTOM_CSS_INLINE_MAX_BYTES = 4096;
|
|
3175
3341
|
function customCssDeliveryOf(settings, answerTheme, mediaOrigin = "") {
|
|
3176
3342
|
const theme = isRecord5(settings.theme) ? settings.theme : {};
|
|
3177
3343
|
const raw = typeof theme.customCss === "string" ? theme.customCss : "";
|
|
3178
3344
|
const candidate = isRecord5(answerTheme) ? answerTheme.customCssHref : void 0;
|
|
3179
|
-
const href = typeof candidate === "string" && /^https:\/\/[^\s/\\]+\/[^\s\\]*$/iu.test(candidate) && (0,
|
|
3345
|
+
const href = typeof candidate === "string" && /^https:\/\/[^\s/\\]+\/[^\s\\]*$/iu.test(candidate) && (0, import_builder_schema24.safeUrl)(candidate, "href", { mediaOrigin: "" }) !== null && new URL(candidate).pathname.includes("/v1/css/") ? candidate : void 0;
|
|
3180
3346
|
const inline2 = customCssOf(settings, mediaOrigin);
|
|
3181
3347
|
const small = new TextEncoder().encode(inline2).length <= CUSTOM_CSS_INLINE_MAX_BYTES;
|
|
3182
3348
|
if (href !== void 0 && raw.trim() === "") return { inline: "", href };
|
|
@@ -3192,14 +3358,14 @@ function makeResolveLink(settings, packs) {
|
|
|
3192
3358
|
return (target2) => {
|
|
3193
3359
|
for (const pack of packs) {
|
|
3194
3360
|
const href = pack.linkTargets?.resolve(target2) ?? null;
|
|
3195
|
-
if (href !== null) return (0,
|
|
3361
|
+
if (href !== null) return (0, import_builder_schema24.safeUrl)(href, "href", { mediaOrigin: "" });
|
|
3196
3362
|
}
|
|
3197
|
-
if (target2.kind === "url") return (0,
|
|
3198
|
-
if (typeof target2.href === "string") return (0,
|
|
3363
|
+
if (target2.kind === "url") return (0, import_builder_schema24.safeUrl)(target2.href, "href", { mediaOrigin: "" });
|
|
3364
|
+
if (typeof target2.href === "string") return (0, import_builder_schema24.safeUrl)(target2.href, "href", { mediaOrigin: "" });
|
|
3199
3365
|
if (target2.kind === "page") {
|
|
3200
3366
|
const slug2 = str2(target2.slug) ?? str2(target2.handle);
|
|
3201
3367
|
if (slug2 !== void 0 && /^[A-Za-z0-9._~-]{1,200}$/.test(slug2)) {
|
|
3202
|
-
return (0,
|
|
3368
|
+
return (0, import_builder_schema24.safeUrl)(pageRoute.replace("{handle}", slug2), "href", { mediaOrigin: "" });
|
|
3203
3369
|
}
|
|
3204
3370
|
}
|
|
3205
3371
|
return null;
|
|
@@ -3211,13 +3377,13 @@ function menuItems(items, resolve, depth = 0) {
|
|
|
3211
3377
|
const out = [];
|
|
3212
3378
|
for (const item of items) {
|
|
3213
3379
|
if (!isRecord5(item) || !isRecord5(item.target) || typeof item.target.kind !== "string") continue;
|
|
3214
|
-
const
|
|
3380
|
+
const label2 = str2(item.label);
|
|
3215
3381
|
const href = resolve(item.target);
|
|
3216
|
-
if (
|
|
3382
|
+
if (label2 === void 0 || href === null) continue;
|
|
3217
3383
|
const kind = MENU_KINDS.has(item.target.kind) ? item.target.kind : void 0;
|
|
3218
3384
|
const children = menuItems(item.children, resolve, depth + 1);
|
|
3219
3385
|
out.push({
|
|
3220
|
-
label,
|
|
3386
|
+
label: label2,
|
|
3221
3387
|
href,
|
|
3222
3388
|
...kind === void 0 ? {} : { kind },
|
|
3223
3389
|
...children.length === 0 ? {} : { children }
|
|
@@ -3257,7 +3423,7 @@ function normalizeMessages(messages) {
|
|
|
3257
3423
|
}
|
|
3258
3424
|
function eligibleOnAnyDevice(messages, now, audience, page) {
|
|
3259
3425
|
const ids = /* @__PURE__ */ new Set();
|
|
3260
|
-
for (const device of DEVICES4) for (const m of (0,
|
|
3426
|
+
for (const device of DEVICES4) for (const m of (0, import_builder_schema24.eligibleMessages)(messages, { now, device, audience, page })) ids.add(m.id);
|
|
3261
3427
|
return messages.filter((m) => ids.has(m.id));
|
|
3262
3428
|
}
|
|
3263
3429
|
function serverMessages(messages, now, page) {
|
|
@@ -3265,7 +3431,7 @@ function serverMessages(messages, now, page) {
|
|
|
3265
3431
|
}
|
|
3266
3432
|
var assetUrl = (v, mediaOrigin) => {
|
|
3267
3433
|
const raw = typeof v === "string" ? v : isRecord5(v) ? v.url : void 0;
|
|
3268
|
-
return typeof raw === "string" ? (0,
|
|
3434
|
+
return typeof raw === "string" ? (0, import_builder_schema24.safeUrl)(raw, "src", { mediaOrigin }) ?? void 0 : void 0;
|
|
3269
3435
|
};
|
|
3270
3436
|
function partClassesOf(settings) {
|
|
3271
3437
|
const theme = isRecord5(settings.theme) ? settings.theme : {};
|
|
@@ -3323,7 +3489,7 @@ function siteDesignOf(settings, resolve, pageOutlet, mediaOrigin, locale, now =
|
|
|
3323
3489
|
// src/basics/v2/menu-v2.tsx
|
|
3324
3490
|
var import_react18 = require("react");
|
|
3325
3491
|
var import_ui6 = require("@usethrottle/ui");
|
|
3326
|
-
var
|
|
3492
|
+
var import_builder_schema25 = require("@usethrottle/builder-schema");
|
|
3327
3493
|
|
|
3328
3494
|
// src/interactions/menu-runtime.ts
|
|
3329
3495
|
var holds3 = 0;
|
|
@@ -3391,8 +3557,8 @@ function setDrawer(nav, open) {
|
|
|
3391
3557
|
if (open) {
|
|
3392
3558
|
list2.setAttribute("role", "dialog");
|
|
3393
3559
|
list2.setAttribute("aria-modal", "true");
|
|
3394
|
-
const
|
|
3395
|
-
if (
|
|
3560
|
+
const label2 = nav.getAttribute("aria-label");
|
|
3561
|
+
if (label2 !== null) list2.setAttribute("aria-label", label2);
|
|
3396
3562
|
focusablesOf(list2)[0]?.focus();
|
|
3397
3563
|
} else {
|
|
3398
3564
|
list2.removeAttribute("role");
|
|
@@ -3497,6 +3663,7 @@ var MODES = ["horizontal", "vertical", "drawer", "mega"];
|
|
|
3497
3663
|
var MAX_LEVEL = 3;
|
|
3498
3664
|
var CLASS_RE = /^[A-Za-z_][A-Za-z0-9_-]{0,63}$/;
|
|
3499
3665
|
var SUBMENU_DEFAULT = "Show submenu for {label}";
|
|
3666
|
+
var frameSubmenu = (text) => text === "" ? SUBMENU_DEFAULT : text.replaceAll("{name}", "{label}");
|
|
3500
3667
|
function localized(value, locale) {
|
|
3501
3668
|
if (!isRecord4(value)) return str(value);
|
|
3502
3669
|
for (const key of [locale, "en"]) {
|
|
@@ -3511,16 +3678,16 @@ function makeLink(builder, own, mediaOrigin) {
|
|
|
3511
3678
|
const targets = builder?.linkTargets;
|
|
3512
3679
|
const fallback = own ?? builder?.resolveLink;
|
|
3513
3680
|
return (target2) => {
|
|
3514
|
-
if (target2.kind === "url") return (0,
|
|
3681
|
+
if (target2.kind === "url") return (0, import_builder_schema25.safeUrl)(target2.href, "href", { mediaOrigin });
|
|
3515
3682
|
if (targets !== void 0 && typeof target2.id === "string") {
|
|
3516
3683
|
const key = `${String(target2.kind)}:${target2.id}`;
|
|
3517
3684
|
if (Object.hasOwn(targets, key)) {
|
|
3518
3685
|
const known = targets[key];
|
|
3519
|
-
return typeof known === "string" ? (0,
|
|
3686
|
+
return typeof known === "string" ? (0, import_builder_schema25.safeUrl)(known, "href", { mediaOrigin }) : null;
|
|
3520
3687
|
}
|
|
3521
3688
|
}
|
|
3522
3689
|
const raw = fallback?.(target2) ?? null;
|
|
3523
|
-
return raw === null ? null : (0,
|
|
3690
|
+
return raw === null ? null : (0, import_builder_schema25.safeUrl)(raw, "href", { mediaOrigin });
|
|
3524
3691
|
};
|
|
3525
3692
|
}
|
|
3526
3693
|
function megaOf(value, locale) {
|
|
@@ -3540,12 +3707,12 @@ function build(raw, level, b) {
|
|
|
3540
3707
|
raw.forEach((entry, index) => {
|
|
3541
3708
|
if (!isRecord4(entry) || !isRecord4(entry.target)) return;
|
|
3542
3709
|
const target2 = entry.target;
|
|
3543
|
-
const
|
|
3544
|
-
if (
|
|
3710
|
+
const label2 = localized(entry.label, b.r.locale);
|
|
3711
|
+
if (label2 === void 0) return;
|
|
3545
3712
|
out.push({
|
|
3546
3713
|
key: typeof entry.id === "string" ? entry.id : String(index),
|
|
3547
|
-
label,
|
|
3548
|
-
href: target2.kind === "category" && typeof entry.url === "string" ? (0,
|
|
3714
|
+
label: label2,
|
|
3715
|
+
href: target2.kind === "category" && typeof entry.url === "string" ? (0, import_builder_schema25.safeUrl)(entry.url, "href", { mediaOrigin: b.r.mediaOrigin }) : b.r.link(target2),
|
|
3549
3716
|
newTab: entry.newTab === true,
|
|
3550
3717
|
classes: Array.isArray(entry.cssClass) ? entry.cssClass.filter((c) => typeof c === "string" && CLASS_RE.test(c)) : [],
|
|
3551
3718
|
description: localized(entry.description, b.r.locale),
|
|
@@ -3562,7 +3729,7 @@ function fromDesign(items, level, r) {
|
|
|
3562
3729
|
return items.map((item, index) => ({
|
|
3563
3730
|
key: String(index),
|
|
3564
3731
|
label: item.label,
|
|
3565
|
-
href: (0,
|
|
3732
|
+
href: (0, import_builder_schema25.safeUrl)(item.href, "href", { mediaOrigin: r.mediaOrigin }),
|
|
3566
3733
|
newTab: false,
|
|
3567
3734
|
classes: [],
|
|
3568
3735
|
description: void 0,
|
|
@@ -3578,7 +3745,7 @@ var Extras = ({ item, describe }) => /* @__PURE__ */ (0, import_jsx_runtime34.js
|
|
|
3578
3745
|
item.badge === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "tb-mm-badge", children: item.badge }),
|
|
3579
3746
|
describe && item.description !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "tb-mm-desc", children: item.description }) : null
|
|
3580
3747
|
] });
|
|
3581
|
-
function FeaturedPanel({ featured, label, ctx }) {
|
|
3748
|
+
function FeaturedPanel({ featured, label: label2, ctx }) {
|
|
3582
3749
|
const { builder, props } = ctx;
|
|
3583
3750
|
const site = builder?.site;
|
|
3584
3751
|
if (builder === null || site === void 0 || site.status !== "ok") return null;
|
|
@@ -3589,7 +3756,7 @@ function FeaturedPanel({ featured, label, ctx }) {
|
|
|
3589
3756
|
const all2 = part2.savedSections;
|
|
3590
3757
|
if (answer === void 0 && all2 !== void 0 && Object.hasOwn(all2, featured.id)) answer = all2[featured.id];
|
|
3591
3758
|
}
|
|
3592
|
-
const parsed2 = answer === void 0 ? null :
|
|
3759
|
+
const parsed2 = answer === void 0 ? null : import_builder_schema25.sectionNodeSchema.safeParse(answer.section);
|
|
3593
3760
|
if (answer === void 0 || parsed2 === null || !parsed2.success) return null;
|
|
3594
3761
|
const assets = { ...site.footer.assets, ...site.header.assets };
|
|
3595
3762
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "tb-mm-feat", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
@@ -3612,7 +3779,7 @@ function FeaturedPanel({ featured, label, ctx }) {
|
|
|
3612
3779
|
}
|
|
3613
3780
|
if (!isFrozenAsset(asset)) return null;
|
|
3614
3781
|
const href = featured.link === null ? null : makeLink(builder, props.resolveLink, props.mediaOrigin)(featured.link);
|
|
3615
|
-
const image = /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AssetImage, { asset, mediaOrigin: props.mediaOrigin, alt: href === null ? featured.caption : featured.caption ||
|
|
3782
|
+
const image = /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AssetImage, { asset, mediaOrigin: props.mediaOrigin, alt: href === null ? featured.caption : featured.caption || label2 });
|
|
3616
3783
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("figure", { className: "tb-mm-feat", children: [
|
|
3617
3784
|
href === null ? image : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("a", { href, children: image }),
|
|
3618
3785
|
featured.caption === "" ? null : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("figcaption", { children: featured.caption })
|
|
@@ -3667,11 +3834,11 @@ var part = (key, extra) => ({
|
|
|
3667
3834
|
className: [`tsf-${key}`, extra].filter(Boolean).join(" "),
|
|
3668
3835
|
"data-throttle-part": key
|
|
3669
3836
|
});
|
|
3670
|
-
function StorefrontNav({ items, label, listId, ctx, className, menu }) {
|
|
3837
|
+
function StorefrontNav({ items, label: label2, listId, ctx, className, menu }) {
|
|
3671
3838
|
const categories = items.some((item) => item.handle !== void 0);
|
|
3672
3839
|
const handle = (item, parent) => item.handle === void 0 ? {} : { "data-category-handle": item.handle, ...categories ? { "data-category-parent": parent } : {} };
|
|
3673
3840
|
const link = (item) => item.href === null ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { ...part("category-nav-link", "tb-mm-text"), children: item.label }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("a", { ...part("category-nav-link"), href: item.href, ...item.newTab ? { target: "_blank", rel: "noopener noreferrer" } : {}, children: item.label });
|
|
3674
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("nav", { ...part("category-nav", className), "aria-label":
|
|
3841
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("nav", { ...part("category-nav", className), "aria-label": label2, ...categories ? {} : { "data-menu": menu }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("ul", { ...part("category-nav-list"), children: items.map((item) => {
|
|
3675
3842
|
const sub = item.children.length > 0;
|
|
3676
3843
|
const panelId = `${listId}-${item.key.replace(/[^A-Za-z0-9_-]/g, "_")}`;
|
|
3677
3844
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("li", { ...part("category-nav-item", item.classes.join(" ")), "data-nav-top": "", ...sub ? { "data-tb-i": "" } : {}, ...handle(item, ""), children: [
|
|
@@ -3692,11 +3859,11 @@ function StorefrontNav({ items, label, listId, ctx, className, menu }) {
|
|
|
3692
3859
|
] }, item.key);
|
|
3693
3860
|
}) }) });
|
|
3694
3861
|
}
|
|
3695
|
-
function Nav({ items, label, listId, ctx, className, menu }) {
|
|
3696
|
-
if (ctx.variant === "storefront") return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(StorefrontNav, { items, label, listId, ctx, menu, ...className === void 0 ? {} : { className } });
|
|
3862
|
+
function Nav({ items, label: label2, listId, ctx, className, menu }) {
|
|
3863
|
+
if (ctx.variant === "storefront") return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(StorefrontNav, { items, label: label2, listId, ctx, menu, ...className === void 0 ? {} : { className } });
|
|
3697
3864
|
const full = { ...ctx, listId };
|
|
3698
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("nav", { className: `tb-mm tb-mm--${ctx.mode}${className === void 0 ? "" : ` ${className}`}`, "aria-label":
|
|
3699
|
-
ctx.mode === "drawer" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: "tb-mm-drawer", "data-tb-drawer": "", "aria-expanded": "false", "aria-controls": listId, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_ui6.Icon, { name: "menu", size: 24, label }) }),
|
|
3865
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("nav", { className: `tb-mm tb-mm--${ctx.mode}${className === void 0 ? "" : ` ${className}`}`, "aria-label": label2, children: [
|
|
3866
|
+
ctx.mode === "drawer" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", className: "tb-mm-drawer", "data-tb-drawer": "", "aria-expanded": "false", "aria-controls": listId, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_ui6.Icon, { name: "menu", size: 24, label: label2 }) }),
|
|
3700
3867
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(List2, { items, top: { id: listId }, ctx: full })
|
|
3701
3868
|
] });
|
|
3702
3869
|
}
|
|
@@ -3710,7 +3877,7 @@ function MenuV2(props) {
|
|
|
3710
3877
|
const mode = oneOf(settings.mode, MODES, "horizontal");
|
|
3711
3878
|
const r = { mediaOrigin, locale, link: makeLink(builder, props.resolveLink, mediaOrigin) };
|
|
3712
3879
|
const categories = Array.isArray(data.categories) ? data.categories : [];
|
|
3713
|
-
const forMenu = (menu, raw) => build((0,
|
|
3880
|
+
const forMenu = (menu, raw) => build((0, import_builder_schema25.expandMenu)(Array.isArray(raw) ? raw : [], categories).menu, 1, { r, menu, mega: mode === "mega" });
|
|
3714
3881
|
let items = [];
|
|
3715
3882
|
let mobile = [];
|
|
3716
3883
|
const site = builder?.site;
|
|
@@ -3727,15 +3894,15 @@ function MenuV2(props) {
|
|
|
3727
3894
|
}
|
|
3728
3895
|
return fallback;
|
|
3729
3896
|
};
|
|
3730
|
-
const
|
|
3897
|
+
const label2 = word("nav.menu", import_builder_schema25.SITE_STRING_DEFAULTS["nav.menu"]);
|
|
3731
3898
|
if (items.length === 0 && mobile.length === 0) {
|
|
3732
3899
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
3733
3900
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(BasicStyles, {}),
|
|
3734
3901
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Placeholder, { editMode, children: `Menu "${name}" is empty: add links in Site settings` })
|
|
3735
3902
|
] });
|
|
3736
3903
|
}
|
|
3737
|
-
const ctx = { builder, props, mode, variant: oneOf(settings.variant, ["default", "storefront"], "default"), submenu: word("nav.submenu",
|
|
3738
|
-
const nameOf = (menu) => menu === "header" ?
|
|
3904
|
+
const ctx = { builder, props, mode, variant: oneOf(settings.variant, ["default", "storefront"], "default"), submenu: word("nav.submenu", frameSubmenu(word("frame.nav.submenu", ""))) };
|
|
3905
|
+
const nameOf = (menu) => menu === "header" ? label2 : `${label2} (${menu})`;
|
|
3739
3906
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
3740
3907
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(BasicStyles, {}),
|
|
3741
3908
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("style", { href: "tb-menu-v2", precedence: "throttle", children: MENU_V2_CSS }),
|
|
@@ -3805,7 +3972,7 @@ var MENU_V2_CSS = `@layer throttle{
|
|
|
3805
3972
|
}
|
|
3806
3973
|
}
|
|
3807
3974
|
}`;
|
|
3808
|
-
var definition =
|
|
3975
|
+
var definition = import_builder_schema25.MB_BASIC_WIDGET_DEFINITIONS.find((d) => d.type === "basic.menu" && d.v === 2);
|
|
3809
3976
|
if (definition === void 0) throw new Error("builder-schema has no basic.menu v2 definition");
|
|
3810
3977
|
var menuV2Widgets = [{ ...definition, Component: MenuV2 }];
|
|
3811
3978
|
|
|
@@ -3938,7 +4105,7 @@ function Bar({ raw, props, builder }) {
|
|
|
3938
4105
|
}
|
|
3939
4106
|
return fallback;
|
|
3940
4107
|
};
|
|
3941
|
-
const dismissLabel = word("announcement.dismiss",
|
|
4108
|
+
const dismissLabel = word("frame.announcement.dismiss", word("announcement.dismiss", import_builder_schema26.SITE_STRING_DEFAULTS["announcement.dismiss"]));
|
|
3942
4109
|
const dismissible = interactive && style.dismissible === true && settings.dismissible !== false;
|
|
3943
4110
|
const dismiss = (id) => {
|
|
3944
4111
|
writeDismissed(id);
|
|
@@ -4031,47 +4198,18 @@ var ANNOUNCEMENT_V2_CSS = `@layer throttle{
|
|
|
4031
4198
|
@media (min-width:767.99px) and (max-width:1024.98px){.tb-an-hide-tablet{display:none}}
|
|
4032
4199
|
@media (max-width:767.98px){.tb-an-hide-phone{display:none}}
|
|
4033
4200
|
}`;
|
|
4034
|
-
var definition2 =
|
|
4201
|
+
var definition2 = import_builder_schema26.BASIC_WIDGET_DEFINITIONS.find((d) => d.type === "basic.announcement");
|
|
4035
4202
|
if (definition2 === void 0) throw new Error("builder-schema has no basic.announcement definition");
|
|
4036
4203
|
var announcementV2Widgets = [{ ...definition2, Component: AnnouncementV2 }];
|
|
4037
4204
|
|
|
4038
4205
|
// src/basics/v2/breadcrumbs.tsx
|
|
4039
4206
|
var import_ui8 = require("@usethrottle/ui");
|
|
4040
|
-
var
|
|
4041
|
-
|
|
4042
|
-
// src/server/jsonld.ts
|
|
4043
|
-
var CONTEXT = "https://schema.org";
|
|
4044
|
-
function breadcrumbJsonLd(items) {
|
|
4045
|
-
return {
|
|
4046
|
-
"@context": CONTEXT,
|
|
4047
|
-
"@type": "BreadcrumbList",
|
|
4048
|
-
itemListElement: items.map((item, index) => ({
|
|
4049
|
-
"@type": "ListItem",
|
|
4050
|
-
position: index + 1,
|
|
4051
|
-
name: item.name,
|
|
4052
|
-
item: item.url
|
|
4053
|
-
}))
|
|
4054
|
-
};
|
|
4055
|
-
}
|
|
4056
|
-
function faqJsonLd(items) {
|
|
4057
|
-
return {
|
|
4058
|
-
"@context": CONTEXT,
|
|
4059
|
-
"@type": "FAQPage",
|
|
4060
|
-
mainEntity: items.map((item) => ({
|
|
4061
|
-
"@type": "Question",
|
|
4062
|
-
name: item.question,
|
|
4063
|
-
acceptedAnswer: { "@type": "Answer", text: item.answer }
|
|
4064
|
-
}))
|
|
4065
|
-
};
|
|
4066
|
-
}
|
|
4067
|
-
function jsonLdString(value) {
|
|
4068
|
-
return JSON.stringify(value).replaceAll("<", "\\u003c");
|
|
4069
|
-
}
|
|
4207
|
+
var import_builder_schema28 = require("@usethrottle/builder-schema");
|
|
4070
4208
|
|
|
4071
4209
|
// src/basics/v2/definitions.ts
|
|
4072
|
-
var
|
|
4210
|
+
var import_builder_schema27 = require("@usethrottle/builder-schema");
|
|
4073
4211
|
function mbDefinition(type) {
|
|
4074
|
-
const found =
|
|
4212
|
+
const found = import_builder_schema27.MB_BASIC_WIDGET_DEFINITIONS.filter((d) => d.type === type).sort((a, b) => b.v - a.v)[0];
|
|
4075
4213
|
if (found === void 0) throw new Error(`No MB definition of ${type}`);
|
|
4076
4214
|
return found;
|
|
4077
4215
|
}
|
|
@@ -4094,7 +4232,7 @@ function Breadcrumbs({ props, data, mediaOrigin, resolveLink, editMode }) {
|
|
|
4094
4232
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Placeholder, { editMode, children: "The trail appears on a product page" })
|
|
4095
4233
|
] });
|
|
4096
4234
|
}
|
|
4097
|
-
const href = (target2) => (0,
|
|
4235
|
+
const href = (target2) => (0, import_builder_schema28.safeUrl)(resolveLink?.(target2), "href", { mediaOrigin });
|
|
4098
4236
|
const trail = [{ name: str(design?.brand?.storeName?.trim()) ?? "Home", href: "/" }];
|
|
4099
4237
|
for (const step2 of Array.isArray(product.breadcrumbs) ? product.breadcrumbs : []) {
|
|
4100
4238
|
if (!isRecord4(step2) || str(step2.name) === void 0) continue;
|
|
@@ -4124,14 +4262,14 @@ var breadcrumbsWidgets = [{ ...mbDefinition("basic.breadcrumbs"), Component: Bre
|
|
|
4124
4262
|
|
|
4125
4263
|
// src/basics/v2/faq.tsx
|
|
4126
4264
|
var import_react21 = require("react");
|
|
4127
|
-
var
|
|
4265
|
+
var import_builder_schema30 = require("@usethrottle/builder-schema");
|
|
4128
4266
|
|
|
4129
4267
|
// src/basics/v2/markup.tsx
|
|
4130
4268
|
var import_react20 = require("react");
|
|
4131
|
-
var
|
|
4269
|
+
var import_builder_schema29 = require("@usethrottle/builder-schema");
|
|
4132
4270
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4133
|
-
var RICH = new Set(
|
|
4134
|
-
var SVG = new Set(
|
|
4271
|
+
var RICH = new Set(import_builder_schema29.RICH_CONTENT_ALLOWED_TAGS);
|
|
4272
|
+
var SVG = new Set(import_builder_schema29.SVG_ALLOWED_TAGS);
|
|
4135
4273
|
var VOID2 = /* @__PURE__ */ new Set(["br", "hr", "img"]);
|
|
4136
4274
|
var MAX_DEPTH4 = 24;
|
|
4137
4275
|
var TOKEN = /<(\/?)([A-Za-z][A-Za-z0-9]*)((?:\s+[^\s="'<>/]+(?:="[^"]*")?)*)\s*(\/?)>|([^<]+)|</gu;
|
|
@@ -4269,7 +4407,7 @@ function checkUrls(tag, props, mediaOrigin) {
|
|
|
4269
4407
|
for (const key of ["href", "xlinkHref", "src"]) {
|
|
4270
4408
|
if (!Object.hasOwn(props, key)) continue;
|
|
4271
4409
|
const value = props[key];
|
|
4272
|
-
const safe = SVG.has(tag) ? typeof value === "string" && FRAGMENT.test(value) ? value : null : (0,
|
|
4410
|
+
const safe = SVG.has(tag) ? typeof value === "string" && FRAGMENT.test(value) ? value : null : (0, import_builder_schema29.safeUrl)(value, key === "src" ? "src" : "href", { mediaOrigin });
|
|
4273
4411
|
if (safe !== null) {
|
|
4274
4412
|
props[key] = safe;
|
|
4275
4413
|
continue;
|
|
@@ -4289,7 +4427,7 @@ function renderMarkup(nodes, options = {}) {
|
|
|
4289
4427
|
});
|
|
4290
4428
|
}
|
|
4291
4429
|
function svgElement(svg) {
|
|
4292
|
-
const clean = (0,
|
|
4430
|
+
const clean = (0, import_builder_schema29.sanitizeSvg)(svg).svg;
|
|
4293
4431
|
if (clean === "") return null;
|
|
4294
4432
|
const root = parseMarkup(clean, "svg")[0];
|
|
4295
4433
|
if (root === void 0 || typeof root === "string" || root.tag !== "svg") return null;
|
|
@@ -4297,12 +4435,12 @@ function svgElement(svg) {
|
|
|
4297
4435
|
return renderMarkup([withFill])[0] ?? null;
|
|
4298
4436
|
}
|
|
4299
4437
|
async function readSvg(response, mediaOrigin) {
|
|
4300
|
-
if (!response.ok || (0,
|
|
4438
|
+
if (!response.ok || (0, import_builder_schema29.safeUrl)(response.url, "src", { mediaOrigin }) === null) return null;
|
|
4301
4439
|
if (!/^image\/svg\+xml(?:\s*;|$)/iu.test(response.headers.get("content-type") ?? "")) return null;
|
|
4302
4440
|
const reader = response.body?.getReader();
|
|
4303
4441
|
if (reader === void 0) {
|
|
4304
4442
|
const text2 = await response.text();
|
|
4305
|
-
return new TextEncoder().encode(text2).length >
|
|
4443
|
+
return new TextEncoder().encode(text2).length > import_builder_schema29.SVG_MAX_BYTES ? null : text2;
|
|
4306
4444
|
}
|
|
4307
4445
|
const decoder = new TextDecoder();
|
|
4308
4446
|
let total = 0;
|
|
@@ -4311,15 +4449,15 @@ async function readSvg(response, mediaOrigin) {
|
|
|
4311
4449
|
const { done, value } = await reader.read();
|
|
4312
4450
|
if (done) return text + decoder.decode();
|
|
4313
4451
|
total += value.length;
|
|
4314
|
-
if (total >
|
|
4452
|
+
if (total > import_builder_schema29.SVG_MAX_BYTES) {
|
|
4315
4453
|
await reader.cancel();
|
|
4316
4454
|
return null;
|
|
4317
4455
|
}
|
|
4318
4456
|
text += decoder.decode(value, { stream: true });
|
|
4319
4457
|
}
|
|
4320
4458
|
}
|
|
4321
|
-
function SvgFromAsset({ asset, mediaOrigin, label }) {
|
|
4322
|
-
const src = isFrozenAsset(asset) ? (0,
|
|
4459
|
+
function SvgFromAsset({ asset, mediaOrigin, label: label2 }) {
|
|
4460
|
+
const src = isFrozenAsset(asset) ? (0, import_builder_schema29.safeUrl)(asset.url, "src", { mediaOrigin }) : null;
|
|
4323
4461
|
const [source, setSource] = (0, import_react20.useState)(null);
|
|
4324
4462
|
(0, import_react20.useEffect)(() => {
|
|
4325
4463
|
if (src === null) return;
|
|
@@ -4332,7 +4470,7 @@ function SvgFromAsset({ asset, mediaOrigin, label }) {
|
|
|
4332
4470
|
if (src === null) return null;
|
|
4333
4471
|
const inline2 = source === null ? null : svgElement(source);
|
|
4334
4472
|
if (inline2 !== null) return inline2;
|
|
4335
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(AssetImage, { asset, mediaOrigin, alt:
|
|
4473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(AssetImage, { asset, mediaOrigin, alt: label2 ?? "", loading: "eager" });
|
|
4336
4474
|
}
|
|
4337
4475
|
|
|
4338
4476
|
// src/basics/v2/faq.tsx
|
|
@@ -4361,7 +4499,7 @@ function Faq({ props, mediaOrigin, editMode }) {
|
|
|
4361
4499
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Placeholder, { editMode, children: "Add questions in the settings" })
|
|
4362
4500
|
] });
|
|
4363
4501
|
}
|
|
4364
|
-
const answers = items.map((item) => parseMarkup((0,
|
|
4502
|
+
const answers = items.map((item) => parseMarkup((0, import_builder_schema30.sanitizeRichContent)(item.answer, mediaOrigin).html, "rich"));
|
|
4365
4503
|
const open = props.mode === "open";
|
|
4366
4504
|
const oneOpen = props.oneOpen === true;
|
|
4367
4505
|
const showAll = !open && props.expandAll === true && !oneOpen;
|
|
@@ -4459,7 +4597,7 @@ function Quote({ props, mediaOrigin, editMode, inlineEdit }) {
|
|
|
4459
4597
|
var quoteWidgets = [{ ...mbDefinition("basic.quote"), Component: Quote }];
|
|
4460
4598
|
|
|
4461
4599
|
// src/basics/v2/rich-content.tsx
|
|
4462
|
-
var
|
|
4600
|
+
var import_builder_schema31 = require("@usethrottle/builder-schema");
|
|
4463
4601
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
4464
4602
|
var slug = (text) => text.toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/gu, "-").replace(/^-+|-+$/gu, "").slice(0, 40);
|
|
4465
4603
|
function headings(nodes, nodeId) {
|
|
@@ -4468,9 +4606,9 @@ function headings(nodes, nodeId) {
|
|
|
4468
4606
|
for (const node of list2) {
|
|
4469
4607
|
if (typeof node === "string") continue;
|
|
4470
4608
|
if (node.tag === "h2" || node.tag === "h3") {
|
|
4471
|
-
const
|
|
4609
|
+
const label2 = textOf2(node.children).replace(/\s+/gu, " ").trim();
|
|
4472
4610
|
const n = found.size + 1;
|
|
4473
|
-
found.set(node, { id: `${nodeId}-${String(n)}${slug(
|
|
4611
|
+
found.set(node, { id: `${nodeId}-${String(n)}${slug(label2) === "" ? "" : `-${slug(label2)}`}`, level: node.tag === "h2" ? 2 : 3, label: label2 });
|
|
4474
4612
|
}
|
|
4475
4613
|
visit(node.children);
|
|
4476
4614
|
}
|
|
@@ -4486,7 +4624,7 @@ function RichContent({ node, props, mediaOrigin, editMode }) {
|
|
|
4486
4624
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Placeholder, { editMode, children: "Add content in the settings" })
|
|
4487
4625
|
] });
|
|
4488
4626
|
}
|
|
4489
|
-
const tree = parseMarkup((0,
|
|
4627
|
+
const tree = parseMarkup((0, import_builder_schema31.sanitizeRichContent)(html, mediaOrigin).html, "rich");
|
|
4490
4628
|
const entries2 = headings(tree, node.id);
|
|
4491
4629
|
const toc = props.toc === true ? [...entries2.values()].filter((e) => e.label !== "") : [];
|
|
4492
4630
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
@@ -4512,7 +4650,7 @@ var richContentWidgets = [{ ...mbDefinition("basic.rich-content"), Component: Ri
|
|
|
4512
4650
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
4513
4651
|
function Svg({ props, mediaOrigin, editMode }) {
|
|
4514
4652
|
const pasted = str(props.svg);
|
|
4515
|
-
const
|
|
4653
|
+
const label2 = str(props.label);
|
|
4516
4654
|
const inline2 = pasted === void 0 ? null : svgElement(pasted);
|
|
4517
4655
|
const asset = pasted === void 0 && props.asset !== null && props.asset !== void 0 ? props.asset : null;
|
|
4518
4656
|
if (inline2 === null && asset === null) {
|
|
@@ -4522,14 +4660,1375 @@ function Svg({ props, mediaOrigin, editMode }) {
|
|
|
4522
4660
|
] });
|
|
4523
4661
|
}
|
|
4524
4662
|
const decorative = props.decorative !== false;
|
|
4525
|
-
const access = decorative ? { "aria-hidden": true } :
|
|
4663
|
+
const access = decorative ? { "aria-hidden": true } : label2 === void 0 ? {} : { role: "img", "aria-label": label2 };
|
|
4526
4664
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
4527
4665
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(BasicV2Styles, {}),
|
|
4528
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "tb-b-svg", ...access, children: inline2 ?? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SvgFromAsset, { asset, mediaOrigin, ...
|
|
4666
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "tb-b-svg", ...access, children: inline2 ?? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SvgFromAsset, { asset, mediaOrigin, ...label2 === void 0 || decorative ? {} : { label: label2 } }) })
|
|
4529
4667
|
] });
|
|
4530
4668
|
}
|
|
4531
4669
|
var svgWidgets = [{ ...mbDefinition("basic.svg"), Component: Svg }];
|
|
4532
4670
|
|
|
4671
|
+
// src/basics/r23/feature-grid.tsx
|
|
4672
|
+
var import_react22 = require("react");
|
|
4673
|
+
var import_ui10 = require("@usethrottle/ui");
|
|
4674
|
+
var import_builder_schema33 = require("@usethrottle/builder-schema");
|
|
4675
|
+
|
|
4676
|
+
// src/basics/r23/shared.tsx
|
|
4677
|
+
var import_builder_schema32 = require("@usethrottle/builder-schema");
|
|
4678
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
4679
|
+
function r23Definition(type) {
|
|
4680
|
+
const found = import_builder_schema32.BASIC_WIDGET_DEFINITIONS.filter((d) => d.type === type).sort((a, b) => b.v - a.v)[0];
|
|
4681
|
+
if (found === void 0) throw new Error(`No R2.3 definition of ${type}`);
|
|
4682
|
+
return found;
|
|
4683
|
+
}
|
|
4684
|
+
var rowsOf = (value) => Array.isArray(value) ? value.flatMap((row) => isRecord4(row) ? [row] : []) : [];
|
|
4685
|
+
var fill = (template, vars) => template.replace(/\{([a-z]+)\}/gu, (whole, name) => Object.hasOwn(vars, name) ? vars[name] : whole);
|
|
4686
|
+
var textOf3 = (value) => typeof value === "string" ? value : "";
|
|
4687
|
+
function usableAsset(value, mediaOrigin) {
|
|
4688
|
+
return isFrozenAsset(value) && (0, import_builder_schema32.safeUrl)(value.url, "src", { mediaOrigin }) !== null ? value : null;
|
|
4689
|
+
}
|
|
4690
|
+
var srcSetOf = (asset, mediaOrigin) => asset.variants.flatMap((variant) => {
|
|
4691
|
+
const url = (0, import_builder_schema32.safeUrl)(variant.url, "src", { mediaOrigin });
|
|
4692
|
+
return url === null || url.includes(",") ? [] : [`${url} ${String(variant.width)}w`];
|
|
4693
|
+
}).join(", ");
|
|
4694
|
+
function PictureImage({
|
|
4695
|
+
asset,
|
|
4696
|
+
mobile,
|
|
4697
|
+
mediaOrigin,
|
|
4698
|
+
alt,
|
|
4699
|
+
sizes,
|
|
4700
|
+
priority = false,
|
|
4701
|
+
className
|
|
4702
|
+
}) {
|
|
4703
|
+
const src = (0, import_builder_schema32.safeUrl)(asset.url, "src", { mediaOrigin });
|
|
4704
|
+
if (src === null) return null;
|
|
4705
|
+
const srcSet = srcSetOf(asset, mediaOrigin);
|
|
4706
|
+
const img = /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4707
|
+
"img",
|
|
4708
|
+
{
|
|
4709
|
+
src,
|
|
4710
|
+
...srcSet === "" ? {} : { srcSet, sizes },
|
|
4711
|
+
width: asset.width,
|
|
4712
|
+
height: asset.height,
|
|
4713
|
+
alt,
|
|
4714
|
+
loading: priority ? "eager" : "lazy",
|
|
4715
|
+
...priority ? { fetchPriority: "high" } : {},
|
|
4716
|
+
decoding: "async",
|
|
4717
|
+
...className === void 0 ? {} : { className }
|
|
4718
|
+
}
|
|
4719
|
+
);
|
|
4720
|
+
if (mobile === null || mobile === void 0) return img;
|
|
4721
|
+
const mobileSrc = (0, import_builder_schema32.safeUrl)(mobile.url, "src", { mediaOrigin });
|
|
4722
|
+
if (mobileSrc === null) return img;
|
|
4723
|
+
const mobileSet = srcSetOf(mobile, mediaOrigin);
|
|
4724
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("picture", { children: [
|
|
4725
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4726
|
+
"source",
|
|
4727
|
+
{
|
|
4728
|
+
media: "(max-width: 767px)",
|
|
4729
|
+
srcSet: mobileSet === "" ? mobileSrc : mobileSet,
|
|
4730
|
+
...mobileSet === "" ? {} : { sizes: "100vw" },
|
|
4731
|
+
width: mobile.width,
|
|
4732
|
+
height: mobile.height
|
|
4733
|
+
}
|
|
4734
|
+
),
|
|
4735
|
+
img
|
|
4736
|
+
] });
|
|
4737
|
+
}
|
|
4738
|
+
var R23_CSS = `@layer throttle{
|
|
4739
|
+
.tb-b-sr{position:absolute;inline-size:1px;block-size:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
|
|
4740
|
+
.tb-b-iwt{display:flex;flex-direction:var(--bx-dir,row);gap:var(--tb-space-l);align-items:stretch}
|
|
4741
|
+
.tb-b-iwt-media{flex:var(--bx-mediaFr,1) 1 0;min-inline-size:0}
|
|
4742
|
+
.tb-b-iwt-media img{display:block;inline-size:100%;block-size:auto;aspect-ratio:var(--bx-ratio,auto);object-fit:cover;border-radius:var(--throttle-radius,8px)}
|
|
4743
|
+
.tb-b-iwt-content{flex:var(--bx-textFr,1) 1 0;min-inline-size:0;align-self:var(--bx-self,center);box-sizing:border-box;padding:var(--tb-space-m);background:var(--b-cardBackground,transparent);border-radius:var(--throttle-radius,8px);margin-inline-start:calc(var(--bx-overlap,0rem)*var(--bx-sa,0));margin-inline-end:calc(var(--bx-overlap,0rem)*var(--bx-ea,0));position:relative}
|
|
4744
|
+
.tb-b-iwt-kicker{margin:0 0 var(--tb-space-xs);font-size:var(--tb-text-s);letter-spacing:.08em;text-transform:uppercase;color:var(--tb-color-muted-foreground,inherit)}
|
|
4745
|
+
.tb-b-iwt-title{margin:0 0 var(--tb-space-s);font-family:var(--throttle-font-family-heading,inherit);line-height:1.2;overflow-wrap:anywhere}
|
|
4746
|
+
.tb-b-iwt-text{line-height:1.6;overflow-wrap:anywhere}
|
|
4747
|
+
.tb-b-iwt-text>:first-child{margin-block-start:0}
|
|
4748
|
+
.tb-b-iwt-content .tb-b-button{margin-block-start:var(--tb-space-s);min-block-size:44px;box-sizing:border-box}
|
|
4749
|
+
.tb-b-iwt-content a:focus-visible{outline:2px solid var(--tb-color-primary,currentColor);outline-offset:2px}
|
|
4750
|
+
@media (max-width:767px){.tb-b-iwt{flex-direction:var(--bx-pdir,column);gap:var(--tb-space-m)}.tb-b-iwt-media,.tb-b-iwt-content{flex:0 0 auto;align-self:stretch}.tb-b-iwt-content{margin-inline:0}}
|
|
4751
|
+
.tb-b-fg{display:grid;grid-template-columns:repeat(var(--b-columnsDesktop,3),minmax(0,1fr));gap:var(--tb-space-m);margin:0;padding:0;list-style:none;text-align:var(--b-align,left)}
|
|
4752
|
+
@media (max-width:1024px){.tb-b-fg{grid-template-columns:repeat(var(--b-columnsTablet,2),minmax(0,1fr))}}
|
|
4753
|
+
@media (max-width:767px){.tb-b-fg{grid-template-columns:repeat(var(--b-columnsMobile,1),minmax(0,1fr))}}
|
|
4754
|
+
.tb-b-fg-item{display:flex;flex-direction:column;gap:var(--tb-space-s);box-sizing:border-box;min-inline-size:0;align-items:var(--b-align-items,stretch)}
|
|
4755
|
+
.tb-b-fg--left .tb-b-fg-item{flex-direction:row;align-items:flex-start}
|
|
4756
|
+
.tb-b-fg--card .tb-b-fg-item,.tb-b-fg--bordered .tb-b-fg-item{padding:var(--tb-space-m);border-radius:var(--throttle-radius,8px)}
|
|
4757
|
+
.tb-b-fg--card .tb-b-fg-item{background:var(--tb-color-surface,var(--tb-color-muted,#f4f4f4))}
|
|
4758
|
+
.tb-b-fg--bordered .tb-b-fg-item{border:1px solid var(--tb-color-border,currentColor)}
|
|
4759
|
+
.tb-b-fg-media{flex:0 0 auto;display:inline-flex;color:var(--b-iconColor,var(--tb-color-primary,currentColor))}
|
|
4760
|
+
.tb-b-fg-media svg,.tb-b-fg-media img{inline-size:calc(var(--b-iconSize,40)*1px);block-size:calc(var(--b-iconSize,40)*1px);object-fit:cover}
|
|
4761
|
+
.tb-b-fg-title{margin:0;font-family:var(--throttle-font-family-heading,inherit);font-size:var(--tb-text-l);line-height:1.25}
|
|
4762
|
+
.tb-b-fg-title a{color:inherit;display:inline-block;min-block-size:44px;line-height:44px}
|
|
4763
|
+
.tb-b-fg-title a:focus-visible,.tb-b-badge a:focus-visible,.tb-b-logos a:focus-visible,.tb-b-social a:focus-visible,.tb-b-tm-btn:focus-visible,.tb-b-logos-pause:focus-visible,.tb-b-tm-list:focus-visible{outline:2px solid var(--tb-color-primary,currentColor);outline-offset:2px}
|
|
4764
|
+
.tb-b-fg-text>:first-child{margin-block-start:0}
|
|
4765
|
+
.tb-b-fg-text>:last-child{margin-block-end:0}
|
|
4766
|
+
.tb-b-fg-body{min-inline-size:0;display:flex;flex-direction:column;gap:var(--tb-space-xs)}
|
|
4767
|
+
.tb-b-tm{color:var(--b-color,inherit);font-size:var(--b-size,var(--tb-text-m));text-align:var(--b-align,left);position:relative}
|
|
4768
|
+
.tb-b-tm-list{margin:0;padding:0;list-style:none}
|
|
4769
|
+
.tb-b-tm--grid .tb-b-tm-list{display:grid;grid-template-columns:repeat(var(--b-columnsDesktop,3),minmax(0,1fr));gap:var(--tb-space-m)}
|
|
4770
|
+
.tb-b-tm--masonry .tb-b-tm-list{column-count:var(--b-columnsDesktop,3);column-gap:var(--tb-space-m)}
|
|
4771
|
+
.tb-b-tm--masonry .tb-b-tm-list>li{break-inside:avoid;margin-block-end:var(--tb-space-m)}
|
|
4772
|
+
.tb-b-tm--carousel .tb-b-tm-list{display:flex;gap:var(--tb-space-m);overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:thin;overscroll-behavior-x:contain}
|
|
4773
|
+
.tb-b-tm--carousel .tb-b-tm-slide{flex:0 0 calc((100% - (var(--b-columnsDesktop,3) - 1)*var(--tb-space-m))/var(--b-columnsDesktop,3));scroll-snap-align:start;min-inline-size:0}
|
|
4774
|
+
@media (max-width:1024px){.tb-b-tm--grid .tb-b-tm-list{grid-template-columns:repeat(min(var(--b-columnsDesktop,3),2),minmax(0,1fr))}.tb-b-tm--masonry .tb-b-tm-list{column-count:min(var(--b-columnsDesktop,3),2)}.tb-b-tm--carousel .tb-b-tm-slide{flex-basis:calc((100% - var(--tb-space-m))/min(var(--b-columnsDesktop,3),2))}}
|
|
4775
|
+
@media (max-width:767px){.tb-b-tm--grid .tb-b-tm-list{grid-template-columns:repeat(var(--b-columnsMobile,1),minmax(0,1fr))}.tb-b-tm--masonry .tb-b-tm-list{column-count:var(--b-columnsMobile,1)}.tb-b-tm--carousel .tb-b-tm-slide{flex-basis:calc((100% - (var(--b-columnsMobile,1) - 1)*var(--tb-space-m))/var(--b-columnsMobile,1))}}
|
|
4776
|
+
.tb-b-tm-card{margin:0;box-sizing:border-box;block-size:100%;display:flex;flex-direction:column;gap:var(--tb-space-s)}
|
|
4777
|
+
.tb-b-tm--card .tb-b-tm-card,.tb-b-tm--bordered .tb-b-tm-card{padding:var(--tb-space-m);border-radius:var(--throttle-radius,8px)}
|
|
4778
|
+
.tb-b-tm--card .tb-b-tm-card{background:var(--tb-color-surface,var(--tb-color-muted,#f4f4f4))}
|
|
4779
|
+
.tb-b-tm--bordered .tb-b-tm-card{border:1px solid var(--tb-color-border,currentColor)}
|
|
4780
|
+
.tb-b-tm-card blockquote{margin:0;line-height:1.5;overflow-wrap:anywhere}
|
|
4781
|
+
.tb-b-tm-card figcaption{display:flex;align-items:center;gap:var(--tb-space-s);font-size:var(--tb-text-s)}
|
|
4782
|
+
.tb-b-tm-photo{inline-size:44px;block-size:44px;border-radius:50%;object-fit:cover;flex:0 0 auto}
|
|
4783
|
+
.tb-b-tm-by{display:flex;flex-direction:column}
|
|
4784
|
+
.tb-b-tm-name{font-weight:600}
|
|
4785
|
+
.tb-b-tm-role,.tb-b-tm-source{color:var(--tb-color-muted-foreground,inherit)}
|
|
4786
|
+
.tb-b-tm-rating{margin:0;display:flex;gap:2px}
|
|
4787
|
+
.tb-b-star{position:relative;display:inline-block;color:var(--tb-color-border-control,#bbb);line-height:1}
|
|
4788
|
+
.tb-b-star--full{color:var(--tb-color-accent,#f5a623)}
|
|
4789
|
+
.tb-b-star--half::before{content:"\\2605";position:absolute;inset-block-start:0;inset-inline-start:0;inline-size:50%;overflow:hidden;color:var(--tb-color-accent,#f5a623)}
|
|
4790
|
+
.tb-b-tm-ctrl{display:flex;justify-content:center;gap:var(--tb-space-s);margin-block-start:var(--tb-space-s);min-block-size:44px}
|
|
4791
|
+
.tb-b-tm-ctrl--wait{visibility:hidden}
|
|
4792
|
+
@media (prefers-reduced-motion:reduce){.tb-b-tm-pause{display:none}}
|
|
4793
|
+
.tb-b-tm-btn{appearance:none;cursor:pointer;font:inherit;color:inherit;background:var(--tb-color-surface,transparent);border:1px solid var(--tb-color-border-control,currentColor);border-radius:999px;min-inline-size:44px;min-block-size:44px;padding:0 var(--tb-space-m)}
|
|
4794
|
+
.tb-b-tm-btn[hidden]{display:none}
|
|
4795
|
+
@media (prefers-reduced-motion:reduce){.tb-b-tm-list{scroll-behavior:auto}}
|
|
4796
|
+
.tb-b-logos{text-align:var(--b-align,center)}
|
|
4797
|
+
.tb-b-logos-title{margin:0 0 var(--tb-space-s);font-size:var(--tb-text-s);letter-spacing:.08em;text-transform:uppercase;color:var(--tb-color-muted-foreground,inherit)}
|
|
4798
|
+
.tb-b-logos-list{margin:0;padding:0;list-style:none}
|
|
4799
|
+
.tb-b-logos--row .tb-b-logos-list>li,.tb-b-logos--grid .tb-b-logos-list>li{display:inline-flex;align-items:center;justify-content:center;margin:calc(var(--b-gap,var(--tb-space-m))/2)}
|
|
4800
|
+
.tb-b-logos--grid .tb-b-logos-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(8rem,1fr));gap:var(--b-gap,var(--tb-space-m));justify-items:center;align-items:center}
|
|
4801
|
+
.tb-b-logos--grid .tb-b-logos-list>li{margin:0}
|
|
4802
|
+
@media (max-width:767px){.tb-b-logos--grid .tb-b-logos-list{grid-template-columns:repeat(var(--b-columnsMobile,2),minmax(0,1fr))}}
|
|
4803
|
+
.tb-b-logos img{display:block;inline-size:auto;max-inline-size:100%;block-size:calc(var(--b-logoHeight,40)*1px);object-fit:contain;filter:grayscale(var(--b-grayscale,0));opacity:calc(1 - var(--b-grayscale,0)*.25)}
|
|
4804
|
+
.tb-b-logos a{display:inline-flex;align-items:center;min-block-size:44px}
|
|
4805
|
+
.tb-b-logos-warn{padding:var(--tb-space-xs);border:1px dashed currentColor;font-size:var(--tb-text-s)}
|
|
4806
|
+
.tb-b-logos--marquee .tb-b-logos-track{display:flex;overflow-x:auto;scrollbar-width:none}
|
|
4807
|
+
.tb-b-logos--marquee .tb-b-logos-track::-webkit-scrollbar{display:none}
|
|
4808
|
+
.tb-b-logos--marquee .tb-b-logos-list{display:flex;flex:0 0 auto;flex-wrap:nowrap;align-items:center;gap:var(--b-gap,var(--tb-space-m));padding-inline-end:var(--b-gap,var(--tb-space-m))}
|
|
4809
|
+
.tb-b-logos--marquee .tb-b-logos-list>li{flex:0 0 auto;margin:0}
|
|
4810
|
+
.tb-b-logos--marquee.is-live .tb-b-logos-track{inline-size:max-content;animation:tb-b-marquee var(--bx-speed,40s) linear infinite}
|
|
4811
|
+
.tb-b-logos--marquee.is-live{overflow:hidden}
|
|
4812
|
+
:dir(rtl) .tb-b-logos--marquee.is-live .tb-b-logos-track{animation-name:tb-b-marquee-rtl}
|
|
4813
|
+
.tb-b-logos--marquee.is-live.is-paused .tb-b-logos-track,.tb-b-logos--marquee.is-live:hover .tb-b-logos-track,.tb-b-logos--marquee.is-live:focus-within .tb-b-logos-track{animation-play-state:paused}
|
|
4814
|
+
@keyframes tb-b-marquee{to{transform:translateX(-50%)}}
|
|
4815
|
+
@keyframes tb-b-marquee-rtl{to{transform:translateX(50%)}}
|
|
4816
|
+
@media (prefers-reduced-motion:reduce){.tb-b-logos--marquee.is-live .tb-b-logos-track{animation:none}.tb-b-logos-pause{display:none}}
|
|
4817
|
+
.tb-b-logos-pause{appearance:none;cursor:pointer;font:inherit;color:inherit;background:var(--tb-color-surface,transparent);border:1px solid var(--tb-color-border-control,currentColor);border-radius:999px;min-inline-size:44px;min-block-size:44px;margin-block-start:var(--tb-space-xs);padding:0 var(--tb-space-m)}
|
|
4818
|
+
.tb-b-social{margin:0;padding:0;list-style:none;color:var(--b-color,inherit);text-align:var(--b-align,left)}
|
|
4819
|
+
.tb-b-social>li{display:inline-block;vertical-align:top;margin:calc(var(--tb-space-xs)/2)}
|
|
4820
|
+
.tb-b-social a{display:inline-flex;align-items:center;justify-content:center;gap:var(--tb-space-xs);min-inline-size:44px;min-block-size:44px;box-sizing:border-box;padding-inline:var(--tb-space-xs);color:inherit;text-decoration:none}
|
|
4821
|
+
.tb-b-social--icon-label a,.tb-b-social--label a{padding-inline:var(--tb-space-s)}
|
|
4822
|
+
.tb-b-social svg{inline-size:calc(var(--b-iconSize,24)*1px);block-size:calc(var(--b-iconSize,24)*1px);flex:0 0 auto}
|
|
4823
|
+
.tb-b-social--circle a,.tb-b-social--square a{border:1px solid currentColor}
|
|
4824
|
+
.tb-b-social--circle.tb-b-social--icon a{border-radius:50%}
|
|
4825
|
+
.tb-b-social--circle.tb-b-social--icon-label a,.tb-b-social--circle.tb-b-social--label a{border-radius:999px}
|
|
4826
|
+
.tb-b-social--square a{border-radius:var(--throttle-radius,8px)}
|
|
4827
|
+
.tb-b-trust{color:var(--b-color,inherit);font-size:var(--b-size,var(--tb-text-m));text-align:var(--b-align,center)}
|
|
4828
|
+
.tb-b-badges,.tb-b-pay{display:flex;flex-wrap:wrap;gap:var(--tb-space-m);margin:0;padding:0;list-style:none;justify-content:center}
|
|
4829
|
+
.tb-b-trust--grid .tb-b-badges{display:grid;grid-template-columns:repeat(auto-fit,minmax(12rem,1fr))}
|
|
4830
|
+
.tb-b-badge{display:flex;align-items:flex-start;gap:var(--tb-space-s);text-align:start}
|
|
4831
|
+
.tb-b-badge-icon{flex:0 0 auto;display:inline-flex;color:var(--b-iconColor,var(--tb-color-primary,currentColor))}
|
|
4832
|
+
.tb-b-badge-icon svg,.tb-b-badge-icon img{inline-size:calc(var(--b-iconSize,32)*1px);block-size:calc(var(--b-iconSize,32)*1px)}
|
|
4833
|
+
.tb-b-badge-body{display:flex;flex-direction:column}
|
|
4834
|
+
.tb-b-badge-title{font-weight:600}
|
|
4835
|
+
.tb-b-badge a{color:inherit;display:inline-flex;align-items:center;min-block-size:44px}
|
|
4836
|
+
.tb-b-badge-text{font-size:var(--tb-text-s);color:var(--tb-color-muted-foreground,inherit)}
|
|
4837
|
+
.tb-b-pay{margin-block-start:var(--tb-space-m);gap:var(--tb-space-xs)}
|
|
4838
|
+
.tb-b-pay svg{display:block;inline-size:calc(var(--b-iconSize,32)*1.5px);block-size:auto}
|
|
4839
|
+
}`;
|
|
4840
|
+
function R23Styles() {
|
|
4841
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
4842
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BasicStyles, {}),
|
|
4843
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("style", { href: "tb-basics-r23", precedence: "throttle", children: R23_CSS })
|
|
4844
|
+
] });
|
|
4845
|
+
}
|
|
4846
|
+
|
|
4847
|
+
// src/basics/r23/feature-grid.tsx
|
|
4848
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
4849
|
+
var LEVELS2 = ["h2", "h3", "h4"];
|
|
4850
|
+
var CARDS = ["plain", "card", "bordered"];
|
|
4851
|
+
var isIconName2 = (name) => typeof name === "string" && import_ui10.ICON_NAMES.includes(name);
|
|
4852
|
+
function FeatureGrid({ props, mediaOrigin, editMode }) {
|
|
4853
|
+
const rows = rowsOf(props.items).filter((row) => str(row.title) !== void 0 || str(row.text) !== void 0);
|
|
4854
|
+
if (rows.length === 0) {
|
|
4855
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
4856
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(R23Styles, {}),
|
|
4857
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Placeholder, { editMode, children: "Add features in the settings" })
|
|
4858
|
+
] });
|
|
4859
|
+
}
|
|
4860
|
+
const level = oneOf(props.titleLevel, LEVELS2, "h3");
|
|
4861
|
+
const card = oneOf(props.cardStyle, CARDS, "plain");
|
|
4862
|
+
const left = props.mediaPosition === "left";
|
|
4863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
4864
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(R23Styles, {}),
|
|
4865
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("ul", { className: `tb-b-fg tb-b-fg--${card}${left ? " tb-b-fg--left" : ""}`, children: rows.map((row, index) => {
|
|
4866
|
+
const image = usableAsset(row.image, mediaOrigin);
|
|
4867
|
+
const svg = image === null && usableAsset(row.svgAsset, mediaOrigin) !== null ? row.svgAsset : null;
|
|
4868
|
+
const icon = image === null && svg === null && isIconName2(row.icon) ? row.icon : null;
|
|
4869
|
+
const title = str(row.title);
|
|
4870
|
+
const href = hrefOf(row.link, mediaOrigin);
|
|
4871
|
+
const html = str(row.text);
|
|
4872
|
+
const body = html === void 0 ? null : renderMarkup(parseMarkup((0, import_builder_schema33.sanitizeRichContent)(html, mediaOrigin).html, "rich"), { mediaOrigin });
|
|
4873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("li", { className: "tb-b-fg-item", children: [
|
|
4874
|
+
(image !== null || svg !== null || icon !== null) && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "tb-b-fg-media", "aria-hidden": "true", children: image !== null ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(AssetImage, { asset: image, mediaOrigin, alt: "", sizes: "96px" }) : svg !== null ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SvgFromAsset, { asset: svg, mediaOrigin }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_ui10.Icon, { name: icon }) }),
|
|
4875
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "tb-b-fg-body", children: [
|
|
4876
|
+
title !== void 0 && (0, import_react22.createElement)(level, { className: "tb-b-fg-title" }, href === null ? title : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("a", { href, children: title })),
|
|
4877
|
+
body !== null && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "tb-b-fg-text", children: body })
|
|
4878
|
+
] })
|
|
4879
|
+
] }, `${String(index)}:${textOf3(row.title)}`);
|
|
4880
|
+
}) })
|
|
4881
|
+
] });
|
|
4882
|
+
}
|
|
4883
|
+
var featureGridWidgets = [{ ...r23Definition("basic.feature-grid"), Component: FeatureGrid }];
|
|
4884
|
+
|
|
4885
|
+
// src/basics/r23/image-with-text.tsx
|
|
4886
|
+
var import_react23 = require("react");
|
|
4887
|
+
var import_builder_schema34 = require("@usethrottle/builder-schema");
|
|
4888
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
4889
|
+
var TYPE = "basic.image-with-text";
|
|
4890
|
+
var LEVELS3 = ["h1", "h2", "h3", "h4", "h5", "h6"];
|
|
4891
|
+
var BUTTON_STYLES = ["primary", "secondary", "outline", "link"];
|
|
4892
|
+
var RULES4 = [
|
|
4893
|
+
{ key: "imageRatio", property: "--bx-ratio", values: { adapt: "auto", "1:1": "1 / 1", "4:3": "4 / 3", "3:4": "3 / 4", "16:9": "16 / 9" } },
|
|
4894
|
+
{ key: "imagePosition", property: "--bx-dir", values: { left: "row", right: "row-reverse" } },
|
|
4895
|
+
{ key: "imagePosition", property: "--bx-sa", values: { left: "-1", right: "0" } },
|
|
4896
|
+
{ key: "imagePosition", property: "--bx-ea", values: { left: "0", right: "-1" } },
|
|
4897
|
+
{ key: "stackOnPhone", property: "--bx-pdir", values: { "image-first": "column", "text-first": "column-reverse" } },
|
|
4898
|
+
{ key: "contentPosition", property: "--bx-self", values: { top: "flex-start", center: "center", bottom: "flex-end" } },
|
|
4899
|
+
{ key: "overlap", property: "--bx-overlap", values: { none: "0rem", small: "2rem", large: "4rem" } },
|
|
4900
|
+
{ key: "imageWidth", property: "--bx-mediaFr", values: { "33": "1", "50": "1", "66": "2" } },
|
|
4901
|
+
{ key: "imageWidth", property: "--bx-textFr", values: { "33": "2", "50": "1", "66": "1" } }
|
|
4902
|
+
];
|
|
4903
|
+
function ImageWithText({ node, props, mediaOrigin, editMode, inlineEdit }) {
|
|
4904
|
+
const image = usableAsset(props.image, mediaOrigin);
|
|
4905
|
+
const mobile = usableAsset(props.mobileImage, mediaOrigin);
|
|
4906
|
+
const title = inlineEdit?.("title") ?? str(props.title);
|
|
4907
|
+
const kicker = str(props.kicker);
|
|
4908
|
+
const html = str(props.text);
|
|
4909
|
+
const label2 = str(props.buttonLabel);
|
|
4910
|
+
const href = hrefOf(props.buttonLink, mediaOrigin);
|
|
4911
|
+
const body = html === void 0 ? null : renderMarkup(parseMarkup((0, import_builder_schema34.sanitizeRichContent)(html, mediaOrigin).html, "rich"), { mediaOrigin });
|
|
4912
|
+
if (image === null && title === void 0 && kicker === void 0 && html === void 0 && label2 === void 0) {
|
|
4913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
|
|
4914
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(R23Styles, {}),
|
|
4915
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Placeholder, { editMode, children: "Choose an image and write some text" })
|
|
4916
|
+
] });
|
|
4917
|
+
}
|
|
4918
|
+
const alt = props.decorative === true ? "" : str(props.alt) ?? "";
|
|
4919
|
+
const level = oneOf(props.titleLevel, LEVELS3, "h2");
|
|
4920
|
+
const style = oneOf(props.buttonStyle, BUTTON_STYLES, "primary");
|
|
4921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
|
|
4922
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(R23Styles, {}),
|
|
4923
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(WidgetStyle, { css: enumCss(node, RULES4) }),
|
|
4924
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "tb-b-iwt", children: [
|
|
4925
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "tb-b-iwt-media", children: [
|
|
4926
|
+
image !== null && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PictureImage, { asset: image, mobile, mediaOrigin, alt, sizes: `(max-width: 767px) 100vw, ${oneOf(props.imageWidth, ["33", "50", "66"], "50")}vw`, priority: props.priority === true }),
|
|
4927
|
+
editMode && image !== null && alt === "" && props.decorative !== true && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "tb-b-empty", children: "Add alt text or mark the image decorative" })
|
|
4928
|
+
] }),
|
|
4929
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "tb-b-iwt-content", children: [
|
|
4930
|
+
kicker !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "tb-b-iwt-kicker", children: kicker }),
|
|
4931
|
+
title !== void 0 && (0, import_react23.createElement)(level, { className: "tb-b-iwt-title" }, title),
|
|
4932
|
+
body !== null && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "tb-b-iwt-text", children: body }),
|
|
4933
|
+
label2 !== void 0 && href !== null && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("a", { className: `tb-b-button tb-b-button--${style} tb-b-button--m`, href, children: label2 })
|
|
4934
|
+
] })
|
|
4935
|
+
] })
|
|
4936
|
+
] });
|
|
4937
|
+
}
|
|
4938
|
+
var imageWithTextWidgets = [{ ...r23Definition(TYPE), Component: ImageWithText }];
|
|
4939
|
+
|
|
4940
|
+
// src/basics/r23/logo-strip.tsx
|
|
4941
|
+
var import_react24 = require("react");
|
|
4942
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
4943
|
+
var LAYOUTS2 = ["row", "grid", "marquee"];
|
|
4944
|
+
var RULES5 = [{ key: "speed", property: "--bx-speed", values: { slow: "60s", medium: "40s", fast: "20s" } }];
|
|
4945
|
+
function LogoStrip({ node, props, mediaOrigin, editMode }) {
|
|
4946
|
+
const titleId = (0, import_react24.useId)();
|
|
4947
|
+
const [reduced2, setReduced] = (0, import_react24.useState)(null);
|
|
4948
|
+
const [paused, setPaused] = (0, import_react24.useState)(false);
|
|
4949
|
+
const layout = oneOf(props.layout, LAYOUTS2, "row");
|
|
4950
|
+
const live = reduced2 === false;
|
|
4951
|
+
(0, import_react24.useEffect)(() => {
|
|
4952
|
+
setReduced(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true);
|
|
4953
|
+
}, []);
|
|
4954
|
+
const pauseLabel = str(props.pauseLabel) ?? "Pause logo scrolling";
|
|
4955
|
+
const playLabel = str(props.playLabel) ?? "Play logo scrolling";
|
|
4956
|
+
const logos = [];
|
|
4957
|
+
const warnings = [];
|
|
4958
|
+
rowsOf(props.items).forEach((row, index) => {
|
|
4959
|
+
const image = usableAsset(row.image, mediaOrigin);
|
|
4960
|
+
if (image === null) return;
|
|
4961
|
+
const decorative = row.decorative === true;
|
|
4962
|
+
const alt = decorative ? "" : str(row.alt) ?? "";
|
|
4963
|
+
if (!decorative && alt === "") {
|
|
4964
|
+
warnings.push(index);
|
|
4965
|
+
return;
|
|
4966
|
+
}
|
|
4967
|
+
logos.push({ key: String(index), image, alt, href: decorative ? null : hrefOf(row.link, mediaOrigin) });
|
|
4968
|
+
});
|
|
4969
|
+
if (logos.length === 0 && !(editMode && warnings.length > 0)) {
|
|
4970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
4971
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(R23Styles, {}),
|
|
4972
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Placeholder, { editMode, children: "Add logos in the settings" })
|
|
4973
|
+
] });
|
|
4974
|
+
}
|
|
4975
|
+
const title = str(props.title);
|
|
4976
|
+
const marquee = layout === "marquee" && live && logos.length > 0;
|
|
4977
|
+
const renderLogos = (copy) => logos.map((logo) => {
|
|
4978
|
+
const img = /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(AssetImage, { asset: logo.image, mediaOrigin, alt: copy ? "" : logo.alt, sizes: "160px" });
|
|
4979
|
+
const external = logo.href !== null && logo.href.startsWith("https://");
|
|
4980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("li", { children: logo.href === null ? img : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
4981
|
+
"a",
|
|
4982
|
+
{
|
|
4983
|
+
href: logo.href,
|
|
4984
|
+
...external ? { rel: "nofollow noopener" } : {},
|
|
4985
|
+
...copy ? { tabIndex: -1 } : {},
|
|
4986
|
+
children: img
|
|
4987
|
+
}
|
|
4988
|
+
) }, logo.key);
|
|
4989
|
+
});
|
|
4990
|
+
const list2 = /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("ul", { className: "tb-b-logos-list", ...title === void 0 ? {} : { "aria-labelledby": titleId }, children: [
|
|
4991
|
+
renderLogos(false),
|
|
4992
|
+
editMode && warnings.map((index) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("li", { className: "tb-b-logos-warn", children: "Add alt text or mark it decorative" }, `w${String(index)}`))
|
|
4993
|
+
] });
|
|
4994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
4995
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(R23Styles, {}),
|
|
4996
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(WidgetStyle, { css: enumCss(node, RULES5) }),
|
|
4997
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: `tb-b-logos tb-b-logos--${layout}${marquee ? " is-live" : ""}${marquee && paused ? " is-paused" : ""}`, children: [
|
|
4998
|
+
title !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "tb-b-logos-title", id: titleId, children: title }),
|
|
4999
|
+
layout === "marquee" ? /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "tb-b-logos-track", children: [
|
|
5000
|
+
list2,
|
|
5001
|
+
marquee && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("ul", { className: "tb-b-logos-list", "aria-hidden": "true", children: renderLogos(true) })
|
|
5002
|
+
] }) : list2,
|
|
5003
|
+
layout === "marquee" && logos.length > 0 && reduced2 !== true && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: "tb-b-logos-pause", disabled: !live, "aria-label": paused ? playLabel : pauseLabel, onClick: () => setPaused(!paused), children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { "aria-hidden": "true", children: paused ? "\u25B6" : "\u23F8" }) })
|
|
5004
|
+
] })
|
|
5005
|
+
] });
|
|
5006
|
+
}
|
|
5007
|
+
var logoStripWidgets = [{ ...r23Definition("basic.logo-strip"), Component: LogoStrip }];
|
|
5008
|
+
|
|
5009
|
+
// src/basics/r23/social-links.tsx
|
|
5010
|
+
var import_ui11 = require("@usethrottle/ui");
|
|
5011
|
+
var import_builder_schema35 = require("@usethrottle/builder-schema");
|
|
5012
|
+
|
|
5013
|
+
// src/basics/r23/icons.tsx
|
|
5014
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
5015
|
+
var Svg2 = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", focusable: "false", children });
|
|
5016
|
+
var PLATFORM_NAMES = {
|
|
5017
|
+
instagram: "Instagram",
|
|
5018
|
+
facebook: "Facebook",
|
|
5019
|
+
x: "X",
|
|
5020
|
+
tiktok: "TikTok",
|
|
5021
|
+
youtube: "YouTube",
|
|
5022
|
+
pinterest: "Pinterest",
|
|
5023
|
+
linkedin: "LinkedIn",
|
|
5024
|
+
threads: "Threads",
|
|
5025
|
+
whatsapp: "WhatsApp",
|
|
5026
|
+
email: "Email",
|
|
5027
|
+
custom: "Website"
|
|
5028
|
+
};
|
|
5029
|
+
var SOCIAL = {
|
|
5030
|
+
instagram: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Svg2, { children: [
|
|
5031
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "5" }),
|
|
5032
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("circle", { cx: "12", cy: "12", r: "4" }),
|
|
5033
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("circle", { cx: "17.5", cy: "6.5", r: ".6", fill: "currentColor" })
|
|
5034
|
+
] }),
|
|
5035
|
+
facebook: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Svg2, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M15 3h-2.5A3.5 3.5 0 0 0 9 6.5V9H6v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h2z", fill: "currentColor", stroke: "none" }) }),
|
|
5036
|
+
x: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Svg2, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M4 4l16 16M20 4L4 20" }) }),
|
|
5037
|
+
tiktok: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Svg2, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M14 3v11.5a3.5 3.5 0 1 1-3.5-3.5M14 3c.5 3 2.5 4.5 5 4.5" }) }),
|
|
5038
|
+
youtube: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Svg2, { children: [
|
|
5039
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("rect", { x: "2", y: "5", width: "20", height: "14", rx: "4" }),
|
|
5040
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M10 9l6 3-6 3z", fill: "currentColor" })
|
|
5041
|
+
] }),
|
|
5042
|
+
pinterest: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Svg2, { children: [
|
|
5043
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
|
|
5044
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M10.5 20l1.8-7.5M9.5 10.5a2.8 2.8 0 1 1 4.5 2.3" })
|
|
5045
|
+
] }),
|
|
5046
|
+
linkedin: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Svg2, { children: [
|
|
5047
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "3" }),
|
|
5048
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M8 10v6M8 7.5v.01M12 16v-6M12 12.5a2.5 2.5 0 0 1 5 0V16" })
|
|
5049
|
+
] }),
|
|
5050
|
+
threads: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Svg2, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M16.5 8.5C15.8 6.8 14.2 6 12.3 6 9.5 6 7.5 8.2 7.5 12s2 6 5 6c2.6 0 4.2-1.5 4.2-3.5 0-2.3-2.3-3-4.5-3-1.8 0-2.7.9-2.7 1.8" }) }),
|
|
5051
|
+
whatsapp: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Svg2, { children: [
|
|
5052
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M3 21l1.6-4.7A9 9 0 1 1 8 19.5z" }),
|
|
5053
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M9 9c0 3 3 6 6 6l1-1.5-2-1-1 .8c-1-.4-2-1.4-2.4-2.4l.8-1-1-2z", fill: "currentColor" })
|
|
5054
|
+
] }),
|
|
5055
|
+
email: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Svg2, { children: [
|
|
5056
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
5057
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M3 7l9 6 9-6" })
|
|
5058
|
+
] }),
|
|
5059
|
+
custom: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Svg2, { children: [
|
|
5060
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
|
|
5061
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M3 12h18M12 3c3 3 3 15 0 18M12 3c-3 3-3 15 0 18" })
|
|
5062
|
+
] })
|
|
5063
|
+
};
|
|
5064
|
+
var SocialIcon = ({ platform }) => Object.hasOwn(SOCIAL, platform) ? SOCIAL[platform]() : null;
|
|
5065
|
+
var BADGE2 = {
|
|
5066
|
+
"secure-checkout": () => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Svg2, { children: [
|
|
5067
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("rect", { x: "5", y: "11", width: "14", height: "9", rx: "2" }),
|
|
5068
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M8 11V8a4 4 0 0 1 8 0v3" })
|
|
5069
|
+
] }),
|
|
5070
|
+
"free-shipping": () => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Svg2, { children: [
|
|
5071
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M2 6h12v10H2zM14 9h4l3 3v4h-7" }),
|
|
5072
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("circle", { cx: "6", cy: "18", r: "2" }),
|
|
5073
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("circle", { cx: "17", cy: "18", r: "2" })
|
|
5074
|
+
] }),
|
|
5075
|
+
returns: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Svg2, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M4 12a8 8 0 1 0 3-6.2M4 4v4h4" }) }),
|
|
5076
|
+
warranty: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Svg2, { children: [
|
|
5077
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M12 3l8 3v6c0 5-3.5 8-8 9-4.5-1-8-4-8-9V6z" }),
|
|
5078
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M8.5 12l2.5 2.5 4.5-5" })
|
|
5079
|
+
] }),
|
|
5080
|
+
support: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Svg2, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M4 14v-2a8 8 0 0 1 16 0v2M4 14h3v5H5a1 1 0 0 1-1-1zM20 14h-3v5h2a1 1 0 0 0 1-1z" }) }),
|
|
5081
|
+
eco: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Svg2, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M5 19c0-8 5-14 15-14 0 10-6 15-14 15M5 19c2-5 5-8 9-10" }) })
|
|
5082
|
+
};
|
|
5083
|
+
var BadgeIcon = ({ name }) => Object.hasOwn(BADGE2, name) ? BADGE2[name]() : null;
|
|
5084
|
+
var Card = ({ title, fill: fill2 = "#fff", children }) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("svg", { viewBox: "0 0 40 26", role: "img", children: [
|
|
5085
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("title", { children: title }),
|
|
5086
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("rect", { x: ".5", y: ".5", width: "39", height: "25", rx: "4", fill: fill2, stroke: "#c8c8c8" }),
|
|
5087
|
+
children
|
|
5088
|
+
] });
|
|
5089
|
+
var label = (text, fill2, size = 9, extra = {}) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("text", { x: "20", y: "16", textAnchor: "middle", fontFamily: "Arial, Helvetica, sans-serif", fontSize: size, fontWeight: "700", fill: fill2, ...extra, children: text });
|
|
5090
|
+
var PAYMENT = {
|
|
5091
|
+
visa: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Card, { title: "Visa", children: label("VISA", "#1a1f71", 10, { fontStyle: "italic" }) }),
|
|
5092
|
+
mastercard: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Card, { title: "Mastercard", children: [
|
|
5093
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("circle", { cx: "15", cy: "13", r: "7", fill: "#eb001b" }),
|
|
5094
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("circle", { cx: "25", cy: "13", r: "7", fill: "#f79e1b", fillOpacity: ".85" })
|
|
5095
|
+
] }),
|
|
5096
|
+
amex: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Card, { title: "American Express", fill: "#2e77bb", children: label("AMEX", "#fff", 9) }),
|
|
5097
|
+
discover: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Card, { title: "Discover", children: [
|
|
5098
|
+
label("DISCOVER", "#222", 5.5),
|
|
5099
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("circle", { cx: "30", cy: "20", r: "3", fill: "#f58220" })
|
|
5100
|
+
] }),
|
|
5101
|
+
paypal: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Card, { title: "PayPal", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("text", { x: "20", y: "16", textAnchor: "middle", fontFamily: "Arial, Helvetica, sans-serif", fontSize: "8", fontWeight: "700", fill: "#003087", children: [
|
|
5102
|
+
"Pay",
|
|
5103
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("tspan", { fill: "#009cde", children: "Pal" })
|
|
5104
|
+
] }) }),
|
|
5105
|
+
"apple-pay": () => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Card, { title: "Apple Pay", children: label("Apple Pay", "#000", 6.5) }),
|
|
5106
|
+
"google-pay": () => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Card, { title: "Google Pay", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("text", { x: "20", y: "16", textAnchor: "middle", fontFamily: "Arial, Helvetica, sans-serif", fontSize: "7.5", fontWeight: "700", fill: "#5f6368", children: [
|
|
5107
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("tspan", { fill: "#4285f4", children: "G" }),
|
|
5108
|
+
" Pay"
|
|
5109
|
+
] }) }),
|
|
5110
|
+
klarna: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Card, { title: "Klarna", fill: "#ffb3c7", children: label("Klarna", "#17120f", 8) }),
|
|
5111
|
+
maestro: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Card, { title: "Maestro", children: [
|
|
5112
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("circle", { cx: "15", cy: "13", r: "7", fill: "#eb001b" }),
|
|
5113
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("circle", { cx: "25", cy: "13", r: "7", fill: "#0099df", fillOpacity: ".85" })
|
|
5114
|
+
] }),
|
|
5115
|
+
diners: () => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Card, { title: "Diners Club", children: [
|
|
5116
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("circle", { cx: "20", cy: "13", r: "8", fill: "none", stroke: "#0079be", strokeWidth: "2" }),
|
|
5117
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M20 5v16", stroke: "#0079be", strokeWidth: "2" })
|
|
5118
|
+
] })
|
|
5119
|
+
};
|
|
5120
|
+
var PaymentMark = ({ method }) => Object.hasOwn(PAYMENT, method) ? PAYMENT[method]() : null;
|
|
5121
|
+
|
|
5122
|
+
// src/basics/r23/social-links.tsx
|
|
5123
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
5124
|
+
var STYLES2 = ["icon", "icon-label", "label"];
|
|
5125
|
+
var SHAPES = ["none", "circle", "square"];
|
|
5126
|
+
var EMAIL = /^[^\s@<>"'\\]+@[^\s@<>"'\\]+\.[^\s@<>"'\\]+$/u;
|
|
5127
|
+
var PHONE = /^\+?\d{6,15}$/u;
|
|
5128
|
+
function socialHref(platform, value, mediaOrigin) {
|
|
5129
|
+
const url = value.trim();
|
|
5130
|
+
if (platform === "email") {
|
|
5131
|
+
const address = url.replace(/^mailto:/iu, "");
|
|
5132
|
+
return EMAIL.test(address) ? `mailto:${address}` : null;
|
|
5133
|
+
}
|
|
5134
|
+
if (platform === "whatsapp" && !url.startsWith("https://")) {
|
|
5135
|
+
const digits = url.replace(/[\s().-]/gu, "");
|
|
5136
|
+
return PHONE.test(digits) ? `https://wa.me/${digits.replace("+", "")}` : null;
|
|
5137
|
+
}
|
|
5138
|
+
const safe = (0, import_builder_schema35.safeUrl)(url, "href", { mediaOrigin });
|
|
5139
|
+
if (safe === null) return null;
|
|
5140
|
+
return safe.startsWith("https://") || platform === "custom" && safe.startsWith("/") ? safe : null;
|
|
5141
|
+
}
|
|
5142
|
+
function SocialLinks({ props, mediaOrigin, editMode }) {
|
|
5143
|
+
const design = (0, import_ui11.useSiteDesign)();
|
|
5144
|
+
const store = str(design?.brand?.storeName?.trim());
|
|
5145
|
+
const template = str(props.nameTemplate) ?? "{store} on {platform}";
|
|
5146
|
+
const style = oneOf(props.style, STYLES2, "icon");
|
|
5147
|
+
const shape = oneOf(props.shape, SHAPES, "none");
|
|
5148
|
+
const newTab = props.newTab !== false;
|
|
5149
|
+
const links = rowsOf(props.links).flatMap((row, index) => {
|
|
5150
|
+
const platform = typeof row.platform === "string" && Object.hasOwn(PLATFORM_NAMES, row.platform) ? row.platform : null;
|
|
5151
|
+
const href = platform === null ? null : socialHref(platform, textOf3(row.url), mediaOrigin);
|
|
5152
|
+
return platform === null || href === null ? [] : [{ index, platform, href, label: str(row.label) }];
|
|
5153
|
+
});
|
|
5154
|
+
if (links.length === 0) {
|
|
5155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
5156
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(R23Styles, {}),
|
|
5157
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Placeholder, { editMode, children: "Add your social profiles in the settings" })
|
|
5158
|
+
] });
|
|
5159
|
+
}
|
|
5160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
5161
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(R23Styles, {}),
|
|
5162
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("ul", { className: `tb-b-social tb-b-social--${style} tb-b-social--${shape}`, children: links.map(({ index, platform, href, label: label2 }) => {
|
|
5163
|
+
const platformName = PLATFORM_NAMES[platform];
|
|
5164
|
+
const name = label2 ?? (store === void 0 || platform === "custom" ? platformName : fill(template, { store, platform: platformName }));
|
|
5165
|
+
const visible = style === "icon" ? void 0 : label2 ?? platformName;
|
|
5166
|
+
const web = href.startsWith("http") || href.startsWith("/");
|
|
5167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
5168
|
+
"a",
|
|
5169
|
+
{
|
|
5170
|
+
href,
|
|
5171
|
+
...visible === name ? {} : { "aria-label": name },
|
|
5172
|
+
...web ? { rel: "me noopener" } : {},
|
|
5173
|
+
...web && newTab && href.startsWith("http") ? { target: "_blank" } : {},
|
|
5174
|
+
children: [
|
|
5175
|
+
style !== "label" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SocialIcon, { platform }),
|
|
5176
|
+
visible !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "tb-b-social-label", children: visible })
|
|
5177
|
+
]
|
|
5178
|
+
}
|
|
5179
|
+
) }, `${String(index)}:${platform}`);
|
|
5180
|
+
}) })
|
|
5181
|
+
] });
|
|
5182
|
+
}
|
|
5183
|
+
var socialLinksWidgets = [{ ...r23Definition("basic.social-links"), Component: SocialLinks }];
|
|
5184
|
+
|
|
5185
|
+
// src/basics/r23/testimonials.tsx
|
|
5186
|
+
var import_react25 = require("react");
|
|
5187
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
5188
|
+
var LAYOUTS3 = ["grid", "carousel", "masonry"];
|
|
5189
|
+
var CARDS2 = ["plain", "card", "bordered"];
|
|
5190
|
+
var reducedMotion = () => window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true;
|
|
5191
|
+
function Rating({ value, template }) {
|
|
5192
|
+
const rounded = Math.round(Math.min(5, Math.max(0, value)) * 2) / 2;
|
|
5193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("p", { className: "tb-b-tm-rating", children: [
|
|
5194
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "tb-b-sr", children: fill(template, { rating: String(rounded) }) }),
|
|
5195
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { "aria-hidden": "true", children: [1, 2, 3, 4, 5].map((n) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: `tb-b-star tb-b-star--${rounded >= n ? "full" : rounded >= n - 0.5 ? "half" : "empty"}`, children: "\u2605" }, n)) })
|
|
5196
|
+
] });
|
|
5197
|
+
}
|
|
5198
|
+
function Testimonials({ props, mediaOrigin, editMode }) {
|
|
5199
|
+
const track = (0, import_react25.useRef)(null);
|
|
5200
|
+
const [live, setLive] = (0, import_react25.useState)(false);
|
|
5201
|
+
const [motion, setMotion] = (0, import_react25.useState)(false);
|
|
5202
|
+
const [hover, setHover] = (0, import_react25.useState)(false);
|
|
5203
|
+
const [focus, setFocus] = (0, import_react25.useState)(false);
|
|
5204
|
+
const [paused, setPaused] = (0, import_react25.useState)(false);
|
|
5205
|
+
const layout = oneOf(props.layout, LAYOUTS3, "grid");
|
|
5206
|
+
const rows = rowsOf(props.items).filter((row) => str(row.quote) !== void 0);
|
|
5207
|
+
const carousel = layout === "carousel" && rows.length > 1;
|
|
5208
|
+
const interval = typeof props.intervalMs === "number" ? props.intervalMs : 6e3;
|
|
5209
|
+
const autoplay2 = carousel && props.autoplay === true && live && motion;
|
|
5210
|
+
(0, import_react25.useEffect)(() => {
|
|
5211
|
+
setLive(true);
|
|
5212
|
+
setMotion(!reducedMotion());
|
|
5213
|
+
}, []);
|
|
5214
|
+
const step2 = (dir, wrap = false) => {
|
|
5215
|
+
const el = track.current;
|
|
5216
|
+
if (el === null) return;
|
|
5217
|
+
const slide = el.firstElementChild instanceof HTMLElement ? el.firstElementChild.offsetWidth : 0;
|
|
5218
|
+
const width = slide > 0 ? slide : el.clientWidth;
|
|
5219
|
+
if (wrap && dir > 0 && el.scrollWidth > el.clientWidth && Math.abs(el.scrollLeft) + el.clientWidth >= el.scrollWidth - 2) {
|
|
5220
|
+
el.scrollTo?.({ left: 0, behavior: "auto" });
|
|
5221
|
+
return;
|
|
5222
|
+
}
|
|
5223
|
+
const rtl = getComputedStyle(el).direction === "rtl";
|
|
5224
|
+
el.scrollBy?.({ left: dir * width * (rtl ? -1 : 1), behavior: reducedMotion() ? "auto" : "smooth" });
|
|
5225
|
+
};
|
|
5226
|
+
(0, import_react25.useEffect)(() => {
|
|
5227
|
+
if (!autoplay2 || paused || hover || focus) return;
|
|
5228
|
+
const id = window.setInterval(() => step2(1, true), Math.max(3e3, interval));
|
|
5229
|
+
return () => window.clearInterval(id);
|
|
5230
|
+
}, [autoplay2, paused, hover, focus, interval]);
|
|
5231
|
+
if (rows.length === 0) {
|
|
5232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
5233
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(R23Styles, {}),
|
|
5234
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Placeholder, { editMode, children: "Add testimonials in the settings" })
|
|
5235
|
+
] });
|
|
5236
|
+
}
|
|
5237
|
+
const showRating = props.showRating !== false;
|
|
5238
|
+
const showImage = props.showImage !== false;
|
|
5239
|
+
const label2 = str(props.carouselLabel) ?? "Customer reviews";
|
|
5240
|
+
const prevLabel = str(props.prevLabel) ?? "Previous review";
|
|
5241
|
+
const nextLabel = str(props.nextLabel) ?? "Next review";
|
|
5242
|
+
const pauseLabel = str(props.pauseLabel) ?? "Pause autoplay";
|
|
5243
|
+
const playLabel = str(props.playLabel) ?? "Start autoplay";
|
|
5244
|
+
const ratingLabel = str(props.ratingLabel) ?? "{rating} out of 5";
|
|
5245
|
+
const slideLabel = str(props.slideLabel) ?? "{n} of {total}";
|
|
5246
|
+
const cards = rows.map((row, index) => {
|
|
5247
|
+
const name = str(row.name);
|
|
5248
|
+
const role = str(row.role);
|
|
5249
|
+
const source = str(row.source);
|
|
5250
|
+
const photo = showImage ? usableAsset(row.image, mediaOrigin) : null;
|
|
5251
|
+
const rating = showRating && typeof row.rating === "number" && row.rating > 0 ? row.rating : null;
|
|
5252
|
+
const card2 = /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("figure", { className: "tb-b-tm-card", children: [
|
|
5253
|
+
rating !== null && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Rating, { value: rating, template: ratingLabel }),
|
|
5254
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("blockquote", { children: str(row.quote) }),
|
|
5255
|
+
(name !== void 0 || role !== void 0 || source !== void 0 || photo !== null) && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("figcaption", { children: [
|
|
5256
|
+
photo !== null && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(AssetImage, { asset: photo, mediaOrigin, alt: "", className: "tb-b-tm-photo", sizes: "44px" }),
|
|
5257
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("span", { className: "tb-b-tm-by", children: [
|
|
5258
|
+
name !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "tb-b-tm-name", children: name }),
|
|
5259
|
+
role !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "tb-b-tm-role", children: role }),
|
|
5260
|
+
source !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "tb-b-tm-source", children: source })
|
|
5261
|
+
] })
|
|
5262
|
+
] })
|
|
5263
|
+
] });
|
|
5264
|
+
return carousel ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5265
|
+
"div",
|
|
5266
|
+
{
|
|
5267
|
+
className: "tb-b-tm-slide",
|
|
5268
|
+
role: "group",
|
|
5269
|
+
"aria-roledescription": "slide",
|
|
5270
|
+
"aria-label": fill(slideLabel, { n: String(index + 1), total: String(rows.length) }),
|
|
5271
|
+
children: card2
|
|
5272
|
+
},
|
|
5273
|
+
index
|
|
5274
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("li", { children: card2 }, index);
|
|
5275
|
+
});
|
|
5276
|
+
const card = oneOf(props.cardStyle, CARDS2, "card");
|
|
5277
|
+
const className = `tb-b-tm tb-b-tm--${carousel ? "carousel" : layout === "carousel" ? "grid" : layout} tb-b-tm--${card}`;
|
|
5278
|
+
if (!carousel) {
|
|
5279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
5280
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(R23Styles, {}),
|
|
5281
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("ul", { className: "tb-b-tm-list", children: cards }) })
|
|
5282
|
+
] });
|
|
5283
|
+
}
|
|
5284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
5285
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(R23Styles, {}),
|
|
5286
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
5287
|
+
"div",
|
|
5288
|
+
{
|
|
5289
|
+
className,
|
|
5290
|
+
role: "region",
|
|
5291
|
+
"aria-roledescription": "carousel",
|
|
5292
|
+
"aria-label": label2,
|
|
5293
|
+
"data-interval": String(Math.min(15e3, Math.max(3e3, interval))),
|
|
5294
|
+
onMouseEnter: () => setHover(true),
|
|
5295
|
+
onMouseLeave: () => setHover(false),
|
|
5296
|
+
onFocus: () => setFocus(true),
|
|
5297
|
+
onBlur: () => setFocus(false),
|
|
5298
|
+
children: [
|
|
5299
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "tb-b-tm-list", ref: track, role: "group", tabIndex: 0, children: cards }),
|
|
5300
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: `tb-b-tm-ctrl${live ? "" : " tb-b-tm-ctrl--wait"}`, children: [
|
|
5301
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: "tb-b-tm-btn", "aria-label": prevLabel, onClick: () => step2(-1), children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { "aria-hidden": "true", children: "\u2039" }) }),
|
|
5302
|
+
props.autoplay === true && !(live && !motion) && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: "tb-b-tm-btn tb-b-tm-pause", "aria-label": paused ? playLabel : pauseLabel, onClick: () => setPaused(!paused), children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { "aria-hidden": "true", children: paused ? "\u25B6" : "\u23F8" }) }),
|
|
5303
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: "tb-b-tm-btn", "aria-label": nextLabel, onClick: () => step2(1), children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { "aria-hidden": "true", children: "\u203A" }) })
|
|
5304
|
+
] })
|
|
5305
|
+
]
|
|
5306
|
+
}
|
|
5307
|
+
)
|
|
5308
|
+
] });
|
|
5309
|
+
}
|
|
5310
|
+
var testimonialsWidgets = [{ ...r23Definition("basic.testimonials"), Component: Testimonials }];
|
|
5311
|
+
|
|
5312
|
+
// src/basics/r23/trust-badges.tsx
|
|
5313
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
5314
|
+
var LAYOUTS4 = ["row", "grid"];
|
|
5315
|
+
function TrustBadges({ props, mediaOrigin, editMode }) {
|
|
5316
|
+
const badges = rowsOf(props.items).filter((row) => str(row.title) !== void 0 || str(row.text) !== void 0);
|
|
5317
|
+
const methods = rowsOf(props.paymentIcons).flatMap((row) => typeof row.method === "string" ? [row.method] : []);
|
|
5318
|
+
if (badges.length === 0 && methods.length === 0) {
|
|
5319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
5320
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(R23Styles, {}),
|
|
5321
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Placeholder, { editMode, children: "Add badges or payment methods in the settings" })
|
|
5322
|
+
] });
|
|
5323
|
+
}
|
|
5324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
5325
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(R23Styles, {}),
|
|
5326
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: `tb-b-trust tb-b-trust--${oneOf(props.layout, LAYOUTS4, "row")}`, children: [
|
|
5327
|
+
badges.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("ul", { className: "tb-b-badges", children: badges.map((row, index) => {
|
|
5328
|
+
const svg = usableAsset(row.svgAsset, mediaOrigin) === null ? null : row.svgAsset;
|
|
5329
|
+
const title = str(row.title);
|
|
5330
|
+
const href = hrefOf(row.link, mediaOrigin);
|
|
5331
|
+
const text = str(row.text);
|
|
5332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("li", { className: "tb-b-badge", children: [
|
|
5333
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "tb-b-badge-icon", "aria-hidden": "true", children: svg !== null ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(SvgFromAsset, { asset: svg, mediaOrigin }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(BadgeIcon, { name: textOf3(row.icon) }) }),
|
|
5334
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "tb-b-badge-body", children: [
|
|
5335
|
+
title !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "tb-b-badge-title", children: href === null ? title : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("a", { href, children: title }) }),
|
|
5336
|
+
text !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "tb-b-badge-text", children: text })
|
|
5337
|
+
] })
|
|
5338
|
+
] }, `${String(index)}:${textOf3(row.title)}`);
|
|
5339
|
+
}) }),
|
|
5340
|
+
methods.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("ul", { className: "tb-b-pay", role: "list", "aria-label": str(props.paymentTitle) ?? "Payment methods we accept", children: methods.map((method, index) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(PaymentMark, { method }) }, `${String(index)}:${method}`)) })
|
|
5341
|
+
] })
|
|
5342
|
+
] });
|
|
5343
|
+
}
|
|
5344
|
+
var trustBadgesWidgets = [{ ...r23Definition("basic.trust-badges"), Component: TrustBadges }];
|
|
5345
|
+
|
|
5346
|
+
// src/basics/r23/index.ts
|
|
5347
|
+
var r23ContentWidgets = [
|
|
5348
|
+
...imageWithTextWidgets,
|
|
5349
|
+
...featureGridWidgets,
|
|
5350
|
+
...testimonialsWidgets,
|
|
5351
|
+
...logoStripWidgets,
|
|
5352
|
+
...socialLinksWidgets,
|
|
5353
|
+
...trustBadgesWidgets
|
|
5354
|
+
];
|
|
5355
|
+
|
|
5356
|
+
// src/basics/r23/before-after.tsx
|
|
5357
|
+
var import_react26 = require("react");
|
|
5358
|
+
|
|
5359
|
+
// src/basics/r23/media-shared.tsx
|
|
5360
|
+
var import_builder_schema36 = require("@usethrottle/builder-schema");
|
|
5361
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
5362
|
+
function r23MediaDefinition(type) {
|
|
5363
|
+
const found = import_builder_schema36.BASIC_WIDGET_DEFINITIONS.filter((d) => d.type === type).sort((a, b) => b.v - a.v)[0];
|
|
5364
|
+
if (found === void 0) throw new Error(`No R2.3 definition of ${type}`);
|
|
5365
|
+
return found;
|
|
5366
|
+
}
|
|
5367
|
+
var mediaRows = (value) => Array.isArray(value) ? value.flatMap((row) => isRecord4(row) ? [row] : []) : [];
|
|
5368
|
+
var mediaText = (value) => typeof value === "string" ? value : "";
|
|
5369
|
+
function mediaAsset(value, mediaOrigin) {
|
|
5370
|
+
return isFrozenAsset(value) && (0, import_builder_schema36.safeUrl)(value.url, "src", { mediaOrigin }) !== null ? value : null;
|
|
5371
|
+
}
|
|
5372
|
+
function MediaImage({
|
|
5373
|
+
asset,
|
|
5374
|
+
mediaOrigin,
|
|
5375
|
+
alt,
|
|
5376
|
+
sizes,
|
|
5377
|
+
priority = false,
|
|
5378
|
+
style
|
|
5379
|
+
}) {
|
|
5380
|
+
const src = (0, import_builder_schema36.safeUrl)(asset.url, "src", { mediaOrigin });
|
|
5381
|
+
if (src === null) return null;
|
|
5382
|
+
const srcSet = asset.variants.flatMap((variant) => {
|
|
5383
|
+
const url = (0, import_builder_schema36.safeUrl)(variant.url, "src", { mediaOrigin });
|
|
5384
|
+
return url === null || url.includes(",") ? [] : [`${url} ${String(variant.width)}w`];
|
|
5385
|
+
}).join(", ");
|
|
5386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
5387
|
+
"img",
|
|
5388
|
+
{
|
|
5389
|
+
src,
|
|
5390
|
+
...srcSet === "" ? {} : { srcSet, sizes },
|
|
5391
|
+
width: asset.width,
|
|
5392
|
+
height: asset.height,
|
|
5393
|
+
alt,
|
|
5394
|
+
loading: priority ? "eager" : "lazy",
|
|
5395
|
+
...priority ? { fetchPriority: "high" } : {},
|
|
5396
|
+
decoding: "async",
|
|
5397
|
+
style: { aspectRatio: `${String(asset.width)} / ${String(asset.height)}`, ...style }
|
|
5398
|
+
}
|
|
5399
|
+
);
|
|
5400
|
+
}
|
|
5401
|
+
var R23_MEDIA_CSS = `@layer throttle{
|
|
5402
|
+
.tb-b-msr{position:absolute;inline-size:1px;block-size:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
|
|
5403
|
+
.tb-b-gal{--g:calc(var(--b-gap,12)*1px)}
|
|
5404
|
+
.tb-b-gal-list{margin:0;padding:0;list-style:none}
|
|
5405
|
+
.tb-b-gal--grid .tb-b-gal-list{display:grid;grid-template-columns:repeat(var(--b-columnsDesktop,3),minmax(0,1fr));gap:var(--g)}
|
|
5406
|
+
.tb-b-gal--masonry .tb-b-gal-list{column-count:var(--b-columnsDesktop,3);column-gap:var(--g)}
|
|
5407
|
+
.tb-b-gal--masonry .tb-b-gal-list>li{break-inside:avoid;margin-block-end:var(--g)}
|
|
5408
|
+
.tb-b-gal-scroll{overflow-x:auto;scroll-snap-type:x mandatory;overscroll-behavior-x:contain;scrollbar-width:thin}
|
|
5409
|
+
.tb-b-gal--carousel .tb-b-gal-list{display:flex;gap:var(--g)}
|
|
5410
|
+
.tb-b-gal--carousel .tb-b-gal-list>li{flex:0 0 calc((100% - (var(--b-columnsDesktop,3) - 1)*var(--g))/var(--b-columnsDesktop,3));scroll-snap-align:start;min-inline-size:0}
|
|
5411
|
+
@media (max-width:1024px){.tb-b-gal--grid .tb-b-gal-list{grid-template-columns:repeat(min(var(--b-columnsDesktop,3),3),minmax(0,1fr))}.tb-b-gal--masonry .tb-b-gal-list{column-count:min(var(--b-columnsDesktop,3),3)}.tb-b-gal--carousel .tb-b-gal-list>li{flex-basis:calc((100% - (min(var(--b-columnsDesktop,3),3) - 1)*var(--g))/min(var(--b-columnsDesktop,3),3))}}
|
|
5412
|
+
@media (max-width:767px){.tb-b-gal--grid .tb-b-gal-list{grid-template-columns:repeat(var(--b-columnsMobile,2),minmax(0,1fr))}.tb-b-gal--masonry .tb-b-gal-list{column-count:var(--b-columnsMobile,2)}.tb-b-gal--carousel .tb-b-gal-list>li{flex-basis:calc((100% - (var(--b-columnsMobile,2) - 1)*var(--g))/var(--b-columnsMobile,2))}}
|
|
5413
|
+
.tb-b-gal-item{margin:0;position:relative;min-inline-size:0}
|
|
5414
|
+
.tb-b-gal-item img{display:block;inline-size:100%;block-size:auto;object-fit:cover}
|
|
5415
|
+
.tb-b-gal-link{display:block;min-block-size:44px}
|
|
5416
|
+
.tb-b-gal-link:focus-visible,.tb-b-gal-scroll:focus-visible{outline:2px solid var(--tb-color-primary,currentColor);outline-offset:2px}
|
|
5417
|
+
.tb-b-gal-item figcaption{padding-block-start:4px;font-size:.875em;overflow-wrap:anywhere}
|
|
5418
|
+
.tb-b-gal--caps-overlay .tb-b-gal-item figcaption{position:absolute;inset-inline:0;inset-block-end:0;padding:6px 10px;background:rgba(0,0,0,.65);color:#fff;pointer-events:none}
|
|
5419
|
+
.tb-b-gal-ctrl{display:flex;justify-content:center;gap:8px;margin-block-start:8px}
|
|
5420
|
+
.tb-b-gal-btn,.tb-b-gal-dialog button{appearance:none;cursor:pointer;font:inherit;color:inherit;background:transparent;border:1px solid currentColor;border-radius:999px;min-inline-size:44px;min-block-size:44px;padding:0 16px}
|
|
5421
|
+
.tb-b-gal-btn[hidden]{display:none}
|
|
5422
|
+
.tb-b-gal-btn:focus-visible,.tb-b-gal-dialog button:focus-visible{outline:3px solid #fff;outline-offset:2px}
|
|
5423
|
+
.tb-b-gal-ctrl .tb-b-gal-btn:focus-visible{outline-color:var(--tb-color-primary,currentColor)}
|
|
5424
|
+
.tb-b-gal-dialog{position:fixed;inset:0;z-index:2147483000;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;box-sizing:border-box;padding:16px;background:rgba(0,0,0,.92);color:#fff}
|
|
5425
|
+
.tb-b-gal-stage{display:flex;align-items:center;justify-content:center;gap:12px;inline-size:100%;min-block-size:0}
|
|
5426
|
+
.tb-b-gal-stage figure{margin:0;display:flex;flex-direction:column;align-items:center;gap:8px;min-inline-size:0}
|
|
5427
|
+
.tb-b-gal-stage img{display:block;inline-size:auto;max-inline-size:100%;block-size:auto;max-block-size:72vh;object-fit:contain}
|
|
5428
|
+
.tb-b-gal-stage figcaption{text-align:center;overflow-wrap:anywhere}
|
|
5429
|
+
.tb-b-gal-status{font-size:.875em}
|
|
5430
|
+
.tb-b-gal-x{position:absolute;inset-block-start:12px;inset-inline-end:12px}
|
|
5431
|
+
.tb-b-ba{inline-size:100%}
|
|
5432
|
+
.tb-b-ba-stage{position:relative;overflow:hidden;inline-size:100%;border-radius:var(--throttle-radius,8px);touch-action:pan-y;user-select:none}
|
|
5433
|
+
.tb-b-ba--vertical .tb-b-ba-stage{touch-action:pan-x}
|
|
5434
|
+
.tb-b-ba-pane{margin:0;position:absolute;inset:0}
|
|
5435
|
+
.tb-b-ba-pane img{display:block;inline-size:100%;block-size:100%;object-fit:cover}
|
|
5436
|
+
.tb-b-ba-after{clip-path:inset(0 0 0 var(--pos,50%))}
|
|
5437
|
+
:dir(rtl) .tb-b-ba-after{clip-path:inset(0 var(--pos,50%) 0 0)}
|
|
5438
|
+
.tb-b-ba--vertical .tb-b-ba-after,:dir(rtl) .tb-b-ba--vertical .tb-b-ba-after{clip-path:inset(var(--pos,50%) 0 0 0)}
|
|
5439
|
+
.tb-b-ba-pane figcaption{position:absolute;inset-block-start:8px;padding:4px 10px;border-radius:4px;background:rgba(0,0,0,.7);color:#fff;font-size:.875em}
|
|
5440
|
+
.tb-b-ba-before figcaption{inset-inline-start:8px}
|
|
5441
|
+
.tb-b-ba-after figcaption{inset-inline-end:8px}
|
|
5442
|
+
.tb-b-ba--vertical .tb-b-ba-after figcaption{inset-block-start:auto;inset-block-end:8px;inset-inline-end:auto;inset-inline-start:8px}
|
|
5443
|
+
.tb-b-ba-range{position:absolute;inset:0;inline-size:100%;block-size:100%;margin:0;opacity:0;pointer-events:none}
|
|
5444
|
+
.tb-b-ba-handle{position:absolute;inset-block:0;inset-inline-start:var(--pos,50%);inline-size:4px;margin-inline-start:-2px;background:var(--b-handleColor,#fff);box-shadow:0 0 0 1px rgba(0,0,0,.35);pointer-events:none}
|
|
5445
|
+
.tb-b-ba-handle::after{content:"";position:absolute;inset-block-start:50%;inset-inline-start:50%;inline-size:44px;block-size:44px;margin:-22px 0 0 -22px;border-radius:50%;background:var(--b-handleColor,#fff);box-shadow:0 0 0 1px rgba(0,0,0,.35),0 2px 6px rgba(0,0,0,.35)}
|
|
5446
|
+
:dir(rtl) .tb-b-ba-handle::after{margin-inline:0;margin:-22px -22px 0 0}
|
|
5447
|
+
.tb-b-ba--vertical .tb-b-ba-handle{inset-block:auto;inset-inline:0;inset-block-start:var(--pos,50%);inline-size:auto;block-size:4px;margin:-2px 0 0}
|
|
5448
|
+
.tb-b-ba-range:focus-visible+.tb-b-ba-handle::after{outline:3px solid var(--tb-color-primary,#2563eb);outline-offset:2px}
|
|
5449
|
+
@media (scripting:none){.tb-b-ba-stage{aspect-ratio:auto!important;display:grid;grid-template-columns:1fr 1fr;gap:8px;overflow:visible}.tb-b-ba--vertical .tb-b-ba-stage{grid-template-columns:1fr}.tb-b-ba-pane{position:relative;inset:auto;aspect-ratio:var(--ba-ratio,auto);clip-path:none!important}.tb-b-ba-range,.tb-b-ba-handle{display:none}}
|
|
5450
|
+
.tb-b-ct{color:var(--b-color,inherit)}
|
|
5451
|
+
.tb-b-ct-scroll{overflow-x:auto}
|
|
5452
|
+
.tb-b-ct-scroll:focus-visible{outline:2px solid var(--tb-color-primary,currentColor);outline-offset:2px}
|
|
5453
|
+
.tb-b-ct--sticky-head .tb-b-ct-scroll{max-block-size:70vh;overflow:auto}
|
|
5454
|
+
.tb-b-ct-table{border-collapse:separate;border-spacing:0;inline-size:100%;min-inline-size:36rem}
|
|
5455
|
+
.tb-b-ct-table caption{caption-side:top;text-align:start;font-weight:600;padding-block-end:8px}
|
|
5456
|
+
.tb-b-ct-table th,.tb-b-ct-table td{padding:12px 16px;border-block-end:1px solid var(--tb-color-border,currentColor);text-align:center;vertical-align:middle;background:var(--tb-color-background,#fff)}
|
|
5457
|
+
.tb-b-ct-table tbody th{text-align:start;font-weight:600}
|
|
5458
|
+
.tb-b-ct-table thead th{font-weight:600}
|
|
5459
|
+
.tb-b-ct-table .tb-b-ct-title{display:block}
|
|
5460
|
+
.tb-b-ct-table thead .tb-b-button{display:inline-flex;align-items:center;justify-content:center;min-block-size:44px;box-sizing:border-box;margin-block-start:8px}
|
|
5461
|
+
.tb-b-ct-table thead a:focus-visible{outline:2px solid var(--tb-color-primary,currentColor);outline-offset:2px}
|
|
5462
|
+
.tb-b-ct--sticky-head .tb-b-ct-table thead th{position:sticky;inset-block-start:0;z-index:2}
|
|
5463
|
+
.tb-b-ct--sticky-col .tb-b-ct-table tbody th,.tb-b-ct--sticky-col .tb-b-ct-table thead th:first-child{position:sticky;inset-inline-start:0;z-index:1}
|
|
5464
|
+
.tb-b-ct--sticky-col.tb-b-ct--sticky-head .tb-b-ct-table thead th:first-child{z-index:3}
|
|
5465
|
+
.tb-b-ct-table .is-hl{background:color-mix(in srgb,var(--b-highlightColor,var(--tb-color-primary,#2563eb)) 12%,var(--tb-color-background,#fff))}
|
|
5466
|
+
.tb-b-ct-mark{font-weight:700}
|
|
5467
|
+
.tb-b-ct-stack{display:none}
|
|
5468
|
+
.tb-b-ct-stack-card{padding:16px;border:1px solid var(--tb-color-border,currentColor);border-radius:var(--throttle-radius,8px)}
|
|
5469
|
+
.tb-b-ct-stack-card.is-hl{background:color-mix(in srgb,var(--b-highlightColor,var(--tb-color-primary,#2563eb)) 12%,var(--tb-color-background,#fff))}
|
|
5470
|
+
.tb-b-ct-stack-title{margin:0 0 8px;font-weight:700}
|
|
5471
|
+
.tb-b-ct-stack dl{margin:0;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px 16px}
|
|
5472
|
+
.tb-b-ct-stack dt{font-weight:600}
|
|
5473
|
+
.tb-b-ct-stack dd{margin:0;text-align:end}
|
|
5474
|
+
.tb-b-ct-stack .tb-b-button{display:inline-flex;align-items:center;min-block-size:44px;box-sizing:border-box;margin-block-start:8px}
|
|
5475
|
+
@media (max-width:767px){.tb-b-ct--stacked .tb-b-ct-scroll{display:none}.tb-b-ct--stacked .tb-b-ct-stack{display:grid;gap:16px}}
|
|
5476
|
+
.tb-b-map{display:grid;gap:16px}
|
|
5477
|
+
.tb-b-map--list-beside{grid-template-columns:minmax(0,2fr) minmax(0,1fr);align-items:start}
|
|
5478
|
+
@media (max-width:767px){.tb-b-map--list-beside{grid-template-columns:minmax(0,1fr)}}
|
|
5479
|
+
.tb-b-map-frame{position:relative;block-size:calc(var(--b-height,400)*1px);border-radius:var(--throttle-radius,8px);overflow:hidden;background:var(--tb-color-muted,#eef0f2)}
|
|
5480
|
+
.tb-b-map-frame iframe{display:block;inline-size:100%;block-size:100%;border:0}
|
|
5481
|
+
.tb-b-map-facade{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:16px;text-align:center;background:repeating-linear-gradient(45deg,transparent 0 14px,rgba(0,0,0,.04) 14px 28px)}
|
|
5482
|
+
.tb-b-map-pin{inline-size:28px;block-size:28px;border-radius:50% 50% 50% 0;transform:rotate(-45deg);background:var(--tb-color-primary,#2563eb)}
|
|
5483
|
+
.tb-b-map-note{margin:0;max-inline-size:32rem;font-size:.875em}
|
|
5484
|
+
.tb-b-map-load,.tb-b-map-show{appearance:none;cursor:pointer;font:inherit;color:inherit;background:var(--tb-color-surface,#fff);border:1px solid var(--tb-color-border-control,currentColor);border-radius:999px;min-inline-size:44px;min-block-size:44px;padding:0 16px}
|
|
5485
|
+
.tb-b-map-load:focus-visible,.tb-b-map-show:focus-visible,.tb-b-map-card a:focus-visible{outline:2px solid var(--tb-color-primary,currentColor);outline-offset:2px}
|
|
5486
|
+
.tb-b-map-show[hidden]{display:none}
|
|
5487
|
+
.tb-b-map-list{margin:0;padding:0;list-style:none;display:grid;gap:12px}
|
|
5488
|
+
.tb-b-map--list-hidden .tb-b-map-list{position:absolute;inline-size:1px;block-size:1px;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
|
|
5489
|
+
.tb-b-map-card{display:flex;flex-direction:column;gap:4px;padding:12px;border:1px solid var(--tb-color-border,currentColor);border-radius:var(--throttle-radius,8px);overflow-wrap:anywhere}
|
|
5490
|
+
.tb-b-map-card p{margin:0}
|
|
5491
|
+
.tb-b-map-name{font-weight:600}
|
|
5492
|
+
.tb-b-map-card a{display:inline-flex;align-items:center;min-block-size:44px;color:inherit}
|
|
5493
|
+
}`;
|
|
5494
|
+
function R23MediaStyles() {
|
|
5495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
5496
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(BasicStyles, {}),
|
|
5497
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("style", { href: "tb-basics-r23-media", precedence: "throttle", children: R23_MEDIA_CSS })
|
|
5498
|
+
] });
|
|
5499
|
+
}
|
|
5500
|
+
|
|
5501
|
+
// src/basics/r23/before-after.tsx
|
|
5502
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
5503
|
+
var ORIENTATIONS = ["horizontal", "vertical"];
|
|
5504
|
+
var RATIOS2 = { "1:1": "1 / 1", "4:3": "4 / 3", "3:2": "3 / 2", "16:9": "16 / 9" };
|
|
5505
|
+
var clamp = (n) => Math.min(100, Math.max(0, Math.round(n)));
|
|
5506
|
+
function BeforeAfter({ props, mediaOrigin, editMode }) {
|
|
5507
|
+
const startValue = typeof props.start === "number" && Number.isFinite(props.start) ? clamp(props.start) : 50;
|
|
5508
|
+
const [pos, setPos] = (0, import_react26.useState)(startValue);
|
|
5509
|
+
const stage = (0, import_react26.useRef)(null);
|
|
5510
|
+
const dragging = (0, import_react26.useRef)(false);
|
|
5511
|
+
const before = mediaAsset(props.before, mediaOrigin);
|
|
5512
|
+
const after = mediaAsset(props.after, mediaOrigin);
|
|
5513
|
+
if (before === null || after === null) {
|
|
5514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
|
|
5515
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(R23MediaStyles, {}),
|
|
5516
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Placeholder, { editMode, children: "Choose a before and an after image" })
|
|
5517
|
+
] });
|
|
5518
|
+
}
|
|
5519
|
+
const orientation = oneOf(props.orientation, ORIENTATIONS, "horizontal");
|
|
5520
|
+
const vertical = orientation === "vertical";
|
|
5521
|
+
const ratio = typeof props.ratio === "string" && Object.hasOwn(RATIOS2, props.ratio) ? RATIOS2[props.ratio] : `${String(before.width)} / ${String(before.height)}`;
|
|
5522
|
+
const beforeLabel = str(props.beforeLabel) ?? "Before";
|
|
5523
|
+
const afterLabel = str(props.afterLabel) ?? "After";
|
|
5524
|
+
const name = str(props.handleLabel) ?? "Comparison slider";
|
|
5525
|
+
const isRtl = () => stage.current !== null && getComputedStyle(stage.current).direction === "rtl";
|
|
5526
|
+
const onKeyDown = (event) => {
|
|
5527
|
+
const flip = !vertical && isRtl();
|
|
5528
|
+
const keys = { ArrowRight: flip ? -1 : 1, ArrowUp: vertical ? -1 : 1, ArrowLeft: flip ? 1 : -1, ArrowDown: vertical ? 1 : -1, PageUp: 10, PageDown: -10 };
|
|
5529
|
+
if (event.key === "Home") setPos(0);
|
|
5530
|
+
else if (event.key === "End") setPos(100);
|
|
5531
|
+
else if (Object.hasOwn(keys, event.key)) setPos((current) => clamp(current + (keys[event.key] ?? 0)));
|
|
5532
|
+
else return;
|
|
5533
|
+
event.preventDefault();
|
|
5534
|
+
};
|
|
5535
|
+
const fromPointer = (event) => {
|
|
5536
|
+
const rect = stage.current?.getBoundingClientRect();
|
|
5537
|
+
if (rect === void 0) return;
|
|
5538
|
+
const size = vertical ? rect.height : rect.width;
|
|
5539
|
+
if (size <= 0) return;
|
|
5540
|
+
const offset = vertical ? event.clientY - rect.top : isRtl() ? rect.right - event.clientX : event.clientX - rect.left;
|
|
5541
|
+
setPos(clamp(offset / size * 100));
|
|
5542
|
+
};
|
|
5543
|
+
const style = { aspectRatio: ratio, "--ba-ratio": ratio, "--pos": `${String(pos)}%` };
|
|
5544
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
|
|
5545
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(R23MediaStyles, {}),
|
|
5546
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: `tb-b-ba tb-b-ba--${orientation}`, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
5547
|
+
"div",
|
|
5548
|
+
{
|
|
5549
|
+
ref: stage,
|
|
5550
|
+
className: "tb-b-ba-stage",
|
|
5551
|
+
style,
|
|
5552
|
+
onPointerDown: (event) => {
|
|
5553
|
+
if (event.button > 0) return;
|
|
5554
|
+
dragging.current = true;
|
|
5555
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
5556
|
+
fromPointer(event);
|
|
5557
|
+
},
|
|
5558
|
+
onPointerMove: (event) => {
|
|
5559
|
+
if (dragging.current) fromPointer(event);
|
|
5560
|
+
},
|
|
5561
|
+
onPointerUp: () => {
|
|
5562
|
+
dragging.current = false;
|
|
5563
|
+
},
|
|
5564
|
+
onPointerCancel: () => {
|
|
5565
|
+
dragging.current = false;
|
|
5566
|
+
},
|
|
5567
|
+
children: [
|
|
5568
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("figure", { className: "tb-b-ba-pane tb-b-ba-before", children: [
|
|
5569
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(MediaImage, { asset: before, mediaOrigin, alt: str(props.beforeAlt) ?? "", sizes: "100vw", priority: props.priority === true, style: { aspectRatio: "auto" } }),
|
|
5570
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("figcaption", { children: beforeLabel })
|
|
5571
|
+
] }),
|
|
5572
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("figure", { className: "tb-b-ba-pane tb-b-ba-after", children: [
|
|
5573
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(MediaImage, { asset: after, mediaOrigin, alt: str(props.afterAlt) ?? "", sizes: "100vw", priority: props.priority === true, style: { aspectRatio: "auto" } }),
|
|
5574
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("figcaption", { children: afterLabel })
|
|
5575
|
+
] }),
|
|
5576
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5577
|
+
"input",
|
|
5578
|
+
{
|
|
5579
|
+
type: "range",
|
|
5580
|
+
className: "tb-b-ba-range",
|
|
5581
|
+
min: 0,
|
|
5582
|
+
max: 100,
|
|
5583
|
+
step: 1,
|
|
5584
|
+
value: pos,
|
|
5585
|
+
"aria-label": name,
|
|
5586
|
+
"aria-orientation": orientation,
|
|
5587
|
+
"aria-valuetext": `${String(pos)} % ${beforeLabel}, ${String(100 - pos)} % ${afterLabel}`,
|
|
5588
|
+
onKeyDown,
|
|
5589
|
+
onChange: (event) => setPos(clamp(Number(event.target.value)))
|
|
5590
|
+
}
|
|
5591
|
+
),
|
|
5592
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "tb-b-ba-handle", "aria-hidden": "true" })
|
|
5593
|
+
]
|
|
5594
|
+
}
|
|
5595
|
+
) })
|
|
5596
|
+
] });
|
|
5597
|
+
}
|
|
5598
|
+
var beforeAfterWidgets = [{ ...r23MediaDefinition("basic.before-after"), Component: BeforeAfter }];
|
|
5599
|
+
|
|
5600
|
+
// src/basics/r23/comparison-table.tsx
|
|
5601
|
+
var import_react27 = require("react");
|
|
5602
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
5603
|
+
var MODES2 = ["scroll", "stacked"];
|
|
5604
|
+
var VALUE_KEYS = ["value1", "value2", "value3", "value4", "value5"];
|
|
5605
|
+
function ComparisonTable({ props, mediaOrigin, editMode }) {
|
|
5606
|
+
const stackId = (0, import_react27.useId)();
|
|
5607
|
+
const columns = mediaRows(props.columns).slice(0, 5).flatMap((row, index) => {
|
|
5608
|
+
const title = str(row.title);
|
|
5609
|
+
return title === void 0 ? [] : [{ index, title, highlight: row.highlight === true, href: hrefOf(row.link, mediaOrigin), buttonLabel: str(row.buttonLabel) }];
|
|
5610
|
+
});
|
|
5611
|
+
const rows = mediaRows(props.rows).flatMap((row) => {
|
|
5612
|
+
const label2 = str(row.label);
|
|
5613
|
+
return label2 === void 0 ? [] : [{ label: label2, row }];
|
|
5614
|
+
});
|
|
5615
|
+
if (columns.length === 0 || rows.length === 0) {
|
|
5616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
5617
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(R23MediaStyles, {}),
|
|
5618
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Placeholder, { editMode, children: "Add columns and rows in the settings" })
|
|
5619
|
+
] });
|
|
5620
|
+
}
|
|
5621
|
+
const included = str(props.includedText) ?? "Included";
|
|
5622
|
+
const notIncluded = str(props.notIncludedText) ?? "Not included";
|
|
5623
|
+
const notApplicable = str(props.notApplicableText) ?? "Not applicable";
|
|
5624
|
+
const mode = oneOf(props.mobileMode, MODES2, "scroll");
|
|
5625
|
+
const caption = str(props.caption);
|
|
5626
|
+
const cell = (raw) => {
|
|
5627
|
+
const value = mediaText(raw).trim();
|
|
5628
|
+
switch (value.toLowerCase()) {
|
|
5629
|
+
case "check":
|
|
5630
|
+
case "\u2713":
|
|
5631
|
+
case "\u2714":
|
|
5632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
5633
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "tb-b-ct-mark tb-b-ct-mark--check", "aria-hidden": "true", children: "\u2713" }),
|
|
5634
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "tb-b-msr", children: included })
|
|
5635
|
+
] });
|
|
5636
|
+
case "cross":
|
|
5637
|
+
case "\u2715":
|
|
5638
|
+
case "\u2717":
|
|
5639
|
+
case "\u2716":
|
|
5640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
5641
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "tb-b-ct-mark tb-b-ct-mark--cross", "aria-hidden": "true", children: "\u2715" }),
|
|
5642
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "tb-b-msr", children: notIncluded })
|
|
5643
|
+
] });
|
|
5644
|
+
case "dash":
|
|
5645
|
+
case "\u2013":
|
|
5646
|
+
case "\u2014":
|
|
5647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
5648
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "tb-b-ct-mark tb-b-ct-mark--dash", "aria-hidden": "true", children: "\u2013" }),
|
|
5649
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "tb-b-msr", children: notApplicable })
|
|
5650
|
+
] });
|
|
5651
|
+
default:
|
|
5652
|
+
return value;
|
|
5653
|
+
}
|
|
5654
|
+
};
|
|
5655
|
+
const button = (col) => col.href !== null && col.buttonLabel !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("a", { className: "tb-b-button tb-b-button--primary", href: col.href, "aria-label": `${col.buttonLabel}: ${col.title}`, children: col.buttonLabel }) : null;
|
|
5656
|
+
const className = [
|
|
5657
|
+
"tb-b-ct",
|
|
5658
|
+
props.stickyHeader === true ? "tb-b-ct--sticky-head" : "",
|
|
5659
|
+
props.stickyFirstColumn === true ? "tb-b-ct--sticky-col" : "",
|
|
5660
|
+
mode === "stacked" ? "tb-b-ct--stacked" : ""
|
|
5661
|
+
].filter((c) => c !== "").join(" ");
|
|
5662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
5663
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(R23MediaStyles, {}),
|
|
5664
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className, children: [
|
|
5665
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "tb-b-ct-scroll", role: "region", tabIndex: 0, "aria-label": str(props.scrollLabel) ?? "Comparison table, scrollable", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("table", { className: "tb-b-ct-table", children: [
|
|
5666
|
+
caption !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("caption", { children: caption }),
|
|
5667
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("tr", { children: [
|
|
5668
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("th", { scope: "col", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "tb-b-msr", children: str(props.featureLabel) ?? "Feature" }) }),
|
|
5669
|
+
columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("th", { scope: "col", className: col.highlight ? "is-hl" : void 0, children: [
|
|
5670
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "tb-b-ct-title", children: col.title }),
|
|
5671
|
+
button(col)
|
|
5672
|
+
] }, col.index))
|
|
5673
|
+
] }) }),
|
|
5674
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("tbody", { children: rows.map(({ label: label2, row }, r) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("tr", { children: [
|
|
5675
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("th", { scope: "row", children: label2 }),
|
|
5676
|
+
columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("td", { className: col.highlight ? "is-hl" : void 0, children: cell(row[VALUE_KEYS[col.index] ?? "value1"]) }, col.index))
|
|
5677
|
+
] }, r)) })
|
|
5678
|
+
] }) }),
|
|
5679
|
+
mode === "stacked" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "tb-b-ct-stack", children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { role: "group", "aria-labelledby": `${stackId}-${String(col.index)}`, className: `tb-b-ct-stack-card${col.highlight ? " is-hl" : ""}`, children: [
|
|
5680
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { id: `${stackId}-${String(col.index)}`, className: "tb-b-ct-stack-title", children: col.title }),
|
|
5681
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("dl", { children: rows.flatMap(({ label: label2, row }, r) => [
|
|
5682
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("dt", { children: label2 }, `t${String(r)}`),
|
|
5683
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("dd", { children: cell(row[VALUE_KEYS[col.index] ?? "value1"]) }, `d${String(r)}`)
|
|
5684
|
+
]) }),
|
|
5685
|
+
button(col)
|
|
5686
|
+
] }, col.index)) })
|
|
5687
|
+
] })
|
|
5688
|
+
] });
|
|
5689
|
+
}
|
|
5690
|
+
var comparisonTableWidgets = [{ ...r23MediaDefinition("basic.comparison-table"), Component: ComparisonTable }];
|
|
5691
|
+
|
|
5692
|
+
// src/basics/r23/gallery.tsx
|
|
5693
|
+
var import_react28 = require("react");
|
|
5694
|
+
var import_react_dom = require("react-dom");
|
|
5695
|
+
var import_builder_schema37 = require("@usethrottle/builder-schema");
|
|
5696
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
5697
|
+
var LAYOUTS5 = ["grid", "masonry", "carousel"];
|
|
5698
|
+
var CAPTIONS = ["below", "overlay", "hidden"];
|
|
5699
|
+
var RATIOS3 = { "1:1": "1 / 1", "4:5": "4 / 5" };
|
|
5700
|
+
var reducedMotion2 = () => window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true;
|
|
5701
|
+
var statusOf = (template, n, total) => template.replaceAll("{n}", String(n)).replaceAll("{total}", String(total));
|
|
5702
|
+
function Lightbox({
|
|
5703
|
+
shots,
|
|
5704
|
+
index,
|
|
5705
|
+
setIndex,
|
|
5706
|
+
onClose,
|
|
5707
|
+
returnTo,
|
|
5708
|
+
label: label2,
|
|
5709
|
+
statusText,
|
|
5710
|
+
texts,
|
|
5711
|
+
mediaOrigin
|
|
5712
|
+
}) {
|
|
5713
|
+
const dialog = (0, import_react28.useRef)(null);
|
|
5714
|
+
const closeButton = (0, import_react28.useRef)(null);
|
|
5715
|
+
(0, import_react28.useEffect)(() => {
|
|
5716
|
+
closeButton.current?.focus();
|
|
5717
|
+
const previous = document.body.style.overflow;
|
|
5718
|
+
document.body.style.overflow = "hidden";
|
|
5719
|
+
return () => {
|
|
5720
|
+
document.body.style.overflow = previous;
|
|
5721
|
+
returnTo?.focus();
|
|
5722
|
+
};
|
|
5723
|
+
}, [returnTo]);
|
|
5724
|
+
const total = shots.length;
|
|
5725
|
+
const go = (dir) => setIndex((index + dir + total) % total);
|
|
5726
|
+
const onKeyDown = (event) => {
|
|
5727
|
+
if (event.key === "Escape") {
|
|
5728
|
+
event.stopPropagation();
|
|
5729
|
+
onClose();
|
|
5730
|
+
} else if (event.key === "ArrowRight" || event.key === "ArrowLeft") {
|
|
5731
|
+
if (total < 2) return;
|
|
5732
|
+
event.stopPropagation();
|
|
5733
|
+
const rtl = dialog.current !== null && getComputedStyle(dialog.current).direction === "rtl";
|
|
5734
|
+
go(event.key === "ArrowRight" !== rtl ? 1 : -1);
|
|
5735
|
+
} else if (event.key === "Tab") {
|
|
5736
|
+
event.stopPropagation();
|
|
5737
|
+
if (dialog.current !== null) trapTab(event, focusablesOf(dialog.current));
|
|
5738
|
+
}
|
|
5739
|
+
};
|
|
5740
|
+
const latestKeyDown = (0, import_react28.useRef)(onKeyDown);
|
|
5741
|
+
latestKeyDown.current = onKeyDown;
|
|
5742
|
+
(0, import_react28.useEffect)(() => {
|
|
5743
|
+
const listener = (event) => latestKeyDown.current(event);
|
|
5744
|
+
document.addEventListener("keydown", listener, true);
|
|
5745
|
+
return () => document.removeEventListener("keydown", listener, true);
|
|
5746
|
+
}, []);
|
|
5747
|
+
const shot = shots[index];
|
|
5748
|
+
if (shot === void 0) return null;
|
|
5749
|
+
return (0, import_react_dom.createPortal)(
|
|
5750
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
5751
|
+
"div",
|
|
5752
|
+
{
|
|
5753
|
+
ref: dialog,
|
|
5754
|
+
className: "tb-b-gal-dialog",
|
|
5755
|
+
role: "dialog",
|
|
5756
|
+
"aria-modal": "true",
|
|
5757
|
+
"aria-label": label2,
|
|
5758
|
+
tabIndex: -1,
|
|
5759
|
+
onClick: (event) => {
|
|
5760
|
+
if (event.target === event.currentTarget) onClose();
|
|
5761
|
+
},
|
|
5762
|
+
children: [
|
|
5763
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("button", { ref: closeButton, type: "button", className: "tb-b-gal-x", onClick: onClose, children: texts.close }),
|
|
5764
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "tb-b-gal-stage", children: [
|
|
5765
|
+
total > 1 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("button", { type: "button", "aria-label": texts.prev, onClick: () => go(-1), children: "\u2039" }),
|
|
5766
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("figure", { children: [
|
|
5767
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(AssetImage, { asset: shot.asset, mediaOrigin, alt: shot.alt, sizes: "100vw", loading: "eager" }),
|
|
5768
|
+
shot.caption !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("figcaption", { children: shot.caption })
|
|
5769
|
+
] }),
|
|
5770
|
+
total > 1 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("button", { type: "button", "aria-label": texts.next, onClick: () => go(1), children: "\u203A" })
|
|
5771
|
+
] }),
|
|
5772
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "tb-b-gal-status", role: "status", "aria-live": "polite", children: statusOf(statusText, index + 1, total) })
|
|
5773
|
+
]
|
|
5774
|
+
}
|
|
5775
|
+
),
|
|
5776
|
+
document.body
|
|
5777
|
+
);
|
|
5778
|
+
}
|
|
5779
|
+
function Gallery({ props, mediaOrigin, editMode, interactive }) {
|
|
5780
|
+
const [open, setOpen2] = (0, import_react28.useState)(null);
|
|
5781
|
+
const returnTo = (0, import_react28.useRef)(null);
|
|
5782
|
+
const track = (0, import_react28.useRef)(null);
|
|
5783
|
+
const shots = [];
|
|
5784
|
+
for (const row of mediaRows(props.images)) {
|
|
5785
|
+
const asset = mediaAsset(row.image, mediaOrigin);
|
|
5786
|
+
const full = asset === null ? null : (0, import_builder_schema37.safeUrl)(asset.url, "src", { mediaOrigin });
|
|
5787
|
+
if (asset === null || full === null) continue;
|
|
5788
|
+
shots.push({ asset, full, alt: str(row.alt) ?? "", caption: str(row.caption), href: hrefOf(row.link, mediaOrigin) });
|
|
5789
|
+
}
|
|
5790
|
+
if (shots.length === 0) {
|
|
5791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
5792
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(R23MediaStyles, {}),
|
|
5793
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Placeholder, { editMode, children: "Add images in the settings" })
|
|
5794
|
+
] });
|
|
5795
|
+
}
|
|
5796
|
+
const layout = oneOf(props.layout, LAYOUTS5, "grid");
|
|
5797
|
+
const captions = oneOf(props.captions, CAPTIONS, "below");
|
|
5798
|
+
const ratio = typeof props.ratio === "string" && Object.hasOwn(RATIOS3, props.ratio) ? RATIOS3[props.ratio] : void 0;
|
|
5799
|
+
const lightbox = props.lightbox !== false;
|
|
5800
|
+
const label2 = str(props.label) ?? "Gallery";
|
|
5801
|
+
const statusText = str(props.statusText) ?? "Image {n} of {total}";
|
|
5802
|
+
const texts = { close: str(props.closeLabel) ?? "Close", prev: str(props.prevLabel) ?? "Previous image", next: str(props.nextLabel) ?? "Next image" };
|
|
5803
|
+
const priority = props.priority === true;
|
|
5804
|
+
const columns = (value, fallback) => typeof value === "number" && value >= 1 ? value : fallback;
|
|
5805
|
+
const sizes = `(max-width: 767px) ${String(Math.round(100 / columns(props.columnsMobile, 2)))}vw, ${String(Math.round(100 / columns(props.columnsDesktop, 3)))}vw`;
|
|
5806
|
+
const step2 = (dir) => {
|
|
5807
|
+
const el = track.current;
|
|
5808
|
+
if (el === null) return;
|
|
5809
|
+
const rtl = getComputedStyle(el).direction === "rtl";
|
|
5810
|
+
el.scrollBy?.({ left: dir * el.clientWidth * (rtl ? -1 : 1), behavior: reducedMotion2() ? "auto" : "smooth" });
|
|
5811
|
+
};
|
|
5812
|
+
const items = shots.map((shot, index) => {
|
|
5813
|
+
const img = /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5814
|
+
MediaImage,
|
|
5815
|
+
{
|
|
5816
|
+
asset: shot.asset,
|
|
5817
|
+
mediaOrigin,
|
|
5818
|
+
alt: shot.alt,
|
|
5819
|
+
sizes,
|
|
5820
|
+
priority: priority && index === 0,
|
|
5821
|
+
...ratio === void 0 ? {} : { style: { aspectRatio: ratio } }
|
|
5822
|
+
}
|
|
5823
|
+
);
|
|
5824
|
+
const href = lightbox ? shot.full : shot.href;
|
|
5825
|
+
const name = shot.alt === "" ? shot.caption ?? statusOf(statusText, index + 1, shots.length) : void 0;
|
|
5826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("figure", { className: "tb-b-gal-item", children: [
|
|
5827
|
+
href === null ? img : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5828
|
+
"a",
|
|
5829
|
+
{
|
|
5830
|
+
className: "tb-b-gal-link",
|
|
5831
|
+
href,
|
|
5832
|
+
...name === void 0 ? {} : { "aria-label": name },
|
|
5833
|
+
...lightbox ? { "aria-haspopup": "dialog" } : {},
|
|
5834
|
+
onClick: lightbox && interactive !== false && !editMode ? (event) => {
|
|
5835
|
+
if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
|
5836
|
+
event.preventDefault();
|
|
5837
|
+
returnTo.current = event.currentTarget;
|
|
5838
|
+
setOpen2(index);
|
|
5839
|
+
} : void 0,
|
|
5840
|
+
children: img
|
|
5841
|
+
}
|
|
5842
|
+
),
|
|
5843
|
+
captions !== "hidden" && shot.caption !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("figcaption", { children: shot.caption })
|
|
5844
|
+
] }) }, index);
|
|
5845
|
+
});
|
|
5846
|
+
const carousel = layout === "carousel" && shots.length > 1;
|
|
5847
|
+
const className = `tb-b-gal tb-b-gal--${carousel ? "carousel" : layout === "carousel" ? "grid" : layout} tb-b-gal--caps-${captions}`;
|
|
5848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
5849
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(R23MediaStyles, {}),
|
|
5850
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className, children: [
|
|
5851
|
+
carousel ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
5852
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "tb-b-gal-scroll", ref: track, role: "group", tabIndex: 0, "aria-label": label2, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("ul", { className: "tb-b-gal-list", children: items }) }),
|
|
5853
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "tb-b-gal-ctrl", children: [
|
|
5854
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("button", { type: "button", className: "tb-b-gal-btn", "aria-label": texts.prev, onClick: () => step2(-1), children: "\u2039" }),
|
|
5855
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("button", { type: "button", className: "tb-b-gal-btn", "aria-label": texts.next, onClick: () => step2(1), children: "\u203A" })
|
|
5856
|
+
] })
|
|
5857
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("ul", { className: "tb-b-gal-list", "aria-label": label2, children: items }),
|
|
5858
|
+
open !== null && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5859
|
+
Lightbox,
|
|
5860
|
+
{
|
|
5861
|
+
shots,
|
|
5862
|
+
index: open,
|
|
5863
|
+
setIndex: setOpen2,
|
|
5864
|
+
onClose: () => setOpen2(null),
|
|
5865
|
+
returnTo: returnTo.current,
|
|
5866
|
+
label: label2,
|
|
5867
|
+
statusText,
|
|
5868
|
+
texts,
|
|
5869
|
+
mediaOrigin
|
|
5870
|
+
}
|
|
5871
|
+
)
|
|
5872
|
+
] })
|
|
5873
|
+
] });
|
|
5874
|
+
}
|
|
5875
|
+
var galleryWidgets = [{ ...r23MediaDefinition("basic.gallery"), Component: Gallery }];
|
|
5876
|
+
|
|
5877
|
+
// src/basics/r23/map.tsx
|
|
5878
|
+
var import_react29 = require("react");
|
|
5879
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
5880
|
+
var PROVIDERS = ["openstreetmap", "google"];
|
|
5881
|
+
var LIST = ["below", "beside", "hidden"];
|
|
5882
|
+
var TYPES = ["LocalBusiness", "Store"];
|
|
5883
|
+
var DAYS = { mon: "Mo", tue: "Tu", wed: "We", thu: "Th", fri: "Fr", sat: "Sa", sun: "Su" };
|
|
5884
|
+
var DAY = "[A-Za-z]{3,9}";
|
|
5885
|
+
var DAY_PART = `${DAY}(?:\\s*[-\u2013]\\s*${DAY})?`;
|
|
5886
|
+
var HOURS_RE = new RegExp(`^\\s*(${DAY_PART}(?:\\s*,\\s*${DAY_PART})*)\\s+(\\d{1,2})(?::(\\d{2}))?\\s*(?:-|\u2013|to)\\s*(\\d{1,2})(?::(\\d{2}))?\\s*$`, "iu");
|
|
5887
|
+
var dayCode = (word) => {
|
|
5888
|
+
const key = word.trim().slice(0, 3).toLowerCase();
|
|
5889
|
+
return /^[a-z]{3,9}$/iu.test(word.trim()) && Object.hasOwn(DAYS, key) ? DAYS[key] : void 0;
|
|
5890
|
+
};
|
|
5891
|
+
var clock = (hour, minute) => {
|
|
5892
|
+
const h = Number(hour);
|
|
5893
|
+
const m = minute === void 0 ? 0 : Number(minute);
|
|
5894
|
+
return h > 24 || m > 59 || h === 24 && m > 0 ? null : `${String(h).padStart(2, "0")}:${String(m).padStart(2, "0")}`;
|
|
5895
|
+
};
|
|
5896
|
+
function parseOpeningHours(input) {
|
|
5897
|
+
const out = [];
|
|
5898
|
+
for (const segment of input.split(/[;\n]+/u)) {
|
|
5899
|
+
const match = HOURS_RE.exec(segment);
|
|
5900
|
+
if (match === null) continue;
|
|
5901
|
+
const days = [];
|
|
5902
|
+
for (const part2 of (match[1] ?? "").split(",")) {
|
|
5903
|
+
const ends = part2.split(/[-–]/u).map(dayCode);
|
|
5904
|
+
if (ends.length === 0 || ends.some((end) => end === void 0)) {
|
|
5905
|
+
days.length = 0;
|
|
5906
|
+
break;
|
|
5907
|
+
}
|
|
5908
|
+
days.push(ends.join("-"));
|
|
5909
|
+
}
|
|
5910
|
+
const open = clock(match[2] ?? "", match[3]);
|
|
5911
|
+
const close = clock(match[4] ?? "", match[5]);
|
|
5912
|
+
if (days.length > 0 && open !== null && close !== null) out.push(`${days.join(",")} ${open}-${close}`);
|
|
5913
|
+
}
|
|
5914
|
+
return out;
|
|
5915
|
+
}
|
|
5916
|
+
var coord = (value, limit) => typeof value === "number" && Number.isFinite(value) && Math.abs(value) <= limit ? value : null;
|
|
5917
|
+
var round = (n) => String(Math.round(n * 1e6) / 1e6);
|
|
5918
|
+
function embedSrc2(provider, lat, lng, zoom) {
|
|
5919
|
+
if (provider === "google") {
|
|
5920
|
+
return `https://www.google.com/maps?${new URLSearchParams({ q: `${round(lat)},${round(lng)}`, z: String(zoom), output: "embed" }).toString()}`;
|
|
5921
|
+
}
|
|
5922
|
+
const lon = 360 / 2 ** zoom * 1.5;
|
|
5923
|
+
const la = lon * 0.6;
|
|
5924
|
+
const bbox = [Math.max(-180, lng - lon), Math.max(-85, lat - la), Math.min(180, lng + lon), Math.min(85, lat + la)].map(round).join(",");
|
|
5925
|
+
return `https://www.openstreetmap.org/export/embed.html?${new URLSearchParams({ bbox, layer: "mapnik", marker: `${round(lat)},${round(lng)}` }).toString()}`;
|
|
5926
|
+
}
|
|
5927
|
+
var directionsHref = (place) => {
|
|
5928
|
+
const destination = place.lat !== null && place.lng !== null ? `${round(place.lat)},${round(place.lng)}` : place.address;
|
|
5929
|
+
return destination === void 0 ? null : `https://www.google.com/maps/dir/?${new URLSearchParams({ api: "1", destination }).toString()}`;
|
|
5930
|
+
};
|
|
5931
|
+
var telHref = (phone) => {
|
|
5932
|
+
const digits = phone.replace(/[^\d]/gu, "");
|
|
5933
|
+
return digits.length >= 5 && digits.length <= 15 ? `tel:${phone.trim().startsWith("+") ? "+" : ""}${digits}` : null;
|
|
5934
|
+
};
|
|
5935
|
+
function MapWidget({ node, props, mediaOrigin, editMode }) {
|
|
5936
|
+
const consentRequired = props.consentRequired !== false;
|
|
5937
|
+
const [loaded, setLoaded] = (0, import_react29.useState)(!consentRequired);
|
|
5938
|
+
const places = mediaRows(props.locations).slice(0, 20).map((row, index) => ({
|
|
5939
|
+
index,
|
|
5940
|
+
name: str(row.name),
|
|
5941
|
+
address: str(row.address),
|
|
5942
|
+
lat: coord(row.lat, 90),
|
|
5943
|
+
lng: coord(row.lng, 180),
|
|
5944
|
+
hours: str(row.hours),
|
|
5945
|
+
phone: str(row.phone),
|
|
5946
|
+
href: hrefOf(row.link, mediaOrigin)
|
|
5947
|
+
})).filter((place) => place.name !== void 0 || place.address !== void 0);
|
|
5948
|
+
const mappable = places.filter((place) => place.lat !== null && place.lng !== null);
|
|
5949
|
+
const [selected, setSelected] = (0, import_react29.useState)(mappable[0]?.index ?? 0);
|
|
5950
|
+
if (places.length === 0) {
|
|
5951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
5952
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(R23MediaStyles, {}),
|
|
5953
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Placeholder, { editMode, children: "Add locations in the settings" })
|
|
5954
|
+
] });
|
|
5955
|
+
}
|
|
5956
|
+
const provider = oneOf(props.provider, PROVIDERS, "openstreetmap");
|
|
5957
|
+
const zoom = typeof props.zoom === "number" && props.zoom >= 3 && props.zoom <= 18 ? Math.round(props.zoom) : 14;
|
|
5958
|
+
const listMode = oneOf(props.showList, LIST, "below");
|
|
5959
|
+
const current = mappable.find((place) => place.index === selected) ?? mappable[0];
|
|
5960
|
+
const showFrame = loaded && !editMode && current !== void 0 && current.lat !== null && current.lng !== null;
|
|
5961
|
+
const directions = str(props.directionsLabel) ?? "Get directions";
|
|
5962
|
+
const showLabel = str(props.showLabel) ?? "Show on map";
|
|
5963
|
+
const schemaType = oneOf(props.schemaType, TYPES, "LocalBusiness");
|
|
5964
|
+
const lds = props.jsonLd !== true ? [] : places.flatMap((place) => {
|
|
5965
|
+
if (place.name === void 0 || place.address === void 0) return [];
|
|
5966
|
+
const hours = place.hours === void 0 ? [] : parseOpeningHours(place.hours);
|
|
5967
|
+
return [
|
|
5968
|
+
{
|
|
5969
|
+
"@context": "https://schema.org",
|
|
5970
|
+
"@type": schemaType,
|
|
5971
|
+
// A fragment of the page's own address: stable per position in the list.
|
|
5972
|
+
"@id": `#store-${node.id}-${String(place.index)}`,
|
|
5973
|
+
name: place.name,
|
|
5974
|
+
address: { "@type": "PostalAddress", streetAddress: place.address },
|
|
5975
|
+
...place.lat !== null && place.lng !== null ? { geo: { "@type": "GeoCoordinates", latitude: place.lat, longitude: place.lng } } : {},
|
|
5976
|
+
...hours.length === 0 ? {} : { openingHours: hours },
|
|
5977
|
+
...place.phone === void 0 ? {} : { telephone: place.phone },
|
|
5978
|
+
...place.href !== null && place.href.startsWith("https://") ? { url: place.href } : {}
|
|
5979
|
+
}
|
|
5980
|
+
];
|
|
5981
|
+
});
|
|
5982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
5983
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(R23MediaStyles, {}),
|
|
5984
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: `tb-b-map tb-b-map--list-${listMode}`, children: [
|
|
5985
|
+
mappable.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "tb-b-map-frame", children: showFrame && current.lat !== null && current.lng !== null ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5986
|
+
"iframe",
|
|
5987
|
+
{
|
|
5988
|
+
src: embedSrc2(provider, current.lat, current.lng, zoom),
|
|
5989
|
+
title: str(props.mapTitle) ?? "Map",
|
|
5990
|
+
loading: "lazy",
|
|
5991
|
+
referrerPolicy: "strict-origin-when-cross-origin",
|
|
5992
|
+
sandbox: "allow-scripts allow-same-origin allow-popups"
|
|
5993
|
+
},
|
|
5994
|
+
`${String(current.index)}-${provider}`
|
|
5995
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "tb-b-map-facade", children: [
|
|
5996
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "tb-b-map-pin", "aria-hidden": "true" }),
|
|
5997
|
+
str(props.privacyNote) !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "tb-b-map-note", children: str(props.privacyNote) }),
|
|
5998
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("button", { type: "button", className: "tb-b-map-load", onClick: () => setLoaded(true), children: str(props.loadLabel) ?? "Load interactive map" })
|
|
5999
|
+
] }) }),
|
|
6000
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("ul", { className: "tb-b-map-list", children: places.map((place) => {
|
|
6001
|
+
const plain = listMode === "hidden";
|
|
6002
|
+
const dir = plain ? null : directionsHref(place);
|
|
6003
|
+
const tel = place.phone === void 0 || plain ? null : telHref(place.phone);
|
|
6004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("li", { className: "tb-b-map-card", children: [
|
|
6005
|
+
place.name !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "tb-b-map-name", children: place.href === null || plain ? place.name : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("a", { href: place.href, children: place.name }) }),
|
|
6006
|
+
place.address !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "tb-b-map-address", children: place.address }),
|
|
6007
|
+
place.hours !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "tb-b-map-hours", children: place.hours }),
|
|
6008
|
+
place.phone !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "tb-b-map-phone", children: tel === null ? place.phone : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("a", { href: tel, children: place.phone }) }),
|
|
6009
|
+
dir !== null && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("a", { className: "tb-b-map-dir", href: dir, target: "_blank", rel: "noopener", "aria-label": place.name === void 0 ? directions : `${directions}: ${place.name}`, children: directions }),
|
|
6010
|
+
!plain && mappable.length > 1 && place.lat !== null && place.lng !== null && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
6011
|
+
"button",
|
|
6012
|
+
{
|
|
6013
|
+
type: "button",
|
|
6014
|
+
className: "tb-b-map-show",
|
|
6015
|
+
"aria-pressed": current?.index === place.index,
|
|
6016
|
+
"aria-label": place.name === void 0 ? showLabel : `${showLabel}: ${place.name}`,
|
|
6017
|
+
onClick: () => setSelected(place.index),
|
|
6018
|
+
children: showLabel
|
|
6019
|
+
}
|
|
6020
|
+
)
|
|
6021
|
+
] }, place.index);
|
|
6022
|
+
}) }),
|
|
6023
|
+
lds.map((ld, i) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("script", { type: "application/ld+json", children: jsonLdString(ld) }, i))
|
|
6024
|
+
] })
|
|
6025
|
+
] });
|
|
6026
|
+
}
|
|
6027
|
+
var mapWidgets = [{ ...r23MediaDefinition("basic.map"), Component: MapWidget }];
|
|
6028
|
+
|
|
6029
|
+
// src/basics/r23/media-index.ts
|
|
6030
|
+
var r23MediaWidgets = [...galleryWidgets, ...beforeAfterWidgets, ...comparisonTableWidgets, ...mapWidgets];
|
|
6031
|
+
|
|
4533
6032
|
// src/basics/index.ts
|
|
4534
6033
|
var BASIC_COMPONENTS = {
|
|
4535
6034
|
"basic.heading": Heading,
|
|
@@ -4545,7 +6044,7 @@ var BASIC_COMPONENTS = {
|
|
|
4545
6044
|
"basic.copyright": Copyright,
|
|
4546
6045
|
"basic.countdown": Countdown
|
|
4547
6046
|
};
|
|
4548
|
-
var v1Widgets =
|
|
6047
|
+
var v1Widgets = import_builder_schema38.BASIC_WIDGET_DEFINITIONS.flatMap(
|
|
4549
6048
|
(definition3) => definition3.v === 1 && Object.hasOwn(BASIC_COMPONENTS, definition3.type) ? [{ ...definition3, Component: BASIC_COMPONENTS[definition3.type] }] : []
|
|
4550
6049
|
);
|
|
4551
6050
|
var widgets = mergeV2Widgets(v1Widgets, [
|
|
@@ -4557,17 +6056,19 @@ var widgets = mergeV2Widgets(v1Widgets, [
|
|
|
4557
6056
|
...quoteWidgets,
|
|
4558
6057
|
...menuV2Widgets,
|
|
4559
6058
|
...announcementV2Widgets,
|
|
4560
|
-
...headingV2Widgets
|
|
6059
|
+
...headingV2Widgets,
|
|
6060
|
+
...r23ContentWidgets,
|
|
6061
|
+
...r23MediaWidgets
|
|
4561
6062
|
]);
|
|
4562
6063
|
var basicPack = { id: "basic", version: "0.0.0", widgets, dataSources: [] };
|
|
4563
6064
|
|
|
4564
6065
|
// src/custom/factory.ts
|
|
4565
|
-
var
|
|
6066
|
+
var import_react31 = require("react");
|
|
4566
6067
|
|
|
4567
6068
|
// src/custom/composite-widget.tsx
|
|
4568
|
-
var
|
|
4569
|
-
var
|
|
4570
|
-
var
|
|
6069
|
+
var import_react30 = require("react");
|
|
6070
|
+
var import_builder_schema39 = require("@usethrottle/builder-schema");
|
|
6071
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4571
6072
|
var SETTING_KEY_RE = /^[a-z][A-Za-z0-9]{0,39}$/;
|
|
4572
6073
|
var NODE_ID_RE = /^[a-z0-9]{8,24}$/;
|
|
4573
6074
|
var WRAP = { section: "zzcompsec001", column: "zzcompcol001", inner: "zzcompinr001" };
|
|
@@ -4580,7 +6081,7 @@ function parseBody(raw) {
|
|
|
4580
6081
|
if (columns === void 0 === (stack === void 0)) return null;
|
|
4581
6082
|
const children = columns !== void 0 ? [{ id: WRAP.inner, type: "inner-section", props: {}, columns }] : stack ?? [];
|
|
4582
6083
|
if (stack?.some((node) => isRecord6(node) && node.type === "inner-section")) return null;
|
|
4583
|
-
const parsed2 =
|
|
6084
|
+
const parsed2 = import_builder_schema39.pageDocumentSchema.safeParse({
|
|
4584
6085
|
schemaVersion: 1,
|
|
4585
6086
|
sections: [{ id: WRAP.section, type: "section", props: {}, columns: [{ id: WRAP.column, type: "column", props: { width: 100 }, children }] }]
|
|
4586
6087
|
});
|
|
@@ -4600,9 +6101,9 @@ function compileComposite(snapshot) {
|
|
|
4600
6101
|
return result;
|
|
4601
6102
|
}
|
|
4602
6103
|
function compile2(snapshot) {
|
|
4603
|
-
const
|
|
6104
|
+
const label2 = `${snapshot.type}@${String(snapshot.v)}`;
|
|
4604
6105
|
const refuse = (why) => {
|
|
4605
|
-
warnOnce(`composite:${
|
|
6106
|
+
warnOnce(`composite:${label2}`, `${label2} was refused (${why}); rendering nothing for it`);
|
|
4606
6107
|
return null;
|
|
4607
6108
|
};
|
|
4608
6109
|
if (snapshot.kind !== "composite") return refuse("not a composite widget");
|
|
@@ -4703,14 +6204,14 @@ function build2(input) {
|
|
|
4703
6204
|
const innerField = inner === void 0 ? void 0 : registry.widget(inner.type, inner.v)?.settings.find((f) => f.key === target2.prop);
|
|
4704
6205
|
if (inner === void 0 || innerField === void 0 || innerField.control !== field.control) continue;
|
|
4705
6206
|
const converted = convert(field, value);
|
|
4706
|
-
if ((0,
|
|
6207
|
+
if ((0, import_builder_schema39.validateSettingValue)(innerField, converted) !== null) continue;
|
|
4707
6208
|
inner.props[target2.prop] = converted;
|
|
4708
6209
|
const responsive = inner.responsive;
|
|
4709
6210
|
for (const device of DEVICES6) {
|
|
4710
6211
|
if (responsive?.[device] !== void 0) delete responsive[device][target2.prop];
|
|
4711
6212
|
const raw = outer.responsive?.[device];
|
|
4712
6213
|
const plain = field.output === "css" && field.translatable !== true && field.control !== "image" && field.control !== "link";
|
|
4713
|
-
if (plain && raw !== void 0 && Object.hasOwn(raw, binding.setting) && (0,
|
|
6214
|
+
if (plain && raw !== void 0 && Object.hasOwn(raw, binding.setting) && (0, import_builder_schema39.validateSettingValue)(innerField, raw[binding.setting]) === null) {
|
|
4714
6215
|
const target$ = inner.responsive ?? (inner.responsive = {});
|
|
4715
6216
|
(target$[device] ?? (target$[device] = {}))[target2.prop] = raw[binding.setting];
|
|
4716
6217
|
}
|
|
@@ -4757,7 +6258,7 @@ function CompositeBody(props) {
|
|
|
4757
6258
|
warnOnce(`composite-weight:${snapshot.type}@${String(snapshot.v)}`, `${snapshot.type} would render too many nodes; rendering nothing for it`);
|
|
4758
6259
|
return null;
|
|
4759
6260
|
}
|
|
4760
|
-
return /* @__PURE__ */ (0,
|
|
6261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4761
6262
|
BuilderRenderer,
|
|
4762
6263
|
{
|
|
4763
6264
|
document: built.document,
|
|
@@ -4773,23 +6274,23 @@ function CompositeBody(props) {
|
|
|
4773
6274
|
);
|
|
4774
6275
|
}
|
|
4775
6276
|
function CompositeWidget(props) {
|
|
4776
|
-
return /* @__PURE__ */ (0,
|
|
6277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(PartBoundary, { label: `${props.snapshot.type}@${String(props.snapshot.v)}`, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react30.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(CompositeBody, { ...props }) }) });
|
|
4777
6278
|
}
|
|
4778
6279
|
|
|
4779
6280
|
// src/custom/factory.ts
|
|
4780
6281
|
var isDisabled = (snapshot) => snapshot.status === "disabled";
|
|
4781
|
-
var Disabled = ({ editMode }) => editMode ? (0,
|
|
6282
|
+
var Disabled = ({ editMode }) => editMode ? (0, import_react31.createElement)("div", { className: "tb-missing" }, "This custom widget is disabled") : null;
|
|
4782
6283
|
var customWidgetFactory = (snapshot, registry) => {
|
|
4783
6284
|
if (isDisabled(snapshot)) return Disabled;
|
|
4784
6285
|
if (snapshot.kind === "template") {
|
|
4785
6286
|
const template = compileTemplate(snapshot, registry);
|
|
4786
6287
|
if (template === null) return null;
|
|
4787
|
-
const Component2 = (props) => (0,
|
|
6288
|
+
const Component2 = (props) => (0, import_react31.createElement)(TemplateWidget, { ...props, snapshot, registry });
|
|
4788
6289
|
componentWeights.set(Component2, template.weight);
|
|
4789
6290
|
return Component2;
|
|
4790
6291
|
}
|
|
4791
6292
|
if (compileComposite(snapshot) === null) return null;
|
|
4792
|
-
return (props) => (0,
|
|
6293
|
+
return (props) => (0, import_react31.createElement)(CompositeWidget, { ...props, snapshot, registry });
|
|
4793
6294
|
};
|
|
4794
6295
|
|
|
4795
6296
|
// src/registry.ts
|
|
@@ -4817,7 +6318,7 @@ function createRendererRegistry(packs, options = {}) {
|
|
|
4817
6318
|
}
|
|
4818
6319
|
const factory = options.customWidget ?? DEFAULT_CUSTOM_WIDGET;
|
|
4819
6320
|
const build3 = (custom) => {
|
|
4820
|
-
const schema = (0,
|
|
6321
|
+
const schema = (0, import_builder_schema40.createRegistry)(definitions, sources, custom);
|
|
4821
6322
|
const snapshots = new Map(custom.map((snapshot) => [customKey(snapshot.type, snapshot.v), snapshot]));
|
|
4822
6323
|
const built = /* @__PURE__ */ new Map();
|
|
4823
6324
|
const registry = {
|
|
@@ -4845,8 +6346,8 @@ function createRendererRegistry(packs, options = {}) {
|
|
|
4845
6346
|
}
|
|
4846
6347
|
|
|
4847
6348
|
// src/slot.tsx
|
|
4848
|
-
var
|
|
4849
|
-
var
|
|
6349
|
+
var import_react32 = require("react");
|
|
6350
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
4850
6351
|
function contextKey(context) {
|
|
4851
6352
|
if (typeof context !== "object" || context === null) return "";
|
|
4852
6353
|
return Object.values(context).map((value) => {
|
|
@@ -4862,12 +6363,12 @@ function BuilderSlot({ name, context }) {
|
|
|
4862
6363
|
if (part2 === void 0 || part2.document.sections.length === 0) return null;
|
|
4863
6364
|
return (
|
|
4864
6365
|
// Suspense inside the boundary: see parts.tsx.
|
|
4865
|
-
/* @__PURE__ */ (0,
|
|
6366
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(PartBoundary, { label: `Builder slot ${name}`, resetKey: contextKey(context), children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { "data-throttle-part": "builder-slot", "data-b-slot": name, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_react32.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(PartView, { part: part2, context }) }) }) })
|
|
4866
6367
|
);
|
|
4867
6368
|
}
|
|
4868
6369
|
|
|
4869
6370
|
// src/provider.tsx
|
|
4870
|
-
var
|
|
6371
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
4871
6372
|
var EMPTY = {};
|
|
4872
6373
|
function loadedAtOf(site) {
|
|
4873
6374
|
if (site.status !== "ok" || site.loadedAt === void 0) return void 0;
|
|
@@ -4875,42 +6376,42 @@ function loadedAtOf(site) {
|
|
|
4875
6376
|
return Number.isNaN(at) ? void 0 : at;
|
|
4876
6377
|
}
|
|
4877
6378
|
function useParentFont() {
|
|
4878
|
-
return (0,
|
|
6379
|
+
return (0, import_react33.useContext)(import_ui12.AppearanceContext)?.variables?.fontFamily;
|
|
4879
6380
|
}
|
|
4880
6381
|
function BuilderProvider({ builderKey, client, packs, site, onError, interactive = true, pathname, catalogRoutes, routeTable, templateName, ownPagePaths, mode = "live", viewer, page, linkTargets, children }) {
|
|
4881
6382
|
const packsKey = packs.map((pack) => `${pack.id}@${pack.version}`).join("|");
|
|
4882
|
-
const registryRef = (0,
|
|
6383
|
+
const registryRef = (0, import_react33.useRef)(null);
|
|
4883
6384
|
if (registryRef.current?.key !== packsKey) {
|
|
4884
6385
|
registryRef.current = { key: packsKey, registry: createRendererRegistry(packs) };
|
|
4885
6386
|
}
|
|
4886
6387
|
const registry = registryRef.current.registry;
|
|
4887
|
-
const builder = (0,
|
|
6388
|
+
const builder = (0, import_react33.useMemo)(
|
|
4888
6389
|
() => client ?? (builderKey === void 0 ? null : (0, import_builder2.createBuilderClient)({ builderKey })),
|
|
4889
6390
|
[client, builderKey]
|
|
4890
6391
|
);
|
|
4891
6392
|
const mediaOrigin = site.status === "ok" ? site.mediaOrigin : "";
|
|
4892
6393
|
const settings = site.status === "ok" ? site.settings : EMPTY;
|
|
4893
|
-
const resolveLink = (0,
|
|
4894
|
-
const outlets = (0,
|
|
4895
|
-
const renderers = (0,
|
|
4896
|
-
const pageOutlet = (0,
|
|
6394
|
+
const resolveLink = (0, import_react33.useMemo)(() => makeResolveLink(settings, packs), [settings, packs]);
|
|
6395
|
+
const outlets = (0, import_react33.useRef)(/* @__PURE__ */ new Map());
|
|
6396
|
+
const renderers = (0, import_react33.useRef)(/* @__PURE__ */ new Map());
|
|
6397
|
+
const pageOutlet = (0, import_react33.useCallback)((handle) => {
|
|
4897
6398
|
let outlet = outlets.current.get(handle);
|
|
4898
6399
|
if (outlet === void 0) {
|
|
4899
6400
|
outlet = function PageOutlet() {
|
|
4900
|
-
return /* @__PURE__ */ (0,
|
|
6401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(PartBoundary, { label: `Builder page ${handle}`, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react33.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(BuilderPage, { slug: handle }) }) });
|
|
4901
6402
|
};
|
|
4902
6403
|
outlets.current.set(handle, outlet);
|
|
4903
6404
|
}
|
|
4904
6405
|
return outlet;
|
|
4905
6406
|
}, []);
|
|
4906
|
-
const resolveSlot = (0,
|
|
6407
|
+
const resolveSlot = (0, import_react33.useCallback)(
|
|
4907
6408
|
(name) => {
|
|
4908
6409
|
const part2 = site.status === "ok" && Object.hasOwn(site.slots, name) ? site.slots[name] : void 0;
|
|
4909
6410
|
if (part2 === void 0 || part2.document.sections.length === 0) return null;
|
|
4910
6411
|
let renderer = renderers.current.get(name);
|
|
4911
6412
|
if (renderer === void 0) {
|
|
4912
6413
|
renderer = function SlotRenderer({ context }) {
|
|
4913
|
-
return /* @__PURE__ */ (0,
|
|
6414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(BuilderSlot, { name, context });
|
|
4914
6415
|
};
|
|
4915
6416
|
renderers.current.set(name, renderer);
|
|
4916
6417
|
}
|
|
@@ -4918,7 +6419,7 @@ function BuilderProvider({ builderKey, client, packs, site, onError, interactive
|
|
|
4918
6419
|
},
|
|
4919
6420
|
[site]
|
|
4920
6421
|
);
|
|
4921
|
-
const delivery = (0,
|
|
6422
|
+
const delivery = (0, import_react33.useMemo)(() => site.status === "ok" ? customCssDeliveryOf(site.settings, site.theme, mediaOrigin) : { inline: "" }, [site, mediaOrigin]);
|
|
4922
6423
|
const customCss = delivery.inline;
|
|
4923
6424
|
const customCssHref = delivery.href;
|
|
4924
6425
|
const configured = settings.routes?.page;
|
|
@@ -4926,7 +6427,7 @@ function BuilderProvider({ builderKey, client, packs, site, onError, interactive
|
|
|
4926
6427
|
const catalogKey = catalogRoutes?.join("\n");
|
|
4927
6428
|
const storeRoutes = settings.routes?.store;
|
|
4928
6429
|
const tableKey = JSON.stringify(routeTable ?? storeRoutes ?? null);
|
|
4929
|
-
const codeRoutes = (0,
|
|
6430
|
+
const codeRoutes = (0, import_react33.useMemo)(() => {
|
|
4930
6431
|
const table = routeTable ?? (storeRoutes === void 0 ? void 0 : buildRouteTable(storeRoutes));
|
|
4931
6432
|
return {
|
|
4932
6433
|
page: pageRoute,
|
|
@@ -4940,37 +6441,37 @@ function BuilderProvider({ builderKey, client, packs, site, onError, interactive
|
|
|
4940
6441
|
const pageId = page?.id;
|
|
4941
6442
|
const pageTemplate = page?.template;
|
|
4942
6443
|
const pageHome = page?.home;
|
|
4943
|
-
const stablePage = (0,
|
|
6444
|
+
const stablePage = (0, import_react33.useMemo)(
|
|
4944
6445
|
() => page === void 0 ? void 0 : { id: pageId, template: pageTemplate, home: pageHome },
|
|
4945
6446
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4946
6447
|
[page === void 0, pageId, pageTemplate, pageHome]
|
|
4947
6448
|
);
|
|
4948
|
-
const value = (0,
|
|
6449
|
+
const value = (0, import_react33.useMemo)(
|
|
4949
6450
|
() => ({ client: builder, packs, registry, site, locale: site.locale, mediaOrigin, onError, resolveLink, interactive, customCss, mode, pathname, codeRoutes, templateName, page: stablePage, linkTargets }),
|
|
4950
6451
|
[builder, packs, registry, site, mediaOrigin, onError, resolveLink, interactive, customCss, mode, pathname, codeRoutes, templateName, stablePage, linkTargets]
|
|
4951
6452
|
);
|
|
4952
|
-
const design = (0,
|
|
6453
|
+
const design = (0, import_react33.useMemo)(
|
|
4953
6454
|
() => site.status === "ok" ? siteDesignOf(site.settings, resolveLink, pageOutlet, mediaOrigin, site.locale, loadedAtOf(site)) : null,
|
|
4954
6455
|
[site, resolveLink, pageOutlet, mediaOrigin]
|
|
4955
6456
|
);
|
|
4956
|
-
const own = (0,
|
|
4957
|
-
const merged = (0,
|
|
6457
|
+
const own = (0, import_react33.useMemo)(() => site.status === "ok" ? appearanceOf(site.settings) : void 0, [site]);
|
|
6458
|
+
const merged = (0, import_ui12.useAppearanceProviderValue)(own);
|
|
4958
6459
|
const parentFont = useParentFont();
|
|
4959
|
-
const appearance = (0,
|
|
6460
|
+
const appearance = (0, import_react33.useMemo)(() => {
|
|
4960
6461
|
if (own === void 0) return void 0;
|
|
4961
6462
|
return parentFont === void 0 ? merged : { ...merged, variables: { ...merged.variables, fontFamily: parentFont } };
|
|
4962
6463
|
}, [own, merged, parentFont]);
|
|
4963
|
-
return /* @__PURE__ */ (0,
|
|
4964
|
-
site.status === "ok" ? /* @__PURE__ */ (0,
|
|
4965
|
-
customCss === "" ? null : /* @__PURE__ */ (0,
|
|
4966
|
-
customCssHref === void 0 ? null : /* @__PURE__ */ (0,
|
|
4967
|
-
/* @__PURE__ */ (0,
|
|
6464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(BuilderContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_ui12.ThrottleUIProvider, { ...appearance === void 0 ? {} : { appearance }, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_ui12.SiteDesignProvider, { value: design, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_ui12.SlotOutletProvider, { resolve: resolveSlot, children: [
|
|
6465
|
+
site.status === "ok" ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("style", { children: themeCss(site.settings, { hostFont: parentFont !== void 0 }) }) : null,
|
|
6466
|
+
customCss === "" ? null : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("style", { children: customCssSheet(customCss) }),
|
|
6467
|
+
customCssHref === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("link", { rel: "stylesheet", href: customCssHref }),
|
|
6468
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ViewerContext.Provider, { value: viewer, children: leaving ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { "data-b-leaving": "", hidden: true }) : children })
|
|
4968
6469
|
] }) }) }) });
|
|
4969
6470
|
}
|
|
4970
6471
|
|
|
4971
6472
|
// src/parts.tsx
|
|
4972
|
-
var
|
|
4973
|
-
var
|
|
6473
|
+
var import_react34 = require("react");
|
|
6474
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
4974
6475
|
function Part({ name, tag }) {
|
|
4975
6476
|
const builder = useBuilder();
|
|
4976
6477
|
if (builder === null || builder.site.status !== "ok") return null;
|
|
@@ -4980,21 +6481,35 @@ function Part({ name, tag }) {
|
|
|
4980
6481
|
return (
|
|
4981
6482
|
// Error boundaries do not catch on the server: the Suspense inside turns a throw
|
|
4982
6483
|
// during SSR into "render nothing here" and the client retries under the boundary.
|
|
4983
|
-
/* @__PURE__ */ (0,
|
|
6484
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(PartBoundary, { label: `Builder ${name}`, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Tag, { "data-throttle-part": `builder-${name}`, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react34.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(PartView, { part: part2 }) }) }) })
|
|
4984
6485
|
);
|
|
4985
6486
|
}
|
|
4986
|
-
var BuilderHeader = () => /* @__PURE__ */ (0,
|
|
4987
|
-
var BuilderFooter = () => /* @__PURE__ */ (0,
|
|
6487
|
+
var BuilderHeader = () => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Part, { name: "header", tag: "header" });
|
|
6488
|
+
var BuilderFooter = () => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Part, { name: "footer", tag: "footer" });
|
|
4988
6489
|
|
|
4989
6490
|
// src/template-view.tsx
|
|
4990
|
-
var
|
|
4991
|
-
var
|
|
6491
|
+
var import_react35 = require("react");
|
|
6492
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
6493
|
+
var FRAMELESS_CSS = '[data-throttle-part="builder-header"],[data-throttle-part="builder-footer"]{display:none}';
|
|
4992
6494
|
function BuilderTemplateView({
|
|
4993
6495
|
name,
|
|
4994
6496
|
part: part2,
|
|
4995
|
-
context
|
|
6497
|
+
context,
|
|
6498
|
+
frame
|
|
4996
6499
|
}) {
|
|
4997
|
-
|
|
6500
|
+
const frameless = frame === "none";
|
|
6501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(PartBoundary, { label: `Builder template ${name}`, children: [
|
|
6502
|
+
frameless ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("style", { children: FRAMELESS_CSS }) : null,
|
|
6503
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
6504
|
+
"div",
|
|
6505
|
+
{
|
|
6506
|
+
"data-throttle-part": "builder-template",
|
|
6507
|
+
"data-b-template": name,
|
|
6508
|
+
...frameless ? { "data-b-frame": "none" } : {},
|
|
6509
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react35.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(PartView, { part: part2, context }) })
|
|
6510
|
+
}
|
|
6511
|
+
)
|
|
6512
|
+
] });
|
|
4998
6513
|
}
|
|
4999
6514
|
function BuilderRouteScope({
|
|
5000
6515
|
templateName,
|
|
@@ -5004,7 +6519,7 @@ function BuilderRouteScope({
|
|
|
5004
6519
|
}) {
|
|
5005
6520
|
const builder = useBuilder();
|
|
5006
6521
|
const tableKey = JSON.stringify(routeTable ?? null);
|
|
5007
|
-
const value = (0,
|
|
6522
|
+
const value = (0, import_react35.useMemo)(() => {
|
|
5008
6523
|
if (builder === null) return null;
|
|
5009
6524
|
const codeRoutes = {
|
|
5010
6525
|
...builder.codeRoutes,
|
|
@@ -5014,7 +6529,7 @@ function BuilderRouteScope({
|
|
|
5014
6529
|
return { ...builder, codeRoutes, templateName };
|
|
5015
6530
|
}, [builder, templateName, tableKey, allowPath]);
|
|
5016
6531
|
if (allowPath !== void 0) allowCodePath(allowPath);
|
|
5017
|
-
return /* @__PURE__ */ (0,
|
|
6532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(BuilderContext.Provider, { value, children });
|
|
5018
6533
|
}
|
|
5019
6534
|
|
|
5020
6535
|
// src/index.ts
|