@streamscloud/kit 0.0.1-1770841384222 → 0.0.1-1770887346972
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/dist/core/actions/horizontal-wheel-scroll.d.ts +5 -0
- package/dist/core/actions/horizontal-wheel-scroll.js +20 -0
- package/dist/core/actions/index.d.ts +2 -0
- package/dist/core/actions/index.js +2 -0
- package/dist/core/actions/swallow-touch.d.ts +2 -0
- package/dist/core/actions/swallow-touch.js +17 -0
- package/dist/core/validation/validation-schemas/email-validation.js +3 -3
- package/dist/core/validation/validation-schemas/handle-validations.js +2 -2
- package/dist/core/validation/validation-schemas/index.d.ts +0 -1
- package/dist/core/validation/validation-schemas/index.js +0 -1
- package/dist/core/validation/validation-schemas/number-validations.js +3 -3
- package/dist/core/validation/validation-schemas/text-validations.js +3 -3
- package/dist/core/validation/validation-schemas/validation-localization.d.ts +9 -0
- package/dist/core/validation/validation-schemas/validation-localization.js +54 -0
- package/dist/locale/index.d.ts +1 -0
- package/dist/locale/index.js +1 -0
- package/dist/locale/locale.svelte.d.ts +6 -0
- package/dist/locale/locale.svelte.js +5 -0
- package/dist/ui/line-clamp/cmp.line-clamp-auto.svelte +95 -0
- package/dist/ui/line-clamp/cmp.line-clamp-auto.svelte.d.ts +8 -0
- package/dist/ui/line-clamp/cmp.line-clamp.svelte +77 -0
- package/dist/ui/line-clamp/cmp.line-clamp.svelte.d.ts +9 -0
- package/dist/ui/line-clamp/index.d.ts +2 -0
- package/dist/ui/line-clamp/index.js +2 -0
- package/dist/ui/line-clamp/line-clamp-localization.d.ts +4 -0
- package/dist/ui/line-clamp/line-clamp-localization.js +19 -0
- package/dist/ui/line-clamp/line-clamp-utils.d.ts +1 -0
- package/dist/ui/line-clamp/line-clamp-utils.js +31 -0
- package/dist/ui/progress/cmp.progress.svelte +28 -0
- package/dist/ui/progress/cmp.progress.svelte.d.ts +7 -0
- package/dist/ui/progress/index.d.ts +1 -0
- package/dist/ui/progress/index.js +1 -0
- package/dist/ui/seek-bar/cmp.seek-bar.svelte +155 -0
- package/dist/ui/seek-bar/cmp.seek-bar.svelte.d.ts +13 -0
- package/dist/ui/seek-bar/index.d.ts +1 -0
- package/dist/ui/seek-bar/index.js +1 -0
- package/dist/ui/time-ago/cmp.time-ago.svelte +68 -0
- package/dist/ui/time-ago/cmp.time-ago.svelte.d.ts +7 -0
- package/dist/ui/time-ago/index.d.ts +1 -0
- package/dist/ui/time-ago/index.js +1 -0
- package/dist/ui/time-ago/time-ago-localization.d.ts +10 -0
- package/dist/ui/time-ago/time-ago-localization.js +61 -0
- package/package.json +64 -40
- package/dist/core/validation/validation-schemas/validation-messages.d.ts +0 -11
- package/dist/core/validation/validation-schemas/validation-messages.js +0 -14
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const horizontalWheelScroll = (node, param = { isolateScroll: true, speed: 1 }) => {
|
|
2
|
+
const onWheel = (event) => {
|
|
3
|
+
const canScrollX = node.scrollWidth > node.clientWidth;
|
|
4
|
+
if (!canScrollX) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
const delta = Math.abs(event.deltaX) > Math.abs(event.deltaY) ? event.deltaX : event.deltaY;
|
|
8
|
+
node.scrollBy({ left: delta * (param.speed ?? 1), behavior: 'smooth' });
|
|
9
|
+
if (param.isolateScroll) {
|
|
10
|
+
event.preventDefault();
|
|
11
|
+
event.stopPropagation();
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
node.addEventListener('wheel', onWheel, { passive: false });
|
|
15
|
+
return {
|
|
16
|
+
destroy() {
|
|
17
|
+
node.removeEventListener('wheel', onWheel);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const swallowTouch = (node) => {
|
|
2
|
+
const stopAll = (e) => {
|
|
3
|
+
e.stopPropagation();
|
|
4
|
+
};
|
|
5
|
+
node.addEventListener('touchstart', stopAll, { passive: false });
|
|
6
|
+
node.addEventListener('touchmove', stopAll, { passive: false });
|
|
7
|
+
node.addEventListener('touchend', stopAll, { passive: false });
|
|
8
|
+
node.addEventListener('touchcancel', stopAll, { passive: false });
|
|
9
|
+
return {
|
|
10
|
+
destroy() {
|
|
11
|
+
node.removeEventListener('touchstart', stopAll);
|
|
12
|
+
node.removeEventListener('touchmove', stopAll);
|
|
13
|
+
node.removeEventListener('touchend', stopAll);
|
|
14
|
+
node.removeEventListener('touchcancel', stopAll);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ValidationLocalization } from './validation-localization';
|
|
2
2
|
import * as yup from 'yup';
|
|
3
3
|
const EMAIL_REGEX = /^[a-zA-Z0-9_]([.+-]?[a-zA-Z0-9_])+@[a-zA-Z0-9]([.-]?[a-zA-Z0-9])+\.[a-zA-Z]{2,}$/;
|
|
4
4
|
export const emailValidationSchema = () => {
|
|
5
|
-
const msg =
|
|
5
|
+
const msg = new ValidationLocalization();
|
|
6
6
|
return yup.string().required(msg.required).matches(EMAIL_REGEX, {
|
|
7
7
|
excludeEmptyString: true,
|
|
8
8
|
message: msg.email
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
export const nullableEmailValidationSchema = () => {
|
|
12
|
-
const msg =
|
|
12
|
+
const msg = new ValidationLocalization();
|
|
13
13
|
return yup.string().nullable().matches(EMAIL_REGEX, {
|
|
14
14
|
excludeEmptyString: true,
|
|
15
15
|
message: msg.email
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ValidationLocalization } from './validation-localization';
|
|
2
2
|
import * as yup from 'yup';
|
|
3
3
|
const DEFAULT_MIN_LENGTH = 3;
|
|
4
4
|
const DEFAULT_MAX_LENGTH = 30;
|
|
5
5
|
const HANDLE_REGEX = /^[a-z_]([a-z0-9_]|[.-](?![.-]))*[a-z0-9_]$/;
|
|
6
6
|
export const handleValidationSchema = (lengthValidation) => {
|
|
7
|
-
const msg =
|
|
7
|
+
const msg = new ValidationLocalization();
|
|
8
8
|
const minLength = lengthValidation?.minLength ?? DEFAULT_MIN_LENGTH;
|
|
9
9
|
const maxLength = lengthValidation?.maxLength ?? DEFAULT_MAX_LENGTH;
|
|
10
10
|
return yup
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export type { TextValidation, TextWithFormatValidation, NumberValidation, MinNumberValidation } from './types';
|
|
2
|
-
export { setValidationMessages } from './validation-messages';
|
|
3
2
|
export { emailValidationSchema, nullableEmailValidationSchema } from './email-validation';
|
|
4
3
|
export { textValidationSchema, formattedTextValidationSchema } from './text-validations';
|
|
5
4
|
export { handleValidationSchema } from './handle-validations';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { setValidationMessages } from './validation-messages';
|
|
2
1
|
export { emailValidationSchema, nullableEmailValidationSchema } from './email-validation';
|
|
3
2
|
export { textValidationSchema, formattedTextValidationSchema } from './text-validations';
|
|
4
3
|
export { handleValidationSchema } from './handle-validations';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ValidationLocalization } from './validation-localization';
|
|
2
2
|
import * as yup from 'yup';
|
|
3
3
|
export const numberValidationSchema = (rules) => {
|
|
4
|
-
const msg =
|
|
4
|
+
const msg = new ValidationLocalization();
|
|
5
5
|
let schema = yup.number().typeError(msg.badFormat);
|
|
6
6
|
if (rules.isRequired) {
|
|
7
7
|
schema = schema.required(msg.required);
|
|
@@ -17,7 +17,7 @@ export const numberValidationSchema = (rules) => {
|
|
|
17
17
|
return schema;
|
|
18
18
|
};
|
|
19
19
|
export const minNumberValidationSchema = (rules) => {
|
|
20
|
-
const msg =
|
|
20
|
+
const msg = new ValidationLocalization();
|
|
21
21
|
let schema = yup.number().typeError(msg.badFormat);
|
|
22
22
|
if (rules.isRequired) {
|
|
23
23
|
schema = schema.required(msg.required);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ValidationLocalization } from './validation-localization';
|
|
2
2
|
import * as yup from 'yup';
|
|
3
3
|
export const textValidationSchema = (rules) => {
|
|
4
|
-
const msg =
|
|
4
|
+
const msg = new ValidationLocalization();
|
|
5
5
|
const schema = yup.string().max(rules.maxLength, msg.maxLength(rules.maxLength));
|
|
6
6
|
if (rules.minLength === 0) {
|
|
7
7
|
return schema;
|
|
@@ -14,6 +14,6 @@ export const textValidationSchema = (rules) => {
|
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
export const formattedTextValidationSchema = (rules, fieldName, formatMessage) => {
|
|
17
|
-
const msg =
|
|
17
|
+
const msg = new ValidationLocalization();
|
|
18
18
|
return textValidationSchema(rules).test(`${fieldName}-format`, formatMessage ?? msg.badFormat, (val) => !val || new RegExp(rules.format).test(val));
|
|
19
19
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class ValidationLocalization {
|
|
2
|
+
get required(): string;
|
|
3
|
+
get email(): string;
|
|
4
|
+
get minLength(): (length: number) => string;
|
|
5
|
+
get maxLength(): (length: number) => string;
|
|
6
|
+
get min(): (val: number) => string;
|
|
7
|
+
get max(): (val: number) => string;
|
|
8
|
+
get badFormat(): string;
|
|
9
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { getLocale } from '../../../locale';
|
|
2
|
+
export class ValidationLocalization {
|
|
3
|
+
get required() {
|
|
4
|
+
return loc.required[getLocale()];
|
|
5
|
+
}
|
|
6
|
+
get email() {
|
|
7
|
+
return loc.email[getLocale()];
|
|
8
|
+
}
|
|
9
|
+
get minLength() {
|
|
10
|
+
return loc.minLength[getLocale()];
|
|
11
|
+
}
|
|
12
|
+
get maxLength() {
|
|
13
|
+
return loc.maxLength[getLocale()];
|
|
14
|
+
}
|
|
15
|
+
get min() {
|
|
16
|
+
return loc.min[getLocale()];
|
|
17
|
+
}
|
|
18
|
+
get max() {
|
|
19
|
+
return loc.max[getLocale()];
|
|
20
|
+
}
|
|
21
|
+
get badFormat() {
|
|
22
|
+
return loc.badFormat[getLocale()];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const loc = {
|
|
26
|
+
required: {
|
|
27
|
+
en: 'This field is required',
|
|
28
|
+
no: 'Dette feltet er obligatorisk'
|
|
29
|
+
},
|
|
30
|
+
email: {
|
|
31
|
+
en: 'Please enter a valid email address',
|
|
32
|
+
no: 'Vennligst skriv inn en gyldig e-postadresse'
|
|
33
|
+
},
|
|
34
|
+
minLength: {
|
|
35
|
+
en: (length) => `Must be at least ${length} characters`,
|
|
36
|
+
no: (length) => `Må være minst ${length} tegn`
|
|
37
|
+
},
|
|
38
|
+
maxLength: {
|
|
39
|
+
en: (length) => `Must be at most ${length} characters`,
|
|
40
|
+
no: (length) => `Kan ikke være mer enn ${length} tegn`
|
|
41
|
+
},
|
|
42
|
+
min: {
|
|
43
|
+
en: (val) => `Must be at least ${val}`,
|
|
44
|
+
no: (val) => `Må være minst ${val}`
|
|
45
|
+
},
|
|
46
|
+
max: {
|
|
47
|
+
en: (val) => `Must be at most ${val}`,
|
|
48
|
+
no: (val) => `Kan ikke være mer enn ${val}`
|
|
49
|
+
},
|
|
50
|
+
badFormat: {
|
|
51
|
+
en: 'Invalid format',
|
|
52
|
+
no: 'Ugyldig format'
|
|
53
|
+
}
|
|
54
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getLocale, type Locale, type LocalizationSchema, setLocale } from './locale.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getLocale, setLocale } from './locale.svelte';
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<script lang="ts">import { LineClampLocalization } from './line-clamp-localization';
|
|
2
|
+
import { calculateClampValue } from './line-clamp-utils';
|
|
3
|
+
import { untrack } from 'svelte';
|
|
4
|
+
let { enableShowMore = false, children } = $props();
|
|
5
|
+
const localization = new LineClampLocalization();
|
|
6
|
+
let element = $state(null);
|
|
7
|
+
let clampWrapperRef = $state(null);
|
|
8
|
+
let isTruncated = $state(false);
|
|
9
|
+
let showingAllText = $state(false);
|
|
10
|
+
const canShowMore = $derived(enableShowMore && isTruncated && !showingAllText);
|
|
11
|
+
const clamp = () => {
|
|
12
|
+
if (!element || !clampWrapperRef) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const parent = element.parentElement;
|
|
16
|
+
if (!parent) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
isTruncated = clampWrapperRef.scrollHeight > clampWrapperRef.offsetHeight;
|
|
20
|
+
if (showingAllText) {
|
|
21
|
+
clampWrapperRef.style.setProperty('-webkit-line-clamp', 'unset');
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
const value = calculateClampValue(parent);
|
|
25
|
+
clampWrapperRef.style.setProperty('-webkit-line-clamp', value.toString());
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const toggleShowMore = () => {
|
|
29
|
+
showingAllText = !showingAllText;
|
|
30
|
+
clamp();
|
|
31
|
+
};
|
|
32
|
+
$effect(() => {
|
|
33
|
+
if (!element) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const parent = element.parentElement;
|
|
37
|
+
if (!parent) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
untrack(() => clamp());
|
|
41
|
+
const resizeObserver = new ResizeObserver(clamp);
|
|
42
|
+
resizeObserver.observe(parent);
|
|
43
|
+
return () => {
|
|
44
|
+
resizeObserver.disconnect();
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<div
|
|
50
|
+
class="line-clamp"
|
|
51
|
+
class:line-clamp--clickable={canShowMore}
|
|
52
|
+
bind:this={element}
|
|
53
|
+
onclick={() => canShowMore && toggleShowMore()}
|
|
54
|
+
onmousedown={() => {}}
|
|
55
|
+
role="none">
|
|
56
|
+
<div class="line-clamp__wrapper-container">
|
|
57
|
+
<div class="line-clamp__wrapper" bind:this={clampWrapperRef}>
|
|
58
|
+
{@render children()}
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
{#if enableShowMore && showingAllText}
|
|
63
|
+
<button type="button" class="line-clamp__show-more-button" onclick={toggleShowMore}>
|
|
64
|
+
{localization.showLess}
|
|
65
|
+
</button>
|
|
66
|
+
{/if}
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
<style>.line-clamp {
|
|
70
|
+
--_line-clamp--white-space: var(--line-clamp--white-space, pre-line);
|
|
71
|
+
width: 100%;
|
|
72
|
+
height: 100%;
|
|
73
|
+
display: flex;
|
|
74
|
+
flex-direction: column;
|
|
75
|
+
}
|
|
76
|
+
.line-clamp--clickable {
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
pointer-events: auto;
|
|
79
|
+
}
|
|
80
|
+
.line-clamp__wrapper-container {
|
|
81
|
+
position: relative;
|
|
82
|
+
}
|
|
83
|
+
.line-clamp__wrapper {
|
|
84
|
+
display: -webkit-box;
|
|
85
|
+
overflow: hidden;
|
|
86
|
+
word-break: break-word;
|
|
87
|
+
white-space: var(--_line-clamp--white-space);
|
|
88
|
+
-webkit-box-orient: vertical;
|
|
89
|
+
}
|
|
90
|
+
.line-clamp__show-more-button {
|
|
91
|
+
font-size: 0.9em;
|
|
92
|
+
font-style: italic;
|
|
93
|
+
pointer-events: auto;
|
|
94
|
+
margin-top: 0.5em;
|
|
95
|
+
}</style>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<script lang="ts">import { LineClampLocalization } from './line-clamp-localization';
|
|
2
|
+
import {} from 'svelte';
|
|
3
|
+
let { maxLines, enableShowMore = false, children } = $props();
|
|
4
|
+
const localization = new LineClampLocalization();
|
|
5
|
+
let isTruncated = $state(false);
|
|
6
|
+
let showingAllText = $state(false);
|
|
7
|
+
const canShowMore = $derived(enableShowMore && isTruncated && !showingAllText);
|
|
8
|
+
const toggleShowMore = () => {
|
|
9
|
+
showingAllText = !showingAllText;
|
|
10
|
+
};
|
|
11
|
+
const trackTruncatedState = (node) => {
|
|
12
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
13
|
+
isTruncated = node.scrollHeight > node.offsetHeight;
|
|
14
|
+
});
|
|
15
|
+
resizeObserver.observe(node);
|
|
16
|
+
return {
|
|
17
|
+
destroy() {
|
|
18
|
+
resizeObserver.disconnect();
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<div
|
|
25
|
+
class="line-clamp"
|
|
26
|
+
class:line-clamp--clickable={canShowMore}
|
|
27
|
+
style:--line-clamp--line-clamp={maxLines}
|
|
28
|
+
onclick={() => canShowMore && toggleShowMore()}
|
|
29
|
+
onmousedown={() => {}}
|
|
30
|
+
role="none">
|
|
31
|
+
<div class="line-clamp__wrapper-container">
|
|
32
|
+
<div class="line-clamp__wrapper" class:line-clamp__wrapper--showing-all={showingAllText} use:trackTruncatedState>
|
|
33
|
+
{@render children()}
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
{#if enableShowMore && showingAllText}
|
|
38
|
+
<button type="button" class="line-clamp__show-more-button" onclick={toggleShowMore}>
|
|
39
|
+
{localization.showLess}
|
|
40
|
+
</button>
|
|
41
|
+
{/if}
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<style>.line-clamp {
|
|
45
|
+
--_line-clamp--white-space: var(--line-clamp--white-space, pre-line);
|
|
46
|
+
--_line-clamp--line-clamp: var(--line-clamp--line-clamp, 1);
|
|
47
|
+
width: 100%;
|
|
48
|
+
height: 100%;
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
}
|
|
52
|
+
.line-clamp--clickable {
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
pointer-events: auto;
|
|
55
|
+
}
|
|
56
|
+
.line-clamp__wrapper-container {
|
|
57
|
+
position: relative;
|
|
58
|
+
}
|
|
59
|
+
.line-clamp__wrapper {
|
|
60
|
+
display: -webkit-box;
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
word-break: break-word;
|
|
63
|
+
white-space: var(--_line-clamp--white-space);
|
|
64
|
+
-webkit-box-orient: vertical;
|
|
65
|
+
line-clamp: var(--_line-clamp--line-clamp);
|
|
66
|
+
-webkit-line-clamp: var(--_line-clamp--line-clamp);
|
|
67
|
+
text-overflow: ellipsis;
|
|
68
|
+
}
|
|
69
|
+
.line-clamp__wrapper--showing-all {
|
|
70
|
+
--_line-clamp--line-clamp: none;
|
|
71
|
+
}
|
|
72
|
+
.line-clamp__show-more-button {
|
|
73
|
+
font-size: 0.9em;
|
|
74
|
+
font-style: italic;
|
|
75
|
+
pointer-events: auto;
|
|
76
|
+
margin-top: 0.5em;
|
|
77
|
+
}</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getLocale } from '../../locale';
|
|
2
|
+
export class LineClampLocalization {
|
|
3
|
+
get showLess() {
|
|
4
|
+
return loc.showLess[getLocale()];
|
|
5
|
+
}
|
|
6
|
+
get showMore() {
|
|
7
|
+
return loc.showMore[getLocale()];
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
const loc = {
|
|
11
|
+
showLess: {
|
|
12
|
+
en: 'Show less',
|
|
13
|
+
no: 'Vis mindre'
|
|
14
|
+
},
|
|
15
|
+
showMore: {
|
|
16
|
+
en: 'Show more',
|
|
17
|
+
no: 'Vis mer'
|
|
18
|
+
}
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const calculateClampValue: (elm: HTMLElement) => number;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const getNumberStyleValue = (elm, property) => {
|
|
2
|
+
const value = window.getComputedStyle(elm).getPropertyValue(property);
|
|
3
|
+
const parsed = parseFloat(value);
|
|
4
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
5
|
+
};
|
|
6
|
+
const getContentHeight = (elm) => {
|
|
7
|
+
const maxHeight = getNumberStyleValue(elm, 'max-height');
|
|
8
|
+
const height = getNumberStyleValue(elm, 'height');
|
|
9
|
+
const paddingTop = getNumberStyleValue(elm, 'padding-top');
|
|
10
|
+
const paddingBottom = getNumberStyleValue(elm, 'padding-bottom');
|
|
11
|
+
const borderTop = getNumberStyleValue(elm, 'border-top-width');
|
|
12
|
+
const borderBottom = getNumberStyleValue(elm, 'border-bottom-width');
|
|
13
|
+
// In border-box: height/max-height include padding + border — subtract both to get content
|
|
14
|
+
// clientHeight includes padding only — border subtraction is a minor over-correction for this fallback
|
|
15
|
+
const elementHeight = maxHeight || height || elm.clientHeight;
|
|
16
|
+
return elementHeight - paddingTop - paddingBottom - borderTop - borderBottom;
|
|
17
|
+
};
|
|
18
|
+
const getLineHeight = (elm) => {
|
|
19
|
+
const lineHeight = getNumberStyleValue(elm, 'line-height');
|
|
20
|
+
if (lineHeight > 0) {
|
|
21
|
+
return lineHeight;
|
|
22
|
+
}
|
|
23
|
+
// Fallback: line-height: normal is approximately 1.2 * font-size
|
|
24
|
+
const fontSize = getNumberStyleValue(elm, 'font-size');
|
|
25
|
+
return fontSize > 0 ? fontSize * 1.2 : 1;
|
|
26
|
+
};
|
|
27
|
+
export const calculateClampValue = (elm) => {
|
|
28
|
+
const contentHeight = getContentHeight(elm);
|
|
29
|
+
const lineHeight = getLineHeight(elm);
|
|
30
|
+
return Math.max(1, Math.floor(contentHeight / lineHeight));
|
|
31
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script lang="ts">let { value } = $props();
|
|
2
|
+
const cssWidth = $derived(`${100 * (value <= 1 ? value : 1)}%`);
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<div class="progress">
|
|
6
|
+
<span class="progress__value" class:progress__value--animated={value > 0.01 && value < 0.96} style:width={cssWidth}> </span>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<style>.progress {
|
|
10
|
+
--_progress--height: var(--progress--height, 0.25em);
|
|
11
|
+
--_progress--back-color: var(--progress--back-color, #9ca3af);
|
|
12
|
+
--_progress--front-color: var(--progress--front-color, #ffffff);
|
|
13
|
+
--_progress--box-shadow: var(--progress--box-shadow, 0 2px 3px rgba(0, 0, 0, 0.25) inset);
|
|
14
|
+
--_progress--border-radius: var(--progress--border-radius, 0);
|
|
15
|
+
width: 100%;
|
|
16
|
+
background: var(--_progress--back-color);
|
|
17
|
+
height: var(--_progress--height);
|
|
18
|
+
box-shadow: var(--_progress--box-shadow);
|
|
19
|
+
border-radius: var(--_progress--border-radius);
|
|
20
|
+
}
|
|
21
|
+
.progress__value {
|
|
22
|
+
background: var(--_progress--front-color);
|
|
23
|
+
display: inline-block;
|
|
24
|
+
height: 100%;
|
|
25
|
+
}
|
|
26
|
+
.progress__value--animated {
|
|
27
|
+
transition: width 600ms;
|
|
28
|
+
}</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Progress } from './cmp.progress.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Progress } from './cmp.progress.svelte';
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<script lang="ts">let { value, listenParentClicks = false, on } = $props();
|
|
2
|
+
let seekBarRef = $state(null);
|
|
3
|
+
let scrubberRef = $state(null);
|
|
4
|
+
let progressRef = $state(null);
|
|
5
|
+
let isDragging = $state(false);
|
|
6
|
+
const cssValue = $derived(`${100 * (value <= 1 ? value : 1)}%`);
|
|
7
|
+
const handleSeek = (e) => {
|
|
8
|
+
if (!progressRef) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
e.stopPropagation();
|
|
12
|
+
const { left, width } = progressRef.getBoundingClientRect();
|
|
13
|
+
const x = e.clientX - left;
|
|
14
|
+
const percent = Math.max(0, Math.min(1, x / width));
|
|
15
|
+
on?.seek(percent);
|
|
16
|
+
};
|
|
17
|
+
const handleParentClick = (e) => {
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
e.stopPropagation();
|
|
20
|
+
if (!progressRef || !seekBarRef || isDragging) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const seekBarRect = progressRef.getBoundingClientRect();
|
|
24
|
+
if (e.clientX >= seekBarRect.left && e.clientX <= seekBarRect.right) {
|
|
25
|
+
const x = e.clientX - seekBarRect.left;
|
|
26
|
+
const percent = Math.max(0, Math.min(1, x / seekBarRect.width));
|
|
27
|
+
on?.seek(percent);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const onMouseMove = (e) => {
|
|
31
|
+
if (isDragging) {
|
|
32
|
+
handleSeek(e);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const onMouseUp = () => {
|
|
36
|
+
isDragging = false;
|
|
37
|
+
window.removeEventListener('mousemove', onMouseMove);
|
|
38
|
+
window.removeEventListener('mouseup', onMouseUp);
|
|
39
|
+
scrubberRef?.blur();
|
|
40
|
+
on?.dragEnd?.();
|
|
41
|
+
};
|
|
42
|
+
const onMouseDown = (e) => {
|
|
43
|
+
isDragging = true;
|
|
44
|
+
on?.dragStart?.();
|
|
45
|
+
handleSeek(e);
|
|
46
|
+
window.addEventListener('mousemove', onMouseMove);
|
|
47
|
+
window.addEventListener('mouseup', onMouseUp);
|
|
48
|
+
scrubberRef?.blur();
|
|
49
|
+
};
|
|
50
|
+
const handleScrubberKeyDown = (event) => {
|
|
51
|
+
const step = 0.05;
|
|
52
|
+
let newValue;
|
|
53
|
+
if (event.key === /*@wc-ignore*/ 'ArrowLeft') {
|
|
54
|
+
newValue = Math.max(0, value - step);
|
|
55
|
+
}
|
|
56
|
+
else if (event.key === /*@wc-ignore*/ 'ArrowRight') {
|
|
57
|
+
newValue = Math.min(1, value + step);
|
|
58
|
+
}
|
|
59
|
+
else if (event.key === /*@wc-ignore*/ 'Home') {
|
|
60
|
+
newValue = 0;
|
|
61
|
+
}
|
|
62
|
+
else if (event.key === /*@wc-ignore*/ 'End') {
|
|
63
|
+
newValue = 1;
|
|
64
|
+
}
|
|
65
|
+
if (newValue !== undefined) {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
on?.seek(newValue);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
$effect(() => {
|
|
71
|
+
if (!listenParentClicks || !seekBarRef) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const parent = seekBarRef.parentElement;
|
|
75
|
+
if (!parent) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
parent.addEventListener('click', handleParentClick);
|
|
79
|
+
return () => {
|
|
80
|
+
parent.removeEventListener('click', handleParentClick);
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
$effect(() => {
|
|
84
|
+
return () => {
|
|
85
|
+
window.removeEventListener('mousemove', onMouseMove);
|
|
86
|
+
window.removeEventListener('mouseup', onMouseUp);
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<div class="seek-bar" onmousedown={onMouseDown} onkeydown={() => ({})} role="none" bind:this={seekBarRef}>
|
|
92
|
+
<div class="seek-bar__container" bind:this={progressRef}>
|
|
93
|
+
<span class="seek-bar__value" style:width={cssValue}> </span>
|
|
94
|
+
<div
|
|
95
|
+
class="seek-bar__scrubber"
|
|
96
|
+
bind:this={scrubberRef}
|
|
97
|
+
class:is-dragging={isDragging}
|
|
98
|
+
style:left={cssValue}
|
|
99
|
+
role="slider"
|
|
100
|
+
tabindex="0"
|
|
101
|
+
aria-valuemin="0"
|
|
102
|
+
aria-valuemax="1"
|
|
103
|
+
aria-valuenow={value}
|
|
104
|
+
aria-label="Media position slider"
|
|
105
|
+
onkeydown={handleScrubberKeyDown}>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
<style>.seek-bar {
|
|
111
|
+
cursor: pointer;
|
|
112
|
+
position: relative;
|
|
113
|
+
padding: 0.3125rem 0;
|
|
114
|
+
--_seek-bar--container-color: var(--seek-bar--container-color, #9ca3af);
|
|
115
|
+
--_seek-bar--value-color: var(--seek-bar--value-color, #ffffff);
|
|
116
|
+
--_seek-bar--scrubber-color: var(--seek-bar--scrubber-color, #ffffff);
|
|
117
|
+
--_seek-bar--scrubber-border-color: var(--seek-bar--scrubber-border-color, #9ca3af);
|
|
118
|
+
--_seek-bar--scrubber-opacity: 0;
|
|
119
|
+
}
|
|
120
|
+
.seek-bar:hover {
|
|
121
|
+
--_seek-bar--scrubber-opacity: 1;
|
|
122
|
+
}
|
|
123
|
+
.seek-bar__container {
|
|
124
|
+
width: 100%;
|
|
125
|
+
background: var(--_seek-bar--container-color);
|
|
126
|
+
height: 0.3125rem;
|
|
127
|
+
position: relative;
|
|
128
|
+
}
|
|
129
|
+
.seek-bar__value {
|
|
130
|
+
background: var(--_seek-bar--value-color);
|
|
131
|
+
border-color: var(--_seek-bar--container-color);
|
|
132
|
+
border-width: 0.0625rem;
|
|
133
|
+
display: inline-block;
|
|
134
|
+
height: 100%;
|
|
135
|
+
}
|
|
136
|
+
.seek-bar__scrubber {
|
|
137
|
+
position: absolute;
|
|
138
|
+
top: 50%;
|
|
139
|
+
width: 0.75rem;
|
|
140
|
+
height: 0.75rem;
|
|
141
|
+
background: var(--_seek-bar--scrubber-color);
|
|
142
|
+
border-color: var(--_seek-bar--scrubber-border-color);
|
|
143
|
+
border-width: 0.0625rem;
|
|
144
|
+
border-radius: 50%;
|
|
145
|
+
transform: translate(-50%, -50%);
|
|
146
|
+
z-index: 1;
|
|
147
|
+
opacity: var(--_seek-bar--scrubber-opacity);
|
|
148
|
+
transition: opacity 0.2s ease-in-out;
|
|
149
|
+
}
|
|
150
|
+
.seek-bar__scrubber.is-dragging, .seek-bar__scrubber:focus {
|
|
151
|
+
--_seek-bar--scrubber-opacity: 1;
|
|
152
|
+
}
|
|
153
|
+
.seek-bar__scrubber:focus-visible {
|
|
154
|
+
outline: none;
|
|
155
|
+
}</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
/** 0-1 */
|
|
3
|
+
value: number;
|
|
4
|
+
listenParentClicks?: boolean;
|
|
5
|
+
on: {
|
|
6
|
+
seek: (e: number) => void;
|
|
7
|
+
dragStart?: () => void;
|
|
8
|
+
dragEnd?: () => void;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
type Cmp = ReturnType<typeof Cmp>;
|
|
13
|
+
export default Cmp;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SeekBar } from './cmp.seek-bar.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SeekBar } from './cmp.seek-bar.svelte';
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script lang="ts">import { DateFormatOptions, DateHelper } from '../../core/utils/date-helper';
|
|
2
|
+
import { TimeAgoLocalization } from './time-ago-localization';
|
|
3
|
+
let { date = null, thresholdMinutes = 60 * 24 * 2 /* 2 days */ } = $props();
|
|
4
|
+
const localization = new TimeAgoLocalization();
|
|
5
|
+
let timeSpan = $state.raw(null);
|
|
6
|
+
let timeoutId;
|
|
7
|
+
const setRelativeTime = (d) => {
|
|
8
|
+
disableTimeout();
|
|
9
|
+
const dateVal = d ? DateHelper.toDate(d) : new Date();
|
|
10
|
+
const setupAbsDate = () => {
|
|
11
|
+
timeSpan = localization.at(dateVal.toLocaleString(localization.locale, dateVal.getFullYear() === new Date().getFullYear() ? DateFormatOptions.dateFormatWithoutYear : DateFormatOptions.dateFormat), dateVal.toLocaleString(localization.locale, DateFormatOptions.timeFormat));
|
|
12
|
+
};
|
|
13
|
+
const diffSeconds = (+new Date() - +dateVal) / 1000;
|
|
14
|
+
if (diffSeconds > thresholdMinutes * 60) {
|
|
15
|
+
return setupAbsDate();
|
|
16
|
+
}
|
|
17
|
+
const secsInHour = 60 * 60;
|
|
18
|
+
const secsIn2Hours = secsInHour * 2;
|
|
19
|
+
const secsInDay = 60 * 60 * 24;
|
|
20
|
+
const secsIn2Days = secsInDay * 2;
|
|
21
|
+
let refreshIntervalSec;
|
|
22
|
+
if (diffSeconds < 60) {
|
|
23
|
+
timeSpan = localization.justNow;
|
|
24
|
+
refreshIntervalSec = 5;
|
|
25
|
+
}
|
|
26
|
+
else if (diffSeconds < 120) {
|
|
27
|
+
timeSpan = localization.aMinuteAgo;
|
|
28
|
+
refreshIntervalSec = 5;
|
|
29
|
+
}
|
|
30
|
+
else if (diffSeconds < secsInHour) {
|
|
31
|
+
timeSpan = localization.minutesAgo(Math.floor(diffSeconds / 60));
|
|
32
|
+
refreshIntervalSec = 60;
|
|
33
|
+
}
|
|
34
|
+
else if (diffSeconds < secsIn2Hours) {
|
|
35
|
+
timeSpan = localization.anHourAgo;
|
|
36
|
+
refreshIntervalSec = 60;
|
|
37
|
+
}
|
|
38
|
+
else if (diffSeconds < secsInDay) {
|
|
39
|
+
timeSpan = localization.hoursAgo(Math.floor(diffSeconds / secsInHour));
|
|
40
|
+
refreshIntervalSec = 3600;
|
|
41
|
+
}
|
|
42
|
+
else if (diffSeconds < secsIn2Days) {
|
|
43
|
+
timeSpan = localization.yesterday(dateVal.toLocaleString(localization.locale, DateFormatOptions.timeFormat));
|
|
44
|
+
refreshIntervalSec = 3600;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
return setupAbsDate();
|
|
48
|
+
}
|
|
49
|
+
timeoutId = setTimeout(() => setRelativeTime(d), refreshIntervalSec * 1000);
|
|
50
|
+
};
|
|
51
|
+
$effect(() => {
|
|
52
|
+
setRelativeTime(date);
|
|
53
|
+
return () => {
|
|
54
|
+
disableTimeout();
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
const disableTimeout = () => {
|
|
58
|
+
if (timeoutId) {
|
|
59
|
+
clearTimeout(timeoutId);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<span>
|
|
65
|
+
{#if timeSpan}
|
|
66
|
+
{timeSpan}
|
|
67
|
+
{/if}
|
|
68
|
+
</span>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TimeAgo } from './cmp.time-ago.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TimeAgo } from './cmp.time-ago.svelte';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class TimeAgoLocalization {
|
|
2
|
+
get locale(): string;
|
|
3
|
+
get aMinuteAgo(): string;
|
|
4
|
+
get anHourAgo(): string;
|
|
5
|
+
get justNow(): string;
|
|
6
|
+
get at(): (date: string, time: string) => string;
|
|
7
|
+
get hoursAgo(): (hours: number) => string;
|
|
8
|
+
get minutesAgo(): (minutes: number) => string;
|
|
9
|
+
get yesterday(): (time: string) => string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { getLocale } from '../../locale';
|
|
2
|
+
export class TimeAgoLocalization {
|
|
3
|
+
get locale() {
|
|
4
|
+
return loc.locale[getLocale()];
|
|
5
|
+
}
|
|
6
|
+
get aMinuteAgo() {
|
|
7
|
+
return loc.aMinuteAgo[getLocale()];
|
|
8
|
+
}
|
|
9
|
+
get anHourAgo() {
|
|
10
|
+
return loc.anHourAgo[getLocale()];
|
|
11
|
+
}
|
|
12
|
+
get justNow() {
|
|
13
|
+
return loc.justNow[getLocale()];
|
|
14
|
+
}
|
|
15
|
+
get at() {
|
|
16
|
+
return loc.at[getLocale()];
|
|
17
|
+
}
|
|
18
|
+
get hoursAgo() {
|
|
19
|
+
return loc.hoursAgo[getLocale()];
|
|
20
|
+
}
|
|
21
|
+
get minutesAgo() {
|
|
22
|
+
return loc.minutesAgo[getLocale()];
|
|
23
|
+
}
|
|
24
|
+
get yesterday() {
|
|
25
|
+
return loc.yesterday[getLocale()];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const loc = {
|
|
29
|
+
locale: {
|
|
30
|
+
en: 'en-US',
|
|
31
|
+
no: 'no-NO'
|
|
32
|
+
},
|
|
33
|
+
aMinuteAgo: {
|
|
34
|
+
en: 'a minute ago',
|
|
35
|
+
no: 'ett minutt siden'
|
|
36
|
+
},
|
|
37
|
+
anHourAgo: {
|
|
38
|
+
en: 'an hour ago',
|
|
39
|
+
no: 'en time siden'
|
|
40
|
+
},
|
|
41
|
+
justNow: {
|
|
42
|
+
en: 'just now',
|
|
43
|
+
no: 'nettopp nå'
|
|
44
|
+
},
|
|
45
|
+
at: {
|
|
46
|
+
en: (date, time) => `${date} at ${time}`,
|
|
47
|
+
no: (date, time) => `${date} kl. ${time}`
|
|
48
|
+
},
|
|
49
|
+
hoursAgo: {
|
|
50
|
+
en: (hours) => `${hours} hours ago`,
|
|
51
|
+
no: (hours) => `${hours} timer siden`
|
|
52
|
+
},
|
|
53
|
+
minutesAgo: {
|
|
54
|
+
en: (minutes) => `${minutes} minutes ago`,
|
|
55
|
+
no: (minutes) => `${minutes} minutter siden`
|
|
56
|
+
},
|
|
57
|
+
yesterday: {
|
|
58
|
+
en: (time) => `Yesterday at ${time}`,
|
|
59
|
+
no: (time) => `I går kl. ${time}`
|
|
60
|
+
}
|
|
61
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamscloud/kit",
|
|
3
|
-
"version": "0.0.1-
|
|
3
|
+
"version": "0.0.1-1770887346972",
|
|
4
4
|
"author": "StreamsCloud",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,38 +32,34 @@
|
|
|
32
32
|
"types": "./dist/core/index.d.ts",
|
|
33
33
|
"svelte": "./dist/core/index.js"
|
|
34
34
|
},
|
|
35
|
+
"./core/actions": {
|
|
36
|
+
"types": "./dist/core/actions/index.d.ts",
|
|
37
|
+
"svelte": "./dist/core/actions/index.js"
|
|
38
|
+
},
|
|
35
39
|
"./core/css": {
|
|
36
40
|
"types": "./dist/core/css/index.d.ts",
|
|
37
41
|
"svelte": "./dist/core/css/index.js"
|
|
38
42
|
},
|
|
39
|
-
"./core/
|
|
40
|
-
"types": "./dist/core/
|
|
41
|
-
"svelte": "./dist/core/
|
|
42
|
-
},
|
|
43
|
-
"./core/transitions": {
|
|
44
|
-
"types": "./dist/core/transitions/index.d.ts",
|
|
45
|
-
"svelte": "./dist/core/transitions/index.js"
|
|
46
|
-
},
|
|
47
|
-
"./core/utils": {
|
|
48
|
-
"types": "./dist/core/utils/index.d.ts",
|
|
49
|
-
"svelte": "./dist/core/utils/index.js"
|
|
43
|
+
"./core/data-loaders": {
|
|
44
|
+
"types": "./dist/core/data-loaders/index.d.ts",
|
|
45
|
+
"svelte": "./dist/core/data-loaders/index.js"
|
|
50
46
|
},
|
|
51
47
|
"./core/files": {
|
|
52
48
|
"types": "./dist/core/files/index.d.ts",
|
|
53
49
|
"svelte": "./dist/core/files/index.js"
|
|
54
50
|
},
|
|
51
|
+
"./core/i18n": {
|
|
52
|
+
"types": "./dist/core/i18n/index.d.ts",
|
|
53
|
+
"svelte": "./dist/core/i18n/index.js"
|
|
54
|
+
},
|
|
55
|
+
"./core/media": {
|
|
56
|
+
"types": "./dist/core/media/index.d.ts",
|
|
57
|
+
"svelte": "./dist/core/media/index.js"
|
|
58
|
+
},
|
|
55
59
|
"./core/repository": {
|
|
56
60
|
"types": "./dist/core/repository/index.d.ts",
|
|
57
61
|
"svelte": "./dist/core/repository/index.js"
|
|
58
62
|
},
|
|
59
|
-
"./core/data-loaders": {
|
|
60
|
-
"types": "./dist/core/data-loaders/index.d.ts",
|
|
61
|
-
"svelte": "./dist/core/data-loaders/index.js"
|
|
62
|
-
},
|
|
63
|
-
"./core/validation": {
|
|
64
|
-
"types": "./dist/core/validation/index.d.ts",
|
|
65
|
-
"svelte": "./dist/core/validation/index.js"
|
|
66
|
-
},
|
|
67
63
|
"./core/theme": {
|
|
68
64
|
"types": "./dist/core/theme/index.d.ts",
|
|
69
65
|
"svelte": "./dist/core/theme/index.js"
|
|
@@ -72,55 +68,83 @@
|
|
|
72
68
|
"types": "./dist/core/toastr/index.d.ts",
|
|
73
69
|
"svelte": "./dist/core/toastr/index.js"
|
|
74
70
|
},
|
|
75
|
-
"./
|
|
76
|
-
"types": "./dist/
|
|
77
|
-
"svelte": "./dist/
|
|
71
|
+
"./core/transitions": {
|
|
72
|
+
"types": "./dist/core/transitions/index.d.ts",
|
|
73
|
+
"svelte": "./dist/core/transitions/index.js"
|
|
74
|
+
},
|
|
75
|
+
"./core/utils": {
|
|
76
|
+
"types": "./dist/core/utils/index.d.ts",
|
|
77
|
+
"svelte": "./dist/core/utils/index.js"
|
|
78
|
+
},
|
|
79
|
+
"./core/validation": {
|
|
80
|
+
"types": "./dist/core/validation/index.d.ts",
|
|
81
|
+
"svelte": "./dist/core/validation/index.js"
|
|
78
82
|
},
|
|
79
|
-
"./
|
|
83
|
+
"./locale": {
|
|
84
|
+
"types": "./dist/locale/index.d.ts",
|
|
85
|
+
"svelte": "./dist/locale/index.js"
|
|
86
|
+
},
|
|
87
|
+
"./ui/button": {
|
|
80
88
|
"types": "./dist/ui/button/index.d.ts",
|
|
81
89
|
"svelte": "./dist/ui/button/index.js"
|
|
82
90
|
},
|
|
83
|
-
"./
|
|
91
|
+
"./ui/dialog": {
|
|
92
|
+
"types": "./dist/ui/dialog/index.d.ts",
|
|
93
|
+
"svelte": "./dist/ui/dialog/index.js"
|
|
94
|
+
},
|
|
95
|
+
"./ui/icon": {
|
|
84
96
|
"types": "./dist/ui/icon/index.d.ts",
|
|
85
97
|
"svelte": "./dist/ui/icon/index.js"
|
|
86
98
|
},
|
|
87
|
-
"./image": {
|
|
99
|
+
"./ui/image": {
|
|
88
100
|
"types": "./dist/ui/image/index.d.ts",
|
|
89
101
|
"svelte": "./dist/ui/image/index.js"
|
|
90
102
|
},
|
|
91
|
-
"./infinite-scrolling": {
|
|
103
|
+
"./ui/infinite-scrolling": {
|
|
92
104
|
"types": "./dist/ui/infinite-scrolling/index.d.ts",
|
|
93
105
|
"svelte": "./dist/ui/infinite-scrolling/index.js"
|
|
94
106
|
},
|
|
95
|
-
"./
|
|
107
|
+
"./ui/line-clamp": {
|
|
108
|
+
"types": "./dist/ui/line-clamp/index.d.ts",
|
|
109
|
+
"svelte": "./dist/ui/line-clamp/index.js"
|
|
110
|
+
},
|
|
111
|
+
"./ui/loading": {
|
|
96
112
|
"types": "./dist/ui/loading/index.d.ts",
|
|
97
113
|
"svelte": "./dist/ui/loading/index.js"
|
|
98
114
|
},
|
|
99
|
-
"./
|
|
115
|
+
"./ui/progress": {
|
|
116
|
+
"types": "./dist/ui/progress/index.d.ts",
|
|
117
|
+
"svelte": "./dist/ui/progress/index.js"
|
|
118
|
+
},
|
|
119
|
+
"./ui/proportional-container": {
|
|
100
120
|
"types": "./dist/ui/proportional-container/index.d.ts",
|
|
101
121
|
"svelte": "./dist/ui/proportional-container/index.js"
|
|
102
122
|
},
|
|
103
|
-
"./
|
|
104
|
-
"types": "./dist/
|
|
105
|
-
"svelte": "./dist/
|
|
123
|
+
"./ui/seek-bar": {
|
|
124
|
+
"types": "./dist/ui/seek-bar/index.d.ts",
|
|
125
|
+
"svelte": "./dist/ui/seek-bar/index.js"
|
|
106
126
|
},
|
|
107
|
-
"./
|
|
108
|
-
"
|
|
127
|
+
"./ui/time-ago": {
|
|
128
|
+
"types": "./dist/ui/time-ago/index.d.ts",
|
|
129
|
+
"svelte": "./dist/ui/time-ago/index.js"
|
|
109
130
|
},
|
|
110
|
-
"./styles/
|
|
111
|
-
"sass": "./dist/styles/
|
|
131
|
+
"./styles/base": {
|
|
132
|
+
"sass": "./dist/styles/_index.scss"
|
|
112
133
|
},
|
|
113
134
|
"./styles/colors": {
|
|
114
135
|
"sass": "./dist/styles/_colors.scss"
|
|
115
136
|
},
|
|
116
|
-
"./styles/
|
|
117
|
-
"sass": "./dist/styles/
|
|
137
|
+
"./styles/functions": {
|
|
138
|
+
"sass": "./dist/styles/_functions.scss"
|
|
118
139
|
},
|
|
119
|
-
"./styles/
|
|
120
|
-
"sass": "./dist/styles/
|
|
140
|
+
"./styles/mixins": {
|
|
141
|
+
"sass": "./dist/styles/_mixins.scss"
|
|
121
142
|
},
|
|
122
143
|
"./styles/normalize.css": "./dist/styles/normalize.css",
|
|
123
144
|
"./styles/reset.css": "./dist/styles/reset.css",
|
|
145
|
+
"./styles/responsive": {
|
|
146
|
+
"sass": "./dist/styles/_responsive.scss"
|
|
147
|
+
},
|
|
124
148
|
"./styles/theme": {
|
|
125
149
|
"sass": "./dist/styles/_theme.scss"
|
|
126
150
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface ValidationMessages {
|
|
2
|
-
required: string;
|
|
3
|
-
email: string;
|
|
4
|
-
minLength: (length: number) => string;
|
|
5
|
-
maxLength: (length: number) => string;
|
|
6
|
-
min: (val: number) => string;
|
|
7
|
-
max: (val: number) => string;
|
|
8
|
-
badFormat: string;
|
|
9
|
-
}
|
|
10
|
-
export declare const getValidationMessages: () => ValidationMessages;
|
|
11
|
-
export declare const setValidationMessages: (messages: Partial<ValidationMessages>) => void;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const defaultMessages = {
|
|
2
|
-
required: 'This field is required',
|
|
3
|
-
email: 'Please enter a valid email address',
|
|
4
|
-
minLength: (length) => `Must be at least ${length} characters`,
|
|
5
|
-
maxLength: (length) => `Must be at most ${length} characters`,
|
|
6
|
-
min: (val) => `Must be at least ${val}`,
|
|
7
|
-
max: (val) => `Must be at most ${val}`,
|
|
8
|
-
badFormat: 'Invalid format'
|
|
9
|
-
};
|
|
10
|
-
let currentMessages = { ...defaultMessages };
|
|
11
|
-
export const getValidationMessages = () => currentMessages;
|
|
12
|
-
export const setValidationMessages = (messages) => {
|
|
13
|
-
currentMessages = { ...currentMessages, ...messages };
|
|
14
|
-
};
|