lutra 0.0.33 → 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/README.md +4 -24
- package/dist/components/AspectRatio.svelte +26 -0
- package/dist/components/AspectRatio.svelte.d.ts +8 -0
- package/dist/components/Dialog.svelte +78 -0
- package/dist/components/Dialog.svelte.d.ts +14 -0
- package/dist/components/Layout.svelte +32 -0
- package/dist/components/Layout.svelte.d.ts +11 -0
- package/dist/components/PageContent.svelte +108 -0
- package/dist/components/PageContent.svelte.d.ts +38 -0
- package/dist/components/Theme.svelte +87 -0
- package/dist/components/Theme.svelte.d.ts +17 -0
- package/dist/{display → components}/Tooltip.svelte +33 -8
- package/dist/components/Tooltip.svelte.d.ts +12 -0
- package/dist/config.d.ts +30 -0
- package/dist/config.js +18 -0
- package/dist/css/0-layers.css +1 -0
- package/dist/css/1-props.css +775 -0
- package/dist/css/2-base.css +209 -0
- package/dist/css/3-typo.css +65 -0
- package/dist/css/4-layout.css +5 -0
- package/dist/css/5-media.css +21 -0
- package/dist/css/lutra.css +6 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +5 -2
- package/dist/types.d.ts +39 -0
- package/dist/types.js +25 -0
- package/package.json +29 -82
- package/dist/color.css +0 -0
- package/dist/display/Avatar.svelte +0 -61
- package/dist/display/Avatar.svelte.d.ts +0 -19
- package/dist/display/Badge.svelte +0 -91
- package/dist/display/Badge.svelte.d.ts +0 -30
- package/dist/display/Callout.svelte +0 -109
- package/dist/display/Callout.svelte.d.ts +0 -28
- package/dist/display/Close.svelte +0 -58
- package/dist/display/Close.svelte.d.ts +0 -18
- package/dist/display/Code.svelte +0 -190
- package/dist/display/Code.svelte.d.ts +0 -32
- package/dist/display/ContextTip.svelte +0 -23
- package/dist/display/ContextTip.svelte.d.ts +0 -18
- package/dist/display/DataList.svelte +0 -16
- package/dist/display/DataList.svelte.d.ts +0 -21
- package/dist/display/Details.svelte +0 -49
- package/dist/display/Details.svelte.d.ts +0 -27
- package/dist/display/Hero.svelte +0 -50
- package/dist/display/Hero.svelte.d.ts +0 -26
- package/dist/display/Icon.svelte +0 -39
- package/dist/display/Icon.svelte.d.ts +0 -19
- package/dist/display/IconButton.svelte +0 -91
- package/dist/display/IconButton.svelte.d.ts +0 -27
- package/dist/display/Image.svelte +0 -91
- package/dist/display/Image.svelte.d.ts +0 -26
- package/dist/display/Indicator.svelte +0 -352
- package/dist/display/Indicator.svelte.d.ts +0 -23
- package/dist/display/Inset.svelte +0 -18
- package/dist/display/Inset.svelte.d.ts +0 -18
- package/dist/display/LineChart.svelte +0 -385
- package/dist/display/LineChart.svelte.d.ts +0 -24
- package/dist/display/LoadingIndicator.svelte +0 -33
- package/dist/display/LoadingIndicator.svelte.d.ts +0 -15
- package/dist/display/Modal.svelte +0 -116
- package/dist/display/Modal.svelte.d.ts +0 -27
- package/dist/display/Notification.svelte +0 -104
- package/dist/display/Notification.svelte.d.ts +0 -23
- package/dist/display/Panel.svelte +0 -23
- package/dist/display/Panel.svelte.d.ts +0 -19
- package/dist/display/Popup.svelte +0 -111
- package/dist/display/Popup.svelte.d.ts +0 -25
- package/dist/display/Stat.svelte +0 -81
- package/dist/display/Stat.svelte.d.ts +0 -30
- package/dist/display/Table.svelte +0 -28
- package/dist/display/Table.svelte.d.ts +0 -24
- package/dist/display/TablePaginator.svelte +0 -51
- package/dist/display/TablePaginator.svelte.d.ts +0 -21
- package/dist/display/Tag.svelte +0 -90
- package/dist/display/Tag.svelte.d.ts +0 -32
- package/dist/display/Tooltip.svelte.d.ts +0 -23
- package/dist/display/chart.d.ts +0 -78
- package/dist/display/chart.js +0 -212
- package/dist/display/index.d.ts +0 -24
- package/dist/display/index.js +0 -24
- package/dist/display/notifications.svelte.d.ts +0 -21
- package/dist/display/notifications.svelte.js +0 -31
- package/dist/form/Button.svelte +0 -39
- package/dist/form/Button.svelte.d.ts +0 -26
- package/dist/form/FieldActions.svelte +0 -68
- package/dist/form/FieldActions.svelte.d.ts +0 -20
- package/dist/form/FieldContainer.svelte +0 -37
- package/dist/form/FieldContainer.svelte.d.ts +0 -19
- package/dist/form/FieldContent.svelte +0 -153
- package/dist/form/FieldContent.svelte.d.ts +0 -31
- package/dist/form/FieldError.svelte +0 -14
- package/dist/form/FieldError.svelte.d.ts +0 -18
- package/dist/form/FieldSection.svelte +0 -86
- package/dist/form/FieldSection.svelte.d.ts +0 -20
- package/dist/form/Fieldset.svelte +0 -68
- package/dist/form/Fieldset.svelte.d.ts +0 -31
- package/dist/form/Form.svelte +0 -136
- package/dist/form/Form.svelte.d.ts +0 -38
- package/dist/form/ImageUpload.svelte +0 -259
- package/dist/form/ImageUpload.svelte.d.ts +0 -31
- package/dist/form/Input.svelte +0 -326
- package/dist/form/Input.svelte.d.ts +0 -117
- package/dist/form/InputLength.svelte +0 -32
- package/dist/form/InputLength.svelte.d.ts +0 -20
- package/dist/form/Label.svelte +0 -44
- package/dist/form/Label.svelte.d.ts +0 -25
- package/dist/form/LogoUpload.svelte +0 -100
- package/dist/form/LogoUpload.svelte.d.ts +0 -29
- package/dist/form/Select.svelte +0 -136
- package/dist/form/Select.svelte.d.ts +0 -70
- package/dist/form/Textarea.svelte +0 -163
- package/dist/form/Textarea.svelte.d.ts +0 -108
- package/dist/form/Toggle.svelte +0 -2
- package/dist/form/Toggle.svelte.d.ts +0 -15
- package/dist/form/client.svelte.d.ts +0 -44
- package/dist/form/client.svelte.js +0 -98
- package/dist/form/form.d.ts +0 -54
- package/dist/form/form.js +0 -340
- package/dist/form/index.d.ts +0 -18
- package/dist/form/index.js +0 -18
- package/dist/form/types.d.ts +0 -62
- package/dist/form/types.js +0 -1
- package/dist/icons/IconAlert.svelte +0 -3
- package/dist/icons/IconAlert.svelte.d.ts +0 -23
- package/dist/icons/IconCopy.svelte +0 -3
- package/dist/icons/IconCopy.svelte.d.ts +0 -23
- package/dist/icons/IconDone.svelte +0 -3
- package/dist/icons/IconDone.svelte.d.ts +0 -23
- package/dist/icons/IconError.svelte +0 -3
- package/dist/icons/IconError.svelte.d.ts +0 -23
- package/dist/icons/IconHelp.svelte +0 -3
- package/dist/icons/IconHelp.svelte.d.ts +0 -23
- package/dist/icons/IconHide.svelte +0 -3
- package/dist/icons/IconHide.svelte.d.ts +0 -23
- package/dist/icons/IconInfo.svelte +0 -3
- package/dist/icons/IconInfo.svelte.d.ts +0 -23
- package/dist/icons/IconLink.svelte +0 -3
- package/dist/icons/IconLink.svelte.d.ts +0 -23
- package/dist/icons/IconMenuBurger.svelte +0 -3
- package/dist/icons/IconMenuBurger.svelte.d.ts +0 -23
- package/dist/icons/IconMenuDots.svelte +0 -3
- package/dist/icons/IconMenuDots.svelte.d.ts +0 -23
- package/dist/icons/IconSearch.svelte +0 -3
- package/dist/icons/IconSearch.svelte.d.ts +0 -23
- package/dist/icons/IconShow.svelte +0 -3
- package/dist/icons/IconShow.svelte.d.ts +0 -23
- package/dist/icons/IconSuccess.svelte +0 -3
- package/dist/icons/IconSuccess.svelte.d.ts +0 -23
- package/dist/icons/IconWarning.svelte +0 -3
- package/dist/icons/IconWarning.svelte.d.ts +0 -23
- package/dist/icons/index.d.ts +0 -14
- package/dist/icons/index.js +0 -14
- package/dist/layout/Layout.svelte +0 -47
- package/dist/layout/Layout.svelte.d.ts +0 -22
- package/dist/layout/LayoutFooter.svelte +0 -21
- package/dist/layout/LayoutFooter.svelte.d.ts +0 -18
- package/dist/layout/LayoutGrid.svelte +0 -51
- package/dist/layout/LayoutGrid.svelte.d.ts +0 -27
- package/dist/layout/LayoutHeader.svelte +0 -97
- package/dist/layout/LayoutHeader.svelte.d.ts +0 -34
- package/dist/layout/LayoutSideMenu.svelte +0 -55
- package/dist/layout/LayoutSideMenu.svelte.d.ts +0 -21
- package/dist/layout/LayoutTypes.d.ts +0 -15
- package/dist/layout/LayoutTypes.js +0 -9
- package/dist/layout/Overlay.svelte +0 -20
- package/dist/layout/Overlay.svelte.d.ts +0 -25
- package/dist/layout/OverlayContainer.svelte +0 -28
- package/dist/layout/OverlayContainer.svelte.d.ts +0 -15
- package/dist/layout/OverlayLayer.svelte +0 -140
- package/dist/layout/OverlayLayer.svelte.d.ts +0 -19
- package/dist/layout/PageContent.svelte +0 -82
- package/dist/layout/PageContent.svelte.d.ts +0 -25
- package/dist/layout/Theme.svelte +0 -243
- package/dist/layout/Theme.svelte.d.ts +0 -19
- package/dist/layout/UIContent.svelte +0 -15
- package/dist/layout/UIContent.svelte.d.ts +0 -18
- package/dist/layout/index.d.ts +0 -11
- package/dist/layout/index.js +0 -11
- package/dist/layout/overlays.svelte.d.ts +0 -34
- package/dist/layout/overlays.svelte.js +0 -44
- package/dist/nav/Breadcrumb.svelte +0 -82
- package/dist/nav/Breadcrumb.svelte.d.ts +0 -28
- package/dist/nav/Menu.svelte +0 -170
- package/dist/nav/Menu.svelte.d.ts +0 -27
- package/dist/nav/MenuItem.svelte +0 -147
- package/dist/nav/MenuItem.svelte.d.ts +0 -22
- package/dist/nav/MenuTypes.d.ts +0 -58
- package/dist/nav/MenuTypes.js +0 -1
- package/dist/nav/NavMenu.svelte +0 -181
- package/dist/nav/NavMenu.svelte.d.ts +0 -19
- package/dist/nav/TabbedContent.svelte +0 -43
- package/dist/nav/TabbedContent.svelte.d.ts +0 -23
- package/dist/nav/Tabs.svelte +0 -158
- package/dist/nav/Tabs.svelte.d.ts +0 -25
- package/dist/nav/index.d.ts +0 -7
- package/dist/nav/index.js +0 -6
- package/dist/style.css +0 -950
- package/dist/typo/Clamp.svelte +0 -25
- package/dist/typo/Clamp.svelte.d.ts +0 -24
- package/dist/typo/H.svelte +0 -52
- package/dist/typo/H.svelte.d.ts +0 -28
- package/dist/typo/H1.svelte +0 -14
- package/dist/typo/H1.svelte.d.ts +0 -26
- package/dist/typo/H2.svelte +0 -14
- package/dist/typo/H2.svelte.d.ts +0 -26
- package/dist/typo/H3.svelte +0 -14
- package/dist/typo/H3.svelte.d.ts +0 -26
- package/dist/typo/H4.svelte +0 -14
- package/dist/typo/H4.svelte.d.ts +0 -26
- package/dist/typo/H5.svelte +0 -14
- package/dist/typo/H5.svelte.d.ts +0 -26
- package/dist/typo/H6.svelte +0 -14
- package/dist/typo/H6.svelte.d.ts +0 -26
- package/dist/typo/P.svelte +0 -34
- package/dist/typo/P.svelte.d.ts +0 -26
- package/dist/typo/index.d.ts +0 -9
- package/dist/typo/index.js +0 -9
- package/dist/utils/StringOrComponent.svelte +0 -14
- package/dist/utils/StringOrComponent.svelte.d.ts +0 -19
- package/dist/utils/StringOrSnippet.svelte +0 -11
- package/dist/utils/StringOrSnippet.svelte.d.ts +0 -19
- package/dist/utils/attr.d.ts +0 -5
- package/dist/utils/attr.js +0 -21
- package/dist/utils/color.d.ts +0 -51
- package/dist/utils/color.js +0 -97
- package/dist/utils/defaults.d.ts +0 -4
- package/dist/utils/defaults.js +0 -1
- package/dist/utils/dom.d.ts +0 -15
- package/dist/utils/dom.js +0 -74
- package/dist/utils/hooks.server.d.ts +0 -2
- package/dist/utils/hooks.server.js +0 -16
- package/dist/utils/id.d.ts +0 -1
- package/dist/utils/id.js +0 -3
- package/dist/utils/index.d.ts +0 -9
- package/dist/utils/index.js +0 -6
- package/dist/utils/isSnippet.d.ts +0 -3
- package/dist/utils/isSnippet.js +0 -11
- package/dist/utils/keyboard.svelte.d.ts +0 -22
- package/dist/utils/keyboard.svelte.js +0 -161
- /package/dist/{utils → util}/transitions.d.ts +0 -0
- /package/dist/{utils → util}/transitions.js +0 -0
package/dist/display/chart.js
DELETED
@@ -1,212 +0,0 @@
|
|
1
|
-
export function scale(domain, range) {
|
2
|
-
const m = (range[1] - range[0]) / (domain[1] - domain[0]);
|
3
|
-
return (num) => range[0] + m * (num - domain[0]);
|
4
|
-
}
|
5
|
-
export function makeScale(numbers, itemsToReturn) {
|
6
|
-
const min = 0;
|
7
|
-
const max = Math.max(...numbers);
|
8
|
-
const interval = Math.ceil(max / itemsToReturn);
|
9
|
-
const getRoundedInterval = (value) => {
|
10
|
-
const power = Math.floor(Math.log10(value));
|
11
|
-
const factor = Math.pow(10, power);
|
12
|
-
if (value / factor <= 2) {
|
13
|
-
return 2 * factor;
|
14
|
-
}
|
15
|
-
else if (value / factor <= 5) {
|
16
|
-
return 5 * factor;
|
17
|
-
}
|
18
|
-
else {
|
19
|
-
return 10 * factor;
|
20
|
-
}
|
21
|
-
};
|
22
|
-
const roundedInterval = getRoundedInterval(interval);
|
23
|
-
const maxOutputValue = Math.ceil(max / roundedInterval) * roundedInterval;
|
24
|
-
const outputLength = maxOutputValue / roundedInterval + 1;
|
25
|
-
const output = new Array(outputLength)
|
26
|
-
.fill(0)
|
27
|
-
.map((_, index) => index * roundedInterval);
|
28
|
-
return output;
|
29
|
-
}
|
30
|
-
export function getShortKValue(num) {
|
31
|
-
if (num >= 1000000) {
|
32
|
-
const shortMValue = (num / 1000000).toFixed(1);
|
33
|
-
if (shortMValue.endsWith('.0')) {
|
34
|
-
return shortMValue.slice(0, -2) + 'M';
|
35
|
-
}
|
36
|
-
else {
|
37
|
-
return shortMValue + 'M';
|
38
|
-
}
|
39
|
-
}
|
40
|
-
else if (num >= 1000) {
|
41
|
-
const shortKValue = (num / 1000).toFixed(1);
|
42
|
-
if (shortKValue.endsWith('.0')) {
|
43
|
-
return shortKValue.slice(0, -2) + 'K';
|
44
|
-
}
|
45
|
-
else {
|
46
|
-
return shortKValue + 'K';
|
47
|
-
}
|
48
|
-
}
|
49
|
-
else {
|
50
|
-
return num.toString();
|
51
|
-
}
|
52
|
-
}
|
53
|
-
/**
|
54
|
-
* Interpolates a Catmull-Rom Spline through a series of x/y points
|
55
|
-
* Converts the CR Spline to Cubic Beziers for use with SVG items
|
56
|
-
*
|
57
|
-
* If 'alpha' is 0.5 then the 'Centripetal' variant is used
|
58
|
-
* If 'alpha' is 1 then the 'Chordal' variant is used
|
59
|
-
*
|
60
|
-
* @param {Array} data - Array of points, each point in object literal holding x/y values
|
61
|
-
* @return {String} d - SVG string with cubic bezier curves representing the Catmull-Rom Spline
|
62
|
-
*/
|
63
|
-
export function catmullRomBase(data, alpha) {
|
64
|
-
if (alpha == 0 || alpha === undefined) {
|
65
|
-
throw new Error('Alpha value must be greater than 0');
|
66
|
-
}
|
67
|
-
else {
|
68
|
-
let pointsData = [];
|
69
|
-
var p0, p1, p2, p3, bp1, bp2, d1, d2, d3, A, B, N, M;
|
70
|
-
var d3powA, d2powA, d3pow2A, d2pow2A, d1pow2A, d1powA;
|
71
|
-
var d = Math.round(data[0].x) + ',' + Math.round(data[0].y) + ' ';
|
72
|
-
var length = data.length;
|
73
|
-
for (var i = 0; i < length - 1; i++) {
|
74
|
-
p0 = i == 0 ? data[0] : data[i - 1];
|
75
|
-
p1 = data[i];
|
76
|
-
p2 = data[i + 1];
|
77
|
-
p3 = i + 2 < length ? data[i + 2] : p2;
|
78
|
-
d1 = Math.sqrt(Math.pow(p0.x - p1.x, 2) + Math.pow(p0.y - p1.y, 2));
|
79
|
-
d2 = Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
|
80
|
-
d3 = Math.sqrt(Math.pow(p2.x - p3.x, 2) + Math.pow(p2.y - p3.y, 2));
|
81
|
-
// Catmull-Rom to Cubic Bezier conversion matrix
|
82
|
-
// A = 2d1^2a + 3d1^a * d2^a + d3^2a
|
83
|
-
// B = 2d3^2a + 3d3^a * d2^a + d2^2a
|
84
|
-
// [ 0 1 0 0 ]
|
85
|
-
// [ -d2^2a /N A/N d1^2a /N 0 ]
|
86
|
-
// [ 0 d3^2a /M B/M -d2^2a /M ]
|
87
|
-
// [ 0 0 1 0 ]
|
88
|
-
d3powA = Math.pow(d3, alpha);
|
89
|
-
d3pow2A = Math.pow(d3, 2 * alpha);
|
90
|
-
d2powA = Math.pow(d2, alpha);
|
91
|
-
d2pow2A = Math.pow(d2, 2 * alpha);
|
92
|
-
d1powA = Math.pow(d1, alpha);
|
93
|
-
d1pow2A = Math.pow(d1, 2 * alpha);
|
94
|
-
A = 2 * d1pow2A + 3 * d1powA * d2powA + d2pow2A;
|
95
|
-
B = 2 * d3pow2A + 3 * d3powA * d2powA + d2pow2A;
|
96
|
-
N = 3 * d1powA * (d1powA + d2powA);
|
97
|
-
if (N > 0) {
|
98
|
-
N = 1 / N;
|
99
|
-
}
|
100
|
-
M = 3 * d3powA * (d3powA + d2powA);
|
101
|
-
if (M > 0) {
|
102
|
-
M = 1 / M;
|
103
|
-
}
|
104
|
-
bp1 = {
|
105
|
-
x: (-d2pow2A * p0.x + A * p1.x + d1pow2A * p2.x) * N,
|
106
|
-
y: (-d2pow2A * p0.y + A * p1.y + d1pow2A * p2.y) * N
|
107
|
-
};
|
108
|
-
bp2 = {
|
109
|
-
x: (d3pow2A * p1.x + B * p2.x - d2pow2A * p3.x) * M,
|
110
|
-
y: (d3pow2A * p1.y + B * p2.y - d2pow2A * p3.y) * M
|
111
|
-
};
|
112
|
-
if (bp1.x == 0 && bp1.y == 0) {
|
113
|
-
bp1 = p1;
|
114
|
-
}
|
115
|
-
if (bp2.x == 0 && bp2.y == 0) {
|
116
|
-
bp2 = p2;
|
117
|
-
}
|
118
|
-
//d += 'C' + bp1.x + ',' + bp1.y + ' ' + bp2.x + ',' + bp2.y + ' ' + p2.x + ',' + p2.y + ' ';
|
119
|
-
pointsData.push({
|
120
|
-
p1: p1,
|
121
|
-
p2: p2,
|
122
|
-
bp1: bp1,
|
123
|
-
bp2: bp2
|
124
|
-
});
|
125
|
-
}
|
126
|
-
return pointsData;
|
127
|
-
}
|
128
|
-
}
|
129
|
-
;
|
130
|
-
/**
|
131
|
-
* Returns the SVG path for Catmull-Rom spline interpolation
|
132
|
-
*/
|
133
|
-
export function catmullRomToSVG(pointsData, alpha, firstValue) {
|
134
|
-
//const pointsData = catmullRomBase(data, alpha);
|
135
|
-
if (!pointsData)
|
136
|
-
return false;
|
137
|
-
let d = Math.round(firstValue.x) + ',' + Math.round(firstValue.y) + ' ';
|
138
|
-
//let d = '';
|
139
|
-
pointsData.forEach(({ p1, p2, bp1, bp2 }) => {
|
140
|
-
d += 'C' + bp1.x + ',' + bp1.y + ' ' + bp2.x + ',' + bp2.y + ' ' + p2.x + ',' + p2.y + ' ';
|
141
|
-
});
|
142
|
-
return d;
|
143
|
-
}
|
144
|
-
/**
|
145
|
-
* Returns the Y coordinate for the given X value on the Catmull-Rom spline
|
146
|
-
*/
|
147
|
-
export function catmullRomGetY(pointsData, alpha, xValue, yPadding) {
|
148
|
-
if (!pointsData)
|
149
|
-
return false;
|
150
|
-
// Find the minimum and maximum Y values
|
151
|
-
let minY = pointsData[0].p1.y;
|
152
|
-
let maxY = pointsData[0].p1.y;
|
153
|
-
for (const { p1, p2, bp1, bp2 } of pointsData) {
|
154
|
-
minY = Math.min(minY, p1.y, p2.y, bp1.y, bp2.y);
|
155
|
-
maxY = Math.max(maxY, p1.y, p2.y, bp1.y, bp2.y);
|
156
|
-
}
|
157
|
-
// Calculate the range and padding for Y values
|
158
|
-
const yRange = maxY - minY;
|
159
|
-
const yOffset = minY + yPadding * yRange / 2;
|
160
|
-
const yScale = 1 - yPadding;
|
161
|
-
let resultY;
|
162
|
-
for (let i = 0; i < pointsData.length; i++) {
|
163
|
-
const { p1, p2, bp1, bp2 } = pointsData[i];
|
164
|
-
// Scale Y coordinates of the points based on the yPadding
|
165
|
-
const scaledP1 = { ...p1, y: yOffset + (p1.y - minY) * yScale };
|
166
|
-
const scaledP2 = { ...p2, y: yOffset + (p2.y - minY) * yScale };
|
167
|
-
const scaledBp1 = { ...bp1, y: yOffset + (bp1.y - minY) * yScale };
|
168
|
-
const scaledBp2 = { ...bp2, y: yOffset + (bp2.y - minY) * yScale };
|
169
|
-
if (xValue >= p1.x && xValue <= p2.x) {
|
170
|
-
// Use the de Casteljau's algorithm to find the Y coordinate for the given X value
|
171
|
-
const t = (xValue - p1.x) / (p2.x - p1.x);
|
172
|
-
const q0 = lerp(scaledP1, scaledBp1, t);
|
173
|
-
const q1 = lerp(scaledBp1, scaledBp2, t);
|
174
|
-
const q2 = lerp(scaledBp2, scaledP2, t);
|
175
|
-
const r0 = lerp(q0, q1, t);
|
176
|
-
const r1 = lerp(q1, q2, t);
|
177
|
-
const resultPoint = lerp(r0, r1, t);
|
178
|
-
// Rescale the resulting Y coordinate back to its original range
|
179
|
-
resultY = minY + (resultPoint.y - yOffset) / yScale;
|
180
|
-
break;
|
181
|
-
}
|
182
|
-
}
|
183
|
-
return resultY;
|
184
|
-
}
|
185
|
-
/**
|
186
|
-
* Linear interpolation helper function
|
187
|
-
*/
|
188
|
-
export function lerp(point1, point2, t) {
|
189
|
-
return {
|
190
|
-
x: point1.x + (point2.x - point1.x) * t,
|
191
|
-
y: point1.y + (point2.y - point1.y) * t,
|
192
|
-
};
|
193
|
-
}
|
194
|
-
export function getSVGSize(svg) {
|
195
|
-
const rect = svg.getBoundingClientRect();
|
196
|
-
const styles = window.getComputedStyle(svg);
|
197
|
-
const padding = {
|
198
|
-
left: parseFloat(styles.paddingLeft),
|
199
|
-
right: parseFloat(styles.paddingRight),
|
200
|
-
top: parseFloat(styles.paddingTop),
|
201
|
-
bottom: parseFloat(styles.paddingBottom),
|
202
|
-
};
|
203
|
-
const innerWidth = rect.width - padding.left - padding.right;
|
204
|
-
const innerHeight = rect.height - padding.top - padding.bottom;
|
205
|
-
return {
|
206
|
-
innerWidth: innerWidth,
|
207
|
-
innerHeight: innerHeight,
|
208
|
-
width: rect.width,
|
209
|
-
height: rect.height,
|
210
|
-
padding: padding,
|
211
|
-
};
|
212
|
-
}
|
package/dist/display/index.d.ts
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
export { default as Avatar } from './Avatar.svelte';
|
2
|
-
export { default as Badge } from './Badge.svelte';
|
3
|
-
export { default as Callout } from './Callout.svelte';
|
4
|
-
export { default as Close } from './Close.svelte';
|
5
|
-
export { default as Code } from './Code.svelte';
|
6
|
-
export { default as ContextTip } from './ContextTip.svelte';
|
7
|
-
export { default as Details } from './Details.svelte';
|
8
|
-
export { default as Hero } from './Hero.svelte';
|
9
|
-
export { default as Icon } from './Icon.svelte';
|
10
|
-
export { default as IconButton } from './IconButton.svelte';
|
11
|
-
export { default as Image } from './Image.svelte';
|
12
|
-
export { default as Indicator } from './Indicator.svelte';
|
13
|
-
export { default as Inset } from './Inset.svelte';
|
14
|
-
export { default as Notification } from './Notification.svelte';
|
15
|
-
export { default as Popup } from './Popup.svelte';
|
16
|
-
export { default as Stat } from './Stat.svelte';
|
17
|
-
export { default as LineChart } from './LineChart.svelte';
|
18
|
-
export { default as LoadingIndicator } from './LoadingIndicator.svelte';
|
19
|
-
export { default as Modal } from './Modal.svelte';
|
20
|
-
export { default as Table } from './Table.svelte';
|
21
|
-
export { default as Tag } from './Tag.svelte';
|
22
|
-
export { default as Tooltip } from './Tooltip.svelte';
|
23
|
-
export * from './chart.js';
|
24
|
-
export * from './notifications.svelte.js';
|
package/dist/display/index.js
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
export { default as Avatar } from './Avatar.svelte';
|
2
|
-
export { default as Badge } from './Badge.svelte';
|
3
|
-
export { default as Callout } from './Callout.svelte';
|
4
|
-
export { default as Close } from './Close.svelte';
|
5
|
-
export { default as Code } from './Code.svelte';
|
6
|
-
export { default as ContextTip } from './ContextTip.svelte';
|
7
|
-
export { default as Details } from './Details.svelte';
|
8
|
-
export { default as Hero } from './Hero.svelte';
|
9
|
-
export { default as Icon } from './Icon.svelte';
|
10
|
-
export { default as IconButton } from './IconButton.svelte';
|
11
|
-
export { default as Image } from './Image.svelte';
|
12
|
-
export { default as Indicator } from './Indicator.svelte';
|
13
|
-
export { default as Inset } from './Inset.svelte';
|
14
|
-
export { default as Notification } from './Notification.svelte';
|
15
|
-
export { default as Popup } from './Popup.svelte';
|
16
|
-
export { default as Stat } from './Stat.svelte';
|
17
|
-
export { default as LineChart } from './LineChart.svelte';
|
18
|
-
export { default as LoadingIndicator } from './LoadingIndicator.svelte';
|
19
|
-
export { default as Modal } from './Modal.svelte';
|
20
|
-
export { default as Table } from './Table.svelte';
|
21
|
-
export { default as Tag } from './Tag.svelte';
|
22
|
-
export { default as Tooltip } from './Tooltip.svelte';
|
23
|
-
export * from './chart.js';
|
24
|
-
export * from './notifications.svelte.js';
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import { type OverlayPosition } from "../layout/overlays.svelte.js";
|
2
|
-
import type { Component, Snippet } from "svelte";
|
3
|
-
/**
|
4
|
-
* Add a notification to the screen.
|
5
|
-
* @param {object} opts - The options for the notification.
|
6
|
-
* @param {string} opts.content - The content of the notification.
|
7
|
-
* @param {OverlayPosition} opts.position - The position of the notification.
|
8
|
-
* @param {Snippet | Component} opts.icon - The icon of the notification.
|
9
|
-
* @param {string} opts.title - The title of the notification.
|
10
|
-
* @param {string} opts.stack - Group notifications together by named stacks.
|
11
|
-
* @param {number} opts.autoClose - The time in milliseconds before the notification closes.
|
12
|
-
* @returns {void}
|
13
|
-
*/
|
14
|
-
export declare function addNotification(opts: {
|
15
|
-
content: string;
|
16
|
-
position?: OverlayPosition;
|
17
|
-
icon?: Snippet | Component;
|
18
|
-
title?: string;
|
19
|
-
stack?: string;
|
20
|
-
autoClose?: number;
|
21
|
-
}): void;
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import { createId } from "../utils/id.js";
|
2
|
-
import { addOverlay, removeOverlay } from "../layout/overlays.svelte.js";
|
3
|
-
import NotificationSvelte from "./Notification.svelte";
|
4
|
-
/**
|
5
|
-
* Add a notification to the screen.
|
6
|
-
* @param {object} opts - The options for the notification.
|
7
|
-
* @param {string} opts.content - The content of the notification.
|
8
|
-
* @param {OverlayPosition} opts.position - The position of the notification.
|
9
|
-
* @param {Snippet | Component} opts.icon - The icon of the notification.
|
10
|
-
* @param {string} opts.title - The title of the notification.
|
11
|
-
* @param {string} opts.stack - Group notifications together by named stacks.
|
12
|
-
* @param {number} opts.autoClose - The time in milliseconds before the notification closes.
|
13
|
-
* @returns {void}
|
14
|
-
*/
|
15
|
-
export function addNotification(opts) {
|
16
|
-
const id = createId();
|
17
|
-
addOverlay({
|
18
|
-
id,
|
19
|
-
z: 100,
|
20
|
-
content: NotificationSvelte,
|
21
|
-
props: { id, ...opts },
|
22
|
-
stack: opts.stack,
|
23
|
-
position: opts.position || "bottom right",
|
24
|
-
layer: "notifications",
|
25
|
-
});
|
26
|
-
if (opts.autoClose) {
|
27
|
-
setTimeout(() => {
|
28
|
-
removeOverlay(id);
|
29
|
-
}, opts.autoClose);
|
30
|
-
}
|
31
|
-
}
|
package/dist/form/Button.svelte
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
<script lang="ts">import Icon from "../display/Icon.svelte";
|
2
|
-
import { getContext } from "svelte";
|
3
|
-
let {
|
4
|
-
href,
|
5
|
-
type = "button",
|
6
|
-
class: className,
|
7
|
-
size = "md",
|
8
|
-
kind = "default",
|
9
|
-
disabled = false,
|
10
|
-
icon,
|
11
|
-
onclick,
|
12
|
-
children
|
13
|
-
} = $props();
|
14
|
-
const form = getContext("form");
|
15
|
-
</script>
|
16
|
-
|
17
|
-
{#if href}
|
18
|
-
<a class="Button Link button {size} {kind} {className}" {href} {onclick}>
|
19
|
-
{#if icon}
|
20
|
-
<Icon {icon} />
|
21
|
-
{/if}
|
22
|
-
{@render children()}
|
23
|
-
</a>
|
24
|
-
{:else}
|
25
|
-
<button class="Button button {size} {kind} {className}" type={type} disabled={disabled || form?.state === 'loading'} {onclick}>
|
26
|
-
{#if icon}
|
27
|
-
<Icon {icon} />
|
28
|
-
{/if}
|
29
|
-
{@render children()}
|
30
|
-
</button>
|
31
|
-
{/if}
|
32
|
-
|
33
|
-
<style>
|
34
|
-
.Button {
|
35
|
-
display: inline-flex;
|
36
|
-
align-items: center;
|
37
|
-
justify-content: center;
|
38
|
-
}
|
39
|
-
</style>
|
@@ -1,26 +0,0 @@
|
|
1
|
-
import { type Component, type Snippet } from 'svelte';
|
2
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
4
|
-
$$bindings?: Bindings;
|
5
|
-
} & Exports;
|
6
|
-
(internal: unknown, props: Props & {
|
7
|
-
$$events?: Events;
|
8
|
-
$$slots?: Slots;
|
9
|
-
}): Exports;
|
10
|
-
z_$$bindings?: Bindings;
|
11
|
-
}
|
12
|
-
declare const Button: $$__sveltets_2_IsomorphicComponent<{
|
13
|
-
href?: string;
|
14
|
-
type?: "button" | "submit" | "reset";
|
15
|
-
kind?: "default" | "outlined" | "secondary" | "warn";
|
16
|
-
size?: "sm" | "md" | "lg" | "xl";
|
17
|
-
class?: string;
|
18
|
-
disabled?: boolean;
|
19
|
-
icon?: string | Snippet | Component;
|
20
|
-
onclick?: (event: MouseEvent) => void;
|
21
|
-
children: Snippet;
|
22
|
-
}, {
|
23
|
-
[evt: string]: CustomEvent<any>;
|
24
|
-
}, {}, {}, "">;
|
25
|
-
type Button = InstanceType<typeof Button>;
|
26
|
-
export default Button;
|
@@ -1,68 +0,0 @@
|
|
1
|
-
<script lang="ts">import StringOrSnippet from "../utils/StringOrSnippet.svelte";
|
2
|
-
let {
|
3
|
-
align = "end",
|
4
|
-
children,
|
5
|
-
info
|
6
|
-
} = $props();
|
7
|
-
</script>
|
8
|
-
|
9
|
-
<div class="FieldActions {align}" class:hasInfo={!!info}>
|
10
|
-
{#if info}
|
11
|
-
<div class="Info">
|
12
|
-
<StringOrSnippet content={info} />
|
13
|
-
</div>
|
14
|
-
{/if}
|
15
|
-
<div class="Actions">
|
16
|
-
{@render children()}
|
17
|
-
</div>
|
18
|
-
</div>
|
19
|
-
|
20
|
-
<style>
|
21
|
-
.FieldActions {
|
22
|
-
display: grid;
|
23
|
-
background: color-mix(in srgb, var(--bg-subtle) calc(var(--fcc) * 100%), transparent);
|
24
|
-
padding: calc(1.5em * var(--fcc)) calc(3em * var(--fcc));
|
25
|
-
grid-column: 1 / -1;
|
26
|
-
grid-template-columns: subgrid;
|
27
|
-
border-bottom-left-radius: inherit;
|
28
|
-
border-bottom-right-radius: inherit;
|
29
|
-
align-items: center;
|
30
|
-
}
|
31
|
-
.Actions {
|
32
|
-
display: flex;
|
33
|
-
flex-direction: row;
|
34
|
-
align-items: center;
|
35
|
-
justify-content: space-between;
|
36
|
-
gap: 1.35em;
|
37
|
-
grid-column: 2 / -1;
|
38
|
-
}
|
39
|
-
.FieldActions.start .Actions {
|
40
|
-
justify-content: start;
|
41
|
-
grid-column: 1 / -1;
|
42
|
-
}
|
43
|
-
.FieldActions.middle .Actions {
|
44
|
-
justify-content: center;
|
45
|
-
grid-column: 1 / -1;
|
46
|
-
}
|
47
|
-
.FieldActions.end .Actions {
|
48
|
-
justify-content: end;
|
49
|
-
grid-column: 1 / -1;
|
50
|
-
}
|
51
|
-
.FieldActions.hasInfo .Actions {
|
52
|
-
grid-column: 2 / -1;
|
53
|
-
}
|
54
|
-
@container (max-width: 480px) {
|
55
|
-
.FieldActions {
|
56
|
-
justify-content: center;
|
57
|
-
gap: 1rem;
|
58
|
-
}
|
59
|
-
.Info {
|
60
|
-
order: 1;
|
61
|
-
text-align: center;
|
62
|
-
}
|
63
|
-
.Actions {
|
64
|
-
order: -1;
|
65
|
-
flex-direction: column;
|
66
|
-
}
|
67
|
-
}
|
68
|
-
</style>
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import type { Snippet } from "svelte";
|
2
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
4
|
-
$$bindings?: Bindings;
|
5
|
-
} & Exports;
|
6
|
-
(internal: unknown, props: Props & {
|
7
|
-
$$events?: Events;
|
8
|
-
$$slots?: Slots;
|
9
|
-
}): Exports;
|
10
|
-
z_$$bindings?: Bindings;
|
11
|
-
}
|
12
|
-
declare const FieldActions: $$__sveltets_2_IsomorphicComponent<{
|
13
|
-
align?: "justified" | "start" | "middle" | "end";
|
14
|
-
children: Snippet;
|
15
|
-
info?: string | Snippet;
|
16
|
-
}, {
|
17
|
-
[evt: string]: CustomEvent<any>;
|
18
|
-
}, {}, {}, "">;
|
19
|
-
type FieldActions = InstanceType<typeof FieldActions>;
|
20
|
-
export default FieldActions;
|
@@ -1,37 +0,0 @@
|
|
1
|
-
<script lang="ts">let {
|
2
|
-
children,
|
3
|
-
contained
|
4
|
-
} = $props();
|
5
|
-
</script>
|
6
|
-
|
7
|
-
<div class="FieldContainer" class:contained style="--fcc: {contained ? 1 : 0}">
|
8
|
-
{@render children()}
|
9
|
-
</div>
|
10
|
-
|
11
|
-
<style>
|
12
|
-
.FieldContainer {
|
13
|
-
container-type: inline-size;
|
14
|
-
display: grid;
|
15
|
-
row-gap: 1.5em;
|
16
|
-
column-gap: 3em;
|
17
|
-
grid-template-columns: minmax(25ch, 35%) minmax(min-content, 1fr);
|
18
|
-
border-radius: var(--border-radius);
|
19
|
-
background: var(--bg, var(--form-bg));
|
20
|
-
}
|
21
|
-
.FieldContainer.contained {
|
22
|
-
border: var(--border);
|
23
|
-
gap: 0;
|
24
|
-
}
|
25
|
-
.FieldContainer :global(.FieldSection:has(+ .FieldActions)) {
|
26
|
-
margin-bottom: 0;
|
27
|
-
border-bottom: 0;
|
28
|
-
}
|
29
|
-
.FieldContainer.contained :global(.FieldSection:has(+ .FieldActions)) {
|
30
|
-
border-bottom: var(--border);
|
31
|
-
}
|
32
|
-
@container (max-width: 800px) {
|
33
|
-
.FieldContainer {
|
34
|
-
grid-template-columns: 1fr;
|
35
|
-
}
|
36
|
-
}
|
37
|
-
</style>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import type { Snippet } from "svelte";
|
2
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
4
|
-
$$bindings?: Bindings;
|
5
|
-
} & Exports;
|
6
|
-
(internal: unknown, props: Props & {
|
7
|
-
$$events?: Events;
|
8
|
-
$$slots?: Slots;
|
9
|
-
}): Exports;
|
10
|
-
z_$$bindings?: Bindings;
|
11
|
-
}
|
12
|
-
declare const FieldContainer: $$__sveltets_2_IsomorphicComponent<{
|
13
|
-
contained?: boolean;
|
14
|
-
children: Snippet;
|
15
|
-
}, {
|
16
|
-
[evt: string]: CustomEvent<any>;
|
17
|
-
}, {}, {}, "">;
|
18
|
-
type FieldContainer = InstanceType<typeof FieldContainer>;
|
19
|
-
export default FieldContainer;
|
@@ -1,153 +0,0 @@
|
|
1
|
-
<script lang="ts">import Label from "./Label.svelte";
|
2
|
-
import FieldError from "./FieldError.svelte";
|
3
|
-
import StringOrSnippet from "../utils/StringOrSnippet.svelte";
|
4
|
-
let {
|
5
|
-
id,
|
6
|
-
contained,
|
7
|
-
prefix,
|
8
|
-
suffix,
|
9
|
-
label,
|
10
|
-
labelTip,
|
11
|
-
help,
|
12
|
-
type = "text",
|
13
|
-
direction = "column",
|
14
|
-
// 'row' | 'column'
|
15
|
-
required,
|
16
|
-
children,
|
17
|
-
field,
|
18
|
-
issue
|
19
|
-
} = $props();
|
20
|
-
</script>
|
21
|
-
|
22
|
-
{#snippet _prefix()}
|
23
|
-
<div class="Fix Prefix">
|
24
|
-
<StringOrSnippet content={prefix} />
|
25
|
-
</div>
|
26
|
-
{/snippet}
|
27
|
-
|
28
|
-
{#snippet _suffix()}
|
29
|
-
<div class="Fix Suffix">
|
30
|
-
<StringOrSnippet content={suffix} />
|
31
|
-
</div>
|
32
|
-
{/snippet}
|
33
|
-
|
34
|
-
<div class="FieldContentContainer">
|
35
|
-
<div class="FieldContent {type} {direction}" class:contained>
|
36
|
-
<Label {label} tip={labelTip} {id} {required} />
|
37
|
-
{#if contained}
|
38
|
-
<div
|
39
|
-
class="Field"
|
40
|
-
class:hasPrefix={prefix}
|
41
|
-
class:hasSuffix={suffix}
|
42
|
-
class:invalid={field?.tainted && issue?.code}
|
43
|
-
>
|
44
|
-
{#if prefix}
|
45
|
-
{@render _prefix()}
|
46
|
-
{/if}
|
47
|
-
|
48
|
-
{@render children()}
|
49
|
-
|
50
|
-
{#if suffix}
|
51
|
-
{@render _suffix()}
|
52
|
-
{/if}
|
53
|
-
</div>
|
54
|
-
{:else}
|
55
|
-
{#if prefix}
|
56
|
-
{@render _prefix()}
|
57
|
-
{/if}
|
58
|
-
|
59
|
-
{@render children()}
|
60
|
-
|
61
|
-
{#if suffix}
|
62
|
-
{@render _suffix()}
|
63
|
-
{/if}
|
64
|
-
{/if}
|
65
|
-
|
66
|
-
</div>
|
67
|
-
|
68
|
-
{#if help}
|
69
|
-
<div class="Help">
|
70
|
-
<StringOrSnippet content={help} />
|
71
|
-
</div>
|
72
|
-
{/if}
|
73
|
-
|
74
|
-
{#if field?.tainted && issue?.code}
|
75
|
-
<FieldError code={issue.code} message={issue.message} />
|
76
|
-
{/if}
|
77
|
-
</div>
|
78
|
-
|
79
|
-
<style>
|
80
|
-
.FieldContentContainer {
|
81
|
-
display: flex;
|
82
|
-
flex-direction: column;
|
83
|
-
gap: 0.75em;
|
84
|
-
}
|
85
|
-
.FieldContent {
|
86
|
-
display: flex;
|
87
|
-
gap: 0.75em;
|
88
|
-
flex-direction: column;
|
89
|
-
font-size: var(--font-size, 1em);
|
90
|
-
}
|
91
|
-
.FieldContent.row {
|
92
|
-
flex-direction: row-reverse;
|
93
|
-
justify-content: start;
|
94
|
-
align-items: center;
|
95
|
-
flex-shrink: 0;
|
96
|
-
}
|
97
|
-
.Field {
|
98
|
-
background-color: var(--field-bg);
|
99
|
-
border: var(--field-border-size) var(--field-border-style) var(--field-border-color);
|
100
|
-
border-radius: var(--field-radius);
|
101
|
-
display: flex;
|
102
|
-
}
|
103
|
-
.Field:has(input:user-invalid),
|
104
|
-
.Field.invalid {
|
105
|
-
border-color: var(--field-border-color-error);
|
106
|
-
}
|
107
|
-
.Field > *:not(input) {
|
108
|
-
flex-grow: 0;
|
109
|
-
flex-shrink: 0;
|
110
|
-
}
|
111
|
-
.Fix {
|
112
|
-
display: flex;
|
113
|
-
align-items: center;
|
114
|
-
padding-inline: 0.75em;
|
115
|
-
font-size: 1em;
|
116
|
-
line-height: 1.5;
|
117
|
-
color: var(--text-subtle);
|
118
|
-
}
|
119
|
-
.Suffix {
|
120
|
-
padding-inline-start: 0;
|
121
|
-
}
|
122
|
-
.Prefix {
|
123
|
-
padding-inline-end: 0;
|
124
|
-
}
|
125
|
-
.Field:has(input:focus-visible),
|
126
|
-
.Field:has(select:focus-visible),
|
127
|
-
.Field:has(textarea:focus-visible) {
|
128
|
-
outline: var(--focus-outline);
|
129
|
-
}
|
130
|
-
.Field:has(input:focus-visible:user-invalid),
|
131
|
-
.Field:has(select:focus-visible:user-invalid),
|
132
|
-
.Field:has(textarea:focus-visible:user-invalid),
|
133
|
-
.Field.invalid:has(input:focus-visible) {
|
134
|
-
outline-color: var(--focus-color-error);
|
135
|
-
}
|
136
|
-
.Field.hasPrefix :global(input) {
|
137
|
-
padding-inline-start: 0.35em;
|
138
|
-
}
|
139
|
-
.Field :global(button) {
|
140
|
-
margin-right: 2px;
|
141
|
-
}
|
142
|
-
.Field :global(button:focus-visible) {
|
143
|
-
outline: var(--focus-outline);
|
144
|
-
outline-offset: 3px;
|
145
|
-
border-radius: calc(var(--field-radius) - 2px);
|
146
|
-
}
|
147
|
-
.Help {
|
148
|
-
font-size: 0.85em;
|
149
|
-
color: var(--text-subtle);
|
150
|
-
line-height: 1.4;
|
151
|
-
font-weight: 400;
|
152
|
-
}
|
153
|
-
</style>
|