@veroxm/react-sdk 0.0.0-stage → 0.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 +5 -0
- package/LICENSE +21 -0
- package/README.md +295 -2
- package/dist/cache.d.ts +69 -0
- package/dist/cache.js +89 -0
- package/dist/client-slots.d.ts +35 -0
- package/dist/client-slots.js +169 -0
- package/dist/client.d.ts +65 -0
- package/dist/client.js +87 -0
- package/dist/editor/constants.d.ts +12 -0
- package/dist/editor/constants.js +12 -0
- package/dist/editor/handler.d.ts +16 -0
- package/dist/editor/handler.js +175 -0
- package/dist/editor/inline.d.ts +25 -0
- package/dist/editor/inline.js +149 -0
- package/dist/editor/menu-input.d.ts +26 -0
- package/dist/editor/menu-input.js +110 -0
- package/dist/editor/overlay.d.ts +31 -0
- package/dist/editor/overlay.js +856 -0
- package/dist/editor/rich-text.d.ts +21 -0
- package/dist/editor/rich-text.js +232 -0
- package/dist/editor/server.d.ts +9 -0
- package/dist/editor/server.js +43 -0
- package/dist/errors.d.ts +20 -0
- package/dist/errors.js +26 -0
- package/dist/hooks/use-cached-query.d.ts +21 -0
- package/dist/hooks/use-cached-query.js +59 -0
- package/dist/hooks/use-collection.d.ts +10 -0
- package/dist/hooks/use-collection.js +14 -0
- package/dist/hooks/use-entries.d.ts +18 -0
- package/dist/hooks/use-entries.js +25 -0
- package/dist/hooks/use-entry.d.ts +21 -0
- package/dist/hooks/use-entry.js +22 -0
- package/dist/hooks/use-media.d.ts +9 -0
- package/dist/hooks/use-media.js +13 -0
- package/dist/hydration-boundary.d.ts +35 -0
- package/dist/hydration-boundary.js +38 -0
- package/dist/image.d.ts +34 -0
- package/dist/image.js +39 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.js +32 -0
- package/dist/next/cache-components.d.ts +15 -0
- package/dist/next/cache-components.js +25 -0
- package/dist/next/cached.d.ts +9 -0
- package/dist/next/cached.js +20 -0
- package/dist/next/edge-slot.d.ts +21 -0
- package/dist/next/edge-slot.js +29 -0
- package/dist/next/editor.d.ts +7 -0
- package/dist/next/editor.js +13 -0
- package/dist/next/index.d.ts +17 -0
- package/dist/next/index.js +21 -0
- package/dist/next/llms.d.ts +2 -0
- package/dist/next/llms.js +44 -0
- package/dist/next/route.d.ts +12 -0
- package/dist/next/route.js +16 -0
- package/dist/next/slot.d.ts +21 -0
- package/dist/next/slot.js +160 -0
- package/dist/node.d.ts +43 -0
- package/dist/node.js +67 -0
- package/dist/preview.d.ts +35 -0
- package/dist/preview.js +46 -0
- package/dist/provider.d.ts +29 -0
- package/dist/provider.js +37 -0
- package/dist/query-keys.d.ts +19 -0
- package/dist/query-keys.js +49 -0
- package/dist/site/chart-view.d.ts +14 -0
- package/dist/site/chart-view.js +44 -0
- package/dist/site/chart.d.ts +127 -0
- package/dist/site/chart.js +639 -0
- package/dist/site/map-embed.d.ts +32 -0
- package/dist/site/map-embed.js +139 -0
- package/dist/site/map-math.d.ts +27 -0
- package/dist/site/map-math.js +89 -0
- package/dist/site/nav-menu.d.ts +19 -0
- package/dist/site/nav-menu.js +76 -0
- package/dist/site/site-parts.d.ts +87 -0
- package/dist/site/site-parts.js +46 -0
- package/dist/site/slider.d.ts +17 -0
- package/dist/site/slider.js +78 -0
- package/dist/site/styles.d.ts +3 -0
- package/dist/site/styles.js +155 -0
- package/dist/site/video-embed.d.ts +15 -0
- package/dist/site/video-embed.js +27 -0
- package/dist/site/video.d.ts +18 -0
- package/dist/site/video.js +73 -0
- package/dist/slots-core.d.ts +397 -0
- package/dist/slots-core.js +367 -0
- package/dist/slots.d.ts +13 -0
- package/dist/slots.js +30 -0
- package/dist/ssr.d.ts +20 -0
- package/dist/ssr.js +35 -0
- package/dist/structured-data.d.ts +13 -0
- package/dist/structured-data.js +36 -0
- package/dist/tracking.d.ts +142 -0
- package/dist/tracking.js +152 -0
- package/dist/types.d.ts +106 -0
- package/dist/types.js +6 -0
- package/package.json +95 -4
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
export declare const CHART_KINDS: readonly ["bar", "hbar", "line", "area", "pie", "donut", "kpi"];
|
|
2
|
+
export type ChartKind = (typeof CHART_KINDS)[number];
|
|
3
|
+
export declare const ANALYTICS_METRICS: readonly ["visitors", "pageviews", "event", "top_pages"];
|
|
4
|
+
export type AnalyticsMetric = (typeof ANALYTICS_METRICS)[number];
|
|
5
|
+
export declare const ANALYTICS_DAYS: readonly [7, 30, 90];
|
|
6
|
+
export interface ChartSeries {
|
|
7
|
+
name: string;
|
|
8
|
+
values: Array<number | null>;
|
|
9
|
+
}
|
|
10
|
+
export type ChartSource = {
|
|
11
|
+
type: "manual";
|
|
12
|
+
}
|
|
13
|
+
/** Each series from a value in the customer's own system (Connected APIs): a list of numbers, or one number. */
|
|
14
|
+
| {
|
|
15
|
+
type: "connected";
|
|
16
|
+
series: Array<{
|
|
17
|
+
name: string;
|
|
18
|
+
key: string;
|
|
19
|
+
}>;
|
|
20
|
+
labelsKey?: string;
|
|
21
|
+
}
|
|
22
|
+
/** VeroXM's own analytics for the project. */
|
|
23
|
+
| {
|
|
24
|
+
type: "analytics";
|
|
25
|
+
metric: AnalyticsMetric;
|
|
26
|
+
days: 7 | 30 | 90;
|
|
27
|
+
event?: string;
|
|
28
|
+
}
|
|
29
|
+
/** Entries of a VeroXM collection (published, as the Content API serves them). */
|
|
30
|
+
| ({
|
|
31
|
+
type: "content";
|
|
32
|
+
collection: string;
|
|
33
|
+
sort?: string;
|
|
34
|
+
} & RowsSpec)
|
|
35
|
+
/** Rows from the customer's own API: a Connected APIs value that returns a list of objects. */
|
|
36
|
+
| ({
|
|
37
|
+
type: "api";
|
|
38
|
+
key: string;
|
|
39
|
+
} & RowsSpec);
|
|
40
|
+
export declare const ROW_OPS: readonly ["value", "sum", "count", "average"];
|
|
41
|
+
export type RowOp = (typeof ROW_OPS)[number];
|
|
42
|
+
/**
|
|
43
|
+
* How rows (collection entries, or objects from an API) become a chart:
|
|
44
|
+
* one row per label, or, with groupBy, one label per distinct value of the
|
|
45
|
+
* label field, adding up (sum, count or average) the rows that share it.
|
|
46
|
+
*/
|
|
47
|
+
export interface RowsSpec {
|
|
48
|
+
/** The field holding each row's label ("month", or "region.name" inside an object). */
|
|
49
|
+
label: string;
|
|
50
|
+
series: Array<{
|
|
51
|
+
name: string;
|
|
52
|
+
field: string;
|
|
53
|
+
op?: RowOp;
|
|
54
|
+
}>;
|
|
55
|
+
groupBy?: boolean;
|
|
56
|
+
/** Rows (or groups) kept, from the top: at most 60. */
|
|
57
|
+
limit?: number;
|
|
58
|
+
}
|
|
59
|
+
export interface ChartFormat {
|
|
60
|
+
prefix?: string;
|
|
61
|
+
suffix?: string;
|
|
62
|
+
decimals?: number;
|
|
63
|
+
}
|
|
64
|
+
export interface ChartValue {
|
|
65
|
+
kind: ChartKind;
|
|
66
|
+
title?: string;
|
|
67
|
+
/** Under the chart: where the numbers come from, or what to take from it. */
|
|
68
|
+
caption?: string;
|
|
69
|
+
labels: string[];
|
|
70
|
+
series: ChartSeries[];
|
|
71
|
+
format?: ChartFormat;
|
|
72
|
+
/** A goal: a line on bar, line and area charts; progress on a KPI. */
|
|
73
|
+
target?: number;
|
|
74
|
+
source: ChartSource;
|
|
75
|
+
/** The template it started from. */
|
|
76
|
+
template?: string;
|
|
77
|
+
/** Still the template's sample numbers: never published like that. */
|
|
78
|
+
sample?: boolean;
|
|
79
|
+
}
|
|
80
|
+
export declare const MAX_CHART_LABELS = 60;
|
|
81
|
+
export declare const MAX_CHART_SERIES = 6;
|
|
82
|
+
export declare const MAX_PIE_SLICES = 6;
|
|
83
|
+
/** Labels and series from rows: collection entries, objects from an API, or anything a developer fetched. */
|
|
84
|
+
export declare function chartDataFromRows(rows: unknown[], spec: RowsSpec): {
|
|
85
|
+
labels: string[];
|
|
86
|
+
series: ChartSeries[];
|
|
87
|
+
};
|
|
88
|
+
/** A chart from rows a developer already has (from any API): `chartFromRows(orders, { kind: "bar", label: "month", series: [{ name: "Revenue", field: "total" }] })`. */
|
|
89
|
+
export declare function chartFromRows(rows: unknown[], spec: RowsSpec & Pick<ChartValue, "kind"> & Partial<Pick<ChartValue, "title" | "caption" | "format" | "target">>): ChartValue;
|
|
90
|
+
/** A chart's value checked and cleaned; problems say what to fix. `forPublish` also refuses sample numbers and empty manual charts. */
|
|
91
|
+
export declare function checkChart(raw: unknown, forPublish?: boolean): {
|
|
92
|
+
value: ChartValue | null;
|
|
93
|
+
problems: string[];
|
|
94
|
+
};
|
|
95
|
+
/** A number as the chart writes it: the chart's prefix, suffix and decimals, in the reader's locale. */
|
|
96
|
+
export declare function formatChartNumber(v: number | null | undefined, format?: ChartFormat, opts?: {
|
|
97
|
+
compact?: boolean;
|
|
98
|
+
locale?: string;
|
|
99
|
+
}): string;
|
|
100
|
+
/** One sentence describing the chart, for screen readers. */
|
|
101
|
+
export declare function chartSummary(c: ChartValue, locale?: string): string;
|
|
102
|
+
export interface ChartSvgOptions {
|
|
103
|
+
width: number;
|
|
104
|
+
height: number;
|
|
105
|
+
locale?: string;
|
|
106
|
+
}
|
|
107
|
+
/** 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. */
|
|
108
|
+
export declare function chartSvg(c: ChartValue, { width, height, locale }: ChartSvgOptions): string;
|
|
109
|
+
/** Series values for analytics and connected charts, filled into a chart (labels and series replaced). */
|
|
110
|
+
export declare function withChartData(c: ChartValue, labels: string[], series: ChartSeries[]): ChartValue;
|
|
111
|
+
/** The chart's typed-in numbers as text, a row per label (tabs between cells). */
|
|
112
|
+
export declare function chartTableText(c: Pick<ChartValue, "labels" | "series">): string;
|
|
113
|
+
/** Labels and series from pasted or typed rows, or what's wrong with them. */
|
|
114
|
+
export declare function parseChartTable(text: string): {
|
|
115
|
+
labels: string[];
|
|
116
|
+
series: ChartSeries[];
|
|
117
|
+
} | {
|
|
118
|
+
error: string;
|
|
119
|
+
};
|
|
120
|
+
export interface ChartTemplate {
|
|
121
|
+
id: string;
|
|
122
|
+
name: string;
|
|
123
|
+
/** What the chart tells you, and what to do about it. */
|
|
124
|
+
why: string;
|
|
125
|
+
value: ChartValue;
|
|
126
|
+
}
|
|
127
|
+
export declare const CHART_TEMPLATES: ChartTemplate[];
|