@voicenter-team/voicenter-ui-plus 4.2.0 → 4.3.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/README.md +3 -5
- package/library/assets/components/VcInteractive/VcInteractive.css +1 -0
- package/library/components/VcInteractive/VcInteractive.vue.mjs +58 -0
- package/library/components/VcInteractive/VcInteractive.vue3.mjs +5 -0
- package/library/components/VcMessage/content/VcMessageFileBlock.vue.mjs +37 -30
- package/library/docs/guides/migration/migrating-from-4.0.md +87 -0
- package/library/enum/fileTypes.mjs +53 -3
- package/library/index.mjs +137 -134
- package/library/index.mjs.br +0 -0
- package/library/index.mjs.gz +0 -0
- package/library/plugin-components.gen.mjs +245 -242
- package/library/plugin.mjs +135 -132
- package/library/plugin.mjs.br +0 -0
- package/library/plugin.mjs.gz +0 -0
- package/library/style.css +2 -0
- package/library/style.css.br +0 -0
- package/library/style.css.gz +0 -0
- package/library/types/components/VcInteractive/VcInteractive.vue.d.ts +47 -0
- package/library/types/components/VcJsonViewer/VcJsonViewer.vue.d.ts +1 -1
- package/library/types/components/VcMessage/VcMessage.vue.d.ts +1 -1
- package/library/types/components/exports.d.ts +3 -1
- package/library/types/components.gen.d.ts +1 -0
- package/library/types/types/VcInteractive.types.d.ts +7 -0
- package/library/types/types/index.d.ts +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -677,11 +677,7 @@ After its rows the application runs the search of [Finding the 3.x names](#findi
|
|
|
677
677
|
|
|
678
678
|
## Upgrading from 4.0
|
|
679
679
|
|
|
680
|
-
What an application on `4.0` changes or checks on the way to the current release
|
|
681
|
-
|
|
682
|
-
| Changed after | What changed | What the application does |
|
|
683
|
-
| --- | --- | --- |
|
|
684
|
-
| `4.0.1` | `VcEntityEditableTabs` has no `entityMethodDataType` prop, and its record is always a row of the entity's `list` or the answer of its `info`. The type of its `entity` prop is `VcEntityWithTypedInfo<Entity>` | Nothing at runtime. `entity-method-data-type` is removed from every `<VcEntityEditableTabs>` (`grep -rnE "entity-method-data-type\|entityMethodDataType" src`). A generic component that passes its own `entity` prop on declares that prop as `VcEntityWithTypedInfo<Entity>` and reads the record type as `ExtractServiceImplementsEntity<Entity>`: `vue-tsc` reports the earlier `entity: Entity` there |
|
|
680
|
+
What an application on `4.0` changes or checks on the way to the current release, and how a project moves to the shared ESLint config and TypeScript 6, is in the guide shipped with the package: `library/docs/guides/migration/migrating-from-4.0.md` (in this repository, `documentation/guides/migration/migrating-from-4.0.md`).
|
|
685
681
|
|
|
686
682
|
## Using ui-plus in an application
|
|
687
683
|
|
|
@@ -695,6 +691,7 @@ The installed package is the truth. Read it before saying what ui-plus has or ho
|
|
|
695
691
|
- **Composables, services, directives, the entity base**: `library/types/composables/`, `library/types/services/`, `library/types/directives/`, `library/types/entity/`.
|
|
696
692
|
- **Types**: prop, event and configuration types are exported from the package root (`import type { UIConfig } from '@voicenter-team/voicenter-ui-plus'`). Generic components take type parameters in the template: `<VcSelect<User, 'id', 'name'> v-model="selected" :options="users" value-key="id" label-key="name" />`.
|
|
697
693
|
- **Colour tokens**: `src/theme/themes.json` (each key is the CSS variable `--<key>`) and `src/theme/tailwindScheme.js` (the Tailwind colour names).
|
|
694
|
+
- **Guides**: `library/docs/guides/`, Markdown files grouped by folder. Moving from an earlier release: `library/docs/guides/migration/`.
|
|
698
695
|
- **Examples**: the [live documentation](https://voicenter-ui-plus.pages.dev/).
|
|
699
696
|
|
|
700
697
|
### Choosing a component
|
|
@@ -705,6 +702,7 @@ The installed package is the truth. Read it before saying what ui-plus has or ho
|
|
|
705
702
|
- a new interaction component;
|
|
706
703
|
- a ui-plus component whose own CSS variables (`--el-*`, the ones ui-plus sets on `.vc-*`) or internal classes are overridden to change how it looks or behaves as a control: its track, rows, selected, hover or active state, shape or indicator;
|
|
707
704
|
- a ui-plus component used for a role it is not built for, such as a segmented switcher drawn as a searchable list.
|
|
705
|
+
- An approved custom control is built on `VcInteractive`. Its props choose the look (`variant`, `color`, `content-color`) and the component draws every state from the theme: rest, hover, keyboard focus, pressed, disabled. The application writes the shape and the content with its own classes (size, corners, layout, the icon and the label) and no colour or state of its own: no `:hover`, `:active` or `:disabled` rule, no `color-mix()`, no opacity for a state. A toggle switches `variant` and `color` with its state and passes `pressed`.
|
|
708
706
|
- Until that yes, the closest ui-plus component is used as drawn, and the difference from the design is the first open point of the report: what the design draws, which component was used, how they differ. No agent or orchestrator gives this approval in the owner's place.
|
|
709
707
|
- A report names a control by what is on screen: a restyled ui-plus component is reported as custom.
|
|
710
708
|
- A design hand-off (Figma, mock-up, screenshot, a specification) says what the user should see. It never justifies a restyle or a custom control.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:where(.vc-interactive){display:inline-flex;align-items:center;justify-content:center;border-radius:var(--vc-radius-control);text-align:center;cursor:pointer;transition:background-color .28s ease,color .28s ease,border-color .28s ease,box-shadow .28s ease}.vc-interactive{border:1px solid transparent;outline:none}.vc-interactive-color--primary{--vc-interactive-fill-rest: var(--vc-action-primary);--vc-interactive-fill-hover: var(--vc-action-primary--hover);--vc-interactive-fill-pressed: var(--vc-action-primary--pressed);--vc-interactive-tint-rest: var(--vc-action-primary--subtle-hover);--vc-interactive-tint-hover: var(--vc-action-primary--subtle-pressed);--vc-interactive-tint-pressed: var(--vc-action-primary--subtle-pressed);--vc-interactive-wash-rest: transparent;--vc-interactive-wash-hover: var(--vc-action-primary--subtle-hover);--vc-interactive-wash-pressed: var(--vc-action-primary--subtle-pressed);--vc-interactive-onfill: var(--vc-onfill-primary, var(--vc-onfill))}.vc-interactive-content--primary{--vc-interactive-text-rest: var(--vc-content-brand);--vc-interactive-text-hover: var(--vc-content-brand--hover);--vc-interactive-text-pressed: var(--vc-content-brand--pressed)}.vc-interactive-color--secondary{--vc-interactive-fill-rest: var(--vc-action-secondary);--vc-interactive-fill-hover: var(--vc-action-secondary--hover);--vc-interactive-fill-pressed: var(--vc-action-secondary--pressed);--vc-interactive-tint-rest: var(--vc-action-secondary--subtle-hover);--vc-interactive-tint-hover: var(--vc-action-secondary--subtle-pressed);--vc-interactive-tint-pressed: var(--vc-action-secondary--subtle-pressed);--vc-interactive-wash-rest: transparent;--vc-interactive-wash-hover: var(--vc-action-secondary--subtle-hover);--vc-interactive-wash-pressed: var(--vc-action-secondary--subtle-pressed);--vc-interactive-onfill: var(--vc-onfill-secondary, var(--vc-onfill))}.vc-interactive-content--secondary{--vc-interactive-text-rest: var(--vc-content-secondary);--vc-interactive-text-hover: var(--vc-content-secondary--hover);--vc-interactive-text-pressed: var(--vc-content-secondary--pressed)}.vc-interactive-color--destructive{--vc-interactive-fill-rest: var(--vc-action-danger);--vc-interactive-fill-hover: var(--vc-action-danger--hover);--vc-interactive-fill-pressed: var(--vc-action-danger--pressed);--vc-interactive-tint-rest: var(--vc-action-danger--subtle-hover);--vc-interactive-tint-hover: var(--vc-action-danger--subtle-pressed);--vc-interactive-tint-pressed: var(--vc-action-danger--subtle-pressed);--vc-interactive-wash-rest: transparent;--vc-interactive-wash-hover: var(--vc-action-danger--subtle-hover);--vc-interactive-wash-pressed: var(--vc-action-danger--subtle-pressed);--vc-interactive-onfill: var(--vc-onfill-danger, var(--vc-onfill))}.vc-interactive-content--destructive{--vc-interactive-text-rest: var(--vc-content-danger);--vc-interactive-text-hover: var(--vc-content-danger--hover);--vc-interactive-text-pressed: var(--vc-content-danger--pressed)}.vc-interactive-color--success{--vc-interactive-fill-rest: var(--vc-action-success);--vc-interactive-fill-hover: var(--vc-action-success--hover);--vc-interactive-fill-pressed: var(--vc-action-success--pressed);--vc-interactive-tint-rest: var(--vc-action-success--subtle-hover);--vc-interactive-tint-hover: var(--vc-action-success--subtle-pressed);--vc-interactive-tint-pressed: var(--vc-action-success--subtle-pressed);--vc-interactive-wash-rest: transparent;--vc-interactive-wash-hover: var(--vc-action-success--subtle-hover);--vc-interactive-wash-pressed: var(--vc-action-success--subtle-pressed);--vc-interactive-onfill: var(--vc-onfill-success, var(--vc-onfill))}.vc-interactive-content--success{--vc-interactive-text-rest: var(--vc-content-success);--vc-interactive-text-hover: var(--vc-content-success--hover);--vc-interactive-text-pressed: var(--vc-content-success--pressed)}.vc-interactive-color--warning{--vc-interactive-fill-rest: var(--vc-action-warning);--vc-interactive-fill-hover: var(--vc-action-warning--hover);--vc-interactive-fill-pressed: var(--vc-action-warning--pressed);--vc-interactive-tint-rest: var(--vc-action-warning--subtle-hover);--vc-interactive-tint-hover: var(--vc-action-warning--subtle-pressed);--vc-interactive-tint-pressed: var(--vc-action-warning--subtle-pressed);--vc-interactive-wash-rest: transparent;--vc-interactive-wash-hover: var(--vc-action-warning--subtle-hover);--vc-interactive-wash-pressed: var(--vc-action-warning--subtle-pressed);--vc-interactive-onfill: var(--vc-onfill-warning, var(--vc-onfill))}.vc-interactive-content--warning{--vc-interactive-text-rest: var(--vc-content-warning);--vc-interactive-text-hover: var(--vc-content-warning--hover);--vc-interactive-text-pressed: var(--vc-content-warning--pressed)}.vc-interactive-color--info{--vc-interactive-fill-rest: var(--vc-action-info);--vc-interactive-fill-hover: var(--vc-action-info--hover);--vc-interactive-fill-pressed: var(--vc-action-info--pressed);--vc-interactive-tint-rest: var(--vc-action-info--subtle-hover);--vc-interactive-tint-hover: var(--vc-action-info--subtle-pressed);--vc-interactive-tint-pressed: var(--vc-action-info--subtle-pressed);--vc-interactive-wash-rest: transparent;--vc-interactive-wash-hover: var(--vc-action-info--subtle-hover);--vc-interactive-wash-pressed: var(--vc-action-info--subtle-pressed);--vc-interactive-onfill: var(--vc-onfill-info, var(--vc-onfill))}.vc-interactive-content--info{--vc-interactive-text-rest: var(--vc-content-info);--vc-interactive-text-hover: var(--vc-content-info--hover);--vc-interactive-text-pressed: var(--vc-content-info--pressed)}.vc-interactive-variant--filled{--vc-interactive-bg-rest: var(--vc-interactive-fill-rest);--vc-interactive-fg-rest: var(--vc-interactive-onfill);--vc-interactive-bg-hover: var(--vc-interactive-fill-hover);--vc-interactive-fg-hover: var(--vc-interactive-onfill);--vc-interactive-bg-pressed: var(--vc-interactive-fill-pressed);--vc-interactive-fg-pressed: var(--vc-interactive-onfill)}.vc-interactive-variant--soft{--vc-interactive-bg-rest: var(--vc-interactive-tint-rest);--vc-interactive-fg-rest: var(--vc-interactive-text-rest);--vc-interactive-bg-hover: var(--vc-interactive-tint-hover);--vc-interactive-fg-hover: var(--vc-interactive-text-hover);--vc-interactive-bg-pressed: var(--vc-interactive-tint-pressed);--vc-interactive-fg-pressed: var(--vc-interactive-text-pressed)}.vc-interactive-variant--outline,.vc-interactive-variant--ghost{--vc-interactive-bg-rest: var(--vc-interactive-wash-rest);--vc-interactive-fg-rest: var(--vc-interactive-text-rest);--vc-interactive-bg-hover: var(--vc-interactive-wash-hover);--vc-interactive-fg-hover: var(--vc-interactive-text-hover);--vc-interactive-bg-pressed: var(--vc-interactive-wash-pressed);--vc-interactive-fg-pressed: var(--vc-interactive-text-pressed)}.vc-interactive:not(.is--disabled){background-color:var(--vc-interactive-bg-rest);color:var(--vc-interactive-fg-rest)}.vc-interactive:not(.is--disabled):hover,.vc-interactive:not(.is--disabled):focus-visible,.vc-interactive:not(.is--disabled)[aria-expanded=true]{background-color:var(--vc-interactive-bg-hover);color:var(--vc-interactive-fg-hover)}.vc-interactive:not(.is--disabled):active{background-color:var(--vc-interactive-bg-pressed);color:var(--vc-interactive-fg-pressed)}.vc-interactive:not(.is--disabled):focus-visible{box-shadow:var(--vc-focus-ring)}.vc-interactive:not(.is--disabled).vc-interactive-variant--outline{border-color:currentColor}.vc-interactive.is--disabled{cursor:not-allowed;background-color:transparent;color:var(--vc-content-disabled)}.vc-interactive.is--disabled.vc-interactive-variant--filled,.vc-interactive.is--disabled.vc-interactive-variant--soft{background-color:var(--vc-bg-muted)}.vc-interactive.is--disabled.vc-interactive-variant--outline{border-color:var(--vc-border)}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import '../../assets/components/VcInteractive/VcInteractive.css';
|
|
2
|
+
import { defineComponent, computed, openBlock, createBlock, resolveDynamicComponent, normalizeClass, withCtx, renderSlot } from "vue";
|
|
3
|
+
const CLASS_FOR_VARIANT = "vc-interactive-variant--";
|
|
4
|
+
const CLASS_FOR_COLOR = "vc-interactive-color--";
|
|
5
|
+
const CLASS_FOR_CONTENT = "vc-interactive-content--";
|
|
6
|
+
const CLASS_DISABLED = "is--disabled";
|
|
7
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
|
+
__name: "VcInteractive",
|
|
9
|
+
props: {
|
|
10
|
+
variant: { default: "filled" },
|
|
11
|
+
color: { default: "primary" },
|
|
12
|
+
contentColor: { default: void 0 },
|
|
13
|
+
pressed: { type: Boolean, default: void 0 },
|
|
14
|
+
disabled: { type: Boolean, default: false },
|
|
15
|
+
as: { default: "button" },
|
|
16
|
+
buttonType: { default: "button" },
|
|
17
|
+
dataTestName: { default: "vc-interactive" }
|
|
18
|
+
},
|
|
19
|
+
emits: ["click"],
|
|
20
|
+
setup(__props, { emit: __emit }) {
|
|
21
|
+
const props = __props;
|
|
22
|
+
const emit = __emit;
|
|
23
|
+
const isNativeButton = computed(() => props.as === "button");
|
|
24
|
+
const classes = computed(() => [
|
|
25
|
+
CLASS_FOR_VARIANT + props.variant,
|
|
26
|
+
CLASS_FOR_COLOR + props.color,
|
|
27
|
+
CLASS_FOR_CONTENT + (props.contentColor ?? props.color),
|
|
28
|
+
{ [CLASS_DISABLED]: props.disabled }
|
|
29
|
+
]);
|
|
30
|
+
function handleClick(evt) {
|
|
31
|
+
if (props.disabled) {
|
|
32
|
+
evt.preventDefault();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
emit("click", evt);
|
|
36
|
+
}
|
|
37
|
+
return (_ctx, _cache) => {
|
|
38
|
+
return openBlock(), createBlock(resolveDynamicComponent(__props.as), {
|
|
39
|
+
class: normalizeClass(["vc-interactive", classes.value]),
|
|
40
|
+
type: isNativeButton.value ? __props.buttonType : void 0,
|
|
41
|
+
disabled: isNativeButton.value && __props.disabled ? true : void 0,
|
|
42
|
+
"aria-disabled": __props.disabled ? "true" : void 0,
|
|
43
|
+
"aria-pressed": __props.pressed,
|
|
44
|
+
tabindex: !isNativeButton.value && __props.disabled ? -1 : void 0,
|
|
45
|
+
"data-test": __props.dataTestName,
|
|
46
|
+
onClick: handleClick
|
|
47
|
+
}, {
|
|
48
|
+
default: withCtx(() => [
|
|
49
|
+
renderSlot(_ctx.$slots, "default")
|
|
50
|
+
]),
|
|
51
|
+
_: 3
|
|
52
|
+
}, 8, ["class", "type", "disabled", "aria-disabled", "aria-pressed", "tabindex", "data-test"]);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
export {
|
|
57
|
+
_sfc_main as default
|
|
58
|
+
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import '../../../assets/components/VcMessage/content/VcMessageFileBlock.css';
|
|
2
|
-
import { defineComponent, computed, ref, watch, openBlock, createElementBlock, createVNode,
|
|
3
|
-
import {
|
|
2
|
+
import { defineComponent, computed, ref, watch, openBlock, createElementBlock, createVNode, normalizeStyle, createElementVNode, toDisplayString, createBlock, createCommentVNode, unref } from "vue";
|
|
3
|
+
import { Download } from "@lucide/vue";
|
|
4
4
|
import _sfc_main$2 from "../../VcButton/VcButtonIcon.vue.mjs";
|
|
5
5
|
import '../../../assets/components/VcIcon/VcIcon.css';import '../../../assets/components/VcButton/VcButtonIcon.css';/* empty css */
|
|
6
6
|
import _sfc_main$1 from "../../VcIcon/VcIcon.vue.mjs";
|
|
7
7
|
/* empty css */
|
|
8
|
+
import { DEFAULT_FILE_TYPE_MAP, DEFAULT_FILE_TYPE } from "../../../enum/fileTypes.mjs";
|
|
8
9
|
import { tVU } from "../../../localization/index.mjs";
|
|
9
10
|
import { clickDownloadLink } from "../../../utils/download.mjs";
|
|
10
11
|
import { literalParam } from "../../../utils/i18nParams.mjs";
|
|
@@ -20,26 +21,24 @@ const _hoisted_3 = {
|
|
|
20
21
|
key: 1,
|
|
21
22
|
class: "vc-message-file-block is--previewable"
|
|
22
23
|
};
|
|
23
|
-
const _hoisted_4 =
|
|
24
|
-
const _hoisted_5 =
|
|
25
|
-
const _hoisted_6 = {
|
|
26
|
-
const _hoisted_7 = {
|
|
24
|
+
const _hoisted_4 = ["src"];
|
|
25
|
+
const _hoisted_5 = { class: "vc-message-file-block__info" };
|
|
26
|
+
const _hoisted_6 = {
|
|
27
27
|
class: "vc-message-file-block__name",
|
|
28
28
|
dir: "auto"
|
|
29
29
|
};
|
|
30
|
-
const
|
|
30
|
+
const _hoisted_7 = {
|
|
31
31
|
key: 0,
|
|
32
32
|
class: "vc-message-file-block__meta"
|
|
33
33
|
};
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const _hoisted_13 = {
|
|
34
|
+
const _hoisted_8 = ["href", "download"];
|
|
35
|
+
const _hoisted_9 = ["src"];
|
|
36
|
+
const _hoisted_10 = { class: "vc-message-file-block__info" };
|
|
37
|
+
const _hoisted_11 = {
|
|
39
38
|
class: "vc-message-file-block__name",
|
|
40
39
|
dir: "auto"
|
|
41
40
|
};
|
|
42
|
-
const
|
|
41
|
+
const _hoisted_12 = {
|
|
43
42
|
key: 0,
|
|
44
43
|
class: "vc-message-file-block__meta"
|
|
45
44
|
};
|
|
@@ -73,6 +72,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
73
72
|
}
|
|
74
73
|
return `${unitIndex ? value.toFixed(1) : value} ${SIZE_UNITS[unitIndex]}`;
|
|
75
74
|
});
|
|
75
|
+
const fileType = computed(() => DEFAULT_FILE_TYPE_MAP[extension.value.toLowerCase()] ?? DEFAULT_FILE_TYPE);
|
|
76
76
|
const meta = computed(() => [extension.value.toUpperCase(), size.value].filter(Boolean).join(" · "));
|
|
77
77
|
const downloadLabel = computed(() => tVU.t("voicenterUi.message.download", { name: literalParam(props.content.name) }));
|
|
78
78
|
const thumbnailFailed = ref(false);
|
|
@@ -86,9 +86,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
86
86
|
return (_ctx, _cache) => {
|
|
87
87
|
return __props.preview ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
88
88
|
createVNode(_sfc_main$1, {
|
|
89
|
-
icon:
|
|
89
|
+
icon: fileType.value.icon,
|
|
90
|
+
style: normalizeStyle({ color: fileType.value.color }),
|
|
90
91
|
class: "vc-message-file-block__preview-icon"
|
|
91
|
-
}, null, 8, ["icon"]),
|
|
92
|
+
}, null, 8, ["icon", "style"]),
|
|
92
93
|
createElementVNode("span", _hoisted_2, toDisplayString(__props.content.name), 1)
|
|
93
94
|
])) : __props.content.previewable ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
94
95
|
createElementVNode("button", {
|
|
@@ -97,7 +98,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
97
98
|
"data-test": "message-file-body",
|
|
98
99
|
onClick: _cache[0] || (_cache[0] = ($event) => emit("content-click", __props.content))
|
|
99
100
|
}, [
|
|
100
|
-
createElementVNode("span",
|
|
101
|
+
createElementVNode("span", {
|
|
102
|
+
class: "vc-message-file-block__icon",
|
|
103
|
+
style: normalizeStyle({ color: fileType.value.color })
|
|
104
|
+
}, [
|
|
101
105
|
showThumbnail.value ? (openBlock(), createElementBlock("img", {
|
|
102
106
|
key: 0,
|
|
103
107
|
src: __props.content.thumbnailUrl,
|
|
@@ -105,15 +109,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
105
109
|
class: "vc-message-file-block__thumbnail",
|
|
106
110
|
"data-test": "message-file-thumbnail",
|
|
107
111
|
onError: onThumbnailError
|
|
108
|
-
}, null, 40,
|
|
112
|
+
}, null, 40, _hoisted_4)) : (openBlock(), createBlock(_sfc_main$1, {
|
|
109
113
|
key: 1,
|
|
110
|
-
icon:
|
|
114
|
+
icon: fileType.value.icon,
|
|
111
115
|
"data-test": "message-file-icon"
|
|
112
116
|
}, null, 8, ["icon"]))
|
|
113
|
-
]),
|
|
114
|
-
createElementVNode("span",
|
|
115
|
-
createElementVNode("span",
|
|
116
|
-
meta.value ? (openBlock(), createElementBlock("span",
|
|
117
|
+
], 4),
|
|
118
|
+
createElementVNode("span", _hoisted_5, [
|
|
119
|
+
createElementVNode("span", _hoisted_6, toDisplayString(__props.content.name), 1),
|
|
120
|
+
meta.value ? (openBlock(), createElementBlock("span", _hoisted_7, toDisplayString(meta.value), 1)) : createCommentVNode("", true)
|
|
117
121
|
])
|
|
118
122
|
]),
|
|
119
123
|
createVNode(_sfc_main$2, {
|
|
@@ -134,7 +138,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
134
138
|
rel: "noopener noreferrer",
|
|
135
139
|
class: "vc-message-file-block"
|
|
136
140
|
}, [
|
|
137
|
-
createElementVNode("span",
|
|
141
|
+
createElementVNode("span", {
|
|
142
|
+
class: "vc-message-file-block__icon",
|
|
143
|
+
style: normalizeStyle({ color: fileType.value.color })
|
|
144
|
+
}, [
|
|
138
145
|
showThumbnail.value ? (openBlock(), createElementBlock("img", {
|
|
139
146
|
key: 0,
|
|
140
147
|
src: __props.content.thumbnailUrl,
|
|
@@ -142,21 +149,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
142
149
|
class: "vc-message-file-block__thumbnail",
|
|
143
150
|
"data-test": "message-file-thumbnail",
|
|
144
151
|
onError: onThumbnailError
|
|
145
|
-
}, null, 40,
|
|
152
|
+
}, null, 40, _hoisted_9)) : (openBlock(), createBlock(_sfc_main$1, {
|
|
146
153
|
key: 1,
|
|
147
|
-
icon:
|
|
154
|
+
icon: fileType.value.icon,
|
|
148
155
|
"data-test": "message-file-icon"
|
|
149
156
|
}, null, 8, ["icon"]))
|
|
150
|
-
]),
|
|
151
|
-
createElementVNode("span",
|
|
152
|
-
createElementVNode("span",
|
|
153
|
-
meta.value ? (openBlock(), createElementBlock("span",
|
|
157
|
+
], 4),
|
|
158
|
+
createElementVNode("span", _hoisted_10, [
|
|
159
|
+
createElementVNode("span", _hoisted_11, toDisplayString(__props.content.name), 1),
|
|
160
|
+
meta.value ? (openBlock(), createElementBlock("span", _hoisted_12, toDisplayString(meta.value), 1)) : createCommentVNode("", true)
|
|
154
161
|
]),
|
|
155
162
|
createVNode(_sfc_main$1, {
|
|
156
163
|
icon: unref(Download),
|
|
157
164
|
class: "vc-message-file-block__download"
|
|
158
165
|
}, null, 8, ["icon"])
|
|
159
|
-
], 8,
|
|
166
|
+
], 8, _hoisted_8));
|
|
160
167
|
};
|
|
161
168
|
}
|
|
162
169
|
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Migrating from 4.0
|
|
3
|
+
description: What an application on ui-plus 4.0 changes on the way to the current release, and how a project moves to the shared ESLint config and TypeScript 6
|
|
4
|
+
group: migration
|
|
5
|
+
order: 2
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Migrating from 4.0
|
|
9
|
+
|
|
10
|
+
What an application on `4.0` changes or checks on the way to the current release. An application on a 4.0 beta takes the rows of README "Upgrading from a 4.0 beta" first.
|
|
11
|
+
|
|
12
|
+
## What changed in the library
|
|
13
|
+
|
|
14
|
+
A row names the last release without the change, so the application takes every row whose release is the one it has installed (the `version` its `package.json` or lock file gives for the library before the upgrade) or a later one.
|
|
15
|
+
|
|
16
|
+
| Changed after | What changed | What the application does |
|
|
17
|
+
| --- | --- | --- |
|
|
18
|
+
| `4.0.1` | `VcEntityEditableTabs` has no `entityMethodDataType` prop, and its record is always a row of the entity's `list` or the answer of its `info`. The type of its `entity` prop is `VcEntityWithTypedInfo<Entity>` | Nothing at runtime. `entity-method-data-type` is removed from every `<VcEntityEditableTabs>` (`grep -rnE "entity-method-data-type\|entityMethodDataType" src`). A generic component that passes its own `entity` prop on declares that prop as `VcEntityWithTypedInfo<Entity>` and reads the record type as `ExtractServiceImplementsEntity<Entity>`: `vue-tsc` reports the earlier `entity: Entity` there |
|
|
19
|
+
|
|
20
|
+
Additions that ask nothing of an application (new components, props, theme keys and classes) are not rows.
|
|
21
|
+
|
|
22
|
+
## TypeScript and ESLint
|
|
23
|
+
|
|
24
|
+
From `4.2.0` the library is written on TypeScript 6 and linted with `@voicenter-team/eslint-config`. This asks nothing of an application: the declarations in `library/types/` are read by an application on TypeScript 5.9 as before, and the library brings no lint rule into a project.
|
|
25
|
+
|
|
26
|
+
A project moves to the same toolchain on its own schedule. The steps below are the ones the library took.
|
|
27
|
+
|
|
28
|
+
### Packages
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm rm @voicenter-team/eslint-config-vue @voicenter-team/eslint-config-ts \
|
|
32
|
+
@typescript-eslint/eslint-plugin @typescript-eslint/parser \
|
|
33
|
+
eslint-plugin-vue vue-eslint-parser @vue/eslint-config-typescript
|
|
34
|
+
npm i -D eslint@^10 @voicenter-team/eslint-config@^1 typescript@^6 vue-tsc@^3
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The config brings typescript-eslint, eslint-plugin-vue and the stylistic rules itself: a project installs none of them. Node is `^20.19`, `^22.13` or `>=24`.
|
|
38
|
+
|
|
39
|
+
A project that builds declarations with `vite-plugin-dts` takes `vite-plugin-dts@^5` and renames its `outDir` option to `outDirs`: version 3 writes broken declarations on TypeScript 6.
|
|
40
|
+
|
|
41
|
+
### ESLint
|
|
42
|
+
|
|
43
|
+
`.eslintrc.*` and `.eslintignore` are replaced by `eslint.config.mjs`:
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
import { defineConfig, includeIgnoreFile } from 'eslint/config'
|
|
47
|
+
import voicenterVue from '@voicenter-team/eslint-config/vue'
|
|
48
|
+
|
|
49
|
+
export default defineConfig(
|
|
50
|
+
includeIgnoreFile(new URL('./.gitignore', import.meta.url).pathname),
|
|
51
|
+
voicenterVue
|
|
52
|
+
)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The script is `eslint .`, with no `--ext` and no `--ignore-path`. A folder that is a project of its own, with its own `package.json` and ESLint config, is named in `globalIgnores([ 'docs/' ])` (from `eslint/config`), or ESLint loads that folder's config for its files.
|
|
56
|
+
|
|
57
|
+
What the config enforces, and what moved from the earlier `-vue` and `-ts` configs, is in the config's own README: `node_modules/@voicenter-team/eslint-config/README.md`, "Migrating from @voicenter-team/eslint-config-ts or -vue".
|
|
58
|
+
|
|
59
|
+
### tsconfig
|
|
60
|
+
|
|
61
|
+
TypeScript 6 reports `baseUrl` as deprecated. It is removed, and each `paths` entry becomes relative to the tsconfig:
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"compilerOptions": {
|
|
66
|
+
"moduleResolution": "bundler",
|
|
67
|
+
"paths": {
|
|
68
|
+
"@/*": [ "./src/*" ]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`moduleResolution` is `bundler` in the tsconfig of the application and in the one of `vite.config.ts`.
|
|
75
|
+
|
|
76
|
+
### The code
|
|
77
|
+
|
|
78
|
+
The config bans the type assertion (`value as T`, `<T>value`), the non-null assertion (`value!`), `any`, and the comments `@ts-expect-error`, `@ts-ignore` and `@ts-nocheck`. A finding is fixed in the code, with no `eslint-disable` comment:
|
|
79
|
+
|
|
80
|
+
- a value of unknown shape (a parsed JSON, a `catch` variable, an injected value) is `unknown`, narrowed by a type guard, `(value: unknown): value is T`;
|
|
81
|
+
- a type the compiler cannot follow is fixed where it is declared: a generic parameter, a narrower return type, the generated contract;
|
|
82
|
+
- a template ref is read with `useTemplateRef<T>()`;
|
|
83
|
+
- `inject()` without a provider gives `undefined`, and the code handles it.
|
|
84
|
+
|
|
85
|
+
`npx eslint . --no-inline-config` counts the findings that the `eslint-disable` comments of the project hide: that number, not the one of `npx eslint .`, is the size of the work.
|
|
86
|
+
|
|
87
|
+
Done when `npx eslint .` prints nothing with no `eslint-disable` comment left in the code, and the type check exits 0.
|
|
@@ -1,16 +1,44 @@
|
|
|
1
|
-
import { FileArchive, FileSpreadsheet, FileText } from "@lucide/vue";
|
|
1
|
+
import { FileArchive, FileMusic, FilePlay, FileImage, FileCode, FileChartPie, FileSpreadsheet, FileBraces, FileText, FileType } from "@lucide/vue";
|
|
2
2
|
const DEFAULT_FILE_TYPE = {
|
|
3
3
|
icon: FileText,
|
|
4
4
|
color: "var(--vc-content-tertiary)"
|
|
5
5
|
};
|
|
6
|
+
const WORD_DOCUMENT = {
|
|
7
|
+
icon: FileType,
|
|
8
|
+
color: "var(--vc-content-info)"
|
|
9
|
+
};
|
|
6
10
|
const TEXT_DOCUMENT = {
|
|
7
11
|
icon: FileText,
|
|
8
12
|
color: "var(--vc-content-secondary)"
|
|
9
13
|
};
|
|
14
|
+
const DATA = {
|
|
15
|
+
icon: FileBraces,
|
|
16
|
+
color: "var(--vc-content-secondary)"
|
|
17
|
+
};
|
|
10
18
|
const SPREADSHEET = {
|
|
11
19
|
icon: FileSpreadsheet,
|
|
12
20
|
color: "var(--vc-content-success)"
|
|
13
21
|
};
|
|
22
|
+
const PRESENTATION = {
|
|
23
|
+
icon: FileChartPie,
|
|
24
|
+
color: "var(--vc-content-warning)"
|
|
25
|
+
};
|
|
26
|
+
const WEB_PAGE = {
|
|
27
|
+
icon: FileCode,
|
|
28
|
+
color: "var(--vc-content-info)"
|
|
29
|
+
};
|
|
30
|
+
const IMAGE = {
|
|
31
|
+
icon: FileImage,
|
|
32
|
+
color: "var(--vc-content-secondary)"
|
|
33
|
+
};
|
|
34
|
+
const VIDEO = {
|
|
35
|
+
icon: FilePlay,
|
|
36
|
+
color: "var(--vc-content-secondary)"
|
|
37
|
+
};
|
|
38
|
+
const AUDIO = {
|
|
39
|
+
icon: FileMusic,
|
|
40
|
+
color: "var(--vc-content-secondary)"
|
|
41
|
+
};
|
|
14
42
|
const ARCHIVE = {
|
|
15
43
|
icon: FileArchive,
|
|
16
44
|
color: "var(--vc-content-warning)"
|
|
@@ -20,12 +48,34 @@ const DEFAULT_FILE_TYPE_MAP = {
|
|
|
20
48
|
icon: FileText,
|
|
21
49
|
color: "var(--vc-content-danger)"
|
|
22
50
|
},
|
|
23
|
-
doc:
|
|
24
|
-
docx:
|
|
51
|
+
doc: WORD_DOCUMENT,
|
|
52
|
+
docx: WORD_DOCUMENT,
|
|
25
53
|
txt: TEXT_DOCUMENT,
|
|
54
|
+
md: TEXT_DOCUMENT,
|
|
55
|
+
json: DATA,
|
|
56
|
+
xml: DATA,
|
|
57
|
+
yaml: DATA,
|
|
58
|
+
yml: DATA,
|
|
26
59
|
xls: SPREADSHEET,
|
|
27
60
|
xlsx: SPREADSHEET,
|
|
28
61
|
csv: SPREADSHEET,
|
|
62
|
+
ppt: PRESENTATION,
|
|
63
|
+
pptx: PRESENTATION,
|
|
64
|
+
html: WEB_PAGE,
|
|
65
|
+
htm: WEB_PAGE,
|
|
66
|
+
jpg: IMAGE,
|
|
67
|
+
jpeg: IMAGE,
|
|
68
|
+
png: IMAGE,
|
|
69
|
+
gif: IMAGE,
|
|
70
|
+
webp: IMAGE,
|
|
71
|
+
svg: IMAGE,
|
|
72
|
+
mp4: VIDEO,
|
|
73
|
+
mov: VIDEO,
|
|
74
|
+
webm: VIDEO,
|
|
75
|
+
mp3: AUDIO,
|
|
76
|
+
wav: AUDIO,
|
|
77
|
+
ogg: AUDIO,
|
|
78
|
+
m4a: AUDIO,
|
|
29
79
|
zip: ARCHIVE,
|
|
30
80
|
rar: ARCHIVE,
|
|
31
81
|
"7z": ARCHIVE
|