@platforma-sdk/ui-vue 1.41.19 → 1.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/.turbo/turbo-build.log +19 -19
  2. package/.turbo/turbo-type-check.log +1 -1
  3. package/CHANGELOG.md +11 -0
  4. package/dist/components/PlMultiSequenceAlignment/Legend.vue.d.ts +2 -2
  5. package/dist/components/PlMultiSequenceAlignment/Legend.vue.d.ts.map +1 -1
  6. package/dist/components/PlMultiSequenceAlignment/Legend.vue2.js +11 -11
  7. package/dist/components/PlMultiSequenceAlignment/Legend.vue3.js +8 -8
  8. package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue.d.ts +12 -6
  9. package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue.d.ts.map +1 -1
  10. package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue2.js +80 -65
  11. package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue2.js.map +1 -1
  12. package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue3.js +14 -12
  13. package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue3.js.map +1 -1
  14. package/dist/components/PlMultiSequenceAlignment/PlMultiSequenceAlignment.vue.d.ts +36 -1
  15. package/dist/components/PlMultiSequenceAlignment/PlMultiSequenceAlignment.vue.d.ts.map +1 -1
  16. package/dist/components/PlMultiSequenceAlignment/PlMultiSequenceAlignment.vue2.js +146 -111
  17. package/dist/components/PlMultiSequenceAlignment/PlMultiSequenceAlignment.vue2.js.map +1 -1
  18. package/dist/components/PlMultiSequenceAlignment/Toolbar.vue.d.ts +2 -0
  19. package/dist/components/PlMultiSequenceAlignment/Toolbar.vue.d.ts.map +1 -1
  20. package/dist/components/PlMultiSequenceAlignment/Toolbar.vue2.js +71 -68
  21. package/dist/components/PlMultiSequenceAlignment/Toolbar.vue2.js.map +1 -1
  22. package/dist/components/PlMultiSequenceAlignment/chemical-properties.d.ts +42 -6
  23. package/dist/components/PlMultiSequenceAlignment/chemical-properties.d.ts.map +1 -1
  24. package/dist/components/PlMultiSequenceAlignment/chemical-properties.js +96 -130
  25. package/dist/components/PlMultiSequenceAlignment/chemical-properties.js.map +1 -1
  26. package/dist/components/PlMultiSequenceAlignment/data.d.ts +3 -9
  27. package/dist/components/PlMultiSequenceAlignment/data.d.ts.map +1 -1
  28. package/dist/components/PlMultiSequenceAlignment/data.js +198 -212
  29. package/dist/components/PlMultiSequenceAlignment/data.js.map +1 -1
  30. package/dist/components/PlMultiSequenceAlignment/markup.d.ts +7 -5
  31. package/dist/components/PlMultiSequenceAlignment/markup.d.ts.map +1 -1
  32. package/dist/components/PlMultiSequenceAlignment/markup.js +47 -26
  33. package/dist/components/PlMultiSequenceAlignment/markup.js.map +1 -1
  34. package/dist/components/PlMultiSequenceAlignment/types.d.ts +1 -1
  35. package/dist/components/PlMultiSequenceAlignment/types.d.ts.map +1 -1
  36. package/dist/lib/ui/uikit/dist/components/PlAccordion/{ExpandTransition.vue.js → ExpandTransition.vue2.js} +1 -1
  37. package/dist/lib/ui/uikit/dist/components/PlAccordion/ExpandTransition.vue2.js.map +1 -0
  38. package/dist/lib/ui/uikit/dist/components/PlAccordion/PlAccordionSection.vue2.js +1 -1
  39. package/dist/lib/ui/uikit/dist/lib/model/common/dist/index.js.map +1 -1
  40. package/dist/lib/ui/uikit/dist/sdk/model/dist/index.js +1 -1
  41. package/dist/node_modules/.pnpm/@vueuse_core@13.3.0_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/core/index.js +111 -165
  42. package/dist/node_modules/.pnpm/@vueuse_core@13.3.0_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/core/index.js.map +1 -1
  43. package/dist/node_modules/.pnpm/@vueuse_shared@13.3.0_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/shared/index.js +1 -1
  44. package/dist/sdk/model/dist/index.js +1 -1
  45. package/package.json +5 -5
  46. package/src/components/PlMultiSequenceAlignment/Legend.vue +4 -3
  47. package/src/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue +66 -46
  48. package/src/components/PlMultiSequenceAlignment/PlMultiSequenceAlignment.vue +85 -34
  49. package/src/components/PlMultiSequenceAlignment/README.md +10 -8
  50. package/src/components/PlMultiSequenceAlignment/Toolbar.vue +4 -1
  51. package/src/components/PlMultiSequenceAlignment/chemical-properties.ts +154 -161
  52. package/src/components/PlMultiSequenceAlignment/data.ts +65 -85
  53. package/src/components/PlMultiSequenceAlignment/markup.ts +47 -15
  54. package/src/components/PlMultiSequenceAlignment/types.ts +1 -1
  55. package/dist/lib/ui/uikit/dist/components/PlAccordion/ExpandTransition.vue.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import type { ColorMap } from './types';
