@m3ui-vue/m3ui-vue 1.3.7 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/API.md +1097 -26
- package/dist/{MButton-D5eJiDza.js → MButton-DQMTIlaV.js} +2 -2
- package/dist/{MButton-D5eJiDza.js.map → MButton-DQMTIlaV.js.map} +1 -1
- package/dist/{MDialog-WqB0jewp.js → MDialog-cdgapGfZ.js} +2 -2
- package/dist/{MDialog-WqB0jewp.js.map → MDialog-cdgapGfZ.js.map} +1 -1
- package/dist/{MListItem-Cf-C2Ru-.js → MListItem-ZkSGIIrb.js} +2 -2
- package/dist/{MListItem-Cf-C2Ru-.js.map → MListItem-ZkSGIIrb.js.map} +1 -1
- package/dist/{MLoadingIndicator-D4GzEZoH.js → MLoadingIndicator-U6_oGx8z.js} +2 -2
- package/dist/{MLoadingIndicator-D4GzEZoH.js.map → MLoadingIndicator-U6_oGx8z.js.map} +1 -1
- package/dist/{MSeekBar-B19xoWE3.js → MSeekBar-DTZVizZg.js} +2 -2
- package/dist/{MSeekBar-B19xoWE3.js.map → MSeekBar-DTZVizZg.js.map} +1 -1
- package/dist/{MSlider-9RoiuebS.js → MSlider-CqJkEYRZ.js} +2 -2
- package/dist/{MSlider-9RoiuebS.js.map → MSlider-CqJkEYRZ.js.map} +1 -1
- package/dist/{MSpinner-BNF8MN-L.js → MSpinner-Btgc-0nb.js} +2 -2
- package/dist/{MSpinner-BNF8MN-L.js.map → MSpinner-Btgc-0nb.js.map} +1 -1
- package/dist/{MTextField-CuG0T3qh.js → MTextField-B6M0gJEO.js} +2 -2
- package/dist/{MTextField-CuG0T3qh.js.map → MTextField-B6M0gJEO.js.map} +1 -1
- package/dist/{MTooltip-Bv7yxngk.js → MTooltip-Dspji4XG.js} +4 -4
- package/dist/{MTooltip-Bv7yxngk.js.map → MTooltip-Dspji4XG.js.map} +1 -1
- package/dist/api.json +1 -1
- package/dist/code-editor.js +1 -1
- package/dist/components/MAudioPlayer.vue.d.ts +2 -2
- package/dist/components/MAvailabilityCalendar.vue.d.ts +83 -0
- package/dist/components/MBadge.vue.d.ts +1 -1
- package/dist/components/MBeforeAfter.vue.d.ts +61 -0
- package/dist/components/MBodyMap.vue.d.ts +70 -0
- package/dist/components/MCandlestickChart.vue.d.ts +82 -0
- package/dist/components/MCertificate.vue.d.ts +76 -0
- package/dist/components/MCreditCardInput.vue.d.ts +75 -0
- package/dist/components/MFlow.vue.d.ts +13 -0
- package/dist/components/MMortgageCalculator.vue.d.ts +83 -0
- package/dist/components/MOdontogram.vue.d.ts +86 -0
- package/dist/components/MOrderBook.vue.d.ts +89 -0
- package/dist/components/MOrderTicket.vue.d.ts +91 -0
- package/dist/components/MPosKeypad.vue.d.ts +84 -0
- package/dist/components/MProductConfigurator.vue.d.ts +136 -0
- package/dist/components/MQuiz.vue.d.ts +102 -0
- package/dist/components/MReceipt.vue.d.ts +93 -0
- package/dist/components/MSeatMap.vue.d.ts +131 -0
- package/dist/components/MSeekBar.vue.d.ts +1 -1
- package/dist/components/MSlider.vue.d.ts +2 -2
- package/dist/components/MSplitter.vue.d.ts +1 -1
- package/dist/components/MTicket.vue.d.ts +83 -0
- package/dist/components/MTour.vue.d.ts +52 -2
- package/dist/components/MVideoPlayer.vue.d.ts +1 -1
- package/dist/components/MVitalsChart.vue.d.ts +73 -0
- package/dist/composables/_printElement.d.ts +9 -0
- package/dist/composables/cardBrand.d.ts +25 -0
- package/dist/composables/flowPaths.d.ts +11 -3
- package/dist/composables/mortgage.d.ts +37 -0
- package/dist/composables/useFlow.d.ts +4 -0
- package/dist/composables/useLocale.d.ts +131 -0
- package/dist/draw.js +2 -2
- package/dist/flow.d.ts +1 -1
- package/dist/flow.js +526 -434
- package/dist/flow.js.map +1 -1
- package/dist/{flowPaths-DzW-aiET.js → flowPaths-CcWOKY4Z.js} +5 -5
- package/dist/flowPaths-CcWOKY4Z.js.map +1 -0
- package/dist/gantt.js +2 -2
- package/dist/index.d.ts +35 -0
- package/dist/locales/index.js +924 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +8393 -3613
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +5 -5
- package/dist/media.js +4 -4
- package/dist/pdf.js +4 -4
- package/dist/rich-text-editor.js +4 -4
- package/dist/styles.css +1 -1
- package/dist/{useLocale-D2ucaY-l.js → useLocale-DLKJIRFi.js} +133 -2
- package/dist/useLocale-DLKJIRFi.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/MAvailabilityCalendar.test.ts +85 -0
- package/src/__tests__/MBeforeAfter.test.ts +79 -0
- package/src/__tests__/MBodyMap.test.ts +60 -0
- package/src/__tests__/MCandlestickChart.test.ts +66 -0
- package/src/__tests__/MCertificate.test.ts +32 -0
- package/src/__tests__/MCreditCardInput.test.ts +122 -0
- package/src/__tests__/MFlow.test.ts +69 -0
- package/src/__tests__/MMortgageCalculator.test.ts +49 -0
- package/src/__tests__/MOdontogram.test.ts +93 -0
- package/src/__tests__/MOrderBook.test.ts +66 -0
- package/src/__tests__/MOrderTicket.test.ts +68 -0
- package/src/__tests__/MPosKeypad.test.ts +116 -0
- package/src/__tests__/MProductConfigurator.test.ts +73 -0
- package/src/__tests__/MQuiz.test.ts +104 -0
- package/src/__tests__/MReceipt.test.ts +52 -0
- package/src/__tests__/MSeatMap.test.ts +76 -0
- package/src/__tests__/MTicket.test.ts +38 -0
- package/src/__tests__/MTour.test.ts +102 -0
- package/src/__tests__/MVitalsChart.test.ts +49 -0
- package/src/__tests__/mortgage.test.ts +25 -0
- package/src/__tests__/ssr.test.ts +11 -0
- package/src/components/MAvailabilityCalendar.vue +460 -0
- package/src/components/MBeforeAfter.vue +248 -0
- package/src/components/MBodyMap.vue +266 -0
- package/src/components/MCandlestickChart.vue +479 -0
- package/src/components/MCertificate.vue +351 -0
- package/src/components/MCreditCardInput.vue +351 -0
- package/src/components/MFlow.vue +117 -17
- package/src/components/MMortgageCalculator.vue +258 -0
- package/src/components/MOdontogram.vue +462 -0
- package/src/components/MOrderBook.vue +287 -0
- package/src/components/MOrderTicket.vue +217 -0
- package/src/components/MPosKeypad.vue +406 -0
- package/src/components/MProductConfigurator.vue +412 -0
- package/src/components/MQuiz.vue +531 -0
- package/src/components/MReceipt.vue +249 -0
- package/src/components/MSeatMap.vue +431 -0
- package/src/components/MTicket.vue +209 -0
- package/src/components/MTour.vue +145 -27
- package/src/components/MVitalsChart.vue +303 -0
- package/src/composables/_printElement.ts +36 -0
- package/src/composables/cardBrand.ts +104 -0
- package/src/composables/flowPaths.ts +16 -7
- package/src/composables/mortgage.ts +70 -0
- package/src/composables/useFlow.ts +4 -0
- package/src/composables/useLocale.ts +277 -0
- package/src/flow.ts +1 -1
- package/src/index.ts +35 -0
- package/src/locales/de.ts +131 -0
- package/src/locales/es.ts +131 -0
- package/src/locales/fr.ts +131 -0
- package/src/locales/ja.ts +131 -0
- package/src/locales/ko.ts +131 -0
- package/src/locales/pt.ts +131 -0
- package/src/locales/zh.ts +131 -0
- package/dist/flowPaths-DzW-aiET.js.map +0 -1
- package/dist/useLocale-D2ucaY-l.js.map +0 -1
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/** One reading of a vital sign. A pair is a range reading such as blood pressure: `[systolic, diastolic]`. */
|
|
3
|
+
export interface VitalReading {
|
|
4
|
+
time: Date | string | number
|
|
5
|
+
value: number | [number, number]
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** A vital sign: its readings, unit and normal range. */
|
|
9
|
+
export interface VitalSeries {
|
|
10
|
+
key: string
|
|
11
|
+
label: string
|
|
12
|
+
unit?: string
|
|
13
|
+
/** Line / point color (any CSS color). Defaults to the primary color */
|
|
14
|
+
color?: string
|
|
15
|
+
decimals?: number
|
|
16
|
+
/**
|
|
17
|
+
* Normal range, drawn as a band. For pair readings give one range per value:
|
|
18
|
+
* `[[90, 120], [60, 80]]` for systolic and diastolic
|
|
19
|
+
*/
|
|
20
|
+
normal?: [number, number] | [[number, number], [number, number]]
|
|
21
|
+
/** Fixed axis range; by default it fits the readings and the normal band */
|
|
22
|
+
domain?: [number, number]
|
|
23
|
+
data: VitalReading[]
|
|
24
|
+
}
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<script setup lang="ts">
|
|
28
|
+
/**
|
|
29
|
+
* A vitals flowsheet: one row per vital sign (heart rate, blood pressure, SpO₂, temperature, respiratory rate…)
|
|
30
|
+
* over a shared time axis, each with its normal range as a band, readings outside it in the error color, and the
|
|
31
|
+
* latest value (with a High / Low tag) beside the row. Blood pressure and other pair readings are drawn as bars from
|
|
32
|
+
* the lower to the upper value. Hovering (or the arrow keys) moves a crosshair across every row at once.
|
|
33
|
+
*
|
|
34
|
+
* @slot label Replaces a row's label column. Slot props: `{ series, reading, status }`
|
|
35
|
+
* @event hover The time under the crosshair (epoch ms), or null when it leaves
|
|
36
|
+
*/
|
|
37
|
+
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
|
38
|
+
import { useLocale } from '../composables/useLocale'
|
|
39
|
+
|
|
40
|
+
const locale = useLocale()
|
|
41
|
+
|
|
42
|
+
const props = withDefaults(
|
|
43
|
+
defineProps<{
|
|
44
|
+
series: VitalSeries[]
|
|
45
|
+
/** Height of each row's plot, in px */
|
|
46
|
+
rowHeight?: number
|
|
47
|
+
/** Start of the time axis (defaults to the first reading) */
|
|
48
|
+
from?: Date | string | number
|
|
49
|
+
/** End of the time axis (defaults to the last reading) */
|
|
50
|
+
to?: Date | string | number
|
|
51
|
+
}>(),
|
|
52
|
+
{ rowHeight: 64 },
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
const emit = defineEmits<{ hover: [number | null] }>()
|
|
56
|
+
|
|
57
|
+
const toMs = (t: Date | string | number) => (t instanceof Date ? t.getTime() : typeof t === 'number' ? t : Date.parse(t))
|
|
58
|
+
|
|
59
|
+
const rootEl = ref<HTMLElement | null>(null)
|
|
60
|
+
const width = ref(640)
|
|
61
|
+
let ro: ResizeObserver | null = null
|
|
62
|
+
onMounted(() => {
|
|
63
|
+
if (!rootEl.value) return
|
|
64
|
+
width.value = rootEl.value.clientWidth || 640
|
|
65
|
+
if (typeof ResizeObserver !== 'undefined') {
|
|
66
|
+
ro = new ResizeObserver(([e]) => (width.value = e!.contentRect.width || width.value))
|
|
67
|
+
ro.observe(rootEl.value)
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
onBeforeUnmount(() => ro?.disconnect())
|
|
71
|
+
|
|
72
|
+
const narrow = computed(() => width.value < 480)
|
|
73
|
+
const LABEL_W = computed(() => (narrow.value ? 0 : Math.min(150, Math.round(width.value * 0.3))))
|
|
74
|
+
const PAD = 8
|
|
75
|
+
const plotW = computed(() => Math.max(60, width.value - LABEL_W.value - PAD * 2))
|
|
76
|
+
|
|
77
|
+
const sorted = computed(() =>
|
|
78
|
+
props.series.map((s) => ({ ...s, data: [...s.data].sort((a, b) => toMs(a.time) - toMs(b.time)) })),
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
const times = computed(() => {
|
|
82
|
+
const set = new Set<number>()
|
|
83
|
+
for (const s of sorted.value) for (const r of s.data) set.add(toMs(r.time))
|
|
84
|
+
return [...set].sort((a, b) => a - b)
|
|
85
|
+
})
|
|
86
|
+
const t0 = computed(() => (props.from !== undefined ? toMs(props.from) : times.value[0] ?? 0))
|
|
87
|
+
const t1 = computed(() => {
|
|
88
|
+
const end = props.to !== undefined ? toMs(props.to) : times.value.at(-1) ?? 1
|
|
89
|
+
return end === t0.value ? end + 1 : end
|
|
90
|
+
})
|
|
91
|
+
const x = (t: number) => PAD + ((t - t0.value) / (t1.value - t0.value)) * plotW.value
|
|
92
|
+
|
|
93
|
+
const ranges = (s: VitalSeries): [number, number][] => {
|
|
94
|
+
if (!s.normal) return []
|
|
95
|
+
return Array.isArray(s.normal[0]) ? (s.normal as [[number, number], [number, number]]) : [s.normal as [number, number]]
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function domainOf(s: VitalSeries): [number, number] {
|
|
99
|
+
if (s.domain) return s.domain
|
|
100
|
+
let lo = Infinity
|
|
101
|
+
let hi = -Infinity
|
|
102
|
+
for (const r of s.data) for (const v of Array.isArray(r.value) ? r.value : [r.value]) {
|
|
103
|
+
lo = Math.min(lo, v)
|
|
104
|
+
hi = Math.max(hi, v)
|
|
105
|
+
}
|
|
106
|
+
for (const [a, b] of ranges(s)) {
|
|
107
|
+
lo = Math.min(lo, a)
|
|
108
|
+
hi = Math.max(hi, b)
|
|
109
|
+
}
|
|
110
|
+
if (!isFinite(lo)) return [0, 1]
|
|
111
|
+
const pad = (hi - lo || Math.abs(hi) || 1) * 0.12
|
|
112
|
+
return [lo - pad, hi + pad]
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function yFor(s: VitalSeries) {
|
|
116
|
+
const [lo, hi] = domainOf(s)
|
|
117
|
+
const h = props.rowHeight
|
|
118
|
+
return (v: number) => 4 + (1 - (v - lo) / (hi - lo)) * (h - 8)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** 'high' | 'low' | 'normal' for a reading against the series' normal range(s) */
|
|
122
|
+
function statusOf(s: VitalSeries, r: VitalReading | undefined): 'high' | 'low' | 'normal' {
|
|
123
|
+
if (!r) return 'normal'
|
|
124
|
+
const rs = ranges(s)
|
|
125
|
+
const vals = Array.isArray(r.value) ? r.value : [r.value]
|
|
126
|
+
let st: 'high' | 'low' | 'normal' = 'normal'
|
|
127
|
+
vals.forEach((v, i) => {
|
|
128
|
+
const range = rs[Math.min(i, rs.length - 1)]
|
|
129
|
+
if (!range) return
|
|
130
|
+
if (v > range[1]) st = 'high'
|
|
131
|
+
else if (v < range[0] && st !== 'high') st = 'low'
|
|
132
|
+
})
|
|
133
|
+
return st
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function fmt(s: VitalSeries, v: number | [number, number]) {
|
|
137
|
+
const f = new Intl.NumberFormat(locale.lang, { maximumFractionDigits: s.decimals ?? 0, minimumFractionDigits: s.decimals ?? 0 })
|
|
138
|
+
return Array.isArray(v) ? `${f.format(v[0])}/${f.format(v[1])}` : f.format(v)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const rows = computed(() =>
|
|
142
|
+
sorted.value.map((s) => {
|
|
143
|
+
const y = yFor(s)
|
|
144
|
+
const color = s.color ?? 'var(--color-primary)'
|
|
145
|
+
const pair = s.data.some((r) => Array.isArray(r.value))
|
|
146
|
+
const bands = ranges(s).map(([a, b]) => ({ y: y(b), h: Math.max(1, y(a) - y(b)) }))
|
|
147
|
+
const lines: string[] = []
|
|
148
|
+
if (pair) {
|
|
149
|
+
for (const k of [0, 1]) lines.push(s.data.map((r, i) => `${i ? 'L' : 'M'}${x(toMs(r.time)).toFixed(1)} ${y((r.value as [number, number])[k]!).toFixed(1)}`).join(''))
|
|
150
|
+
} else {
|
|
151
|
+
lines.push(s.data.map((r, i) => `${i ? 'L' : 'M'}${x(toMs(r.time)).toFixed(1)} ${y(r.value as number).toFixed(1)}`).join(''))
|
|
152
|
+
}
|
|
153
|
+
const points = s.data.map((r) => {
|
|
154
|
+
const t = toMs(r.time)
|
|
155
|
+
const out = statusOf(s, r) !== 'normal'
|
|
156
|
+
return Array.isArray(r.value)
|
|
157
|
+
? { t, x: x(t), y1: y(r.value[0]), y2: y(r.value[1]), out }
|
|
158
|
+
: { t, x: x(t), y: y(r.value), out }
|
|
159
|
+
})
|
|
160
|
+
return { s, color, bands, lines, points, pair }
|
|
161
|
+
}),
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
// ── crosshair ──
|
|
165
|
+
const hoverT = ref<number | null>(null)
|
|
166
|
+
function readingAt(s: VitalSeries, t: number | null): VitalReading | undefined {
|
|
167
|
+
if (t === null) return s.data.at(-1)
|
|
168
|
+
// the latest reading at or before the hovered time
|
|
169
|
+
let best: VitalReading | undefined
|
|
170
|
+
for (const r of s.data) if (toMs(r.time) <= t) best = r
|
|
171
|
+
return best
|
|
172
|
+
}
|
|
173
|
+
function nearestTime(px: number) {
|
|
174
|
+
const t = t0.value + ((px - PAD) / plotW.value) * (t1.value - t0.value)
|
|
175
|
+
let best = times.value[0] ?? null
|
|
176
|
+
for (const tt of times.value) if (Math.abs(tt - t) < Math.abs((best ?? 0) - t)) best = tt
|
|
177
|
+
return best
|
|
178
|
+
}
|
|
179
|
+
function setHover(t: number | null) {
|
|
180
|
+
if (t !== hoverT.value) emit('hover', t)
|
|
181
|
+
hoverT.value = t
|
|
182
|
+
}
|
|
183
|
+
function onPointerMove(e: PointerEvent) {
|
|
184
|
+
const svg = (e.currentTarget as Element).getBoundingClientRect()
|
|
185
|
+
setHover(nearestTime(e.clientX - svg.left))
|
|
186
|
+
}
|
|
187
|
+
function onKeydown(e: KeyboardEvent) {
|
|
188
|
+
if (!times.value.length) return
|
|
189
|
+
const i = hoverT.value === null ? times.value.length : times.value.indexOf(hoverT.value)
|
|
190
|
+
if (e.key === 'ArrowLeft') setHover(times.value[Math.max(0, i - 1)]!)
|
|
191
|
+
else if (e.key === 'ArrowRight') setHover(times.value[Math.min(times.value.length - 1, i + 1)]!)
|
|
192
|
+
else if (e.key === 'Escape') setHover(null)
|
|
193
|
+
else return
|
|
194
|
+
e.preventDefault()
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// ── time axis ──
|
|
198
|
+
const spanMs = computed(() => t1.value - t0.value)
|
|
199
|
+
const tickFmt = computed(() =>
|
|
200
|
+
new Intl.DateTimeFormat(locale.lang, spanMs.value <= 2 * 86_400_000 ? { hour: '2-digit', minute: '2-digit' } : { day: 'numeric', month: 'short' }),
|
|
201
|
+
)
|
|
202
|
+
const fullFmt = computed(() => new Intl.DateTimeFormat(locale.lang, { dateStyle: 'medium', timeStyle: 'short' }))
|
|
203
|
+
const ticks = computed(() => {
|
|
204
|
+
const n = Math.max(2, Math.floor(plotW.value / 90))
|
|
205
|
+
return Array.from({ length: n + 1 }, (_, i) => t0.value + (spanMs.value * i) / n)
|
|
206
|
+
})
|
|
207
|
+
</script>
|
|
208
|
+
|
|
209
|
+
<template>
|
|
210
|
+
<div
|
|
211
|
+
ref="rootEl"
|
|
212
|
+
class="m3-vitals text-on-surface outline-none"
|
|
213
|
+
tabindex="0"
|
|
214
|
+
@keydown="onKeydown"
|
|
215
|
+
>
|
|
216
|
+
<p v-if="!times.length" class="py-6 text-center text-body-medium text-on-surface-variant">{{ locale.vitalsNoData }}</p>
|
|
217
|
+
<template v-else>
|
|
218
|
+
<div
|
|
219
|
+
v-for="row in rows"
|
|
220
|
+
:key="row.s.key"
|
|
221
|
+
class="flex border-b border-outline-variant"
|
|
222
|
+
:class="narrow ? 'flex-col pt-2' : 'items-center'"
|
|
223
|
+
:data-vital="row.s.key"
|
|
224
|
+
>
|
|
225
|
+
<div class="shrink-0 pe-2" :style="narrow ? undefined : { width: `${LABEL_W}px` }">
|
|
226
|
+
<slot name="label" :series="row.s" :reading="readingAt(row.s, hoverT)" :status="statusOf(row.s, readingAt(row.s, hoverT))">
|
|
227
|
+
<div class="flex items-baseline gap-2" :class="narrow ? '' : 'flex-col gap-0'">
|
|
228
|
+
<span class="text-label-large text-on-surface-variant">{{ row.s.label }}</span>
|
|
229
|
+
<span v-if="readingAt(row.s, hoverT)" class="flex items-baseline gap-1">
|
|
230
|
+
<span
|
|
231
|
+
class="text-title-large font-medium tabular-nums"
|
|
232
|
+
:class="statusOf(row.s, readingAt(row.s, hoverT)) !== 'normal' ? 'text-error' : ''"
|
|
233
|
+
data-value
|
|
234
|
+
>{{ fmt(row.s, readingAt(row.s, hoverT)!.value) }}</span>
|
|
235
|
+
<span v-if="row.s.unit" class="text-body-small text-on-surface-variant">{{ row.s.unit }}</span>
|
|
236
|
+
<span
|
|
237
|
+
v-if="statusOf(row.s, readingAt(row.s, hoverT)) !== 'normal'"
|
|
238
|
+
class="rounded-xs bg-error-container px-1 text-label-small font-medium text-on-error-container"
|
|
239
|
+
data-status
|
|
240
|
+
>{{ statusOf(row.s, readingAt(row.s, hoverT)) === 'high' ? locale.vitalsHigh : locale.vitalsLow }}</span>
|
|
241
|
+
</span>
|
|
242
|
+
</div>
|
|
243
|
+
</slot>
|
|
244
|
+
</div>
|
|
245
|
+
<svg
|
|
246
|
+
:width="plotW + PAD * 2"
|
|
247
|
+
:height="rowHeight"
|
|
248
|
+
class="block shrink-0 touch-pan-y"
|
|
249
|
+
aria-hidden="true"
|
|
250
|
+
@pointermove="onPointerMove"
|
|
251
|
+
@pointerdown="onPointerMove"
|
|
252
|
+
@pointerleave="(e) => e.pointerType === 'mouse' && setHover(null)"
|
|
253
|
+
>
|
|
254
|
+
<rect v-for="(b, i) in row.bands" :key="i" :x="PAD" :y="b.y" :width="plotW" :height="b.h" class="fill-success" fill-opacity="0.12" data-band />
|
|
255
|
+
<path v-for="(d, i) in row.lines" :key="i" :d="d" fill="none" :stroke="row.color" stroke-width="1.5" :stroke-opacity="row.pair ? 0.5 : 1" />
|
|
256
|
+
<template v-for="p in row.points" :key="p.t">
|
|
257
|
+
<g v-if="'y1' in p">
|
|
258
|
+
<line :x1="p.x" :x2="p.x" :y1="p.y1" :y2="p.y2" :stroke="p.out ? 'var(--color-error)' : row.color" stroke-width="3" stroke-linecap="round" />
|
|
259
|
+
<line :x1="p.x - 4" :x2="p.x + 4" :y1="p.y1" :y2="p.y1" :stroke="p.out ? 'var(--color-error)' : row.color" stroke-width="2" />
|
|
260
|
+
<line :x1="p.x - 4" :x2="p.x + 4" :y1="p.y2" :y2="p.y2" :stroke="p.out ? 'var(--color-error)' : row.color" stroke-width="2" />
|
|
261
|
+
</g>
|
|
262
|
+
<circle
|
|
263
|
+
v-else
|
|
264
|
+
:cx="p.x"
|
|
265
|
+
:cy="p.y"
|
|
266
|
+
:r="p.t === hoverT ? 5 : 3.5"
|
|
267
|
+
:fill="p.out ? 'var(--color-error)' : row.color"
|
|
268
|
+
class="stroke-surface"
|
|
269
|
+
stroke-width="1.5"
|
|
270
|
+
:data-out="p.out || undefined"
|
|
271
|
+
/>
|
|
272
|
+
</template>
|
|
273
|
+
<line v-if="hoverT !== null" :x1="x(hoverT)" :x2="x(hoverT)" y1="0" :y2="rowHeight" class="stroke-on-surface-variant" stroke-dasharray="3 3" />
|
|
274
|
+
</svg>
|
|
275
|
+
</div>
|
|
276
|
+
|
|
277
|
+
<div class="flex" :style="narrow ? undefined : { paddingInlineStart: `${LABEL_W}px` }">
|
|
278
|
+
<svg :width="plotW + PAD * 2" height="22" class="block" aria-hidden="true">
|
|
279
|
+
<text
|
|
280
|
+
v-for="(t, i) in ticks"
|
|
281
|
+
:key="t"
|
|
282
|
+
:x="x(t)"
|
|
283
|
+
y="15"
|
|
284
|
+
:text-anchor="i === 0 ? 'start' : i === ticks.length - 1 ? 'end' : 'middle'"
|
|
285
|
+
class="fill-on-surface-variant text-[11px]"
|
|
286
|
+
>{{ tickFmt.format(t) }}</text>
|
|
287
|
+
</svg>
|
|
288
|
+
</div>
|
|
289
|
+
<p class="mt-1 flex min-h-5 items-center gap-3 text-body-small text-on-surface-variant">
|
|
290
|
+
<span class="flex items-center gap-1"><span class="h-2.5 w-4 rounded-[2px] bg-success/20" />{{ locale.vitalsNormal }}</span>
|
|
291
|
+
<span v-if="hoverT !== null" class="ms-auto tabular-nums" data-hover-time>{{ fullFmt.format(hoverT) }}</span>
|
|
292
|
+
</p>
|
|
293
|
+
</template>
|
|
294
|
+
</div>
|
|
295
|
+
</template>
|
|
296
|
+
|
|
297
|
+
<style>
|
|
298
|
+
.m3-vitals:focus-visible {
|
|
299
|
+
outline: 3px solid var(--color-secondary);
|
|
300
|
+
outline-offset: 2px;
|
|
301
|
+
border-radius: 4px;
|
|
302
|
+
}
|
|
303
|
+
</style>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prints one element on its own: copies it with the page's stylesheets into a hidden iframe and prints that frame,
|
|
3
|
+
* so the rest of the page (navigation, other content) never reaches the paper. Always prints the light theme.
|
|
4
|
+
* Internal: used by MReceipt and MCertificate.
|
|
5
|
+
*/
|
|
6
|
+
export function printElement(el: HTMLElement, { page, css = '' }: { page: string; css?: string }) {
|
|
7
|
+
if (typeof document === 'undefined') return
|
|
8
|
+
const frame = document.createElement('iframe')
|
|
9
|
+
frame.setAttribute('aria-hidden', 'true')
|
|
10
|
+
frame.style.cssText = 'position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden'
|
|
11
|
+
document.body.appendChild(frame)
|
|
12
|
+
const doc = frame.contentDocument
|
|
13
|
+
const win = frame.contentWindow
|
|
14
|
+
if (!doc || !win) return frame.remove()
|
|
15
|
+
const styles = Array.from(document.querySelectorAll('style, link[rel="stylesheet"]'))
|
|
16
|
+
.map((n) => n.outerHTML)
|
|
17
|
+
.join('')
|
|
18
|
+
const html = document.documentElement
|
|
19
|
+
const palette = html.getAttribute('data-palette')
|
|
20
|
+
doc.open()
|
|
21
|
+
doc.write(
|
|
22
|
+
`<!doctype html><html class="${html.className.replace(/\bdark\b/, '')}"${palette ? ` data-palette="${palette}"` : ''}>` +
|
|
23
|
+
`<head><meta charset="utf-8"><base href="${document.baseURI}">${styles}` +
|
|
24
|
+
`<style>@page{size:${page};margin:0}html,body{margin:0;background:#fff;-webkit-print-color-adjust:exact;print-color-adjust:exact}${css}</style>` +
|
|
25
|
+
`</head><body>${el.outerHTML}</body></html>`,
|
|
26
|
+
)
|
|
27
|
+
doc.close()
|
|
28
|
+
const go = () => {
|
|
29
|
+
win.focus()
|
|
30
|
+
win.print()
|
|
31
|
+
setTimeout(() => frame.remove(), 1000)
|
|
32
|
+
}
|
|
33
|
+
// Wait for the copied stylesheets before printing
|
|
34
|
+
if (doc.readyState === 'complete') setTimeout(go, 50)
|
|
35
|
+
else frame.addEventListener('load', go, { once: true })
|
|
36
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/** Card networks recognized by `detectCardBrand()` and `MCreditCardInput`. */
|
|
2
|
+
export type CardBrand =
|
|
3
|
+
| 'visa'
|
|
4
|
+
| 'mastercard'
|
|
5
|
+
| 'amex'
|
|
6
|
+
| 'discover'
|
|
7
|
+
| 'diners'
|
|
8
|
+
| 'jcb'
|
|
9
|
+
| 'unionpay'
|
|
10
|
+
| 'maestro'
|
|
11
|
+
| 'naranja'
|
|
12
|
+
| 'cabal'
|
|
13
|
+
| 'unknown'
|
|
14
|
+
|
|
15
|
+
export interface CardBrandInfo {
|
|
16
|
+
brand: CardBrand
|
|
17
|
+
/** Display name, e.g. "Mastercard" */
|
|
18
|
+
name: string
|
|
19
|
+
/** Valid lengths of the number, in digits */
|
|
20
|
+
lengths: number[]
|
|
21
|
+
/** Digit counts after which a space is shown, e.g. [4, 8, 12] → `4242 4242 4242 4242` */
|
|
22
|
+
gaps: number[]
|
|
23
|
+
/** Length of the security code */
|
|
24
|
+
cvcLength: number
|
|
25
|
+
/** Whether the number has to pass the Luhn checksum */
|
|
26
|
+
luhn: boolean
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const BRANDS: (CardBrandInfo & { pattern: RegExp })[] = [
|
|
30
|
+
// Specific local networks go before the broad ranges they sit in
|
|
31
|
+
{ brand: 'naranja', name: 'Naranja', pattern: /^589562/, lengths: [16], gaps: [4, 8, 12], cvcLength: 3, luhn: false },
|
|
32
|
+
{ brand: 'cabal', name: 'Cabal', pattern: /^(60420[1-9]|6042[1-9]\d|6043\d\d|604400|589657)/, lengths: [16], gaps: [4, 8, 12], cvcLength: 3, luhn: true },
|
|
33
|
+
{ brand: 'visa', name: 'Visa', pattern: /^4/, lengths: [13, 16], gaps: [4, 8, 12], cvcLength: 3, luhn: true },
|
|
34
|
+
{ brand: 'mastercard', name: 'Mastercard', pattern: /^(5[1-5]|222[1-9]|22[3-9]\d|2[3-6]\d\d|27[01]\d|2720)/, lengths: [16], gaps: [4, 8, 12], cvcLength: 3, luhn: true },
|
|
35
|
+
{ brand: 'amex', name: 'American Express', pattern: /^3[47]/, lengths: [15], gaps: [4, 10], cvcLength: 4, luhn: true },
|
|
36
|
+
{ brand: 'diners', name: 'Diners Club', pattern: /^(36|38|30[0-5])/, lengths: [14, 16, 19], gaps: [4, 10], cvcLength: 3, luhn: true },
|
|
37
|
+
{ brand: 'jcb', name: 'JCB', pattern: /^35(2[89]|[3-8])/, lengths: [16, 17, 18, 19], gaps: [4, 8, 12], cvcLength: 3, luhn: true },
|
|
38
|
+
{ brand: 'discover', name: 'Discover', pattern: /^(6011|65|64[4-9])/, lengths: [16, 19], gaps: [4, 8, 12], cvcLength: 3, luhn: true },
|
|
39
|
+
{ brand: 'unionpay', name: 'UnionPay', pattern: /^62/, lengths: [16, 17, 18, 19], gaps: [4, 8, 12], cvcLength: 3, luhn: false },
|
|
40
|
+
{ brand: 'maestro', name: 'Maestro', pattern: /^(5018|5020|5038|5893|6304|6759|676[1-3])/, lengths: [12, 13, 14, 15, 16, 17, 18, 19], gaps: [4, 8, 12], cvcLength: 3, luhn: true },
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
const UNKNOWN: CardBrandInfo = { brand: 'unknown', name: '', lengths: [12, 13, 14, 15, 16], gaps: [4, 8, 12], cvcLength: 3, luhn: true }
|
|
44
|
+
|
|
45
|
+
/** Card network of a (partial) number, from its leading digits. Spaces and dashes are ignored. */
|
|
46
|
+
export function detectCardBrand(number: string): CardBrandInfo {
|
|
47
|
+
const digits = number.replace(/\D/g, '')
|
|
48
|
+
if (!digits) return UNKNOWN
|
|
49
|
+
const hit = BRANDS.find((b) => b.pattern.test(digits))
|
|
50
|
+
if (!hit) return UNKNOWN
|
|
51
|
+
const { pattern: _pattern, ...info } = hit
|
|
52
|
+
return info
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Luhn (mod 10) checksum of a card number. Spaces and dashes are ignored. */
|
|
56
|
+
export function luhnCheck(number: string): boolean {
|
|
57
|
+
const digits = number.replace(/\D/g, '')
|
|
58
|
+
if (!digits) return false
|
|
59
|
+
let sum = 0
|
|
60
|
+
let double = false
|
|
61
|
+
for (let i = digits.length - 1; i >= 0; i--) {
|
|
62
|
+
let d = digits.charCodeAt(i) - 48
|
|
63
|
+
if (double) {
|
|
64
|
+
d *= 2
|
|
65
|
+
if (d > 9) d -= 9
|
|
66
|
+
}
|
|
67
|
+
sum += d
|
|
68
|
+
double = !double
|
|
69
|
+
}
|
|
70
|
+
return sum % 10 === 0
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Formats digits with the brand's gaps: `"4242424242424242"` → `"4242 4242 4242 4242"`. */
|
|
74
|
+
export function formatCardNumber(number: string): string {
|
|
75
|
+
const digits = number.replace(/\D/g, '')
|
|
76
|
+
const { gaps } = detectCardBrand(digits)
|
|
77
|
+
let out = ''
|
|
78
|
+
for (let i = 0; i < digits.length; i++) {
|
|
79
|
+
if (i > 0 && gaps.includes(i)) out += ' '
|
|
80
|
+
out += digits[i]
|
|
81
|
+
}
|
|
82
|
+
return out
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Whether a card number is complete and valid for its brand (length, plus Luhn where the network uses it). */
|
|
86
|
+
export function isValidCardNumber(number: string): boolean {
|
|
87
|
+
const digits = number.replace(/\D/g, '')
|
|
88
|
+
const info = detectCardBrand(digits)
|
|
89
|
+
if (!info.lengths.includes(digits.length)) return false
|
|
90
|
+
return !info.luhn || luhnCheck(digits)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Whether an `MM/YY` expiry is well formed and not in the past (a card is valid through its expiry month). */
|
|
94
|
+
export function isValidExpiry(expiry: string, now: Date = new Date()): boolean {
|
|
95
|
+
const m = /^(\d{2})\/(\d{2})$/.exec(expiry.trim())
|
|
96
|
+
if (!m) return false
|
|
97
|
+
const month = Number(m[1])
|
|
98
|
+
const year = 2000 + Number(m[2])
|
|
99
|
+
if (month < 1 || month > 12) return false
|
|
100
|
+
const thisYear = now.getFullYear()
|
|
101
|
+
const thisMonth = now.getMonth() + 1
|
|
102
|
+
if (year > thisYear + 20) return false
|
|
103
|
+
return year > thisYear || (year === thisYear && month >= thisMonth)
|
|
104
|
+
}
|
|
@@ -80,7 +80,16 @@ export function getBezierPath(p: FlowEdgePathParams & { curvature?: number }): F
|
|
|
80
80
|
type Pt = [number, number]
|
|
81
81
|
|
|
82
82
|
/** The corners of an orthogonal route between the ends, leaving and arriving square to the sides */
|
|
83
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Where a step edge from `sourcePosition` to `targetPosition` turns. `centerX` / `centerY` move its middle run (the
|
|
85
|
+
* one halfway between the ends) off the halfway point, e.g. to keep it off another edge's
|
|
86
|
+
*/
|
|
87
|
+
export interface FlowStepCenter {
|
|
88
|
+
centerX?: number
|
|
89
|
+
centerY?: number
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function smoothStepPoints(p: FlowEdgePathParams & FlowStepCenter & { offset?: number }): Pt[] {
|
|
84
93
|
const { sourceX: sx, sourceY: sy, targetX: tx, targetY: ty } = p
|
|
85
94
|
const sp = p.sourcePosition ?? 'bottom'
|
|
86
95
|
const tp = p.targetPosition ?? 'top'
|
|
@@ -95,7 +104,7 @@ export function smoothStepPoints(p: FlowEdgePathParams & { offset?: number }): P
|
|
|
95
104
|
if (sH && tH) {
|
|
96
105
|
if (nsx === -ntx && (tx - sx) * nsx >= 2 * off) {
|
|
97
106
|
// Facing each other with room: one vertical run halfway
|
|
98
|
-
const mx = (sx + tx) / 2
|
|
107
|
+
const mx = p.centerX ?? (sx + tx) / 2
|
|
99
108
|
mid = [[mx, sy], [mx, ty]]
|
|
100
109
|
} else if (nsx === ntx) {
|
|
101
110
|
// Both sides look the same way: go round past the farther one
|
|
@@ -103,18 +112,18 @@ export function smoothStepPoints(p: FlowEdgePathParams & { offset?: number }): P
|
|
|
103
112
|
mid = [[x, sy], [x, ty]]
|
|
104
113
|
} else {
|
|
105
114
|
// Behind: out, across halfway between the ends, and back in
|
|
106
|
-
const my = (sy + ty) / 2
|
|
115
|
+
const my = p.centerY ?? (sy + ty) / 2
|
|
107
116
|
mid = [s1, [s1[0], my], [t1[0], my], t1]
|
|
108
117
|
}
|
|
109
118
|
} else if (!sH && !tH) {
|
|
110
119
|
if (nsy === -nty && (ty - sy) * nsy >= 2 * off) {
|
|
111
|
-
const my = (sy + ty) / 2
|
|
120
|
+
const my = p.centerY ?? (sy + ty) / 2
|
|
112
121
|
mid = [[sx, my], [tx, my]]
|
|
113
122
|
} else if (nsy === nty) {
|
|
114
123
|
const y = nsy > 0 ? Math.max(s1[1], t1[1]) : Math.min(s1[1], t1[1])
|
|
115
124
|
mid = [[sx, y], [tx, y]]
|
|
116
125
|
} else {
|
|
117
|
-
const mx = (sx + tx) / 2
|
|
126
|
+
const mx = p.centerX ?? (sx + tx) / 2
|
|
118
127
|
mid = [s1, [mx, s1[1]], [mx, t1[1]], t1]
|
|
119
128
|
}
|
|
120
129
|
} else if (sH) {
|
|
@@ -223,7 +232,7 @@ export function getRoutedPath(p: FlowEdgePathParams & { route: number[]; borderR
|
|
|
223
232
|
}
|
|
224
233
|
|
|
225
234
|
/** Right-angled steps with rounded corners (`borderRadius`, default 8; 0 gives sharp steps). `offset` (default 20) is how far it leaves a node before turning */
|
|
226
|
-
export function getSmoothStepPath(p: FlowEdgePathParams & { borderRadius?: number; offset?: number }): FlowEdgePath {
|
|
235
|
+
export function getSmoothStepPath(p: FlowEdgePathParams & FlowStepCenter & { borderRadius?: number; offset?: number }): FlowEdgePath {
|
|
227
236
|
return roundedPath(smoothStepPoints(p), p.borderRadius ?? 8)
|
|
228
237
|
}
|
|
229
238
|
|
|
@@ -292,7 +301,7 @@ export function distanceToPoints(x: number, y: number, pts: [number, number][]):
|
|
|
292
301
|
}
|
|
293
302
|
|
|
294
303
|
/** `getSmoothStepPath` with sharp corners */
|
|
295
|
-
export function getStepPath(p: FlowEdgePathParams & { offset?: number; route?: number[] }): FlowEdgePath {
|
|
304
|
+
export function getStepPath(p: FlowEdgePathParams & FlowStepCenter & { offset?: number; route?: number[] }): FlowEdgePath {
|
|
296
305
|
return p.route ? getRoutedPath({ ...p, route: p.route, borderRadius: 0 }) : getSmoothStepPath({ ...p, borderRadius: 0 })
|
|
297
306
|
}
|
|
298
307
|
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/** One payment of an amortization schedule. */
|
|
2
|
+
export interface AmortizationPayment {
|
|
3
|
+
/** 1-based payment number */
|
|
4
|
+
n: number
|
|
5
|
+
payment: number
|
|
6
|
+
principal: number
|
|
7
|
+
interest: number
|
|
8
|
+
/** Balance left after this payment */
|
|
9
|
+
balance: number
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface AmortizationOptions {
|
|
13
|
+
/** Amount borrowed */
|
|
14
|
+
principal: number
|
|
15
|
+
/** Yearly nominal interest rate, in percent (e.g. 6.5) */
|
|
16
|
+
rate: number
|
|
17
|
+
/** Term in years */
|
|
18
|
+
years: number
|
|
19
|
+
/**
|
|
20
|
+
* `french`: the same payment every period (most of the world's mortgages).
|
|
21
|
+
* `german`: the same principal every period, so payments start higher and fall.
|
|
22
|
+
*/
|
|
23
|
+
system?: 'french' | 'german'
|
|
24
|
+
/** Payments per year */
|
|
25
|
+
periodsPerYear?: number
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface Amortization {
|
|
29
|
+
payments: AmortizationPayment[]
|
|
30
|
+
firstPayment: number
|
|
31
|
+
lastPayment: number
|
|
32
|
+
totalInterest: number
|
|
33
|
+
totalPaid: number
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const round = (n: number) => Math.round(n * 100) / 100
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Builds the payment schedule of a loan. Amounts are rounded to cents per payment and the last payment absorbs the
|
|
40
|
+
* rounding, so the balance ends at exactly 0.
|
|
41
|
+
*/
|
|
42
|
+
export function amortize({ principal, rate, years, system = 'french', periodsPerYear = 12 }: AmortizationOptions): Amortization {
|
|
43
|
+
const count = Math.max(0, Math.round(years * periodsPerYear))
|
|
44
|
+
const r = rate / 100 / periodsPerYear
|
|
45
|
+
const payments: AmortizationPayment[] = []
|
|
46
|
+
if (principal <= 0 || count === 0) return { payments, firstPayment: 0, lastPayment: 0, totalInterest: 0, totalPaid: 0 }
|
|
47
|
+
|
|
48
|
+
const fixed = r === 0 ? principal / count : (principal * r) / (1 - (1 + r) ** -count)
|
|
49
|
+
const fixedPrincipal = principal / count
|
|
50
|
+
let balance = principal
|
|
51
|
+
let totalInterest = 0
|
|
52
|
+
let totalPaid = 0
|
|
53
|
+
for (let n = 1; n <= count; n++) {
|
|
54
|
+
const interest = round(balance * r)
|
|
55
|
+
let part = system === 'german' ? round(fixedPrincipal) : round(fixed - interest)
|
|
56
|
+
if (n === count || part > balance) part = round(balance)
|
|
57
|
+
balance = round(balance - part)
|
|
58
|
+
const payment = round(part + interest)
|
|
59
|
+
totalInterest += interest
|
|
60
|
+
totalPaid += payment
|
|
61
|
+
payments.push({ n, payment, principal: part, interest, balance })
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
payments,
|
|
65
|
+
firstPayment: payments[0]!.payment,
|
|
66
|
+
lastPayment: payments.at(-1)!.payment,
|
|
67
|
+
totalInterest: round(totalInterest),
|
|
68
|
+
totalPaid: round(totalPaid),
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -181,6 +181,8 @@ export interface FlowContext {
|
|
|
181
181
|
* there (as the `branch` event gives). For dropping something onto an edge, e.g. a junction
|
|
182
182
|
*/
|
|
183
183
|
getEdgeAt(p: FlowXY, opts?: { radius?: number; ignore?: (e: FlowEdge) => boolean }): FlowEdgeHit | null
|
|
184
|
+
/** The SVG path (`d`, flow coordinates) an edge is drawn along right now, its own route and edgeSpacing included: to draw it elsewhere, e.g. an exported image */
|
|
185
|
+
getEdgePath(id: string): string | null
|
|
184
186
|
/** Page (client) coordinates → flow coordinates */
|
|
185
187
|
screenToFlow(p: { x: number; y: number }): FlowXY
|
|
186
188
|
flowToScreen(p: FlowXY): { x: number; y: number }
|
|
@@ -210,6 +212,8 @@ export interface FlowContext {
|
|
|
210
212
|
cut(): void
|
|
211
213
|
/** Pastes what was copied, at a flow point (default a step from the originals) */
|
|
212
214
|
paste(at?: FlowXY): void
|
|
215
|
+
/** Copies of the selection (with the edges between them) a step away, selected; the clipboard stays as it was */
|
|
216
|
+
duplicate(): void
|
|
213
217
|
/**
|
|
214
218
|
* Drags a node with a pointer that's already down, e.g. one just added from a palette outside the canvas: it
|
|
215
219
|
* follows the pointer from there (guides, splicing into an edge) until it's let go. With a finger, the page
|