lutra 0.0.33 → 0.1.4

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.
Files changed (274) hide show
  1. package/README.md +4 -24
  2. package/dist/components/AspectRatio.svelte +26 -0
  3. package/dist/components/AspectRatio.svelte.d.ts +8 -0
  4. package/dist/components/Avatar.svelte +105 -0
  5. package/dist/components/Avatar.svelte.d.ts +14 -0
  6. package/dist/{display → components}/Close.svelte +25 -7
  7. package/dist/components/Close.svelte.d.ts +7 -0
  8. package/dist/components/ContextTip.svelte +41 -0
  9. package/dist/components/ContextTip.svelte.d.ts +7 -0
  10. package/dist/components/Dialog.svelte +78 -0
  11. package/dist/components/Dialog.svelte.d.ts +14 -0
  12. package/dist/components/Icon.svelte +62 -0
  13. package/dist/components/Icon.svelte.d.ts +8 -0
  14. package/dist/{display → components}/IconButton.svelte +43 -14
  15. package/dist/components/IconButton.svelte.d.ts +16 -0
  16. package/dist/components/Image.svelte +172 -0
  17. package/dist/components/Image.svelte.d.ts +56 -0
  18. package/dist/{display → components}/Indicator.svelte +44 -9
  19. package/dist/components/Indicator.svelte.d.ts +12 -0
  20. package/dist/{display → components}/Inset.svelte +8 -3
  21. package/dist/components/Inset.svelte.d.ts +7 -0
  22. package/dist/components/Layout.svelte +33 -0
  23. package/dist/components/Layout.svelte.d.ts +11 -0
  24. package/dist/components/MenuDropdown.svelte +195 -0
  25. package/dist/components/MenuDropdown.svelte.d.ts +16 -0
  26. package/dist/{nav → components}/MenuItem.svelte +46 -38
  27. package/dist/components/MenuItem.svelte.d.ts +11 -0
  28. package/dist/components/MenuItemContent.svelte +25 -0
  29. package/dist/components/MenuItemContent.svelte.d.ts +10 -0
  30. package/dist/{nav → components}/MenuTypes.d.ts +19 -5
  31. package/dist/components/Modal.svelte +149 -0
  32. package/dist/components/Modal.svelte.d.ts +16 -0
  33. package/dist/{display → components}/Notification.svelte +33 -22
  34. package/dist/components/Notification.svelte.d.ts +12 -0
  35. package/dist/components/Overlay.svelte +31 -0
  36. package/dist/components/Overlay.svelte.d.ts +14 -0
  37. package/dist/{layout → components}/OverlayContainer.svelte +6 -3
  38. package/dist/{layout → components}/OverlayContainer.svelte.d.ts +4 -1
  39. package/dist/components/OverlayLayer.svelte +168 -0
  40. package/dist/components/OverlayLayer.svelte.d.ts +8 -0
  41. package/dist/components/PageContent.svelte +108 -0
  42. package/dist/components/PageContent.svelte.d.ts +38 -0
  43. package/dist/components/TabbedContent.svelte +74 -0
  44. package/dist/components/TabbedContent.svelte.d.ts +11 -0
  45. package/dist/components/TabbedContentItem.svelte +33 -0
  46. package/dist/components/TabbedContentItem.svelte.d.ts +10 -0
  47. package/dist/components/Table.svelte +41 -0
  48. package/dist/components/Table.svelte.d.ts +13 -0
  49. package/dist/{nav → components}/Tabs.svelte +99 -41
  50. package/dist/components/Tabs.svelte.d.ts +20 -0
  51. package/dist/components/Tag.svelte +120 -0
  52. package/dist/components/Tag.svelte.d.ts +21 -0
  53. package/dist/components/Theme.svelte +105 -0
  54. package/dist/components/Theme.svelte.d.ts +17 -0
  55. package/dist/{display → components}/Tooltip.svelte +41 -16
  56. package/dist/components/Tooltip.svelte.d.ts +12 -0
  57. package/dist/components/UIContent.svelte +19 -0
  58. package/dist/components/UIContent.svelte.d.ts +7 -0
  59. package/dist/components/index.d.ts +28 -0
  60. package/dist/components/index.js +29 -0
  61. package/dist/{display → components}/notifications.svelte.d.ts +1 -1
  62. package/dist/{display → components}/notifications.svelte.js +3 -4
  63. package/dist/{layout → components}/overlays.svelte.d.ts +4 -2
  64. package/dist/config.d.ts +30 -0
  65. package/dist/config.js +18 -0
  66. package/dist/css/1-props.css +440 -0
  67. package/dist/css/2-base.css +343 -0
  68. package/dist/css/3-typo.css +106 -0
  69. package/dist/css/4-layout.css +368 -0
  70. package/dist/css/5-media.css +116 -0
  71. package/dist/css/lutra.css +7 -0
  72. package/dist/css/themes/DefaultTheme.css +209 -0
  73. package/dist/form/Button.svelte +35 -16
  74. package/dist/form/Button.svelte.d.ts +8 -19
  75. package/dist/form/Datepicker.svelte +311 -0
  76. package/dist/form/Datepicker.svelte.d.ts +9 -0
  77. package/dist/form/FieldContent.svelte +69 -44
  78. package/dist/form/FieldContent.svelte.d.ts +7 -17
  79. package/dist/form/FieldError.svelte +16 -6
  80. package/dist/form/FieldError.svelte.d.ts +4 -15
  81. package/dist/form/Fieldset.svelte +48 -13
  82. package/dist/form/Fieldset.svelte.d.ts +5 -16
  83. package/dist/form/Form.svelte +158 -74
  84. package/dist/form/Form.svelte.d.ts +17 -17
  85. package/dist/form/{FieldActions.svelte → FormActions.svelte} +29 -17
  86. package/dist/form/FormActions.svelte.d.ts +9 -0
  87. package/dist/form/FormSection.svelte +96 -0
  88. package/dist/form/FormSection.svelte.d.ts +9 -0
  89. package/dist/form/ImageUpload.svelte +134 -94
  90. package/dist/form/ImageUpload.svelte.d.ts +5 -16
  91. package/dist/form/Input.svelte +254 -136
  92. package/dist/form/Input.svelte.d.ts +12 -21
  93. package/dist/form/InputLength.svelte +15 -5
  94. package/dist/form/InputLength.svelte.d.ts +4 -15
  95. package/dist/form/Label.svelte +55 -11
  96. package/dist/form/Label.svelte.d.ts +6 -15
  97. package/dist/form/LogoUpload.svelte +36 -21
  98. package/dist/form/LogoUpload.svelte.d.ts +4 -15
  99. package/dist/form/Select.svelte +100 -50
  100. package/dist/form/Select.svelte.d.ts +5 -16
  101. package/dist/form/Textarea.svelte +200 -98
  102. package/dist/form/Textarea.svelte.d.ts +11 -24
  103. package/dist/form/Toggle.svelte +3 -1
  104. package/dist/form/Toggle.svelte.d.ts +4 -1
  105. package/dist/form/client.svelte.d.ts +1 -0
  106. package/dist/form/client.svelte.js +6 -2
  107. package/dist/form/form.d.ts +10 -9
  108. package/dist/form/form.js +37 -32
  109. package/dist/form/index.d.ts +3 -4
  110. package/dist/form/index.js +3 -4
  111. package/dist/form/types.d.ts +9 -16
  112. package/dist/icons/IconAlert.svelte.d.ts +4 -1
  113. package/dist/icons/IconCopy.svelte.d.ts +4 -1
  114. package/dist/icons/IconDone.svelte.d.ts +4 -1
  115. package/dist/icons/IconError.svelte.d.ts +4 -1
  116. package/dist/icons/IconHelp.svelte.d.ts +4 -1
  117. package/dist/icons/IconHide.svelte.d.ts +4 -1
  118. package/dist/icons/IconInfo.svelte.d.ts +4 -1
  119. package/dist/icons/IconLink.svelte.d.ts +4 -1
  120. package/dist/icons/IconMenuBurger.svelte.d.ts +4 -1
  121. package/dist/icons/IconMenuDots.svelte.d.ts +4 -1
  122. package/dist/icons/IconSearch.svelte.d.ts +4 -1
  123. package/dist/icons/IconShow.svelte.d.ts +4 -1
  124. package/dist/icons/IconSuccess.svelte.d.ts +4 -1
  125. package/dist/icons/IconWarning.svelte.d.ts +4 -1
  126. package/dist/index.d.ts +3 -1
  127. package/dist/index.js +3 -2
  128. package/dist/types.d.ts +39 -0
  129. package/dist/types.js +25 -0
  130. package/dist/util/StringOrComponent.svelte +20 -0
  131. package/dist/util/StringOrComponent.svelte.d.ts +8 -0
  132. package/dist/util/StringOrSnippet.svelte +16 -0
  133. package/dist/util/StringOrSnippet.svelte.d.ts +8 -0
  134. package/dist/{utils → util}/dom.js +1 -2
  135. package/dist/util/locale.d.ts +1 -0
  136. package/dist/util/locale.js +47 -0
  137. package/dist/util/settings.d.ts +4 -0
  138. package/package.json +35 -79
  139. package/dist/color.css +0 -0
  140. package/dist/display/Avatar.svelte +0 -61
  141. package/dist/display/Avatar.svelte.d.ts +0 -19
  142. package/dist/display/Badge.svelte +0 -91
  143. package/dist/display/Badge.svelte.d.ts +0 -30
  144. package/dist/display/Callout.svelte +0 -109
  145. package/dist/display/Callout.svelte.d.ts +0 -28
  146. package/dist/display/Close.svelte.d.ts +0 -18
  147. package/dist/display/Code.svelte +0 -190
  148. package/dist/display/Code.svelte.d.ts +0 -32
  149. package/dist/display/ContextTip.svelte +0 -23
  150. package/dist/display/ContextTip.svelte.d.ts +0 -18
  151. package/dist/display/DataList.svelte +0 -16
  152. package/dist/display/DataList.svelte.d.ts +0 -21
  153. package/dist/display/Details.svelte +0 -49
  154. package/dist/display/Details.svelte.d.ts +0 -27
  155. package/dist/display/Hero.svelte +0 -50
  156. package/dist/display/Hero.svelte.d.ts +0 -26
  157. package/dist/display/Icon.svelte +0 -39
  158. package/dist/display/Icon.svelte.d.ts +0 -19
  159. package/dist/display/IconButton.svelte.d.ts +0 -27
  160. package/dist/display/Image.svelte +0 -91
  161. package/dist/display/Image.svelte.d.ts +0 -26
  162. package/dist/display/Indicator.svelte.d.ts +0 -23
  163. package/dist/display/Inset.svelte.d.ts +0 -18
  164. package/dist/display/LineChart.svelte +0 -385
  165. package/dist/display/LineChart.svelte.d.ts +0 -24
  166. package/dist/display/LoadingIndicator.svelte +0 -33
  167. package/dist/display/LoadingIndicator.svelte.d.ts +0 -15
  168. package/dist/display/Modal.svelte +0 -116
  169. package/dist/display/Modal.svelte.d.ts +0 -27
  170. package/dist/display/Notification.svelte.d.ts +0 -23
  171. package/dist/display/Panel.svelte +0 -23
  172. package/dist/display/Panel.svelte.d.ts +0 -19
  173. package/dist/display/Popup.svelte +0 -111
  174. package/dist/display/Popup.svelte.d.ts +0 -25
  175. package/dist/display/Stat.svelte +0 -81
  176. package/dist/display/Stat.svelte.d.ts +0 -30
  177. package/dist/display/Table.svelte +0 -28
  178. package/dist/display/Table.svelte.d.ts +0 -24
  179. package/dist/display/TablePaginator.svelte +0 -51
  180. package/dist/display/TablePaginator.svelte.d.ts +0 -21
  181. package/dist/display/Tag.svelte +0 -90
  182. package/dist/display/Tag.svelte.d.ts +0 -32
  183. package/dist/display/Tooltip.svelte.d.ts +0 -23
  184. package/dist/display/chart.d.ts +0 -78
  185. package/dist/display/chart.js +0 -212
  186. package/dist/display/index.d.ts +0 -24
  187. package/dist/display/index.js +0 -24
  188. package/dist/form/FieldActions.svelte.d.ts +0 -20
  189. package/dist/form/FieldContainer.svelte +0 -37
  190. package/dist/form/FieldContainer.svelte.d.ts +0 -19
  191. package/dist/form/FieldSection.svelte +0 -86
  192. package/dist/form/FieldSection.svelte.d.ts +0 -20
  193. package/dist/layout/Layout.svelte +0 -47
  194. package/dist/layout/Layout.svelte.d.ts +0 -22
  195. package/dist/layout/LayoutFooter.svelte +0 -21
  196. package/dist/layout/LayoutFooter.svelte.d.ts +0 -18
  197. package/dist/layout/LayoutGrid.svelte +0 -51
  198. package/dist/layout/LayoutGrid.svelte.d.ts +0 -27
  199. package/dist/layout/LayoutHeader.svelte +0 -97
  200. package/dist/layout/LayoutHeader.svelte.d.ts +0 -34
  201. package/dist/layout/LayoutSideMenu.svelte +0 -55
  202. package/dist/layout/LayoutSideMenu.svelte.d.ts +0 -21
  203. package/dist/layout/LayoutTypes.d.ts +0 -15
  204. package/dist/layout/LayoutTypes.js +0 -9
  205. package/dist/layout/Overlay.svelte +0 -20
  206. package/dist/layout/Overlay.svelte.d.ts +0 -25
  207. package/dist/layout/OverlayLayer.svelte +0 -140
  208. package/dist/layout/OverlayLayer.svelte.d.ts +0 -19
  209. package/dist/layout/PageContent.svelte +0 -82
  210. package/dist/layout/PageContent.svelte.d.ts +0 -25
  211. package/dist/layout/Theme.svelte +0 -243
  212. package/dist/layout/Theme.svelte.d.ts +0 -19
  213. package/dist/layout/UIContent.svelte +0 -15
  214. package/dist/layout/UIContent.svelte.d.ts +0 -18
  215. package/dist/layout/index.d.ts +0 -11
  216. package/dist/layout/index.js +0 -11
  217. package/dist/nav/Breadcrumb.svelte +0 -82
  218. package/dist/nav/Breadcrumb.svelte.d.ts +0 -28
  219. package/dist/nav/Menu.svelte +0 -170
  220. package/dist/nav/Menu.svelte.d.ts +0 -27
  221. package/dist/nav/MenuItem.svelte.d.ts +0 -22
  222. package/dist/nav/NavMenu.svelte +0 -181
  223. package/dist/nav/NavMenu.svelte.d.ts +0 -19
  224. package/dist/nav/TabbedContent.svelte +0 -43
  225. package/dist/nav/TabbedContent.svelte.d.ts +0 -23
  226. package/dist/nav/Tabs.svelte.d.ts +0 -25
  227. package/dist/nav/index.d.ts +0 -7
  228. package/dist/nav/index.js +0 -6
  229. package/dist/style.css +0 -950
  230. package/dist/typo/Clamp.svelte +0 -25
  231. package/dist/typo/Clamp.svelte.d.ts +0 -24
  232. package/dist/typo/H.svelte +0 -52
  233. package/dist/typo/H.svelte.d.ts +0 -28
  234. package/dist/typo/H1.svelte +0 -14
  235. package/dist/typo/H1.svelte.d.ts +0 -26
  236. package/dist/typo/H2.svelte +0 -14
  237. package/dist/typo/H2.svelte.d.ts +0 -26
  238. package/dist/typo/H3.svelte +0 -14
  239. package/dist/typo/H3.svelte.d.ts +0 -26
  240. package/dist/typo/H4.svelte +0 -14
  241. package/dist/typo/H4.svelte.d.ts +0 -26
  242. package/dist/typo/H5.svelte +0 -14
  243. package/dist/typo/H5.svelte.d.ts +0 -26
  244. package/dist/typo/H6.svelte +0 -14
  245. package/dist/typo/H6.svelte.d.ts +0 -26
  246. package/dist/typo/P.svelte +0 -34
  247. package/dist/typo/P.svelte.d.ts +0 -26
  248. package/dist/typo/index.d.ts +0 -9
  249. package/dist/typo/index.js +0 -9
  250. package/dist/utils/StringOrComponent.svelte +0 -14
  251. package/dist/utils/StringOrComponent.svelte.d.ts +0 -19
  252. package/dist/utils/StringOrSnippet.svelte +0 -11
  253. package/dist/utils/StringOrSnippet.svelte.d.ts +0 -19
  254. package/dist/utils/defaults.d.ts +0 -4
  255. package/dist/utils/hooks.server.d.ts +0 -2
  256. package/dist/utils/hooks.server.js +0 -16
  257. package/dist/utils/id.d.ts +0 -1
  258. package/dist/utils/id.js +0 -3
  259. package/dist/utils/index.d.ts +0 -9
  260. package/dist/utils/index.js +0 -6
  261. package/dist/utils/isSnippet.d.ts +0 -3
  262. package/dist/utils/isSnippet.js +0 -11
  263. /package/dist/{nav → components}/MenuTypes.js +0 -0
  264. /package/dist/{layout → components}/overlays.svelte.js +0 -0
  265. /package/dist/{utils → util}/attr.d.ts +0 -0
  266. /package/dist/{utils → util}/attr.js +0 -0
  267. /package/dist/{utils → util}/color.d.ts +0 -0
  268. /package/dist/{utils → util}/color.js +0 -0
  269. /package/dist/{utils → util}/dom.d.ts +0 -0
  270. /package/dist/{utils → util}/keyboard.svelte.d.ts +0 -0
  271. /package/dist/{utils → util}/keyboard.svelte.js +0 -0
  272. /package/dist/{utils/defaults.js → util/settings.js} +0 -0
  273. /package/dist/{utils → util}/transitions.d.ts +0 -0
  274. /package/dist/{utils → util}/transitions.js +0 -0