1
+ import type { HighlightLegend } from './types';
2
2
 
3
3
  export type Markup = { id: string; start: number; length: number }[];
4
4
 
@@ -46,27 +46,59 @@ export function markupAlignedSequence(
46
46
  return adjusted;
47
47
  }
48
48
 
49
- export function colorizeSequencesByMarkup(
50
- { markupRows, columnCount, colorMap }: {
49
+ export function highlightByMarkup(
50
+ { markupRows, columnCount, labels }: {
51
51
  markupRows: Markup[];
52
52
  columnCount: number;
53
- colorMap: ColorMap;
53
+ labels: Record<string, string>;
54
54
  },
55
- ): Promise<Blob> {
56
- const canvas = new OffscreenCanvas(columnCount, markupRows.length);
57
- const context = canvas.getContext('2d')!;
58
- for (const [rowIndex, markup] of markupRows.entries()) {
59
- for (const segment of markup) {
60
- const color = colorMap[segment.id]?.color;
61
- if (!color) continue;
62
- context.fillStyle = color;
63
- context.fillRect(segment.start, rowIndex, segment.length, 1);
55
+ ): { blob: Blob; legend: HighlightLegend } {
56
+ const linesById: Map<string, {
57
+ row: number;
58
+ start: number;
59
+ length: number;
60
+ }[]> = new Map();
61
+ for (const [row, markup] of markupRows.entries()) {
62
+ for (const { id, start, length } of markup) {
63
+ let bucket = linesById.get(id);
64
+ if (!bucket) linesById.set(id, bucket = []);
65
+ bucket.push({ row, start, length });
64
66
  }
65
67
  }
66
- return canvas.convertToBlob();
68
+ const legend: HighlightLegend = Object.fromEntries(
69
+ Object.entries(labels)
70
+ .filter(([id]) => linesById.has(id))
71
+ .map(([id, label], index) => [
72
+ id,
73
+ {
74
+ label,
75
+ color: markupColors[index % markupColors.length],
76
+ },
77
+ ]),
78
+ );
79
+ const blob = new Blob(
80
+ (function*() {
81
+ const viewBox = `0 0 ${columnCount} ${markupRows.length * 2}`;
82
+ yield `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${viewBox}" stroke-width="2" preserveAspectRatio="none">`;
83
+ for (const [id, lines] of linesById) {
84
+ const { color } = legend[id];
85
+ yield `<path stroke="${color}" d="`;
86
+ let x = 0, y = 0;
87
+ for (const { row, start, length } of lines) {
88
+ yield `m${start - x},${row * 2 + 1 - y}h${length}`;
89
+ x = start + length;
90
+ y = row * 2 + 1;
91
+ }
92
+ yield '"/>';
93
+ }
94
+ yield '</svg>';
95
+ })().toArray(),
96
+ { type: 'image/svg+xml' },
97
+ );
98
+ return { blob, legend };
67
99
  }
68
100
 
69
- export const markupColors = [
101
+ const markupColors = [
70
102
  '#E5F2FF',
71
103
  '#FFE8E8',
72
104
  '#F0EBFF',
@@ -1,3 +1,3 @@
1
- export type ColorMap = Record<string, { label: string; color: string }>;
1
+ export type HighlightLegend = Record<string, { label: string; color: string }>;
2
2
 
3
3
  export type ResidueCounts = Record<string, number>[];
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExpandTransition.vue.js","sources":["../../../../../../../../../lib/ui/uikit/src/components/PlAccordion/ExpandTransition.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nconst onStart = (el: Element) => {\n el.classList.add('expand-collapse-fix');\n (el as HTMLElement).style.setProperty('--component-height', el.scrollHeight + 'px');\n};\n\nconst onAfter = (el: Element) => {\n (el as HTMLElement).style.removeProperty('--component-height');\n el.classList.remove('expand-collapse-fix');\n};\n</script>\n\n<template>\n <Transition name=\"expand-collapse\" @enter=\"onStart\" @leave=\"onStart\" @after-enter=\"onAfter\" @after-leave=\"onAfter\">\n <slot/>\n </Transition>\n</template>\n\n<style>\n.expand-collapse-fix {\n overflow: hidden;\n}\n\n.expand-collapse-enter-active,\n.expand-collapse-leave-active {\n transition:\n height 0.2s ease-in-out,\n opacity 0.2s ease-in-out;\n height: var(--component-height);\n}\n\n.expand-collapse-enter-from,\n.expand-collapse-leave-to {\n opacity: 0.5;\n height: 0;\n}\n</style>\n"],"names":["onStart","el","onAfter"],"mappings":";;;;AACMA,UAAAA,IAAU,CAACC,MAAgB;AAC5BA,QAAA,UAAU,IAAI,qBAAqB,GACrCA,EAAmB,MAAM,YAAY,sBAAsBA,EAAG,eAAe,IAAI;AAAA,IAAA,GAG9EC,IAAU,CAACD,MAAgB;AAC9BA,QAAmB,MAAM,eAAe,oBAAoB,GAC1DA,EAAA,UAAU,OAAO,qBAAqB;AAAA,IAC3C;;;;;;;;;;;;;;;"}