@streamscloud/kit 0.0.1-1770364570820
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/continuation-token.d.ts +10 -0
- package/dist/core/continuation-token.js +32 -0
- package/dist/core/css/index.d.ts +1 -0
- package/dist/core/css/index.js +1 -0
- package/dist/core/css/style-functions.d.ts +5 -0
- package/dist/core/css/style-functions.js +12 -0
- package/dist/core/cursor-result.d.ts +9 -0
- package/dist/core/cursor-result.js +1 -0
- package/dist/core/data-loaders/cursor-data-loader-with-search.svelte.d.ts +19 -0
- package/dist/core/data-loaders/cursor-data-loader-with-search.svelte.js +57 -0
- package/dist/core/data-loaders/cursor-data-loader.svelte.d.ts +13 -0
- package/dist/core/data-loaders/cursor-data-loader.svelte.js +33 -0
- package/dist/core/data-loaders/data-loader.d.ts +4 -0
- package/dist/core/data-loaders/data-loader.js +1 -0
- package/dist/core/data-loaders/index.d.ts +4 -0
- package/dist/core/data-loaders/index.js +4 -0
- package/dist/core/data-loaders/page-data-loader.svelte.d.ts +15 -0
- package/dist/core/data-loaders/page-data-loader.svelte.js +37 -0
- package/dist/core/deferred.d.ts +6 -0
- package/dist/core/deferred.js +13 -0
- package/dist/core/event-dispatcher.d.ts +9 -0
- package/dist/core/event-dispatcher.js +28 -0
- package/dist/core/files/base64-helper.d.ts +4 -0
- package/dist/core/files/base64-helper.js +22 -0
- package/dist/core/files/blob-storage.d.ts +1 -0
- package/dist/core/files/blob-storage.js +19 -0
- package/dist/core/files/file-helper.d.ts +6 -0
- package/dist/core/files/file-helper.js +27 -0
- package/dist/core/files/file-service.d.ts +4 -0
- package/dist/core/files/file-service.js +54 -0
- package/dist/core/files/file-types.d.ts +16 -0
- package/dist/core/files/file-types.js +28 -0
- package/dist/core/files/file-with-blob-data-helper.d.ts +19 -0
- package/dist/core/files/file-with-blob-data-helper.js +86 -0
- package/dist/core/files/files-provider.d.ts +8 -0
- package/dist/core/files/files-provider.js +38 -0
- package/dist/core/files/image-resizer.d.ts +31 -0
- package/dist/core/files/image-resizer.js +92 -0
- package/dist/core/files/index.d.ts +9 -0
- package/dist/core/files/index.js +9 -0
- package/dist/core/files/types.d.ts +12 -0
- package/dist/core/files/types.js +10 -0
- package/dist/core/graphql.d.ts +4 -0
- package/dist/core/graphql.js +10 -0
- package/dist/core/handle-generator.d.ts +1 -0
- package/dist/core/handle-generator.js +32 -0
- package/dist/core/i18n/index.d.ts +1 -0
- package/dist/core/i18n/index.js +1 -0
- package/dist/core/i18n/plural.d.ts +14 -0
- package/dist/core/i18n/plural.js +18 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.js +6 -0
- package/dist/core/repository/index.d.ts +2 -0
- package/dist/core/repository/index.js +2 -0
- package/dist/core/repository/map-container.svelte.d.ts +9 -0
- package/dist/core/repository/map-container.svelte.js +22 -0
- package/dist/core/repository/repository-notifier.d.ts +19 -0
- package/dist/core/repository/repository-notifier.js +88 -0
- package/dist/core/repository/repository.svelte.d.ts +2 -0
- package/dist/core/repository/repository.svelte.js +59 -0
- package/dist/core/repository/types.d.ts +15 -0
- package/dist/core/repository/types.js +1 -0
- package/dist/core/theme/app-theme.svelte.d.ts +15 -0
- package/dist/core/theme/app-theme.svelte.js +48 -0
- package/dist/core/theme/index.d.ts +4 -0
- package/dist/core/theme/index.js +3 -0
- package/dist/core/theme/theme-cookie.d.ts +5 -0
- package/dist/core/theme/theme-cookie.js +19 -0
- package/dist/core/theme/types.d.ts +5 -0
- package/dist/core/theme/types.js +8 -0
- package/dist/core/toastr/index.d.ts +3 -0
- package/dist/core/toastr/index.js +2 -0
- package/dist/core/toastr/toaster-host.svelte.d.ts +5 -0
- package/dist/core/toastr/toaster-host.svelte.js +40 -0
- package/dist/core/toastr/toastr.scss +27 -0
- package/dist/core/toastr/toastr.svelte.d.ts +8 -0
- package/dist/core/toastr/toastr.svelte.js +27 -0
- package/dist/core/toastr/types.d.ts +14 -0
- package/dist/core/toastr/types.js +1 -0
- package/dist/core/transitions/index.d.ts +1 -0
- package/dist/core/transitions/index.js +1 -0
- package/dist/core/transitions/slide-horizontally.d.ts +8 -0
- package/dist/core/transitions/slide-horizontally.js +54 -0
- package/dist/core/utils/array-helper.d.ts +21 -0
- package/dist/core/utils/array-helper.js +130 -0
- package/dist/core/utils/base64-serializer.d.ts +4 -0
- package/dist/core/utils/base64-serializer.js +21 -0
- package/dist/core/utils/browser.d.ts +1 -0
- package/dist/core/utils/browser.js +1 -0
- package/dist/core/utils/date-helper.d.ts +51 -0
- package/dist/core/utils/date-helper.js +244 -0
- package/dist/core/utils/dom-helper.d.ts +10 -0
- package/dist/core/utils/dom-helper.js +34 -0
- package/dist/core/utils/href-validator.d.ts +22 -0
- package/dist/core/utils/href-validator.js +52 -0
- package/dist/core/utils/html-helper.d.ts +12 -0
- package/dist/core/utils/html-helper.js +104 -0
- package/dist/core/utils/index.d.ts +13 -0
- package/dist/core/utils/index.js +13 -0
- package/dist/core/utils/lazy-init.d.ts +1 -0
- package/dist/core/utils/lazy-init.js +7 -0
- package/dist/core/utils/number-helper.d.ts +5 -0
- package/dist/core/utils/number-helper.js +32 -0
- package/dist/core/utils/string-generator.d.ts +2 -0
- package/dist/core/utils/string-generator.js +5 -0
- package/dist/core/utils/string-helper.d.ts +12 -0
- package/dist/core/utils/string-helper.js +75 -0
- package/dist/core/utils/url-helper.d.ts +3 -0
- package/dist/core/utils/url-helper.js +13 -0
- package/dist/core/utils/utils.d.ts +29 -0
- package/dist/core/utils/utils.js +108 -0
- package/dist/core/validation/form-validation-handler/form-validation-handler.svelte.d.ts +47 -0
- package/dist/core/validation/form-validation-handler/form-validation-handler.svelte.js +182 -0
- package/dist/core/validation/form-validation-handler/index.d.ts +4 -0
- package/dist/core/validation/form-validation-handler/index.js +3 -0
- package/dist/core/validation/form-validation-handler/stub-form-validator.d.ts +5 -0
- package/dist/core/validation/form-validation-handler/stub-form-validator.js +12 -0
- package/dist/core/validation/form-validation-handler/types.d.ts +10 -0
- package/dist/core/validation/form-validation-handler/types.js +1 -0
- package/dist/core/validation/form-validation-handler/yup-form-validator.d.ts +11 -0
- package/dist/core/validation/form-validation-handler/yup-form-validator.js +49 -0
- package/dist/core/validation/form-validator.svelte.d.ts +12 -0
- package/dist/core/validation/form-validator.svelte.js +21 -0
- package/dist/core/validation/i-validator.d.ts +6 -0
- package/dist/core/validation/i-validator.js +1 -0
- package/dist/core/validation/index.d.ts +5 -0
- package/dist/core/validation/index.js +4 -0
- package/dist/core/validation/validation-schemas/email-validation.d.ts +3 -0
- package/dist/core/validation/validation-schemas/email-validation.js +17 -0
- package/dist/core/validation/validation-schemas/handle-validations.d.ts +3 -0
- package/dist/core/validation/validation-schemas/handle-validations.js +16 -0
- package/dist/core/validation/validation-schemas/index.d.ts +6 -0
- package/dist/core/validation/validation-schemas/index.js +5 -0
- package/dist/core/validation/validation-schemas/number-validations.d.ts +4 -0
- package/dist/core/validation/validation-schemas/number-validations.js +30 -0
- package/dist/core/validation/validation-schemas/text-validations.d.ts +4 -0
- package/dist/core/validation/validation-schemas/text-validations.js +19 -0
- package/dist/core/validation/validation-schemas/types.d.ts +19 -0
- package/dist/core/validation/validation-schemas/types.js +1 -0
- package/dist/core/validation/validation-schemas/validation-messages.d.ts +11 -0
- package/dist/core/validation/validation-schemas/validation-messages.js +14 -0
- package/dist/core/validation/validators-hub.svelte.d.ts +14 -0
- package/dist/core/validation/validators-hub.svelte.js +51 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.js +2 -0
- package/package.json +125 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getValidationMessages } from './validation-messages';
|
|
2
|
+
import * as yup from 'yup';
|
|
3
|
+
export const textValidationSchema = (rules) => {
|
|
4
|
+
const msg = getValidationMessages();
|
|
5
|
+
const schema = yup.string().max(rules.maxLength, msg.maxLength(rules.maxLength));
|
|
6
|
+
if (rules.minLength === 0) {
|
|
7
|
+
return schema;
|
|
8
|
+
}
|
|
9
|
+
else if (rules.minLength === 1) {
|
|
10
|
+
return schema.required(msg.required);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
return schema.min(rules.minLength, msg.minLength(rules.minLength));
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export const formattedTextValidationSchema = (rules, fieldName, formatMessage) => {
|
|
17
|
+
const msg = getValidationMessages();
|
|
18
|
+
return textValidationSchema(rules).test(`${fieldName}-format`, formatMessage ?? msg.badFormat, (val) => !val || new RegExp(rules.format).test(val));
|
|
19
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type TextValidation = {
|
|
2
|
+
minLength: number;
|
|
3
|
+
maxLength: number;
|
|
4
|
+
};
|
|
5
|
+
export type TextWithFormatValidation = TextValidation & {
|
|
6
|
+
format: string;
|
|
7
|
+
};
|
|
8
|
+
export type NumberValidation = {
|
|
9
|
+
isRequired: boolean;
|
|
10
|
+
minValue: number | null;
|
|
11
|
+
maxValue: number | null;
|
|
12
|
+
minExclusive: boolean;
|
|
13
|
+
maxExclusive: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type MinNumberValidation = {
|
|
16
|
+
isRequired: boolean;
|
|
17
|
+
minValue: number | null;
|
|
18
|
+
minExclusive: boolean;
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
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;
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IValidator } from './i-validator';
|
|
2
|
+
export declare class ValidatorsHub implements IValidator {
|
|
3
|
+
private _validators;
|
|
4
|
+
private _isValid;
|
|
5
|
+
private _isModified;
|
|
6
|
+
constructor(...validators: IValidator[]);
|
|
7
|
+
get isValid(): boolean;
|
|
8
|
+
get isModified(): boolean;
|
|
9
|
+
validate: () => Promise<boolean>;
|
|
10
|
+
addValidator: (...validators: IValidator[]) => void;
|
|
11
|
+
removeValidator: (...validators: IValidator[]) => void;
|
|
12
|
+
clear: () => void;
|
|
13
|
+
dispose(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export class ValidatorsHub {
|
|
2
|
+
_validators = $state([]);
|
|
3
|
+
_isValid = $derived.by(() => {
|
|
4
|
+
if (!this._validators.length) {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
return [...this._validators].every((v) => v.isValid);
|
|
8
|
+
});
|
|
9
|
+
_isModified = $derived.by(() => {
|
|
10
|
+
if (!this._validators.length) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
return [...this._validators].some((v) => v.isModified);
|
|
14
|
+
});
|
|
15
|
+
constructor(...validators) {
|
|
16
|
+
this.addValidator(...validators);
|
|
17
|
+
}
|
|
18
|
+
get isValid() {
|
|
19
|
+
return this._isValid;
|
|
20
|
+
}
|
|
21
|
+
get isModified() {
|
|
22
|
+
return this._isModified;
|
|
23
|
+
}
|
|
24
|
+
validate = async () => {
|
|
25
|
+
return (await Promise.all(this._validators.map((v) => v.validate()))).every((v) => v);
|
|
26
|
+
};
|
|
27
|
+
addValidator = (...validators) => {
|
|
28
|
+
this._validators.push(...validators);
|
|
29
|
+
};
|
|
30
|
+
removeValidator = (...validators) => {
|
|
31
|
+
validators.forEach((validator) => {
|
|
32
|
+
const index = this._validators.indexOf(validator);
|
|
33
|
+
if (index === -1) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const removed = this._validators.splice(index, 1);
|
|
37
|
+
try {
|
|
38
|
+
removed[0].dispose();
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
// do nothing
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
clear = () => {
|
|
46
|
+
this.removeValidator(...this._validators);
|
|
47
|
+
};
|
|
48
|
+
dispose() {
|
|
49
|
+
this._validators.forEach((v) => v.dispose());
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/ui/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@streamscloud/kit",
|
|
3
|
+
"version": "0.0.1-1770364570820",
|
|
4
|
+
"author": "StreamsCloud",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/StreamsCloud/streamscloud-frontend-packages.git"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "vite dev --port 3011 --host",
|
|
12
|
+
"build": "svelte-package --tsconfig ./tsconfig.app.json && prettier --write --plugin prettier-plugin-svelte . && eslint --fix .",
|
|
13
|
+
"publish:prod": "npm run build && npm publish --access public --tag latest",
|
|
14
|
+
"version:dev": "node -e \"const fs=require('fs');const pkg=require('./package.json');const base=(pkg.version.includes('-')?pkg.version.split('-')[0]:pkg.version);pkg.version=base+'-'+Date.now();fs.writeFileSync('package.json',JSON.stringify(pkg,null,2)+'\\n');\"",
|
|
15
|
+
"publish:dev": "npm run build && npm run version:dev && npm publish --tag next && git checkout -- package.json",
|
|
16
|
+
"pack": "npm run build && npm pack",
|
|
17
|
+
"preview": "vite preview",
|
|
18
|
+
"check": "svelte-check --tsconfig ./tsconfig.app.json && tsc -p tsconfig.node.json",
|
|
19
|
+
"lint": "prettier --check --plugin prettier-plugin-svelte . && eslint .",
|
|
20
|
+
"lint-format": "prettier --write --plugin prettier-plugin-svelte . && eslint --fix .",
|
|
21
|
+
"format": "prettier --write --plugin prettier-plugin-svelte ."
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"sideEffects": [
|
|
27
|
+
"**/*.css"
|
|
28
|
+
],
|
|
29
|
+
"exports": {
|
|
30
|
+
"./core": {
|
|
31
|
+
"types": "./dist/core/index.d.ts",
|
|
32
|
+
"svelte": "./dist/core/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./core/css": {
|
|
35
|
+
"types": "./dist/core/css/index.d.ts",
|
|
36
|
+
"svelte": "./dist/core/css/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./core/i18n": {
|
|
39
|
+
"types": "./dist/core/i18n/index.d.ts",
|
|
40
|
+
"svelte": "./dist/core/i18n/index.js"
|
|
41
|
+
},
|
|
42
|
+
"./core/transitions": {
|
|
43
|
+
"types": "./dist/core/transitions/index.d.ts",
|
|
44
|
+
"svelte": "./dist/core/transitions/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./core/utils": {
|
|
47
|
+
"types": "./dist/core/utils/index.d.ts",
|
|
48
|
+
"svelte": "./dist/core/utils/index.js"
|
|
49
|
+
},
|
|
50
|
+
"./core/files": {
|
|
51
|
+
"types": "./dist/core/files/index.d.ts",
|
|
52
|
+
"svelte": "./dist/core/files/index.js"
|
|
53
|
+
},
|
|
54
|
+
"./core/repository": {
|
|
55
|
+
"types": "./dist/core/repository/index.d.ts",
|
|
56
|
+
"svelte": "./dist/core/repository/index.js"
|
|
57
|
+
},
|
|
58
|
+
"./core/data-loaders": {
|
|
59
|
+
"types": "./dist/core/data-loaders/index.d.ts",
|
|
60
|
+
"svelte": "./dist/core/data-loaders/index.js"
|
|
61
|
+
},
|
|
62
|
+
"./core/validation": {
|
|
63
|
+
"types": "./dist/core/validation/index.d.ts",
|
|
64
|
+
"svelte": "./dist/core/validation/index.js"
|
|
65
|
+
},
|
|
66
|
+
"./core/theme": {
|
|
67
|
+
"types": "./dist/core/theme/index.d.ts",
|
|
68
|
+
"svelte": "./dist/core/theme/index.js"
|
|
69
|
+
},
|
|
70
|
+
"./core/toastr": {
|
|
71
|
+
"types": "./dist/core/toastr/index.d.ts",
|
|
72
|
+
"svelte": "./dist/core/toastr/index.js"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"peerDependencies": {
|
|
76
|
+
"@urql/core": "^6.0.1",
|
|
77
|
+
"dequal": "^2.0.3",
|
|
78
|
+
"dompurify": "^3.3.1",
|
|
79
|
+
"mime": "^4.1.0",
|
|
80
|
+
"nanoid": "^5.1.6",
|
|
81
|
+
"rfdc": "^1.4.1",
|
|
82
|
+
"svelte": "^5.33.4",
|
|
83
|
+
"svelte-sonner": "^1.0.7",
|
|
84
|
+
"yup": "^1.7.1"
|
|
85
|
+
},
|
|
86
|
+
"devDependencies": {
|
|
87
|
+
"@urql/core": "^6.0.1",
|
|
88
|
+
"@eslint/compat": "^2.0.2",
|
|
89
|
+
"@eslint/js": "^9.39.2",
|
|
90
|
+
"@sveltejs/package": "^2.5.7",
|
|
91
|
+
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
|
92
|
+
"@tsconfig/svelte": "^5.0.7",
|
|
93
|
+
"@types/dompurify": "^3.0.5",
|
|
94
|
+
"autoprefixer": "^10.4.24",
|
|
95
|
+
"dequal": "^2.0.3",
|
|
96
|
+
"dompurify": "^3.3.1",
|
|
97
|
+
"eslint": "^9.39.2",
|
|
98
|
+
"eslint-config-prettier": "^10.1.8",
|
|
99
|
+
"eslint-formatter-codeframe": "^7.32.2",
|
|
100
|
+
"eslint-formatter-visualstudio": "^9.0.1",
|
|
101
|
+
"eslint-plugin-import": "^2.32.0",
|
|
102
|
+
"eslint-plugin-jsonc": "^2.21.0",
|
|
103
|
+
"eslint-plugin-only-warn": "^1.1.0",
|
|
104
|
+
"eslint-plugin-promise": "^7.2.1",
|
|
105
|
+
"eslint-plugin-svelte": "^3.14.0",
|
|
106
|
+
"eslint-plugin-unused-imports": "^4.3.0",
|
|
107
|
+
"globals": "^17.3.0",
|
|
108
|
+
"mime": "^4.1.0",
|
|
109
|
+
"nanoid": "^5.1.6",
|
|
110
|
+
"prettier": "^3.8.1",
|
|
111
|
+
"prettier-plugin-svelte": "^3.4.1",
|
|
112
|
+
"publint": "^0.3.17",
|
|
113
|
+
"rfdc": "^1.4.1",
|
|
114
|
+
"sass": "^1.97.3",
|
|
115
|
+
"svelte": "^5.49.2",
|
|
116
|
+
"svelte-check": "^4.3.6",
|
|
117
|
+
"svelte-sonner": "^1.0.7",
|
|
118
|
+
"svelte-preprocess": "^6.0.3",
|
|
119
|
+
"typescript": "^5.9.3",
|
|
120
|
+
"typescript-eslint": "^8.54.0",
|
|
121
|
+
"vite": "^7.3.1",
|
|
122
|
+
"vite-tsconfig-paths": "^6.0.5",
|
|
123
|
+
"yup": "^1.7.1"
|
|
124
|
+
}
|
|
125
|
+
}
|