@veroxm/react-sdk 0.3.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +6 -0
- package/dist/site/chart-view.d.ts +2 -0
- package/dist/site/chart-view.js +1 -0
- package/dist/site/chart.d.ts +31 -5
- package/dist/site/chart.js +26 -5
- package/dist/site/map-embed.d.ts +2 -0
- package/dist/site/map-embed.js +1 -0
- package/dist/site/map-math.d.ts +2 -0
- package/dist/site/map-math.js +2 -0
- package/dist/site/nav-menu.d.ts +7 -1
- package/dist/site/nav-menu.js +6 -1
- package/dist/site/site-parts.d.ts +9 -1
- package/dist/site/site-parts.js +7 -1
- package/dist/site/slider.d.ts +2 -0
- package/dist/site/slider.js +1 -0
- package/dist/site/styles.d.ts +6 -1
- package/dist/site/styles.js +6 -1
- package/dist/site/video-embed.d.ts +2 -0
- package/dist/site/video-embed.js +1 -0
- package/dist/site/video.d.ts +12 -2
- package/dist/site/video.js +10 -2
- package/dist/tracking.d.ts +6 -0
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
- `VeroxmTrackerLike.identifyAccount?()`: optional, satisfied by `@veroxm/sdk` 1.1's tracker.
|
|
6
|
+
|
|
7
|
+
## 1.0.0
|
|
8
|
+
|
|
9
|
+
- Stable: from 1.0, breaking changes come only in a major version, after a deprecation period. What that covers
|
|
10
|
+
and what it doesn't: the [stability policy](https://docs.veroxm.com/sdks/stability). The public API is listed in `api-report.md`.
|
|
11
|
+
- The site building blocks (`Chart`, `MapEmbed`, `Slider`, `VideoEmbed`, `NavMenu`, `SiteHeader`, `SiteFooter`,
|
|
12
|
+
`VeroxmSiteStyles` and their helpers) are marked `@experimental`: they can still change in a minor release, always
|
|
13
|
+
noted here.
|
|
14
|
+
|
|
3
15
|
## 0.3.0
|
|
4
16
|
|
|
5
17
|
- `ExperienceDecision.reason` includes `'holdout'`, and `<Experience>` shows its fallback for it.
|
package/README.md
CHANGED
|
@@ -315,6 +315,12 @@ if (error instanceof VeroxmGraphQLError && error.errors[0]?.extensions?.code ===
|
|
|
315
315
|
}
|
|
316
316
|
```
|
|
317
317
|
|
|
318
|
+
## Stability
|
|
319
|
+
|
|
320
|
+
Follows semantic versioning. The site building blocks (charts, maps, sliders, video, menus, header and footer) are `@experimental` and can still change in a minor release. From 1.0, breaking changes come only in a major version, after at least one minor release with the
|
|
321
|
+
feature marked deprecated. What the promise covers (and what it doesn't, such as anything marked `@internal` or
|
|
322
|
+
`@experimental`) is in the [stability policy](https://docs.veroxm.com/sdks/stability).
|
|
323
|
+
|
|
318
324
|
## Documentation and support
|
|
319
325
|
|
|
320
326
|
- Guide: https://docs.veroxm.com/platform-tools/react-sdk
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ChartValue } from './chart.js';
|
|
2
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
2
3
|
export interface ChartProps {
|
|
3
4
|
chart: ChartValue | null | undefined;
|
|
4
5
|
/** Pixels. Default 320 (220 for a key figure). */
|
|
@@ -11,4 +12,5 @@ export interface ChartProps {
|
|
|
11
12
|
/** Spread on the figure, e.g. slot.edit('chart') for VeroXM's on-page editor. */
|
|
12
13
|
editProps?: Record<string, string>;
|
|
13
14
|
}
|
|
15
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
14
16
|
export declare function Chart({ chart, height, locale, showTable, className, editProps }: ChartProps): import("react").JSX.Element | null;
|
package/dist/site/chart-view.js
CHANGED
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useId, useLayoutEffect, useRef, useState } from 'react';
|
|
4
4
|
import { chartSummary, chartSvg, formatChartNumber } from './chart.js';
|
|
5
5
|
const COLORS = ['#2a78d6', '#eb6834', '#1baf7a', '#eda100', '#e87ba4', '#008300'];
|
|
6
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
6
7
|
export function Chart({ chart, height, locale, showTable = true, className, editProps }) {
|
|
7
8
|
const id = useId();
|
|
8
9
|
const boxRef = useRef(null);
|
package/dist/site/chart.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
export declare const CHART_KINDS: readonly ["bar", "hbar", "line", "area", "pie", "donut", "kpi"];
|
|
2
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
2
3
|
export type ChartKind = (typeof CHART_KINDS)[number];
|
|
3
4
|
export declare const ANALYTICS_METRICS: readonly ["visitors", "pageviews", "event", "top_pages"];
|
|
4
5
|
export type AnalyticsMetric = (typeof ANALYTICS_METRICS)[number];
|
|
5
6
|
export declare const ANALYTICS_DAYS: readonly [7, 30, 90];
|
|
7
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
6
8
|
export interface ChartSeries {
|
|
7
9
|
name: string;
|
|
8
10
|
values: Array<number | null>;
|
|
9
11
|
}
|
|
12
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
10
13
|
export type ChartSource = {
|
|
11
14
|
type: "manual";
|
|
12
15
|
}
|
|
@@ -61,6 +64,7 @@ export interface ChartFormat {
|
|
|
61
64
|
suffix?: string;
|
|
62
65
|
decimals?: number;
|
|
63
66
|
}
|
|
67
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
64
68
|
export interface ChartValue {
|
|
65
69
|
kind: ChartKind;
|
|
66
70
|
title?: string;
|
|
@@ -80,31 +84,51 @@ export interface ChartValue {
|
|
|
80
84
|
export declare const MAX_CHART_LABELS = 60;
|
|
81
85
|
export declare const MAX_CHART_SERIES = 6;
|
|
82
86
|
export declare const MAX_PIE_SLICES = 6;
|
|
83
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* Labels and series from rows: collection entries, objects from an API, or anything a developer fetched.
|
|
89
|
+
*
|
|
90
|
+
* @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md).
|
|
91
|
+
*/
|
|
84
92
|
export declare function chartDataFromRows(rows: unknown[], spec: RowsSpec): {
|
|
85
93
|
labels: string[];
|
|
86
94
|
series: ChartSeries[];
|
|
87
95
|
};
|
|
88
|
-
/**
|
|
96
|
+
/**
|
|
97
|
+
* A chart from rows a developer already has (from any API): `chartFromRows(orders, { kind: "bar", label: "month", series: [{ name: "Revenue", field: "total" }] })`.
|
|
98
|
+
*
|
|
99
|
+
* @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md).
|
|
100
|
+
*/
|
|
89
101
|
export declare function chartFromRows(rows: unknown[], spec: RowsSpec & Pick<ChartValue, "kind"> & Partial<Pick<ChartValue, "title" | "caption" | "format" | "target">>): ChartValue;
|
|
90
102
|
/** A chart's value checked and cleaned; problems say what to fix. `forPublish` also refuses sample numbers and empty manual charts. */
|
|
91
103
|
export declare function checkChart(raw: unknown, forPublish?: boolean): {
|
|
92
104
|
value: ChartValue | null;
|
|
93
105
|
problems: string[];
|
|
94
106
|
};
|
|
95
|
-
/**
|
|
107
|
+
/**
|
|
108
|
+
* A number as the chart writes it: the chart's prefix, suffix and decimals, in the reader's locale.
|
|
109
|
+
*
|
|
110
|
+
* @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md).
|
|
111
|
+
*/
|
|
96
112
|
export declare function formatChartNumber(v: number | null | undefined, format?: ChartFormat, opts?: {
|
|
97
113
|
compact?: boolean;
|
|
98
114
|
locale?: string;
|
|
99
115
|
}): string;
|
|
100
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* One sentence describing the chart, for screen readers.
|
|
118
|
+
*
|
|
119
|
+
* @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md).
|
|
120
|
+
*/
|
|
101
121
|
export declare function chartSummary(c: ChartValue, locale?: string): string;
|
|
102
122
|
export interface ChartSvgOptions {
|
|
103
123
|
width: number;
|
|
104
124
|
height: number;
|
|
105
125
|
locale?: string;
|
|
106
126
|
}
|
|
107
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* The chart as SVG markup (empty when there is nothing to draw). Marks carry data-x so a page can show a tooltip on hover.
|
|
129
|
+
*
|
|
130
|
+
* @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md).
|
|
131
|
+
*/
|
|
108
132
|
export declare function chartSvg(c: ChartValue, { width, height, locale }: ChartSvgOptions): string;
|
|
109
133
|
/** Series values for analytics and connected charts, filled into a chart (labels and series replaced). */
|
|
110
134
|
export declare function withChartData(c: ChartValue, labels: string[], series: ChartSeries[]): ChartValue;
|
|
@@ -117,6 +141,7 @@ export declare function parseChartTable(text: string): {
|
|
|
117
141
|
} | {
|
|
118
142
|
error: string;
|
|
119
143
|
};
|
|
144
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
120
145
|
export interface ChartTemplate {
|
|
121
146
|
id: string;
|
|
122
147
|
name: string;
|
|
@@ -124,4 +149,5 @@ export interface ChartTemplate {
|
|
|
124
149
|
why: string;
|
|
125
150
|
value: ChartValue;
|
|
126
151
|
}
|
|
152
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
127
153
|
export declare const CHART_TEMPLATES: ChartTemplate[];
|
package/dist/site/chart.js
CHANGED
|
@@ -66,7 +66,11 @@ function rowNumber(v) {
|
|
|
66
66
|
return rowNumber(v.amount);
|
|
67
67
|
return null;
|
|
68
68
|
}
|
|
69
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* Labels and series from rows: collection entries, objects from an API, or anything a developer fetched.
|
|
71
|
+
*
|
|
72
|
+
* @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md).
|
|
73
|
+
*/
|
|
70
74
|
export function chartDataFromRows(rows, spec) {
|
|
71
75
|
const max = Math.min(spec.limit ?? MAX_CHART_LABELS, MAX_CHART_LABELS);
|
|
72
76
|
const labelOf = (r) => {
|
|
@@ -98,7 +102,11 @@ export function chartDataFromRows(rows, spec) {
|
|
|
98
102
|
}));
|
|
99
103
|
return { labels, series };
|
|
100
104
|
}
|
|
101
|
-
/**
|
|
105
|
+
/**
|
|
106
|
+
* A chart from rows a developer already has (from any API): `chartFromRows(orders, { kind: "bar", label: "month", series: [{ name: "Revenue", field: "total" }] })`.
|
|
107
|
+
*
|
|
108
|
+
* @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md).
|
|
109
|
+
*/
|
|
102
110
|
export function chartFromRows(rows, spec) {
|
|
103
111
|
const { labels, series } = chartDataFromRows(rows, spec);
|
|
104
112
|
return { kind: spec.kind, ...(spec.title ? { title: spec.title } : {}), ...(spec.caption ? { caption: spec.caption } : {}), ...(spec.format ? { format: spec.format } : {}), ...(spec.target !== undefined ? { target: spec.target } : {}), labels, series, source: { type: "manual" } };
|
|
@@ -228,7 +236,11 @@ export function checkChart(raw, forPublish = true) {
|
|
|
228
236
|
};
|
|
229
237
|
return { value, problems };
|
|
230
238
|
}
|
|
231
|
-
/**
|
|
239
|
+
/**
|
|
240
|
+
* A number as the chart writes it: the chart's prefix, suffix and decimals, in the reader's locale.
|
|
241
|
+
*
|
|
242
|
+
* @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md).
|
|
243
|
+
*/
|
|
232
244
|
export function formatChartNumber(v, format = {}, opts = {}) {
|
|
233
245
|
if (!isNum(v))
|
|
234
246
|
return "–";
|
|
@@ -239,7 +251,11 @@ export function formatChartNumber(v, format = {}, opts = {}) {
|
|
|
239
251
|
});
|
|
240
252
|
return `${format.prefix ?? ""}${nf.format(v)}${format.suffix ?? ""}`;
|
|
241
253
|
}
|
|
242
|
-
/**
|
|
254
|
+
/**
|
|
255
|
+
* One sentence describing the chart, for screen readers.
|
|
256
|
+
*
|
|
257
|
+
* @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md).
|
|
258
|
+
*/
|
|
243
259
|
export function chartSummary(c, locale) {
|
|
244
260
|
const kind = { bar: "Column chart", hbar: "Bar chart", line: "Line chart", area: "Area chart", pie: "Pie chart", donut: "Donut chart", kpi: "Key figure" }[c.kind];
|
|
245
261
|
const s = c.series[0];
|
|
@@ -314,7 +330,11 @@ function legend(series, x, y, width) {
|
|
|
314
330
|
});
|
|
315
331
|
return { svg: `<g class="vxc-legend">${parts.join("")}</g>`, height: cy - y + 22 };
|
|
316
332
|
}
|
|
317
|
-
/**
|
|
333
|
+
/**
|
|
334
|
+
* The chart as SVG markup (empty when there is nothing to draw). Marks carry data-x so a page can show a tooltip on hover.
|
|
335
|
+
*
|
|
336
|
+
* @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md).
|
|
337
|
+
*/
|
|
318
338
|
export function chartSvg(c, { width, height, locale }) {
|
|
319
339
|
const series = c.series.filter((s) => s.values.some(isNum));
|
|
320
340
|
if (!series.length || width < 120 || height < 80)
|
|
@@ -587,6 +607,7 @@ export function parseChartTable(text) {
|
|
|
587
607
|
return { labels, series };
|
|
588
608
|
}
|
|
589
609
|
const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
610
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
590
611
|
export const CHART_TEMPLATES = [
|
|
591
612
|
{
|
|
592
613
|
id: "monthly-sales",
|
package/dist/site/map-embed.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SlotMap } from '../slots-core.js';
|
|
2
2
|
import { type GeoPoint } from './map-math.js';
|
|
3
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
3
4
|
export interface MapEmbedProps {
|
|
4
5
|
map: SlotMap | null | undefined;
|
|
5
6
|
/** The map's accessible name. Default "Map". */
|
|
@@ -29,4 +30,5 @@ export declare function tilesFor(center: GeoPoint, zoom: number, width: number,
|
|
|
29
30
|
x: number;
|
|
30
31
|
y: number;
|
|
31
32
|
}[];
|
|
33
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
32
34
|
export declare function MapEmbed({ map, label, height, tileUrl, attribution, deferred, showList, className, editProps, }: MapEmbedProps): import("react").JSX.Element | null;
|
package/dist/site/map-embed.js
CHANGED
|
@@ -32,6 +32,7 @@ export function tilesFor(center, zoom, width, height, tileUrl) {
|
|
|
32
32
|
function PlaceLines({ place }) {
|
|
33
33
|
return (_jsxs(_Fragment, { children: [_jsx("span", { className: "vxs-place-name", children: place.name }), place.address ? _jsx("span", { className: "vxs-place-address", children: place.address }) : null, _jsxs("span", { className: "vxs-place-links", children: [place.link && isSafeMenuHref(place.link) ? _jsx("a", { href: place.link, children: "Details" }) : null, _jsxs("a", { href: osmLink(place), target: "_blank", rel: "noopener noreferrer", children: ["Open map", _jsxs("span", { className: "vxs-sr", children: [" of ", place.name, " in a new tab"] })] })] })] }));
|
|
34
34
|
}
|
|
35
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
35
36
|
export function MapEmbed({ map, label = 'Map', height = 380, tileUrl = OSM_TILES, attribution = tileUrl === OSM_TILES ? OSM_CREDIT : undefined, deferred = false, showList = true, className, editProps, }) {
|
|
36
37
|
const id = useId();
|
|
37
38
|
const places = useMemo(() => (map?.places ?? []).filter((p) => Number.isFinite(p.lat) && Number.isFinite(p.lng) && Math.abs(p.lat) <= 90 && Math.abs(p.lng) <= 180), [map]);
|
package/dist/site/map-math.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export declare const MAP_TILE_SIZE = 256;
|
|
|
9
9
|
* A place from what an editor pastes: '24.7136, 46.6753', or a link to
|
|
10
10
|
* OpenStreetMap, Google Maps or Apple Maps. The zoom comes along when the
|
|
11
11
|
* link has one.
|
|
12
|
+
*
|
|
13
|
+
* @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md).
|
|
12
14
|
*/
|
|
13
15
|
export declare function parseMapLink(input: string): (GeoPoint & {
|
|
14
16
|
zoom?: number;
|
package/dist/site/map-math.js
CHANGED
|
@@ -12,6 +12,8 @@ const round6 = (v) => Math.round(v * 1e6) / 1e6;
|
|
|
12
12
|
* A place from what an editor pastes: '24.7136, 46.6753', or a link to
|
|
13
13
|
* OpenStreetMap, Google Maps or Apple Maps. The zoom comes along when the
|
|
14
14
|
* link has one.
|
|
15
|
+
*
|
|
16
|
+
* @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md).
|
|
15
17
|
*/
|
|
16
18
|
export function parseMapLink(input) {
|
|
17
19
|
const text = input.trim();
|
package/dist/site/nav-menu.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ElementType } from 'react';
|
|
2
2
|
import type { SlotMenuItem } from '../slots-core.js';
|
|
3
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
3
4
|
export interface NavMenuProps {
|
|
4
5
|
items: SlotMenuItem[];
|
|
5
6
|
/** The nav's accessible name. Default "Main". */
|
|
@@ -14,6 +15,11 @@ export interface NavMenuProps {
|
|
|
14
15
|
/** Spread on the nav, e.g. slot.edit('menu') for VeroXM's on-page editor. */
|
|
15
16
|
editProps?: Record<string, string>;
|
|
16
17
|
}
|
|
17
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Links VeroXM accepts in a menu; anything else renders as plain text.
|
|
20
|
+
*
|
|
21
|
+
* @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md).
|
|
22
|
+
*/
|
|
18
23
|
export declare function isSafeMenuHref(href: string): boolean;
|
|
24
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
19
25
|
export declare function NavMenu({ items, label, currentPath, linkComponent, toggleLabel, className, editProps }: NavMenuProps): import("react").JSX.Element | null;
|
package/dist/site/nav-menu.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useId, useRef, useState } from 'react';
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Links VeroXM accepts in a menu; anything else renders as plain text.
|
|
6
|
+
*
|
|
7
|
+
* @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md).
|
|
8
|
+
*/
|
|
5
9
|
export function isSafeMenuHref(href) {
|
|
6
10
|
return /^(https?:\/\/|mailto:|tel:|\/(?!\/)|#)/i.test(href.trim());
|
|
7
11
|
}
|
|
@@ -16,6 +20,7 @@ function MenuLink({ item, currentPath, Link, onNavigate }) {
|
|
|
16
20
|
return _jsx("span", { className: "vxs-nav-text", children: item.label });
|
|
17
21
|
return (_jsxs(Link, { className: "vxs-nav-link", href: item.href, onClick: onNavigate, ...(samePage(item.href, currentPath) ? { 'aria-current': 'page' } : {}), ...(item.newTab ? { target: '_blank', rel: 'noopener noreferrer' } : {}), children: [item.label, item.newTab ? _jsx("span", { className: "vxs-sr", children: " (opens in a new tab)" }) : null] }));
|
|
18
22
|
}
|
|
23
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
19
24
|
export function NavMenu({ items, label = 'Main', currentPath, linkComponent = 'a', toggleLabel = 'Menu', className, editProps }) {
|
|
20
25
|
const id = useId();
|
|
21
26
|
const navRef = useRef(null);
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { ElementType, ReactNode } from 'react';
|
|
2
2
|
import { type SlotLink, type SlotMedia, type SlotMenuItem } from '../slots-core.js';
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* What marketers edit in a site header.
|
|
5
|
+
*
|
|
6
|
+
* @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md).
|
|
7
|
+
*/
|
|
4
8
|
export declare const headerFields: {
|
|
5
9
|
logo: {
|
|
6
10
|
label?: string;
|
|
@@ -53,6 +57,7 @@ export declare const footerFields: {
|
|
|
53
57
|
};
|
|
54
58
|
};
|
|
55
59
|
type Edit = (fieldName: string) => Record<string, string>;
|
|
60
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
56
61
|
export interface SiteHeaderProps {
|
|
57
62
|
logo?: SlotMedia | null;
|
|
58
63
|
logoText?: string;
|
|
@@ -71,7 +76,9 @@ export interface SiteHeaderProps {
|
|
|
71
76
|
/** Extra content at the end, such as a language switcher or a search button. */
|
|
72
77
|
children?: ReactNode;
|
|
73
78
|
}
|
|
79
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
74
80
|
export declare function SiteHeader({ logo, logoText, menu, cta, homeHref, currentPath, linkComponent, edit, sticky, className, children }: SiteHeaderProps): import("react").JSX.Element;
|
|
81
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
75
82
|
export interface SiteFooterProps {
|
|
76
83
|
columns?: SlotMenuItem[];
|
|
77
84
|
/** Rich text, as VeroXM stores it (already cleaned to a safe set of tags). */
|
|
@@ -83,5 +90,6 @@ export interface SiteFooterProps {
|
|
|
83
90
|
className?: string;
|
|
84
91
|
children?: ReactNode;
|
|
85
92
|
}
|
|
93
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
86
94
|
export declare function SiteFooter({ columns, text, social, legal, linkComponent, edit, className, children }: SiteFooterProps): import("react").JSX.Element;
|
|
87
95
|
export {};
|
package/dist/site/site-parts.js
CHANGED
|
@@ -10,7 +10,11 @@ import { NavMenu, isSafeMenuHref } from './nav-menu.js';
|
|
|
10
10
|
//
|
|
11
11
|
// No hooks here, so both work in Server Components (NavMenu, inside the
|
|
12
12
|
// header, is the only client part).
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* What marketers edit in a site header.
|
|
15
|
+
*
|
|
16
|
+
* @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md).
|
|
17
|
+
*/
|
|
14
18
|
export const headerFields = {
|
|
15
19
|
logo: field.media({ label: 'Logo' }),
|
|
16
20
|
logoText: field.text({ label: 'Site name', max: 60 }),
|
|
@@ -36,10 +40,12 @@ function Anchor({ href, className, children, Link, newTab, ...rest }) {
|
|
|
36
40
|
return _jsx("span", { className: className, children: children });
|
|
37
41
|
return (_jsx(Link, { href: href, className: className, ...(newTab ? { target: '_blank', rel: 'noopener noreferrer' } : {}), ...rest, children: children }));
|
|
38
42
|
}
|
|
43
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
39
44
|
export function SiteHeader({ logo = null, logoText = '', menu = [], cta = null, homeHref = '/', currentPath, linkComponent = 'a', edit = noEdit, sticky, className, children }) {
|
|
40
45
|
const Link = linkComponent;
|
|
41
46
|
return (_jsx("header", { className: `vxs-header${sticky ? ' vxs-sticky' : ''}${className ? ` ${className}` : ''}`, children: _jsxs("div", { className: "vxs-header-inner", children: [_jsx(Link, { href: homeHref, className: "vxs-brand", "aria-label": logo?.url ? `${logoText || logo.alt || 'Home'}, home` : undefined, ...edit(logo?.url ? 'logo' : 'logoText'), children: _jsx(Logo, { logo: logo, text: logoText }) }), _jsx(NavMenu, { items: menu, currentPath: currentPath, linkComponent: linkComponent, editProps: edit('menu') }), cta?.href ? (_jsx(Anchor, { href: cta.href, className: "vxs-cta", Link: Link, ...edit('cta'), children: cta.label || cta.href })) : null, children] }) }));
|
|
42
47
|
}
|
|
48
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
43
49
|
export function SiteFooter({ columns = [], text = '', social = [], legal = '', linkComponent = 'a', edit = noEdit, className, children }) {
|
|
44
50
|
const Link = linkComponent;
|
|
45
51
|
return (_jsxs("footer", { className: `vxs-footer${className ? ` ${className}` : ''}`, children: [_jsxs("div", { className: "vxs-footer-inner", children: [text ? _jsx("div", { className: "vxs-footer-text", ...edit('text'), dangerouslySetInnerHTML: { __html: text } }) : null, columns.length ? (_jsx("nav", { "aria-label": "Footer", className: "vxs-footer-columns", ...edit('columns'), children: columns.map((col, i) => (_jsxs("div", { className: "vxs-footer-column", children: [col.href ? (_jsx(Anchor, { href: col.href, className: "vxs-footer-heading", Link: Link, newTab: col.newTab, children: col.label })) : (_jsx("p", { className: "vxs-footer-heading", children: col.label })), col.children?.length ? (_jsx("ul", { children: col.children.map((item, j) => (_jsx("li", { children: _jsx(Anchor, { href: item.href, className: "vxs-footer-link", Link: Link, newTab: item.newTab, children: item.label }) }, j))) })) : null] }, i))) })) : null] }), social.length || legal || children ? (_jsxs("div", { className: "vxs-footer-bottom", children: [legal ? (_jsx("p", { className: "vxs-legal", ...edit('legal'), children: legal })) : null, social.length ? (_jsx("ul", { className: "vxs-social", "aria-label": "Social media", ...edit('social'), children: social.map((item, i) => (_jsx("li", { children: _jsx(Anchor, { href: item.href, className: "vxs-footer-link", Link: Link, newTab: item.newTab, children: item.label }) }, i))) })) : null, children] })) : null] }));
|
package/dist/site/slider.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ElementType, type ReactNode } from 'react';
|
|
2
2
|
import type { SlotSlide } from '../slots-core.js';
|
|
3
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
3
4
|
export interface SliderProps {
|
|
4
5
|
slides: SlotSlide[];
|
|
5
6
|
/** The slider's accessible name. Default "Slides". */
|
|
@@ -14,4 +15,5 @@ export interface SliderProps {
|
|
|
14
15
|
/** Spread on the slider, e.g. slot.edit('slides') for VeroXM's on-page editor. */
|
|
15
16
|
editProps?: Record<string, string>;
|
|
16
17
|
}
|
|
18
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
17
19
|
export declare function Slider({ slides, label, autoplay, renderSlide, linkComponent, className, editProps }: SliderProps): import("react").JSX.Element | null;
|
package/dist/site/slider.js
CHANGED
|
@@ -9,6 +9,7 @@ function DefaultSlide({ slide, index, Link }) {
|
|
|
9
9
|
const position = p ? `${Math.round(p.x * 100)}% ${Math.round(p.y * 100)}%` : undefined;
|
|
10
10
|
return (_jsxs(_Fragment, { children: [img?.url ? (_jsxs("picture", { children: [img.webpUrl ? _jsx("source", { srcSet: img.webpUrl, type: "image/webp" }) : null, _jsx("img", { className: "vxs-slide-img", src: img.url, alt: slide.title ? '' : img.alt, width: img.width ?? undefined, height: img.height ?? undefined, loading: index === 0 ? 'eager' : 'lazy', decoding: "async", style: position ? { objectPosition: position } : undefined })] })) : null, slide.title || slide.text || slide.link?.href ? (_jsxs("div", { className: "vxs-slide-caption", children: [slide.title ? _jsx("p", { className: "vxs-slide-title", children: slide.title }) : null, slide.text ? _jsx("p", { className: "vxs-slide-text", children: slide.text }) : null, slide.link?.href && isSafeMenuHref(slide.link.href) ? (_jsx(Link, { className: "vxs-slide-link", href: slide.link.href, children: slide.link.label || slide.link.href })) : null] })) : null] }));
|
|
11
11
|
}
|
|
12
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
12
13
|
export function Slider({ slides, label = 'Slides', autoplay = 0, renderSlide, linkComponent = 'a', className, editProps }) {
|
|
13
14
|
const id = useId();
|
|
14
15
|
const rootRef = useRef(null);
|
package/dist/site/styles.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
1
2
|
export declare const SITE_STYLES = "\n:root{--vxs-bg:#fff;--vxs-fg:#18181b;--vxs-muted:#52525b;--vxs-line:#e4e4e7;--vxs-accent:#4f46e5;--vxs-accent-fg:#fff;--vxs-menu-bg:#fff;--vxs-radius:10px;--vxs-width:1200px;--vxs-footer-bg:#fafafa}\n.vxs-sr{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}\n.vxs-header{background:var(--vxs-bg);color:var(--vxs-fg);border-bottom:1px solid var(--vxs-line);position:relative;z-index:40}\n.vxs-sticky{position:sticky;top:0}\n.vxs-header-inner{max-width:var(--vxs-width);margin:0 auto;padding:12px 20px;display:flex;align-items:center;gap:24px}\n.vxs-brand{display:flex;align-items:center;color:inherit;text-decoration:none;font-weight:700;font-size:1.15rem;flex-shrink:0}\n.vxs-logo{display:block;max-height:40px;width:auto;height:auto}\n.vxs-nav{flex:1;display:flex;align-items:center}\n.vxs-nav ul{list-style:none;margin:0;padding:0}\n.vxs-nav-list{display:flex;flex-wrap:wrap;gap:4px}\n.vxs-nav-item{position:relative}\n.vxs-nav-row{display:flex;align-items:center}\n.vxs-nav-link,.vxs-nav-text,.vxs-nav-button{display:flex;align-items:center;gap:6px;padding:8px 12px;border-radius:8px;color:inherit;text-decoration:none;font:inherit;background:none;border:0;cursor:pointer;line-height:1.3}\n.vxs-nav-text{cursor:default}\n.vxs-nav-more{padding:8px 6px;margin-left:-8px}\n.vxs-nav-link:hover,.vxs-nav-button:hover{background:color-mix(in srgb,var(--vxs-fg) 6%,transparent)}\n.vxs-nav-link[aria-current=page]{color:var(--vxs-accent);font-weight:600}\n.vxs-nav :focus-visible,.vxs-footer :focus-visible,.vxs-brand:focus-visible,.vxs-cta:focus-visible{outline:2px solid var(--vxs-accent);outline-offset:2px}\n.vxs-caret{width:7px;height:7px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:translateY(-2px) rotate(45deg);transition:transform .15s}\n[aria-expanded=true]>.vxs-caret{transform:translateY(1px) rotate(-135deg)}\n.vxs-nav-sub{min-width:220px;background:var(--vxs-menu-bg);border:1px solid var(--vxs-line);border-radius:var(--vxs-radius);box-shadow:0 12px 32px rgba(0,0,0,.12);padding:6px}\n.vxs-nav-sub-2{position:absolute;top:calc(100% + 4px);left:0}\n.vxs-nav-sub .vxs-nav-link,.vxs-nav-sub .vxs-nav-button,.vxs-nav-sub .vxs-nav-text{width:100%;justify-content:space-between}\n.vxs-nav-sub .vxs-nav-row .vxs-nav-link{width:auto;flex:1}\n.vxs-nav-sub .vxs-nav-more{width:auto;flex:none}\n.vxs-nav-link,.vxs-nav-button,.vxs-nav-text{white-space:nowrap}\n.vxs-nav-sub-3{border:0;box-shadow:none;padding:0 0 0 12px;min-width:0;border-left:2px solid var(--vxs-line);border-radius:0;margin:2px 0 4px 12px}\n.vxs-nav-sub[hidden]{display:none}\n.vxs-nav-toggle{display:none;align-items:center;gap:8px;margin-left:auto;padding:8px 12px;border:1px solid var(--vxs-line);border-radius:8px;background:none;color:inherit;font:inherit;cursor:pointer}\n.vxs-burger,.vxs-burger::before,.vxs-burger::after{display:block;width:16px;height:2px;background:currentColor;border-radius:2px;position:relative}\n.vxs-burger::before,.vxs-burger::after{content:\"\";position:absolute;left:0}\n.vxs-burger::before{top:-5px}.vxs-burger::after{top:5px}\n.vxs-cta{display:inline-flex;align-items:center;padding:9px 16px;border-radius:999px;background:var(--vxs-accent);color:var(--vxs-accent-fg);text-decoration:none;font-weight:600;white-space:nowrap}\n@media (max-width:767px){\n.vxs-header-inner{flex-wrap:wrap;gap:12px}\n.vxs-nav{display:contents}\n.vxs-cta{order:1;margin-left:auto}\n.vxs-nav-toggle{display:inline-flex;order:2;margin-left:auto}\n.vxs-header-inner:has(.vxs-cta) .vxs-nav-toggle{margin-left:0}\n.vxs-nav-list{order:3;flex-basis:100%;display:none;flex-direction:column;padding:4px 0 8px}\n.vxs-nav-list[data-open=true]{display:flex}\n.vxs-nav-sub,.vxs-nav-sub-2{position:static;box-shadow:none;border:0;border-left:2px solid var(--vxs-line);border-radius:0;margin:0 0 4px 12px;padding:0 0 0 8px;min-width:0}\n}\n@media (max-width:479px){\n.vxs-header-inner{gap:8px}\n.vxs-nav-toggle{padding:10px}\n.vxs-nav-toggle-text{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}\n.vxs-cta{padding:7px 12px;font-size:.875rem}\n}\n@media (prefers-reduced-motion:reduce){.vxs-caret{transition:none}}\n.vxs-video{position:relative;aspect-ratio:16/9;background:#000;border-radius:var(--vxs-radius);overflow:hidden}\n.vxs-video-frame{position:absolute;inset:0;width:100%;height:100%;border:0;display:block}\n.vxs-video-cover{all:unset;position:absolute;inset:0;cursor:pointer;display:block}\n.vxs-video-cover img{width:100%;height:100%;object-fit:cover;display:block}\n.vxs-video-play{position:absolute;left:50%;top:50%;width:68px;height:48px;margin:-24px 0 0 -34px;border-radius:14px;background:rgba(0,0,0,.72);transition:background .15s}\n.vxs-video-play::after{content:\"\";position:absolute;left:28px;top:14px;border-style:solid;border-width:10px 0 10px 17px;border-color:transparent transparent transparent #fff}\n.vxs-video-cover:hover .vxs-video-play,.vxs-video-cover:focus-visible .vxs-video-play{background:var(--vxs-accent)}\n.vxs-video-cover:focus-visible{outline:3px solid var(--vxs-accent);outline-offset:-3px}\n.vxs-video-title{position:absolute;left:0;right:0;bottom:0;padding:24px 16px 12px;color:#fff;font-weight:600;background:linear-gradient(transparent,rgba(0,0,0,.7))}\n.vxs-slider{position:relative;--vxs-slide-ratio:16/7}\n.vxs-slider-viewport{overflow:hidden;border-radius:var(--vxs-radius);touch-action:pan-y}\n.vxs-slider-track{display:flex;transition:transform .45s ease}\n.vxs-slide{flex:0 0 100%;position:relative;aspect-ratio:var(--vxs-slide-ratio);background:var(--vxs-line);overflow:hidden}\n.vxs-slide picture{display:contents}\n.vxs-slide-img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}\n.vxs-slide-caption{position:absolute;inset:auto 0 0 0;padding:48px clamp(16px,4vw,48px) clamp(16px,3vw,36px);color:#fff;background:linear-gradient(transparent,rgba(0,0,0,.65));display:flex;flex-direction:column;align-items:flex-start;gap:8px}\n.vxs-slide-title{margin:0;font-size:clamp(1.25rem,3vw,2.25rem);font-weight:700;line-height:1.15;max-width:24ch}\n.vxs-slide-text{margin:0;max-width:52ch;opacity:.92}\n.vxs-slide-link{display:inline-flex;margin-top:4px;padding:9px 16px;border-radius:999px;background:var(--vxs-accent);color:var(--vxs-accent-fg);text-decoration:none;font-weight:600}\n.vxs-slide-link:focus-visible{outline:2px solid #fff;outline-offset:2px}\n.vxs-slider-controls{display:flex;align-items:center;justify-content:center;gap:12px;margin-top:12px}\n.vxs-slider-btn{appearance:none;display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:50%;border:1px solid var(--vxs-line);background:var(--vxs-bg);color:var(--vxs-fg);cursor:pointer}\n.vxs-slider-btn:focus-visible,.vxs-slider-dot:focus-visible{outline:2px solid var(--vxs-accent);outline-offset:2px}\n.vxs-chevron{width:8px;height:8px;border-right:2px solid currentColor;border-bottom:2px solid currentColor}\n.vxs-slider-prev .vxs-chevron{transform:translateX(2px) rotate(135deg)}\n.vxs-slider-next .vxs-chevron{transform:translateX(-2px) rotate(-45deg)}\n[dir=rtl] .vxs-slider-prev .vxs-chevron{transform:translateX(-2px) rotate(-45deg)}\n[dir=rtl] .vxs-slider-next .vxs-chevron{transform:translateX(2px) rotate(135deg)}\n.vxs-icon-pause{width:10px;height:12px;border-left:3px solid currentColor;border-right:3px solid currentColor}\n.vxs-icon-play{width:0;height:0;margin-left:3px;border-style:solid;border-width:6px 0 6px 10px;border-color:transparent transparent transparent currentColor}\n.vxs-slider-dots{display:flex;gap:2px}\n.vxs-slider-dot{appearance:none;width:24px;height:24px;border:0;background:none;cursor:pointer;position:relative;padding:0}\n.vxs-slider-dot::after{content:\"\";position:absolute;left:8px;top:8px;width:8px;height:8px;border-radius:50%;background:var(--vxs-muted);opacity:.4}\n.vxs-slider-dot[aria-current=true]::after{opacity:1;background:var(--vxs-accent);transform:scale(1.25)}\n.vxs-map{margin:0}\n.vxs-map-view{position:relative;overflow:hidden;border-radius:var(--vxs-radius);background:#e5e3df;touch-action:none;cursor:grab;user-select:none}\n.vxs-map-view:active{cursor:grabbing}\n.vxs-map-view:focus-visible{outline:2px solid var(--vxs-accent);outline-offset:2px}\n.vxs-map-tiles img{position:absolute;width:256px;height:256px;max-width:none;pointer-events:none}\n.vxs-map-pin{appearance:none;position:absolute;width:28px;height:28px;margin:-28px 0 0 -14px;padding:0;border:0;background:none;cursor:pointer}\n.vxs-map-pin::before{content:\"\";position:absolute;inset:0;border-radius:50% 50% 50% 0;transform:rotate(-45deg);background:var(--vxs-pin,#e11d48);border:2px solid #fff;box-shadow:0 2px 6px rgba(0,0,0,.35)}\n.vxs-map-pin::after{content:\"\";position:absolute;left:10px;top:8px;width:8px;height:8px;border-radius:50%;background:#fff}\n.vxs-map-pin[aria-expanded=true]::before{background:var(--vxs-accent)}\n.vxs-map-pin:focus-visible{outline:2px solid var(--vxs-accent);outline-offset:4px;border-radius:50%}\n.vxs-map-card{position:absolute;z-index:1;transform:translate(-50%,calc(-100% - 36px));min-width:180px;max-width:260px;background:var(--vxs-bg);color:var(--vxs-fg);border-radius:10px;box-shadow:0 8px 24px rgba(0,0,0,.2);padding:10px 12px;display:flex;flex-direction:column;gap:2px;font-size:.875rem;cursor:auto}\n.vxs-place-name{font-weight:650}\n.vxs-place-address{color:var(--vxs-muted)}\n.vxs-place-links{display:flex;gap:12px;margin-top:4px}\n.vxs-place-links a{color:var(--vxs-accent)}\n.vxs-map-zoom{position:absolute;z-index:2;top:10px;right:10px;display:flex;flex-direction:column;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,.2)}\n.vxs-map-zoom button{appearance:none;width:34px;height:34px;border:0;border-bottom:1px solid var(--vxs-line);background:var(--vxs-bg);color:var(--vxs-fg);font-size:18px;line-height:1;cursor:pointer}\n.vxs-map-zoom button:last-child{border-bottom:0}\n.vxs-map-zoom button:disabled{opacity:.4;cursor:not-allowed}\n.vxs-map-zoom button:focus-visible{outline:2px solid var(--vxs-accent);outline-offset:-2px}\n.vxs-map-credit{position:absolute;right:0;bottom:0;padding:2px 6px;font-size:11px;background:rgba(255,255,255,.8);color:#333;text-decoration:none}\n.vxs-map-defer{appearance:none;width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;border:1px dashed var(--vxs-line);border-radius:var(--vxs-radius);background:var(--vxs-footer-bg);color:var(--vxs-fg);font:inherit;font-weight:600;cursor:pointer}\n.vxs-map-defer-note{font-weight:400;font-size:.8rem;color:var(--vxs-muted)}\n.vxs-map-list{list-style:none;margin:12px 0 0;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px}\n.vxs-map-item{display:flex;flex-direction:column;gap:2px;font-size:.9rem;padding:10px 12px;border:1px solid var(--vxs-line);border-radius:10px}\n[dir=rtl] .vxs-map-zoom{right:auto;left:10px}\n.vxs-chart{margin:0;--vxc-surface:var(--vxs-bg)}\n.vxs-chart-title{margin:0 0 8px;font-weight:650;font-size:1.05rem}\n.vxs-chart-box{position:relative}\n.vxs-chart-box svg{display:block;width:100%;height:100%;overflow:visible}\n.vxs-chart-cross{position:absolute;top:8px;bottom:26px;width:1px;background:var(--vxc-axis,#c3c2b7);pointer-events:none}\n.vxs-chart-tip{position:absolute;z-index:2;min-width:120px;max-width:200px;padding:8px 10px;border-radius:8px;background:var(--vxs-bg);color:var(--vxs-fg);box-shadow:0 6px 20px rgba(0,0,0,.18);font-size:.8rem;display:flex;flex-direction:column;gap:2px;pointer-events:none}\n.vxs-chart-tip-label{color:var(--vxs-muted)}\n.vxs-chart-tip-row{display:flex;align-items:center;gap:6px}\n.vxs-chart-tip-row i{width:8px;height:8px;border-radius:2px;flex:none}\n.vxs-chart-caption{margin:8px 0 0;color:var(--vxs-muted);font-size:.875rem}\n.vxs-chart-data{margin-top:8px;font-size:.875rem}\n.vxs-chart-data summary{cursor:pointer;color:var(--vxs-accent)}\n.vxs-chart-table{overflow-x:auto;margin-top:6px}\n.vxs-chart-table table{border-collapse:collapse;min-width:100%}\n.vxs-chart-table th,.vxs-chart-table td{padding:4px 10px;border-bottom:1px solid var(--vxs-line);text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}\n.vxs-chart-table th:first-child{text-align:left;font-weight:500}\n@media (prefers-color-scheme:dark){:root:where(:not([data-theme=light])) .vxs-chart{--vxc-1:#3987e5;--vxc-2:#d95926;--vxc-3:#199e70;--vxc-4:#c98500;--vxc-5:#d55181;--vxc-6:#008300;--vxc-ink:#ffffff;--vxc-ink2:#c3c2b7;--vxc-muted:#898781;--vxc-grid:#2c2c2a;--vxc-axis:#383835;--vxc-good:#0ca30c;--vxc-bad:#e66767}}\n:root[data-theme=dark] .vxs-chart{--vxc-1:#3987e5;--vxc-2:#d95926;--vxc-3:#199e70;--vxc-4:#c98500;--vxc-5:#d55181;--vxc-6:#008300;--vxc-ink:#ffffff;--vxc-ink2:#c3c2b7;--vxc-muted:#898781;--vxc-grid:#2c2c2a;--vxc-axis:#383835;--vxc-good:#0ca30c;--vxc-bad:#e66767}\n@media (max-width:767px){.vxs-slider{--vxs-slide-ratio:4/3}}\n@media (prefers-reduced-motion:reduce){.vxs-slider-track{transition:none}}\n.vxs-footer{background:var(--vxs-footer-bg);color:var(--vxs-fg);border-top:1px solid var(--vxs-line);margin-top:48px}\n.vxs-footer-inner{max-width:var(--vxs-width);margin:0 auto;padding:40px 20px 24px;display:grid;grid-template-columns:minmax(200px,1.2fr) 3fr;gap:32px}\n.vxs-footer-inner>:only-child{grid-column:1/-1}\n.vxs-footer-text{color:var(--vxs-muted);max-width:36ch}\n.vxs-footer-text p{margin:0 0 8px}\n.vxs-footer-columns{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:24px}\n.vxs-footer-heading{display:block;margin:0 0 10px;font-weight:650;color:inherit;text-decoration:none}\n.vxs-footer-column ul,.vxs-social{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}\n.vxs-footer-link{color:var(--vxs-muted);text-decoration:none}\n.vxs-footer-link:hover{color:var(--vxs-fg);text-decoration:underline}\n.vxs-footer-bottom{max-width:var(--vxs-width);margin:0 auto;padding:16px 20px 28px;border-top:1px solid var(--vxs-line);display:flex;flex-wrap:wrap;gap:16px;align-items:center;justify-content:space-between}\n.vxs-legal{margin:0;color:var(--vxs-muted);font-size:.875rem}\n.vxs-social{flex-direction:row;flex-wrap:wrap;gap:16px}\n@media (max-width:767px){.vxs-footer-inner{grid-template-columns:1fr}}\n";
|
|
2
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* The default look for the site components; render once, e.g. in the root layout.
|
|
5
|
+
*
|
|
6
|
+
* @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md).
|
|
7
|
+
*/
|
|
3
8
|
export declare function VeroxmSiteStyles(): import("react").JSX.Element;
|
package/dist/site/styles.js
CHANGED
|
@@ -3,6 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
// <VeroxmSiteStyles /> once (in the root layout), then restyle with the
|
|
4
4
|
// variables on :root, or leave it out and write your own CSS against the
|
|
5
5
|
// vxs-* classes.
|
|
6
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
6
7
|
export const SITE_STYLES = `
|
|
7
8
|
:root{--vxs-bg:#fff;--vxs-fg:#18181b;--vxs-muted:#52525b;--vxs-line:#e4e4e7;--vxs-accent:#4f46e5;--vxs-accent-fg:#fff;--vxs-menu-bg:#fff;--vxs-radius:10px;--vxs-width:1200px;--vxs-footer-bg:#fafafa}
|
|
8
9
|
.vxs-sr{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
|
|
@@ -149,7 +150,11 @@ export const SITE_STYLES = `
|
|
|
149
150
|
.vxs-social{flex-direction:row;flex-wrap:wrap;gap:16px}
|
|
150
151
|
@media (max-width:767px){.vxs-footer-inner{grid-template-columns:1fr}}
|
|
151
152
|
`;
|
|
152
|
-
/**
|
|
153
|
+
/**
|
|
154
|
+
* The default look for the site components; render once, e.g. in the root layout.
|
|
155
|
+
*
|
|
156
|
+
* @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md).
|
|
157
|
+
*/
|
|
153
158
|
export function VeroxmSiteStyles() {
|
|
154
159
|
return _jsx("style", { "data-veroxm-site": "", children: SITE_STYLES });
|
|
155
160
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SlotMedia, SlotVideo } from '../slots-core.js';
|
|
2
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
2
3
|
export interface VideoEmbedProps {
|
|
3
4
|
/** A video field's value, or a link (a link VeroXM doesn't recognise renders nothing). */
|
|
4
5
|
video: SlotVideo | string | null | undefined;
|
|
@@ -12,4 +13,5 @@ export interface VideoEmbedProps {
|
|
|
12
13
|
/** Spread on the wrapper, e.g. slot.edit('video') for VeroXM's on-page editor. */
|
|
13
14
|
editProps?: Record<string, string>;
|
|
14
15
|
}
|
|
16
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
15
17
|
export declare function VideoEmbed({ video, title, poster, thumbnail, className, editProps }: VideoEmbedProps): import("react").JSX.Element | null;
|
package/dist/site/video-embed.js
CHANGED
|
@@ -12,6 +12,7 @@ function toRef(video) {
|
|
|
12
12
|
const ref = video.url ? parseVideoUrl(video.url) : null;
|
|
13
13
|
return ref ? { ...ref, ...(video.title ? { title: video.title } : {}) } : null;
|
|
14
14
|
}
|
|
15
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
15
16
|
export function VideoEmbed({ video, title, poster, thumbnail = true, className, editProps }) {
|
|
16
17
|
const [playing, setPlaying] = useState(false);
|
|
17
18
|
const ref = toRef(video);
|
package/dist/site/video.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
1
2
|
export type VideoProvider = 'youtube' | 'vimeo' | 'file';
|
|
3
|
+
/** @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md). */
|
|
2
4
|
export interface VideoRef {
|
|
3
5
|
provider: VideoProvider;
|
|
4
6
|
/** YouTube's 11-character id, Vimeo's number, or the file's address. */
|
|
@@ -8,9 +10,17 @@ export interface VideoRef {
|
|
|
8
10
|
/** Vimeo: the private hash of an unlisted video. */
|
|
9
11
|
hash?: string;
|
|
10
12
|
}
|
|
11
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* What video a link points to, or null when it isn't one VeroXM can play.
|
|
15
|
+
*
|
|
16
|
+
* @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md).
|
|
17
|
+
*/
|
|
12
18
|
export declare function parseVideoUrl(input: string): VideoRef | null;
|
|
13
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* The player's address: YouTube without cookies, Vimeo without tracking.
|
|
21
|
+
*
|
|
22
|
+
* @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md).
|
|
23
|
+
*/
|
|
14
24
|
export declare function videoEmbedUrl(ref: VideoRef, opts?: {
|
|
15
25
|
autoplay?: boolean;
|
|
16
26
|
}): string;
|
package/dist/site/video.js
CHANGED
|
@@ -14,7 +14,11 @@ function videoSeconds(raw) {
|
|
|
14
14
|
const s = Number(m[1] ?? 0) * 3600 + Number(m[2] ?? 0) * 60 + Number(m[3] ?? 0);
|
|
15
15
|
return s || undefined;
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* What video a link points to, or null when it isn't one VeroXM can play.
|
|
19
|
+
*
|
|
20
|
+
* @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md).
|
|
21
|
+
*/
|
|
18
22
|
export function parseVideoUrl(input) {
|
|
19
23
|
let url;
|
|
20
24
|
try {
|
|
@@ -47,7 +51,11 @@ export function parseVideoUrl(input) {
|
|
|
47
51
|
return { provider: 'file', id: url.toString() };
|
|
48
52
|
return null;
|
|
49
53
|
}
|
|
50
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* The player's address: YouTube without cookies, Vimeo without tracking.
|
|
56
|
+
*
|
|
57
|
+
* @experimental A site building block: it can still change in a minor release (see SDK-STABILITY.md).
|
|
58
|
+
*/
|
|
51
59
|
export function videoEmbedUrl(ref, opts = {}) {
|
|
52
60
|
if (ref.provider === 'file')
|
|
53
61
|
return ref.id;
|
package/dist/tracking.d.ts
CHANGED
|
@@ -8,6 +8,12 @@ export interface VeroxmTrackerLike {
|
|
|
8
8
|
track(name: string, properties?: Record<string, unknown>): void;
|
|
9
9
|
page(properties?: Record<string, unknown>): void;
|
|
10
10
|
identify(userId: string, traits?: Record<string, unknown>): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Links the visitor to a signed-in end user's account with their access token (@veroxm/sdk 1.1). Optional so
|
|
13
|
+
* older trackers still type-check.
|
|
14
|
+
* @since 1.1.0
|
|
15
|
+
*/
|
|
16
|
+
identifyAccount?(accessToken: string, traits?: Record<string, unknown>): Promise<void>;
|
|
11
17
|
consent(choices: {
|
|
12
18
|
analytics?: boolean;
|
|
13
19
|
personalization?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veroxm/react-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "React and Next.js SDK for VeroXM: content hooks, visual slots with A/B tests, the on-page editor, llms.txt and structured data.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"veroxm",
|
|
@@ -67,7 +67,8 @@
|
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"build": "rm -rf dist && tsc -p tsconfig.json",
|
|
70
|
-
"test": "vitest run"
|
|
70
|
+
"test": "vitest run",
|
|
71
|
+
"api:report": "node ../../scripts/api-report.mjs . --write"
|
|
71
72
|
},
|
|
72
73
|
"dependencies": {
|
|
73
74
|
"graphql-request": "^7.0.0"
|