dou-ui 0.1.0-alpha.4 → 0.1.0-alpha.5
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/components/chat-context-meter/chat-context-meter.js +19 -2
- package/dist/components/chat-context-meter/chat-context-meter.js.map +1 -1
- package/dist/components/chat-context-meter/chat-context-meter.vue_vue_type_script_setup_true_lang.js +43 -42
- package/dist/components/chat-context-meter/chat-context-meter.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/chat-context-meter/chat-context-meter2.js.map +1 -1
- package/dist/components/chat-context-meter/index.js +2 -1
- package/dist/components/chat-context-meter/index.js.map +1 -1
- package/dist/components/chat-context-meter/style.js +1 -3
- package/dist/components/chat-message/chat-message.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/copy-button/copy-button.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/popover/popover.js.map +1 -1
- package/dist/components/popover/popover.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/components/popover/popover.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tooltip/tooltip.js.map +1 -1
- package/dist/components/tooltip/tooltip.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/tooltip/tooltip.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/plugin.js +2 -2
- package/dist/style.css +1 -1
- package/dist/types/components/chat-context-meter/chat-context-meter.d.ts +23 -3
- package/dist/types/components/chat-context-meter/index.d.ts +1 -0
- package/dist/types/components/dropdown/dropdown.vue.d.ts +1 -1
- package/dist/types/components/dropdown/index.d.ts +3 -3
- package/dist/types/components/popover/index.d.ts +3 -3
- package/dist/types/components/popover/popover.vue.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
// src/components/chat-context-meter/chat-context-meter.ts
|
|
2
|
+
var count = (n) => Number.isFinite(n) && n > 0 ? n : 0;
|
|
3
|
+
/**
|
|
4
|
+
* The numbers the meter shows for `used` and `total`, for a tooltip or
|
|
5
|
+
* details around it that agree with the ring: `percent` stays within 0–100
|
|
6
|
+
* and is 0 without a `total`.
|
|
7
|
+
*/
|
|
8
|
+
function contextUsage(used, total) {
|
|
9
|
+
const u = count(used);
|
|
10
|
+
const all = count(total);
|
|
11
|
+
const share = all > 0 ? Math.min(u / all, 1) : 0;
|
|
12
|
+
return {
|
|
13
|
+
used: u,
|
|
14
|
+
total: all,
|
|
15
|
+
share,
|
|
16
|
+
percent: Math.round(share * 100)
|
|
17
|
+
};
|
|
18
|
+
}
|
|
2
19
|
var trim = (n) => String(Number(n.toFixed(1)));
|
|
3
|
-
/** `45200` → `45.2k`, `1200000` → `1.2M
|
|
20
|
+
/** `45200` → `45.2k`, `1200000` → `1.2M`: how the meter reads its numbers, for tooltips around it. */
|
|
4
21
|
function compactNumber(value) {
|
|
5
22
|
const abs = Math.abs(value);
|
|
6
23
|
if (abs >= 1e6) return `${trim(value / 1e6)}M`;
|
|
7
24
|
if (abs >= 1e3) return `${trim(value / 1e3)}k`;
|
|
8
25
|
return String(Math.round(value));
|
|
9
26
|
}
|
|
10
|
-
export { compactNumber };
|
|
27
|
+
export { compactNumber, contextUsage };
|
|
11
28
|
|
|
12
29
|
//# sourceMappingURL=chat-context-meter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-context-meter.js","names":[],"sources":["../../../src/components/chat-context-meter/chat-context-meter.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"chat-context-meter.js","names":[],"sources":["../../../src/components/chat-context-meter/chat-context-meter.ts"],"sourcesContent":["/**\n * Only the ring: no tooltip, not focusable. A DouTooltip can wrap the ring\n * itself (give it `tabindex=\"0\"`); a popover or dropdown opened by a click\n * needs a button holding the ring, which a span can't stand in for. Name it\n * with `aria-label`.\n */\nexport interface ChatContextMeterProps {\n /** Tokens used so far. */\n used?: number\n /** Tokens the context holds. */\n total?: number\n /** The share, from 0 to 1, from which the ring turns to the warning tone. */\n warnAt?: number\n /** The share from which it turns to the danger tone. */\n dangerAt?: number\n /** Show the percentage next to the ring. */\n showLabel?: boolean\n}\n\nexport interface ContextUsage {\n /** Tokens used: a number below 0, or not a finite number, counts as 0. */\n used: number\n /** Tokens the context holds, the same way. */\n total: number\n /** How full, from 0 to 1, as the ring draws it. */\n share: number\n /** The share as a whole percent, as the ring's label shows it: never over 100. */\n percent: number\n}\n\nconst count = (n: number) => (Number.isFinite(n) && n > 0 ? n : 0)\n\n/**\n * The numbers the meter shows for `used` and `total`, for a tooltip or\n * details around it that agree with the ring: `percent` stays within 0–100\n * and is 0 without a `total`.\n */\nexport function contextUsage(used: number, total: number): ContextUsage {\n const u = count(used)\n const all = count(total)\n const share = all > 0 ? Math.min(u / all, 1) : 0\n return { used: u, total: all, share, percent: Math.round(share * 100) }\n}\n\nconst trim = (n: number) => String(Number(n.toFixed(1)))\n\n/** `45200` → `45.2k`, `1200000` → `1.2M`: how the meter reads its numbers, for tooltips around it. */\nexport function compactNumber(value: number): string {\n const abs = Math.abs(value)\n if (abs >= 1e6) return `${trim(value / 1e6)}M`\n if (abs >= 1e3) return `${trim(value / 1e3)}k`\n return String(Math.round(value))\n}\n"],"mappings":";AA8BA,IAAM,SAAS,MAAe,OAAO,SAAS,CAAC,KAAK,IAAI,IAAI,IAAI;;;;;;AAOhE,SAAgB,aAAa,MAAc,OAA6B;CACtE,MAAM,IAAI,MAAM,IAAI;CACpB,MAAM,MAAM,MAAM,KAAK;CACvB,MAAM,QAAQ,MAAM,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,IAAI;CAC/C,OAAO;EAAE,MAAM;EAAG,OAAO;EAAK;EAAO,SAAS,KAAK,MAAM,QAAQ,GAAG;CAAE;AACxE;AAEA,IAAM,QAAQ,MAAc,OAAO,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;;AAGvD,SAAgB,cAAc,OAAuB;CACnD,MAAM,MAAM,KAAK,IAAI,KAAK;CAC1B,IAAI,OAAO,KAAK,OAAO,GAAG,KAAK,QAAQ,GAAG,EAAE;CAC5C,IAAI,OAAO,KAAK,OAAO,GAAG,KAAK,QAAQ,GAAG,EAAE;CAC5C,OAAO,OAAO,KAAK,MAAM,KAAK,CAAC;AACjC"}
|
package/dist/components/chat-context-meter/chat-context-meter.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useNamespace } from "../../utils/namespace.js";
|
|
2
2
|
import { useLocale } from "../config-provider/use-config.js";
|
|
3
|
-
import {
|
|
4
|
-
import { compactNumber } from "./chat-context-meter.js";
|
|
5
|
-
import { computed,
|
|
3
|
+
import { devWarn } from "../../utils/status-check.js";
|
|
4
|
+
import { compactNumber, contextUsage } from "./chat-context-meter.js";
|
|
5
|
+
import { computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, normalizeClass, onMounted, openBlock, toDisplayString, unref, useTemplateRef } from "vue";
|
|
6
6
|
// src/components/chat-context-meter/chat-context-meter.vue?vue&type=script&setup=true&lang.ts
|
|
7
7
|
var _hoisted_1 = [
|
|
8
8
|
"aria-label",
|
|
@@ -12,12 +12,10 @@ var _hoisted_1 = [
|
|
|
12
12
|
var _hoisted_2 = ["stroke-dasharray"];
|
|
13
13
|
var chat_context_meter_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
14
14
|
name: "DouChatContextMeter",
|
|
15
|
-
inheritAttrs: false,
|
|
16
15
|
__name: "chat-context-meter",
|
|
17
16
|
props: {
|
|
18
17
|
used: { default: 0 },
|
|
19
18
|
total: { default: 0 },
|
|
20
|
-
format: {},
|
|
21
19
|
warnAt: { default: .8 },
|
|
22
20
|
dangerAt: { default: .95 },
|
|
23
21
|
showLabel: {
|
|
@@ -29,48 +27,51 @@ var chat_context_meter_vue_vue_type_script_setup_true_lang_default = /*@__PURE__
|
|
|
29
27
|
const props = __props;
|
|
30
28
|
const ns = useNamespace("chat-context-meter");
|
|
31
29
|
const { t } = useLocale();
|
|
32
|
-
const
|
|
33
|
-
const
|
|
30
|
+
const usage = computed(() => contextUsage(props.used, props.total));
|
|
31
|
+
const share = computed(() => usage.value.share);
|
|
32
|
+
const percent = computed(() => usage.value.percent);
|
|
34
33
|
const tone = computed(() => share.value >= props.dangerAt ? "danger" : share.value >= props.warnAt ? "warning" : "neutral");
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
total: fmt(props.total),
|
|
34
|
+
const valueText = computed(() => t("chat.context", {
|
|
35
|
+
used: compactNumber(usage.value.used),
|
|
36
|
+
total: compactNumber(usage.value.total),
|
|
39
37
|
percent: percent.value
|
|
40
38
|
}));
|
|
39
|
+
const root = useTemplateRef("root");
|
|
40
|
+
onMounted(() => {
|
|
41
|
+
if (process.env.NODE_ENV === "production" || !props.showLabel) return;
|
|
42
|
+
if (root.value?.parentElement?.closest(".dou-button.is-icon-only")) devWarn("[dou-ui] DouChatContextMeter: `showLabel` inside an icon-only button spills out of it, as the button sizes the ring as its icon. Put the ring in the button’s `leading` slot and the percentage as its text.");
|
|
43
|
+
});
|
|
41
44
|
const CIRCUMFERENCE = 2 * Math.PI * 6;
|
|
42
45
|
return (_ctx, _cache) => {
|
|
43
|
-
return openBlock(),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
_: 1
|
|
73
|
-
}, 8, ["content"]);
|
|
46
|
+
return openBlock(), createElementBlock("span", {
|
|
47
|
+
ref_key: "root",
|
|
48
|
+
ref: root,
|
|
49
|
+
class: normalizeClass([unref(ns).b(), unref(ns).m(tone.value)]),
|
|
50
|
+
role: "meter",
|
|
51
|
+
"aria-label": unref(t)("chat.contextLabel"),
|
|
52
|
+
"aria-valuenow": percent.value,
|
|
53
|
+
"aria-valuemin": "0",
|
|
54
|
+
"aria-valuemax": "100",
|
|
55
|
+
"aria-valuetext": valueText.value
|
|
56
|
+
}, [(openBlock(), createElementBlock("svg", {
|
|
57
|
+
class: normalizeClass(unref(ns).e("ring")),
|
|
58
|
+
viewBox: "0 0 16 16",
|
|
59
|
+
"aria-hidden": "true"
|
|
60
|
+
}, [createElementVNode("circle", {
|
|
61
|
+
class: normalizeClass(unref(ns).e("track")),
|
|
62
|
+
cx: "8",
|
|
63
|
+
cy: "8",
|
|
64
|
+
r: "6"
|
|
65
|
+
}, null, 2), createElementVNode("circle", {
|
|
66
|
+
class: normalizeClass(unref(ns).e("bar")),
|
|
67
|
+
cx: "8",
|
|
68
|
+
cy: "8",
|
|
69
|
+
r: "6",
|
|
70
|
+
"stroke-dasharray": `${CIRCUMFERENCE * share.value} ${CIRCUMFERENCE}`
|
|
71
|
+
}, null, 10, _hoisted_2)], 2)), __props.showLabel ? (openBlock(), createElementBlock("span", {
|
|
72
|
+
key: 0,
|
|
73
|
+
class: normalizeClass(unref(ns).e("label"))
|
|
74
|
+
}, toDisplayString(percent.value) + "%", 3)) : createCommentVNode("", true)], 10, _hoisted_1);
|
|
74
75
|
};
|
|
75
76
|
}
|
|
76
77
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-context-meter.vue_vue_type_script_setup_true_lang.js","names":["
|
|
1
|
+
{"version":3,"file":"chat-context-meter.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_normalizeClass","_unref","_createElementVNode","_toDisplayString","_createCommentVNode"],"sources":["../../../src/components/chat-context-meter/chat-context-meter.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onMounted, useTemplateRef } from 'vue'\nimport { useNamespace } from '../../utils/namespace'\nimport { devWarn } from '../../utils/status-check'\nimport { useLocale } from '../config-provider/use-config'\nimport { compactNumber, contextUsage } from './chat-context-meter'\nimport type { ChatContextMeterProps } from './chat-context-meter'\n\ndefineOptions({ name: 'DouChatContextMeter' })\n\nconst props = withDefaults(defineProps<ChatContextMeterProps>(), {\n used: 0,\n total: 0,\n warnAt: 0.8,\n dangerAt: 0.95,\n showLabel: false,\n})\n\nconst ns = useNamespace('chat-context-meter')\nconst { t } = useLocale()\n\nconst usage = computed(() => contextUsage(props.used, props.total))\nconst share = computed(() => usage.value.share)\nconst percent = computed(() => usage.value.percent)\nconst tone = computed(() =>\n share.value >= props.dangerAt ? 'danger' : share.value >= props.warnAt ? 'warning' : 'neutral',\n)\n// what a screen reader hears for the value; the ring shows no numbers\nconst valueText = computed(() =>\n t('chat.context', {\n used: compactNumber(usage.value.used),\n total: compactNumber(usage.value.total),\n percent: percent.value,\n }),\n)\n\n// an icon-only button sizes the ring as its icon: the label would spill out of it\nconst root = useTemplateRef<HTMLElement>('root')\nonMounted(() => {\n if (process.env.NODE_ENV === 'production' || !props.showLabel) return\n if (root.value?.parentElement?.closest('.dou-button.is-icon-only'))\n devWarn(\n '[dou-ui] DouChatContextMeter: `showLabel` inside an icon-only button spills out of it, as the button sizes the ring as its icon. Put the ring in the button’s `leading` slot and the percentage as its text.',\n )\n})\n\n// r = 6 on a 16 box; the circumference drives the dash\nconst CIRCUMFERENCE = 2 * Math.PI * 6\n</script>\n\n<template>\n <!-- only the ring: a tooltip or popover goes around it, so it takes no focus of its own; an `aria-label` passed in replaces the default name -->\n <span\n ref=\"root\"\n :class=\"[ns.b(), ns.m(tone)]\"\n role=\"meter\"\n :aria-label=\"t('chat.contextLabel')\"\n :aria-valuenow=\"percent\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n :aria-valuetext=\"valueText\"\n >\n <svg :class=\"ns.e('ring')\" viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n <circle :class=\"ns.e('track')\" cx=\"8\" cy=\"8\" r=\"6\" />\n <circle\n :class=\"ns.e('bar')\"\n cx=\"8\"\n cy=\"8\"\n r=\"6\"\n :stroke-dasharray=\"`${CIRCUMFERENCE * share} ${CIRCUMFERENCE}`\"\n />\n </svg>\n <span v-if=\"showLabel\" :class=\"ns.e('label')\">{{ percent }}%</span>\n </span>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EAUA,MAAM,QAAQ;EAQd,MAAM,KAAK,aAAa,oBAAoB;EAC5C,MAAM,EAAE,MAAM,UAAU;EAExB,MAAM,QAAQ,eAAe,aAAa,MAAM,MAAM,MAAM,KAAK,CAAC;EAClE,MAAM,QAAQ,eAAe,MAAM,MAAM,KAAK;EAC9C,MAAM,UAAU,eAAe,MAAM,MAAM,OAAO;EAClD,MAAM,OAAO,eACX,MAAM,SAAS,MAAM,WAAW,WAAW,MAAM,SAAS,MAAM,SAAS,YAAY,SACvF;EAEA,MAAM,YAAY,eAChB,EAAE,gBAAgB;GAChB,MAAM,cAAc,MAAM,MAAM,IAAI;GACpC,OAAO,cAAc,MAAM,MAAM,KAAK;GACtC,SAAS,QAAQ;EACnB,CAAC,CACH;EAGA,MAAM,OAAO,eAA4B,MAAM;EAC/C,gBAAgB;GACd,IAAA,QAAA,IAAA,aAA6B,gBAAgB,CAAC,MAAM,WAAW;GAC/D,IAAI,KAAK,OAAO,eAAe,QAAQ,0BAA0B,GAC/D,QACE,8MACF;EACJ,CAAC;EAGD,MAAM,gBAAgB,IAAI,KAAK,KAAK;;GAKlC,OAAAA,UAAA,GAAAC,mBAqBO,QAAA;IApBD,SAAA;IAAJ,KAAI;IACH,OAAKC,eAAA,CAAGC,MAAA,EAAA,CAAE,CAAC,EAAC,GAAIA,MAAA,EAAA,CAAE,CAAC,EAAE,KAAA,KAAI,CAAA,CAAA;IAC1B,MAAK;IACJ,cAAYA,MAAA,CAAA,CAAC,CAAA,mBAAA;IACb,iBAAe,QAAA;IAChB,iBAAc;IACd,iBAAc;IACb,kBAAgB,UAAA;G,KAEjBH,UAAA,GAAAC,mBASM,OAAA;IATA,OAAKC,eAAEC,MAAA,EAAA,CAAE,CAAC,EAAC,MAAA,CAAA;IAAU,SAAQ;IAAY,eAAY;G,IACzDC,mBAAqD,UAAA;IAA5C,OAAKF,eAAEC,MAAA,EAAA,CAAE,CAAC,EAAC,OAAA,CAAA;IAAW,IAAG;IAAI,IAAG;IAAI,GAAE;G,aAC/CC,mBAME,UAAA;IALC,OAAKF,eAAEC,MAAA,EAAA,CAAE,CAAC,EAAC,KAAA,CAAA;IACZ,IAAG;IACH,IAAG;IACH,GAAE;IACD,oBAAgB,GAAK,gBAAgB,MAAA,MAAK,GAAI;G,gCAGvC,QAAA,aAAZH,UAAA,GAAAC,mBAAmE,QAAA;;IAA3C,OAAKC,eAAEC,MAAA,EAAA,CAAE,CAAC,EAAC,OAAA,CAAA;GAAc,GAAAE,gBAAA,QAAA,KAAO,IAAG,KAAC,CAAA,K"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-context-meter2.js","names":["_sfc_main"],"sources":["../../../src/components/chat-context-meter/chat-context-meter.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { useNamespace } from '../../utils/namespace'\nimport {
|
|
1
|
+
{"version":3,"file":"chat-context-meter2.js","names":["_sfc_main"],"sources":["../../../src/components/chat-context-meter/chat-context-meter.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onMounted, useTemplateRef } from 'vue'\nimport { useNamespace } from '../../utils/namespace'\nimport { devWarn } from '../../utils/status-check'\nimport { useLocale } from '../config-provider/use-config'\nimport { compactNumber, contextUsage } from './chat-context-meter'\nimport type { ChatContextMeterProps } from './chat-context-meter'\n\ndefineOptions({ name: 'DouChatContextMeter' })\n\nconst props = withDefaults(defineProps<ChatContextMeterProps>(), {\n used: 0,\n total: 0,\n warnAt: 0.8,\n dangerAt: 0.95,\n showLabel: false,\n})\n\nconst ns = useNamespace('chat-context-meter')\nconst { t } = useLocale()\n\nconst usage = computed(() => contextUsage(props.used, props.total))\nconst share = computed(() => usage.value.share)\nconst percent = computed(() => usage.value.percent)\nconst tone = computed(() =>\n share.value >= props.dangerAt ? 'danger' : share.value >= props.warnAt ? 'warning' : 'neutral',\n)\n// what a screen reader hears for the value; the ring shows no numbers\nconst valueText = computed(() =>\n t('chat.context', {\n used: compactNumber(usage.value.used),\n total: compactNumber(usage.value.total),\n percent: percent.value,\n }),\n)\n\n// an icon-only button sizes the ring as its icon: the label would spill out of it\nconst root = useTemplateRef<HTMLElement>('root')\nonMounted(() => {\n if (process.env.NODE_ENV === 'production' || !props.showLabel) return\n if (root.value?.parentElement?.closest('.dou-button.is-icon-only'))\n devWarn(\n '[dou-ui] DouChatContextMeter: `showLabel` inside an icon-only button spills out of it, as the button sizes the ring as its icon. Put the ring in the button’s `leading` slot and the percentage as its text.',\n )\n})\n\n// r = 6 on a 16 box; the circumference drives the dash\nconst CIRCUMFERENCE = 2 * Math.PI * 6\n</script>\n\n<template>\n <!-- only the ring: a tooltip or popover goes around it, so it takes no focus of its own; an `aria-label` passed in replaces the default name -->\n <span\n ref=\"root\"\n :class=\"[ns.b(), ns.m(tone)]\"\n role=\"meter\"\n :aria-label=\"t('chat.contextLabel')\"\n :aria-valuenow=\"percent\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n :aria-valuetext=\"valueText\"\n >\n <svg :class=\"ns.e('ring')\" viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n <circle :class=\"ns.e('track')\" cx=\"8\" cy=\"8\" r=\"6\" />\n <circle\n :class=\"ns.e('bar')\"\n cx=\"8\"\n cy=\"8\"\n r=\"6\"\n :stroke-dasharray=\"`${CIRCUMFERENCE * share} ${CIRCUMFERENCE}`\"\n />\n </svg>\n <span v-if=\"showLabel\" :class=\"ns.e('label')\">{{ percent }}%</span>\n </span>\n</template>\n"],"mappings":""}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { withInstall } from "../../utils/install.js";
|
|
2
|
+
import { compactNumber, contextUsage } from "./chat-context-meter.js";
|
|
2
3
|
import chat_context_meter_default from "./chat-context-meter2.js";
|
|
3
4
|
// src/components/chat-context-meter/index.ts
|
|
4
5
|
var DouChatContextMeter = withInstall(chat_context_meter_default);
|
|
5
|
-
export { DouChatContextMeter, DouChatContextMeter as default };
|
|
6
|
+
export { DouChatContextMeter, DouChatContextMeter as default, compactNumber, contextUsage };
|
|
6
7
|
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ChatContextMeter"],"sources":["../../../src/components/chat-context-meter/index.ts"],"sourcesContent":["import { withInstall } from '../../utils/install'\nimport ChatContextMeter from './chat-context-meter.vue'\n\nexport const DouChatContextMeter = withInstall(ChatContextMeter)\nexport default DouChatContextMeter\n\nexport type * from './chat-context-meter'\nexport type ChatContextMeterInstance = InstanceType<typeof ChatContextMeter>\n\ndeclare module 'vue' {\n export interface GlobalComponents {\n DouChatContextMeter: typeof DouChatContextMeter\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["ChatContextMeter"],"sources":["../../../src/components/chat-context-meter/index.ts"],"sourcesContent":["import { withInstall } from '../../utils/install'\nimport ChatContextMeter from './chat-context-meter.vue'\n\nexport const DouChatContextMeter = withInstall(ChatContextMeter)\nexport default DouChatContextMeter\n\nexport type * from './chat-context-meter'\nexport { compactNumber, contextUsage } from './chat-context-meter'\nexport type ChatContextMeterInstance = InstanceType<typeof ChatContextMeter>\n\ndeclare module 'vue' {\n export interface GlobalComponents {\n DouChatContextMeter: typeof DouChatContextMeter\n }\n}\n"],"mappings":";;;;AAGA,IAAa,sBAAsB,YAAYA,0BAAgB"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import '@dou-ui/theme/core.css'
|
|
2
|
-
import '@dou-ui/theme/components/
|
|
3
|
-
import '@dou-ui/theme/components/kbd.css'
|
|
4
|
-
import '@dou-ui/theme/components/tooltip.css'
|
|
2
|
+
import '@dou-ui/theme/components/button.css'
|
|
5
3
|
import '@dou-ui/theme/components/chat-context-meter.css'
|
|
@@ -5,7 +5,6 @@ import { DouButton } from "../button/index.js";
|
|
|
5
5
|
import { DouChatArtifact } from "../chat-artifact/index.js";
|
|
6
6
|
import { DouChatAttachments } from "../chat-attachments/index.js";
|
|
7
7
|
import { DouChatConfirm } from "../chat-confirm/index.js";
|
|
8
|
-
import { DouTooltip } from "../tooltip/index.js";
|
|
9
8
|
import { DouChatQuestion } from "../chat-question/index.js";
|
|
10
9
|
import { planRunning } from "../chat-plan/chat-plan.js";
|
|
11
10
|
import { DouChatPlan } from "../chat-plan/index.js";
|
|
@@ -14,6 +13,7 @@ import { DouChatSources } from "../chat-sources/index.js";
|
|
|
14
13
|
import { stepsLive } from "../chat-steps/chat-steps.js";
|
|
15
14
|
import { DouChatSteps } from "../chat-steps/index.js";
|
|
16
15
|
import { DouChatToolCall } from "../chat-tool-call/index.js";
|
|
16
|
+
import { DouTooltip } from "../tooltip/index.js";
|
|
17
17
|
import { DouCopyButton } from "../copy-button/index.js";
|
|
18
18
|
import { DouMarkdown } from "../markdown/index.js";
|
|
19
19
|
import { DouStreamText } from "../stream-text/index.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useNamespace } from "../../utils/namespace.js";
|
|
2
2
|
import { useLocale } from "../config-provider/use-config.js";
|
|
3
|
-
import { DouTooltip } from "../tooltip/index.js";
|
|
4
3
|
import { useClipboard } from "../../composables/use-clipboard.js";
|
|
4
|
+
import { DouTooltip } from "../tooltip/index.js";
|
|
5
5
|
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeProps, normalizeClass, openBlock, toDisplayString, unref, withCtx } from "vue";
|
|
6
6
|
import { CheckIcon, CopyIcon } from "@dou-ui/icons";
|
|
7
7
|
// src/components/copy-button/copy-button.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","names":["_sfc_main"],"sources":["../../../src/components/popover/popover.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, mergeProps, useId, useSlots } from 'vue'\nimport { getTabbable } from '../../composables/use-focus-trap'\nimport { usePopup } from '../../composables/use-popup'\nimport { useNamespace } from '../../utils/namespace'\nimport { OnlyChild } from '../../utils/only-child'\nimport type { PopoverExpose, PopoverProps, PopoverSlots } from './popover'\nimport { useTeleport } from '../../utils/teleport'\n\ndefineOptions({ name: 'DouPopover', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<PopoverProps>(), {\n placement: 'bottom',\n trigger: 'click',\n disabled: false,\n showDelay: 100,\n hideDelay: 150,\n offset: 8,\n teleport: undefined,\n})\nconst teleportTarget = useTeleport(() => props.teleport)\nconst open = defineModel<boolean>('open', { default: false })\ndefineSlots<PopoverSlots>()\nconst slots = useSlots()\n\nconst ns = useNamespace('popover')\nconst id = `dou-popover-${useId()}`\nconst titleId = `${id}-title`\nconst hasTitle = computed(() => !!props.title || !!slots.title)\n\nconst popup = usePopup({\n open,\n trigger: () => props.trigger,\n disabled: () => props.disabled,\n placement: () => props.placement,\n offset: () => props.offset,\n showDelay: () => props.showDelay,\n hideDelay: () => props.hideDelay,\n})\nconst { triggerRef, panelRef, rendered, theme, placement, panelStyle, panelListeners } = popup\n\n// The panel lives at the end of <body>, away from the trigger in tab\n// order. `Tab` from the trigger steps into the panel, and stepping out of\n// either end of the panel lands back on the trigger, from where the\n// browser carries on as usual.\nfunction onTriggerKeydown(event: KeyboardEvent) {\n if (event.key !== 'Tab' ||
|
|
1
|
+
{"version":3,"file":"popover.js","names":["_sfc_main"],"sources":["../../../src/components/popover/popover.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, mergeProps, useId, useSlots } from 'vue'\nimport { getTabbable } from '../../composables/use-focus-trap'\nimport { usePopup } from '../../composables/use-popup'\nimport { useNamespace } from '../../utils/namespace'\nimport { OnlyChild } from '../../utils/only-child'\nimport type { PopoverExpose, PopoverProps, PopoverSlots } from './popover'\nimport { useTeleport } from '../../utils/teleport'\n\ndefineOptions({ name: 'DouPopover', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<PopoverProps>(), {\n placement: 'bottom',\n trigger: 'click',\n disabled: false,\n showDelay: 100,\n hideDelay: 150,\n offset: 8,\n teleport: undefined,\n})\nconst teleportTarget = useTeleport(() => props.teleport)\nconst open = defineModel<boolean>('open', { default: false })\ndefineSlots<PopoverSlots>()\nconst slots = useSlots()\n\nconst ns = useNamespace('popover')\nconst id = `dou-popover-${useId()}`\nconst titleId = `${id}-title`\nconst hasTitle = computed(() => !!props.title || !!slots.title)\n\nconst popup = usePopup({\n open,\n trigger: () => props.trigger,\n disabled: () => props.disabled,\n placement: () => props.placement,\n offset: () => props.offset,\n showDelay: () => props.showDelay,\n hideDelay: () => props.hideDelay,\n})\nconst { triggerRef, panelRef, rendered, theme, placement, panelStyle, panelListeners } = popup\n\n// The panel lives at the end of <body>, away from the trigger in tab\n// order. `Tab` from the trigger steps into the panel, and stepping out of\n// either end of the panel lands back on the trigger, from where the\n// browser carries on as usual. Leaving the trigger any other way (`Tab`\n// with nothing to focus in the panel, or `Shift+Tab`) closes the panel, so\n// it doesn't stay open away from the focus.\nfunction onTriggerKeydown(event: KeyboardEvent) {\n if (event.key !== 'Tab' || !open.value || !panelRef.value) return\n const first = event.shiftKey ? undefined : getTabbable(panelRef.value)[0]\n if (!first) return popup.hide()\n event.preventDefault()\n first.focus()\n}\n\nfunction onPanelKeydown(event: KeyboardEvent) {\n if (event.key !== 'Tab' || !panelRef.value) return\n const tabbable = getTabbable(panelRef.value)\n const trigger = popup.reference() as HTMLElement | null\n if (event.shiftKey && document.activeElement === tabbable[0]) {\n event.preventDefault()\n trigger?.focus()\n } else if (!event.shiftKey && document.activeElement === tabbable.at(-1)) {\n trigger?.focus()\n popup.hide()\n }\n}\n\n// Hover has no keyboard of its own: Enter or Space on the trigger (a click\n// with `detail` 0) opens and closes a hover card too, so a screen reader\n// can reach it. A link trigger keeps Enter for following the link.\nfunction onTriggerClick(event: MouseEvent) {\n if (props.trigger !== 'hover' || event.detail !== 0 || props.disabled) return\n if ((event.currentTarget as Element | null)?.matches('a[href]')) return\n if (open.value) return popup.hide()\n popup.tapped.value = true\n popup.show()\n}\n\nconst triggerProps = computed(() =>\n mergeProps(popup.triggerListeners.value, {\n onKeydown: onTriggerKeydown,\n onClick: onTriggerClick,\n 'aria-haspopup': 'dialog' as const,\n // a hover card a tap or the keyboard opened stays, like a dialog\n 'aria-expanded': props.trigger === 'hover' && !popup.tapped.value ? undefined : open.value,\n 'aria-controls': rendered.value ? id : undefined,\n }),\n)\n\nconst panelClasses = computed(() => [ns.b(), 'dou-floating', ns.is('titled', hasTitle.value)])\nconst width = computed(() =>\n typeof props.width === 'number' ? `${props.width}px` : (props.width ?? undefined),\n)\n\ndefineExpose<PopoverExpose>({ open: () => popup.show(), close: () => popup.dismiss() })\n</script>\n\n<template>\n <OnlyChild ref=\"triggerRef\" v-bind=\"triggerProps\"><slot /></OnlyChild>\n <Teleport v-if=\"rendered\" :to=\"teleportTarget.to\" :disabled=\"teleportTarget.disabled\">\n <Transition appear name=\"dou-floating\">\n <div\n v-show=\"open\"\n :id=\"id\"\n ref=\"panelRef\"\n role=\"dialog\"\n :aria-labelledby=\"hasTitle ? titleId : undefined\"\n :class=\"panelClasses\"\n :style=\"[panelStyle, { width }]\"\n :data-placement=\"placement\"\n :data-dou-theme=\"theme\"\n v-bind=\"{ ...$attrs, ...panelListeners }\"\n @keydown=\"onPanelKeydown\"\n >\n <div v-if=\"hasTitle\" :id=\"titleId\" :class=\"ns.e('title')\">\n <slot name=\"title\">{{ title }}</slot>\n </div>\n <div :class=\"ns.e('content')\">\n <slot name=\"content\" :close=\"popup.dismiss\">{{ content }}</slot>\n </div>\n </div>\n </Transition>\n </Teleport>\n</template>\n"],"mappings":""}
|
|
@@ -60,9 +60,9 @@ var popover_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCo
|
|
|
60
60
|
});
|
|
61
61
|
const { triggerRef, panelRef, rendered, theme, placement, panelStyle, panelListeners } = popup;
|
|
62
62
|
function onTriggerKeydown(event) {
|
|
63
|
-
if (event.key !== "Tab" ||
|
|
64
|
-
const first = getTabbable(panelRef.value)[0];
|
|
65
|
-
if (!first) return;
|
|
63
|
+
if (event.key !== "Tab" || !open.value || !panelRef.value) return;
|
|
64
|
+
const first = event.shiftKey ? void 0 : getTabbable(panelRef.value)[0];
|
|
65
|
+
if (!first) return popup.hide();
|
|
66
66
|
event.preventDefault();
|
|
67
67
|
first.focus();
|
|
68
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_useModel","_openBlock","_createElementBlock","_Fragment","_createVNode","_unref","_mergeProps","_withCtx","_renderSlot","_createBlock","_Teleport","_Transition","_withDirectives","_createElementVNode","_normalizeClass","_createTextVNode","_toDisplayString","_createCommentVNode","_vShow"],"sources":["../../../src/components/popover/popover.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, mergeProps, useId, useSlots } from 'vue'\nimport { getTabbable } from '../../composables/use-focus-trap'\nimport { usePopup } from '../../composables/use-popup'\nimport { useNamespace } from '../../utils/namespace'\nimport { OnlyChild } from '../../utils/only-child'\nimport type { PopoverExpose, PopoverProps, PopoverSlots } from './popover'\nimport { useTeleport } from '../../utils/teleport'\n\ndefineOptions({ name: 'DouPopover', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<PopoverProps>(), {\n placement: 'bottom',\n trigger: 'click',\n disabled: false,\n showDelay: 100,\n hideDelay: 150,\n offset: 8,\n teleport: undefined,\n})\nconst teleportTarget = useTeleport(() => props.teleport)\nconst open = defineModel<boolean>('open', { default: false })\ndefineSlots<PopoverSlots>()\nconst slots = useSlots()\n\nconst ns = useNamespace('popover')\nconst id = `dou-popover-${useId()}`\nconst titleId = `${id}-title`\nconst hasTitle = computed(() => !!props.title || !!slots.title)\n\nconst popup = usePopup({\n open,\n trigger: () => props.trigger,\n disabled: () => props.disabled,\n placement: () => props.placement,\n offset: () => props.offset,\n showDelay: () => props.showDelay,\n hideDelay: () => props.hideDelay,\n})\nconst { triggerRef, panelRef, rendered, theme, placement, panelStyle, panelListeners } = popup\n\n// The panel lives at the end of <body>, away from the trigger in tab\n// order. `Tab` from the trigger steps into the panel, and stepping out of\n// either end of the panel lands back on the trigger, from where the\n// browser carries on as usual.\nfunction onTriggerKeydown(event: KeyboardEvent) {\n if (event.key !== 'Tab' ||
|
|
1
|
+
{"version":3,"file":"popover.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_useModel","_openBlock","_createElementBlock","_Fragment","_createVNode","_unref","_mergeProps","_withCtx","_renderSlot","_createBlock","_Teleport","_Transition","_withDirectives","_createElementVNode","_normalizeClass","_createTextVNode","_toDisplayString","_createCommentVNode","_vShow"],"sources":["../../../src/components/popover/popover.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, mergeProps, useId, useSlots } from 'vue'\nimport { getTabbable } from '../../composables/use-focus-trap'\nimport { usePopup } from '../../composables/use-popup'\nimport { useNamespace } from '../../utils/namespace'\nimport { OnlyChild } from '../../utils/only-child'\nimport type { PopoverExpose, PopoverProps, PopoverSlots } from './popover'\nimport { useTeleport } from '../../utils/teleport'\n\ndefineOptions({ name: 'DouPopover', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<PopoverProps>(), {\n placement: 'bottom',\n trigger: 'click',\n disabled: false,\n showDelay: 100,\n hideDelay: 150,\n offset: 8,\n teleport: undefined,\n})\nconst teleportTarget = useTeleport(() => props.teleport)\nconst open = defineModel<boolean>('open', { default: false })\ndefineSlots<PopoverSlots>()\nconst slots = useSlots()\n\nconst ns = useNamespace('popover')\nconst id = `dou-popover-${useId()}`\nconst titleId = `${id}-title`\nconst hasTitle = computed(() => !!props.title || !!slots.title)\n\nconst popup = usePopup({\n open,\n trigger: () => props.trigger,\n disabled: () => props.disabled,\n placement: () => props.placement,\n offset: () => props.offset,\n showDelay: () => props.showDelay,\n hideDelay: () => props.hideDelay,\n})\nconst { triggerRef, panelRef, rendered, theme, placement, panelStyle, panelListeners } = popup\n\n// The panel lives at the end of <body>, away from the trigger in tab\n// order. `Tab` from the trigger steps into the panel, and stepping out of\n// either end of the panel lands back on the trigger, from where the\n// browser carries on as usual. Leaving the trigger any other way (`Tab`\n// with nothing to focus in the panel, or `Shift+Tab`) closes the panel, so\n// it doesn't stay open away from the focus.\nfunction onTriggerKeydown(event: KeyboardEvent) {\n if (event.key !== 'Tab' || !open.value || !panelRef.value) return\n const first = event.shiftKey ? undefined : getTabbable(panelRef.value)[0]\n if (!first) return popup.hide()\n event.preventDefault()\n first.focus()\n}\n\nfunction onPanelKeydown(event: KeyboardEvent) {\n if (event.key !== 'Tab' || !panelRef.value) return\n const tabbable = getTabbable(panelRef.value)\n const trigger = popup.reference() as HTMLElement | null\n if (event.shiftKey && document.activeElement === tabbable[0]) {\n event.preventDefault()\n trigger?.focus()\n } else if (!event.shiftKey && document.activeElement === tabbable.at(-1)) {\n trigger?.focus()\n popup.hide()\n }\n}\n\n// Hover has no keyboard of its own: Enter or Space on the trigger (a click\n// with `detail` 0) opens and closes a hover card too, so a screen reader\n// can reach it. A link trigger keeps Enter for following the link.\nfunction onTriggerClick(event: MouseEvent) {\n if (props.trigger !== 'hover' || event.detail !== 0 || props.disabled) return\n if ((event.currentTarget as Element | null)?.matches('a[href]')) return\n if (open.value) return popup.hide()\n popup.tapped.value = true\n popup.show()\n}\n\nconst triggerProps = computed(() =>\n mergeProps(popup.triggerListeners.value, {\n onKeydown: onTriggerKeydown,\n onClick: onTriggerClick,\n 'aria-haspopup': 'dialog' as const,\n // a hover card a tap or the keyboard opened stays, like a dialog\n 'aria-expanded': props.trigger === 'hover' && !popup.tapped.value ? undefined : open.value,\n 'aria-controls': rendered.value ? id : undefined,\n }),\n)\n\nconst panelClasses = computed(() => [ns.b(), 'dou-floating', ns.is('titled', hasTitle.value)])\nconst width = computed(() =>\n typeof props.width === 'number' ? `${props.width}px` : (props.width ?? undefined),\n)\n\ndefineExpose<PopoverExpose>({ open: () => popup.show(), close: () => popup.dismiss() })\n</script>\n\n<template>\n <OnlyChild ref=\"triggerRef\" v-bind=\"triggerProps\"><slot /></OnlyChild>\n <Teleport v-if=\"rendered\" :to=\"teleportTarget.to\" :disabled=\"teleportTarget.disabled\">\n <Transition appear name=\"dou-floating\">\n <div\n v-show=\"open\"\n :id=\"id\"\n ref=\"panelRef\"\n role=\"dialog\"\n :aria-labelledby=\"hasTitle ? titleId : undefined\"\n :class=\"panelClasses\"\n :style=\"[panelStyle, { width }]\"\n :data-placement=\"placement\"\n :data-dou-theme=\"theme\"\n v-bind=\"{ ...$attrs, ...panelListeners }\"\n @keydown=\"onPanelKeydown\"\n >\n <div v-if=\"hasTitle\" :id=\"titleId\" :class=\"ns.e('title')\">\n <slot name=\"title\">{{ title }}</slot>\n </div>\n <div :class=\"ns.e('content')\">\n <slot name=\"content\" :close=\"popup.dismiss\">{{ content }}</slot>\n </div>\n </div>\n </Transition>\n </Teleport>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWA,MAAM,QAAQ;EASd,MAAM,iBAAiB,kBAAkB,MAAM,QAAQ;EACvD,MAAM,OAAOC,SAAoB,SAAC,MAA0B;EAE5D,MAAM,QAAQ,SAAS;EAEvB,MAAM,KAAK,aAAa,SAAS;EACjC,MAAM,KAAK,eAAe,MAAM;EAChC,MAAM,UAAU,GAAG,GAAG;EACtB,MAAM,WAAW,eAAe,CAAC,CAAC,MAAM,SAAS,CAAC,CAAC,MAAM,KAAK;EAE9D,MAAM,QAAQ,SAAS;GACrB;GACA,eAAe,MAAM;GACrB,gBAAgB,MAAM;GACtB,iBAAiB,MAAM;GACvB,cAAc,MAAM;GACpB,iBAAiB,MAAM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AAA,E,IACfG,WAAgE,KAAA,QAAA,WAAA,EAA1C,OAAOH,MAAA,KAAA,CAAK,CAAC,QAAnC,SAAgE,CAAjBU,gBAAAC,gBAAA,QAAA,OAAO,GAAA,CAAA,C,4BAhBhD,CAAAE,OAAA,KAAA,KAAI,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.js","names":["_sfc_main"],"sources":["../../../src/components/tooltip/tooltip.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, useId, watch } from 'vue'\nimport { ariaHotkey, useApplePlatform } from '../../composables/use-hotkey'\nimport type { VirtualElement } from '../../composables/use-floating'\nimport { usePopup } from '../../composables/use-popup'\nimport { useNamespace } from '../../utils/namespace'\nimport { OnlyChild } from '../../utils/only-child'\nimport { hasHover } from '../../utils/pointer'\nimport { DouKbd } from '../kbd'\nimport type { TooltipProps, TooltipSlots } from './tooltip'\nimport { claimTooltip, releaseTooltip } from './only-one'\nimport { useTeleport } from '../../utils/teleport'\n\ndefineOptions({ name: 'DouTooltip', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<TooltipProps>(), {\n placement: 'top',\n disabled: false,\n showDelay: 200,\n hideDelay: 100,\n offset: 6,\n followCursor: false,\n interactive: true,\n teleport: undefined,\n})\nconst teleportTarget = useTeleport(() => props.teleport)\nconst open = defineModel<boolean>('open', { default: false })\ndefineSlots<TooltipSlots>()\n\nconst ns = useNamespace('tooltip')\nconst id = `dou-tooltip-${useId()}`\n\nconst {\n triggerRef,\n panelRef,\n reference,\n rendered,\n theme,\n placement,\n panelStyle,\n triggerListeners,\n panelListeners,\n update,\n} = usePopup({\n open,\n trigger: ['hover', 'focus'],\n // touch gets no tip, see below\n tap: false,\n disabled: () => props.disabled,\n placement: () => props.placement,\n // keep clear of the pointer itself when following it\n offset: () => props.offset + (props.followCursor ? 10 : 0),\n showDelay: () => props.showDelay,\n hideDelay: () => props.hideDelay,\n anchor: () => (props.followCursor && pointer.value ? cursor : undefined),\n})\n\n// with `followCursor`, the tooltip sits next to a point under the pointer\nconst pointer = ref<{ x: number; y: number } | null>(null)\nconst cursor: VirtualElement = {\n getBoundingClientRect: () => new DOMRect(pointer.value?.x ?? 0, pointer.value?.y ?? 0, 0, 0),\n}\nfunction onPointermove(event: PointerEvent) {\n if (!props.followCursor || !hasHover(event.pointerType)) return\n pointer.value = { x: event.clientX, y: event.clientY }\n update()\n}\n\n/*\n * Tooltips that hover or focus opened show one at a time. One opened\n * through `open` from outside (a guide, say) takes no part: it neither\n * closes the others nor is closed by them.\n */\nlet byTrigger = false\n// A tooltip whose trigger left the page without unmounting is just dropped.\nconst close = () => {\n if ((triggerRef.value?.$el as Node | undefined)?.isConnected !== false) open.value = false\n}\nwatch(open, (value) => {\n if (value && byTrigger) claimTooltip(close)\n else if (!value) {\n releaseTooltip(close)\n byTrigger = false\n }\n})\nonBeforeUnmount(() => releaseTooltip(close))\n\n/*\n * On the trigger of a popover or a menu, the tip gives way once the panel\n * opens: it would only sit over the panel. The trigger may also hold the\n * button that opens it (the arrow of a DouDropdownButton). It comes back\n * when the pointer comes in again, or with the next focus.\n */\n// Only a control that opens a popup counts: a tree item or a collapse\n// header inside the trigger is expanded too, and must not hide the tip.\nconst popupOpen = '[aria-haspopup]:not([aria-haspopup=\"false\"])[aria-expanded=\"true\"]'\nconst expanded = () => {\n const element = reference()\n return !!element && (element.matches(popupOpen) || !!element.querySelector(popupOpen))\n}\nlet watching: MutationObserver | undefined\nwatch(open, (value) => {\n watching?.disconnect()\n watching = undefined\n if (!value || !byTrigger) return\n if (expanded()) {\n open.value = false\n return\n }\n const element = reference()\n if (!element || typeof MutationObserver === 'undefined') return\n watching = new MutationObserver(() => {\n if (expanded()) open.value = false\n })\n watching.observe(element, {\n attributes: true,\n attributeFilter: ['aria-expanded'],\n subtree: true,\n })\n})\nonBeforeUnmount(() => watching?.disconnect())\n\n/*\n * An icon button named \"设置\" with the tip \"设置\" would be read twice:\n * once as its name, once as its description. The tip describes the\n * trigger only when it says something the name does not.\n */\nconst describes = ref(false)\nconst plain = (text: string | null | undefined) =>\n (text ?? '').replace(/\\s+/g, ' ').trim().toLowerCase()\nfunction nameOf(element: Element) {\n const label = element.getAttribute('aria-label')\n if (label?.trim()) return label\n const ids = element.getAttribute('aria-labelledby')?.split(/\\s+/).filter(Boolean)\n if (ids?.length) return ids.map((one) => document.getElementById(one)?.textContent).join(' ')\n return element.textContent\n}\nwatch(\n [open, () => props.content],\n ([value]) => {\n if (!value) return\n const element = reference()\n const panel = panelRef.value\n // the shortcut is announced through aria-keyshortcuts, so only the words count\n const text = panel && (panel.querySelector(`.${ns.e('text')}`) ?? panel).textContent\n describes.value
|
|
1
|
+
{"version":3,"file":"tooltip.js","names":["_sfc_main"],"sources":["../../../src/components/tooltip/tooltip.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, useId, watch } from 'vue'\nimport { ariaHotkey, useApplePlatform } from '../../composables/use-hotkey'\nimport type { VirtualElement } from '../../composables/use-floating'\nimport { usePopup } from '../../composables/use-popup'\nimport { useNamespace } from '../../utils/namespace'\nimport { OnlyChild } from '../../utils/only-child'\nimport { hasHover } from '../../utils/pointer'\nimport { DouKbd } from '../kbd'\nimport type { TooltipProps, TooltipSlots } from './tooltip'\nimport { claimTooltip, releaseTooltip } from './only-one'\nimport { useTeleport } from '../../utils/teleport'\n\ndefineOptions({ name: 'DouTooltip', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<TooltipProps>(), {\n placement: 'top',\n disabled: false,\n showDelay: 200,\n hideDelay: 100,\n offset: 6,\n followCursor: false,\n interactive: true,\n teleport: undefined,\n})\nconst teleportTarget = useTeleport(() => props.teleport)\nconst open = defineModel<boolean>('open', { default: false })\ndefineSlots<TooltipSlots>()\n\nconst ns = useNamespace('tooltip')\nconst id = `dou-tooltip-${useId()}`\n\nconst {\n triggerRef,\n panelRef,\n reference,\n rendered,\n theme,\n placement,\n panelStyle,\n triggerListeners,\n panelListeners,\n update,\n} = usePopup({\n open,\n trigger: ['hover', 'focus'],\n // touch gets no tip, see below\n tap: false,\n disabled: () => props.disabled,\n placement: () => props.placement,\n // keep clear of the pointer itself when following it\n offset: () => props.offset + (props.followCursor ? 10 : 0),\n showDelay: () => props.showDelay,\n hideDelay: () => props.hideDelay,\n anchor: () => (props.followCursor && pointer.value ? cursor : undefined),\n})\n\n// with `followCursor`, the tooltip sits next to a point under the pointer\nconst pointer = ref<{ x: number; y: number } | null>(null)\nconst cursor: VirtualElement = {\n getBoundingClientRect: () => new DOMRect(pointer.value?.x ?? 0, pointer.value?.y ?? 0, 0, 0),\n}\nfunction onPointermove(event: PointerEvent) {\n if (!props.followCursor || !hasHover(event.pointerType)) return\n pointer.value = { x: event.clientX, y: event.clientY }\n update()\n}\n\n/*\n * Tooltips that hover or focus opened show one at a time. One opened\n * through `open` from outside (a guide, say) takes no part: it neither\n * closes the others nor is closed by them.\n */\nlet byTrigger = false\n// A tooltip whose trigger left the page without unmounting is just dropped.\nconst close = () => {\n if ((triggerRef.value?.$el as Node | undefined)?.isConnected !== false) open.value = false\n}\nwatch(open, (value) => {\n if (value && byTrigger) claimTooltip(close)\n else if (!value) {\n releaseTooltip(close)\n byTrigger = false\n }\n})\nonBeforeUnmount(() => releaseTooltip(close))\n\n/*\n * On the trigger of a popover or a menu, the tip gives way once the panel\n * opens: it would only sit over the panel. The trigger may also hold the\n * button that opens it (the arrow of a DouDropdownButton). It comes back\n * when the pointer comes in again, or with the next focus.\n */\n// Only a control that opens a popup counts: a tree item or a collapse\n// header inside the trigger is expanded too, and must not hide the tip.\nconst popupOpen = '[aria-haspopup]:not([aria-haspopup=\"false\"])[aria-expanded=\"true\"]'\nconst expanded = () => {\n const element = reference()\n return !!element && (element.matches(popupOpen) || !!element.querySelector(popupOpen))\n}\nlet watching: MutationObserver | undefined\nwatch(open, (value) => {\n watching?.disconnect()\n watching = undefined\n if (!value || !byTrigger) return\n if (expanded()) {\n open.value = false\n return\n }\n const element = reference()\n if (!element || typeof MutationObserver === 'undefined') return\n watching = new MutationObserver(() => {\n if (expanded()) open.value = false\n })\n watching.observe(element, {\n attributes: true,\n attributeFilter: ['aria-expanded'],\n subtree: true,\n })\n})\nonBeforeUnmount(() => watching?.disconnect())\n\n/*\n * An icon button named \"设置\" with the tip \"设置\" would be read twice:\n * once as its name, once as its description. The tip describes the\n * trigger only when it says something the name does not, nor the value\n * a meter or slider reads out (`aria-valuetext`).\n */\nconst describes = ref(false)\nconst plain = (text: string | null | undefined) =>\n (text ?? '').replace(/\\s+/g, ' ').trim().toLowerCase()\nfunction nameOf(element: Element) {\n const label = element.getAttribute('aria-label')\n if (label?.trim()) return label\n const ids = element.getAttribute('aria-labelledby')?.split(/\\s+/).filter(Boolean)\n if (ids?.length) return ids.map((one) => document.getElementById(one)?.textContent).join(' ')\n return element.textContent\n}\nwatch(\n [open, () => props.content],\n ([value]) => {\n if (!value) return\n const element = reference()\n const panel = panelRef.value\n // the shortcut is announced through aria-keyshortcuts, so only the words count\n const text = panel && (panel.querySelector(`.${ns.e('text')}`) ?? panel).textContent\n describes.value =\n !element ||\n (plain(text) !== plain(nameOf(element)) &&\n plain(text) !== plain(element.getAttribute('aria-valuetext')))\n },\n { flush: 'post' },\n)\n/** Marks what follows (the open after the delay) as the trigger's own doing. */\nconst fromTrigger = (handler?: (event: Event) => void) =>\n handler &&\n ((event: Event) => {\n byTrigger = true\n handler(event)\n })\n\nconst interactive = computed(() => props.interactive && !props.followCursor)\n\nconst apple = useApplePlatform()\n\n// A tap also brings focus, and phones move it away only with the next tap\n// elsewhere, so the tip would stay up over the page. Touch gets no tip, the\n// same as a native title (hover already leaves touch out).\nlet touch = false\nconst notTouch = (handler?: (event: Event) => void) =>\n handler && ((event: Event) => touch || handler(event))\nconst leave = (handler?: (event: Event) => void) =>\n handler &&\n ((event: Event) => {\n // the finger lifting is not leaving: the focus from the tap is still to come\n if (hasHover((event as PointerEvent).pointerType ?? 'mouse')) touch = false\n handler(event)\n if (!open.value) byTrigger = false\n })\nfunction onPointerType(event: PointerEvent) {\n touch = !hasHover(event.pointerType)\n}\nconst enter = (handler?: (event: Event) => void) => (event: Event) => {\n onPointerType(event as PointerEvent)\n handler?.(event)\n}\n\n// Focus that comes with a press shows no tip: the pointer is already there\n// and hovering shows it. Opened at once under the pointer, it could take the\n// release, and the click that started it would be lost.\nlet pressing = false\nfunction onPointerdown(event: PointerEvent) {\n onPointerType(event)\n pressing = true\n setTimeout(() => (pressing = false))\n}\nconst focusin = (handler?: (event: Event) => void) =>\n handler && ((event: Event) => pressing || handler(event))\n\nconst triggerProps = computed(() => ({\n ...triggerListeners.value,\n onPointerenter: enter(fromTrigger(triggerListeners.value.onPointerenter)),\n onFocusin: notTouch(focusin(fromTrigger(triggerListeners.value.onFocusin))),\n onPointerleave: leave(triggerListeners.value.onPointerleave),\n onFocusout: leave(triggerListeners.value.onFocusout),\n onPointerdown,\n onPointermove,\n 'aria-describedby': open.value && describes.value ? id : undefined,\n ...(props.shortcut && { 'aria-keyshortcuts': ariaHotkey(props.shortcut, apple.value) }),\n}))\n</script>\n\n<template>\n <OnlyChild ref=\"triggerRef\" v-bind=\"triggerProps\"><slot /></OnlyChild>\n <Teleport v-if=\"rendered\" :to=\"teleportTarget.to\" :disabled=\"teleportTarget.disabled\">\n <Transition appear name=\"dou-floating\">\n <div\n v-show=\"open\"\n :id=\"id\"\n ref=\"panelRef\"\n role=\"tooltip\"\n :class=\"[ns.b(), 'dou-floating', ns.is('static', !interactive)]\"\n :style=\"panelStyle\"\n :data-placement=\"placement\"\n :data-dou-theme=\"theme\"\n v-bind=\"{ ...$attrs, ...(interactive ? panelListeners : {}) }\"\n >\n <span v-if=\"shortcut\" :class=\"ns.e('shortcut')\">\n <span :class=\"ns.e('text')\"\n ><slot name=\"content\">{{ content }}</slot></span\n >\n <DouKbd size=\"sm\" :keys=\"shortcut\" />\n </span>\n <slot v-else name=\"content\">{{ content }}</slot>\n </div>\n </Transition>\n </Teleport>\n</template>\n"],"mappings":""}
|
|
@@ -124,7 +124,7 @@ var tooltip_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCo
|
|
|
124
124
|
const element = reference();
|
|
125
125
|
const panel = panelRef.value;
|
|
126
126
|
const text = panel && (panel.querySelector(`.${ns.e("text")}`) ?? panel).textContent;
|
|
127
|
-
describes.value = !element || plain(text) !== plain(nameOf(element));
|
|
127
|
+
describes.value = !element || plain(text) !== plain(nameOf(element)) && plain(text) !== plain(element.getAttribute("aria-valuetext"));
|
|
128
128
|
}, { flush: "post" });
|
|
129
129
|
/** Marks what follows (the open after the delay) as the trigger's own doing. */
|
|
130
130
|
const fromTrigger = (handler) => handler && ((event) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_useModel","_openBlock","_createElementBlock","_Fragment","_createVNode","_unref","_mergeProps","_withCtx","_renderSlot","_createBlock","_Teleport","_Transition","_withDirectives","_createElementVNode","_normalizeClass","_createTextVNode","_toDisplayString","_vShow","_createCommentVNode"],"sources":["../../../src/components/tooltip/tooltip.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, useId, watch } from 'vue'\nimport { ariaHotkey, useApplePlatform } from '../../composables/use-hotkey'\nimport type { VirtualElement } from '../../composables/use-floating'\nimport { usePopup } from '../../composables/use-popup'\nimport { useNamespace } from '../../utils/namespace'\nimport { OnlyChild } from '../../utils/only-child'\nimport { hasHover } from '../../utils/pointer'\nimport { DouKbd } from '../kbd'\nimport type { TooltipProps, TooltipSlots } from './tooltip'\nimport { claimTooltip, releaseTooltip } from './only-one'\nimport { useTeleport } from '../../utils/teleport'\n\ndefineOptions({ name: 'DouTooltip', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<TooltipProps>(), {\n placement: 'top',\n disabled: false,\n showDelay: 200,\n hideDelay: 100,\n offset: 6,\n followCursor: false,\n interactive: true,\n teleport: undefined,\n})\nconst teleportTarget = useTeleport(() => props.teleport)\nconst open = defineModel<boolean>('open', { default: false })\ndefineSlots<TooltipSlots>()\n\nconst ns = useNamespace('tooltip')\nconst id = `dou-tooltip-${useId()}`\n\nconst {\n triggerRef,\n panelRef,\n reference,\n rendered,\n theme,\n placement,\n panelStyle,\n triggerListeners,\n panelListeners,\n update,\n} = usePopup({\n open,\n trigger: ['hover', 'focus'],\n // touch gets no tip, see below\n tap: false,\n disabled: () => props.disabled,\n placement: () => props.placement,\n // keep clear of the pointer itself when following it\n offset: () => props.offset + (props.followCursor ? 10 : 0),\n showDelay: () => props.showDelay,\n hideDelay: () => props.hideDelay,\n anchor: () => (props.followCursor && pointer.value ? cursor : undefined),\n})\n\n// with `followCursor`, the tooltip sits next to a point under the pointer\nconst pointer = ref<{ x: number; y: number } | null>(null)\nconst cursor: VirtualElement = {\n getBoundingClientRect: () => new DOMRect(pointer.value?.x ?? 0, pointer.value?.y ?? 0, 0, 0),\n}\nfunction onPointermove(event: PointerEvent) {\n if (!props.followCursor || !hasHover(event.pointerType)) return\n pointer.value = { x: event.clientX, y: event.clientY }\n update()\n}\n\n/*\n * Tooltips that hover or focus opened show one at a time. One opened\n * through `open` from outside (a guide, say) takes no part: it neither\n * closes the others nor is closed by them.\n */\nlet byTrigger = false\n// A tooltip whose trigger left the page without unmounting is just dropped.\nconst close = () => {\n if ((triggerRef.value?.$el as Node | undefined)?.isConnected !== false) open.value = false\n}\nwatch(open, (value) => {\n if (value && byTrigger) claimTooltip(close)\n else if (!value) {\n releaseTooltip(close)\n byTrigger = false\n }\n})\nonBeforeUnmount(() => releaseTooltip(close))\n\n/*\n * On the trigger of a popover or a menu, the tip gives way once the panel\n * opens: it would only sit over the panel. The trigger may also hold the\n * button that opens it (the arrow of a DouDropdownButton). It comes back\n * when the pointer comes in again, or with the next focus.\n */\n// Only a control that opens a popup counts: a tree item or a collapse\n// header inside the trigger is expanded too, and must not hide the tip.\nconst popupOpen = '[aria-haspopup]:not([aria-haspopup=\"false\"])[aria-expanded=\"true\"]'\nconst expanded = () => {\n const element = reference()\n return !!element && (element.matches(popupOpen) || !!element.querySelector(popupOpen))\n}\nlet watching: MutationObserver | undefined\nwatch(open, (value) => {\n watching?.disconnect()\n watching = undefined\n if (!value || !byTrigger) return\n if (expanded()) {\n open.value = false\n return\n }\n const element = reference()\n if (!element || typeof MutationObserver === 'undefined') return\n watching = new MutationObserver(() => {\n if (expanded()) open.value = false\n })\n watching.observe(element, {\n attributes: true,\n attributeFilter: ['aria-expanded'],\n subtree: true,\n })\n})\nonBeforeUnmount(() => watching?.disconnect())\n\n/*\n * An icon button named \"设置\" with the tip \"设置\" would be read twice:\n * once as its name, once as its description. The tip describes the\n * trigger only when it says something the name does not.\n */\nconst describes = ref(false)\nconst plain = (text: string | null | undefined) =>\n (text ?? '').replace(/\\s+/g, ' ').trim().toLowerCase()\nfunction nameOf(element: Element) {\n const label = element.getAttribute('aria-label')\n if (label?.trim()) return label\n const ids = element.getAttribute('aria-labelledby')?.split(/\\s+/).filter(Boolean)\n if (ids?.length) return ids.map((one) => document.getElementById(one)?.textContent).join(' ')\n return element.textContent\n}\nwatch(\n [open, () => props.content],\n ([value]) => {\n if (!value) return\n const element = reference()\n const panel = panelRef.value\n // the shortcut is announced through aria-keyshortcuts, so only the words count\n const text = panel && (panel.querySelector(`.${ns.e('text')}`) ?? panel).textContent\n describes.value = !element || plain(text) !== plain(nameOf(element))\n },\n { flush: 'post' },\n)\n/** Marks what follows (the open after the delay) as the trigger's own doing. */\nconst fromTrigger = (handler?: (event: Event) => void) =>\n handler &&\n ((event: Event) => {\n byTrigger = true\n handler(event)\n })\n\nconst interactive = computed(() => props.interactive && !props.followCursor)\n\nconst apple = useApplePlatform()\n\n// A tap also brings focus, and phones move it away only with the next tap\n// elsewhere, so the tip would stay up over the page. Touch gets no tip, the\n// same as a native title (hover already leaves touch out).\nlet touch = false\nconst notTouch = (handler?: (event: Event) => void) =>\n handler && ((event: Event) => touch || handler(event))\nconst leave = (handler?: (event: Event) => void) =>\n handler &&\n ((event: Event) => {\n // the finger lifting is not leaving: the focus from the tap is still to come\n if (hasHover((event as PointerEvent).pointerType ?? 'mouse')) touch = false\n handler(event)\n if (!open.value) byTrigger = false\n })\nfunction onPointerType(event: PointerEvent) {\n touch = !hasHover(event.pointerType)\n}\nconst enter = (handler?: (event: Event) => void) => (event: Event) => {\n onPointerType(event as PointerEvent)\n handler?.(event)\n}\n\n// Focus that comes with a press shows no tip: the pointer is already there\n// and hovering shows it. Opened at once under the pointer, it could take the\n// release, and the click that started it would be lost.\nlet pressing = false\nfunction onPointerdown(event: PointerEvent) {\n onPointerType(event)\n pressing = true\n setTimeout(() => (pressing = false))\n}\nconst focusin = (handler?: (event: Event) => void) =>\n handler && ((event: Event) => pressing || handler(event))\n\nconst triggerProps = computed(() => ({\n ...triggerListeners.value,\n onPointerenter: enter(fromTrigger(triggerListeners.value.onPointerenter)),\n onFocusin: notTouch(focusin(fromTrigger(triggerListeners.value.onFocusin))),\n onPointerleave: leave(triggerListeners.value.onPointerleave),\n onFocusout: leave(triggerListeners.value.onFocusout),\n onPointerdown,\n onPointermove,\n 'aria-describedby': open.value && describes.value ? id : undefined,\n ...(props.shortcut && { 'aria-keyshortcuts': ariaHotkey(props.shortcut, apple.value) }),\n}))\n</script>\n\n<template>\n <OnlyChild ref=\"triggerRef\" v-bind=\"triggerProps\"><slot /></OnlyChild>\n <Teleport v-if=\"rendered\" :to=\"teleportTarget.to\" :disabled=\"teleportTarget.disabled\">\n <Transition appear name=\"dou-floating\">\n <div\n v-show=\"open\"\n :id=\"id\"\n ref=\"panelRef\"\n role=\"tooltip\"\n :class=\"[ns.b(), 'dou-floating', ns.is('static', !interactive)]\"\n :style=\"panelStyle\"\n :data-placement=\"placement\"\n :data-dou-theme=\"theme\"\n v-bind=\"{ ...$attrs, ...(interactive ? panelListeners : {}) }\"\n >\n <span v-if=\"shortcut\" :class=\"ns.e('shortcut')\">\n <span :class=\"ns.e('text')\"\n ><slot name=\"content\">{{ content }}</slot></span\n >\n <DouKbd size=\"sm\" :keys=\"shortcut\" />\n </span>\n <slot v-else name=\"content\">{{ content }}</slot>\n </div>\n </Transition>\n </Teleport>\n</template>\n"],"mappings":";;;;;;;;;;;AA+FA,IAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAhFlB,MAAM,QAAQ;EAUd,MAAM,iBAAiB,kBAAkB,MAAM,QAAQ;EACvD,MAAM,OAAOC,SAAoB,SAAC,MAA0B;EAG5D,MAAM,KAAK,aAAa,SAAS;EACjC,MAAM,KAAK,eAAe,MAAM;EAEhC,MAAM,EACJ,YACA,UACA,WACA,UACA,OACA,WACA,YACA,kBACA,gBACA,WACE,SAAS;GACX;GACA,SAAS,CAAC,SAAS,OAAO;GAE1B,KAAK;GACL,gBAAgB,MAAM;GACtB,iBAAiB,MAAM;GAEvB,cAAc,MAAM,UAAU,MAAM,eAAe,KAAK;GACxD,iBAAiB,MAAM;GACvB,iBAAiB,MAAM;GACvB,cAAe,MAAM,gBAAgB,QAAQ,QAAQ,SAAS,KAAA;EAChE,CAAC;EAGD,MAAM,UAAU,IAAqC,IAAI;EACzD,MAAM,SAAyB,EAC7B,6BAA6B,IAAI,QAAQ,QAAQ,OAAO,KAAK,GAAG,QAAQ,OAAO,KAAK,GAAG,GAAG,CAAC,EAC7F;EACA,SAAS,cAAc,OAAqB;GAC1C,IAAI,CAAC,MAAM,gBAAgB,CAAC,SAAS,MAAM,WAAW,GAAG;GACzD,QAAQ,QAAQ;IAAE,GAAG,MAAM;IAAS,GAAG,MAAM;GAAQ;GACrD,OAAO;EACT;EAOA,IAAI,YAAY;EAEhB,MAAM,cAAc;GAClB,KAAK,WAAW,OAAO,IAAA,EAA0B,gBAAgB,OAAO,KAAK,QAAQ;EACvF;EACA,MAAM,OAAO,UAAU;GACrB,IAAI,SAAS,WAAW,aAAa,KAAK;QACrC,IAAI,CAAC,OAAO;IACf,eAAe,KAAK;IACpB,YAAY;GACd;EACF,CAAC;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AhB9B,CAAAC,OAAA,KAAA,KAAI,C"}
|
|
1
|
+
{"version":3,"file":"tooltip.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_useModel","_openBlock","_createElementBlock","_Fragment","_createVNode","_unref","_mergeProps","_withCtx","_renderSlot","_createBlock","_Teleport","_Transition","_withDirectives","_createElementVNode","_normalizeClass","_createTextVNode","_toDisplayString","_vShow","_createCommentVNode"],"sources":["../../../src/components/tooltip/tooltip.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, useId, watch } from 'vue'\nimport { ariaHotkey, useApplePlatform } from '../../composables/use-hotkey'\nimport type { VirtualElement } from '../../composables/use-floating'\nimport { usePopup } from '../../composables/use-popup'\nimport { useNamespace } from '../../utils/namespace'\nimport { OnlyChild } from '../../utils/only-child'\nimport { hasHover } from '../../utils/pointer'\nimport { DouKbd } from '../kbd'\nimport type { TooltipProps, TooltipSlots } from './tooltip'\nimport { claimTooltip, releaseTooltip } from './only-one'\nimport { useTeleport } from '../../utils/teleport'\n\ndefineOptions({ name: 'DouTooltip', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<TooltipProps>(), {\n placement: 'top',\n disabled: false,\n showDelay: 200,\n hideDelay: 100,\n offset: 6,\n followCursor: false,\n interactive: true,\n teleport: undefined,\n})\nconst teleportTarget = useTeleport(() => props.teleport)\nconst open = defineModel<boolean>('open', { default: false })\ndefineSlots<TooltipSlots>()\n\nconst ns = useNamespace('tooltip')\nconst id = `dou-tooltip-${useId()}`\n\nconst {\n triggerRef,\n panelRef,\n reference,\n rendered,\n theme,\n placement,\n panelStyle,\n triggerListeners,\n panelListeners,\n update,\n} = usePopup({\n open,\n trigger: ['hover', 'focus'],\n // touch gets no tip, see below\n tap: false,\n disabled: () => props.disabled,\n placement: () => props.placement,\n // keep clear of the pointer itself when following it\n offset: () => props.offset + (props.followCursor ? 10 : 0),\n showDelay: () => props.showDelay,\n hideDelay: () => props.hideDelay,\n anchor: () => (props.followCursor && pointer.value ? cursor : undefined),\n})\n\n// with `followCursor`, the tooltip sits next to a point under the pointer\nconst pointer = ref<{ x: number; y: number } | null>(null)\nconst cursor: VirtualElement = {\n getBoundingClientRect: () => new DOMRect(pointer.value?.x ?? 0, pointer.value?.y ?? 0, 0, 0),\n}\nfunction onPointermove(event: PointerEvent) {\n if (!props.followCursor || !hasHover(event.pointerType)) return\n pointer.value = { x: event.clientX, y: event.clientY }\n update()\n}\n\n/*\n * Tooltips that hover or focus opened show one at a time. One opened\n * through `open` from outside (a guide, say) takes no part: it neither\n * closes the others nor is closed by them.\n */\nlet byTrigger = false\n// A tooltip whose trigger left the page without unmounting is just dropped.\nconst close = () => {\n if ((triggerRef.value?.$el as Node | undefined)?.isConnected !== false) open.value = false\n}\nwatch(open, (value) => {\n if (value && byTrigger) claimTooltip(close)\n else if (!value) {\n releaseTooltip(close)\n byTrigger = false\n }\n})\nonBeforeUnmount(() => releaseTooltip(close))\n\n/*\n * On the trigger of a popover or a menu, the tip gives way once the panel\n * opens: it would only sit over the panel. The trigger may also hold the\n * button that opens it (the arrow of a DouDropdownButton). It comes back\n * when the pointer comes in again, or with the next focus.\n */\n// Only a control that opens a popup counts: a tree item or a collapse\n// header inside the trigger is expanded too, and must not hide the tip.\nconst popupOpen = '[aria-haspopup]:not([aria-haspopup=\"false\"])[aria-expanded=\"true\"]'\nconst expanded = () => {\n const element = reference()\n return !!element && (element.matches(popupOpen) || !!element.querySelector(popupOpen))\n}\nlet watching: MutationObserver | undefined\nwatch(open, (value) => {\n watching?.disconnect()\n watching = undefined\n if (!value || !byTrigger) return\n if (expanded()) {\n open.value = false\n return\n }\n const element = reference()\n if (!element || typeof MutationObserver === 'undefined') return\n watching = new MutationObserver(() => {\n if (expanded()) open.value = false\n })\n watching.observe(element, {\n attributes: true,\n attributeFilter: ['aria-expanded'],\n subtree: true,\n })\n})\nonBeforeUnmount(() => watching?.disconnect())\n\n/*\n * An icon button named \"设置\" with the tip \"设置\" would be read twice:\n * once as its name, once as its description. The tip describes the\n * trigger only when it says something the name does not, nor the value\n * a meter or slider reads out (`aria-valuetext`).\n */\nconst describes = ref(false)\nconst plain = (text: string | null | undefined) =>\n (text ?? '').replace(/\\s+/g, ' ').trim().toLowerCase()\nfunction nameOf(element: Element) {\n const label = element.getAttribute('aria-label')\n if (label?.trim()) return label\n const ids = element.getAttribute('aria-labelledby')?.split(/\\s+/).filter(Boolean)\n if (ids?.length) return ids.map((one) => document.getElementById(one)?.textContent).join(' ')\n return element.textContent\n}\nwatch(\n [open, () => props.content],\n ([value]) => {\n if (!value) return\n const element = reference()\n const panel = panelRef.value\n // the shortcut is announced through aria-keyshortcuts, so only the words count\n const text = panel && (panel.querySelector(`.${ns.e('text')}`) ?? panel).textContent\n describes.value =\n !element ||\n (plain(text) !== plain(nameOf(element)) &&\n plain(text) !== plain(element.getAttribute('aria-valuetext')))\n },\n { flush: 'post' },\n)\n/** Marks what follows (the open after the delay) as the trigger's own doing. */\nconst fromTrigger = (handler?: (event: Event) => void) =>\n handler &&\n ((event: Event) => {\n byTrigger = true\n handler(event)\n })\n\nconst interactive = computed(() => props.interactive && !props.followCursor)\n\nconst apple = useApplePlatform()\n\n// A tap also brings focus, and phones move it away only with the next tap\n// elsewhere, so the tip would stay up over the page. Touch gets no tip, the\n// same as a native title (hover already leaves touch out).\nlet touch = false\nconst notTouch = (handler?: (event: Event) => void) =>\n handler && ((event: Event) => touch || handler(event))\nconst leave = (handler?: (event: Event) => void) =>\n handler &&\n ((event: Event) => {\n // the finger lifting is not leaving: the focus from the tap is still to come\n if (hasHover((event as PointerEvent).pointerType ?? 'mouse')) touch = false\n handler(event)\n if (!open.value) byTrigger = false\n })\nfunction onPointerType(event: PointerEvent) {\n touch = !hasHover(event.pointerType)\n}\nconst enter = (handler?: (event: Event) => void) => (event: Event) => {\n onPointerType(event as PointerEvent)\n handler?.(event)\n}\n\n// Focus that comes with a press shows no tip: the pointer is already there\n// and hovering shows it. Opened at once under the pointer, it could take the\n// release, and the click that started it would be lost.\nlet pressing = false\nfunction onPointerdown(event: PointerEvent) {\n onPointerType(event)\n pressing = true\n setTimeout(() => (pressing = false))\n}\nconst focusin = (handler?: (event: Event) => void) =>\n handler && ((event: Event) => pressing || handler(event))\n\nconst triggerProps = computed(() => ({\n ...triggerListeners.value,\n onPointerenter: enter(fromTrigger(triggerListeners.value.onPointerenter)),\n onFocusin: notTouch(focusin(fromTrigger(triggerListeners.value.onFocusin))),\n onPointerleave: leave(triggerListeners.value.onPointerleave),\n onFocusout: leave(triggerListeners.value.onFocusout),\n onPointerdown,\n onPointermove,\n 'aria-describedby': open.value && describes.value ? id : undefined,\n ...(props.shortcut && { 'aria-keyshortcuts': ariaHotkey(props.shortcut, apple.value) }),\n}))\n</script>\n\n<template>\n <OnlyChild ref=\"triggerRef\" v-bind=\"triggerProps\"><slot /></OnlyChild>\n <Teleport v-if=\"rendered\" :to=\"teleportTarget.to\" :disabled=\"teleportTarget.disabled\">\n <Transition appear name=\"dou-floating\">\n <div\n v-show=\"open\"\n :id=\"id\"\n ref=\"panelRef\"\n role=\"tooltip\"\n :class=\"[ns.b(), 'dou-floating', ns.is('static', !interactive)]\"\n :style=\"panelStyle\"\n :data-placement=\"placement\"\n :data-dou-theme=\"theme\"\n v-bind=\"{ ...$attrs, ...(interactive ? panelListeners : {}) }\"\n >\n <span v-if=\"shortcut\" :class=\"ns.e('shortcut')\">\n <span :class=\"ns.e('text')\"\n ><slot name=\"content\">{{ content }}</slot></span\n >\n <DouKbd size=\"sm\" :keys=\"shortcut\" />\n </span>\n <slot v-else name=\"content\">{{ content }}</slot>\n </div>\n </Transition>\n </Teleport>\n</template>\n"],"mappings":";;;;;;;;;;;AA+FA,IAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAhFlB,MAAM,QAAQ;EAUd,MAAM,iBAAiB,kBAAkB,MAAM,QAAQ;EACvD,MAAM,OAAOC,SAAoB,SAAC,MAA0B;EAG5D,MAAM,KAAK,aAAa,SAAS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AAA,CAAc,CAAC;G,IAC1ED,YAoBaO,YAAA;IApBD,QAAA;IAAO,MAAK;IAAxB,WAAA;;IACE,SAAAJ,cAkBM,CAlBNK,eAAAC,mBAkBM,OAlBNP,WAkBM;KAhBC;KACD,SAAA;KAAJ,KAAI;KACJ,MAAK;KACJ,OAAK;MAAGD,MAAA,EAAA,CAAE,CAAC,EAAC;MAAA;MAAoBA,MAAA,EAAA,CAAE,CAAC,GAAE,UAAA,CAAY,YAAA,KAAW;KAAA;KAC5D,OAAOA,MAAA,UAAA;KACP,kBAAgBA,MAAA,SAAA;KAChB,kBAAgBA,MAAA,KAAA;IACJN,GAAAA;KAAAA,GAAAA,KAAAA;KAAM,GAAM,YAAA,QAAcM,MAAA,cAAA,IAAc,CAAA;IAAA,CAAA,GAAA,CAEzC,QAAA,YAAZJ,UAAA,GAAAC,mBAKO,QAAA;;KALgB,OAAKY,eAAET,MAAA,EAAA,CAAE,CAAC,EAAC,UAAA,CAAA;I,IAChCQ,mBAEC,QAAA,EAFM,OAAKC,eAAET,MAAA,EAAA,CAAE,CAAC,EAAC,MAAA,CAAA,E,IACfG,WAAyC,KAAA,QAAA,WAAA,CAAA,SAAA,CAAjBO,gBAAAC,gBAAA,QAAA,OAAO,GAAA,CAAA,C,SAElCZ,YAAqCC,MAAA,MAAA,GAAA;KAA7B,MAAK;KAAM,MAAM,QAAA;I,8BAE3BG,WAAgD,KAAA,QAAA,WAAA,CAAA,SAAA,CAAjBO,gBAAAC,gBAAA,QAAA,OAAO,GAAA,CAAA,C,kCAhB9B,CAAAC,OAAA,KAAA,KAAI,C"}
|
package/dist/index.js
CHANGED
|
@@ -50,8 +50,7 @@ import { formatFileSize, matchesAccept } from "./components/upload/upload.js";
|
|
|
50
50
|
import { DouChatAttachments } from "./components/chat-attachments/index.js";
|
|
51
51
|
import { DouChatBubble } from "./components/chat-bubble/index.js";
|
|
52
52
|
import { DouChatConfirm } from "./components/chat-confirm/index.js";
|
|
53
|
-
import {
|
|
54
|
-
import { DouTooltip } from "./components/tooltip/index.js";
|
|
53
|
+
import { compactNumber, contextUsage } from "./components/chat-context-meter/chat-context-meter.js";
|
|
55
54
|
import { DouChatContextMeter } from "./components/chat-context-meter/index.js";
|
|
56
55
|
import { DouChatInput } from "./components/chat-input/index.js";
|
|
57
56
|
import { createOffsets } from "./components/virtual-list/virtual-list.js";
|
|
@@ -69,6 +68,8 @@ import { DouChatCitation, DouChatSources } from "./components/chat-sources/index
|
|
|
69
68
|
import { DouChatSteps } from "./components/chat-steps/index.js";
|
|
70
69
|
import { DouChatToolCall } from "./components/chat-tool-call/index.js";
|
|
71
70
|
import { useClipboard } from "./composables/use-clipboard.js";
|
|
71
|
+
import { DouKbd } from "./components/kbd/index.js";
|
|
72
|
+
import { DouTooltip } from "./components/tooltip/index.js";
|
|
72
73
|
import { DouCopyButton } from "./components/copy-button/index.js";
|
|
73
74
|
import { createMarkdownParser, parseMarkdown } from "./components/markdown/parser.js";
|
|
74
75
|
import { DouCodeBlock } from "./components/code-block/index.js";
|
|
@@ -184,6 +185,6 @@ import { CANVAS_MAX_SIDE, canvasMaxArea, fitPixelRatio, svgToPNG } from "./utils
|
|
|
184
185
|
import { breakpoints, collaborationColors } from "@dou-ui/theme";
|
|
185
186
|
// src/index.ts
|
|
186
187
|
var src_default = DouUI;
|
|
187
|
-
export { CANVAS_MAX_SIDE, DouAffix, DouAlert, DouAnchor, DouAutocomplete, DouAvatar, DouAvatarGroup, DouBackTop, DouBadge, DouBanner, DouBreadcrumb, DouButton, DouCalendar, DouCalendarHeatmap, DouCalendarView, DouCard, DouCarousel, DouCarouselItem, DouCascader, DouChatArtifact, DouChatAttachments, DouChatBubble, DouChatCitation, DouChatConfirm, DouChatContextMeter, DouChatInput, DouChatList, DouChatMessage, DouChatPlan, DouChatQuestion, DouChatReasoning, DouChatSources, DouChatSteps, DouChatSuggestions, DouChatToolCall, DouCheckTag, DouCheckTagGroup, DouCheckbox, DouCheckboxGroup, DouCodeBlock, DouCollapse, DouCollapseItem, DouCollapseTransition, DouColorModeButton, DouColorModeSelect, DouColorModeSwitch, DouColorPanel, DouColorPicker, DouCommand, DouCommandDialog, DouCommentThread, DouConfigProvider, DouContextMenu, DouCopyButton, DouCountdown, DouDatePicker, DouDescriptions, DouDescriptionsItem, DouDialog, DouDivider, DouDrawer, DouDropdown, DouDropdownButton, DouDropdownGroup, DouDropdownItem, DouDropdownRadioGroup, DouDropdownSub, DouEditable, DouEllipsis, DouEmpty, DouFieldGroup, DouFieldGroupText, DouFindReplace, DouForm, DouFormItem, DouGrid, DouGridItem, DouHighlight, DouIcon, DouImage, DouImageCropper, DouImagePreview, DouInfiniteScroll, DouInput, DouInputDate, DouInputNumber, DouInputOtp, DouInputTag, DouInputTime, DouKbd, DouLayout, DouLayoutAside, DouLayoutAsideTrigger, DouLayoutFooter, DouLayoutHeader, DouLayoutMain, DouLink, DouListbox, DouLoading, DouMarkdown, DouMarquee, DouMasonry, DouMenu, DouMenubar, DouMenubarMenu, DouNodeGraph, DouNodeGraphLegend, DouPageHeader, DouPagination, DouPopconfirm, DouPopover, DouProgress, DouProgressGroup, DouQrcode, DouRadio, DouRadioGroup, DouRate, DouRelativeTime, DouResult, DouScrollbar, DouSegmentedControl, DouSelect, DouShimmer, DouSkeleton, DouSlider, DouSortable, DouSortableHandle, DouSpace, DouSparkline, DouSpinner, DouSplitter, DouStatistic, DouStatusDot, DouSteps, DouStreamText, DouSwitch, DouTabPanel, DouTable, DouTabs, DouTag, DouText, DouTextarea, DouTimePicker, DouTimeline, DouTimelineItem, DouToastViewport, DouToggle, DouToggleGroup, DouToolbar, DouToolbarSeparator, DouTooltip, DouTour, DouTransfer, DouTree, DouTreeSelect, DouUI, DouUpload, DouUser, DouVirtualList, DouWatermark, applyCommentAction, applySharedCommentAction, ariaHotkey, breakpointWidth, breakpoints, canvasMaxArea, checkboxGroupKey, collaborationColors, colorModeScript, computePosition, configProviderKey, createCommentId, createMarkdownParser, createOffsets, createScrollLink, src_default as default, defaultSanitizeUrl, dialog, downloadBlob, dropdownHostKey, dropdownKey, en, encodeQr, expandRepeats, fieldGroupKey, fitPixelRatio, formItemKey, formKey, formatDateValue, formatDuration, formatFileSize, formatHotkey, fuzzyMatch, getMotionDuration, getTabbable, holdPointer, installedAppContext, isApplePlatform, isComposing, isStandardSchema, isTopLayer, layoutGraph, layoutKey, matchCommand, matchesAccept, matchesHotkey, occurrenceOf, paginationRange, parseHotkey, parseMarkdown, placeItems, provideGlobalConfig, radioGroupKey, readSharedComments, scrollPositionOf, setInstalledAppContext, setMotionMode, showFormErrors, splitHighlight, svgToPNG, toast, treeRowHeights, useApplePlatform, useBreakpoints, useClipboard, useColorMode, useCountdown, useDialog, useElementSize, useFloating, useFocusTrap, useFormDisabled, useFormItem, useFormReadonly, useFormSize, useGlobalConfig, useHotkey, useIntersection, useLayer, useLocale, useMotionMode, useNamespace, useNow, useReducedMotion, useResizeObserver, useRovingFocus, useScrollLock, useSortable, useTeleport, useTouchScroll, useZIndex, vInfiniteScroll, vLoading, visibleRange, withInstall, zhCN, zhTW };
|
|
188
|
+
export { CANVAS_MAX_SIDE, DouAffix, DouAlert, DouAnchor, DouAutocomplete, DouAvatar, DouAvatarGroup, DouBackTop, DouBadge, DouBanner, DouBreadcrumb, DouButton, DouCalendar, DouCalendarHeatmap, DouCalendarView, DouCard, DouCarousel, DouCarouselItem, DouCascader, DouChatArtifact, DouChatAttachments, DouChatBubble, DouChatCitation, DouChatConfirm, DouChatContextMeter, DouChatInput, DouChatList, DouChatMessage, DouChatPlan, DouChatQuestion, DouChatReasoning, DouChatSources, DouChatSteps, DouChatSuggestions, DouChatToolCall, DouCheckTag, DouCheckTagGroup, DouCheckbox, DouCheckboxGroup, DouCodeBlock, DouCollapse, DouCollapseItem, DouCollapseTransition, DouColorModeButton, DouColorModeSelect, DouColorModeSwitch, DouColorPanel, DouColorPicker, DouCommand, DouCommandDialog, DouCommentThread, DouConfigProvider, DouContextMenu, DouCopyButton, DouCountdown, DouDatePicker, DouDescriptions, DouDescriptionsItem, DouDialog, DouDivider, DouDrawer, DouDropdown, DouDropdownButton, DouDropdownGroup, DouDropdownItem, DouDropdownRadioGroup, DouDropdownSub, DouEditable, DouEllipsis, DouEmpty, DouFieldGroup, DouFieldGroupText, DouFindReplace, DouForm, DouFormItem, DouGrid, DouGridItem, DouHighlight, DouIcon, DouImage, DouImageCropper, DouImagePreview, DouInfiniteScroll, DouInput, DouInputDate, DouInputNumber, DouInputOtp, DouInputTag, DouInputTime, DouKbd, DouLayout, DouLayoutAside, DouLayoutAsideTrigger, DouLayoutFooter, DouLayoutHeader, DouLayoutMain, DouLink, DouListbox, DouLoading, DouMarkdown, DouMarquee, DouMasonry, DouMenu, DouMenubar, DouMenubarMenu, DouNodeGraph, DouNodeGraphLegend, DouPageHeader, DouPagination, DouPopconfirm, DouPopover, DouProgress, DouProgressGroup, DouQrcode, DouRadio, DouRadioGroup, DouRate, DouRelativeTime, DouResult, DouScrollbar, DouSegmentedControl, DouSelect, DouShimmer, DouSkeleton, DouSlider, DouSortable, DouSortableHandle, DouSpace, DouSparkline, DouSpinner, DouSplitter, DouStatistic, DouStatusDot, DouSteps, DouStreamText, DouSwitch, DouTabPanel, DouTable, DouTabs, DouTag, DouText, DouTextarea, DouTimePicker, DouTimeline, DouTimelineItem, DouToastViewport, DouToggle, DouToggleGroup, DouToolbar, DouToolbarSeparator, DouTooltip, DouTour, DouTransfer, DouTree, DouTreeSelect, DouUI, DouUpload, DouUser, DouVirtualList, DouWatermark, applyCommentAction, applySharedCommentAction, ariaHotkey, breakpointWidth, breakpoints, canvasMaxArea, checkboxGroupKey, collaborationColors, colorModeScript, compactNumber, computePosition, configProviderKey, contextUsage, createCommentId, createMarkdownParser, createOffsets, createScrollLink, src_default as default, defaultSanitizeUrl, dialog, downloadBlob, dropdownHostKey, dropdownKey, en, encodeQr, expandRepeats, fieldGroupKey, fitPixelRatio, formItemKey, formKey, formatDateValue, formatDuration, formatFileSize, formatHotkey, fuzzyMatch, getMotionDuration, getTabbable, holdPointer, installedAppContext, isApplePlatform, isComposing, isStandardSchema, isTopLayer, layoutGraph, layoutKey, matchCommand, matchesAccept, matchesHotkey, occurrenceOf, paginationRange, parseHotkey, parseMarkdown, placeItems, provideGlobalConfig, radioGroupKey, readSharedComments, scrollPositionOf, setInstalledAppContext, setMotionMode, showFormErrors, splitHighlight, svgToPNG, toast, treeRowHeights, useApplePlatform, useBreakpoints, useClipboard, useColorMode, useCountdown, useDialog, useElementSize, useFloating, useFocusTrap, useFormDisabled, useFormItem, useFormReadonly, useFormSize, useGlobalConfig, useHotkey, useIntersection, useLayer, useLocale, useMotionMode, useNamespace, useNow, useReducedMotion, useResizeObserver, useRovingFocus, useScrollLock, useSortable, useTeleport, useTouchScroll, useZIndex, vInfiniteScroll, vLoading, visibleRange, withInstall, zhCN, zhTW };
|
|
188
189
|
|
|
189
190
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { DouUI } from './plugin'\n\nexport * from './components'\nexport * from './locale'\nexport {\n computePosition,\n getTabbable,\n isTopLayer,\n useFloating,\n useFocusTrap,\n useLayer,\n useScrollLock,\n} from './composables'\nexport type {\n Layer,\n Placement,\n Position,\n PositionOptions,\n Side,\n UseFloatingOptions,\n UseFocusTrapOptions,\n UseLayerOptions,\n VirtualElement,\n} from './composables'\nexport { useElementSize, useIntersection, useResizeObserver } from './composables/use-element-size'\nexport type {\n UseElementSizeOptions,\n UseIntersectionOptions,\n UseResizeObserverOptions,\n} from './composables/use-element-size'\nexport {\n getMotionDuration,\n setMotionMode,\n useMotionMode,\n useReducedMotion,\n} from './composables/use-motion'\nexport type { MotionDuration, MotionMode } from './composables/use-motion'\nexport {\n ariaHotkey,\n formatHotkey,\n isApplePlatform,\n matchesHotkey,\n parseHotkey,\n useApplePlatform,\n useHotkey,\n} from './composables/use-hotkey'\nexport type { UseHotkeyOptions } from './composables/use-hotkey'\nexport { breakpointWidth, useBreakpoints } from './composables/use-breakpoints'\nexport type { UseBreakpointsReturn } from './composables/use-breakpoints'\nexport { useClipboard } from './composables/use-clipboard'\nexport type { UseClipboardOptions, UseClipboardReturn } from './composables/use-clipboard'\nexport { useRovingFocus } from './composables/use-roving-focus'\nexport type { RovingOrientation, UseRovingFocusOptions } from './composables/use-roving-focus'\nexport { useNow } from './composables/use-now'\nexport type { UseNowOptions } from './composables/use-now'\nexport { breakpoints, collaborationColors } from '@dou-ui/theme'\nexport type { Breakpoint } from '@dou-ui/theme'\nexport { useNamespace, withInstall } from './utils'\nexport { isComposing } from './utils/keyboard'\nexport { holdPointer } from './utils/pointer'\nexport { createScrollLink, scrollPositionOf } from './utils/scroll'\nexport { installedAppContext, setInstalledAppContext } from './utils/app-context'\nexport type { ScrollLink, ScrollLinkAxis } from './utils/scroll'\nexport { useTouchScroll } from './composables/use-touch-scroll'\nexport type { UseTouchScrollReturn } from './composables/use-touch-scroll'\nexport type { PointerHold } from './utils/pointer'\nexport { useTeleport } from './utils/teleport'\nexport type { TeleportTarget } from './utils/teleport'\nexport { CANVAS_MAX_SIDE, canvasMaxArea, fitPixelRatio, svgToPNG } from './utils/png'\nexport { downloadBlob } from './utils/download'\nexport type { PNGExportSource, SvgToPNGOptions } from './utils/png'\nexport type { ForwardedAttributes, Size, Tone, WithAttributes, WithInstall } from './utils'\nexport type { DataAttributes } from './attributes'\nexport { DouUI }\nexport default DouUI\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { DouUI } from './plugin'\n\nexport * from './components'\nexport * from './locale'\nexport {\n computePosition,\n getTabbable,\n isTopLayer,\n useFloating,\n useFocusTrap,\n useLayer,\n useScrollLock,\n} from './composables'\nexport type {\n Layer,\n Placement,\n Position,\n PositionOptions,\n Side,\n UseFloatingOptions,\n UseFocusTrapOptions,\n UseLayerOptions,\n VirtualElement,\n} from './composables'\nexport { useElementSize, useIntersection, useResizeObserver } from './composables/use-element-size'\nexport type {\n UseElementSizeOptions,\n UseIntersectionOptions,\n UseResizeObserverOptions,\n} from './composables/use-element-size'\nexport {\n getMotionDuration,\n setMotionMode,\n useMotionMode,\n useReducedMotion,\n} from './composables/use-motion'\nexport type { MotionDuration, MotionMode } from './composables/use-motion'\nexport {\n ariaHotkey,\n formatHotkey,\n isApplePlatform,\n matchesHotkey,\n parseHotkey,\n useApplePlatform,\n useHotkey,\n} from './composables/use-hotkey'\nexport type { UseHotkeyOptions } from './composables/use-hotkey'\nexport { breakpointWidth, useBreakpoints } from './composables/use-breakpoints'\nexport type { UseBreakpointsReturn } from './composables/use-breakpoints'\nexport { useClipboard } from './composables/use-clipboard'\nexport type { UseClipboardOptions, UseClipboardReturn } from './composables/use-clipboard'\nexport { useRovingFocus } from './composables/use-roving-focus'\nexport type { RovingOrientation, UseRovingFocusOptions } from './composables/use-roving-focus'\nexport { useNow } from './composables/use-now'\nexport type { UseNowOptions } from './composables/use-now'\nexport { breakpoints, collaborationColors } from '@dou-ui/theme'\nexport type { Breakpoint } from '@dou-ui/theme'\nexport { useNamespace, withInstall } from './utils'\nexport { isComposing } from './utils/keyboard'\nexport { holdPointer } from './utils/pointer'\nexport { createScrollLink, scrollPositionOf } from './utils/scroll'\nexport { installedAppContext, setInstalledAppContext } from './utils/app-context'\nexport type { ScrollLink, ScrollLinkAxis } from './utils/scroll'\nexport { useTouchScroll } from './composables/use-touch-scroll'\nexport type { UseTouchScrollReturn } from './composables/use-touch-scroll'\nexport type { PointerHold } from './utils/pointer'\nexport { useTeleport } from './utils/teleport'\nexport type { TeleportTarget } from './utils/teleport'\nexport { CANVAS_MAX_SIDE, canvasMaxArea, fitPixelRatio, svgToPNG } from './utils/png'\nexport { downloadBlob } from './utils/download'\nexport type { PNGExportSource, SvgToPNGOptions } from './utils/png'\nexport type { ForwardedAttributes, Size, Tone, WithAttributes, WithInstall } from './utils'\nexport type { DataAttributes } from './attributes'\nexport { DouUI }\nexport default DouUI\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EA,IAAA,cAAe"}
|
package/dist/plugin.js
CHANGED
|
@@ -30,8 +30,6 @@ import { DouChatArtifact } from "./components/chat-artifact/index.js";
|
|
|
30
30
|
import { DouChatAttachments } from "./components/chat-attachments/index.js";
|
|
31
31
|
import { DouChatBubble } from "./components/chat-bubble/index.js";
|
|
32
32
|
import { DouChatConfirm } from "./components/chat-confirm/index.js";
|
|
33
|
-
import { DouKbd } from "./components/kbd/index.js";
|
|
34
|
-
import { DouTooltip } from "./components/tooltip/index.js";
|
|
35
33
|
import { DouChatContextMeter } from "./components/chat-context-meter/index.js";
|
|
36
34
|
import { DouChatInput } from "./components/chat-input/index.js";
|
|
37
35
|
import { DouVirtualList } from "./components/virtual-list/index.js";
|
|
@@ -45,6 +43,8 @@ import { DouPopover } from "./components/popover/index.js";
|
|
|
45
43
|
import { DouChatCitation, DouChatSources } from "./components/chat-sources/index.js";
|
|
46
44
|
import { DouChatSteps } from "./components/chat-steps/index.js";
|
|
47
45
|
import { DouChatToolCall } from "./components/chat-tool-call/index.js";
|
|
46
|
+
import { DouKbd } from "./components/kbd/index.js";
|
|
47
|
+
import { DouTooltip } from "./components/tooltip/index.js";
|
|
48
48
|
import { DouCopyButton } from "./components/copy-button/index.js";
|
|
49
49
|
import { DouCodeBlock } from "./components/code-block/index.js";
|
|
50
50
|
import { DouMarkdown } from "./components/markdown/index.js";
|