@8wave/ai-elements 0.126.0-beta.11 → 0.126.0-beta.13
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/_chunks/{PkChart-DWb-SQth.js → PkChart-BiFofCDF.js} +7 -3
- package/dist/_chunks/{PkChart-DWb-SQth.js.map → PkChart-BiFofCDF.js.map} +1 -1
- package/dist/_chunks/{PkFilePreview-Qa0gqSB7.js → PkFilePreview-CW04wd9z.js} +2 -2
- package/dist/_chunks/{PkFilePreview-Qa0gqSB7.js.map → PkFilePreview-CW04wd9z.js.map} +1 -1
- package/dist/_chunks/{PkFilePreviewDialog-BAiyiAhZ.js → PkFilePreviewDialog-0vC6vbNa.js} +2 -2
- package/dist/_chunks/{PkFilePreviewDialog-BAiyiAhZ.js.map → PkFilePreviewDialog-0vC6vbNa.js.map} +1 -1
- package/dist/_chunks/{PkToolShowChart-CuLW9Kcy.js → PkToolShowChart-lLXuHRJu.js} +2 -2
- package/dist/_chunks/{PkToolShowChart-CuLW9Kcy.js.map → PkToolShowChart-lLXuHRJu.js.map} +1 -1
- package/dist/ai-elements.es.js +2 -2
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/_chunks/{PkChart-DiMQHC6K.js → PkChart-CmrpyYAS.js} +7 -3
- package/dist-vue/_chunks/{PkChart-DiMQHC6K.js.map → PkChart-CmrpyYAS.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbot-DcL0-0oj.js → PkChatbot-BNcXCHJv.js} +2 -2
- package/dist-vue/_chunks/{PkChatbot-DcL0-0oj.js.map → PkChatbot-BNcXCHJv.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotMessages-B4WVWbxH.js → PkChatbotMessages-DV0hYZgp.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotMessages-B4WVWbxH.js.map → PkChatbotMessages-DV0hYZgp.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-BrBSEwg6.js → PkChatbotViewChat-8itM8FhY.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewChat-BrBSEwg6.js.map → PkChatbotViewChat-8itM8FhY.js.map} +1 -1
- package/dist-vue/_chunks/{PkFilePreview-Bcvo21_8.js → PkFilePreview-DLrXC8uc.js} +3 -3
- package/dist-vue/_chunks/{PkFilePreview-Bcvo21_8.js.map → PkFilePreview-DLrXC8uc.js.map} +1 -1
- package/dist-vue/_chunks/{PkFilePreviewDialog-C7bLPoeL.js → PkFilePreviewDialog-xcglY0iR.js} +2 -2
- package/dist-vue/_chunks/{PkFilePreviewDialog-C7bLPoeL.js.map → PkFilePreviewDialog-xcglY0iR.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowChart-p5CZEPWQ.js → PkToolShowChart-B8xJi1yY.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowChart-p5CZEPWQ.js.map → PkToolShowChart-B8xJi1yY.js.map} +1 -1
- package/dist-vue/index.js +5 -5
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { m as e } from "./index.es-BYhSukum.js";
|
|
2
2
|
import { J as t, N as n, S as r, _ as i, k as a, tt as o, w as s, z as c } from "./vue.runtime.esm-bundler-DZgpK-ja.js";
|
|
3
|
-
import { t as l } from "./PkFilePreview-
|
|
3
|
+
import { t as l } from "./PkFilePreview-CW04wd9z.js";
|
|
4
4
|
import { t as u } from "./_plugin-vue_export-helper-Djzt4Yr7.js";
|
|
5
5
|
// ../../packages/components/src/chat/PkFilePreviewDialog.vue?vue&type=script&setup=true&lang.ts
|
|
6
6
|
a();
|
|
@@ -115,4 +115,4 @@ var d = /*#__PURE__*/ u(/* @__PURE__ */ s({
|
|
|
115
115
|
}), [["styles", [".pk-file-preview-dialog:not(.vv-dialog--fullscreen)>article{width:min(90rem,94dvw);height:92dvh}.pk-file-preview-dialog.vv-dialog--fullscreen>article{max-height:none}.pk-file-preview-dialog .vv-dialog__content{flex-direction:column;flex:1;min-height:0;padding:0;display:flex}"]]]);
|
|
116
116
|
export { d as default };
|
|
117
117
|
|
|
118
|
-
//# sourceMappingURL=PkFilePreviewDialog-
|
|
118
|
+
//# sourceMappingURL=PkFilePreviewDialog-0vC6vbNa.js.map
|
package/dist/_chunks/{PkFilePreviewDialog-BAiyiAhZ.js.map → PkFilePreviewDialog-0vC6vbNa.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PkFilePreviewDialog-
|
|
1
|
+
{"version":3,"file":"PkFilePreviewDialog-0vC6vbNa.js","names":["_useModel","_openBlock","_createBlock","_withCtx","_createVNode","PkFilePreview","uu","useModel","mergeModels","createVNode","createBlock","init_runtime_core_esm_bundler","withCtx","defineComponent","openBlock","PkFilePreview_default","_plugin_vue_export_helper_default","PkFilePreviewDialog_default","\"mode\"","\"modeModifiers\"","\"sheet\"","\"sheetModifiers\"","\"zoom\"","\"zoomModifiers\"","\"fit\"","\"fitModifiers\"","__emit","emit","mode","__props","sheet","zoom","fit","_component_VvDialog","_cache","$event","text","pointer","action"],"sources":["../../../../packages/components/src/chat/PkFilePreviewDialog.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import type {\n ChatFilePreview,\n FilePointer,\n SelectionGroupCapability,\n } from 'models'\n import PkFilePreview from './PkFilePreview.vue'\n import type { ChatFilePreviewChanges } from './previewChanges'\n import type { ChatFilePreviewTarget, WordPreviewMode } from './utils'\n\n /**\n * The viewer of a file stored in a chat in a dialog over the page: the\n * chat's when it has no room for the panel beside it or the reader\n * expands it, the chat log's always. Open while it is mounted: `close`\n * asks the host to drop it. The viewer draws its own head, with the file\n * and the close button, so the dialog has no title and takes its name.\n */\n defineProps<{\n target: ChatFilePreviewTarget\n /** The authenticated download URL of the same version. */\n downloadUrl: string\n preview?: ChatFilePreview\n /** What the version changed from the one shown before, for a moment. */\n changes?: ChatFilePreviewChanges\n loading?: boolean\n error?: boolean\n /** Covers the screen, for a phone. */\n fullscreen?: boolean\n /** The versions of the file in the conversation, from 1. */\n versions?: number[]\n /** The shown version can be written again as the newest one. */\n restorable?: boolean\n /** Offers to go back to the panel beside the chat. */\n resize?: 'shrink'\n /** The selection bar's actions for this format: absent in the chat logs. */\n selectionActions?: SelectionGroupCapability\n /** The agent answers in the chat the dialog covers. */\n working?: boolean\n }>()\n\n const emit = defineEmits<{\n close: []\n version: [version: number]\n restore: []\n resize: []\n showChat: []\n selectionSend: [\n text: string,\n pointer: FilePointer,\n action: { id: string; size: number },\n ]\n }>()\n\n // How the file is shown, kept by the host across panel and dialog\n const mode = defineModel<WordPreviewMode>('mode')\n const sheet = defineModel<number>('sheet')\n const zoom = defineModel<number>('zoom')\n // A boolean prop left out is false, not the viewer's default: the chat\n // logs keep no zoom, and their pages opened at 100% instead of fitted\n const fit = defineModel<boolean>('fit', { default: true })\n</script>\n\n<template>\n <VvDialog\n :model-value=\"true\"\n :aria-label=\"target.filename\"\n :modifiers=\"fullscreen ? 'fullscreen' : undefined\"\n class=\"pk-file-preview-dialog\"\n @update:model-value=\"!$event && emit('close')\">\n <PkFilePreview\n v-model:mode=\"mode\"\n v-model:sheet=\"sheet\"\n v-model:zoom=\"zoom\"\n v-model:fit=\"fit\"\n :kind=\"target.kind\"\n :filename=\"target.filename\"\n :version=\"target.version\"\n :versions\n :download-url\n :preview\n :changes\n :loading\n :error\n :restorable\n :resize\n :file-id=\"target.fileId\"\n :stored-file-name=\"target.storedFileName\"\n :selection-actions\n :working\n @version=\"emit('version', $event)\"\n @restore=\"emit('restore')\"\n @resize=\"emit('resize')\"\n @show-chat=\"emit('showChat')\"\n @selection-send=\"\n (text, pointer, action) =>\n emit('selectionSend', text, pointer, action)\n \"\n @close=\"emit('close')\" />\n </VvDialog>\n</template>\n\n<style lang=\"scss\">\n // Almost the whole window, room for a page of Word and a grid of Excel;\n // the viewer scrolls in its own box, so the content does not pad it.\n .pk-file-preview-dialog {\n &:not(.vv-dialog--fullscreen) > article {\n width: min(90rem, 94dvw);\n height: 92dvh;\n }\n\n // The library writes `max-height: auto`, which is no value: the\n // wrapper kept its 90dvh and the phone saw the chat around it\n &.vv-dialog--fullscreen > article {\n max-height: none;\n }\n\n .vv-dialog__content {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-height: 0;\n padding: 0;\n }\n }\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwCI,IAAM2B,IAAOD,GAcPE,IAAO5B,EAA4B6B,GAAC,MAAM,GAC1CC,IAAQ9B,EAAmB6B,GAAC,OAAO,GACnCE,IAAO/B,EAAmB6B,GAAC,MAAM,GAGjCG,IAAMhC,EAAoB6B,GAAC,KAAwB;;;GAIzD,OAAA5B,EAAA,GAAAC,EAmCW+B,GAAA;IAlCN,eAAa;IACb,cAAYJ,EAAA,OAAO;IACnB,WAAWA,EAAA,aAAU,eAAkB,KAAA;IACxC,OAAM;IACL,uBAAkB,AAAAK,EAAA,SAAA,MAAA,CAAGC,KAAUR,EAAI,OAAA;;IACpC,SAAAxB,QA4B6B,CA5B7BC,EA4B6BC,GAAA;KA3BjB,MAAMuB,EAAA;KAAA,iBAAA,AAAAM,EAAA,QAAA,MAAA,EAAI,QAAAC;KACV,OAAOL,EAAA;KAAA,kBAAA,AAAAI,EAAA,QAAA,MAAA,EAAK,QAAAC;KACZ,MAAMJ,EAAA;KAAA,iBAAA,AAAAG,EAAA,QAAA,MAAA,EAAI,QAAAC;KACV,KAAKH,EAAA;KAAA,gBAAA,AAAAE,EAAA,QAAA,MAAA,EAAG,QAAAC;KACf,MAAMN,EAAA,OAAO;KACb,UAAUA,EAAA,OAAO;KACjB,SAASA,EAAA,OAAO;KAChB,UAAAA,EAAA;KACA,gBAAAA,EAAA;KACA,SAAAA,EAAA;KACA,SAAAA,EAAA;KACA,SAAAA,EAAA;KACA,OAAAA,EAAA;KACA,YAAAA,EAAA;KACA,QAAAA,EAAA;KACA,WAASA,EAAA,OAAO;KAChB,oBAAkBA,EAAA,OAAO;KACzB,qBAAAA,EAAA;KACA,SAAAA,EAAA;KACA,WAAO,AAAAK,EAAA,QAAA,MAAEP,EAAI,WAAYQ,CAAM;KAC/B,WAAO,AAAAD,EAAA,QAAA,MAAEP,EAAI,SAAA;KACb,UAAM,AAAAO,EAAA,QAAA,MAAEP,EAAI,QAAA;KACZ,YAAS,AAAAO,EAAA,QAAA,MAAEP,EAAI,UAAA;KACf,iBAAc,AAAAO,EAAA,QAAoB,GAAM,GAAS,MAA+BP,EAAI,iBAAkBS,GAAMC,GAASC,CAAM;KAI3H,SAAK,AAAAJ,EAAA,QAAA,MAAEP,EAAI,OAAA"}
|
|
@@ -27,7 +27,7 @@ var k = { class: "pk-chart-card border border-surface-3 rounded-xl w-full overfl
|
|
|
27
27
|
isDark: { type: Boolean }
|
|
28
28
|
},
|
|
29
29
|
setup(i) {
|
|
30
|
-
let f = n(() => import("./PkChart-
|
|
30
|
+
let f = n(() => import("./PkChart-BiFofCDF.js")), m = i, { t: _, locale: x } = T({ useScope: "global" }), { copy: O, copied: R } = w(), z = d(() => {
|
|
31
31
|
switch (m.chart.type) {
|
|
32
32
|
case "line": return "ri:line-chart-line";
|
|
33
33
|
case "pie": return "ri:pie-chart-line";
|
|
@@ -135,4 +135,4 @@ var z = {
|
|
|
135
135
|
}), [["styles", [".pk-tool-show-chart__loading{height:360px}"]]]);
|
|
136
136
|
export { H as default };
|
|
137
137
|
|
|
138
|
-
//# sourceMappingURL=PkToolShowChart-
|
|
138
|
+
//# sourceMappingURL=PkToolShowChart-lLXuHRJu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PkToolShowChart-CuLW9Kcy.js","names":["_hoisted_1","_hoisted_2","_hoisted_3","_openBlock","_createElementBlock","_createElementVNode","_createVNode","_toDisplayString","_unref","_withCtx","_createBlock","_Fragment","_renderList","$t","_openBlock","_createElementBlock","_Fragment","_renderList","_createBlock","PkChartCard","_createVNode","_toDisplayString","ou","Ee","defineAsyncComponent","createVNode","init_shared_esm_bundler","renderList","useTemplateRef","createBlock","Fragment","createBaseVNode","ref","computed","init_runtime_core_esm_bundler","toDisplayString","init_reactivity_esm_bundler","withCtx","createCommentVNode","defineComponent","unref","openBlock","ShowChartInputSchema","VvButtonLocalized","toSnakeCase","useClipboard","useI18n","chartValueFormatter","chartAsTsv","_plugin_vue_export_helper_default","_hoisted_1$1","_hoisted_2$1","_hoisted_3$1","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","PkChartCard_default","PkChart","props","__props","$t","icon","showTable","format","locale","chartRef","downloadPng","blob","url","anchor","_component_VvIcon","_component_VvButton","_component_VvButtonGroup","createElementBlock","_cache","copied","copy","series","i","category","_hoisted_1","_hoisted_2","_hoisted_3","PkToolShowChart_default","toolPart","streaming","refused","input","parsed","_ctx"],"sources":["../../../../packages/components/src/chat/PkChartCard.vue","../../../../packages/components/src/chat/PkToolShowChart.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, defineAsyncComponent, ref, useTemplateRef } from 'vue'\n import { useClipboard } from '@vueuse/core'\n import { useI18n } from 'vue-i18n'\n import type { Chart } from 'models'\n import { toSnakeCase } from 'utils'\n import { chartAsTsv, chartValueFormatter } from './chartFormat'\n\n // Chart.js comes with it: a separate chunk, loaded with the first chart\n const PkChart = defineAsyncComponent(() => import('./PkChart.vue'))\n\n /**\n * One chart of `showChart` (spec `chat-charts.md`) in its card: the chart,\n * the same numbers as a table, \"Copy data\" for a sheet and the chart as a\n * PNG.\n */\n const props = defineProps<{\n chart: Chart\n /** A note below the chart, e.g. the source of the numbers. */\n caption?: string\n isDark?: boolean\n }>()\n\n const { t: $t, locale } = useI18n({ useScope: 'global' })\n const { copy, copied } = useClipboard()\n\n const icon = computed(() => {\n switch (props.chart.type) {\n case 'line':\n return 'ri:line-chart-line'\n case 'pie':\n return 'ri:pie-chart-line'\n case 'doughnut':\n return 'ri:donut-chart-line'\n default:\n return props.chart.horizontal\n ? 'ri:bar-chart-horizontal-line'\n : 'ri:bar-chart-2-line'\n }\n })\n\n const showTable = ref(false)\n const format = computed(() =>\n chartValueFormatter(locale.value, props.chart.format),\n )\n\n const chartRef = useTemplateRef<{ toBlob: () => Promise<Blob | null> }>(\n 'chartRef',\n )\n const downloadPng = async () => {\n const blob = await chartRef.value?.toBlob()\n if (!blob) {\n return\n }\n const url = URL.createObjectURL(blob)\n const anchor = document.createElement('a')\n anchor.href = url\n anchor.download = `${toSnakeCase(props.chart.title || 'chart')}.png`\n document.body.appendChild(anchor)\n anchor.click()\n document.body.removeChild(anchor)\n URL.revokeObjectURL(url)\n }\n</script>\n\n<template>\n <div\n class=\"pk-chart-card border border-surface-3 rounded-xl w-full overflow-hidden\">\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8\">\n <VvIcon :name=\"icon\" class=\"text-16 shrink-0\" />\n <strong class=\"font-bold truncate\">\n {{ chart.title || $t('label.chart') }}\n </strong>\n <VvButtonGroup\n modifiers=\"compact\"\n class=\"pk-chart-card__actions ml-auto shrink-0\">\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"showTable ? icon : 'ri:table-line'\"\n :label=\"\n showTable\n ? $t('chart.showChart')\n : $t('chart.showTable')\n \"\n @click=\"showTable = !showTable\" />\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('chart.copyData')\"\n @click=\"copy(chartAsTsv(chart, locale))\" />\n <VvButton\n v-if=\"!showTable\"\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :label=\"$t('action.download')\"\n :title=\"$t('chart.downloadPng')\"\n @click=\"downloadPng\" />\n </VvButtonGroup>\n </div>\n <div v-if=\"showTable\" class=\"pk-chart-card__table-wrap\">\n <table class=\"pk-chart-card__table text-12\">\n <thead>\n <tr>\n <th scope=\"col\">{{ chart.categoryLabel ?? '' }}</th>\n <th\n v-for=\"series in chart.series\"\n :key=\"series.name\"\n scope=\"col\">\n {{ series.name }}\n </th>\n </tr>\n </thead>\n <tbody>\n <tr v-for=\"(category, i) in chart.categories\" :key=\"i\">\n <th scope=\"row\">{{ category }}</th>\n <td v-for=\"series in chart.series\" :key=\"series.name\">\n {{ format(series.values[i] ?? null) }}\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <div v-else class=\"pk-chart-card__stage px-sm py-sm\">\n <PkChart ref=\"chartRef\" :chart :is-dark />\n </div>\n <div\n v-if=\"caption\"\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-t border-surface-3 text-word-3\">\n {{ caption }}\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-chart-card {\n // A container for the narrow card below. It is also the containing\n // block of any `position: fixed` inside it, so a menu added here\n // must open in the top layer (docs/agents/gotchas/frontend.md, \"The\n // chat measures its own width\"): today the card has none.\n container-type: inline-size;\n\n // On a narrow card the actions keep their icon and lose the word on\n // screen, still read by a screen reader: the title keeps the room\n // (at 390px it was cut to \"Fattori di ...\")\n @container (width < 30rem) {\n &__actions .vv-button__label {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n }\n }\n\n // A fixed stage, as the diagram's: the chart loads in a chunk of its\n // own, and loader and chart must take the same room or the chat's\n // scroll jumps\n &__stage {\n height: 320px;\n }\n\n &__table-wrap {\n max-height: 320px;\n overflow: auto;\n }\n\n &__table {\n width: 100%;\n border-collapse: collapse;\n\n th,\n td {\n padding: var(--spacing-6) var(--spacing-sm);\n border-bottom: 1px solid var(--color-surface-3);\n text-align: right;\n white-space: nowrap;\n }\n\n th:first-child {\n text-align: left;\n white-space: normal;\n }\n\n thead th {\n color: var(--color-word-3);\n font-weight: 600;\n }\n\n tbody th {\n color: var(--color-word-2);\n font-weight: 400;\n }\n\n td {\n color: var(--color-word);\n font-variant-numeric: tabular-nums;\n }\n\n tbody tr:last-child > * {\n border-bottom: 0;\n }\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { ShowChartInputSchema } from 'models'\n import PkChartCard from './PkChartCard.vue'\n\n /**\n * The cards of `showChart` (spec `chat-charts.md`): every chart of the\n * call in its own card, one under the other, the caption under the last.\n */\n const props = defineProps<{\n part: unknown\n isDark?: boolean\n }>()\n\n const toolPart = computed(\n () => props.part as { state?: string; input?: unknown },\n )\n // A half-written input has series shorter than the categories\n const streaming = computed(() => toolPart.value.state === 'input-streaming')\n // A call the tool refused for its input: the model reads why and calls\n // again, and the corrected chart follows it. Nothing to show here.\n const refused = computed(() => toolPart.value.state === 'output-error')\n /** The input as the tool validated it; a stored one that is not stays a message. */\n const input = computed(() => {\n if (streaming.value) {\n return undefined\n }\n const parsed = ShowChartInputSchema.safeParse(toolPart.value.input)\n return parsed.success ? parsed.data : undefined\n })\n</script>\n\n<template>\n <div v-if=\"input\" class=\"flex flex-col gap-sm w-full\">\n <PkChartCard\n v-for=\"(chart, i) in input.charts\"\n :key=\"i\"\n :chart\n :caption=\"i === input.charts.length - 1 ? input.caption : undefined\"\n :is-dark />\n </div>\n <div\n v-else-if=\"streaming\"\n class=\"pk-tool-show-chart__loading border border-surface-3 rounded-xl w-full flex justify-center items-center\">\n <VvIcon name=\"loading-loop\" class=\"w-24 h-24 text-word-5\" />\n </div>\n <div\n v-else-if=\"!refused\"\n class=\"border border-surface-3 rounded-xl w-full text-12 text-danger py-8 px-sm\">\n {{ $t('message.chartRenderError') }}\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-tool-show-chart {\n // The height of a card while the call is written: the card that\n // replaces it takes about as much, and the chat's scroll stays put\n &__loading {\n height: 360px;\n }\n }\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASI,IAAM4D,IAAUpC,QAA2B,OAAO,wBAAgB,GAO5DqC,IAAQC,GAOR,EAAE,GAAGC,GAAI,cAAWjB,EAAQ,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A,GAAAC,EAIM,OAJNsE,GAIMhE,EADCR,EAAAA,GAAE,0BAAA,CAAA,GAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"PkToolShowChart-lLXuHRJu.js","names":["_hoisted_1","_hoisted_2","_hoisted_3","_openBlock","_createElementBlock","_createElementVNode","_createVNode","_toDisplayString","_unref","_withCtx","_createBlock","_Fragment","_renderList","$t","_openBlock","_createElementBlock","_Fragment","_renderList","_createBlock","PkChartCard","_createVNode","_toDisplayString","ou","Ee","defineAsyncComponent","createVNode","init_shared_esm_bundler","renderList","useTemplateRef","createBlock","Fragment","createBaseVNode","ref","computed","init_runtime_core_esm_bundler","toDisplayString","init_reactivity_esm_bundler","withCtx","createCommentVNode","defineComponent","unref","openBlock","ShowChartInputSchema","VvButtonLocalized","toSnakeCase","useClipboard","useI18n","chartValueFormatter","chartAsTsv","_plugin_vue_export_helper_default","_hoisted_1$1","_hoisted_2$1","_hoisted_3$1","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","PkChartCard_default","PkChart","props","__props","$t","icon","showTable","format","locale","chartRef","downloadPng","blob","url","anchor","_component_VvIcon","_component_VvButton","_component_VvButtonGroup","createElementBlock","_cache","copied","copy","series","i","category","_hoisted_1","_hoisted_2","_hoisted_3","PkToolShowChart_default","toolPart","streaming","refused","input","parsed","_ctx"],"sources":["../../../../packages/components/src/chat/PkChartCard.vue","../../../../packages/components/src/chat/PkToolShowChart.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, defineAsyncComponent, ref, useTemplateRef } from 'vue'\n import { useClipboard } from '@vueuse/core'\n import { useI18n } from 'vue-i18n'\n import type { Chart } from 'models'\n import { toSnakeCase } from 'utils'\n import { chartAsTsv, chartValueFormatter } from './chartFormat'\n\n // Chart.js comes with it: a separate chunk, loaded with the first chart\n const PkChart = defineAsyncComponent(() => import('./PkChart.vue'))\n\n /**\n * One chart of `showChart` (spec `chat-charts.md`) in its card: the chart,\n * the same numbers as a table, \"Copy data\" for a sheet and the chart as a\n * PNG.\n */\n const props = defineProps<{\n chart: Chart\n /** A note below the chart, e.g. the source of the numbers. */\n caption?: string\n isDark?: boolean\n }>()\n\n const { t: $t, locale } = useI18n({ useScope: 'global' })\n const { copy, copied } = useClipboard()\n\n const icon = computed(() => {\n switch (props.chart.type) {\n case 'line':\n return 'ri:line-chart-line'\n case 'pie':\n return 'ri:pie-chart-line'\n case 'doughnut':\n return 'ri:donut-chart-line'\n default:\n return props.chart.horizontal\n ? 'ri:bar-chart-horizontal-line'\n : 'ri:bar-chart-2-line'\n }\n })\n\n const showTable = ref(false)\n const format = computed(() =>\n chartValueFormatter(locale.value, props.chart.format),\n )\n\n const chartRef = useTemplateRef<{ toBlob: () => Promise<Blob | null> }>(\n 'chartRef',\n )\n const downloadPng = async () => {\n const blob = await chartRef.value?.toBlob()\n if (!blob) {\n return\n }\n const url = URL.createObjectURL(blob)\n const anchor = document.createElement('a')\n anchor.href = url\n anchor.download = `${toSnakeCase(props.chart.title || 'chart')}.png`\n document.body.appendChild(anchor)\n anchor.click()\n document.body.removeChild(anchor)\n URL.revokeObjectURL(url)\n }\n</script>\n\n<template>\n <div\n class=\"pk-chart-card border border-surface-3 rounded-xl w-full overflow-hidden\">\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8\">\n <VvIcon :name=\"icon\" class=\"text-16 shrink-0\" />\n <strong class=\"font-bold truncate\">\n {{ chart.title || $t('label.chart') }}\n </strong>\n <VvButtonGroup\n modifiers=\"compact\"\n class=\"pk-chart-card__actions ml-auto shrink-0\">\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"showTable ? icon : 'ri:table-line'\"\n :label=\"\n showTable\n ? $t('chart.showChart')\n : $t('chart.showTable')\n \"\n @click=\"showTable = !showTable\" />\n <VvButton\n modifiers=\"action-quiet-small\"\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('chart.copyData')\"\n @click=\"copy(chartAsTsv(chart, locale))\" />\n <VvButton\n v-if=\"!showTable\"\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :label=\"$t('action.download')\"\n :title=\"$t('chart.downloadPng')\"\n @click=\"downloadPng\" />\n </VvButtonGroup>\n </div>\n <div v-if=\"showTable\" class=\"pk-chart-card__table-wrap\">\n <table class=\"pk-chart-card__table text-12\">\n <thead>\n <tr>\n <th scope=\"col\">{{ chart.categoryLabel ?? '' }}</th>\n <th\n v-for=\"series in chart.series\"\n :key=\"series.name\"\n scope=\"col\">\n {{ series.name }}\n </th>\n </tr>\n </thead>\n <tbody>\n <tr v-for=\"(category, i) in chart.categories\" :key=\"i\">\n <th scope=\"row\">{{ category }}</th>\n <td v-for=\"series in chart.series\" :key=\"series.name\">\n {{ format(series.values[i] ?? null) }}\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <div v-else class=\"pk-chart-card__stage px-sm py-sm\">\n <PkChart ref=\"chartRef\" :chart :is-dark />\n </div>\n <div\n v-if=\"caption\"\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-t border-surface-3 text-word-3\">\n {{ caption }}\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-chart-card {\n // A container for the narrow card below. It is also the containing\n // block of any `position: fixed` inside it, so a menu added here\n // must open in the top layer (docs/agents/gotchas/frontend.md, \"The\n // chat measures its own width\"): today the card has none.\n container-type: inline-size;\n\n // On a narrow card the actions keep their icon and lose the word on\n // screen, still read by a screen reader: the title keeps the room\n // (at 390px it was cut to \"Fattori di ...\")\n @container (width < 30rem) {\n &__actions .vv-button__label {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n }\n }\n\n // A fixed stage, as the diagram's: the chart loads in a chunk of its\n // own, and loader and chart must take the same room or the chat's\n // scroll jumps\n &__stage {\n height: 320px;\n }\n\n &__table-wrap {\n max-height: 320px;\n overflow: auto;\n }\n\n &__table {\n width: 100%;\n border-collapse: collapse;\n\n th,\n td {\n padding: var(--spacing-6) var(--spacing-sm);\n border-bottom: 1px solid var(--color-surface-3);\n text-align: right;\n white-space: nowrap;\n }\n\n th:first-child {\n text-align: left;\n white-space: normal;\n }\n\n thead th {\n color: var(--color-word-3);\n font-weight: 600;\n }\n\n tbody th {\n color: var(--color-word-2);\n font-weight: 400;\n }\n\n td {\n color: var(--color-word);\n font-variant-numeric: tabular-nums;\n }\n\n tbody tr:last-child > * {\n border-bottom: 0;\n }\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { ShowChartInputSchema } from 'models'\n import PkChartCard from './PkChartCard.vue'\n\n /**\n * The cards of `showChart` (spec `chat-charts.md`): every chart of the\n * call in its own card, one under the other, the caption under the last.\n */\n const props = defineProps<{\n part: unknown\n isDark?: boolean\n }>()\n\n const toolPart = computed(\n () => props.part as { state?: string; input?: unknown },\n )\n // A half-written input has series shorter than the categories\n const streaming = computed(() => toolPart.value.state === 'input-streaming')\n // A call the tool refused for its input: the model reads why and calls\n // again, and the corrected chart follows it. Nothing to show here.\n const refused = computed(() => toolPart.value.state === 'output-error')\n /** The input as the tool validated it; a stored one that is not stays a message. */\n const input = computed(() => {\n if (streaming.value) {\n return undefined\n }\n const parsed = ShowChartInputSchema.safeParse(toolPart.value.input)\n return parsed.success ? parsed.data : undefined\n })\n</script>\n\n<template>\n <div v-if=\"input\" class=\"flex flex-col gap-sm w-full\">\n <PkChartCard\n v-for=\"(chart, i) in input.charts\"\n :key=\"i\"\n :chart\n :caption=\"i === input.charts.length - 1 ? input.caption : undefined\"\n :is-dark />\n </div>\n <div\n v-else-if=\"streaming\"\n class=\"pk-tool-show-chart__loading border border-surface-3 rounded-xl w-full flex justify-center items-center\">\n <VvIcon name=\"loading-loop\" class=\"w-24 h-24 text-word-5\" />\n </div>\n <div\n v-else-if=\"!refused\"\n class=\"border border-surface-3 rounded-xl w-full text-12 text-danger py-8 px-sm\">\n {{ $t('message.chartRenderError') }}\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-tool-show-chart {\n // The height of a card while the call is written: the card that\n // replaces it takes about as much, and the chat's scroll stays put\n &__loading {\n height: 360px;\n }\n }\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASI,IAAM4D,IAAUpC,QAA2B,OAAO,wBAAgB,GAO5DqC,IAAQC,GAOR,EAAE,GAAGC,GAAI,cAAWjB,EAAQ,EAAE,UAAU,SAAS,CAAC,GAClD,EAAE,SAAM,cAAWD,EAAa,GAEhCmB,IAAO/B,QAAe;GACxB,QAAQ4B,EAAM,MAAM,MAApB;IACI,KAAK,QACD,OAAO;IACX,KAAK,OACD,OAAO;IACX,KAAK,YACD,OAAO;IACX,SACI,OAAOA,EAAM,MAAM,aACb,iCACA;GACd;EACJ,CAAC,GAEKI,IAAYjC,EAAI,EAAK,GACrBkC,IAASjC,QACXc,EAAoBoB,EAAO,OAAON,EAAM,MAAM,MAAM,CACxD,GAEMO,IAAWxC,EACb,UACJ,GACMyC,IAAc,YAAY;GAC5B,IAAMC,IAAO,MAAMF,EAAS,OAAO,OAAO;GAC1C,IAAI,CAACE,GACD;GAEJ,IAAMC,IAAM,IAAI,gBAAgBD,CAAI,GAC9BE,IAAS,SAAS,cAAc,GAAG;GAMzC,AALA,EAAO,OAAOD,GACd,EAAO,WAAW,GAAG3B,EAAYiB,EAAM,MAAM,SAAS,OAAO,EAAE,OAC/D,SAAS,KAAK,YAAYW,CAAM,GAChCA,EAAO,MAAM,GACb,SAAS,KAAK,YAAYA,CAAM,GAChC,IAAI,gBAAgBD,CAAG;EAC3B;;;GAIA,OAAApE,EAAA,GAAAC,EAiEM,OAjENJ,GAiEM;IA/DFK,EA+BM,OA/BNJ,GA+BM;KA7BFK,EAAgDmE,GAAA;MAAvC,MAAMT,EAAA;MAAM,OAAM;;KAC3B3D,EAES,UAFTH,GAESK,EADFuD,EAAA,MAAM,SAAStD,EAAAuD,CAAA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AAO,OADnB5E,EAAA,GAAAI,EAKeC,GAAA;IAHV,KAAK8D;IACL;IACA,SAASA,MAAMS,EAAA,MAAM,OAAO,SAAM,IAAOA,EAAA,MAAM,UAAU,KAAA;IACzD,WAAA5B,EAAA;;;;;G,iBAGM0B,EAAA,SADf1E,EAAA,GAAAC,EAIM,OAJNqE,GAIM,CADFhE,EAA4DqD,GAAA;IAApD,MAAK;IAAe,OAAM;G,QAGtBgB,EAAA,Q,aADhB3E,EAAA,GAAAC,EAIM,OAJNsE,GAIMhE,EADCR,EAAAA,GAAE,0BAAA,CAAA,GAAA,CAAA"}
|
package/dist/ai-elements.es.js
CHANGED
|
@@ -16468,7 +16468,7 @@ var db = {
|
|
|
16468
16468
|
shareDocument: A(() => import("./_chunks/PkToolShareDocument-Cv7uBr5Z.js")),
|
|
16469
16469
|
showArtifact: A(() => import("./_chunks/PkToolShowArtifact-DMIADTQ6.js")),
|
|
16470
16470
|
showCalendarEvent: A(() => import("./_chunks/PkToolShowCalendarEvent-fMI-paCP.js")),
|
|
16471
|
-
showChart: A(() => import("./_chunks/PkToolShowChart-
|
|
16471
|
+
showChart: A(() => import("./_chunks/PkToolShowChart-lLXuHRJu.js")),
|
|
16472
16472
|
showComparison: A(() => import("./_chunks/PkToolShowComparison-CKSqPgJo.js")),
|
|
16473
16473
|
showContactForm: A(() => import("./_chunks/PkToolShowContactForm-B5DCcFqt.js")),
|
|
16474
16474
|
showDiagram: A(() => import("./_chunks/PkToolShowDiagram-DEFJr7zY.js")),
|
|
@@ -19151,7 +19151,7 @@ var TC = { class: "pk-chatbot-view-chat__input-stage" }, EC = {
|
|
|
19151
19151
|
"selection-action"
|
|
19152
19152
|
],
|
|
19153
19153
|
setup(e, { emit: t }) {
|
|
19154
|
-
let n = A(() => import("./_chunks/PkToolShowForm-BBxcDLyR.js")), r = A(() => import("./_chunks/PkToolShowContactForm-B5DCcFqt.js")), i = A(() => import("./_chunks/PkToolShowSuggestedReply-DKuV4mmV.js")), a = A(() => import("./_chunks/PkToolShowSources-DNDgRLE-.js")), o = A(() => import("./_chunks/PkToolRequestGeolocation-DZenn1az.js")), s = A(() => import("./_chunks/PkToolRequestOAuthConnection-Dz0qfYu5.js")), c = A(() => import("./_chunks/PkToolShowLocation-DaFjO8MV.js")), l = A(() => import("./_chunks/PkToolShowChart-
|
|
19154
|
+
let n = A(() => import("./_chunks/PkToolShowForm-BBxcDLyR.js")), r = A(() => import("./_chunks/PkToolShowContactForm-B5DCcFqt.js")), i = A(() => import("./_chunks/PkToolShowSuggestedReply-DKuV4mmV.js")), a = A(() => import("./_chunks/PkToolShowSources-DNDgRLE-.js")), o = A(() => import("./_chunks/PkToolRequestGeolocation-DZenn1az.js")), s = A(() => import("./_chunks/PkToolRequestOAuthConnection-Dz0qfYu5.js")), c = A(() => import("./_chunks/PkToolShowLocation-DaFjO8MV.js")), l = A(() => import("./_chunks/PkToolShowChart-lLXuHRJu.js")), u = A(() => import("./_chunks/PkToolShowDiagram-DEFJr7zY.js")), d = A(() => import("./_chunks/PkToolChatFile-x50rORrq.js")), f = A(() => import("./_chunks/PkToolShareDocument-Cv7uBr5Z.js")), p = A(() => import("./_chunks/PkFilePreview-CW04wd9z.js").then((e) => e.n)), m = A(() => import("./_chunks/PkFilePreviewDialog-0vC6vbNa.js")), h = e, g = t, _ = Hp(h.agentId), { agentInterface: v, agentFileUpload: y, agentType: b, agentVoice: x, actions: S, revisedAnswers: C, messages: w, chat: T, messageFeedbacks: ee, feedbackDialogMessage: te, isFeedbackSubmitting: ne, isFeedbackSubmitted: re, feedbackSubmitError: ie, isLeadSubmitted: E, isLoadingSubmitLead: D, submitLeadError: ae, input: oe, inputMessagePlaceholder: O, isConversationBlocked: se, baseUrl: ce, pendingAttachments: le, isAttachmentLimitReached: ue, fileLimitError: de, apiClient: fe, isDark: pe, hostToolsPending: me, pageNoticeLevel: he, hostConfirmation: ge, agentPageAccess: k, hostStepTitles: _e, hostStepChanges: ve, confirmationMode: ye, canQueue: be, queuedMessages: xe, backgroundAnswers: Se, inputFocusRequest: we, pagePointer: Te, pagePointerAvailable: Ee, pagePointing: De, agentSelectionActions: ke } = di(_);
|
|
19155
19155
|
Ce(pr, _e), Ce(lr, ve);
|
|
19156
19156
|
let Ae = Ve("inputEl");
|
|
19157
19157
|
M(we, () => {
|
package/dist-vue/PkChatbot.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as default } from "./_chunks/PkChatbot-
|
|
1
|
+
export { t as default } from "./_chunks/PkChatbot-BNcXCHJv.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as default } from "./_chunks/PkChatbotMessages-
|
|
1
|
+
export { t as default } from "./_chunks/PkChatbotMessages-DV0hYZgp.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as default } from "./_chunks/PkChatbotViewChat-
|
|
1
|
+
export { t as default } from "./_chunks/PkChatbotViewChat-8itM8FhY.js";
|
|
@@ -151,7 +151,8 @@ var N = ({ r: e, g: t, b: n }) => `#${[
|
|
|
151
151
|
borderWidth: 2,
|
|
152
152
|
pointRadius: 3,
|
|
153
153
|
cubicInterpolationMode: c ? "default" : "monotone",
|
|
154
|
-
spanGaps: !1
|
|
154
|
+
spanGaps: !1,
|
|
155
|
+
clip: 5
|
|
155
156
|
} : {
|
|
156
157
|
label: i,
|
|
157
158
|
data: e.values,
|
|
@@ -166,6 +167,7 @@ var N = ({ r: e, g: t, b: n }) => `#${[
|
|
|
166
167
|
font: i
|
|
167
168
|
}), f = {
|
|
168
169
|
beginAtZero: !0,
|
|
170
|
+
grace: "10%",
|
|
169
171
|
stacked: !!n.stacked,
|
|
170
172
|
ticks: {
|
|
171
173
|
color: r.tick,
|
|
@@ -179,6 +181,7 @@ var N = ({ r: e, g: t, b: n }) => `#${[
|
|
|
179
181
|
border: { display: !1 },
|
|
180
182
|
title: d(n.valueLabel)
|
|
181
183
|
}, p = {
|
|
184
|
+
offset: !0,
|
|
182
185
|
stacked: !!n.stacked,
|
|
183
186
|
ticks: {
|
|
184
187
|
color: r.tick,
|
|
@@ -251,7 +254,8 @@ var N = ({ r: e, g: t, b: n }) => `#${[
|
|
|
251
254
|
await a(), F.value && j.value && (I?.destroy(), I = new g(F.value, W()));
|
|
252
255
|
};
|
|
253
256
|
return E({ toBlob: async () => {
|
|
254
|
-
if (!F.value || !j.value) return null;
|
|
257
|
+
if (!I || !F.value || !j.value) return null;
|
|
258
|
+
I.stop(), I.update("none"), I.draw();
|
|
255
259
|
let e = document.createElement("canvas");
|
|
256
260
|
e.width = F.value.width, e.height = F.value.height;
|
|
257
261
|
let t = e.getContext("2d");
|
|
@@ -278,4 +282,4 @@ var N = ({ r: e, g: t, b: n }) => `#${[
|
|
|
278
282
|
});
|
|
279
283
|
export { F as default };
|
|
280
284
|
|
|
281
|
-
//# sourceMappingURL=PkChart-
|
|
285
|
+
//# sourceMappingURL=PkChart-CmrpyYAS.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PkChart-DiMQHC6K.js","names":["ChartJS","_openBlock","_createElementBlock","_createElementVNode","isRoundChart","chartValueFormatter","pixel","supportsColorRoles","channel","value","parseSrgb","match","computed","parseOnCanvas","r","g","b","a","readColor","expression","probe","resolveCssColorsIn","element","expressions","hexString","_hoisted_1","PkChart_default","defineComponent","__expose","ArcElement","BarController","BarElement","CategoryScale","DoughnutController","Legend","LinearScale","LineController","LineElement","PieController","PointElement","Title","Tooltip","props","__props","$t","useI18n","root","useTemplateRef","canvas","instance","ROLES","CATEGORICAL","strength","toward","role","TONES","INK","fallbackColors","dark","OFFICE_INK","readColors","light","hex","categorical","tones","tone","i","text","tick","grid","surface","configuration","colors","font","format","locale","chart","reducedMotion","round","paper","untoned","datasets","label","series","index","color","axisTitle","valueAxis","categoryAxis","horizontal","item","total","v","sum","share","draw","nextTick","Chart","copy","context","resolve","onMounted","watch","onBeforeUnmount","openBlock","createElementBlock","createElementVNode","s"],"sources":["../../../../packages/composable/src/cssColor.ts","../../../../packages/components/src/chat/PkChart.vue"],"sourcesContent":["/** A color as a canvas draws it: channels 0-255, alpha 0-1. */\nexport type RgbaColor = { r: number; g: number; b: number; a: number }\n\nlet scopes: Record<'light' | 'dark', HTMLElement> | undefined\nlet pixel: CanvasRenderingContext2D | null | undefined\nlet memoRevision = ''\nconst memo = new Map<string, RgbaColor>()\n\n/**\n * Whether this browser computes the color roles of the design system, which\n * derive from the palette with the relative color syntax and `color-mix()`.\n */\nexport const supportsColorRoles = () =>\n typeof CSS !== 'undefined' &&\n CSS.supports('color', 'color(from red xyz-d65 x y z)') &&\n CSS.supports('color', 'color-mix(in srgb, red 50%, blue)')\n\n/**\n * A hidden element per theme, with the classes that pin it: the colors of a\n * theme resolve inside it whatever the document's own theme is at that\n * moment, which during a switch is not yet the one being drawn.\n */\nfunction scopeOf(theme: 'light' | 'dark') {\n if (!scopes) {\n const make = (name: 'light' | 'dark') => {\n const element = document.createElement('span')\n element.className = `theme theme--${name}`\n element.setAttribute('aria-hidden', 'true')\n element.style.cssText =\n 'position:fixed;width:0;height:0;overflow:hidden;visibility:hidden;pointer-events:none'\n document.body.append(element)\n return element\n }\n scopes = { light: make('light'), dark: make('dark') }\n }\n return scopes[theme]\n}\n\nconst channel = (value: string) =>\n Math.round(Math.min(1, Math.max(0, Number(value))) * 255)\n\n/** `color(srgb r g b / a)`, the form a color mixed in sRGB computes to. */\nfunction parseSrgb(computed: string): RgbaColor | null {\n const match = computed.match(\n /^color\\(srgb (\\S+) (\\S+) (\\S+)(?: \\/ (\\S+))?\\)$/,\n )\n if (!match) {\n return null\n }\n return {\n r: channel(match[1]),\n g: channel(match[2]),\n b: channel(match[3]),\n a: match[4] === undefined ? 1 : Number(match[4]),\n }\n}\n\n/** Any other form the browser computed, read back from one pixel. */\nfunction parseOnCanvas(computed: string): RgbaColor {\n pixel ??= document\n .createElement('canvas')\n .getContext('2d', { willReadFrequently: true })\n if (!pixel) {\n return { r: 0, g: 0, b: 0, a: 1 }\n }\n pixel.clearRect(0, 0, 1, 1)\n pixel.fillStyle = computed\n pixel.fillRect(0, 0, 1, 1)\n const [r, g, b, a] = pixel.getImageData(0, 0, 1, 1).data\n return { r, g, b, a: Math.round((a / 255) * 1000) / 1000 }\n}\n\n/**\n * The color a CSS expression (`var(--color-accent-graphic)`, a `color-mix()`)\n * resolves to in a theme, in channels a canvas understands. Chart.js draws on\n * a canvas, which reads no custom property, and the design system derives its\n * roles in XYZ with the relative color syntax: the expression is mixed into\n * sRGB first, so the browser hands it back as `color(srgb ...)`.\n *\n * Results are kept while `revision` stays the same: the caller passes what\n * changes the colors, the theme's version and its stylesheet.\n */\nexport function resolveCssColor(\n expression: string,\n theme: 'light' | 'dark',\n revision: string,\n): RgbaColor {\n if (revision !== memoRevision) {\n memo.clear()\n memoRevision = revision\n }\n const id = `${theme}|${expression}`\n const known = memo.get(id)\n if (known) {\n return known\n }\n const color = readColor(scopeOf(theme), expression)\n memo.set(id, color)\n return color\n}\n\n/** The expression mixed into sRGB on `probe`, read back as channels. */\nfunction readColor(probe: HTMLElement, expression: string): RgbaColor {\n probe.style.color = `color-mix(in srgb, ${expression} 100%, transparent)`\n const computed = getComputedStyle(probe).color\n return parseSrgb(computed) ?? parseOnCanvas(computed)\n}\n\n/**\n * The colors of CSS expressions as they resolve inside `element`, with the\n * theme and the custom properties that reach it there. In the widget that is\n * its shadow root, which the theme scopes of {@link resolveCssColor}, on the\n * document's body, never see. Nothing is memoized: the caller reads again\n * when the theme changes.\n */\nexport function resolveCssColorsIn(\n element: Element,\n expressions: readonly string[],\n): RgbaColor[] {\n const probe = document.createElement('span')\n probe.setAttribute('aria-hidden', 'true')\n probe.style.cssText =\n 'position:absolute;width:0;height:0;overflow:hidden;visibility:hidden;pointer-events:none'\n element.append(probe)\n try {\n return expressions.map((expression) => readColor(probe, expression))\n } finally {\n probe.remove()\n }\n}\n\n/** `#rrggbb`, ready for the hex alpha some charts append. */\nexport const hexString = ({ r, g, b }: RgbaColor) =>\n `#${[r, g, b].map((value) => value.toString(16).padStart(2, '0')).join('')}`\n\n/** A `#rrggbb` color as an `rgba()` string with the alpha given. */\nexport function hexWithAlpha(hex: string, alpha: number) {\n const value = Number.parseInt(hex.slice(1, 7), 16)\n return `rgba(${(value >> 16) & 255}, ${(value >> 8) & 255}, ${value & 255}, ${alpha})`\n}\n\nconst channelsOf = (hex: string) => {\n const value = Number.parseInt(hex.slice(1, 7), 16)\n return [(value >> 16) & 255, (value >> 8) & 255, value & 255]\n}\n\n/** WCAG relative luminance of a `#rrggbb` color. */\nconst luminanceOf = (hex: string) => {\n const [r, g, b] = channelsOf(hex).map((channel) => {\n const value = channel / 255\n return value <= 0.03928\n ? value / 12.92\n : ((value + 0.055) / 1.055) ** 2.4\n })\n return 0.2126 * r + 0.7152 * g + 0.0722 * b\n}\n\nconst contrastOf = (a: string, b: string) => {\n const [high, low] = [luminanceOf(a), luminanceOf(b)].sort((x, y) => y - x)\n return (high + 0.05) / (low + 0.05)\n}\n\n/**\n * `color` as a chart mark on `ground`: unchanged when it already stands 3:1\n * off it, the contrast WCAG asks of a graphic (1.4.11), otherwise mixed\n * toward `toward` (white on a dark ground, black on a light one) a tenth at\n * a time until it does. An agent's own color is often black, which vanished\n * from the bars of the dark theme, and the palette's two dark teals did too.\n * A color that is not `#rgb` or `#rrggbb` is returned as it is.\n */\nexport function readableOn(color: string, ground: string, toward: string) {\n const short = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(color)\n const hex = short\n ? `#${short[1]}${short[1]}${short[2]}${short[2]}${short[3]}${short[3]}`\n : color\n if (!/^#[0-9a-f]{6}$/i.test(hex) || contrastOf(hex, ground) >= 3) {\n return color\n }\n const from = channelsOf(hex)\n const to = channelsOf(toward)\n for (let step = 1; step <= 10; step++) {\n const mixed = hexString({\n r: Math.round(from[0] + ((to[0] - from[0]) * step) / 10),\n g: Math.round(from[1] + ((to[1] - from[1]) * step) / 10),\n b: Math.round(from[2] + ((to[2] - from[2]) * step) / 10),\n a: 1,\n })\n if (contrastOf(mixed, ground) >= 3) {\n return mixed\n }\n }\n return toward\n}\n","<script setup lang=\"ts\">\n import {\n nextTick,\n onBeforeUnmount,\n onMounted,\n useTemplateRef,\n watch,\n } from 'vue'\n import { useI18n } from 'vue-i18n'\n import {\n ArcElement,\n BarController,\n BarElement,\n CategoryScale,\n Chart as ChartJS,\n DoughnutController,\n Legend,\n LinearScale,\n LineController,\n LineElement,\n PieController,\n PointElement,\n Title,\n Tooltip,\n type ChartConfiguration,\n type TooltipItem,\n } from 'chart.js'\n import {\n hexString,\n resolveCssColorsIn,\n supportsColorRoles,\n } from 'composables'\n import { isRoundChart, type Chart, type ChartTone } from 'models'\n import { chartValueFormatter } from './chartFormat'\n\n ChartJS.register(\n ArcElement,\n BarController,\n BarElement,\n CategoryScale,\n DoughnutController,\n Legend,\n LinearScale,\n LineController,\n LineElement,\n PieController,\n PointElement,\n Title,\n Tooltip,\n )\n\n /**\n * Draws a chart described as data (spec `chat-charts.md`) with Chart.js,\n * in the colors of the theme it sits in: the categorical palette from the\n * design system's graphic roles, the tones from its semantic ones. The\n * colors are read inside this element, so in the widget they are the\n * widget's own and not the host page's.\n *\n * On `paper` it draws a chart of a file in the file's viewer (F4): on the\n * white of the sheet or the page in both themes, in Office's grey ink,\n * with the file's `colors` (one per series, or one per slice), its\n * `legend` where the file puts one, and its title inside.\n */\n const props = defineProps<{\n chart: Chart\n isDark?: boolean\n paper?: boolean\n colors?: string[]\n legend?: 'top' | 'bottom' | 'left' | 'right'\n }>()\n\n const { locale, t: $t } = useI18n({ useScope: 'global' })\n\n const root = useTemplateRef<HTMLElement>('root')\n const canvas = useTemplateRef<HTMLCanvasElement>('canvas')\n let instance: ChartJS | undefined\n\n const ROLES = ['accent', 'brand', 'info'] as const\n /**\n * Twelve categorical colors, enough for the slices of a pie: the three\n * graphic roles, then the same roles toward the surface (a tint in the\n * light theme, a shade in the dark one), then toward the text, then\n * further toward the surface. Mixing the default brand, a near black\n * navy, toward the text alone gave two slices nobody could tell apart.\n * Interleaved, so neighbours never share a hue.\n */\n const CATEGORICAL = (\n [\n [100, 'surface'],\n [55, 'surface'],\n [70, 'word'],\n [30, 'surface'],\n ] as const\n ).flatMap(([strength, toward]) =>\n ROLES.map((role) =>\n strength === 100\n ? `var(--color-${role}-graphic)`\n : `color-mix(in srgb, var(--color-${role}-graphic) ${strength}%, var(--color-${toward}))`,\n ),\n )\n const TONES: Record<ChartTone, string> = {\n positive: 'var(--color-success-graphic)',\n warning: 'var(--color-warning-graphic)',\n negative: 'var(--color-danger-graphic)',\n critical:\n 'color-mix(in srgb, var(--color-danger-graphic) 60%, var(--color-word))',\n neutral:\n 'color-mix(in srgb, var(--color-word) 35%, var(--color-surface))',\n }\n const INK = [\n 'var(--color-word-2)',\n 'var(--color-word-3)',\n 'var(--color-surface-3)',\n 'var(--color-surface)',\n ]\n\n /**\n * A browser that cannot compute the design system's roles (no\n * `color-mix()` or relative colors) would draw every series in the text\n * color: it gets the dashboard's colors for the default theme instead.\n */\n const fallbackColors = (dark: boolean) => ({\n categorical: [\n '#9365ff',\n '#004775',\n '#6e66ed',\n '#003d5c',\n '#4b63d9',\n '#0058a8',\n '#285ec1',\n '#00508f',\n ],\n tones: {\n positive: '#5cb327',\n warning: '#e0a800',\n negative: '#fe4242',\n critical: '#991b1b',\n neutral: dark ? '#4b4b5c' : '#c4c9d4',\n } satisfies Record<ChartTone, string>,\n text: dark ? '#d1d5db' : '#4b5563',\n tick: dark ? '#9ca3af' : '#6b7280',\n grid: dark ? '#374151' : '#f3f4f6',\n surface: dark ? '#1f2937' : '#ffffff',\n })\n\n /** The grey Office draws a chart's text and lines in, on white. */\n const OFFICE_INK = {\n text: '#595959',\n tick: '#595959',\n grid: '#d9d9d9',\n surface: '#ffffff',\n }\n\n const readColors = () => {\n if (props.paper) {\n const light = fallbackColors(false)\n return {\n ...light,\n ...OFFICE_INK,\n categorical: props.colors?.length\n ? props.colors\n : light.categorical,\n }\n }\n if (!supportsColorRoles()) {\n return fallbackColors(!!props.isDark)\n }\n const expressions = [...CATEGORICAL, ...Object.values(TONES), ...INK]\n const hex = resolveCssColorsIn(root.value!, expressions).map(hexString)\n const categorical = hex.slice(0, CATEGORICAL.length)\n const tones = Object.fromEntries(\n Object.keys(TONES).map((tone, i) => [\n tone,\n hex[CATEGORICAL.length + i],\n ]),\n ) as Record<ChartTone, string>\n const [text, tick, grid, surface] = hex.slice(-INK.length)\n return { categorical, tones, text, tick, grid, surface }\n }\n\n const configuration = (): ChartConfiguration => {\n const { chart } = props\n const colors = readColors()\n const font = {\n family: getComputedStyle(root.value!).fontFamily,\n size: 11,\n }\n const format = chartValueFormatter(locale.value, chart.format)\n const reducedMotion = window.matchMedia(\n '(prefers-reduced-motion: reduce)',\n ).matches\n const round = isRoundChart(chart.type)\n const paper = !!props.paper\n let untoned = 0\n const datasets = chart.series.map((series, index) => {\n // A file can leave a series unnamed: numbered, as Excel does\n const label = series.name || $t('chart.series', { n: index + 1 })\n if (round) {\n return {\n label,\n data: series.values,\n backgroundColor: chart.categories.map(\n (_, i) =>\n colors.categorical[i % colors.categorical.length],\n ),\n borderColor: colors.surface,\n borderWidth: 2,\n }\n }\n const color = series.tone\n ? colors.tones[series.tone]\n : colors.categorical[untoned++ % colors.categorical.length]\n // On paper, straight lines and square bars, as Office draws them\n return chart.type === 'line'\n ? {\n label,\n data: series.values,\n borderColor: color,\n backgroundColor: color,\n borderWidth: 2,\n pointRadius: 3,\n // Smooth without overshooting a value\n cubicInterpolationMode: paper ? 'default' : 'monotone',\n // A missing value stays a gap, not a guess\n spanGaps: false,\n }\n : {\n label,\n data: series.values,\n backgroundColor: color,\n borderRadius: paper ? 0 : 3,\n maxBarThickness: paper ? undefined : 48,\n }\n })\n const axisTitle = (text?: string) => ({\n display: !!text,\n text: text ?? '',\n color: colors.tick,\n font,\n })\n const valueAxis = {\n beginAtZero: true,\n stacked: !!chart.stacked,\n ticks: {\n color: colors.tick,\n font,\n callback: (value: string | number) => format(Number(value)),\n },\n grid: { color: colors.grid, drawTicks: false },\n border: { display: false },\n title: axisTitle(chart.valueLabel),\n }\n const categoryAxis = {\n stacked: !!chart.stacked,\n ticks: { color: colors.tick, font, autoSkip: true },\n grid: { display: false },\n border: { display: false },\n title: axisTitle(chart.categoryLabel),\n }\n const horizontal = chart.type === 'bar' && !!chart.horizontal\n return {\n type: chart.type,\n data: { labels: chart.categories, datasets },\n options: {\n responsive: true,\n maintainAspectRatio: false,\n animation: reducedMotion ? false : { duration: 400 },\n indexAxis: horizontal ? 'y' : 'x',\n // The hole of a doughnut, and the slices drawn whole in a pie\n ...(round && {\n cutout: chart.type === 'doughnut' ? '55%' : 0,\n }),\n scales: round\n ? {}\n : horizontal\n ? { x: valueAxis, y: categoryAxis }\n : { x: categoryAxis, y: valueAxis },\n plugins: {\n // The card says the title of a chart in the chat; a\n // file's chart carries its own\n title: {\n display: paper && !!chart.title,\n text: chart.title ?? '',\n color: colors.text,\n font: { ...font, size: 14, weight: 'normal' },\n padding: { top: 4, bottom: 8 },\n },\n legend: {\n display: paper\n ? !!props.legend\n : round || chart.series.length > 1,\n position: (paper && props.legend) || 'bottom',\n labels: {\n color: colors.text,\n font,\n boxWidth: 10,\n boxHeight: 10,\n useBorderRadius: true,\n borderRadius: 2,\n },\n },\n tooltip: {\n callbacks: {\n label: (item: TooltipItem<typeof chart.type>) => {\n const value = Number(item.raw)\n if (!round) {\n return `${item.dataset.label}: ${format(value)}`\n }\n const total = (item.dataset.data as number[])\n .filter((v) => typeof v === 'number')\n .reduce((sum, v) => sum + v, 0)\n const share = total\n ? new Intl.NumberFormat(locale.value, {\n style: 'percent',\n maximumFractionDigits: 1,\n }).format(value / total)\n : ''\n return `${item.label}: ${format(value)}${share ? ` (${share})` : ''}`\n },\n },\n },\n },\n },\n } as ChartConfiguration\n }\n\n const draw = async () => {\n await nextTick()\n if (!canvas.value || !root.value) {\n return\n }\n instance?.destroy()\n instance = new ChartJS(canvas.value, configuration())\n }\n\n /**\n * The chart as a PNG on the surface it is drawn on: the canvas itself is\n * transparent, and a transparent PNG pasted on a dark slide loses its\n * text.\n */\n const toBlob = async (): Promise<Blob | null> => {\n if (!canvas.value || !root.value) {\n return null\n }\n const copy = document.createElement('canvas')\n copy.width = canvas.value.width\n copy.height = canvas.value.height\n const context = copy.getContext('2d')\n if (!context) {\n return null\n }\n context.fillStyle = readColors().surface\n context.fillRect(0, 0, copy.width, copy.height)\n context.drawImage(canvas.value, 0, 0)\n return new Promise((resolve) => copy.toBlob(resolve, 'image/png'))\n }\n\n defineExpose({ toBlob })\n\n onMounted(draw)\n // Redrawn when the numbers or the theme change, not when the parent hands\n // over the same chart as a new object (each update of the message parses\n // the input again): that replayed the animation. The colors are read\n // again with the theme classes.\n watch(\n () =>\n JSON.stringify([\n props.isDark,\n props.paper,\n props.legend,\n props.colors,\n props.chart,\n ]),\n draw,\n )\n onBeforeUnmount(() => {\n instance?.destroy()\n instance = undefined\n })\n</script>\n\n<template>\n <div ref=\"root\" class=\"pk-chart\">\n <canvas\n ref=\"canvas\"\n role=\"img\"\n :aria-label=\"\n chart.title || chart.series.map((s) => s.name).join(', ')\n \" />\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-chart {\n position: relative;\n width: 100%;\n height: 100%;\n min-height: 0;\n }\n</style>\n"],"mappings":";;;;;;AAIA,IAAIM,GAQSC,UACT,OAAO,MAAQ,OACf,IAAI,SAAS,SAAS,+BAA+B,KACrD,IAAI,SAAS,SAAS,mCAAmC,GAuBvDC,KAAW,MACb,KAAK,MAAM,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,OAAOC,CAAK,CAAC,CAAC,IAAI,GAAG;AAG5D,SAASC,EAAU,GAAoC;CACnD,IAAMC,IAAQC,EAAS,MACnB,iDACJ;CAIA,OAHKD,IAGE;EACH,GAAGH,EAAQG,EAAM,EAAE;EACnB,GAAGH,EAAQG,EAAM,EAAE;EACnB,GAAGH,EAAQG,EAAM,EAAE;EACnB,GAAGA,EAAM,OAAO,KAAA,IAAY,IAAI,OAAOA,EAAM,EAAE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,EAAW,CAAC,CAAC,SACjCuC,EAAQ,SAAS,GAAG,GAAGD,EAAK,OAAOA,EAAK,MAAM,GAC9CC,EAAQ,UAAUnD,EAAO,OAAO,GAAG,CAAC,GAC7B,IAAI,SAAS,MAAYkD,EAAK,OAAOE,GAAS,WAAW,CAAC,KALtD;EAMf,EAEsB,CAAC,GAEvBC,EAAUN,CAAI,GAKdO,QAEQ,KAAK,UAAU;GACX5D,EAAM;GACNA,EAAM;GACNA,EAAM;GACNA,EAAM;GACNA,EAAM;EACV,CAAC,GACLqD,CACJ,GACAQ,QAAsB;GAElB,AADAtD,GAAU,QAAQ,GAClB,IAAW,KAAA;EACf,CAAC,I,UAIDhD,EAAA,GAAAC,EAOM,OAAA;GAPG,SAAA;GAAJ,KAAI4C;GAAO,OAAM;E,IAClB3C,EAKQ,UAAA;GAJA,SAAA;GAAJ,KAAI6C;GACJ,MAAK;GACJ,cAA6BL,EAAA,MAAM,SAASA,EAAA,MAAM,OAAO,KAAK,MAAMgE,EAAE,IAAI,CAAA,CAAE,KAAI,IAAA"}
|
|
1
|
+
{"version":3,"file":"PkChart-CmrpyYAS.js","names":["ChartJS","_openBlock","_createElementBlock","_createElementVNode","isRoundChart","chartValueFormatter","pixel","supportsColorRoles","channel","value","parseSrgb","match","computed","parseOnCanvas","r","g","b","a","readColor","expression","probe","resolveCssColorsIn","element","expressions","hexString","_hoisted_1","PkChart_default","defineComponent","__expose","ArcElement","BarController","BarElement","CategoryScale","DoughnutController","Legend","LinearScale","LineController","LineElement","PieController","PointElement","Title","Tooltip","props","__props","$t","useI18n","root","useTemplateRef","canvas","instance","ROLES","CATEGORICAL","strength","toward","role","TONES","INK","fallbackColors","dark","OFFICE_INK","readColors","light","hex","categorical","tones","tone","i","text","tick","grid","surface","configuration","colors","font","format","locale","chart","reducedMotion","round","paper","untoned","datasets","label","series","index","color","axisTitle","valueAxis","categoryAxis","horizontal","item","total","v","sum","share","draw","nextTick","Chart","copy","context","resolve","onMounted","watch","onBeforeUnmount","openBlock","createElementBlock","createElementVNode","s"],"sources":["../../../../packages/composable/src/cssColor.ts","../../../../packages/components/src/chat/PkChart.vue"],"sourcesContent":["/** A color as a canvas draws it: channels 0-255, alpha 0-1. */\nexport type RgbaColor = { r: number; g: number; b: number; a: number }\n\nlet scopes: Record<'light' | 'dark', HTMLElement> | undefined\nlet pixel: CanvasRenderingContext2D | null | undefined\nlet memoRevision = ''\nconst memo = new Map<string, RgbaColor>()\n\n/**\n * Whether this browser computes the color roles of the design system, which\n * derive from the palette with the relative color syntax and `color-mix()`.\n */\nexport const supportsColorRoles = () =>\n typeof CSS !== 'undefined' &&\n CSS.supports('color', 'color(from red xyz-d65 x y z)') &&\n CSS.supports('color', 'color-mix(in srgb, red 50%, blue)')\n\n/**\n * A hidden element per theme, with the classes that pin it: the colors of a\n * theme resolve inside it whatever the document's own theme is at that\n * moment, which during a switch is not yet the one being drawn.\n */\nfunction scopeOf(theme: 'light' | 'dark') {\n if (!scopes) {\n const make = (name: 'light' | 'dark') => {\n const element = document.createElement('span')\n element.className = `theme theme--${name}`\n element.setAttribute('aria-hidden', 'true')\n element.style.cssText =\n 'position:fixed;width:0;height:0;overflow:hidden;visibility:hidden;pointer-events:none'\n document.body.append(element)\n return element\n }\n scopes = { light: make('light'), dark: make('dark') }\n }\n return scopes[theme]\n}\n\nconst channel = (value: string) =>\n Math.round(Math.min(1, Math.max(0, Number(value))) * 255)\n\n/** `color(srgb r g b / a)`, the form a color mixed in sRGB computes to. */\nfunction parseSrgb(computed: string): RgbaColor | null {\n const match = computed.match(\n /^color\\(srgb (\\S+) (\\S+) (\\S+)(?: \\/ (\\S+))?\\)$/,\n )\n if (!match) {\n return null\n }\n return {\n r: channel(match[1]),\n g: channel(match[2]),\n b: channel(match[3]),\n a: match[4] === undefined ? 1 : Number(match[4]),\n }\n}\n\n/** Any other form the browser computed, read back from one pixel. */\nfunction parseOnCanvas(computed: string): RgbaColor {\n pixel ??= document\n .createElement('canvas')\n .getContext('2d', { willReadFrequently: true })\n if (!pixel) {\n return { r: 0, g: 0, b: 0, a: 1 }\n }\n pixel.clearRect(0, 0, 1, 1)\n pixel.fillStyle = computed\n pixel.fillRect(0, 0, 1, 1)\n const [r, g, b, a] = pixel.getImageData(0, 0, 1, 1).data\n return { r, g, b, a: Math.round((a / 255) * 1000) / 1000 }\n}\n\n/**\n * The color a CSS expression (`var(--color-accent-graphic)`, a `color-mix()`)\n * resolves to in a theme, in channels a canvas understands. Chart.js draws on\n * a canvas, which reads no custom property, and the design system derives its\n * roles in XYZ with the relative color syntax: the expression is mixed into\n * sRGB first, so the browser hands it back as `color(srgb ...)`.\n *\n * Results are kept while `revision` stays the same: the caller passes what\n * changes the colors, the theme's version and its stylesheet.\n */\nexport function resolveCssColor(\n expression: string,\n theme: 'light' | 'dark',\n revision: string,\n): RgbaColor {\n if (revision !== memoRevision) {\n memo.clear()\n memoRevision = revision\n }\n const id = `${theme}|${expression}`\n const known = memo.get(id)\n if (known) {\n return known\n }\n const color = readColor(scopeOf(theme), expression)\n memo.set(id, color)\n return color\n}\n\n/** The expression mixed into sRGB on `probe`, read back as channels. */\nfunction readColor(probe: HTMLElement, expression: string): RgbaColor {\n probe.style.color = `color-mix(in srgb, ${expression} 100%, transparent)`\n const computed = getComputedStyle(probe).color\n return parseSrgb(computed) ?? parseOnCanvas(computed)\n}\n\n/**\n * The colors of CSS expressions as they resolve inside `element`, with the\n * theme and the custom properties that reach it there. In the widget that is\n * its shadow root, which the theme scopes of {@link resolveCssColor}, on the\n * document's body, never see. Nothing is memoized: the caller reads again\n * when the theme changes.\n */\nexport function resolveCssColorsIn(\n element: Element,\n expressions: readonly string[],\n): RgbaColor[] {\n const probe = document.createElement('span')\n probe.setAttribute('aria-hidden', 'true')\n probe.style.cssText =\n 'position:absolute;width:0;height:0;overflow:hidden;visibility:hidden;pointer-events:none'\n element.append(probe)\n try {\n return expressions.map((expression) => readColor(probe, expression))\n } finally {\n probe.remove()\n }\n}\n\n/** `#rrggbb`, ready for the hex alpha some charts append. */\nexport const hexString = ({ r, g, b }: RgbaColor) =>\n `#${[r, g, b].map((value) => value.toString(16).padStart(2, '0')).join('')}`\n\n/** A `#rrggbb` color as an `rgba()` string with the alpha given. */\nexport function hexWithAlpha(hex: string, alpha: number) {\n const value = Number.parseInt(hex.slice(1, 7), 16)\n return `rgba(${(value >> 16) & 255}, ${(value >> 8) & 255}, ${value & 255}, ${alpha})`\n}\n\nconst channelsOf = (hex: string) => {\n const value = Number.parseInt(hex.slice(1, 7), 16)\n return [(value >> 16) & 255, (value >> 8) & 255, value & 255]\n}\n\n/** WCAG relative luminance of a `#rrggbb` color. */\nconst luminanceOf = (hex: string) => {\n const [r, g, b] = channelsOf(hex).map((channel) => {\n const value = channel / 255\n return value <= 0.03928\n ? value / 12.92\n : ((value + 0.055) / 1.055) ** 2.4\n })\n return 0.2126 * r + 0.7152 * g + 0.0722 * b\n}\n\nconst contrastOf = (a: string, b: string) => {\n const [high, low] = [luminanceOf(a), luminanceOf(b)].sort((x, y) => y - x)\n return (high + 0.05) / (low + 0.05)\n}\n\n/**\n * `color` as a chart mark on `ground`: unchanged when it already stands 3:1\n * off it, the contrast WCAG asks of a graphic (1.4.11), otherwise mixed\n * toward `toward` (white on a dark ground, black on a light one) a tenth at\n * a time until it does. An agent's own color is often black, which vanished\n * from the bars of the dark theme, and the palette's two dark teals did too.\n * A color that is not `#rgb` or `#rrggbb` is returned as it is.\n */\nexport function readableOn(color: string, ground: string, toward: string) {\n const short = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(color)\n const hex = short\n ? `#${short[1]}${short[1]}${short[2]}${short[2]}${short[3]}${short[3]}`\n : color\n if (!/^#[0-9a-f]{6}$/i.test(hex) || contrastOf(hex, ground) >= 3) {\n return color\n }\n const from = channelsOf(hex)\n const to = channelsOf(toward)\n for (let step = 1; step <= 10; step++) {\n const mixed = hexString({\n r: Math.round(from[0] + ((to[0] - from[0]) * step) / 10),\n g: Math.round(from[1] + ((to[1] - from[1]) * step) / 10),\n b: Math.round(from[2] + ((to[2] - from[2]) * step) / 10),\n a: 1,\n })\n if (contrastOf(mixed, ground) >= 3) {\n return mixed\n }\n }\n return toward\n}\n","<script setup lang=\"ts\">\n import {\n nextTick,\n onBeforeUnmount,\n onMounted,\n useTemplateRef,\n watch,\n } from 'vue'\n import { useI18n } from 'vue-i18n'\n import {\n ArcElement,\n BarController,\n BarElement,\n CategoryScale,\n Chart as ChartJS,\n DoughnutController,\n Legend,\n LinearScale,\n LineController,\n LineElement,\n PieController,\n PointElement,\n Title,\n Tooltip,\n type ChartConfiguration,\n type TooltipItem,\n } from 'chart.js'\n import {\n hexString,\n resolveCssColorsIn,\n supportsColorRoles,\n } from 'composables'\n import { isRoundChart, type Chart, type ChartTone } from 'models'\n import { chartValueFormatter } from './chartFormat'\n\n ChartJS.register(\n ArcElement,\n BarController,\n BarElement,\n CategoryScale,\n DoughnutController,\n Legend,\n LinearScale,\n LineController,\n LineElement,\n PieController,\n PointElement,\n Title,\n Tooltip,\n )\n\n /**\n * Draws a chart described as data (spec `chat-charts.md`) with Chart.js,\n * in the colors of the theme it sits in: the categorical palette from the\n * design system's graphic roles, the tones from its semantic ones. The\n * colors are read inside this element, so in the widget they are the\n * widget's own and not the host page's.\n *\n * On `paper` it draws a chart of a file in the file's viewer (F4): on the\n * white of the sheet or the page in both themes, in Office's grey ink,\n * with the file's `colors` (one per series, or one per slice), its\n * `legend` where the file puts one, and its title inside.\n */\n const props = defineProps<{\n chart: Chart\n isDark?: boolean\n paper?: boolean\n colors?: string[]\n legend?: 'top' | 'bottom' | 'left' | 'right'\n }>()\n\n const { locale, t: $t } = useI18n({ useScope: 'global' })\n\n const root = useTemplateRef<HTMLElement>('root')\n const canvas = useTemplateRef<HTMLCanvasElement>('canvas')\n let instance: ChartJS | undefined\n\n const ROLES = ['accent', 'brand', 'info'] as const\n /**\n * Twelve categorical colors, enough for the slices of a pie: the three\n * graphic roles, then the same roles toward the surface (a tint in the\n * light theme, a shade in the dark one), then toward the text, then\n * further toward the surface. Mixing the default brand, a near black\n * navy, toward the text alone gave two slices nobody could tell apart.\n * Interleaved, so neighbours never share a hue.\n */\n const CATEGORICAL = (\n [\n [100, 'surface'],\n [55, 'surface'],\n [70, 'word'],\n [30, 'surface'],\n ] as const\n ).flatMap(([strength, toward]) =>\n ROLES.map((role) =>\n strength === 100\n ? `var(--color-${role}-graphic)`\n : `color-mix(in srgb, var(--color-${role}-graphic) ${strength}%, var(--color-${toward}))`,\n ),\n )\n const TONES: Record<ChartTone, string> = {\n positive: 'var(--color-success-graphic)',\n warning: 'var(--color-warning-graphic)',\n negative: 'var(--color-danger-graphic)',\n critical:\n 'color-mix(in srgb, var(--color-danger-graphic) 60%, var(--color-word))',\n neutral:\n 'color-mix(in srgb, var(--color-word) 35%, var(--color-surface))',\n }\n const INK = [\n 'var(--color-word-2)',\n 'var(--color-word-3)',\n 'var(--color-surface-3)',\n 'var(--color-surface)',\n ]\n\n /**\n * A browser that cannot compute the design system's roles (no\n * `color-mix()` or relative colors) would draw every series in the text\n * color: it gets the dashboard's colors for the default theme instead.\n */\n const fallbackColors = (dark: boolean) => ({\n categorical: [\n '#9365ff',\n '#004775',\n '#6e66ed',\n '#003d5c',\n '#4b63d9',\n '#0058a8',\n '#285ec1',\n '#00508f',\n ],\n tones: {\n positive: '#5cb327',\n warning: '#e0a800',\n negative: '#fe4242',\n critical: '#991b1b',\n neutral: dark ? '#4b4b5c' : '#c4c9d4',\n } satisfies Record<ChartTone, string>,\n text: dark ? '#d1d5db' : '#4b5563',\n tick: dark ? '#9ca3af' : '#6b7280',\n grid: dark ? '#374151' : '#f3f4f6',\n surface: dark ? '#1f2937' : '#ffffff',\n })\n\n /** The grey Office draws a chart's text and lines in, on white. */\n const OFFICE_INK = {\n text: '#595959',\n tick: '#595959',\n grid: '#d9d9d9',\n surface: '#ffffff',\n }\n\n const readColors = () => {\n if (props.paper) {\n const light = fallbackColors(false)\n return {\n ...light,\n ...OFFICE_INK,\n categorical: props.colors?.length\n ? props.colors\n : light.categorical,\n }\n }\n if (!supportsColorRoles()) {\n return fallbackColors(!!props.isDark)\n }\n const expressions = [...CATEGORICAL, ...Object.values(TONES), ...INK]\n const hex = resolveCssColorsIn(root.value!, expressions).map(hexString)\n const categorical = hex.slice(0, CATEGORICAL.length)\n const tones = Object.fromEntries(\n Object.keys(TONES).map((tone, i) => [\n tone,\n hex[CATEGORICAL.length + i],\n ]),\n ) as Record<ChartTone, string>\n const [text, tick, grid, surface] = hex.slice(-INK.length)\n return { categorical, tones, text, tick, grid, surface }\n }\n\n const configuration = (): ChartConfiguration => {\n const { chart } = props\n const colors = readColors()\n const font = {\n family: getComputedStyle(root.value!).fontFamily,\n size: 11,\n }\n const format = chartValueFormatter(locale.value, chart.format)\n const reducedMotion = window.matchMedia(\n '(prefers-reduced-motion: reduce)',\n ).matches\n const round = isRoundChart(chart.type)\n const paper = !!props.paper\n let untoned = 0\n const datasets = chart.series.map((series, index) => {\n // A file can leave a series unnamed: numbered, as Excel does\n const label = series.name || $t('chart.series', { n: index + 1 })\n if (round) {\n return {\n label,\n data: series.values,\n backgroundColor: chart.categories.map(\n (_, i) =>\n colors.categorical[i % colors.categorical.length],\n ),\n borderColor: colors.surface,\n borderWidth: 2,\n }\n }\n const color = series.tone\n ? colors.tones[series.tone]\n : colors.categorical[untoned++ % colors.categorical.length]\n // On paper, straight lines and square bars, as Office draws them\n return chart.type === 'line'\n ? {\n label,\n data: series.values,\n borderColor: color,\n backgroundColor: color,\n borderWidth: 2,\n pointRadius: 3,\n // Smooth without overshooting a value\n cubicInterpolationMode: paper ? 'default' : 'monotone',\n // A missing value stays a gap, not a guess\n spanGaps: false,\n // A point on zero is drawn whole, hovered too (radius\n // 4 and its border); a series fading out of a\n // narrower axis is still cut at the edge\n clip: 5,\n }\n : {\n label,\n data: series.values,\n backgroundColor: color,\n borderRadius: paper ? 0 : 3,\n maxBarThickness: paper ? undefined : 48,\n }\n })\n const axisTitle = (text?: string) => ({\n display: !!text,\n text: text ?? '',\n color: colors.tick,\n font,\n })\n const valueAxis = {\n beginAtZero: true,\n // Room past the highest value (and the lowest below zero), then\n // up to the next tick, as Excel picks its axis: a top value on\n // the last tick drew its point on the edge, cut in half\n grace: '10%',\n stacked: !!chart.stacked,\n ticks: {\n color: colors.tick,\n font,\n callback: (value: string | number) => format(Number(value)),\n },\n grid: { color: colors.grid, drawTicks: false },\n border: { display: false },\n title: axisTitle(chart.valueLabel),\n }\n const categoryAxis = {\n // Each category in the middle of its band, for lines too, as\n // Excel draws them: the first point off the value axis, the last\n // off the right edge (bars have it already)\n offset: true,\n stacked: !!chart.stacked,\n ticks: { color: colors.tick, font, autoSkip: true },\n grid: { display: false },\n border: { display: false },\n title: axisTitle(chart.categoryLabel),\n }\n const horizontal = chart.type === 'bar' && !!chart.horizontal\n return {\n type: chart.type,\n data: { labels: chart.categories, datasets },\n options: {\n responsive: true,\n maintainAspectRatio: false,\n animation: reducedMotion ? false : { duration: 400 },\n indexAxis: horizontal ? 'y' : 'x',\n // The hole of a doughnut, and the slices drawn whole in a pie\n ...(round && {\n cutout: chart.type === 'doughnut' ? '55%' : 0,\n }),\n scales: round\n ? {}\n : horizontal\n ? { x: valueAxis, y: categoryAxis }\n : { x: categoryAxis, y: valueAxis },\n plugins: {\n // The card says the title of a chart in the chat; a\n // file's chart carries its own\n title: {\n display: paper && !!chart.title,\n text: chart.title ?? '',\n color: colors.text,\n font: { ...font, size: 14, weight: 'normal' },\n padding: { top: 4, bottom: 8 },\n },\n legend: {\n display: paper\n ? !!props.legend\n : round || chart.series.length > 1,\n position: (paper && props.legend) || 'bottom',\n labels: {\n color: colors.text,\n font,\n boxWidth: 10,\n boxHeight: 10,\n useBorderRadius: true,\n borderRadius: 2,\n },\n },\n tooltip: {\n callbacks: {\n label: (item: TooltipItem<typeof chart.type>) => {\n const value = Number(item.raw)\n if (!round) {\n return `${item.dataset.label}: ${format(value)}`\n }\n const total = (item.dataset.data as number[])\n .filter((v) => typeof v === 'number')\n .reduce((sum, v) => sum + v, 0)\n const share = total\n ? new Intl.NumberFormat(locale.value, {\n style: 'percent',\n maximumFractionDigits: 1,\n }).format(value / total)\n : ''\n return `${item.label}: ${format(value)}${share ? ` (${share})` : ''}`\n },\n },\n },\n },\n },\n } as ChartConfiguration\n }\n\n const draw = async () => {\n await nextTick()\n if (!canvas.value || !root.value) {\n return\n }\n instance?.destroy()\n instance = new ChartJS(canvas.value, configuration())\n }\n\n /**\n * The chart as a PNG on the surface it is drawn on: the canvas itself is\n * transparent, and a transparent PNG pasted on a dark slide loses its\n * text.\n */\n const toBlob = async (): Promise<Blob | null> => {\n if (!instance || !canvas.value || !root.value) {\n return null\n }\n // The canvas holds the frame on screen: a chart drawn a moment ago\n // (back from the table, a new theme) is still in its entry\n // animation, the lines halfway up, a pie halfway round. Finished at\n // once, the PNG has the values. `draw()` paints it now: `update()`\n // replays a hover (a tap on a phone), whose animation would put\n // the painting off to the next frame\n instance.stop()\n instance.update('none')\n instance.draw()\n const copy = document.createElement('canvas')\n copy.width = canvas.value.width\n copy.height = canvas.value.height\n const context = copy.getContext('2d')\n if (!context) {\n return null\n }\n context.fillStyle = readColors().surface\n context.fillRect(0, 0, copy.width, copy.height)\n context.drawImage(canvas.value, 0, 0)\n return new Promise((resolve) => copy.toBlob(resolve, 'image/png'))\n }\n\n defineExpose({ toBlob })\n\n onMounted(draw)\n // Redrawn when the numbers or the theme change, not when the parent hands\n // over the same chart as a new object (each update of the message parses\n // the input again): that replayed the animation. The colors are read\n // again with the theme classes.\n watch(\n () =>\n JSON.stringify([\n props.isDark,\n props.paper,\n props.legend,\n props.colors,\n props.chart,\n ]),\n draw,\n )\n onBeforeUnmount(() => {\n instance?.destroy()\n instance = undefined\n })\n</script>\n\n<template>\n <div ref=\"root\" class=\"pk-chart\">\n <canvas\n ref=\"canvas\"\n role=\"img\"\n :aria-label=\"\n chart.title || chart.series.map((s) => s.name).join(', ')\n \" />\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-ch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AM,OAAO,KAAK,MAAMgE,EAAE,IAAI,CAAA,CAAE,KAAI,IAAA"}
|
|
@@ -3,7 +3,7 @@ import { n as t } from "./useChatbotStore-Bc99inD5.js";
|
|
|
3
3
|
import { t as n } from "./useLocalizedString-Dmn92nix.js";
|
|
4
4
|
import { t as r } from "./useShortUrlResolver-KJDk7QLj.js";
|
|
5
5
|
import { t as ee } from "./PkAvatar-DwtZWSW4.js";
|
|
6
|
-
import { t as te } from "./PkChatbotViewChat-
|
|
6
|
+
import { t as te } from "./PkChatbotViewChat-8itM8FhY.js";
|
|
7
7
|
import { t as ne } from "./PkChatbotViewConversations-D7ANZR5O.js";
|
|
8
8
|
import { t as re } from "./PkChatbotViewFiles-CTDhK-3Q.js";
|
|
9
9
|
import { t as ie } from "./PkChatbotViewProfile-BMIvkLEf.js";
|
|
@@ -295,4 +295,4 @@ var Ce = { class: "pk-chatbot__header-start" }, we = ["title"], Te = { key: 1 },
|
|
|
295
295
|
});
|
|
296
296
|
export { O as t };
|
|
297
297
|
|
|
298
|
-
//# sourceMappingURL=PkChatbot-
|
|
298
|
+
//# sourceMappingURL=PkChatbot-BNcXCHJv.js.map
|