@svadmin/lite 0.17.0 → 0.22.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/README.md +71 -2
- package/dist/components/LiteActivityFeed.svelte +24 -2
- package/dist/components/LiteActivityFeed.svelte.d.ts +6 -0
- package/dist/components/LiteAffix.svelte +29 -0
- package/dist/components/LiteAffix.svelte.d.ts +13 -0
- package/dist/components/LiteAnchor.svelte +38 -0
- package/dist/components/LiteAnchor.svelte.d.ts +14 -0
- package/dist/components/LiteApprovalActionCard.svelte +4 -1
- package/dist/components/LiteApprovalActionCard.svelte.d.ts +2 -0
- package/dist/components/LiteAutoComplete.svelte +41 -0
- package/dist/components/LiteAutoComplete.svelte.d.ts +13 -0
- package/dist/components/LiteBackTop.svelte +16 -0
- package/dist/components/LiteBackTop.svelte.d.ts +8 -0
- package/dist/components/LiteBreadcrumbs.svelte +4 -1
- package/dist/components/LiteBreadcrumbs.svelte.d.ts +2 -0
- package/dist/components/LiteCalendar.svelte +124 -0
- package/dist/components/LiteCalendar.svelte.d.ts +20 -0
- package/dist/components/LiteCarousel.svelte +72 -0
- package/dist/components/LiteCarousel.svelte.d.ts +14 -0
- package/dist/components/LiteCollapse.svelte +49 -0
- package/dist/components/LiteCollapse.svelte.d.ts +15 -0
- package/dist/components/LiteColumnHeaderFilter.svelte +4 -1
- package/dist/components/LiteColumnHeaderFilter.svelte.d.ts +2 -0
- package/dist/components/LiteColumnSettings.svelte +4 -1
- package/dist/components/LiteColumnSettings.svelte.d.ts +2 -0
- package/dist/components/LiteCommentThread.svelte +113 -0
- package/dist/components/LiteCommentThread.svelte.d.ts +26 -0
- package/dist/components/LiteCountdown.svelte +49 -0
- package/dist/components/LiteCountdown.svelte.d.ts +10 -0
- package/dist/components/LiteDetailDrawer.svelte +45 -0
- package/dist/components/LiteDetailDrawer.svelte.d.ts +14 -0
- package/dist/components/LiteDraggableRowTable.svelte +4 -1
- package/dist/components/LiteDraggableRowTable.svelte.d.ts +2 -0
- package/dist/components/LiteDrawerForm.svelte +4 -1
- package/dist/components/LiteDrawerForm.svelte.d.ts +2 -0
- package/dist/components/LiteEditableTable.svelte +4 -1
- package/dist/components/LiteEditableTable.svelte.d.ts +2 -0
- package/dist/components/LiteEmptyState.svelte +8 -1
- package/dist/components/LiteEmptyState.svelte.d.ts +3 -0
- package/dist/components/LiteFilterBuilder.svelte +4 -1
- package/dist/components/LiteFilterBuilder.svelte.d.ts +2 -0
- package/dist/components/LiteFloatButton.svelte +54 -0
- package/dist/components/LiteFloatButton.svelte.d.ts +15 -0
- package/dist/components/LiteGrid.svelte +34 -0
- package/dist/components/LiteGrid.svelte.d.ts +11 -0
- package/dist/components/LiteImage.svelte +54 -0
- package/dist/components/LiteImage.svelte.d.ts +14 -0
- package/dist/components/LiteImageCropper.svelte +4 -1
- package/dist/components/LiteImageCropper.svelte.d.ts +2 -0
- package/dist/components/LiteImagePreview.svelte +36 -0
- package/dist/components/LiteImagePreview.svelte.d.ts +13 -0
- package/dist/components/LiteItemList.svelte +50 -0
- package/dist/components/LiteItemList.svelte.d.ts +15 -0
- package/dist/components/LiteJsonSchemaForm.svelte +4 -1
- package/dist/components/LiteJsonSchemaForm.svelte.d.ts +2 -0
- package/dist/components/LiteLayout.svelte +16 -4
- package/dist/components/LiteLayout.svelte.d.ts +8 -0
- package/dist/components/LiteLink.svelte +32 -0
- package/dist/components/LiteLink.svelte.d.ts +11 -0
- package/dist/components/LiteLogin.svelte +9 -2
- package/dist/components/LiteLogin.svelte.d.ts +2 -0
- package/dist/components/LiteMasterDetailView.svelte +4 -1
- package/dist/components/LiteMasterDetailView.svelte.d.ts +2 -0
- package/dist/components/LiteMediaLibraryModal.svelte +4 -1
- package/dist/components/LiteMediaLibraryModal.svelte.d.ts +2 -0
- package/dist/components/LiteMenu.svelte +22 -0
- package/dist/components/LiteMenu.svelte.d.ts +12 -0
- package/dist/components/LiteMenuList.svelte +55 -0
- package/dist/components/LiteMenuList.svelte.d.ts +17 -0
- package/dist/components/LiteModalForm.svelte +4 -1
- package/dist/components/LiteModalForm.svelte.d.ts +2 -0
- package/dist/components/LiteNotificationCenter.svelte +85 -0
- package/dist/components/LiteNotificationCenter.svelte.d.ts +22 -0
- package/dist/components/LiteOtpInput.svelte +50 -0
- package/dist/components/LiteOtpInput.svelte.d.ts +15 -0
- package/dist/components/LitePageHeader.svelte +34 -0
- package/dist/components/LitePageHeader.svelte.d.ts +13 -0
- package/dist/components/LitePagination.svelte +10 -2
- package/dist/components/LitePagination.svelte.d.ts +2 -0
- package/dist/components/LitePopconfirm.svelte +49 -0
- package/dist/components/LitePopconfirm.svelte.d.ts +14 -0
- package/dist/components/LitePresenceAvatarGroup.svelte +4 -1
- package/dist/components/LitePresenceAvatarGroup.svelte.d.ts +2 -0
- package/dist/components/LitePrintableBill.svelte +4 -1
- package/dist/components/LitePrintableBill.svelte.d.ts +2 -0
- package/dist/components/LiteProgress.svelte +46 -0
- package/dist/components/LiteProgress.svelte.d.ts +12 -0
- package/dist/components/LiteQRCode.svelte +62 -0
- package/dist/components/LiteQRCode.svelte.d.ts +14 -0
- package/dist/components/LiteResizeBox.svelte +34 -0
- package/dist/components/LiteResizeBox.svelte.d.ts +12 -0
- package/dist/components/LiteResult.svelte +52 -0
- package/dist/components/LiteResult.svelte.d.ts +14 -0
- package/dist/components/LiteRowActions.svelte +36 -0
- package/dist/components/LiteRowActions.svelte.d.ts +17 -0
- package/dist/components/LiteSensitiveDataMask.svelte +4 -1
- package/dist/components/LiteSensitiveDataMask.svelte.d.ts +2 -0
- package/dist/components/LiteSkeleton.svelte +100 -0
- package/dist/components/LiteSkeleton.svelte.d.ts +19 -0
- package/dist/components/LiteSpace.svelte +31 -0
- package/dist/components/LiteSpace.svelte.d.ts +12 -0
- package/dist/components/LiteSpin.svelte +27 -0
- package/dist/components/LiteSpin.svelte.d.ts +10 -0
- package/dist/components/LiteSplitPaneLayout.svelte +16 -4
- package/dist/components/LiteSplitPaneLayout.svelte.d.ts +8 -0
- package/dist/components/LiteStatistic.svelte +63 -0
- package/dist/components/LiteStatistic.svelte.d.ts +15 -0
- package/dist/components/LiteStatsCard.svelte +5 -2
- package/dist/components/LiteStatsCard.svelte.d.ts +2 -0
- package/dist/components/LiteStatusBadge.svelte +33 -0
- package/dist/components/LiteStatusBadge.svelte.d.ts +12 -0
- package/dist/components/LiteStatusTabs.svelte +35 -0
- package/dist/components/LiteStatusTabs.svelte.d.ts +14 -0
- package/dist/components/LiteStepForm.svelte +4 -1
- package/dist/components/LiteStepForm.svelte.d.ts +2 -0
- package/dist/components/LiteSteps.svelte +64 -0
- package/dist/components/LiteSteps.svelte.d.ts +18 -0
- package/dist/components/LiteTable.svelte +4 -1
- package/dist/components/LiteTable.svelte.d.ts +2 -0
- package/dist/components/LiteTableSummary.svelte +4 -1
- package/dist/components/LiteTableSummary.svelte.d.ts +2 -0
- package/dist/components/LiteTabs.svelte +28 -18
- package/dist/components/LiteTabs.svelte.d.ts +11 -2
- package/dist/components/LiteTag.svelte +31 -0
- package/dist/components/LiteTag.svelte.d.ts +13 -0
- package/dist/components/LiteTimeline.svelte +48 -0
- package/dist/components/LiteTimeline.svelte.d.ts +17 -0
- package/dist/components/LiteTour.svelte +54 -0
- package/dist/components/LiteTour.svelte.d.ts +15 -0
- package/dist/components/LiteTransfer.svelte +4 -1
- package/dist/components/LiteTransfer.svelte.d.ts +2 -0
- package/dist/components/LiteTree.svelte +48 -0
- package/dist/components/LiteTree.svelte.d.ts +17 -0
- package/dist/components/LiteTwoFactorStepper.svelte +53 -0
- package/dist/components/LiteTwoFactorStepper.svelte.d.ts +16 -0
- package/dist/components/LiteVersionDiffViewer.svelte +4 -1
- package/dist/components/LiteVersionDiffViewer.svelte.d.ts +2 -0
- package/dist/components/LiteVideoPlayer.svelte +67 -0
- package/dist/components/LiteVideoPlayer.svelte.d.ts +22 -0
- package/dist/components/advanced/LiteAutoSaveIndicator.svelte +42 -13
- package/dist/components/advanced/LiteAutoSaveIndicator.svelte.d.ts +10 -4
- package/dist/components/advanced/LiteDrawerForm.svelte +4 -1
- package/dist/components/advanced/LiteDrawerForm.svelte.d.ts +2 -0
- package/dist/components/advanced/LiteModalForm.svelte +4 -1
- package/dist/components/advanced/LiteModalForm.svelte.d.ts +2 -0
- package/dist/components/compatibility/LiteRealtimeStatus.svelte +41 -2
- package/dist/components/compatibility/LiteRealtimeStatus.svelte.d.ts +15 -0
- package/dist/components/fields/LiteBooleanField.svelte +4 -2
- package/dist/components/fields/LiteBooleanField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteCascader.svelte +5 -2
- package/dist/components/fields/LiteCascader.svelte.d.ts +2 -0
- package/dist/components/fields/LiteDateField.svelte +39 -9
- package/dist/components/fields/LiteDateField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteImageField.svelte +6 -2
- package/dist/components/fields/LiteImageField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteMarkdownField.svelte +49 -3
- package/dist/components/fields/LiteMarkdownField.svelte.d.ts +5 -0
- package/dist/components/fields/LiteNumberField.svelte +5 -3
- package/dist/components/fields/LiteNumberField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteRichTextField.svelte +45 -8
- package/dist/components/fields/LiteRichTextField.svelte.d.ts +3 -0
- package/dist/components/fields/LiteSelectField.svelte +5 -3
- package/dist/components/fields/LiteSelectField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteTagField.svelte +38 -15
- package/dist/components/fields/LiteTagField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteTextField.svelte +26 -5
- package/dist/components/fields/LiteTextField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteTreeSelect.svelte +5 -2
- package/dist/components/fields/LiteTreeSelect.svelte.d.ts +2 -0
- package/dist/components/fields/LiteUrlField.svelte +5 -3
- package/dist/components/fields/LiteUrlField.svelte.d.ts +2 -0
- package/dist/components/layout/LiteSidebar.svelte +4 -1
- package/dist/components/layout/LiteSidebar.svelte.d.ts +2 -0
- package/dist/components/pages/LiteCreatePage.svelte +4 -1
- package/dist/components/pages/LiteCreatePage.svelte.d.ts +2 -0
- package/dist/components/pages/LiteEditPage.svelte +4 -1
- package/dist/components/pages/LiteEditPage.svelte.d.ts +2 -0
- package/dist/components/pages/LiteListPage.svelte +4 -1
- package/dist/components/pages/LiteListPage.svelte.d.ts +2 -0
- package/dist/components/pages/LiteShowPage.svelte +4 -1
- package/dist/components/pages/LiteShowPage.svelte.d.ts +2 -0
- package/dist/components/widgets/LiteAnomalyBadge.svelte +5 -2
- package/dist/components/widgets/LiteAnomalyBadge.svelte.d.ts +2 -0
- package/dist/components/widgets/LiteAreaChart.svelte +20 -0
- package/dist/components/widgets/LiteAreaChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteChartSvg.svelte +102 -0
- package/dist/components/widgets/LiteChartSvg.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteChartTable.svelte +44 -0
- package/dist/components/widgets/LiteChartTable.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteDonutChart.svelte +20 -0
- package/dist/components/widgets/LiteDonutChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteFunnelChart.svelte +20 -0
- package/dist/components/widgets/LiteFunnelChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteGaugeChart.svelte +20 -0
- package/dist/components/widgets/LiteGaugeChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteHeatmapChart.svelte +20 -0
- package/dist/components/widgets/LiteHeatmapChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteInsightCard.svelte +34 -12
- package/dist/components/widgets/LiteInsightCard.svelte.d.ts +7 -4
- package/dist/components/widgets/LiteLineChart.svelte +6 -3
- package/dist/components/widgets/LiteLineChart.svelte.d.ts +0 -5
- package/dist/components/widgets/LitePieChart.svelte +5 -3
- package/dist/components/widgets/LitePieChart.svelte.d.ts +0 -5
- package/dist/components/widgets/LiteRadarChart.svelte +20 -0
- package/dist/components/widgets/LiteRadarChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteRoseChart.svelte +20 -0
- package/dist/components/widgets/LiteRoseChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteScatterChart.svelte +20 -0
- package/dist/components/widgets/LiteScatterChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteWaterfallChart.svelte +20 -0
- package/dist/components/widgets/LiteWaterfallChart.svelte.d.ts +10 -0
- package/dist/components/widgets/chart-geometry.d.ts +65 -0
- package/dist/components/widgets/chart-geometry.js +229 -0
- package/dist/components/widgets/index.d.ts +10 -0
- package/dist/components/widgets/index.js +10 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +47 -0
- package/dist/lite-code-theme.css +139 -0
- package/dist/lite.css +108 -1
- package/dist/rich-content.d.ts +47 -0
- package/dist/rich-content.js +498 -0
- package/dist/schema-generator.js +3 -1
- package/dist/server-adapter.js +6 -11
- package/dist/value-normalization.d.ts +4 -0
- package/dist/value-normalization.js +13 -0
- package/package.json +18 -4
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-side chart geometry.
|
|
3
|
+
*
|
|
4
|
+
* Every helper is pure and DOM-free so the same numbers render inside SSR HTML
|
|
5
|
+
* and inside tests. Inputs are the normalized table rows that the Lite chart
|
|
6
|
+
* widgets already accept: `[label, value]` pairs where the value may be a
|
|
7
|
+
* numeric string.
|
|
8
|
+
*/
|
|
9
|
+
export interface Basket {
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
padding: number;
|
|
13
|
+
}
|
|
14
|
+
export interface Point {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
}
|
|
18
|
+
export interface Slice {
|
|
19
|
+
path: string;
|
|
20
|
+
}
|
|
21
|
+
export interface Rect {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
}
|
|
27
|
+
export interface Cell extends Rect {
|
|
28
|
+
opacity: number;
|
|
29
|
+
}
|
|
30
|
+
/** Numeric series extracted from table rows; unparsable or non-finite values become 0. */
|
|
31
|
+
export declare function series(rows: ReadonlyArray<ReadonlyArray<string | number>>): number[];
|
|
32
|
+
export declare function labels(rows: ReadonlyArray<ReadonlyArray<string | number>>): string[];
|
|
33
|
+
/** Cartesian plot points scaled into the basket, `x` spread across the series. */
|
|
34
|
+
export declare function points(values: readonly number[], basket?: Basket): Point[];
|
|
35
|
+
export declare function polyline(values: readonly number[], basket?: Basket): string;
|
|
36
|
+
/** Closed area path that fills the space between the series and the baseline. */
|
|
37
|
+
export declare function areaPath(values: readonly number[], basket?: Basket): string;
|
|
38
|
+
export declare function pieSlices(values: readonly number[], basket?: Basket): Slice[];
|
|
39
|
+
export declare function donutSlices(values: readonly number[], basket?: Basket): Slice[];
|
|
40
|
+
/**
|
|
41
|
+
* Rose chart: every value becomes a wedge whose radius encodes magnitude, so
|
|
42
|
+
* proportional area is intentionally not preserved (that is the point of a rose).
|
|
43
|
+
*/
|
|
44
|
+
export declare function roseSlices(values: readonly number[], basket?: Basket): Slice[];
|
|
45
|
+
/** Radar polygon plus its axes, using one axis per data point. */
|
|
46
|
+
export declare function radarPolygon(values: readonly number[], basket?: Basket): {
|
|
47
|
+
polygon: string;
|
|
48
|
+
axes: string[];
|
|
49
|
+
};
|
|
50
|
+
/** Gauge drawn as a filled arc from 0 to `value / max`. */
|
|
51
|
+
export declare function gaugeArc(value: number, max?: number, basket?: Basket): {
|
|
52
|
+
track: string;
|
|
53
|
+
value: string;
|
|
54
|
+
percent: number;
|
|
55
|
+
};
|
|
56
|
+
export declare function funnelRects(values: readonly number[], basket?: Basket): Rect[];
|
|
57
|
+
/** Waterfall bars accumulate deltas and color rising versus falling steps. */
|
|
58
|
+
export declare function waterfallBars(values: readonly number[], basket?: Basket): Array<Rect & {
|
|
59
|
+
positive: boolean;
|
|
60
|
+
}>;
|
|
61
|
+
/** Heatmap cells laid out in a grid; opacity encodes magnitude. */
|
|
62
|
+
export declare function heatCells(values: readonly number[], basket?: Basket, columns?: number): Cell[];
|
|
63
|
+
export declare function scatterPoints(values: readonly number[], basket?: Basket): Point[];
|
|
64
|
+
/** Every widget shares one empty-data predicate so SSR output stays predictable. */
|
|
65
|
+
export declare function hasData(rows: ReadonlyArray<ReadonlyArray<string | number>>): boolean;
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-side chart geometry.
|
|
3
|
+
*
|
|
4
|
+
* Every helper is pure and DOM-free so the same numbers render inside SSR HTML
|
|
5
|
+
* and inside tests. Inputs are the normalized table rows that the Lite chart
|
|
6
|
+
* widgets already accept: `[label, value]` pairs where the value may be a
|
|
7
|
+
* numeric string.
|
|
8
|
+
*/
|
|
9
|
+
const DEFAULT_BASKET = { width: 320, height: 160, padding: 12 };
|
|
10
|
+
/** Numeric series extracted from table rows; unparsable or non-finite values become 0. */
|
|
11
|
+
export function series(rows) {
|
|
12
|
+
return rows.map((row) => {
|
|
13
|
+
const raw = row[1];
|
|
14
|
+
const value = typeof raw === 'number' ? raw : Number.parseFloat(String(raw ?? ''));
|
|
15
|
+
return Number.isFinite(value) ? value : 0;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export function labels(rows) {
|
|
19
|
+
return rows.map((row) => String(row[0] ?? ''));
|
|
20
|
+
}
|
|
21
|
+
function extent(values) {
|
|
22
|
+
if (values.length === 0)
|
|
23
|
+
return { min: 0, max: 1 };
|
|
24
|
+
const min = Math.min(...values);
|
|
25
|
+
const max = Math.max(...values);
|
|
26
|
+
return { min, max: min === max ? min + 1 : max };
|
|
27
|
+
}
|
|
28
|
+
function round(value) {
|
|
29
|
+
return Math.round(value * 100) / 100;
|
|
30
|
+
}
|
|
31
|
+
/** Cartesian plot points scaled into the basket, `x` spread across the series. */
|
|
32
|
+
export function points(values, basket = DEFAULT_BASKET) {
|
|
33
|
+
const { width, height, padding } = basket;
|
|
34
|
+
const { min, max } = extent(values);
|
|
35
|
+
const innerWidth = width - padding * 2;
|
|
36
|
+
const innerHeight = height - padding * 2;
|
|
37
|
+
const step = values.length > 1 ? innerWidth / (values.length - 1) : 0;
|
|
38
|
+
return values.map((value, index) => ({
|
|
39
|
+
x: round(padding + step * index + (values.length === 1 ? innerWidth / 2 : 0)),
|
|
40
|
+
y: round(padding + innerHeight - ((value - min) / (max - min)) * innerHeight),
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
export function polyline(values, basket) {
|
|
44
|
+
return points(values, basket)
|
|
45
|
+
.map((point) => `${point.x},${point.y}`)
|
|
46
|
+
.join(' ');
|
|
47
|
+
}
|
|
48
|
+
/** Closed area path that fills the space between the series and the baseline. */
|
|
49
|
+
export function areaPath(values, basket = DEFAULT_BASKET) {
|
|
50
|
+
const plotted = points(values, basket);
|
|
51
|
+
if (plotted.length === 0)
|
|
52
|
+
return '';
|
|
53
|
+
const baseline = basket.height - basket.padding;
|
|
54
|
+
const first = plotted[0];
|
|
55
|
+
const last = plotted[plotted.length - 1];
|
|
56
|
+
if (!first || !last)
|
|
57
|
+
return '';
|
|
58
|
+
const line = plotted.map((point, index) => `${index === 0 ? 'M' : 'L'}${point.x} ${point.y}`).join(' ');
|
|
59
|
+
return `${line} L${last.x} ${baseline} L${first.x} ${baseline} Z`;
|
|
60
|
+
}
|
|
61
|
+
function circlePoint(cx, cy, radius, angle) {
|
|
62
|
+
return { x: round(cx + radius * Math.cos(angle)), y: round(cy + radius * Math.sin(angle)) };
|
|
63
|
+
}
|
|
64
|
+
function ringSegment(values, cx, cy, outer, inner) {
|
|
65
|
+
const total = values.reduce((sum, value) => sum + Math.max(0, value), 0);
|
|
66
|
+
if (total <= 0)
|
|
67
|
+
return [];
|
|
68
|
+
let start = -Math.PI / 2;
|
|
69
|
+
return values.map((value) => {
|
|
70
|
+
const sweep = (Math.max(0, value) / total) * Math.PI * 2;
|
|
71
|
+
const end = start + sweep;
|
|
72
|
+
const largeArc = sweep > Math.PI ? 1 : 0;
|
|
73
|
+
const outerStart = circlePoint(cx, cy, outer, start);
|
|
74
|
+
const outerEnd = circlePoint(cx, cy, outer, end);
|
|
75
|
+
const innerEnd = circlePoint(cx, cy, inner, end);
|
|
76
|
+
const innerStart = circlePoint(cx, cy, inner, start);
|
|
77
|
+
const path = `M${outerStart.x} ${outerStart.y} ` +
|
|
78
|
+
`A${outer} ${outer} 0 ${largeArc} 1 ${outerEnd.x} ${outerEnd.y} ` +
|
|
79
|
+
`L${innerEnd.x} ${innerEnd.y} ` +
|
|
80
|
+
`A${inner} ${inner} 0 ${largeArc} 0 ${innerStart.x} ${innerStart.y} Z`;
|
|
81
|
+
start = end;
|
|
82
|
+
return { path };
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
export function pieSlices(values, basket = DEFAULT_BASKET) {
|
|
86
|
+
const cx = basket.width / 2;
|
|
87
|
+
const cy = basket.height / 2;
|
|
88
|
+
return ringSegment(values, cx, cy, Math.min(cx, cy) - basket.padding, 0);
|
|
89
|
+
}
|
|
90
|
+
export function donutSlices(values, basket = DEFAULT_BASKET) {
|
|
91
|
+
const cx = basket.width / 2;
|
|
92
|
+
const cy = basket.height / 2;
|
|
93
|
+
const outer = Math.min(cx, cy) - basket.padding;
|
|
94
|
+
return ringSegment(values, cx, cy, outer, outer * 0.55);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Rose chart: every value becomes a wedge whose radius encodes magnitude, so
|
|
98
|
+
* proportional area is intentionally not preserved (that is the point of a rose).
|
|
99
|
+
*/
|
|
100
|
+
export function roseSlices(values, basket = DEFAULT_BASKET) {
|
|
101
|
+
const cx = basket.width / 2;
|
|
102
|
+
const cy = basket.height / 2;
|
|
103
|
+
const outer = Math.min(cx, cy) - basket.padding;
|
|
104
|
+
const { max } = extent(values.map((value) => Math.max(0, value)));
|
|
105
|
+
const count = Math.max(1, values.length);
|
|
106
|
+
const step = (Math.PI * 2) / count;
|
|
107
|
+
const gap = step * 0.08;
|
|
108
|
+
return values.map((value, index) => {
|
|
109
|
+
const radius = Math.max(6, (Math.max(0, value) / max) * outer);
|
|
110
|
+
const start = -Math.PI / 2 + index * step + gap;
|
|
111
|
+
const end = start + step - gap * 2;
|
|
112
|
+
const from = circlePoint(cx, cy, 0, start);
|
|
113
|
+
const to = circlePoint(cx, cy, radius, start);
|
|
114
|
+
const across = circlePoint(cx, cy, radius, end);
|
|
115
|
+
const largeArc = end - start > Math.PI ? 1 : 0;
|
|
116
|
+
return { path: `M${from.x} ${from.y} L${to.x} ${to.y} A${radius} ${radius} 0 ${largeArc} 1 ${across.x} ${across.y} Z` };
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/** Radar polygon plus its axes, using one axis per data point. */
|
|
120
|
+
export function radarPolygon(values, basket = DEFAULT_BASKET) {
|
|
121
|
+
const cx = basket.width / 2;
|
|
122
|
+
const cy = basket.height / 2;
|
|
123
|
+
const radius = Math.min(cx, cy) - basket.padding;
|
|
124
|
+
const { max } = extent(values.map((value) => Math.max(0, value)));
|
|
125
|
+
const count = Math.max(3, values.length);
|
|
126
|
+
const step = (Math.PI * 2) / count;
|
|
127
|
+
const axes = [];
|
|
128
|
+
const shape = [];
|
|
129
|
+
for (let index = 0; index < count; index += 1) {
|
|
130
|
+
const angle = -Math.PI / 2 + index * step;
|
|
131
|
+
const outer = circlePoint(cx, cy, radius, angle);
|
|
132
|
+
axes.push(`${cx},${cy} ${outer.x},${outer.y}`);
|
|
133
|
+
const raw = values[index] ?? 0;
|
|
134
|
+
const scaled = circlePoint(cx, cy, (Math.max(0, raw) / max) * radius, angle);
|
|
135
|
+
shape.push(`${scaled.x},${scaled.y}`);
|
|
136
|
+
}
|
|
137
|
+
return { polygon: shape.join(' '), axes };
|
|
138
|
+
}
|
|
139
|
+
/** Gauge drawn as a filled arc from 0 to `value / max`. */
|
|
140
|
+
export function gaugeArc(value, max = 100, basket = DEFAULT_BASKET) {
|
|
141
|
+
const cx = basket.width / 2;
|
|
142
|
+
const cy = basket.height - basket.padding;
|
|
143
|
+
const radius = Math.min(cx, cy) - basket.padding;
|
|
144
|
+
const safeMax = max > 0 ? max : 100;
|
|
145
|
+
const ratio = Math.min(1, Math.max(0, value / safeMax));
|
|
146
|
+
const degree = Math.PI * ratio;
|
|
147
|
+
const start = circlePoint(cx, cy, radius, Math.PI);
|
|
148
|
+
const end = circlePoint(cx, cy, radius, Math.PI + degree);
|
|
149
|
+
const full = circlePoint(cx, cy, radius, Math.PI * 2);
|
|
150
|
+
return {
|
|
151
|
+
track: `M${start.x} ${start.y} A${radius} ${radius} 0 0 1 ${full.x} ${full.y}`,
|
|
152
|
+
value: `M${start.x} ${start.y} A${radius} ${radius} 0 ${degree > Math.PI ? 1 : 0} 1 ${end.x} ${end.y}`,
|
|
153
|
+
percent: Math.round(ratio * 100),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
export function funnelRects(values, basket = DEFAULT_BASKET) {
|
|
157
|
+
const { width, height, padding } = basket;
|
|
158
|
+
const { max } = extent(values.map((value) => Math.max(0, value)));
|
|
159
|
+
const count = Math.max(1, values.length);
|
|
160
|
+
const gap = 4;
|
|
161
|
+
const step = (height - padding * 2 - gap * (count - 1)) / count;
|
|
162
|
+
const innerWidth = width - padding * 2;
|
|
163
|
+
return values.map((value, index) => {
|
|
164
|
+
const ratio = Math.max(0, value) / max;
|
|
165
|
+
const barWidth = Math.max(4, innerWidth * ratio);
|
|
166
|
+
return {
|
|
167
|
+
x: round(padding + (innerWidth - barWidth) / 2),
|
|
168
|
+
y: round(padding + index * (step + gap)),
|
|
169
|
+
width: round(barWidth),
|
|
170
|
+
height: round(step),
|
|
171
|
+
};
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
/** Waterfall bars accumulate deltas and color rising versus falling steps. */
|
|
175
|
+
export function waterfallBars(values, basket = DEFAULT_BASKET) {
|
|
176
|
+
const { width, height, padding } = basket;
|
|
177
|
+
const count = Math.max(1, values.length);
|
|
178
|
+
const innerWidth = width - padding * 2;
|
|
179
|
+
const innerHeight = height - padding * 2;
|
|
180
|
+
let running = 0;
|
|
181
|
+
const cumulative = values.map((value) => {
|
|
182
|
+
const start = running;
|
|
183
|
+
running += value;
|
|
184
|
+
return { start, end: running };
|
|
185
|
+
});
|
|
186
|
+
const extentValues = cumulative.flatMap((step) => [step.start, step.end, 0]);
|
|
187
|
+
const { min, max } = extent(extentValues);
|
|
188
|
+
const gap = 3;
|
|
189
|
+
const barWidth = Math.max(2, (innerWidth - gap * (count - 1)) / count);
|
|
190
|
+
return values.map((value, index) => {
|
|
191
|
+
const step = cumulative[index] ?? { start: 0, end: 0 };
|
|
192
|
+
const top = Math.max(step.start, step.end);
|
|
193
|
+
const bottom = Math.min(step.start, step.end);
|
|
194
|
+
const yTop = padding + innerHeight - ((top - min) / (max - min)) * innerHeight;
|
|
195
|
+
const yBottom = padding + innerHeight - ((bottom - min) / (max - min)) * innerHeight;
|
|
196
|
+
return {
|
|
197
|
+
x: round(padding + index * (barWidth + gap)),
|
|
198
|
+
y: round(yTop),
|
|
199
|
+
width: round(barWidth),
|
|
200
|
+
height: round(Math.max(1, yBottom - yTop)),
|
|
201
|
+
positive: value >= 0,
|
|
202
|
+
};
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
/** Heatmap cells laid out in a grid; opacity encodes magnitude. */
|
|
206
|
+
export function heatCells(values, basket = DEFAULT_BASKET, columns = 0) {
|
|
207
|
+
const { width, height, padding } = basket;
|
|
208
|
+
const count = Math.max(1, values.length);
|
|
209
|
+
const cols = columns > 0 ? columns : Math.ceil(Math.sqrt(count));
|
|
210
|
+
const rows = Math.ceil(count / cols);
|
|
211
|
+
const gap = 2;
|
|
212
|
+
const cellWidth = (width - padding * 2 - gap * (cols - 1)) / cols;
|
|
213
|
+
const cellHeight = (height - padding * 2 - gap * (rows - 1)) / rows;
|
|
214
|
+
const { max } = extent(values.map((value) => Math.max(0, value)));
|
|
215
|
+
return values.map((value, index) => ({
|
|
216
|
+
x: round(padding + (index % cols) * (cellWidth + gap)),
|
|
217
|
+
y: round(padding + Math.floor(index / cols) * (cellHeight + gap)),
|
|
218
|
+
width: round(cellWidth),
|
|
219
|
+
height: round(cellHeight),
|
|
220
|
+
opacity: round(Math.max(0.12, Math.max(0, value) / max)),
|
|
221
|
+
}));
|
|
222
|
+
}
|
|
223
|
+
export function scatterPoints(values, basket) {
|
|
224
|
+
return points(values, basket);
|
|
225
|
+
}
|
|
226
|
+
/** Every widget shares one empty-data predicate so SSR output stays predictable. */
|
|
227
|
+
export function hasData(rows) {
|
|
228
|
+
return rows.length > 0;
|
|
229
|
+
}
|
|
@@ -3,3 +3,13 @@ export { default as LiteAnomalyBadge } from './LiteAnomalyBadge.svelte';
|
|
|
3
3
|
export { default as LiteBarChart } from './LiteBarChart.svelte';
|
|
4
4
|
export { default as LiteLineChart } from './LiteLineChart.svelte';
|
|
5
5
|
export { default as LitePieChart } from './LitePieChart.svelte';
|
|
6
|
+
export { default as LiteAreaChart } from './LiteAreaChart.svelte';
|
|
7
|
+
export { default as LiteScatterChart } from './LiteScatterChart.svelte';
|
|
8
|
+
export { default as LiteRadarChart } from './LiteRadarChart.svelte';
|
|
9
|
+
export { default as LiteGaugeChart } from './LiteGaugeChart.svelte';
|
|
10
|
+
export { default as LiteFunnelChart } from './LiteFunnelChart.svelte';
|
|
11
|
+
export { default as LiteHeatmapChart } from './LiteHeatmapChart.svelte';
|
|
12
|
+
export { default as LiteWaterfallChart } from './LiteWaterfallChart.svelte';
|
|
13
|
+
export { default as LiteRoseChart } from './LiteRoseChart.svelte';
|
|
14
|
+
export { default as LiteDonutChart } from './LiteDonutChart.svelte';
|
|
15
|
+
export { default as LiteChartTable } from './LiteChartTable.svelte';
|
|
@@ -3,3 +3,13 @@ export { default as LiteAnomalyBadge } from './LiteAnomalyBadge.svelte';
|
|
|
3
3
|
export { default as LiteBarChart } from './LiteBarChart.svelte';
|
|
4
4
|
export { default as LiteLineChart } from './LiteLineChart.svelte';
|
|
5
5
|
export { default as LitePieChart } from './LitePieChart.svelte';
|
|
6
|
+
export { default as LiteAreaChart } from './LiteAreaChart.svelte';
|
|
7
|
+
export { default as LiteScatterChart } from './LiteScatterChart.svelte';
|
|
8
|
+
export { default as LiteRadarChart } from './LiteRadarChart.svelte';
|
|
9
|
+
export { default as LiteGaugeChart } from './LiteGaugeChart.svelte';
|
|
10
|
+
export { default as LiteFunnelChart } from './LiteFunnelChart.svelte';
|
|
11
|
+
export { default as LiteHeatmapChart } from './LiteHeatmapChart.svelte';
|
|
12
|
+
export { default as LiteWaterfallChart } from './LiteWaterfallChart.svelte';
|
|
13
|
+
export { default as LiteRoseChart } from './LiteRoseChart.svelte';
|
|
14
|
+
export { default as LiteDonutChart } from './LiteDonutChart.svelte';
|
|
15
|
+
export { default as LiteChartTable } from './LiteChartTable.svelte';
|
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export { default as LiteMetricStrip } from './components/LiteMetricStrip.svelte'
|
|
|
30
30
|
export type { LiteMetricStripItem, LiteMetricTone, LiteMetricBadgeTone, } from './components/LiteMetricStrip.svelte';
|
|
31
31
|
export { default as LiteBadge } from './components/LiteBadge.svelte';
|
|
32
32
|
export type { LiteBadgeVariant } from './components/LiteBadge.svelte';
|
|
33
|
+
export { default as LiteTag } from './components/LiteTag.svelte';
|
|
33
34
|
export { default as LiteConfirmDialog } from './components/LiteConfirmDialog.svelte';
|
|
34
35
|
export { default as LiteEmptyState } from './components/LiteEmptyState.svelte';
|
|
35
36
|
export { default as LiteTabs } from './components/LiteTabs.svelte';
|
|
@@ -73,6 +74,45 @@ export { default as LitePdfDocumentViewer } from './components/LitePdfDocumentVi
|
|
|
73
74
|
export { default as LiteSpreadsheetView } from './components/LiteSpreadsheetView.svelte';
|
|
74
75
|
export { default as LiteDecisionTable } from './components/LiteDecisionTable.svelte';
|
|
75
76
|
export { default as LiteOfflineSyncBanner } from './components/LiteOfflineSyncBanner.svelte';
|
|
77
|
+
export { default as LiteImage } from './components/LiteImage.svelte';
|
|
78
|
+
export { default as LiteImagePreview } from './components/LiteImagePreview.svelte';
|
|
79
|
+
export { default as LiteVideoPlayer } from './components/LiteVideoPlayer.svelte';
|
|
80
|
+
export { default as LiteCalendar } from './components/LiteCalendar.svelte';
|
|
81
|
+
export { default as LiteCarousel } from './components/LiteCarousel.svelte';
|
|
82
|
+
export { default as LiteAnchor } from './components/LiteAnchor.svelte';
|
|
83
|
+
export { default as LiteAffix } from './components/LiteAffix.svelte';
|
|
84
|
+
export { default as LiteCollapse } from './components/LiteCollapse.svelte';
|
|
85
|
+
export { default as LiteCommentThread } from './components/LiteCommentThread.svelte';
|
|
86
|
+
export { default as LiteFloatButton } from './components/LiteFloatButton.svelte';
|
|
87
|
+
export { default as LiteSteps } from './components/LiteSteps.svelte';
|
|
88
|
+
export { default as LiteTimeline } from './components/LiteTimeline.svelte';
|
|
89
|
+
export { default as LiteStatistic } from './components/LiteStatistic.svelte';
|
|
90
|
+
export { default as LiteCountdown } from './components/LiteCountdown.svelte';
|
|
91
|
+
export { default as LiteTour } from './components/LiteTour.svelte';
|
|
92
|
+
export { default as LiteMenu } from './components/LiteMenu.svelte';
|
|
93
|
+
export { default as LiteSpace } from './components/LiteSpace.svelte';
|
|
94
|
+
export { default as LiteGrid } from './components/LiteGrid.svelte';
|
|
95
|
+
export { default as LiteLink } from './components/LiteLink.svelte';
|
|
96
|
+
export { default as LitePageHeader } from './components/LitePageHeader.svelte';
|
|
97
|
+
export { default as LiteStatusBadge } from './components/LiteStatusBadge.svelte';
|
|
98
|
+
export { default as LiteStatusTabs } from './components/LiteStatusTabs.svelte';
|
|
99
|
+
export { default as LiteNotificationCenter } from './components/LiteNotificationCenter.svelte';
|
|
100
|
+
export { default as LiteOtpInput } from './components/LiteOtpInput.svelte';
|
|
101
|
+
export { default as LiteTwoFactorStepper } from './components/LiteTwoFactorStepper.svelte';
|
|
102
|
+
export { default as LitePopconfirm } from './components/LitePopconfirm.svelte';
|
|
103
|
+
export { default as LiteDetailDrawer } from './components/LiteDetailDrawer.svelte';
|
|
104
|
+
export { default as LiteRowActions } from './components/LiteRowActions.svelte';
|
|
105
|
+
export { default as LiteItemList } from './components/LiteItemList.svelte';
|
|
106
|
+
export { default as LiteBackTop } from './components/LiteBackTop.svelte';
|
|
107
|
+
export { default as LiteResizeBox } from './components/LiteResizeBox.svelte';
|
|
108
|
+
export { default as LiteAutoComplete } from './components/LiteAutoComplete.svelte';
|
|
109
|
+
export { default as LiteResult } from './components/LiteResult.svelte';
|
|
110
|
+
export { default as LiteSkeleton } from './components/LiteSkeleton.svelte';
|
|
111
|
+
export { default as LiteSpin } from './components/LiteSpin.svelte';
|
|
112
|
+
export { default as LiteProgress } from './components/LiteProgress.svelte';
|
|
113
|
+
export { default as LiteTree } from './components/LiteTree.svelte';
|
|
114
|
+
export { configureMarkdownRenderer, escapeHtml, renderInlineMarkdown, renderMarkdown, renderRichContent, sanitizeRichTextHtml, } from './rich-content';
|
|
115
|
+
export type { MarkdownRenderOptions } from './rich-content';
|
|
76
116
|
export * from './components/compatibility/index';
|
|
77
117
|
export * from './components/buttons/index';
|
|
78
118
|
export * from './components/fields/index';
|
package/dist/index.js
CHANGED
|
@@ -29,6 +29,7 @@ export { default as LiteBreadcrumbs } from './components/LiteBreadcrumbs.svelte'
|
|
|
29
29
|
export { default as LiteStatsCard } from './components/LiteStatsCard.svelte';
|
|
30
30
|
export { default as LiteMetricStrip } from './components/LiteMetricStrip.svelte';
|
|
31
31
|
export { default as LiteBadge } from './components/LiteBadge.svelte';
|
|
32
|
+
export { default as LiteTag } from './components/LiteTag.svelte';
|
|
32
33
|
export { default as LiteConfirmDialog } from './components/LiteConfirmDialog.svelte';
|
|
33
34
|
export { default as LiteEmptyState } from './components/LiteEmptyState.svelte';
|
|
34
35
|
export { default as LiteTabs } from './components/LiteTabs.svelte';
|
|
@@ -70,6 +71,52 @@ export { default as LitePdfDocumentViewer } from './components/LitePdfDocumentVi
|
|
|
70
71
|
export { default as LiteSpreadsheetView } from './components/LiteSpreadsheetView.svelte';
|
|
71
72
|
export { default as LiteDecisionTable } from './components/LiteDecisionTable.svelte';
|
|
72
73
|
export { default as LiteOfflineSyncBanner } from './components/LiteOfflineSyncBanner.svelte';
|
|
74
|
+
// Media, navigation and feedback primitives added to keep Lite aligned with
|
|
75
|
+
// the modern @svadmin/ui surface. These render static SSR HTML and never
|
|
76
|
+
// require hydration.
|
|
77
|
+
export { default as LiteImage } from './components/LiteImage.svelte';
|
|
78
|
+
export { default as LiteImagePreview } from './components/LiteImagePreview.svelte';
|
|
79
|
+
export { default as LiteVideoPlayer } from './components/LiteVideoPlayer.svelte';
|
|
80
|
+
// LiteQRCode is an opt-in subpath export because it statically imports the
|
|
81
|
+
// optional `qrcode` peer. Keeping it out of the root entry lets a consumer
|
|
82
|
+
// import '@svadmin/lite' without installing that peer:
|
|
83
|
+
// import LiteQRCode from '@svadmin/lite/components/LiteQRCode.svelte';
|
|
84
|
+
export { default as LiteCalendar } from './components/LiteCalendar.svelte';
|
|
85
|
+
export { default as LiteCarousel } from './components/LiteCarousel.svelte';
|
|
86
|
+
export { default as LiteAnchor } from './components/LiteAnchor.svelte';
|
|
87
|
+
export { default as LiteAffix } from './components/LiteAffix.svelte';
|
|
88
|
+
export { default as LiteCollapse } from './components/LiteCollapse.svelte';
|
|
89
|
+
export { default as LiteCommentThread } from './components/LiteCommentThread.svelte';
|
|
90
|
+
export { default as LiteFloatButton } from './components/LiteFloatButton.svelte';
|
|
91
|
+
export { default as LiteSteps } from './components/LiteSteps.svelte';
|
|
92
|
+
export { default as LiteTimeline } from './components/LiteTimeline.svelte';
|
|
93
|
+
export { default as LiteStatistic } from './components/LiteStatistic.svelte';
|
|
94
|
+
export { default as LiteCountdown } from './components/LiteCountdown.svelte';
|
|
95
|
+
export { default as LiteTour } from './components/LiteTour.svelte';
|
|
96
|
+
export { default as LiteMenu } from './components/LiteMenu.svelte';
|
|
97
|
+
export { default as LiteSpace } from './components/LiteSpace.svelte';
|
|
98
|
+
export { default as LiteGrid } from './components/LiteGrid.svelte';
|
|
99
|
+
export { default as LiteLink } from './components/LiteLink.svelte';
|
|
100
|
+
export { default as LitePageHeader } from './components/LitePageHeader.svelte';
|
|
101
|
+
export { default as LiteStatusBadge } from './components/LiteStatusBadge.svelte';
|
|
102
|
+
export { default as LiteStatusTabs } from './components/LiteStatusTabs.svelte';
|
|
103
|
+
export { default as LiteNotificationCenter } from './components/LiteNotificationCenter.svelte';
|
|
104
|
+
export { default as LiteOtpInput } from './components/LiteOtpInput.svelte';
|
|
105
|
+
export { default as LiteTwoFactorStepper } from './components/LiteTwoFactorStepper.svelte';
|
|
106
|
+
export { default as LitePopconfirm } from './components/LitePopconfirm.svelte';
|
|
107
|
+
export { default as LiteDetailDrawer } from './components/LiteDetailDrawer.svelte';
|
|
108
|
+
export { default as LiteRowActions } from './components/LiteRowActions.svelte';
|
|
109
|
+
export { default as LiteItemList } from './components/LiteItemList.svelte';
|
|
110
|
+
export { default as LiteBackTop } from './components/LiteBackTop.svelte';
|
|
111
|
+
export { default as LiteResizeBox } from './components/LiteResizeBox.svelte';
|
|
112
|
+
export { default as LiteAutoComplete } from './components/LiteAutoComplete.svelte';
|
|
113
|
+
export { default as LiteResult } from './components/LiteResult.svelte';
|
|
114
|
+
export { default as LiteSkeleton } from './components/LiteSkeleton.svelte';
|
|
115
|
+
export { default as LiteSpin } from './components/LiteSpin.svelte';
|
|
116
|
+
export { default as LiteProgress } from './components/LiteProgress.svelte';
|
|
117
|
+
export { default as LiteTree } from './components/LiteTree.svelte';
|
|
118
|
+
// Rich content rendering (SSR-safe Markdown + rich HTML allowlist)
|
|
119
|
+
export { configureMarkdownRenderer, escapeHtml, renderInlineMarkdown, renderMarkdown, renderRichContent, sanitizeRichTextHtml, } from './rich-content';
|
|
73
120
|
// Compatibility fallbacks for browser-only and third-party UI capabilities.
|
|
74
121
|
export * from './components/compatibility/index';
|
|
75
122
|
// Action Buttons
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opt-in code token theme for @svadmin/lite.
|
|
3
|
+
*
|
|
4
|
+
* `lite.css` ships IE11-safe literal token colours. Import this stylesheet
|
|
5
|
+
* instead (or after it) when the target baseline supports CSS custom
|
|
6
|
+
* properties, then override the variables per container to re-theme every
|
|
7
|
+
* Markdown / rich text / insight / comment / notification surface at once:
|
|
8
|
+
*
|
|
9
|
+
* .lite-code-block { --lite-token-keyword: #7FD1FF; }
|
|
10
|
+
*
|
|
11
|
+
* Variables fall back to the same palette that `lite.css` hardcodes, so the
|
|
12
|
+
* stylesheet is safe to import on its own.
|
|
13
|
+
*/
|
|
14
|
+
.lite-markdown-preview,
|
|
15
|
+
.lite-rich-preview,
|
|
16
|
+
.lite-insight-content,
|
|
17
|
+
.lite-comments__rich,
|
|
18
|
+
.lite-notification-center__rich,
|
|
19
|
+
.lite-activity-rich {
|
|
20
|
+
--lite-token-comment: #86909C;
|
|
21
|
+
--lite-token-keyword: #165DFF;
|
|
22
|
+
--lite-token-string: #007A5A;
|
|
23
|
+
--lite-token-number: #C2410C;
|
|
24
|
+
--lite-token-function: #7A3EA8;
|
|
25
|
+
--lite-token-type: #0E7490;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.lite-markdown-preview .tok-comment,
|
|
29
|
+
.lite-rich-preview .tok-comment,
|
|
30
|
+
.lite-insight-content .tok-comment,
|
|
31
|
+
.lite-comments__rich .tok-comment,
|
|
32
|
+
.lite-notification-center__rich .tok-comment,
|
|
33
|
+
.lite-activity-rich .tok-comment {
|
|
34
|
+
color: var(--lite-token-comment, #86909C);
|
|
35
|
+
font-style: italic;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.lite-markdown-preview .tok-keyword,
|
|
39
|
+
.lite-rich-preview .tok-keyword,
|
|
40
|
+
.lite-insight-content .tok-keyword,
|
|
41
|
+
.lite-comments__rich .tok-keyword,
|
|
42
|
+
.lite-notification-center__rich .tok-keyword,
|
|
43
|
+
.lite-activity-rich .tok-keyword {
|
|
44
|
+
color: var(--lite-token-keyword, #165DFF);
|
|
45
|
+
font-weight: 600;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.lite-markdown-preview .tok-string,
|
|
49
|
+
.lite-rich-preview .tok-string,
|
|
50
|
+
.lite-insight-content .tok-string,
|
|
51
|
+
.lite-comments__rich .tok-string,
|
|
52
|
+
.lite-notification-center__rich .tok-string,
|
|
53
|
+
.lite-activity-rich .tok-string {
|
|
54
|
+
color: var(--lite-token-string, #007A5A);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.lite-markdown-preview .tok-number,
|
|
58
|
+
.lite-rich-preview .tok-number,
|
|
59
|
+
.lite-insight-content .tok-number,
|
|
60
|
+
.lite-comments__rich .tok-number,
|
|
61
|
+
.lite-notification-center__rich .tok-number,
|
|
62
|
+
.lite-activity-rich .tok-number {
|
|
63
|
+
color: var(--lite-token-number, #C2410C);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.lite-markdown-preview .tok-function,
|
|
67
|
+
.lite-rich-preview .tok-function,
|
|
68
|
+
.lite-insight-content .tok-function,
|
|
69
|
+
.lite-comments__rich .tok-function,
|
|
70
|
+
.lite-notification-center__rich .tok-function,
|
|
71
|
+
.lite-activity-rich .tok-function {
|
|
72
|
+
color: var(--lite-token-function, #7A3EA8);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.lite-markdown-preview .tok-type,
|
|
76
|
+
.lite-rich-preview .tok-type,
|
|
77
|
+
.lite-insight-content .tok-type,
|
|
78
|
+
.lite-comments__rich .tok-type,
|
|
79
|
+
.lite-notification-center__rich .tok-type,
|
|
80
|
+
.lite-activity-rich .tok-type {
|
|
81
|
+
color: var(--lite-token-type, #0E7490);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Dark preset. Add `lite-dark` to any ancestor (or the preview container) to
|
|
85
|
+
* swap the palette and the code block / table-of-contents chrome:
|
|
86
|
+
*
|
|
87
|
+
* <div class="lite-dark"><div class="lite-markdown-preview">…</div></div>
|
|
88
|
+
*
|
|
89
|
+
* Hosts with their own theme root can map it instead, for example
|
|
90
|
+
* `[data-theme="dark"] { --lite-token-keyword: … }`.
|
|
91
|
+
*/
|
|
92
|
+
.lite-dark {
|
|
93
|
+
--lite-token-comment: #8B949E;
|
|
94
|
+
--lite-token-keyword: #7FD1FF;
|
|
95
|
+
--lite-token-string: #9BE39B;
|
|
96
|
+
--lite-token-number: #FFC17A;
|
|
97
|
+
--lite-token-function: #C4A7FF;
|
|
98
|
+
--lite-token-type: #79D7D0;
|
|
99
|
+
color: #E6EDF3;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.lite-dark pre,
|
|
103
|
+
.lite-dark .lite-code-block {
|
|
104
|
+
background: #161B22;
|
|
105
|
+
border-color: #30363D;
|
|
106
|
+
color: #E6EDF3;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.lite-dark pre code {
|
|
110
|
+
color: #E6EDF3;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.lite-dark .lite-toc {
|
|
114
|
+
background: #161B22;
|
|
115
|
+
border-color: #30363D;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.lite-dark .lite-toc__list a {
|
|
119
|
+
color: #7FD1FF;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.lite-dark blockquote {
|
|
123
|
+
border-left-color: #30363D;
|
|
124
|
+
color: #C9D1D9;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.lite-dark table th,
|
|
128
|
+
.lite-dark table td {
|
|
129
|
+
border-color: #30363D;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.lite-dark table th {
|
|
133
|
+
background: #161B22;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.lite-dark .lite-footnotes {
|
|
137
|
+
border-top-color: #30363D;
|
|
138
|
+
color: #C9D1D9;
|
|
139
|
+
}
|