@milaboratories/uikit 1.2.13 → 1.2.14
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/CHANGELOG.md +6 -0
- package/dist/pl-uikit.js +173 -161
- package/dist/pl-uikit.umd.cjs +4 -3
- package/dist/src/components/PlLogView/PlLogView.vue.d.ts +17 -0
- package/dist/style.css +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +5 -4
- package/src/assets/typography.scss +1 -0
- package/src/components/PlLogView/PlLogView.vue +24 -4
- package/src/components/PlLogView/pl-log-view.scss +22 -3
- package/src/types.ts +8 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/uikit",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/pl-uikit.umd.js",
|
|
6
6
|
"module": "dist/pl-uikit.js",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"vite": "^5.4.8",
|
|
31
31
|
"vue-tsc": "^2.1.6",
|
|
32
32
|
"yarpm": "^1.2.0",
|
|
33
|
-
"@milaboratories/helpers": "^1.6.
|
|
34
|
-
"@platforma-sdk/model": "^1.2.
|
|
33
|
+
"@milaboratories/helpers": "^1.6.4",
|
|
34
|
+
"@platforma-sdk/model": "^1.2.30"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"dev": "vite",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"minify-icons": "svgo -f src/assets/icons/icon-assets -o src/assets/icons/icon-assets-min",
|
|
48
48
|
"generate-icons": "pnpm run parse-icons-folder && pnpm run minify-icons",
|
|
49
49
|
"lint": "eslint . --ext js,ts,vue",
|
|
50
|
-
"check": "yarpm type-check && yarpm test && yarpm lint"
|
|
50
|
+
"check": "yarpm type-check && yarpm test && yarpm lint",
|
|
51
|
+
"do-pack": "rm *.tgz && pnpm pack && mv *.tgz package.tgz"
|
|
51
52
|
}
|
|
52
53
|
}
|
|
@@ -8,20 +8,39 @@ export default {
|
|
|
8
8
|
</script>
|
|
9
9
|
|
|
10
10
|
<script lang="ts" setup>
|
|
11
|
-
import { onMounted, onUpdated, ref } from 'vue';
|
|
11
|
+
import { computed, onMounted, onUpdated, ref } from 'vue';
|
|
12
12
|
import MaskIcon24 from '../MaskIcon24.vue';
|
|
13
13
|
import './pl-log-view.scss';
|
|
14
|
-
import { tapIf } from '@milaboratories/helpers';
|
|
14
|
+
import { okOptional, tapIf } from '@milaboratories/helpers';
|
|
15
|
+
import type { ValueOrErrors } from '@platforma-sdk/model';
|
|
16
|
+
|
|
17
|
+
const getOutputError = <T,>(o?: ValueOrErrors<T>) => {
|
|
18
|
+
if (o && o.ok === false) {
|
|
19
|
+
return o.errors.join('\n');
|
|
20
|
+
}
|
|
21
|
+
};
|
|
15
22
|
|
|
16
23
|
const props = defineProps<{
|
|
17
24
|
/**
|
|
18
25
|
* String contents
|
|
19
26
|
*/
|
|
20
27
|
value?: string;
|
|
28
|
+
/**
|
|
29
|
+
* String contents
|
|
30
|
+
*/
|
|
31
|
+
error?: unknown;
|
|
32
|
+
/**
|
|
33
|
+
* Block output (Note: error and value take precedence over output property)
|
|
34
|
+
*/
|
|
35
|
+
output?: ValueOrErrors<unknown>;
|
|
21
36
|
}>();
|
|
22
37
|
|
|
23
38
|
const contentRef = ref<HTMLElement>();
|
|
24
39
|
|
|
40
|
+
const computedError = computed(() => props.error ?? getOutputError(props.output));
|
|
41
|
+
|
|
42
|
+
const computedValue = computed(() => props.value ?? okOptional(props.output));
|
|
43
|
+
|
|
25
44
|
const onClickCopy = () => {
|
|
26
45
|
if (props.value) {
|
|
27
46
|
navigator.clipboard.writeText(props.value);
|
|
@@ -43,8 +62,9 @@ onUpdated(scrollDown);
|
|
|
43
62
|
</script>
|
|
44
63
|
|
|
45
64
|
<template>
|
|
46
|
-
<div class="pl-log-view">
|
|
65
|
+
<div class="pl-log-view" :class="{ 'has-error': computedError }">
|
|
47
66
|
<MaskIcon24 title="Copy content" class="pl-log-view__copy" name="clipboard" @click="onClickCopy" />
|
|
48
|
-
<div
|
|
67
|
+
<div v-if="computedError" class="pl-log-view__error">{{ computedError }}</div>
|
|
68
|
+
<div v-else ref="contentRef" class="pl-log-view__content">{{ computedValue }}</div>
|
|
49
69
|
</div>
|
|
50
70
|
</template>
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
@import "@/assets/mixins";
|
|
2
2
|
|
|
3
3
|
.pl-log-view {
|
|
4
|
+
--log-background: var(--bg-base-light);
|
|
4
5
|
height: 100%;
|
|
5
6
|
max-height: 100%;
|
|
6
7
|
max-width: 100%;
|
|
7
8
|
border-radius: 6px;
|
|
8
9
|
border: 1px solid var(--border-color-div-grey);
|
|
9
|
-
background: var(--
|
|
10
|
+
background: var(--log-background);
|
|
10
11
|
display: flex;
|
|
11
12
|
position: relative;
|
|
12
13
|
min-height: 44px;
|
|
13
14
|
|
|
15
|
+
&.has-error {
|
|
16
|
+
--log-background: var(--notification-error);
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
&__copy {
|
|
15
20
|
position: absolute;
|
|
16
21
|
top: 12px;
|
|
@@ -32,9 +37,23 @@
|
|
|
32
37
|
font-family: var(--font-family-monospace);
|
|
33
38
|
white-space: pre;
|
|
34
39
|
font-size: 14px;
|
|
35
|
-
font-style: normal;
|
|
36
40
|
font-weight: 400;
|
|
37
|
-
line-height: 20px;
|
|
41
|
+
line-height: 20px;
|
|
42
|
+
@include scrollbar(true, true);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&__error {
|
|
46
|
+
margin: 12px;
|
|
47
|
+
max-height: 100%;
|
|
48
|
+
max-width: 100%;
|
|
49
|
+
flex: 1;
|
|
50
|
+
color: var(--txt-01);
|
|
51
|
+
font-feature-settings: 'ss11' on, 'ss15' on, 'ss17' on;
|
|
52
|
+
font-family: var(--font-family-monospace);
|
|
53
|
+
white-space: pre;
|
|
54
|
+
font-size: 14px;
|
|
55
|
+
font-weight: 400;
|
|
56
|
+
line-height: 20px;
|
|
38
57
|
@include scrollbar(true, true);
|
|
39
58
|
}
|
|
40
59
|
}
|
package/src/types.ts
CHANGED
|
@@ -27,15 +27,15 @@ export type SimpleOption<T = unknown> = {
|
|
|
27
27
|
|
|
28
28
|
export type ListOption<T = unknown> =
|
|
29
29
|
| {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
text: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
value: T;
|
|
33
|
+
}
|
|
34
34
|
| {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
label: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
value: T;
|
|
38
|
+
};
|
|
39
39
|
|
|
40
40
|
export type ListOptionNormalized<T = unknown> = {
|
|
41
41
|
label: string;
|