@@ -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
- }
@@ -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,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,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,86 +0,0 @@
1
- <script lang="ts">import H5 from "../typo/H5.svelte";
2
- import P from "../typo/P.svelte";
3
- let {
4
- title,
5
- description,
6
- children
7
- } = $props();
8
- </script>
9
-
10
- <div class="FieldSection" class:noTitle={!title && !description}>
11
- {#if title || description}
12
- <div class="FieldSectionTitle">
13
- {#if title}
14
- {#if typeof title === "string"}
15
- <H5>{title}</H5>
16
- {:else}
17
- {@render title()}
18
- {/if}
19
- {/if}
20
- {#if description}
21
- {#if typeof description === "string"}
22
- <small>{description}</small>
23
- {:else}
24
- {@render description()}
25
- {/if}
26
- {/if}
27
- </div>
28
- {/if}
29
- <div class="FieldSectionFields">
30
- {@render children()}
31
- </div>
32
- </div>
33
-
34
- <style>
35
- .FieldSection {
36
- padding: 0;
37
- display: grid;
38
- grid-template-columns: subgrid;
39
- grid-column: 1 / -1;
40
- padding: calc(var(--fcc) * 3em);
41
- gap: 3em;
42
- }
43
- .FieldSectionTitle {
44
- display: flex;
45
- flex-direction: column;
46
- background-color: var(--base);
47
- gap: 1.25em;
48
- text-wrap: balance;
49
- }
50
- .FieldSection:not(:first-child) {
51
- border-top: calc(var(--fcc) * var(--border-size)) var(--border-style) var(--border-color);
52
- }
53
- .FieldSectionFields {
54
- display: grid;
55
- gap: var(--gap, 1.5em);
56
- }
57
- .FieldSection.noTitle .FieldSectionFields {
58
- grid-column: 1 / -1;
59
- }
60
- @media(max-width: 1280px) {
61
- .FieldSection {
62
- padding: 2em;
63
- gap: 1.5em;
64
- }
65
- .FieldSectionTitle {
66
- gap: 0.5em;
67
- padding-block-end: 1.5em;
68
- }
69
- }
70
- @media(max-width: 640px) {
71
- .FieldSection {
72
- padding: 1em;
73
- gap: 1.5em;
74
- }
75
- .FieldSectionTitle {
76
- gap: 0.5em;
77
- padding-block-end: 1.5em;
78
- }
79
- }
80
- @container (max-width: 800px) {
81
- .FieldSectionTitle,
82
- .FieldSectionFields {
83
- grid-column: 1 / -1;
84
- }
85
- }
86
- </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 FieldSection: $$__sveltets_2_IsomorphicComponent<{
13
- title?: string | Snippet;
14
- description?: string | Snippet;
15
- children: Snippet;
16
- }, {
17
- [evt: string]: CustomEvent<any>;
18
- }, {}, {}, "">;
19
- type FieldSection = InstanceType<typeof FieldSection>;
20
- export default FieldSection;
@@ -1,47 +0,0 @@
1
- <script lang="ts">import "../style.css";
2
- import Theme from "./Theme.svelte";
3
- import OverlayContainer from "./OverlayContainer.svelte";
4
- let {
5
- theme,
6
- children
7
- } = $props();
8
- </script>
9
-
10
- <!-- This is an SVG filter that makes text black or white based on the luminance of the background. -->
11
- <svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="0" style="position:absolute; height:0; width:0; display: contents;">
12
- <defs>
13
- <filter id="bwFilter" color-interpolation-filters="sRGB">
14
- <!-- Convert to grayscale based on luminance -->
15
- <feColorMatrix type="matrix"
16
- values="0.2126 0.7152 0.0722 0 0
17
- 0.2126 0.7152 0.0722 0 0
18
- 0.2126 0.7152 0.0722 0 0
19
- 0 0 0 1 0"/>
20
- <!-- Expand edges slightly to clean up any fringing -->
21
- <feMorphology operator="dilate" radius="2"/>
22
- <!-- Apply the threshold to determine if the color should be black or white -->
23
- <feComponentTransfer>
24
- <feFuncR type="linear" slope="-255" intercept="128"/>
25
- <feFuncG type="linear" slope="-255" intercept="128"/>
26
- <feFuncB type="linear" slope="-255" intercept="128"/>
27
- </feComponentTransfer>
28
- <!-- Composite step to clean up the result -->
29
- <feComposite operator="in" in2="SourceGraphic"/>
30
- </filter>
31
- </defs>
32
- </svg>
33
-
34
- <Theme theme={theme}>
35
- <div class="Layout">
36
- {@render children()}
37
- <OverlayContainer />
38
- </div>
39
- </Theme>
40
-
41
- <style>
42
- .Layout {
43
- background: var(--bg-app);
44
- min-height: 100%;
45
- height: 100%;
46
- }
47
- </style>
@@ -1,22 +0,0 @@
1
- import type { Snippet } from "svelte";
2
- import "../style.css";
3
- 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> {
4
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
5
- $$bindings?: Bindings;
6
- } & Exports;
7
- (internal: unknown, props: Props & {
8
- $$events?: Events;
9
- $$slots?: Slots;
10
- }): Exports;
11
- z_$$bindings?: Bindings;
12
- }
13
- declare const Layout: $$__sveltets_2_IsomorphicComponent<{
14
- /** The theme to use for the layout. Leave empty to detect automatically or get from user preferences, if any exist. */
15
- theme?: "light" | "dark" | undefined;
16
- /** The content to display. */
17
- children: Snippet;
18
- }, {
19
- [evt: string]: CustomEvent<any>;
20
- }, {}, {}, "">;
21
- type Layout = InstanceType<typeof Layout>;
22
- export default Layout;
@@ -1,21 +0,0 @@
1
- <script lang="ts">let {
2
- copyright
3
- } = $props();
4
- </script>
5
-
6
- <footer>
7
- <p>&copy; {new Date().getFullYear()} {copyright}. All rights reserved.</p>
8
- </footer>
9
-
10
- <style>
11
- footer {
12
- padding: var(--padding, 4rem 4rem);
13
- font-size: 0.85em;
14
- color: var(--text-subtle);
15
- }
16
- @media (max-width: 640px) {
17
- footer {
18
- padding: calc(var(--padding, 4rem) / 2);
19
- }
20
- }
21
- </style>
@@ -1,18 +0,0 @@
1
- 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> {
2
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
- $$bindings?: Bindings;
4
- } & Exports;
5
- (internal: unknown, props: Props & {
6
- $$events?: Events;
7
- $$slots?: Slots;
8
- }): Exports;
9
- z_$$bindings?: Bindings;
10
- }
11
- declare const LayoutFooter: $$__sveltets_2_IsomorphicComponent<{
12
- /** The copyright text to display. */
13
- copyright?: string;
14
- }, {
15
- [evt: string]: CustomEvent<any>;
16
- }, {}, {}, "">;
17
- type LayoutFooter = InstanceType<typeof LayoutFooter>;
18
- export default LayoutFooter;
@@ -1,51 +0,0 @@
1
- <script lang="ts">import { setContext } from "svelte";
2
- let {
3
- children,
4
- header,
5
- footer,
6
- border,
7
- sticky
8
- } = $props();
9
- </script>
10
-
11
- <div class="LayoutGrid" class:footer class:header class:border>
12
- {#if header}
13
- {@render header()}
14
- {/if}
15
- <main>
16
- {@render children()}
17
- </main>
18
- {#if footer}
19
- {@render footer()}
20
- {/if}
21
- </div>
22
-
23
- <style>
24
- .LayoutGrid {
25
- display: grid;
26
- container-type: inline-size;
27
- -webkit-overflow-scrolling: touch;
28
- min-block-size: var(--min-block-size, 100%);
29
- background-color: var(--bg-app);
30
- }
31
- .LayoutGrid.footer.header {
32
- grid-template-rows: auto 1fr auto;
33
- }
34
- .LayoutGrid.header {
35
- grid-template-rows: auto 1fr;
36
- }
37
- .LayoutGrid.footer {
38
- grid-template-rows: 1fr auto;
39
- }
40
- header.sticky {
41
- position: sticky;
42
- top: 0;
43
- z-index: 10;
44
- }
45
- .LayoutGrid.border header {
46
- border-block-end: var(--header-border, var(--border-subtle));
47
- }
48
- .LayoutGrid.border footer {
49
- border-block-start: var(--footer-border, var(--border-subtle));
50
- }
51
- </style>
@@ -1,27 +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 LayoutGrid: $$__sveltets_2_IsomorphicComponent<{
13
- /** The header of the grid. */
14
- header?: Snippet;
15
- /** The footer of the grid. */
16
- footer?: Snippet;
17
- /** Add a subtle border to the header and footer. */
18
- border?: boolean;
19
- /** Make the header sticky. */
20
- sticky?: boolean;
21
- /** The main content of the grid. */
22
- children: Snippet;
23
- }, {
24
- [evt: string]: CustomEvent<any>;
25
- }, {}, {}, "">;
26
- type LayoutGrid = InstanceType<typeof LayoutGrid>;
27
- export default LayoutGrid;