@maggioli-design-system/mds-progress 2.8.3 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/mds-progress.cjs.entry.js +1 -1
- package/dist/cjs/mds-progress.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/common/file.js +48 -0
- package/dist/collection/common/icon.js +15 -0
- package/dist/collection/common/unit.js +15 -3
- package/dist/collection/common/yugop/core.js +16 -0
- package/dist/collection/common/yugop/index.js +3 -0
- package/dist/collection/common/yugop/random-text.js +59 -0
- package/dist/collection/common/yugop/utils/math.js +11 -0
- package/dist/collection/common/yugop/utils/noop.js +1 -0
- package/dist/collection/common/yugop/utils/prng.js +21 -0
- package/dist/collection/common/yugop/utils/string.js +2 -0
- package/dist/collection/components/mds-progress/mds-progress.css +195 -0
- package/dist/collection/dictionary/file-extensions.js +64 -0
- package/dist/collection/dictionary/icon.js +6 -1
- package/dist/collection/dictionary/text.js +6 -0
- package/dist/collection/dictionary/variant.js +18 -1
- package/dist/collection/fixtures/filenames.js +57 -0
- package/dist/collection/type/file-types.js +1 -0
- package/dist/collection/type/text.js +1 -0
- package/dist/collection/type/variant-file-format.js +111 -0
- package/dist/components/mds-progress.js +1 -1
- package/dist/documentation.json +3 -3
- package/dist/esm/mds-progress.entry.js +1 -1
- package/dist/esm/mds-progress.js +1 -1
- package/dist/esm-es5/mds-progress.entry.js +1 -1
- package/dist/mds-progress/mds-progress.esm.js +1 -1
- package/dist/mds-progress/mds-progress.js +1 -1
- package/dist/mds-progress/p-20cc5857.system.entry.js +1 -0
- package/{www/build/p-690d2715.system.js → dist/mds-progress/p-91249106.system.js} +1 -1
- package/dist/mds-progress/p-b8ddb760.entry.js +1 -0
- package/dist/stats.json +57 -18
- package/dist/types/common/file.d.ts +12 -0
- package/dist/types/common/icon.d.ts +5 -0
- package/dist/types/common/unit.d.ts +2 -1
- package/dist/types/common/yugop/core.d.ts +10 -0
- package/dist/types/common/yugop/index.d.ts +1 -0
- package/dist/types/common/yugop/random-text.d.ts +31 -0
- package/dist/types/common/yugop/utils/math.d.ts +3 -0
- package/dist/types/common/yugop/utils/noop.d.ts +1 -0
- package/dist/types/common/yugop/utils/prng.d.ts +8 -0
- package/dist/types/common/yugop/utils/string.d.ts +1 -0
- package/dist/types/dictionary/file-extensions.d.ts +11 -0
- package/dist/types/dictionary/icon.d.ts +2 -1
- package/dist/types/dictionary/text.d.ts +2 -0
- package/dist/types/dictionary/variant.d.ts +2 -1
- package/dist/types/fixtures/filenames.d.ts +2 -0
- package/dist/types/type/file-types.d.ts +1 -0
- package/dist/types/type/text.d.ts +1 -0
- package/dist/types/type/variant-file-format.d.ts +11 -0
- package/dist/types/type/variant.d.ts +1 -0
- package/documentation.json +51 -12
- package/package.json +3 -3
- package/readme.md +2 -0
- package/src/common/file.ts +63 -0
- package/src/common/icon.ts +25 -0
- package/src/common/unit.ts +21 -2
- package/src/common/yugop/core.ts +47 -0
- package/src/common/yugop/index.ts +4 -0
- package/src/common/yugop/random-text.ts +95 -0
- package/src/common/yugop/utils/math.ts +21 -0
- package/src/common/yugop/utils/noop.ts +1 -0
- package/src/common/yugop/utils/prng.ts +35 -0
- package/src/common/yugop/utils/string.ts +4 -0
- package/src/dictionary/file-extensions.ts +81 -0
- package/src/dictionary/icon.ts +6 -0
- package/src/dictionary/text.ts +9 -0
- package/src/dictionary/variant.ts +19 -0
- package/src/fixtures/filenames.ts +60 -0
- package/src/fixtures/icons.json +10 -0
- package/src/fixtures/iconsauce.json +3 -0
- package/src/type/file-types.ts +55 -0
- package/src/type/text.ts +4 -0
- package/src/type/variant-file-format.ts +128 -0
- package/src/type/variant.ts +17 -0
- package/www/build/mds-progress.esm.js +1 -1
- package/www/build/mds-progress.js +1 -1
- package/www/build/p-20cc5857.system.entry.js +1 -0
- package/{dist/mds-progress/p-690d2715.system.js → www/build/p-91249106.system.js} +1 -1
- package/www/build/p-b8ddb760.entry.js +1 -0
- package/dist/mds-progress/p-3e473a5b.entry.js +0 -1
- package/dist/mds-progress/p-9135177f.system.entry.js +0 -1
- package/www/build/p-3e473a5b.entry.js +0 -1
- package/www/build/p-9135177f.system.entry.js +0 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface FileFormatVariant {
|
|
2
|
+
color: string;
|
|
3
|
+
icon: string;
|
|
4
|
+
iconBackground: string;
|
|
5
|
+
variant: string;
|
|
6
|
+
}
|
|
7
|
+
interface FileFormatVariants {
|
|
8
|
+
[key: string]: FileFormatVariant;
|
|
9
|
+
}
|
|
10
|
+
declare const fileFormatsVariant: FileFormatVariants;
|
|
11
|
+
export { fileFormatsVariant, FileFormatVariant, FileFormatVariants, };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type ThemeStatusVariantType = 'error' | 'info' | 'success' | 'warning';
|
|
2
2
|
export type ThemeVariantType = 'dark' | 'error' | 'info' | 'light' | 'primary' | 'success' | 'warning';
|
|
3
3
|
export type ThemeFullVariantType = 'amaranth' | 'aqua' | 'blue' | 'dark' | 'error' | 'green' | 'info' | 'light' | 'lime' | 'orange' | 'orchid' | 'sky' | 'success' | 'violet' | 'warning' | 'yellow';
|
|
4
|
+
export type ThemeFullVariantAvatarType = 'amaranth' | 'aqua' | 'blue' | 'error' | 'green' | 'info' | 'lime' | 'orange' | 'orchid' | 'primary' | 'sky' | 'success' | 'violet' | 'warning' | 'yellow';
|
|
4
5
|
export type ThemeLuminanceVariantType = 'dark' | 'light';
|
|
5
6
|
export type LabelVariantType = 'amaranth' | 'aqua' | 'blue' | 'green' | 'lime' | 'orange' | 'orchid' | 'sky' | 'violet' | 'yellow';
|
|
6
7
|
export type ActionVariantType = 'primary' | 'dark' | 'light';
|
package/documentation.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"timestamp": "2024-
|
|
2
|
+
"timestamp": "2024-02-09T14:18:39",
|
|
3
3
|
"compiler": {
|
|
4
4
|
"name": "@stencil/core",
|
|
5
|
-
"version": "4.
|
|
6
|
-
"typescriptVersion": "5.
|
|
5
|
+
"version": "4.10.0",
|
|
6
|
+
"typescriptVersion": "5.3.3"
|
|
7
7
|
},
|
|
8
8
|
"components": [
|
|
9
9
|
{
|
|
@@ -184,6 +184,7 @@
|
|
|
184
184
|
"dependents": [
|
|
185
185
|
"mds-accordion-timer-item",
|
|
186
186
|
"mds-benchmark-bar",
|
|
187
|
+
"mds-input-upload",
|
|
187
188
|
"mds-stepper-bar-item"
|
|
188
189
|
],
|
|
189
190
|
"dependencies": [],
|
|
@@ -194,6 +195,9 @@
|
|
|
194
195
|
"mds-benchmark-bar": [
|
|
195
196
|
"mds-progress"
|
|
196
197
|
],
|
|
198
|
+
"mds-input-upload": [
|
|
199
|
+
"mds-progress"
|
|
200
|
+
],
|
|
197
201
|
"mds-stepper-bar-item": [
|
|
198
202
|
"mds-progress"
|
|
199
203
|
]
|
|
@@ -221,6 +225,16 @@
|
|
|
221
225
|
"docstring": "",
|
|
222
226
|
"path": "src/components/mds-accordion-timer-item/meta/event-detail.ts"
|
|
223
227
|
},
|
|
228
|
+
"src/type/variant.ts::ToneMinimalVariantType": {
|
|
229
|
+
"declaration": "export type ToneMinimalVariantType =\n| 'strong'\n| 'weak'",
|
|
230
|
+
"docstring": "",
|
|
231
|
+
"path": "src/type/variant.ts"
|
|
232
|
+
},
|
|
233
|
+
"src/type/variant.ts::ThemeFullVariantAvatarType": {
|
|
234
|
+
"declaration": "export type ThemeFullVariantAvatarType =\n | 'amaranth'\n | 'aqua'\n | 'blue'\n | 'error'\n | 'green'\n | 'info'\n | 'lime'\n | 'orange'\n | 'orchid'\n | 'primary'\n | 'sky'\n | 'success'\n | 'violet'\n | 'warning'\n | 'yellow'",
|
|
235
|
+
"docstring": "",
|
|
236
|
+
"path": "src/type/variant.ts"
|
|
237
|
+
},
|
|
224
238
|
"src/type/variant.ts::ThemeFullVariantType": {
|
|
225
239
|
"declaration": "export type ThemeFullVariantType =\n | 'amaranth'\n | 'aqua'\n | 'blue'\n | 'dark'\n | 'error'\n | 'green'\n | 'info'\n | 'light'\n | 'lime'\n | 'orange'\n | 'orchid'\n | 'sky'\n | 'success'\n | 'violet'\n | 'warning'\n | 'yellow'",
|
|
226
240
|
"docstring": "",
|
|
@@ -326,16 +340,26 @@
|
|
|
326
340
|
"docstring": "",
|
|
327
341
|
"path": "src/components/mds-dropdown/meta/event-detail.ts"
|
|
328
342
|
},
|
|
329
|
-
"src/
|
|
330
|
-
"declaration": "export type ExtensionSuffixType =\n | '7z'\n | 'ace'\n | 'ai'\n | 'db'\n | 'default'\n | 'dmg'\n | 'doc'\n | 'docm'\n | 'docx'\n | 'eml'\n | 'eps'\n | 'exe'\n | 'flac'\n | 'gif'\n | 'htm'\n | 'html'\n | 'jpe'\n | 'jpeg'\n | 'jpg'\n | 'js'\n | 'json'\n | 'jsx'\n | 'm2v'\n | 'mp2'\n | 'mp3'\n | 'mp4'\n | 'mp4v'\n | 'mpeg'\n | 'mpg'\n | 'mpg4'\n | 'mpga'\n | 'odp'\n | 'ods'\n | 'odt'\n | 'pdf'\n | 'php'\n | 'png'\n | 'ppt'\n | 'rar'\n | 'rtf'\n | 'sass'\n | 'shtml'\n | 'svg'\n | 'tar'\n | 'ts'\n | 'txt'\n | 'wav'\n | 'xar'\n | 'xls'\n | 'xlsx'\n | 'zip'",
|
|
343
|
+
"src/type/file-types.ts::ExtensionSuffixType": {
|
|
344
|
+
"declaration": "export type ExtensionSuffixType =\n | '7z'\n | 'ace'\n | 'ai'\n | 'db'\n | 'default'\n | 'dmg'\n | 'doc'\n | 'docm'\n | 'docx'\n | 'eml'\n | 'eps'\n | 'exe'\n | 'flac'\n | 'gif'\n | 'heic'\n | 'htm'\n | 'html'\n | 'jpe'\n | 'jpeg'\n | 'jpg'\n | 'js'\n | 'json'\n | 'jsx'\n | 'm2v'\n | 'mp2'\n | 'mp3'\n | 'mp4'\n | 'mp4v'\n | 'mpeg'\n | 'mpg'\n | 'mpg4'\n | 'mpga'\n | 'odp'\n | 'ods'\n | 'odt'\n | 'pdf'\n | 'php'\n | 'png'\n | 'ppt'\n | 'rar'\n | 'rtf'\n | 'sass'\n | 'shtml'\n | 'svg'\n | 'tar'\n | 'tiff'\n | 'ts'\n | 'txt'\n | 'wav'\n | 'webp'\n | 'xar'\n | 'xls'\n | 'xlsx'\n | 'zip'",
|
|
331
345
|
"docstring": "",
|
|
332
|
-
"path": "src/
|
|
346
|
+
"path": "src/type/file-types.ts"
|
|
333
347
|
},
|
|
334
348
|
"src/components/mds-file/meta/event-detail.ts::MdsFileEventDetail": {
|
|
335
349
|
"declaration": "export interface MdsFileEventDetail {\n description: string\n extension: string\n filename: string\n target: HTMLMdsFileElement\n type: string\n}",
|
|
336
350
|
"docstring": "",
|
|
337
351
|
"path": "src/components/mds-file/meta/event-detail.ts"
|
|
338
352
|
},
|
|
353
|
+
"src/type/text.ts::TypographyTruncateType": {
|
|
354
|
+
"declaration": "export type TypographyTruncateType =\n | 'all'\n | 'none'\n | 'word'",
|
|
355
|
+
"docstring": "",
|
|
356
|
+
"path": "src/type/text.ts"
|
|
357
|
+
},
|
|
358
|
+
"src/components/mds-file-preview/meta/event-detail.ts::MdsFilePreviewEventDetail": {
|
|
359
|
+
"declaration": "export interface MdsFilePreviewEventDetail {\n extension: string\n filename: string\n target: HTMLMdsFileElement\n}",
|
|
360
|
+
"docstring": "",
|
|
361
|
+
"path": "src/components/mds-file-preview/meta/event-detail.ts"
|
|
362
|
+
},
|
|
339
363
|
"src/components/mds-filter/meta/event-detail.ts::MdsFilterEventDetail": {
|
|
340
364
|
"declaration": "export interface MdsFilterEventDetail {\n children: NodeListOf<HTMLMdsFilterItemElement>\n value: string\n}",
|
|
341
365
|
"docstring": "",
|
|
@@ -471,6 +495,11 @@
|
|
|
471
495
|
"docstring": "",
|
|
472
496
|
"path": "src/type/input.ts"
|
|
473
497
|
},
|
|
498
|
+
"src/components/mds-input-upload/meta/types.ts::AttachmentSort": {
|
|
499
|
+
"declaration": "enum AttachmentSort {\n status = 'status',\n date = 'date',\n}",
|
|
500
|
+
"docstring": "",
|
|
501
|
+
"path": "src/components/mds-input-upload/meta/types.ts"
|
|
502
|
+
},
|
|
474
503
|
"src/type/typography.ts::TypographyType": {
|
|
475
504
|
"declaration": "export type TypographyType =\n | 'action'\n | 'caption'\n | 'snippet'\n | 'detail'\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'h6'\n | 'hack'\n | 'label'\n | 'option'\n | 'paragraph'\n | 'tip'",
|
|
476
505
|
"docstring": "",
|
|
@@ -511,6 +540,11 @@
|
|
|
511
540
|
"docstring": "",
|
|
512
541
|
"path": "src/components/mds-progress/meta/types.ts"
|
|
513
542
|
},
|
|
543
|
+
"src/components/mds-push-notification/meta/types.ts::NotificationPreviewType": {
|
|
544
|
+
"declaration": "export type NotificationPreviewType =\n | 'avatar'\n | 'image'",
|
|
545
|
+
"docstring": "",
|
|
546
|
+
"path": "src/components/mds-push-notification/meta/types.ts"
|
|
547
|
+
},
|
|
514
548
|
"src/components/mds-stepper-bar/meta/event-detail.ts::MdsStepperBarEventDetail": {
|
|
515
549
|
"declaration": "export interface MdsStepperBarEventDetail {\n step: number\n value: string\n}",
|
|
516
550
|
"docstring": "",
|
|
@@ -522,7 +556,7 @@
|
|
|
522
556
|
"path": "src/components/mds-stepper-bar-item/meta/event-detail.ts"
|
|
523
557
|
},
|
|
524
558
|
"src/components/mds-tab/meta/event-detail.ts::MdsTabEventDetail": {
|
|
525
|
-
"declaration": "export interface MdsTabEventDetail {\n id: number\n}",
|
|
559
|
+
"declaration": "export interface MdsTabEventDetail {\n id: number\n value?: string\n}",
|
|
526
560
|
"docstring": "",
|
|
527
561
|
"path": "src/components/mds-tab/meta/event-detail.ts"
|
|
528
562
|
},
|
|
@@ -536,6 +570,16 @@
|
|
|
536
570
|
"docstring": "",
|
|
537
571
|
"path": "src/type/typography.ts"
|
|
538
572
|
},
|
|
573
|
+
"src/components/mds-tab-item/meta/event-detail.ts::MdsTabItemEventDetail": {
|
|
574
|
+
"declaration": "export interface MdsTabItemEventDetail {\n target: HTMLMdsTabItemElement\n value?: string\n}",
|
|
575
|
+
"docstring": "",
|
|
576
|
+
"path": "src/components/mds-tab-item/meta/event-detail.ts"
|
|
577
|
+
},
|
|
578
|
+
"src/components/mds-text/meta/types.ts::TextAnimationType": {
|
|
579
|
+
"declaration": "export type TextAnimationType =\n | 'none'\n | 'yugop'",
|
|
580
|
+
"docstring": "",
|
|
581
|
+
"path": "src/components/mds-text/meta/types.ts"
|
|
582
|
+
},
|
|
539
583
|
"src/components/mds-text/meta/types.ts::TypographyTagType": {
|
|
540
584
|
"declaration": "export type TypographyTagType =\n | 'abbr'\n | 'address'\n | 'article'\n | 'b'\n | 'bdo'\n | 'blockquote'\n | 'cite'\n | 'code'\n | 'dd'\n | 'del'\n | 'details'\n | 'dfn'\n | 'div'\n | 'dl'\n | 'dt'\n | 'em'\n | 'figcaption'\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'h6'\n | 'i'\n | 'ins'\n | 'kbd'\n | 'label'\n | 'legend'\n | 'li'\n | 'mark'\n | 'ol'\n | 'p'\n | 'pre'\n | 'q'\n | 'rb'\n | 'rt'\n | 'ruby'\n | 's'\n | 'samp'\n | 'small'\n | 'span'\n | 'strong'\n | 'sub'\n | 'summary'\n | 'sup'\n | 'time'\n | 'u'\n | 'ul'\n | 'var'",
|
|
541
585
|
"docstring": "",
|
|
@@ -546,11 +590,6 @@
|
|
|
546
590
|
"docstring": "",
|
|
547
591
|
"path": "src/type/variant.ts"
|
|
548
592
|
},
|
|
549
|
-
"src/type/variant.ts::ToneMinimalVariantType": {
|
|
550
|
-
"declaration": "export type ToneMinimalVariantType =\n| 'strong'\n| 'weak'",
|
|
551
|
-
"docstring": "",
|
|
552
|
-
"path": "src/type/variant.ts"
|
|
553
|
-
},
|
|
554
593
|
"src/components/mds-toast/meta/types.ts::ToastPosition": {
|
|
555
594
|
"declaration": "export type ToastPosition =\n | 'top-left'\n | 'top-center'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-center'\n | 'bottom-right'",
|
|
556
595
|
"docstring": "",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maggioli-design-system/mds-progress",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "mds-progress is a web-component from Magma Design System, built with StencilJS, TypeScript, Storybook. It's based on the web-component standard and it's designed to be agnostic from the JavaScirpt framework you are using.",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"test": "stencil test --spec --e2e"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@maggioli-design-system/styles": "14.1
|
|
28
|
-
"@stencil/core": "4.
|
|
27
|
+
"@maggioli-design-system/styles": "14.2.1",
|
|
28
|
+
"@stencil/core": "4.10.0"
|
|
29
29
|
},
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"author": {
|
package/readme.md
CHANGED
|
@@ -34,6 +34,7 @@ This is a web-component from Maggioli Design System [Magma](https://magma.maggio
|
|
|
34
34
|
|
|
35
35
|
- [mds-accordion-timer-item](../mds-accordion-timer-item)
|
|
36
36
|
- [mds-benchmark-bar](../mds-benchmark-bar)
|
|
37
|
+
- [mds-input-upload](../mds-input-upload)
|
|
37
38
|
- [mds-stepper-bar-item](../mds-stepper-bar-item)
|
|
38
39
|
|
|
39
40
|
### Graph
|
|
@@ -41,6 +42,7 @@ This is a web-component from Maggioli Design System [Magma](https://magma.maggio
|
|
|
41
42
|
graph TD;
|
|
42
43
|
mds-accordion-timer-item --> mds-progress
|
|
43
44
|
mds-benchmark-bar --> mds-progress
|
|
45
|
+
mds-input-upload --> mds-progress
|
|
44
46
|
mds-stepper-bar-item --> mds-progress
|
|
45
47
|
style mds-progress fill:#f9f,stroke:#333,stroke-width:4px
|
|
46
48
|
```
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { fileExtensionsDictionary, ExtensionInfo } from '@dictionary/file-extensions'
|
|
2
|
+
import { fileFormatsVariant } from '@type/variant-file-format'
|
|
3
|
+
|
|
4
|
+
interface FileFormatsVariants {
|
|
5
|
+
color: string
|
|
6
|
+
icon: string
|
|
7
|
+
iconBackground: string
|
|
8
|
+
variant: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const sanitizeFilename = (filename: string, error: string = 'Attribute "filename" is undefined.') => {
|
|
12
|
+
if (filename === undefined ) {
|
|
13
|
+
throw console.error(error)
|
|
14
|
+
}
|
|
15
|
+
if (filename.includes('/')) {
|
|
16
|
+
return filename.split('/').pop() ?? ''
|
|
17
|
+
}
|
|
18
|
+
return filename
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const sanitizeSuffix = (rawFilename: string) => {
|
|
22
|
+
const filename = sanitizeFilename(rawFilename)
|
|
23
|
+
if (filename.includes('.')) {
|
|
24
|
+
return filename.split('.').pop() ?? ''
|
|
25
|
+
}
|
|
26
|
+
return filename
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const getName = (rawFilename: string): string => {
|
|
30
|
+
const filename = sanitizeFilename(rawFilename)
|
|
31
|
+
if (filename.includes('.')) {
|
|
32
|
+
return filename.split('.')[0] ?? ''
|
|
33
|
+
}
|
|
34
|
+
return filename
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const getSuffix = (rawFilename: string, suffixOverride?: string): string => {
|
|
38
|
+
const suffix = sanitizeSuffix(rawFilename)
|
|
39
|
+
const filename = sanitizeFilename(rawFilename)
|
|
40
|
+
if (suffixOverride !== null && suffixOverride !== undefined) {
|
|
41
|
+
return suffixOverride.toLowerCase()
|
|
42
|
+
}
|
|
43
|
+
if (suffix !== filename) {
|
|
44
|
+
return suffix
|
|
45
|
+
}
|
|
46
|
+
return 'default'
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const getExtensionInfos = (rawFilename: string, suffixOverride?: string): ExtensionInfo => {
|
|
50
|
+
const suffix = getSuffix(rawFilename, suffixOverride).toLocaleLowerCase()
|
|
51
|
+
return fileExtensionsDictionary[suffix] ?? fileExtensionsDictionary.default
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const getFormatsVariant = (rawFilename: string, suffixOverride?: string): FileFormatsVariants => {
|
|
55
|
+
return fileFormatsVariant[getExtensionInfos(rawFilename, suffixOverride).format]
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export {
|
|
59
|
+
getExtensionInfos,
|
|
60
|
+
getFormatsVariant,
|
|
61
|
+
getSuffix,
|
|
62
|
+
getName,
|
|
63
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const BASE64_SVG_ICON = 'data:image/svg+xml;base64,'
|
|
2
|
+
const MARKUP_SVG_ICON = '<svg '
|
|
3
|
+
|
|
4
|
+
const isIconFormatIsBase64 = (icon?: string): boolean => {
|
|
5
|
+
if (!icon) {
|
|
6
|
+
return false
|
|
7
|
+
}
|
|
8
|
+
return icon.startsWith(BASE64_SVG_ICON)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const isIconFormatIsSVG = (icon?: string): boolean => {
|
|
12
|
+
if (!icon) {
|
|
13
|
+
return false
|
|
14
|
+
}
|
|
15
|
+
return icon.startsWith(MARKUP_SVG_ICON)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
isIconFormatIsBase64,
|
|
22
|
+
isIconFormatIsSVG,
|
|
23
|
+
BASE64_SVG_ICON,
|
|
24
|
+
MARKUP_SVG_ICON,
|
|
25
|
+
}
|
package/src/common/unit.ts
CHANGED
|
@@ -1,14 +1,33 @@
|
|
|
1
1
|
const cssDurationToMilliseconds = (duration: string, defaultValue = 1000): number => {
|
|
2
|
+
|
|
3
|
+
if (duration.includes('ms')) {
|
|
4
|
+
return Number(duration.replace('ms', ''))
|
|
5
|
+
}
|
|
6
|
+
|
|
2
7
|
if (duration.includes('s')) {
|
|
3
8
|
return Number(duration.replace('s', '')) * 1000
|
|
4
9
|
}
|
|
5
10
|
|
|
6
|
-
|
|
7
|
-
|
|
11
|
+
return defaultValue
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const cssSizeToNumber = (size: string, defaultValue = 0): number => {
|
|
15
|
+
if (size.includes('px')) {
|
|
16
|
+
return Number(size.replace('px', ''))
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (size.includes('rem')) {
|
|
20
|
+
return Number(size.replace('rem', '')) * 16
|
|
8
21
|
}
|
|
9
22
|
|
|
23
|
+
if (size.includes('em')) {
|
|
24
|
+
return Number(size.replace('em', '')) * 16
|
|
25
|
+
}
|
|
26
|
+
|
|
10
27
|
return defaultValue
|
|
11
28
|
}
|
|
29
|
+
|
|
12
30
|
export {
|
|
13
31
|
cssDurationToMilliseconds,
|
|
32
|
+
cssSizeToNumber,
|
|
14
33
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { generator } from './utils/prng'
|
|
2
|
+
import { strToCharCodeArray } from './utils/string'
|
|
3
|
+
import { randomSign, minMaxLooped } from './utils/math'
|
|
4
|
+
const rand = generator()
|
|
5
|
+
|
|
6
|
+
const random: (arg0: number, arg1: number) => () => number = (
|
|
7
|
+
base,
|
|
8
|
+
offset,
|
|
9
|
+
) => () => (base + rand.range(0, offset)) * randomSign()
|
|
10
|
+
|
|
11
|
+
export const generateRandomCharCodeArray: (
|
|
12
|
+
arg0: number,
|
|
13
|
+
arg1: number
|
|
14
|
+
) => (arg0: string) => number[] = (base, offset) => str =>
|
|
15
|
+
strToCharCodeArray(str).map(random(base, offset))
|
|
16
|
+
type Options = {
|
|
17
|
+
str: string
|
|
18
|
+
minCharCode: number
|
|
19
|
+
maxCharCode: number
|
|
20
|
+
placeholderChar: string
|
|
21
|
+
charStep: number
|
|
22
|
+
}
|
|
23
|
+
export const charCodeArrayToString: (
|
|
24
|
+
arg0: Options
|
|
25
|
+
) => (arg0: number[]) => string = ({
|
|
26
|
+
str,
|
|
27
|
+
minCharCode,
|
|
28
|
+
maxCharCode,
|
|
29
|
+
placeholderChar,
|
|
30
|
+
charStep,
|
|
31
|
+
}) => charCodes =>
|
|
32
|
+
charCodes.reduce((acc, item, index) => {
|
|
33
|
+
if (item !== 0) {
|
|
34
|
+
if (Math.abs(item) > charStep) {
|
|
35
|
+
return acc + placeholderChar
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
acc +
|
|
40
|
+
String.fromCharCode(
|
|
41
|
+
minMaxLooped(minCharCode, maxCharCode)(str.charCodeAt(index) + item),
|
|
42
|
+
)
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return acc + str.charAt(index)
|
|
47
|
+
}, '')
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { generateRandomCharCodeArray, charCodeArrayToString } from './core'
|
|
2
|
+
import { noop } from './utils/noop'
|
|
3
|
+
|
|
4
|
+
type Options = {
|
|
5
|
+
str: string
|
|
6
|
+
speed?: number
|
|
7
|
+
placeholderChar?: string
|
|
8
|
+
frameOffset?: number
|
|
9
|
+
charOffset?: number
|
|
10
|
+
charStep?: number
|
|
11
|
+
minCharCode?: number
|
|
12
|
+
maxCharCode?: number
|
|
13
|
+
onProgress?: (arg0: string) => void
|
|
14
|
+
onComplete?: (arg0: string) => void
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
class RandomText {
|
|
18
|
+
static defaults: Options = {
|
|
19
|
+
str: '',
|
|
20
|
+
speed: 2,
|
|
21
|
+
placeholderChar: '_',
|
|
22
|
+
frameOffset: 30,
|
|
23
|
+
charOffset: 20,
|
|
24
|
+
charStep: 10,
|
|
25
|
+
minCharCode: 32,
|
|
26
|
+
maxCharCode: 122,
|
|
27
|
+
onProgress: noop,
|
|
28
|
+
onComplete: noop,
|
|
29
|
+
}
|
|
30
|
+
str: string
|
|
31
|
+
speed: number
|
|
32
|
+
placeholderChar: string
|
|
33
|
+
frameOffset: number
|
|
34
|
+
charOffset: number
|
|
35
|
+
charStep: number
|
|
36
|
+
minCharCode: number
|
|
37
|
+
maxCharCode: number
|
|
38
|
+
onProgress: (...args: Array<string>) => string
|
|
39
|
+
onComplete: (...args: Array<string>) => string
|
|
40
|
+
rafId: number // TODO: should be #rafId for private
|
|
41
|
+
|
|
42
|
+
constructor (options: Options) {
|
|
43
|
+
Object.assign(this, { ...RandomText.defaults, ...options })
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
start = (): void => {
|
|
47
|
+
const { frameOffset, charOffset, str, speed } = this
|
|
48
|
+
const randoms = generateRandomCharCodeArray(frameOffset, charOffset)(str)
|
|
49
|
+
this.stop()
|
|
50
|
+
this.rafId = requestAnimationFrame(() => {
|
|
51
|
+
this.step(randoms, speed, speed)
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
stop (): void {
|
|
56
|
+
cancelAnimationFrame(this.rafId)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
step (randoms: number[], stepCount: number, speed: number): void {
|
|
60
|
+
const {
|
|
61
|
+
str,
|
|
62
|
+
charStep,
|
|
63
|
+
minCharCode,
|
|
64
|
+
maxCharCode,
|
|
65
|
+
placeholderChar,
|
|
66
|
+
onProgress,
|
|
67
|
+
onComplete,
|
|
68
|
+
} = this
|
|
69
|
+
const stepArray = randoms.slice(0, stepCount)
|
|
70
|
+
const steppedArray = stepArray.map(item => {
|
|
71
|
+
if (item > 0) return item - 1
|
|
72
|
+
if (item < 0) return item + 1
|
|
73
|
+
return 0
|
|
74
|
+
})
|
|
75
|
+
const output = charCodeArrayToString({
|
|
76
|
+
str,
|
|
77
|
+
minCharCode,
|
|
78
|
+
maxCharCode,
|
|
79
|
+
placeholderChar,
|
|
80
|
+
charStep,
|
|
81
|
+
})(steppedArray)
|
|
82
|
+
const updatedRandoms = [...steppedArray, ...randoms.slice(stepCount)]
|
|
83
|
+
onProgress(output)
|
|
84
|
+
|
|
85
|
+
if (output !== str) {
|
|
86
|
+
this.rafId = requestAnimationFrame(() => {
|
|
87
|
+
this.step(updatedRandoms, stepCount + speed, speed)
|
|
88
|
+
})
|
|
89
|
+
} else {
|
|
90
|
+
onComplete(output)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export default RandomText
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { generator } from './prng'
|
|
2
|
+
|
|
3
|
+
const rand = generator()
|
|
4
|
+
export const randomSign: () => number = () =>
|
|
5
|
+
(Math.round(Math.random()) - 0.5) * 2
|
|
6
|
+
export const generateRandomNumbers: (
|
|
7
|
+
arg0: number
|
|
8
|
+
) => (
|
|
9
|
+
arg0: number
|
|
10
|
+
) => (arg0: number) => number[] = base => charOffset => length =>
|
|
11
|
+
[...Array(length)].map(
|
|
12
|
+
() => (base + rand.range(0, charOffset)) * randomSign(),
|
|
13
|
+
)
|
|
14
|
+
export const minMaxLooped: (
|
|
15
|
+
arg0: number,
|
|
16
|
+
arg1: number
|
|
17
|
+
) => (arg0: number) => number = (min, max) => value => {
|
|
18
|
+
if (value > max) return min + (value - max)
|
|
19
|
+
if (value < min) return max + (value - min)
|
|
20
|
+
return value
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const noop: (...rest: unknown[]) => unknown = () => {}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const int32 = 2147483647
|
|
2
|
+
|
|
3
|
+
const gen: (arg0: number) => number = v => (v * 16807) % int32
|
|
4
|
+
|
|
5
|
+
const randomFloat: (arg0: number) => number = v => gen(v) / int32
|
|
6
|
+
|
|
7
|
+
const randomInt: (arg0: number) => number = v => gen(v)
|
|
8
|
+
|
|
9
|
+
type Generator = (
|
|
10
|
+
_?: number
|
|
11
|
+
) => {
|
|
12
|
+
random: () => number
|
|
13
|
+
randomFloat: () => number
|
|
14
|
+
range: (min: number, max: number) => number
|
|
15
|
+
rangeFloat: (min: number, max: number) => number
|
|
16
|
+
}
|
|
17
|
+
export const generator: Generator = (seed = 1) => {
|
|
18
|
+
let value = seed < 1 ? 1 : seed
|
|
19
|
+
|
|
20
|
+
const next: () => number = () => {
|
|
21
|
+
value = randomInt(value)
|
|
22
|
+
return value
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
random: () => next(),
|
|
27
|
+
randomFloat: () => randomFloat(next()),
|
|
28
|
+
range: (min, max) => {
|
|
29
|
+
const minimum = min - 0.4999
|
|
30
|
+
const maximum = max + 0.4999
|
|
31
|
+
return Math.round(minimum + (maximum - minimum) * randomFloat(next()))
|
|
32
|
+
},
|
|
33
|
+
rangeFloat: (min, max) => min + (max - min) * randomFloat(next()),
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
interface FileExtenstion {
|
|
2
|
+
[key: string]: ExtensionInfo
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
interface ExtensionInfo {
|
|
6
|
+
preview?: boolean
|
|
7
|
+
format: string
|
|
8
|
+
description: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const fileExtensionsDictionary: FileExtenstion = {
|
|
12
|
+
'7z': { format: 'archive', description: 'Archivio compresso' },
|
|
13
|
+
ace: { format: 'archive', description: 'Archivio compresso' },
|
|
14
|
+
ai: { format: 'vector', description: 'Vettoriale Adobe Illustrator' },
|
|
15
|
+
dart: { format: 'code', description: 'Dart' },
|
|
16
|
+
db: { format: 'data', description: 'File di database' },
|
|
17
|
+
default: { format: 'attachment', description: 'Formato sconosciuto' },
|
|
18
|
+
dmg: { format: 'executable', description: 'Apple Disk Image' },
|
|
19
|
+
doc: { format: 'text', description: 'Documento Microsoft Word' },
|
|
20
|
+
docm: { format: 'text', description: 'Documento Microsoft Word' },
|
|
21
|
+
docx: { format: 'text', description: 'Documento Microsoft Word Compresso' },
|
|
22
|
+
eml: { format: 'email', description: 'E-mail di posta elettronica' },
|
|
23
|
+
eps: { format: 'vector', description: 'Vettoriale Corel Draw' },
|
|
24
|
+
exe: { format: 'executable', description: 'File eseguibile Windows' },
|
|
25
|
+
flac: { format: 'audio', description: 'Audio non compresso' },
|
|
26
|
+
gif: { format: 'image', description: 'Immagine compressa', preview: true },
|
|
27
|
+
htm: { format: 'markup', description: 'Pagina web' },
|
|
28
|
+
heic: { format: 'image', description: 'High Efficiency Image File Format' },
|
|
29
|
+
html: { format: 'markup', description: 'Pagina web' },
|
|
30
|
+
jpe: { format: 'image', description: 'Immagine compressa', preview: true },
|
|
31
|
+
jpeg: { format: 'image', description: 'Immagine compressa', preview: true },
|
|
32
|
+
jpg: { format: 'image', description: 'Immagine compressa', preview: true },
|
|
33
|
+
js: { format: 'code', description: 'JavaScript' },
|
|
34
|
+
json: { format: 'data', description: 'JavaScript Object Notation' },
|
|
35
|
+
jsx: { format: 'code', description: 'JavaScript' },
|
|
36
|
+
m2v: { format: 'video', description: 'Filmato SD' },
|
|
37
|
+
mp2: { format: 'audio', description: 'Audio compresso' },
|
|
38
|
+
mp3: { format: 'audio', description: 'Audio compresso' },
|
|
39
|
+
mp4: { format: 'video', description: 'Filmato HD' },
|
|
40
|
+
mp4v: { format: 'video', description: 'Filmato HD' },
|
|
41
|
+
mpeg: { format: 'video', description: 'Filmato SD' },
|
|
42
|
+
mpg4: { format: 'video', description: 'Filmato SD' },
|
|
43
|
+
mpg: { format: 'video', description: 'Filmato SD' },
|
|
44
|
+
mpga: { format: 'audio', description: 'Audio compresso' },
|
|
45
|
+
odp: { format: 'slide', description: 'Slide di presentazione LibreOffice' },
|
|
46
|
+
ods: { format: 'spreadsheet', description: 'Foglio di calcolo LibreOffice' },
|
|
47
|
+
odt: { format: 'text', description: 'File di testo LibreOffice' },
|
|
48
|
+
pdf: { format: 'document', description: 'Documento Adobe' },
|
|
49
|
+
php: { format: 'code', description: 'Hypertext Preprocessor' },
|
|
50
|
+
png: { format: 'image', description: 'Immagine Portable Network Graphics', preview: true },
|
|
51
|
+
ppt: { format: 'slide', description: 'Slide di presentazione PowerPoint' },
|
|
52
|
+
rar: { format: 'archive', description: 'Archivio compresso' },
|
|
53
|
+
rtf: { format: 'text', description: 'Documento di testo Rich Text Format' },
|
|
54
|
+
sass: { format: 'code', description: 'Syntactically Awesome StyleSheets' },
|
|
55
|
+
shtml: { format: 'markup', description: 'Pagina web' },
|
|
56
|
+
svg: { format: 'vector', description: 'Scalable Vector Graphics', preview: true },
|
|
57
|
+
tar: { format: 'archive', description: 'Archivio non compresso' },
|
|
58
|
+
tiff: { format: 'image', description: 'Tag Image File Format' },
|
|
59
|
+
ts: { format: 'code', description: 'TypeScript' },
|
|
60
|
+
tsx: { format: 'code', description: 'TypeScript Extended Syntax' },
|
|
61
|
+
txt: { format: 'text', description: 'Documento di testo non formattato' },
|
|
62
|
+
wav: { format: 'audio', description: 'Audio non compresso' },
|
|
63
|
+
webp: { format: 'image', description: 'Immagine Web Picture', preview: true },
|
|
64
|
+
xar: { format: 'archive', description: 'Archivio compresso' },
|
|
65
|
+
xls: { format: 'spreadsheet', description: 'Foglio di calcolo Office' },
|
|
66
|
+
xlsx: { format: 'spreadsheet', description: 'Foglio di calcolo Office' },
|
|
67
|
+
zip: { format: 'archive', description: 'Archivio compresso' },
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const genericMimeToExt: Map<string, string[]> = new Map([
|
|
71
|
+
['image', ['.png', '.jpg', '.jpeg', '.tiff', '.webp', '.jpe', '.gif', '.heic']],
|
|
72
|
+
['audio', ['.mp2', '.mp3', '.mpga', '.wav', '.flac']],
|
|
73
|
+
['video', ['.mv2', '.mp4', '.mp4v', '.mpeg', '.mpg4', '.mpg']],
|
|
74
|
+
])
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
FileExtenstion,
|
|
78
|
+
ExtensionInfo,
|
|
79
|
+
fileExtensionsDictionary,
|
|
80
|
+
genericMimeToExt,
|
|
81
|
+
}
|
package/src/dictionary/icon.ts
CHANGED
|
@@ -2,8 +2,14 @@ import jsonIconsDictionary from '../fixtures/icons.json'
|
|
|
2
2
|
import jsonMggIconsDictionary from '../fixtures/iconsauce.json'
|
|
3
3
|
const iconsDictionary = jsonIconsDictionary
|
|
4
4
|
const mggIconsDictionary = jsonMggIconsDictionary
|
|
5
|
+
const svgIconsDictionary = [
|
|
6
|
+
`${location.origin}/svg/mi/baseline/email.svg`,
|
|
7
|
+
'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjQiPjxwYXRoIGQ9Im0yMzMtODAgNjUtMjgxTDgwLTU1MGwyODgtMjUgMTEyLTI2NSAxMTIgMjY1IDI4OCAyNS0yMTggMTg5IDY1IDI4MS0yNDctMTQ5TDIzMy04MFoiLz48L3N2Zz4=',
|
|
8
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6s-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8s-3.58-8-8-8z"/></svg>',
|
|
9
|
+
]
|
|
5
10
|
|
|
6
11
|
export {
|
|
7
12
|
iconsDictionary,
|
|
8
13
|
mggIconsDictionary,
|
|
14
|
+
svgIconsDictionary,
|
|
9
15
|
}
|