lutra 0.0.1
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 +29 -0
- package/dist/Data/Stat.svelte +89 -0
- package/dist/Data/Stat.svelte.d.ts +33 -0
- package/dist/DataTable/DataTable.svelte +36 -0
- package/dist/DataTable/DataTable.svelte.d.ts +19 -0
- package/dist/DataTable/DataTableColumn.svelte +20 -0
- package/dist/DataTable/DataTableColumn.svelte.d.ts +18 -0
- package/dist/DataTable/DataTableRow.svelte +28 -0
- package/dist/DataTable/DataTableRow.svelte.d.ts +18 -0
- package/dist/Display/Avatar.svelte +61 -0
- package/dist/Display/Avatar.svelte.d.ts +18 -0
- package/dist/Display/Badge.svelte +93 -0
- package/dist/Display/Badge.svelte.d.ts +30 -0
- package/dist/Display/Callout.svelte +105 -0
- package/dist/Display/Callout.svelte.d.ts +34 -0
- package/dist/Display/Code.svelte +195 -0
- package/dist/Display/Code.svelte.d.ts +29 -0
- package/dist/Display/ContextTip.svelte +23 -0
- package/dist/Display/ContextTip.svelte.d.ts +17 -0
- package/dist/Display/Details.svelte +49 -0
- package/dist/Display/Details.svelte.d.ts +26 -0
- package/dist/Display/Hero.svelte +50 -0
- package/dist/Display/Hero.svelte.d.ts +25 -0
- package/dist/Display/Icon.svelte +35 -0
- package/dist/Display/Icon.svelte.d.ts +18 -0
- package/dist/Display/IconButton.svelte +85 -0
- package/dist/Display/IconButton.svelte.d.ts +28 -0
- package/dist/Display/Indicator.svelte +352 -0
- package/dist/Display/Indicator.svelte.d.ts +22 -0
- package/dist/Display/Popup.svelte +111 -0
- package/dist/Display/Popup.svelte.d.ts +26 -0
- package/dist/Display/Tag.svelte +90 -0
- package/dist/Display/Tag.svelte.d.ts +31 -0
- package/dist/Display/Tooltip.svelte +96 -0
- package/dist/Display/Tooltip.svelte.d.ts +22 -0
- package/dist/Form/Button.svelte +34 -0
- package/dist/Form/Button.svelte.d.ts +24 -0
- package/dist/Form/FieldActions.svelte +25 -0
- package/dist/Form/FieldActions.svelte.d.ts +17 -0
- package/dist/Form/FieldContainer.svelte +31 -0
- package/dist/Form/FieldContainer.svelte.d.ts +18 -0
- package/dist/Form/FieldContent.svelte +78 -0
- package/dist/Form/FieldContent.svelte.d.ts +32 -0
- package/dist/Form/FieldSection.svelte +97 -0
- package/dist/Form/FieldSection.svelte.d.ts +23 -0
- package/dist/Form/Fieldset.svelte +63 -0
- package/dist/Form/Fieldset.svelte.d.ts +32 -0
- package/dist/Form/Form.svelte +19 -0
- package/dist/Form/Form.svelte.d.ts +18 -0
- package/dist/Form/Input.svelte +266 -0
- package/dist/Form/Input.svelte.d.ts +113 -0
- package/dist/Form/InputLength.svelte +32 -0
- package/dist/Form/InputLength.svelte.d.ts +19 -0
- package/dist/Form/Label.svelte +26 -0
- package/dist/Form/Label.svelte.d.ts +25 -0
- package/dist/Form/Select.svelte +24 -0
- package/dist/Form/Select.svelte.d.ts +28 -0
- package/dist/Form/form.d.ts +34 -0
- package/dist/Form/form.js +31 -0
- package/dist/Form/types.d.ts +4 -0
- package/dist/Form/types.js +1 -0
- package/dist/Grid/Column.svelte +11 -0
- package/dist/Grid/Column.svelte.d.ts +17 -0
- package/dist/Grid/Grid.svelte +19 -0
- package/dist/Grid/Grid.svelte.d.ts +18 -0
- package/dist/Grid/Row.svelte +44 -0
- package/dist/Grid/Row.svelte.d.ts +19 -0
- package/dist/Icons/Alert.svelte +3 -0
- package/dist/Icons/Alert.svelte.d.ts +23 -0
- package/dist/Icons/Copy.svelte +3 -0
- package/dist/Icons/Copy.svelte.d.ts +23 -0
- package/dist/Icons/Done.svelte +3 -0
- package/dist/Icons/Done.svelte.d.ts +23 -0
- package/dist/Icons/Error.svelte +3 -0
- package/dist/Icons/Error.svelte.d.ts +23 -0
- package/dist/Icons/Help.svelte +3 -0
- package/dist/Icons/Help.svelte.d.ts +23 -0
- package/dist/Icons/Hide.svelte +3 -0
- package/dist/Icons/Hide.svelte.d.ts +23 -0
- package/dist/Icons/Info.svelte +3 -0
- package/dist/Icons/Info.svelte.d.ts +23 -0
- package/dist/Icons/Link.svelte +3 -0
- package/dist/Icons/Link.svelte.d.ts +23 -0
- package/dist/Icons/Show.svelte +3 -0
- package/dist/Icons/Show.svelte.d.ts +23 -0
- package/dist/Icons/Success.svelte +3 -0
- package/dist/Icons/Success.svelte.d.ts +23 -0
- package/dist/Icons/Warning.svelte +3 -0
- package/dist/Icons/Warning.svelte.d.ts +23 -0
- package/dist/Layout/Layout.svelte +43 -0
- package/dist/Layout/Layout.svelte.d.ts +21 -0
- package/dist/Layout/LayoutFooter.svelte +21 -0
- package/dist/Layout/LayoutFooter.svelte.d.ts +17 -0
- package/dist/Layout/LayoutGrid.svelte +51 -0
- package/dist/Layout/LayoutGrid.svelte.d.ts +30 -0
- package/dist/Layout/LayoutHeader.svelte +94 -0
- package/dist/Layout/LayoutHeader.svelte.d.ts +38 -0
- package/dist/Layout/LayoutTypes.svelte.d.ts +15 -0
- package/dist/Layout/LayoutTypes.svelte.js +9 -0
- package/dist/Layout/PageContent.svelte +89 -0
- package/dist/Layout/PageContent.svelte.d.ts +23 -0
- package/dist/Layout/Theme.svelte +215 -0
- package/dist/Layout/Theme.svelte.d.ts +18 -0
- package/dist/Layout/UIContent.svelte +15 -0
- package/dist/Layout/UIContent.svelte.d.ts +17 -0
- package/dist/Navigation/Breadcrumb.svelte +82 -0
- package/dist/Navigation/Breadcrumb.svelte.d.ts +29 -0
- package/dist/Navigation/Menu.svelte +180 -0
- package/dist/Navigation/Menu.svelte.d.ts +18 -0
- package/dist/Navigation/MenuTypes.svelte.d.ts +37 -0
- package/dist/Navigation/MenuTypes.svelte.js +1 -0
- package/dist/Navigation/TabbedContent.svelte +43 -0
- package/dist/Navigation/TabbedContent.svelte.d.ts +22 -0
- package/dist/Navigation/Tabs.svelte +118 -0
- package/dist/Navigation/Tabs.svelte.d.ts +24 -0
- package/dist/Pages/LoginPage.svelte +32 -0
- package/dist/Pages/LoginPage.svelte.d.ts +14 -0
- package/dist/Typography/Clamp.svelte +25 -0
- package/dist/Typography/Clamp.svelte.d.ts +23 -0
- package/dist/Typography/H.svelte +51 -0
- package/dist/Typography/H.svelte.d.ts +25 -0
- package/dist/Typography/H1.svelte +14 -0
- package/dist/Typography/H1.svelte.d.ts +23 -0
- package/dist/Typography/H2.svelte +13 -0
- package/dist/Typography/H2.svelte.d.ts +23 -0
- package/dist/Typography/H3.svelte +13 -0
- package/dist/Typography/H3.svelte.d.ts +23 -0
- package/dist/Typography/H4.svelte +13 -0
- package/dist/Typography/H4.svelte.d.ts +23 -0
- package/dist/Typography/H5.svelte +13 -0
- package/dist/Typography/H5.svelte.d.ts +23 -0
- package/dist/Typography/H6.svelte +13 -0
- package/dist/Typography/H6.svelte.d.ts +23 -0
- package/dist/Typography/P.svelte +32 -0
- package/dist/Typography/P.svelte.d.ts +23 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/style.css +787 -0
- package/dist/utils/attr.d.ts +5 -0
- package/dist/utils/attr.js +21 -0
- package/dist/utils/color.d.ts +51 -0
- package/dist/utils/color.js +97 -0
- package/dist/utils/defaults.d.ts +4 -0
- package/dist/utils/defaults.js +1 -0
- package/dist/utils/hooks.server.d.ts +2 -0
- package/dist/utils/hooks.server.js +16 -0
- package/dist/utils/id.d.ts +1 -0
- package/dist/utils/id.js +3 -0
- package/dist/utils/isSnippet.d.ts +5 -0
- package/dist/utils/isSnippet.js +6 -0
- package/dist/utils/transitions.d.ts +29 -0
- package/dist/utils/transitions.js +66 -0
- package/package.json +58 -0
@@ -0,0 +1,5 @@
|
|
1
|
+
/**
|
2
|
+
* Node attribute helper. This is used to create a function that will set e.g. aria attributes on an element.
|
3
|
+
* @returns {Function} - The function to set the aria attributes. Pass this as `attr(opts)` to a child which can use it with `use:attr`.
|
4
|
+
*/
|
5
|
+
export declare function attr(opts: Record<string, any>): (node: Element) => void;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
/**
|
2
|
+
* Node attribute helper. This is used to create a function that will set e.g. aria attributes on an element.
|
3
|
+
* @returns {Function} - The function to set the aria attributes. Pass this as `attr(opts)` to a child which can use it with `use:attr`.
|
4
|
+
*/
|
5
|
+
export function attr(opts) {
|
6
|
+
return function (node) {
|
7
|
+
for (const [key, value] of Object.entries(opts)) {
|
8
|
+
if (key.startsWith('on')) {
|
9
|
+
node.addEventListener(key.slice(2).toLowerCase(), value);
|
10
|
+
}
|
11
|
+
else {
|
12
|
+
if (value === false) {
|
13
|
+
node.removeAttribute(key);
|
14
|
+
}
|
15
|
+
else {
|
16
|
+
node.setAttribute(key, value);
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
};
|
21
|
+
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
/**
|
2
|
+
* Convert a string to a color
|
3
|
+
* @param {string} str - The string to convert
|
4
|
+
* @returns {string} The color
|
5
|
+
*/
|
6
|
+
export declare function stringToColor(str: string): string;
|
7
|
+
/**
|
8
|
+
* Convert a hex color to rgb
|
9
|
+
* @param {string} hex - The hex color
|
10
|
+
* @returns {number[]} The rgb color
|
11
|
+
*/
|
12
|
+
export declare function hexToRgb(hex: string): number[];
|
13
|
+
/**
|
14
|
+
* Get the relative luminance of a color from a hex color
|
15
|
+
* @param {string} hex - The hex color
|
16
|
+
* @returns {number} The relative luminance
|
17
|
+
*/
|
18
|
+
export declare function hexRelativeLuminance(hex: string): number;
|
19
|
+
/**
|
20
|
+
* Get the relative luminance of a color according to the W3C
|
21
|
+
* @param {number} R8bit - The red value
|
22
|
+
* @param {number} G8bit - The green value
|
23
|
+
* @param {number} B8bit - The blue value
|
24
|
+
* @returns
|
25
|
+
*/
|
26
|
+
export declare function relativeLuminanceW3C(R8bit: number, G8bit: number, B8bit: number): number;
|
27
|
+
/**
|
28
|
+
* Status colors
|
29
|
+
*/
|
30
|
+
export declare const StatusColors: {
|
31
|
+
readonly default: "default";
|
32
|
+
readonly ok: "ok";
|
33
|
+
readonly alert: "alert";
|
34
|
+
readonly warn: "warn";
|
35
|
+
readonly info: "info";
|
36
|
+
readonly task: "task";
|
37
|
+
};
|
38
|
+
export type StatusColor = keyof typeof StatusColors;
|
39
|
+
export type StatusColorOrString = StatusColor | (string & {});
|
40
|
+
/**
|
41
|
+
* Check if the value is a valid StatusColor
|
42
|
+
* @param {string} value - The value to check
|
43
|
+
* @returns {boolean} - If the value is a valid StatusColor
|
44
|
+
*/
|
45
|
+
export declare const isStatusColor: (value?: string) => value is "default" | "ok" | "alert" | "warn" | "info" | "task";
|
46
|
+
/**
|
47
|
+
* Get the CSS variable for a status color
|
48
|
+
* @param {StatusColorOrString} color - The status color
|
49
|
+
* @returns {string} - The CSS variable for the status color
|
50
|
+
*/
|
51
|
+
export declare function getStatusColorVar(color?: StatusColorOrString, fallback?: string): string;
|
@@ -0,0 +1,97 @@
|
|
1
|
+
/**
|
2
|
+
* Convert a string to a color
|
3
|
+
* @param {string} str - The string to convert
|
4
|
+
* @returns {string} The color
|
5
|
+
*/
|
6
|
+
export function stringToColor(str) {
|
7
|
+
let hash = 0;
|
8
|
+
for (let i = 0; i < str.length; i++) {
|
9
|
+
hash = str.charCodeAt(i) + ((hash << 5) - hash);
|
10
|
+
}
|
11
|
+
let color = '#';
|
12
|
+
for (let i = 0; i < 3; i++) {
|
13
|
+
const value = (hash >> (i * 8)) & 0xFF;
|
14
|
+
color += ('00' + value.toString(16)).substr(-2);
|
15
|
+
}
|
16
|
+
return color;
|
17
|
+
}
|
18
|
+
/**
|
19
|
+
* Convert a hex color to rgb
|
20
|
+
* @param {string} hex - The hex color
|
21
|
+
* @returns {number[]} The rgb color
|
22
|
+
*/
|
23
|
+
export function hexToRgb(hex) {
|
24
|
+
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
|
25
|
+
var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
26
|
+
hex = hex.replace(shorthandRegex, function (m, r, g, b) {
|
27
|
+
return r + r + g + g + b + b;
|
28
|
+
});
|
29
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
30
|
+
if (!result) {
|
31
|
+
throw new Error('Invalid hex color');
|
32
|
+
}
|
33
|
+
return [
|
34
|
+
parseInt(result[1], 16),
|
35
|
+
parseInt(result[2], 16),
|
36
|
+
parseInt(result[3], 16)
|
37
|
+
];
|
38
|
+
}
|
39
|
+
/**
|
40
|
+
* Get the relative luminance of a color from a hex color
|
41
|
+
* @param {string} hex - The hex color
|
42
|
+
* @returns {number} The relative luminance
|
43
|
+
*/
|
44
|
+
export function hexRelativeLuminance(hex) {
|
45
|
+
const rgb = hexToRgb(hex);
|
46
|
+
return relativeLuminanceW3C(rgb[0], rgb[1], rgb[2]);
|
47
|
+
}
|
48
|
+
/**
|
49
|
+
* Get the relative luminance of a color according to the W3C
|
50
|
+
* @param {number} R8bit - The red value
|
51
|
+
* @param {number} G8bit - The green value
|
52
|
+
* @param {number} B8bit - The blue value
|
53
|
+
* @returns
|
54
|
+
*/
|
55
|
+
export function relativeLuminanceW3C(R8bit, G8bit, B8bit) {
|
56
|
+
var RsRGB = R8bit / 255;
|
57
|
+
var GsRGB = G8bit / 255;
|
58
|
+
var BsRGB = B8bit / 255;
|
59
|
+
var R = (RsRGB <= 0.03928) ? RsRGB / 12.92 : Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
60
|
+
var G = (GsRGB <= 0.03928) ? GsRGB / 12.92 : Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
61
|
+
var B = (BsRGB <= 0.03928) ? BsRGB / 12.92 : Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
62
|
+
// For the sRGB colorspace, the relative luminance of a color is defined as:
|
63
|
+
var L = 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
64
|
+
return L;
|
65
|
+
}
|
66
|
+
/**
|
67
|
+
* Status colors
|
68
|
+
*/
|
69
|
+
export const StatusColors = {
|
70
|
+
default: "default",
|
71
|
+
ok: "ok",
|
72
|
+
alert: "alert",
|
73
|
+
warn: "warn",
|
74
|
+
info: "info",
|
75
|
+
task: "task"
|
76
|
+
};
|
77
|
+
/**
|
78
|
+
* Check if the value is a valid StatusColor
|
79
|
+
* @param {string} value - The value to check
|
80
|
+
* @returns {boolean} - If the value is a valid StatusColor
|
81
|
+
*/
|
82
|
+
export const isStatusColor = (value) => {
|
83
|
+
if (!value)
|
84
|
+
return false;
|
85
|
+
return Object.keys(StatusColors).includes(value);
|
86
|
+
};
|
87
|
+
/**
|
88
|
+
* Get the CSS variable for a status color
|
89
|
+
* @param {StatusColorOrString} color - The status color
|
90
|
+
* @returns {string} - The CSS variable for the status color
|
91
|
+
*/
|
92
|
+
export function getStatusColorVar(color, fallback) {
|
93
|
+
if (isStatusColor(color)) {
|
94
|
+
return `var(--status-${color})`;
|
95
|
+
}
|
96
|
+
return color || fallback || "var(--status-default)";
|
97
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
const acceptCh = [
|
2
|
+
'Sec-CH-Prefers-Color-Scheme',
|
3
|
+
'Sec-CH-Prefers-Reduced-Transparency',
|
4
|
+
'Sec-CH-Prefers-Reduced-Motion',
|
5
|
+
'Sec-CH-UA-Arch',
|
6
|
+
'Sec-CH-UA-Bitness',
|
7
|
+
'Sec-CH-UA-Mobile',
|
8
|
+
'Sec-CH-UA-Model',
|
9
|
+
'Sec-CH-UA-Platform',
|
10
|
+
'Sec-CH-UA-Platform-Version',
|
11
|
+
];
|
12
|
+
export const addAcceptCh = (event) => {
|
13
|
+
event.setHeaders({
|
14
|
+
'Accept-CH': acceptCh.join(', ')
|
15
|
+
});
|
16
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function createId(): string;
|
package/dist/utils/id.js
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
import type { ComponentType } from "svelte";
|
2
|
+
export declare const isSnippet: (object: unknown) => object is (this: void) => typeof import("svelte").SnippetReturn & {
|
3
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
4
|
+
};
|
5
|
+
export declare const isComponent: (object: unknown) => object is ComponentType;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
/**
|
2
|
+
* A bezier curve that starts fast and slows down.
|
3
|
+
*/
|
4
|
+
export declare const popBezier: (t: number) => number;
|
5
|
+
export declare const popBezierInverse: (t: number) => number;
|
6
|
+
export declare function slidefade(node: Element, params?: {
|
7
|
+
origin?: string;
|
8
|
+
x?: number;
|
9
|
+
y?: number;
|
10
|
+
delay?: number;
|
11
|
+
duration?: number;
|
12
|
+
easing?: (t: number) => number;
|
13
|
+
}): {
|
14
|
+
delay: number;
|
15
|
+
duration: number;
|
16
|
+
easing: (t: number) => number;
|
17
|
+
css: (t: number, u: number) => string;
|
18
|
+
};
|
19
|
+
/** MIT License github.com/pushkine/ */
|
20
|
+
export interface SpringParams {
|
21
|
+
mass?: number;
|
22
|
+
damping?: number;
|
23
|
+
stiffness?: number;
|
24
|
+
soft?: boolean;
|
25
|
+
}
|
26
|
+
type seconds = number;
|
27
|
+
export declare function solve_spring(from: number, velocity: number, to: number, _params: SpringParams): (t: seconds) => number;
|
28
|
+
export declare function cubicBezier(x1: number, y1: number, x2: number, y2: number): (t: number) => number;
|
29
|
+
export {};
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import { cubicOut } from 'svelte/easing';
|
2
|
+
let visibleDoubleElements = false;
|
3
|
+
/**
|
4
|
+
* A bezier curve that starts fast and slows down.
|
5
|
+
*/
|
6
|
+
export const popBezier = cubicBezier(0.25, 0.25, 0.75, 1);
|
7
|
+
export const popBezierInverse = cubicBezier(0.75, 0.75, 0.25, 0);
|
8
|
+
export function slidefade(node, params = {}) {
|
9
|
+
const existingTransform = getComputedStyle(node).transform.replace('none', '');
|
10
|
+
const existingMarginTop = getComputedStyle(node).paddingTop;
|
11
|
+
const x = params.x || -5;
|
12
|
+
const y = params.y || -5;
|
13
|
+
return {
|
14
|
+
delay: params.delay || 0,
|
15
|
+
duration: params.duration || 400,
|
16
|
+
easing: params.easing || popBezier,
|
17
|
+
css: (t, u) => `transform-origin: ${params.origin || "top left"}; transform: ${existingTransform}; scale: ${t / 10 + 0.9}; padding-top: calc(${existingMarginTop} + ${y * u}px); opacity: ${t};`,
|
18
|
+
};
|
19
|
+
}
|
20
|
+
export function solve_spring(from, velocity, to, _params) {
|
21
|
+
const params = {
|
22
|
+
mass: _params.mass || 1.0,
|
23
|
+
damping: _params.damping || 10.0,
|
24
|
+
stiffness: _params.stiffness || 100.0,
|
25
|
+
soft: _params.soft || false,
|
26
|
+
};
|
27
|
+
const delta = to - from;
|
28
|
+
if (true === params.soft || 1.0 <= params.damping / (2.0 * Math.sqrt(params.stiffness * params.mass))) {
|
29
|
+
const angular_frequency = -Math.sqrt(params.stiffness / params.mass);
|
30
|
+
const leftover = -angular_frequency * delta - velocity;
|
31
|
+
return (t) => to - (delta + t * leftover) * Math.E ** (t * angular_frequency);
|
32
|
+
}
|
33
|
+
else {
|
34
|
+
const damping_frequency = Math.sqrt(4.0 * params.mass * params.stiffness - params.damping ** 2.0);
|
35
|
+
const leftover = (params.damping * delta - 2.0 * params.mass * velocity) / damping_frequency;
|
36
|
+
const dfm = (0.5 * damping_frequency) / params.mass;
|
37
|
+
const dm = -(0.5 * params.damping) / params.mass;
|
38
|
+
return (t) => to - (Math.cos(t * dfm) * delta + Math.sin(t * dfm) * leftover) * Math.E ** (t * dm);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
export function cubicBezier(x1, y1, x2, y2) {
|
42
|
+
if (!(x1 >= 0 && x1 <= 1 && x2 >= 0 && x2 <= 1))
|
43
|
+
throw new Error(`CubicBezier x1 & x2 values must be { 0 < x < 1 }, got { x1 : ${x1}, x2: ${x2} }`);
|
44
|
+
const ax = 1.0 - (x2 = 3.0 * (x2 - x1) - (x1 *= 3.0)) - x1, ay = 1.0 - (y2 = 3.0 * (y2 - y1) - (y1 *= 3.0)) - y1;
|
45
|
+
let i = 0, r = 0.0, s = 0.0, d = 0.0, x = 0.0;
|
46
|
+
return (t) => {
|
47
|
+
for (r = t, i = 0; 32 > i; i++)
|
48
|
+
if (1e-5 > Math.abs((x = r * (r * (r * ax + x2) + x1) - t)))
|
49
|
+
return r * (r * (r * ay + y2) + y1);
|
50
|
+
else if (1e-5 > Math.abs((d = r * (r * ax * 3.0 + x2 * 2.0) + x1)))
|
51
|
+
break;
|
52
|
+
else
|
53
|
+
r -= x / d;
|
54
|
+
if ((s = 0.0) > (r = t))
|
55
|
+
return 0;
|
56
|
+
else if ((d = 1.0) < r)
|
57
|
+
return 1;
|
58
|
+
while (d > s)
|
59
|
+
if (1e-5 > Math.abs((x = r * (r * (r * ax + x2) + x1)) - t))
|
60
|
+
break;
|
61
|
+
else
|
62
|
+
t > x ? (s = r) : (d = r), (r = 0.5 * (d - s) + s);
|
63
|
+
return r * (r * (r * ay + y2) + y1);
|
64
|
+
};
|
65
|
+
}
|
66
|
+
;
|
package/package.json
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
{
|
2
|
+
"name": "lutra",
|
3
|
+
"version": "0.0.1",
|
4
|
+
"scripts": {
|
5
|
+
"dev": "vite dev --host 0.0.0.0",
|
6
|
+
"props": "node read_props.js",
|
7
|
+
"local": "node local",
|
8
|
+
"build": "vite build && npm run package",
|
9
|
+
"preview": "vite preview",
|
10
|
+
"package": "npm run props && svelte-kit sync && svelte-package && publint",
|
11
|
+
"prepublishOnly": "npm run package",
|
12
|
+
"test": "npm run test:integration && npm run test:unit",
|
13
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
14
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
15
|
+
"format": "prettier --write .",
|
16
|
+
"test:integration": "playwright test",
|
17
|
+
"test:unit": "vitest"
|
18
|
+
},
|
19
|
+
"exports": {
|
20
|
+
".": {
|
21
|
+
"types": "./dist/index.d.ts",
|
22
|
+
"svelte": "./dist/index.js"
|
23
|
+
}
|
24
|
+
},
|
25
|
+
"files": [
|
26
|
+
"dist",
|
27
|
+
"!dist/**/*.test.*",
|
28
|
+
"!dist/**/*.spec.*"
|
29
|
+
],
|
30
|
+
"peerDependencies": {
|
31
|
+
"@sveltejs/kit": "^2.5.0",
|
32
|
+
"svelte": "^4.0.0"
|
33
|
+
},
|
34
|
+
"devDependencies": {
|
35
|
+
"@playwright/test": "^1.42.1",
|
36
|
+
"@rollup/browser": "^4.13.0",
|
37
|
+
"@sveltejs/adapter-auto": "^3.1.1",
|
38
|
+
"@sveltejs/package": "^2.3.0",
|
39
|
+
"@sveltejs/vite-plugin-svelte": "^3.0.2",
|
40
|
+
"@types/glob": "8.1.0",
|
41
|
+
"glob": "^10.3.10",
|
42
|
+
"highlight.js": "^11.9.0",
|
43
|
+
"mdsvex": "^0.11.0",
|
44
|
+
"monaco-editor": "^0.47.0",
|
45
|
+
"prettier": "^3.2.5",
|
46
|
+
"prettier-plugin-svelte": "^3.2.2",
|
47
|
+
"publint": "^0.2.7",
|
48
|
+
"svelte": "next",
|
49
|
+
"svelte-check": "^3.6.8",
|
50
|
+
"tslib": "^2.6.2",
|
51
|
+
"typescript": "^5.4.3",
|
52
|
+
"vite": "5.2.6",
|
53
|
+
"vitest": "1.4.0"
|
54
|
+
},
|
55
|
+
"svelte": "./dist/index.js",
|
56
|
+
"types": "./dist/index.d.ts",
|
57
|
+
"type": "module"
|
58
|
+
}
|