@mzzsfy/dsh-stock-assistant 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +110 -108
- package/cordis.patch.yml +6 -0
- package/package.json +2 -2
- package/src/application.mjs +42 -31
- package/src/client.js +323 -174
- package/src/index.js +41 -34
- package/src/kline-cache.mjs +1 -1
- package/src/market-model.mjs +21 -9
- package/src/memory-cache.mjs +19 -0
- package/src/providers/eastmoney.mjs +16 -4
- package/src/route-gate.mjs +29 -0
- package/src/routes.mjs +68 -66
- package/src/schemas.mjs +59 -4
- package/src/service.mjs +36 -10
- package/src/state.mjs +14 -13
- package//345/205/274/345/256/271/346/200/247/346/265/213/350/257/225.md +98 -4
package/src/client.js
CHANGED
|
@@ -2,6 +2,8 @@ window.__ModuleLoader__.load({
|
|
|
2
2
|
id: '@mzzsfy/dsh-stock-assistant',
|
|
3
3
|
factory(require) {
|
|
4
4
|
const PANEL_ID = 'stock-assistant', BASE = '/api/stock-assistant', BROWSE_PAGE = 50
|
|
5
|
+
// 单票标签上限与服务端 schemas.MAX_TAGS 一致, 由 tags-schema 测试守卫; 客户端只做前置提示, 服务端仍校验
|
|
6
|
+
const MAX_TAGS = 8
|
|
5
7
|
// K线结果的归属键: 拉取、校验、灌图三处必须用同一个拼法, 否则校验形同虚设
|
|
6
8
|
function klineKeyOf(securityId, period) { return `${securityId}|${period}` }
|
|
7
9
|
// 灌图计划: 空壳只清屏且不记 key(空数据上 fitContent 是 no-op, 记了就再也不会铺满);
|
|
@@ -10,22 +12,25 @@ window.__ModuleLoader__.load({
|
|
|
10
12
|
if (!hasData) return { fit: false, next: shippedKey }
|
|
11
13
|
return { fit: shippedKey !== key, next: key }
|
|
12
14
|
}
|
|
13
|
-
//
|
|
14
|
-
const
|
|
15
|
-
// 自选的分组切面:
|
|
16
|
-
//
|
|
17
|
-
function
|
|
18
|
-
// 只认确实存在的标的: 自选与明细表短暂不一致时, 不存在的 id
|
|
15
|
+
// 分组 tab 的保留键: 标签名来自用户输入且只校验长度, 用不可见前缀保证不会与真实标签撞键
|
|
16
|
+
const ALL_TAB_KEY = '\u0000all', REST_TAB_KEY = '\u0000rest', TAG_PREFIX = 'tag:', WATCHLIST_PANEL_ID = 'ssb-watchlist-panel'
|
|
17
|
+
// 自选的分组切面: 全部 → 各标签(按首次出现顺序) → 未分组(仅当有无标签票)。
|
|
18
|
+
// 一只票可有多个标签, 因此会同时出现在多个 tab 里; 列表与详情编辑共用这一份归属答案
|
|
19
|
+
function tagTabs(order, items) {
|
|
20
|
+
// 只认确实存在的标的: 自选与明细表短暂不一致时, 不存在的 id 既不该进 tab 也不该进未分组
|
|
19
21
|
const known = order.filter(id => items[id])
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
22
|
+
const tagsOf = id => items[id].tags || []
|
|
23
|
+
const names = [...new Set(known.flatMap(tagsOf))]
|
|
24
|
+
const tabs = [
|
|
25
|
+
{ key: ALL_TAB_KEY, label: '全部', ids: known },
|
|
26
|
+
...names.map(name => ({ key: `${TAG_PREFIX}${name}`, label: name, ids: known.filter(id => tagsOf(id).includes(name)) })),
|
|
27
|
+
]
|
|
28
|
+
const rest = known.filter(id => !tagsOf(id).length)
|
|
29
|
+
if (rest.length) tabs.push({ key: REST_TAB_KEY, label: '未分组', ids: rest })
|
|
30
|
+
return tabs
|
|
28
31
|
}
|
|
32
|
+
// 激活键可能已失效(标签被解散或改名): 回退首个 tab, 而不是渲染空白列表
|
|
33
|
+
const resolveTab = (tabs, key) => tabs.find(tab => tab.key === key) || tabs[0]
|
|
29
34
|
// 来源偶发给 null 字段: LWC 只跳过 undefined, null 会按 0 参与价格轴范围把整图压扁;
|
|
30
35
|
// 而非有限的 OHLC 又不能留成 NaN —— 它会顺着均线的滑动窗口把后面所有指标值一起毒掉。
|
|
31
36
|
// 所以四个价格有任一缺失就丢掉整根, 其余字段(avg/amount 等)原样带过去: 分时均价线靠 avg
|
|
@@ -54,8 +59,8 @@ window.__ModuleLoader__.load({
|
|
|
54
59
|
}
|
|
55
60
|
// 缺失值不是 0: 直接 Number() 会把 null 变成真实的 0, 画到图上就是一条压在地板上的线
|
|
56
61
|
const finiteOr = value => value == null || value === '' ? NaN : Number(value)
|
|
57
|
-
//
|
|
58
|
-
const
|
|
62
|
+
// 多笔成本取最低价作为成本基准: 汇总盈亏按它算, 其余成本只作参考线(各自仍显示与现价的百分比)
|
|
63
|
+
const costBaseOf = marks => { const prices = (marks || []).filter(mark => mark.kind === 'cost').map(mark => mark.price); return prices.length ? Math.min(...prices) : null }
|
|
59
64
|
// 价格标记按该证券的价位精度显示: 港股四位小数, 用 toString 会丢位数
|
|
60
65
|
const priceTextOf = (value, scale) => value == null || value === '' || Number.isNaN(Number(value)) ? '—' : Number(value).toFixed(scale ?? 2)
|
|
61
66
|
// 涨跌方向只在这里判一次: 面板与悬浮窗共用, 避免 0 被显示成涨或被当成跌
|
|
@@ -65,8 +70,8 @@ window.__ModuleLoader__.load({
|
|
|
65
70
|
}
|
|
66
71
|
// 每个标记各自的盈亏口径: 成本看「现价相对它」的浮盈, 卖价看「它相对成本」的潜在收益,
|
|
67
72
|
// 还没有成本时卖价退回相对现价——三个口径都是同一个式子, 只是基准不同
|
|
68
|
-
const markPct = (mark, last,
|
|
69
|
-
const base = mark.kind === 'cost' ? mark.price :
|
|
73
|
+
const markPct = (mark, last, costBase) => {
|
|
74
|
+
const base = mark.kind === 'cost' ? mark.price : costBase ?? last
|
|
70
75
|
return base == null || last == null ? null : (mark.kind === 'cost' ? last - base : mark.price - base) / base * 100
|
|
71
76
|
}
|
|
72
77
|
// 成交额按万/亿缩写避免长列; zeroIsMissing 关掉时 0 按真值显示(成交量用)
|
|
@@ -131,7 +136,15 @@ window.__ModuleLoader__.load({
|
|
|
131
136
|
const timeout = setTimeout(() => controller.abort(), path === '/provider-check' ? 61000 : path === '/catalog-sync' ? 121000 : 11000)
|
|
132
137
|
try {
|
|
133
138
|
const response = await request(BASE + path, { method, headers: { 'Content-Type': 'application/json' }, ...(body === undefined ? {} : { body: JSON.stringify(body) }), signal: controller.signal })
|
|
134
|
-
|
|
139
|
+
let result
|
|
140
|
+
try { result = await response.json() } catch (error) {
|
|
141
|
+
// 读响应体被中止(超时/页面重置)属于外部取消, 不能伪装成服务故障
|
|
142
|
+
if (error?.name === 'AbortError') throw error
|
|
143
|
+
// 插件 host 半区未激活时宿主对未注册路由回纯文本 "not found", 解析器报错对用户无信息量
|
|
144
|
+
const unavailable = new Error(`股票工具服务不可用(HTTP ${response.status})`)
|
|
145
|
+
unavailable.code = 'SERVICE_UNAVAILABLE'
|
|
146
|
+
throw unavailable
|
|
147
|
+
}
|
|
135
148
|
if (!response.ok || !result.ok) { const e = new Error(result.error?.message || '请求失败'); Object.assign(e, result.error, { snapshot: result.snapshot }); throw e }
|
|
136
149
|
return result.data
|
|
137
150
|
} finally { clearTimeout(timeout); requests.delete(controller); signal?.removeEventListener('abort', abort) }
|
|
@@ -175,7 +188,7 @@ window.__ModuleLoader__.load({
|
|
|
175
188
|
const detailChanged = next.detailId !== undefined && next.detailId !== state.view.detailId
|
|
176
189
|
const saved = next.detailId === undefined ? undefined : (state.data?.control.watchlist.items[next.detailId] || state.view.browsePeek?.[next.detailId])
|
|
177
190
|
const alias = next.alias !== undefined ? { alias: next.alias } : detailChanged ? { alias: saved?.alias || '' } : {}
|
|
178
|
-
patch({ view: { ...state.view, ...next, ...alias, ...(leaveDetail ? { detailId: null, alias: '', browsePeek: {} } : {}), ...(detailChanged ? { markDraft: null,
|
|
191
|
+
patch({ view: { ...state.view, ...next, ...alias, ...(leaveDetail ? { detailId: null, alias: '', browsePeek: {} } : {}), ...(detailChanged ? { markDraft: null, tagDraft: null, markError: null, tagError: null } : {}) } })
|
|
179
192
|
sendDemand()
|
|
180
193
|
}
|
|
181
194
|
function scheduleSearch(query) {
|
|
@@ -582,6 +595,77 @@ window.__ModuleLoader__.load({
|
|
|
582
595
|
function Toggle({ label, checked, onChange, disabled = false }) {
|
|
583
596
|
return h('label', { className: 'ssb-switch' }, h('input', { type: 'checkbox', checked, disabled, onChange: e => onChange(e.target.checked) }), h('span', { className: 'ssb-switch__track' }, h('span', { className: 'ssb-switch__thumb' })), h('span', null, label))
|
|
584
597
|
}
|
|
598
|
+
// 自绘下拉: 原生 select 的菜单不进 DOM, 自动化点不到也断言不了; 换成 listbox 后「打开→选择」全链路可测
|
|
599
|
+
const DROPDOWN = { itemHeight: 28, padding: 8, gap: 4, maxHeight: 240, edge: 8 }
|
|
600
|
+
// 菜单定位: 下方空间不够且上方更宽裕时向上弹, 左右夹在视口内; 高度取可用方向的空间
|
|
601
|
+
function dropdownPlacement(rect, viewport, count) {
|
|
602
|
+
const height = Math.min(count * DROPDOWN.itemHeight + DROPDOWN.padding, DROPDOWN.maxHeight)
|
|
603
|
+
const below = viewport.height - rect.bottom - DROPDOWN.gap - DROPDOWN.edge
|
|
604
|
+
const above = rect.top - DROPDOWN.gap - DROPDOWN.edge
|
|
605
|
+
const up = below < height && above > below
|
|
606
|
+
const maxHeight = Math.max(DROPDOWN.itemHeight, Math.min(height, Math.floor(up ? above : below)))
|
|
607
|
+
const left = Math.max(DROPDOWN.edge, Math.min(rect.left, viewport.width - rect.width - DROPDOWN.edge))
|
|
608
|
+
return { left, top: up ? Math.max(DROPDOWN.edge, rect.top - DROPDOWN.gap - maxHeight) : rect.bottom + DROPDOWN.gap, minWidth: rect.width, maxHeight }
|
|
609
|
+
}
|
|
610
|
+
function Select({ value, options, onChange, disabled = false, label }) {
|
|
611
|
+
const [open, setOpen] = React.useState(false), [active, setActive] = React.useState(0), [place, setPlace] = React.useState(null)
|
|
612
|
+
const rootRef = React.useRef(null), triggerRef = React.useRef(null), menuId = React.useId()
|
|
613
|
+
const selectedAt = Math.max(0, options.findIndex(option => option.value === value))
|
|
614
|
+
const current = options[selectedAt]
|
|
615
|
+
const close = React.useCallback(() => setOpen(false), [])
|
|
616
|
+
// 打开时才量坐标: 设置页有折叠区, 渲染期算出的位置会过期
|
|
617
|
+
const openMenu = React.useCallback(() => {
|
|
618
|
+
if (disabled || !triggerRef.current) return
|
|
619
|
+
setPlace(dropdownPlacement(triggerRef.current.getBoundingClientRect(), { width: innerWidth, height: innerHeight }, options.length))
|
|
620
|
+
setActive(selectedAt); setOpen(true)
|
|
621
|
+
}, [disabled, options.length, selectedAt])
|
|
622
|
+
React.useEffect(() => {
|
|
623
|
+
if (!open) return
|
|
624
|
+
const onPointer = event => { if (!rootRef.current?.contains(event.target)) close() }
|
|
625
|
+
const onMove = () => close()
|
|
626
|
+
document.addEventListener('pointerdown', onPointer, true)
|
|
627
|
+
window.addEventListener('scroll', onMove, true)
|
|
628
|
+
window.addEventListener('resize', onMove)
|
|
629
|
+
return () => { document.removeEventListener('pointerdown', onPointer, true); window.removeEventListener('scroll', onMove, true); window.removeEventListener('resize', onMove) }
|
|
630
|
+
}, [open, close])
|
|
631
|
+
React.useEffect(() => { if (disabled) close() }, [disabled, close])
|
|
632
|
+
const choose = index => {
|
|
633
|
+
const option = options[index]
|
|
634
|
+
if (!option) return
|
|
635
|
+
setOpen(false); triggerRef.current?.focus()
|
|
636
|
+
if (option.value !== value) onChange(option.value)
|
|
637
|
+
}
|
|
638
|
+
const onKeyDown = event => {
|
|
639
|
+
if (disabled) return
|
|
640
|
+
if (!open) {
|
|
641
|
+
if (event.key === 'Enter' || event.key === ' ' || event.key === 'ArrowDown' || event.key === 'ArrowUp') { event.preventDefault(); openMenu() }
|
|
642
|
+
return
|
|
643
|
+
}
|
|
644
|
+
if (event.key === 'Escape') { event.preventDefault(); event.stopPropagation(); close(); return }
|
|
645
|
+
if (event.key === 'Tab') { close(); return }
|
|
646
|
+
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { event.preventDefault(); setActive(at => Math.max(0, Math.min(options.length - 1, at + (event.key === 'ArrowDown' ? 1 : -1)))); return }
|
|
647
|
+
if (event.key === 'Home') { event.preventDefault(); setActive(0); return }
|
|
648
|
+
if (event.key === 'End') { event.preventDefault(); setActive(options.length - 1); return }
|
|
649
|
+
if (event.key === 'Enter' || event.key === ' ') { event.preventDefault(); choose(active) }
|
|
650
|
+
}
|
|
651
|
+
const optionId = index => `${menuId}-opt-${index}`
|
|
652
|
+
return h('div', { className: 'ssb-select', ref: rootRef },
|
|
653
|
+
h('button', {
|
|
654
|
+
type: 'button', ref: triggerRef, className: 'ssb-select-trigger', role: 'combobox', disabled, 'aria-label': label,
|
|
655
|
+
'aria-haspopup': 'listbox', 'aria-expanded': open, 'aria-controls': menuId, 'aria-activedescendant': open ? optionId(active) : undefined,
|
|
656
|
+
onClick: () => (open ? close() : openMenu()), onKeyDown,
|
|
657
|
+
}, h('span', { className: 'ssb-select-value' }, current?.label ?? ''), h('span', { className: 'ssb-select-caret', 'aria-hidden': 'true' })),
|
|
658
|
+
h('div', {
|
|
659
|
+
role: 'listbox', id: menuId, hidden: !open, className: 'ssb-select-menu', 'aria-label': label,
|
|
660
|
+
style: place ? { left: place.left, top: place.top, minWidth: place.minWidth, maxHeight: place.maxHeight } : undefined,
|
|
661
|
+
}, ...options.map((option, index) => h('div', {
|
|
662
|
+
key: option.value, id: optionId(index), role: 'option', 'aria-selected': option.value === value,
|
|
663
|
+
className: `ssb-select-option${index === active ? ' ssb-select-option-active' : ''}`,
|
|
664
|
+
onPointerDown: event => event.preventDefault(),
|
|
665
|
+
onClick: () => choose(index),
|
|
666
|
+
onPointerEnter: () => setActive(index),
|
|
667
|
+
}, option.label))))
|
|
668
|
+
}
|
|
585
669
|
function QuoteStatus({ entry, short = false }) {
|
|
586
670
|
const quote = entry?.quote
|
|
587
671
|
const detail = (quote ? `${quote.providerInstanceId} · ${quote.delayKind === 'unknown' ? '延迟未知' : delayText(quote)}` : '等待报价') + (entry?.lastError?.message ? ` · ${entry.lastError.message}` : '')
|
|
@@ -595,7 +679,7 @@ window.__ModuleLoader__.load({
|
|
|
595
679
|
// 详情页只给来源名: 延迟与获取时间已在事实表里逐行列出, 这里重复会把抽屉头部撑长
|
|
596
680
|
return h('span', { className: 'ssb-muted ssb-source', title: detail }, entry?.health && entry.health !== 'ok' ? `${({ limited: '额度受限', error: '请求失败', 'no-data': '暂无报价', unconfigured: '未配置来源' })[entry.health] || entry.health} · ` : '', quote ? quote.providerInstanceId : '等待报价')
|
|
597
681
|
}
|
|
598
|
-
// 拖拽落位: 返回新的完整顺序;
|
|
682
|
+
// 拖拽落位: 返回新的完整顺序; 非本 tab 成员按原槽位回填, 保证提交的是全量 order
|
|
599
683
|
function dragOrder(sequence, order, from, over, after) {
|
|
600
684
|
const visible = sequence.filter(id => id !== from)
|
|
601
685
|
const at = visible.indexOf(over)
|
|
@@ -624,15 +708,45 @@ window.__ModuleLoader__.load({
|
|
|
624
708
|
const unhealthy = (state.data.providerStatus || []).filter(s => { const log = s.recentRequests || []; return log.length && log[0].status !== 'ok' })
|
|
625
709
|
const providers = state.data.control.providers || []
|
|
626
710
|
const sourcesBanner = unhealthy.length || providers.some(p => !p.enabled) ? h('div', { className: 'ssb-banner' }, `${providers.filter(p => p.enabled).length}/${providers.length} 个数据源启用${unhealthy.length ? `,${unhealthy.map(s => s.id).join('、')} 最近请求失败` : ''}`, h(Button, { onClick: () => runtime.updateView({ view: 'list', overlay: 'settings' }) }, '查看')) : null
|
|
627
|
-
//
|
|
628
|
-
const
|
|
711
|
+
// 分组 tab: 全部 → 各标签(首现序) → 未分组; 一只票可同时属于多个标签, 于是在多个 tab 可见
|
|
712
|
+
const tabs = tagTabs(w.order, w.items)
|
|
713
|
+
const active = resolveTab(tabs, view.activeTab)
|
|
714
|
+
const inTab = new Set(active.ids)
|
|
715
|
+
// tab 顺序取排序后的全量序, 置顶票因此在每个 tab 里都排最前
|
|
716
|
+
const tabOrder = order.filter(id => inTab.has(id))
|
|
717
|
+
// 组合概览按当前 tab 成员算(不占独立横幅带)。不做涨跌额求和: 各市场币种不同且无仓位数量, 相加没有意义
|
|
718
|
+
const stats = active.ids.reduce((acc, id) => { const pct = Number(data.quotes[id]?.quote?.changePct); if (Number.isNaN(pct)) return acc; acc.up += pct > 0; acc.down += pct < 0; const item = w.items[id], last = Number(data.quotes[id]?.quote?.last), costBase = costBaseOf(item.marks); if (costBase != null && last) { acc.held += 1; acc.pl += (last - costBase) / costBase * 100 } return acc }, { up: 0, down: 0, held: 0, pl: 0 })
|
|
629
719
|
// 持仓合计为等权均值(无仓位数量数据, 百分比求和会随只数放大; 均值是最不坏近似)
|
|
630
|
-
const heldText = stats
|
|
720
|
+
const heldText = stats.held ? ` · 持仓盈亏 ${signed(Number((stats.pl / stats.held).toFixed(1)))}%(等权)` : ''
|
|
721
|
+
const statsText = `${active.ids.length} 只 · ${stats.up} 涨 ${stats.down} 跌${heldText}${freshnessText(data.quotes) ? ` · ${freshnessText(data.quotes)}` : ''}`
|
|
722
|
+
const isTagTab = active.key.startsWith(TAG_PREFIX)
|
|
723
|
+
// 重命名草稿绑定的是标签名: 切换 tab 后残留的草稿不再渲染
|
|
724
|
+
const renameDraft = isTagTab && view.tagRename?.from === active.label ? view.tagRename : null
|
|
725
|
+
const tabBar = w.order.length ? h('div', { className: 'ssb-tabs', role: 'tablist', 'aria-label': '自选分组' },
|
|
726
|
+
...tabs.map(tab => h('button', { key: tab.key, type: 'button', role: 'tab', 'aria-controls': WATCHLIST_PANEL_ID, className: `ssb-tab${tab.key === active.key ? ' ssb-tab-on' : ''}`, 'aria-selected': tab.key === active.key, onClick: () => runtime.updateView({ activeTab: tab.key, tagRename: null }) }, `${tab.label} · ${tab.ids.length}`))) : null
|
|
727
|
+
const tagTools = isTagTab ? h('div', { className: 'ssb-toolbar' },
|
|
728
|
+
h(Button, { disabled: busy.write, onClick: () => runtime.updateView({ tagRename: { from: active.label, to: active.label, error: '' } }) }, '重命名'),
|
|
729
|
+
// 解散成功后激活键失效, 显式回到全部而不是让 resolveTab 静默兜底; 失败时保留原地由顶部横幅报错
|
|
730
|
+
h(Button, { disabled: busy.write, onClick: () => runtime.mutate('tagRemove', { tag: active.label }).then(() => runtime.updateView({ activeTab: ALL_TAB_KEY, tagRename: null })).catch(() => { }) }, '解散')) : null
|
|
731
|
+
const renameForm = renameDraft ? h('form', { className: 'ssb-inline-form ssb-tag-rename', onSubmit: e => {
|
|
732
|
+
e.preventDefault()
|
|
733
|
+
const to = String(renameDraft.to || '').trim()
|
|
734
|
+
if (!to) { runtime.updateView({ tagRename: { ...renameDraft, error: '标签名不能为空' } }); return }
|
|
735
|
+
if ([...to].length > 12) { runtime.updateView({ tagRename: { ...renameDraft, error: '标签名最多12字' } }); return }
|
|
736
|
+
// 激活键跟随新标签名, 否则重命名成功后 tab 条上找不到旧键会掉回全部; 失败保留草稿供改名重试
|
|
737
|
+
runtime.mutate('tagRename', { from: renameDraft.from, to }).then(() => runtime.updateView({ tagRename: null, activeTab: `${TAG_PREFIX}${to}` })).catch(() => { })
|
|
738
|
+
} },
|
|
739
|
+
h('label', { className: 'ssb-inline-field' }, h('span', { className: 'ssb-field-label' }, '标签名'), h('input', { className: 'ssb-input ssb-input-group', value: renameDraft.to, maxLength: 12, onChange: e => runtime.updateView({ tagRename: { ...renameDraft, to: e.target.value, error: '' } }) })),
|
|
740
|
+
h('button', { type: 'submit', className: 'ssb-button', disabled: busy.write }, '保存'),
|
|
741
|
+
h(Button, { onClick: () => runtime.updateView({ tagRename: null }) }, '取消'),
|
|
742
|
+
renameDraft.error ? h('small', { className: 'ssb-form-error', role: 'alert' }, renameDraft.error) : null) : null
|
|
631
743
|
return h('section', { className: 'ssb-list-pane' },
|
|
632
744
|
sourcesBanner,
|
|
633
|
-
h('div', { className: 'ssb-section-head' }, h('h2', null, `自选 · ${w.order.length}`),
|
|
634
|
-
|
|
635
|
-
|
|
745
|
+
h('div', { className: 'ssb-section-head' }, h('h2', null, `自选 · ${w.order.length}`), w.order.length ? h('span', { className: 'ssb-muted' }, statsText) : null, tagTools, h(Select, { value: view.sort, label: '自选排序', options: [{ value: 'manual', label: '手动顺序' }, { value: 'desc', label: '涨幅优先' }, { value: 'asc', label: '跌幅优先' }], onChange: value => runtime.updateView({ sort: value }) })),
|
|
746
|
+
renameForm,
|
|
747
|
+
tabBar,
|
|
748
|
+
!w.order.length ? h('div', { className: 'ssb-empty' }, h('p', null, '添加第一只自选,集中查看价格和来源。'), h(Button, { primary: true, onClick: () => runtime.updateView({ view: 'search' }) }, '添加自选')) :
|
|
749
|
+
h('div', { className: 'ssb-table-scroll', role: 'tabpanel', id: WATCHLIST_PANEL_ID, 'aria-label': active.label, onScroll: e => runtime.updateView({ scrollTop: e.currentTarget.scrollTop }), ref: node => { if (node && Math.abs(node.scrollTop - (view.scrollTop || 0)) > 1) node.scrollTop = view.scrollTop || 0 } },
|
|
636
750
|
// 表头: 让每列含义自解释; 窄容器整体隐藏(降级为行内键值对)
|
|
637
751
|
h('div', { className: 'ssb-row-head', 'aria-hidden': true },
|
|
638
752
|
h('span', { className: 'ssb-grip' }, ''),
|
|
@@ -646,16 +760,15 @@ window.__ModuleLoader__.load({
|
|
|
646
760
|
h('span', { className: 'ssb-cell-amplitude' }, '振幅'),
|
|
647
761
|
h('span', { className: 'ssb-cell-pl' }, '持仓盈亏'),
|
|
648
762
|
h('span', { className: 'ssb-col-status' }, '')),
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
// 分组分段: 置顶/各组/未分组都常显段头(一只没归组时也要看得见分组这回事); 置顶区不进组段;
|
|
653
|
-
// 组序=首现序; 折叠组隐藏成员。分组与排序正交: 全局排序只改组内顺序, 不改分段
|
|
654
|
-
// 拖拽排序: 提交完整显示序, 折叠组隐藏项保持原槽位由 order 回填
|
|
763
|
+
h('div', { className: 'ssb-rows', role: 'list' }, ...(() => {
|
|
764
|
+
// 列表只渲染激活 tab 的成员: 行序取排序后的全量序, 拖拽落的仍是完整自选序。
|
|
765
|
+
// 置顶是排序权重而不是独立分段, 所以 lane 只按置顶区分, 防止把置顶票拖出置顶段
|
|
655
766
|
const sequence = []
|
|
656
|
-
const laneOf = id =>
|
|
767
|
+
const laneOf = id => String(!!w.items[id].pinned)
|
|
657
768
|
const commitOrder = (from, over, after) => {
|
|
658
|
-
|
|
769
|
+
// 拖拽期间别处可能移除标的或解散标签: 源不在本 tab 的渲染序里就放弃, 否则会提交重复 id
|
|
770
|
+
if (!from || !over || from === over || !w.items[from] || !w.items[over] || !sequence.includes(from)) return
|
|
771
|
+
if (laneOf(from) !== laneOf(over)) return
|
|
659
772
|
const merged = dragOrder(sequence, order, from, over, after)
|
|
660
773
|
if (!merged) return
|
|
661
774
|
// 失败错误由 action 通道落到顶部横幅, 这里只防未处理拒绝
|
|
@@ -665,14 +778,13 @@ window.__ModuleLoader__.load({
|
|
|
665
778
|
const item = w.items[id], entry = data.quotes[id], q = entry?.quote
|
|
666
779
|
sequence.push(id)
|
|
667
780
|
const direction = toneClass(q?.changePct)
|
|
668
|
-
// 列表只显示一个数:
|
|
669
|
-
const
|
|
670
|
-
const plPct =
|
|
781
|
+
// 列表只显示一个数: 多个成本取最低价作为「持仓成本」
|
|
782
|
+
const costBase = costBaseOf(item.marks)
|
|
783
|
+
const plPct = costBase != null && q?.last != null ? Number((Number(q.last) - costBase) / costBase * 100).toFixed(1) : null
|
|
671
784
|
const amplitude = q?.high != null && q?.low != null && Number(q.previousClose) > 0 ? Number(((Number(q.high) - Number(q.low)) / Number(q.previousClose)) * 100).toFixed(1) : null
|
|
672
785
|
const dragging = view.dragId === id
|
|
673
786
|
const dropEdge = view.dropAt?.id === id ? view.dropAt.after ? ' ssb-drop-after' : ' ssb-drop-before' : ''
|
|
674
787
|
const canDrag = view.sort === 'manual' && !busy.write
|
|
675
|
-
const changeOrder = (from, over, after) => commitOrder(from, over, after)
|
|
676
788
|
return h(React.Fragment, { key: id },
|
|
677
789
|
h('div', {
|
|
678
790
|
className: `ssb-row${view.detailId === id ? ' ssb-selected' : ''}${entry?.health !== 'ok' ? ' ssb-stale' : ''}${dragging ? ' ssb-dragging' : ''}${dropEdge}${item.pinned ? ' ssb-pinned' : ''}`,
|
|
@@ -681,20 +793,21 @@ window.__ModuleLoader__.load({
|
|
|
681
793
|
onDragStart: e => { e.dataTransfer.effectAllowed = 'move'; e.dataTransfer.setData('text/plain', id); runtime.updateView({ dragId: id, dropAt: null }) },
|
|
682
794
|
onDragEnd: () => runtime.updateView({ dragId: null, dropAt: null }),
|
|
683
795
|
onDragOver: e => {
|
|
684
|
-
|
|
796
|
+
// 拖拽期间别处可能移除标的: 先确认两端都还在, 否则 laneOf 会读 undefined
|
|
797
|
+
if (!view.dragId || view.dragId === id || !w.items[view.dragId] || !w.items[id] || laneOf(view.dragId) !== laneOf(id)) return
|
|
685
798
|
e.preventDefault()
|
|
686
799
|
const rect = e.currentTarget.getBoundingClientRect()
|
|
687
800
|
const after = e.clientY > rect.top + rect.height / 2
|
|
688
801
|
if (view.dropAt?.id !== id || view.dropAt.after !== after) runtime.updateView({ dropAt: { id, after } })
|
|
689
802
|
},
|
|
690
|
-
onDrop: e => { e.preventDefault();
|
|
803
|
+
onDrop: e => { e.preventDefault(); commitOrder(view.dragId, id, view.dropAt?.after === true); runtime.updateView({ dragId: null, dropAt: null }) },
|
|
691
804
|
},
|
|
692
805
|
h('div', { className: 'ssb-row-main' },
|
|
693
806
|
h('span', { className: 'ssb-grip', 'aria-hidden': true, title: canDrag ? '拖动排序' : '切回手动顺序后可拖动' }, '⠿'),
|
|
694
807
|
h('button', { className: 'ssb-stock-name', 'data-security-id': id, onClick: () => open(id), onFocus: () => { if (view.focusId !== id) runtime.updateView({ focusId: id }) }, onBlur: e => { if (!e.relatedTarget?.closest('.ssb-stock-name')) runtime.updateView({ keyboardNavigating: false, frozenOrder: null }) }, onKeyDown: e => {
|
|
695
808
|
if (e.key === 'Escape') { runtime.updateView({ menuId: null, frozenOrder: null, keyboardNavigating: false, view: 'list' }); return }
|
|
696
809
|
if (['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(e.key)) {
|
|
697
|
-
// 导航序列=实际渲染 DOM 序(
|
|
810
|
+
// 导航序列=实际渲染 DOM 序(tab 过滤后与全量 order 错位), focusId 取目标行 data-security-id 保持状态同步
|
|
698
811
|
e.preventDefault(); const buttons = [...e.currentTarget.closest('.ssb-rows').querySelectorAll('.ssb-stock-name')]; const at = buttons.indexOf(e.currentTarget), next = e.key === 'Home' ? 0 : e.key === 'End' ? buttons.length - 1 : Math.max(0, Math.min(buttons.length - 1, at + (e.key === 'ArrowDown' ? 1 : -1)))
|
|
699
812
|
const target = buttons[next]; runtime.updateView({ keyboardNavigating: true, frozenOrder: order, focusId: target?.dataset.securityId }); target?.focus()
|
|
700
813
|
}
|
|
@@ -716,48 +829,10 @@ window.__ModuleLoader__.load({
|
|
|
716
829
|
amplitude == null ? null : h('span', { className: 'ssb-kv' }, '振', `${amplitude}%`),
|
|
717
830
|
plPct == null ? null : h('span', { className: `ssb-kv ssb-kv-pl${toneClass(plPct)}` }, '持仓', `${signed(plPct)}%`))))
|
|
718
831
|
}
|
|
719
|
-
|
|
720
|
-
// 置顶与未分组也各给一个组头, 否则一只都没归组时整页平铺, 分组功能等于不可发现
|
|
721
|
-
// 段序固定按自选顺序: 用排序后的 order 取「首现序」会让段落随行情跳动换位,
|
|
722
|
-
// 正在点的组头会跑掉。排序只决定组内先后
|
|
723
|
-
const rank = new Map(order.map((id, i) => [id, i]))
|
|
724
|
-
// 缺 id 时排到最后: 排到最前会让一个不该出现的条目抢走组内首位
|
|
725
|
-
const sortedIds = ids => ids.slice().sort((left, right) => (rank.get(left) ?? Infinity) - (rank.get(right) ?? Infinity))
|
|
726
|
-
const slices = groupSlices(w.order, w.items)
|
|
727
|
-
const toggleGroup = (key, open) => runtime.updateView({ groupCollapsed: { ...view.groupCollapsed, [key]: open } })
|
|
728
|
-
// 组名来自用户输入: 直接取 groupCollapsed[name] 会让 constructor/toString 这类名字读到原型链上的成员,
|
|
729
|
-
// 被误判成「已折叠」, 整组不渲染
|
|
730
|
-
const collapsedOf = key => Object.hasOwn(view.groupCollapsed || {}, key) && !!view.groupCollapsed[key]
|
|
731
|
-
const head = (key, label, ids, actions) => {
|
|
732
|
-
const open = !collapsedOf(key)
|
|
733
|
-
const gs = ids.reduce((acc, id) => { const pct = Number(data.quotes[id]?.quote?.changePct); if (!Number.isNaN(pct)) { acc.up += pct > 0; acc.down += pct < 0 } return acc }, { up: 0, down: 0 })
|
|
734
|
-
// role=presentation 只是把组头从无障碍树里摘掉, 组折叠按钮与工具条照样会
|
|
735
|
-
// 变成列表的直接子节点. 所以段自己是一个 group, 行装在段内的 list 里
|
|
736
|
-
return h('div', { key: 'sec-' + key, role: 'group', 'aria-label': label },
|
|
737
|
-
h('div', { className: 'ssb-group-head' },
|
|
738
|
-
h('span', { className: 'ssb-group-toggle', role: 'button', tabIndex: 0, 'aria-expanded': open, 'aria-label': `${label} 分组折叠`, onClick: () => toggleGroup(key, open), onKeyDown: e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); toggleGroup(key, open) } } }, open ? '▾' : '▸', ` ${label} · ${ids.length} 只 · ${gs.up} 涨 ${gs.down} 跌`),
|
|
739
|
-
h('span', { className: 'ssb-toolbar' }, actions)),
|
|
740
|
-
open ? h('div', { role: 'list', 'aria-label': label }, ...ids.map(rowOf)) : null)
|
|
741
|
-
}
|
|
742
|
-
const section = (key, label, ids, actions) => head(key, label, ids, actions)
|
|
743
|
-
const out = []
|
|
744
|
-
if (slices.pinned.length) out.push(section(PINNED_KEY, '置顶', sortedIds(slices.pinned), null))
|
|
745
|
-
for (const { name, ids } of slices.groups) {
|
|
746
|
-
const actions = [
|
|
747
|
-
// 折叠态迁移必须等写入成功: 名字不合规时服务端会 400, 先迁移会让旧组突然展开
|
|
748
|
-
h(Button, { key: 'rename', onClick: () => {
|
|
749
|
-
const to = prompt('重命名分组', name)?.trim()
|
|
750
|
-
if (!to) return
|
|
751
|
-
quiet(() => runtime.mutate('groupRename', { from: name, to }))().then(() => { if (to !== name) runtime.updateView({ groupCollapsed: { ...view.groupCollapsed, [to]: collapsedOf(name), [name]: undefined } }) }).catch(() => { })
|
|
752
|
-
} }, '重命名'),
|
|
753
|
-
h(Button, { key: 'drop', disabled: busy.write, onClick: () => { quiet(() => runtime.mutate('groupRemove', { group: name }))(); runtime.updateView({ groupCollapsed: { ...view.groupCollapsed, [name]: undefined } }) } }, '解散'),
|
|
754
|
-
]
|
|
755
|
-
out.push(section(name, name, sortedIds(ids), actions))
|
|
756
|
-
}
|
|
757
|
-
if (slices.ungrouped.length) out.push(section(REST_KEY, '未分组', sortedIds(slices.ungrouped), null))
|
|
758
|
-
return out
|
|
832
|
+
return tabOrder.map(rowOf)
|
|
759
833
|
})())))
|
|
760
|
-
}
|
|
834
|
+
}
|
|
835
|
+
// ---- KlineView: lightweight-charts 图表视图(设计"client 详情重构"节十步数据流) ----
|
|
761
836
|
const PERIODS = [{ key: 'trend', label: '分时' }, { key: '1d', label: '日K' }, { key: '1w', label: '周K' }, { key: '1M', label: '月K' }]
|
|
762
837
|
const GUIDE_KEY = 'ssb-guides'
|
|
763
838
|
const GUIDE_DEFAULT = { preClose: true, marks: true, highLow: false, ma: true, ema: false, boll: false, bbi: false }
|
|
@@ -951,10 +1026,10 @@ window.__ModuleLoader__.load({
|
|
|
951
1026
|
}
|
|
952
1027
|
}, [kline?.candles, kline?.preClose, wantTrend, item.priceScale, guides])
|
|
953
1028
|
const marks = item.marks || []
|
|
954
|
-
const
|
|
1029
|
+
const costBase = costBaseOf(marks)
|
|
955
1030
|
// 盈亏一律以最后一根收盘为准, 跟图例里的成分保持一致
|
|
956
1031
|
const lastClose = kline?.candles?.length ? finiteOr(kline.candles[kline.candles.length - 1].close) : null
|
|
957
|
-
const costPct =
|
|
1032
|
+
const costPct = costBase != null && Number.isFinite(lastClose) ? (lastClose - costBase) / costBase * 100 : null
|
|
958
1033
|
// 把一套主题色铺满整张图: 背景/网格/两轴边框/主序列/成交量/指标线/参考线。
|
|
959
1034
|
// 首灌与换主题共用同一份, 免得两处漏项(分时面积序列的键名与蜡烛不同)
|
|
960
1035
|
function repaintChart(t) {
|
|
@@ -1169,10 +1244,10 @@ window.__ModuleLoader__.load({
|
|
|
1169
1244
|
legend ? h('div', { className: 'ssb-kline-legend' },
|
|
1170
1245
|
// 成本与卖价都是报价要素, 跟开高低收放同一行; 放在指标行会被挤到第三行去
|
|
1171
1246
|
h('div', { className: 'ssb-legend-row' }, ...legend.quote.map(([label, value, tone]) => h('span', { key: label, className: `ssb-legend-item${tone || ''}` }, h('span', { className: 'ssb-legend-label' }, label), value == null ? '—' : value)),
|
|
1172
|
-
|
|
1247
|
+
costBase == null ? null : h('span', { className: 'ssb-legend-item ssb-legend-cost' }, h('span', { className: 'ssb-legend-label' }, marks.filter(m => m.kind === 'cost').length > 1 ? '成本(最低)' : '成本'), priceTextOf(costBase, item.priceScale), costPct == null ? null : h('span', { className: `ssb-legend-pct${toneClass(costPct)}` }, `${signed(costPct.toFixed(2))}%`)),
|
|
1173
1248
|
// 目标位只在图例里出现一次: 线在价格轴上, 具体数值看这里
|
|
1174
1249
|
...marks.filter(mark => mark.kind === 'target').map(mark => {
|
|
1175
|
-
const pct = markPct(mark, lastClose,
|
|
1250
|
+
const pct = markPct(mark, lastClose, costBase)
|
|
1176
1251
|
return h('span', { key: mark.id, className: 'ssb-legend-item ssb-legend-target' }, h('span', { className: 'ssb-legend-label' }, '卖价'), priceTextOf(mark.price, item.priceScale), pct == null ? null : h('span', { className: `ssb-legend-pct${toneClass(pct)}` }, `${signed(pct.toFixed(2))}%`))
|
|
1177
1252
|
})),
|
|
1178
1253
|
legend.series.length ? h('div', { className: 'ssb-legend-row' },
|
|
@@ -1251,12 +1326,14 @@ window.__ModuleLoader__.load({
|
|
|
1251
1326
|
const peekActions = inWatchlist ? null : h('div', { className: 'ssb-toolbar' }, h(Button, { primary: true, disabled: state.busy.write, onClick: quiet(() => runtime.mutate('add', { securityId: item.id })) }, '加自选'))
|
|
1252
1327
|
// 价格标记: 每条带语义(成本/卖价), 各自算盈亏, 图上一条线
|
|
1253
1328
|
const marks = item.marks || []
|
|
1254
|
-
const
|
|
1329
|
+
const costBase = costBaseOf(marks)
|
|
1255
1330
|
const lastN = Number(q?.last)
|
|
1256
|
-
const costPl =
|
|
1331
|
+
const costPl = costBase != null && lastN ? { amount: Number((lastN - costBase).toFixed(item.priceScale ?? 2)), pct: Number(((lastN - costBase) / costBase * 100).toFixed(1)) } : null
|
|
1257
1332
|
const applyMarks = next => quiet(() => runtime.mutate('marks', { securityId: item.id, marks: next }))
|
|
1258
1333
|
// 增删都是整组替换: 协议面只有一个操作, 也不会出现半更新的中间态
|
|
1259
|
-
|
|
1334
|
+
// 标记类型是成组分类切换, 用分段控件而不是两个按钮: 选中态不再靠"黑底按钮"承担
|
|
1335
|
+
const markKind = view.markDraft?.kind === 'target' ? 'target' : 'cost'
|
|
1336
|
+
const markForm = inWatchlist ? h('form', { className: 'ssb-inline-form', onSubmit: e => {
|
|
1260
1337
|
e.preventDefault()
|
|
1261
1338
|
const raw = String(view.markDraft?.price ?? '').trim()
|
|
1262
1339
|
const price = Number(raw)
|
|
@@ -1267,28 +1344,70 @@ window.__ModuleLoader__.load({
|
|
|
1267
1344
|
applyMarks([...marks, { id: crypto.randomUUID().slice(0, 8), price, kind }])()
|
|
1268
1345
|
runtime.updateView({ markDraft: null, markError: '' })
|
|
1269
1346
|
} },
|
|
1270
|
-
h('
|
|
1271
|
-
|
|
1272
|
-
h(
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1347
|
+
h('div', { className: 'ssb-seg', role: 'group', 'aria-label': '标记类型' },
|
|
1348
|
+
h('button', { type: 'button', className: `ssb-seg-opt${markKind === 'cost' ? ' ssb-seg-on' : ''}`, 'aria-pressed': markKind === 'cost', onClick: () => runtime.updateView({ markDraft: { kind: 'cost', price: view.markDraft?.price ?? '' } }) }, '成本'),
|
|
1349
|
+
h('button', { type: 'button', className: `ssb-seg-opt${markKind === 'target' ? ' ssb-seg-on' : ''}`, 'aria-pressed': markKind === 'target', onClick: () => runtime.updateView({ markDraft: { kind: 'target', price: view.markDraft?.price ?? '' } }) }, '卖价')),
|
|
1350
|
+
h('label', { className: 'ssb-inline-field' },
|
|
1351
|
+
h('span', { className: 'ssb-field-label' }, '价格'),
|
|
1352
|
+
h('input', { className: 'ssb-input ssb-input-num', value: view.markDraft?.price ?? '', inputMode: 'decimal', onChange: e => runtime.updateView({ markDraft: { kind: view.markDraft?.kind ?? 'cost', price: e.target.value }, markError: '' }), placeholder: '输入价格' })),
|
|
1353
|
+
h('button', { type: 'submit', className: 'ssb-button ssb-primary', disabled: state.busy.write }, '添加标记'),
|
|
1354
|
+
view.markError ? h('small', { className: 'ssb-form-error', role: 'alert' }, view.markError) : null) : null
|
|
1276
1355
|
const markList = marks.length ? h('ul', { className: 'ssb-mark-list', 'aria-label': '价格标记' }, ...marks.map(mark => {
|
|
1277
|
-
const pct = markPct(mark, lastN,
|
|
1356
|
+
const pct = markPct(mark, lastN, costBase)
|
|
1278
1357
|
return h('li', { key: mark.id, className: 'ssb-mark-row' },
|
|
1279
1358
|
h('span', { className: 'ssb-mark-kind' }, mark.kind === 'cost' ? '成本' : '卖价'),
|
|
1280
1359
|
h('span', { className: 'ssb-number' }, priceTextOf(mark.price, item.priceScale)),
|
|
1281
|
-
h('span', { className: `ssb-
|
|
1360
|
+
h('span', { className: `ssb-mark-pct${toneClass(pct)}` }, pct == null ? '—' : `${signed(pct.toFixed(2))}%`),
|
|
1282
1361
|
h(Button, { danger: true, disabled: state.busy.write, onClick: applyMarks(marks.filter(other => other.id !== mark.id)) }, '删除'))
|
|
1283
1362
|
})) : null
|
|
1284
|
-
//
|
|
1285
|
-
const
|
|
1286
|
-
const
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
h(
|
|
1363
|
+
// 分组标签: 一只票可同时属于多个分组, 整组替换提交; 已有标签 pill 一键加入, 新标签走输入框
|
|
1364
|
+
const tags = item.tags || []
|
|
1365
|
+
const allTags = [...new Set(Object.values(data.control.watchlist.items).flatMap(other => other.tags || []))]
|
|
1366
|
+
// 失败就地报错: 顶部横幅在抽屉之后, 详情里点标签出错时会被盖住
|
|
1367
|
+
const applyTags = next => () => runtime.mutate('tags', { securityId: item.id, tags: next }).then(() => runtime.updateView({ tagError: '' })).catch(e => runtime.updateView({ tagError: e?.message || '标签更新失败' }))
|
|
1368
|
+
const tagForm = inWatchlist ? h('div', { className: 'ssb-tag-editor' },
|
|
1369
|
+
tags.length ? h('div', { className: 'ssb-tag-chips', role: 'list', 'aria-label': '当前分组标签' }, ...tags.map(tag => h('span', { key: tag, className: 'ssb-tag-chip', role: 'listitem' }, tag,
|
|
1370
|
+
h('button', { type: 'button', className: 'ssb-tag-x', 'aria-label': `移除标签 ${tag}`, disabled: state.busy.write, onClick: applyTags(tags.filter(other => other !== tag)) }, '×'))))
|
|
1371
|
+
: h('p', { className: 'ssb-form-hint' }, '还没有分组标签;不加标签的票会落在「未分组」tab。'),
|
|
1372
|
+
(() => {
|
|
1373
|
+
const addable = allTags.filter(tag => !tags.includes(tag))
|
|
1374
|
+
return addable.length ? h('div', { className: 'ssb-tag-pills', role: 'group', 'aria-label': '已有分组标签' }, ...addable.map(tag => h('button', { key: tag, type: 'button', className: 'ssb-tag-pill', disabled: state.busy.write || tags.length >= MAX_TAGS, onClick: applyTags([...tags, tag]) }, `+ ${tag}`))) : null
|
|
1375
|
+
})(),
|
|
1376
|
+
h('form', { className: 'ssb-inline-form', onSubmit: e => {
|
|
1377
|
+
e.preventDefault()
|
|
1378
|
+
const raw = String(view.tagDraft || '').trim()
|
|
1379
|
+
if (!raw) { runtime.updateView({ tagError: '标签名不能为空' }); return }
|
|
1380
|
+
if ([...raw].length > 12) { runtime.updateView({ tagError: '标签名最多12字' }); return }
|
|
1381
|
+
if (tags.includes(raw)) { runtime.updateView({ tagError: '已有同名标签' }); return }
|
|
1382
|
+
if (tags.length >= MAX_TAGS) { runtime.updateView({ tagError: `每只最多 ${MAX_TAGS} 个标签` }); return }
|
|
1383
|
+
// 只有写入成功才清草稿: 失败要留着让用户改
|
|
1384
|
+
runtime.mutate('tags', { securityId: item.id, tags: [...tags, raw] }).then(() => runtime.updateView({ tagDraft: '', tagError: '' })).catch(() => { })
|
|
1385
|
+
} },
|
|
1386
|
+
h('label', { className: 'ssb-inline-field' }, h('span', { className: 'ssb-field-label' }, '新标签'), h('input', { className: 'ssb-input ssb-input-group', value: view.tagDraft || '', maxLength: 12, onChange: e => runtime.updateView({ tagDraft: e.target.value, tagError: '' }) })),
|
|
1387
|
+
h('button', { type: 'submit', className: 'ssb-button', disabled: state.busy.write }, '添加标签'),
|
|
1388
|
+
view.tagError ? h('small', { className: 'ssb-form-error', role: 'alert' }, view.tagError) : null)) : null
|
|
1389
|
+
const costBlock = costPl ? h('div', { className: `ssb-number${toneClass(costPl.amount)}` }, h('span', null, `持仓盈亏 ${signed(costPl.amount)} · ${signed(costPl.pct)}%`), h('span', { className: 'ssb-muted ssb-small' }, `成本价 ${priceTextOf(costBase, item.priceScale)}`)) : null
|
|
1390
|
+
// 自选设置: 低频管理动作收进区块头部, 表单按「价格标记 / 分组与别名」两栏并排,
|
|
1391
|
+
// 不再让四段表单各自占一列、按钮各自落一行
|
|
1392
|
+
const watchActions = inWatchlist ? h(React.Fragment, null,
|
|
1393
|
+
h('div', { className: 'ssb-forms-head' },
|
|
1394
|
+
h('h3', null, '自选设置'),
|
|
1395
|
+
h('div', { className: 'ssb-toolbar ssb-forms-actions' },
|
|
1396
|
+
h(Button, { disabled: state.busy.write, onClick: quiet(() => runtime.mutate('pin', { securityId: item.id, pinned: !item.pinned })) }, item.pinned ? '取消置顶' : '置顶'),
|
|
1397
|
+
h(Button, { danger: true, disabled: state.busy.write, onClick: () => { if (!confirm(`从自选移除「${item.alias || item.officialName}」?`)) return; quiet(() => runtime.mutate('remove', { securityId: item.id }))(); runtime.updateView({ detailId: null, selectedId: null, overlay: null, focusId: null }) } }, '移出自选'))),
|
|
1398
|
+
h('div', { className: 'ssb-forms-body' },
|
|
1399
|
+
h('section', { className: 'ssb-form-block' },
|
|
1400
|
+
h('h4', null, '价格标记'),
|
|
1401
|
+
markForm,
|
|
1402
|
+
markList,
|
|
1403
|
+
h('p', { className: 'ssb-form-hint' }, '多笔成本取最低价作为成本,盈亏按它算;每条成本单独显示与现价的百分比,卖价收益也按成本算。')),
|
|
1404
|
+
h('section', { className: 'ssb-form-block' },
|
|
1405
|
+
h('h4', null, '分组标签与别名'),
|
|
1406
|
+
tagForm,
|
|
1407
|
+
h('form', { className: 'ssb-inline-form', onSubmit: e => { e.preventDefault(); quiet(() => runtime.mutate('alias', { securityId: item.id, alias: view.alias }))() } },
|
|
1408
|
+
h('label', { className: 'ssb-inline-field' }, h('span', { className: 'ssb-field-label' }, '别名'), h('input', { className: 'ssb-input ssb-input-alias', value: view.alias || '', maxLength: 30, onChange: e => runtime.updateView({ alias: e.target.value }), 'aria-describedby': 'ssb-alias-hint' })),
|
|
1409
|
+
h('button', { type: 'submit', className: 'ssb-button', disabled: state.busy.write }, '保存别名')),
|
|
1410
|
+
h('p', { id: 'ssb-alias-hint', className: 'ssb-form-hint' }, '别名最多 30 个字符,留空显示正式名称。')))) : null
|
|
1292
1411
|
return h('aside', { className: 'ssb-detail' }, h('div', { className: 'ssb-section-head' }, h('h2', null, item.alias || item.officialName), inWatchlist && order.length > 1 ? h('div', { className: 'ssb-toolbar' }, h(Button, { onClick: () => openNeighbor(neighbor(-1)) }, '上一只'), h(Button, { onClick: () => openNeighbor(neighbor(1)) }, '下一只')) : null),
|
|
1293
1412
|
h('p', { className: 'ssb-muted' }, `${item.officialName} · ${marketLabel} ${item.code}${currency ? ` · ${currency}` : ''}`),
|
|
1294
1413
|
h('div', { className: `ssb-detail-price ssb-number${direction}` }, priceTextOf(q?.last, item.priceScale), h('span', { className: 'ssb-small' }, q?.changePct == null ? '—' : `${signed(q.changePct)}%`)),
|
|
@@ -1312,7 +1431,7 @@ window.__ModuleLoader__.load({
|
|
|
1312
1431
|
}
|
|
1313
1432
|
// ---- FloatingTicker: 悬浮盯盘, portal 到 body 常驻, 不随面板切换卸载 ----
|
|
1314
1433
|
// 悬浮窗自己的数据流: 列表模式批量拉勾选标的的报价, 图形模式只拉当前这只的分时
|
|
1315
|
-
function useFloatingPolling({ open, mode, securityId, picked, items, live,
|
|
1434
|
+
function useFloatingPolling({ open, mode, securityId, picked, items, live, floatSeconds, quotes, fetched, revision, setFetched, setTrend, setError }) {
|
|
1316
1435
|
// quotes 的每条是 { quote, health }, 交易时段在 quote 里
|
|
1317
1436
|
// 时段取最新的一份: 自己拉的和面板的都可能旧, 不能无条件让自己的压过面板的。
|
|
1318
1437
|
// 时间戳相同取自己那份——自己那份刚由这一拍的刷新拿到, 而面板可能在本次渲染前就已冻结
|
|
@@ -1359,9 +1478,9 @@ window.__ModuleLoader__.load({
|
|
|
1359
1478
|
}
|
|
1360
1479
|
pull()
|
|
1361
1480
|
// 休市时不设交易节奏的定时器, 但仍留一拍低频检查, 复盘后自动恢复
|
|
1362
|
-
const timer = setInterval(pull, floatPollDelay(
|
|
1481
|
+
const timer = setInterval(pull, floatPollDelay(floatSeconds, allQuiet))
|
|
1363
1482
|
return () => { dead = true; clearInterval(timer) }
|
|
1364
|
-
}, [open, mode, securityId, pickedKey, live,
|
|
1483
|
+
}, [open, mode, securityId, pickedKey, live, floatSeconds, stateKey])
|
|
1365
1484
|
}
|
|
1366
1485
|
// 拖动: 按住非控件区域移动, 松手时把落点写回偏好
|
|
1367
1486
|
function useFloatingDrag(onDrop) {
|
|
@@ -1395,9 +1514,13 @@ window.__ModuleLoader__.load({
|
|
|
1395
1514
|
},
|
|
1396
1515
|
}
|
|
1397
1516
|
}
|
|
1398
|
-
//
|
|
1399
|
-
const
|
|
1400
|
-
|
|
1517
|
+
// 悬浮窗自己的快慢档位: 只影响这个窗口的请求节奏, 与列表刷新间隔各管各的
|
|
1518
|
+
const FLOAT_INTERVALS = [3, 5, 10, 15, 30], FLOAT_FALLBACK_SECONDS = 10
|
|
1519
|
+
// 档位归一: 定时器、按钮文案与陈旧判定共用同一份取值, 避免非法存量值让三者各说各话
|
|
1520
|
+
const floatIntervalOf = floatSeconds => FLOAT_INTERVALS.includes(Number(floatSeconds)) ? Number(floatSeconds) : FLOAT_FALLBACK_SECONDS
|
|
1521
|
+
// 轮询节奏: 全部收市后压到一分钟一拍
|
|
1522
|
+
const floatPollDelay = (floatSeconds, quiet) => {
|
|
1523
|
+
const base = floatIntervalOf(floatSeconds) * 1000
|
|
1401
1524
|
return quiet ? Math.max(base, 60 * 1000) : base
|
|
1402
1525
|
}
|
|
1403
1526
|
// 主序列是蜡烛还是面积, 决定重涂时该下发哪一组键名: 两组键名互不相通, 用错等于没涂
|
|
@@ -1527,22 +1650,20 @@ window.__ModuleLoader__.load({
|
|
|
1527
1650
|
h('button', { type: 'button', className: 'ssb-float-icon', 'aria-label': picker ? '完成选择' : '选择观测目标', 'aria-expanded': picker, onClick: () => onPicker(!picker) }, picker ? '✓' : '☰'),
|
|
1528
1651
|
h('button', { type: 'button', className: 'ssb-float-icon', 'aria-label': '关闭悬浮盯盘', onClick: () => onClose() }, '✕'))
|
|
1529
1652
|
}
|
|
1653
|
+
// 多标签下一只票会同时属于多个分组, 按段列会重复出现: 选择器平铺全部标的, 顶部只留计数与全选
|
|
1530
1654
|
function FloatPicker({ order, items, picked, onPicked }) {
|
|
1531
|
-
const slices = groupSlices(order, items)
|
|
1532
1655
|
const toggleMany = (ids, on) => { const set = new Set(picked); ids.forEach(id => on ? set.add(id) : set.delete(id)); onPicked([...set]) }
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1656
|
+
// 与 tagTabs 同口径: 只有确实存在的标的参与勾选, 否则渲染时读不到名字会整块浮窗消失
|
|
1657
|
+
const ids = order.filter(id => items[id])
|
|
1658
|
+
const allOn = ids.length > 0 && ids.every(id => picked.includes(id))
|
|
1659
|
+
return h('div', { className: 'ssb-float-picker' }, ...(ids.length
|
|
1660
|
+
? [
|
|
1661
|
+
h('div', { key: 'summary', className: 'ssb-picker-head' },
|
|
1662
|
+
h('span', null, `已选 ${ids.filter(id => picked.includes(id)).length}/${ids.length}`),
|
|
1539
1663
|
h('button', { type: 'button', className: 'ssb-picker-all', onClick: () => toggleMany(ids, !allOn) }, allOn ? '全不选' : '全选')),
|
|
1540
|
-
...ids.map(id => h(Toggle, { key: id, label: items[id].alias || items[id].officialName, checked: picked.includes(id), onChange: () => toggleMany([id], !picked.includes(id)) }))
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
return h('div', { className: 'ssb-float-picker' }, ...(order.length
|
|
1544
|
-
? [block('pinned', '置顶', slices.pinned), ...slices.groups.map(group => block(`grp-${group.name}`, group.name, group.ids)), block('ungrouped', hasSections ? '未分组' : '', slices.ungrouped)]
|
|
1545
|
-
: [h('p', { className: 'ssb-muted' }, '自选为空')]))
|
|
1664
|
+
...ids.map(id => h(Toggle, { key: id, label: items[id].alias || items[id].officialName, checked: picked.includes(id), onChange: () => toggleMany([id], !picked.includes(id)) })),
|
|
1665
|
+
]
|
|
1666
|
+
: [h('p', { key: 'empty', className: 'ssb-muted' }, '自选为空')]))
|
|
1546
1667
|
}
|
|
1547
1668
|
function FloatList({ picked, items, securityId, entryOf, onPick, onTip, onLeave, onScroll }) {
|
|
1548
1669
|
return h('div', { className: 'ssb-float-list', onScroll },
|
|
@@ -1591,7 +1712,9 @@ window.__ModuleLoader__.load({
|
|
|
1591
1712
|
const securityId = (floating.securityId && picked.includes(floating.securityId) ? floating.securityId : picked[0]) || null
|
|
1592
1713
|
const update = next => setFloating(next)
|
|
1593
1714
|
const drag = useFloatingDrag(update)
|
|
1594
|
-
|
|
1715
|
+
// 悬浮窗节奏取自独立偏好, 列表间隔不再参与
|
|
1716
|
+
const floatRefresh = floatIntervalOf(state.data?.control.preferences?.floatRefreshSeconds)
|
|
1717
|
+
useFloatingPolling({ open, mode, securityId, picked, items, live: floating.live, floatSeconds: floatRefresh, quotes: state.data?.quotes, fetched, revision: state.data?.control.revision, setFetched, setTrend, setError })
|
|
1595
1718
|
// 面板已经刷过的报价先拿来渲染, 悬浮窗自己的 refresh 结果回来后再按 receivedAt 择优:
|
|
1596
1719
|
// 否则首次打开要干等一轮上游请求, 列表是空的
|
|
1597
1720
|
const entryOf = id => {
|
|
@@ -1660,19 +1783,17 @@ window.__ModuleLoader__.load({
|
|
|
1660
1783
|
const quoteTimes = stampIds.map(id => priceTimeOf(quoteOf(id))).filter(at => at != null)
|
|
1661
1784
|
const liveQuoteTimes = picked.filter(id => !QUIET_STATES.has(quoteOf(id)?.sessionState)).map(id => timestampOf(quoteOf(id)?.receivedAt)).filter(at => at != null)
|
|
1662
1785
|
const trendAt = mode === 'kline' ? (timestampOf(candles?.at(-1)?.at) ?? timestampOf(trendData?.fetchedAt)) : null
|
|
1663
|
-
const { stamp, stale } = floatFreshness({ mode, quoteTimes, liveQuoteTimes, trendAt, quiet: QUIET_STATES.has(quoteOf(securityId)?.sessionState), now: Date.now(), refreshSeconds:
|
|
1786
|
+
const { stamp, stale } = floatFreshness({ mode, quoteTimes, liveQuoteTimes, trendAt, quiet: QUIET_STATES.has(quoteOf(securityId)?.sessionState), now: Date.now(), refreshSeconds: floatRefresh })
|
|
1664
1787
|
// 这里必须先过 finiteOr: Number(null) 是 0, 会把缺失的昨收当成真实的 0 交给下游,
|
|
1665
1788
|
// 结果是迷你图基准画在 0、价格显示 "0", 与图例里的「昨收 —」自相矛盾
|
|
1666
1789
|
const last = finiteOr(candles?.at(-1)?.close)
|
|
1667
1790
|
const base = finiteOr(trendData?.preClose)
|
|
1668
1791
|
const pct = Number.isFinite(last) && Number.isFinite(base) && base ? (last - base) / base * 100 : null
|
|
1669
1792
|
const showRowTip = (id, event) => {
|
|
1670
|
-
//
|
|
1671
|
-
//
|
|
1672
|
-
const rect = event.currentTarget.getBoundingClientRect()
|
|
1673
|
-
|
|
1674
|
-
const lines = quoteTipLines({ quote: quoteOf(id), marks: item.marks, scale: item.priceScale }).length
|
|
1675
|
-
setRowTip({ id, left, top: rowTipPositionOf({ top: rect.top, bottom: rect.bottom, lines, viewportHeight: window.innerHeight }).top })
|
|
1793
|
+
// 行提示走公共悬浮组件(common-tools Tooltip):portal 到 body, 不受列表 overflow 裁剪;
|
|
1794
|
+
// 组件自己按视口夹取与换侧, 不再预估高度
|
|
1795
|
+
const rect = event.currentTarget.getBoundingClientRect()
|
|
1796
|
+
setRowTip({ id, anchor: { kind: 'rect', left: rect.left, top: rect.top, width: rect.width, height: rect.height } })
|
|
1676
1797
|
}
|
|
1677
1798
|
const greenUp = state.data?.control.preferences.colorMode === 'green-up' ? ' ssb-green-up' : ''
|
|
1678
1799
|
// 勾选写入一律按自选顺序重排, 否则反复勾选会把 ids 变成点击次序, 列表顺序会跳
|
|
@@ -1686,7 +1807,7 @@ window.__ModuleLoader__.load({
|
|
|
1686
1807
|
? h(FloatList, { picked, items, securityId, entryOf, onPick: id => update({ mode: 'kline', securityId: id }), onTip: showRowTip, onLeave: () => setRowTip(null), onScroll: () => setRowTip(null) })
|
|
1687
1808
|
: !current ? h('p', { className: 'ssb-muted' }, '未选择标的') : h(FloatChart, { securityId, current, candles, preClose: base, error, last, pct }),
|
|
1688
1809
|
h(FloatFoot, {
|
|
1689
|
-
mode, securityId, picked, current, stamp, stale, alertOn, error, liveOn: floating.live !== false, refresh:
|
|
1810
|
+
mode, securityId, picked, current, stamp, stale, alertOn, error, liveOn: floating.live !== false, refresh: floatRefresh,
|
|
1690
1811
|
onBell: () => { const next = !alertOn; alertStates.current = {}; setAlert({ on: next }); if (next) requestAlertPermission() },
|
|
1691
1812
|
onLive: () => {
|
|
1692
1813
|
if (!picked.length) return
|
|
@@ -1696,8 +1817,8 @@ window.__ModuleLoader__.load({
|
|
|
1696
1817
|
},
|
|
1697
1818
|
onDetail: () => { if (securityId) runtime.openDetail(securityId) },
|
|
1698
1819
|
}),
|
|
1699
|
-
rowTip && items[rowTip.id] ? h(
|
|
1700
|
-
...quoteTipLines({ quote: quoteOf(rowTip.id), marks: items[rowTip.id].marks, scale: items[rowTip.id].priceScale }).map((text, index) => h('
|
|
1820
|
+
rowTip && items[rowTip.id] ? h(tools.Tooltip, { anchor: rowTip.anchor },
|
|
1821
|
+
...quoteTipLines({ quote: quoteOf(rowTip.id), marks: items[rowTip.id].marks, scale: items[rowTip.id].priceScale }).map((text, index) => h('div', { key: index }, text))) : null)
|
|
1701
1822
|
}
|
|
1702
1823
|
function BrowseView({ runtime, state }) {
|
|
1703
1824
|
const { view, busy, data } = state
|
|
@@ -1728,7 +1849,7 @@ window.__ModuleLoader__.load({
|
|
|
1728
1849
|
h('div', { className: 'ssb-panel-head' }, h('h2', null, '添加自选'), h('div', { className: 'ssb-toolbar' }, h(Button, { onClick: () => runtime.updateView({ view: 'list' }) }, '返回自选'))),
|
|
1729
1850
|
h('div', { className: 'ssb-panel-body' },
|
|
1730
1851
|
h('div', { className: 'ssb-form-row' },
|
|
1731
|
-
h('
|
|
1852
|
+
h('div', { className: 'ssb-field' }, h('span', null, '市场'), h(Select, { value: view.searchMarket || 'all', label: '市场', options: [['all', '全部'], ['XSHG', '沪A股'], ['XSHE', '深A股'], ['XHKG', '港股'], ['XNAS', '美股(NASDAQ)'], ['XNYS', '美股(NYSE)'], ['XJPX', '日经'], ['XKRX', '韩证'], ['XLON', '伦敦']].map(([value, label]) => ({ value, label })), onChange: value => runtime.updateView({ searchMarket: value }) })),
|
|
1732
1853
|
h('label', { className: 'ssb-search-label' }, '搜索名称、代码或拼音首字母', h('input', { type: 'search', autoFocus: true, value: view.query, placeholder: '例如 600519、茅台、腾讯、AAPL', onChange: e => runtime.search(e.target.value), onCompositionStart: () => runtime.composition(true), onCompositionEnd: () => runtime.composition(false), onKeyDown: e => {
|
|
1733
1854
|
if (e.nativeEvent?.isComposing || state.composing) return
|
|
1734
1855
|
const at = visible.findIndex(c => c.id === view.selectedId)
|
|
@@ -1801,7 +1922,7 @@ window.__ModuleLoader__.load({
|
|
|
1801
1922
|
adapter?.description ? h('p', { className: 'ssb-provider-desc ssb-muted' }, adapter.description) : null,
|
|
1802
1923
|
expanded ? h('div', { className: 'ssb-provider-body', disabled: state.busy.configuration },
|
|
1803
1924
|
h('div', { className: 'ssb-provider-head' },
|
|
1804
|
-
h('
|
|
1925
|
+
h('div', { className: 'ssb-field ssb-provider-adapter' }, h('span', null, '适配器'), h(Select, { value: p.adapterId, label: '适配器', options: state.data.adapters.map(a => ({ value: a.adapterId, label: a.adapterId + (a.credential === 'none' ? '(免凭据)' : '') })), onChange: adapterId => { const descriptor = state.data.adapters.find(a => a.adapterId === adapterId); providerChange(p.id, { adapterId, credentialRef: descriptor?.credential === 'none' ? null : descriptor?.credential || null, quotaGroup: adapterId + '-account', budget: descriptor?.credential === 'none' && p.budget.requestsPerMinute === null ? { ...p.budget, requestsPerMinute: 60 } : p.budget }) } })),
|
|
1805
1926
|
h('div', { className: 'ssb-provider-switches' },
|
|
1806
1927
|
h(Toggle, { label: '启用', checked: p.enabled, onChange: value => providerChange(p.id, { enabled: value }) }),
|
|
1807
1928
|
h(Button, { danger: true, onClick: () => change({ providers: draft.providers.filter(other => other.id !== p.id), routes: draft.routes.filter(r => r.primaryInstanceId !== p.id).map(r => ({ ...r, fallbackInstanceIds: r.fallbackInstanceIds.filter(id => id !== p.id), failoverMode: r.fallbackInstanceIds.includes(p.id) ? 'off' : r.failoverMode })) }) }, '移除'))),
|
|
@@ -1812,7 +1933,7 @@ window.__ModuleLoader__.load({
|
|
|
1812
1933
|
openSource || !p.credentialRef ? null : h(CredentialField, { key: 'cred-' + p.id, runtime, refName: p.credentialRef, present: status?.credentialPresent }),
|
|
1813
1934
|
field('每分钟请求上限(留空仅允许探针)', p.budget.requestsPerMinute, value => providerChange(p.id, { budget: { ...p.budget, requestsPerMinute: value ? Number(value) : null } }), { type: 'number', min: 1 }),
|
|
1814
1935
|
field('每日请求上限(留空无限制)', p.budget.dailyRequestLimit, value => providerChange(p.id, { budget: { ...p.budget, dailyRequestLimit: value ? Number(value) : null } }), { type: 'number', min: 1 }),
|
|
1815
|
-
h('
|
|
1936
|
+
h('div', { className: 'ssb-field' }, h('span', null, '计费单位'), h(Select, { value: p.budget.billingUnit, label: '计费单位', options: [{ value: 'request', label: '请求' }, { value: 'symbol', label: '证券' }], onChange: value => providerChange(p.id, { budget: { ...p.budget, billingUnit: value } }) })),
|
|
1816
1937
|
p.budget.billingUnit === 'symbol' ? field('每分钟证券额度', p.budget.symbolCreditsPerMinute, value => providerChange(p.id, { budget: { ...p.budget, symbolCreditsPerMinute: value ? Number(value) : null } }), { type: 'number', min: 1 }) : null,
|
|
1817
1938
|
...['quotes', 'catalog', 'search', 'calendar'].map(cap => field(`${({ quotes: '报价', catalog: '目录', search: '搜索', calendar: '日历' })[cap]}每分钟上限`, p.budget.capabilityLimits[cap] ?? '', value => providerChange(p.id, { budget: { ...p.budget, capabilityLimits: Object.fromEntries(Object.entries({ ...p.budget.capabilityLimits, [cap]: value ? Number(value) : null }).filter(([, limit]) => limit !== null)) } }), { type: 'number', min: 1, key: cap })),
|
|
1818
1939
|
adapter?.endpointKeys?.length ? h('details', { key: 'ep-' + p.id, style: { gridColumn: '1 / -1' } },
|
|
@@ -1833,13 +1954,13 @@ window.__ModuleLoader__.load({
|
|
|
1833
1954
|
const allocation = marketRoutes.map(r => `${CAP_LABEL[r.capability]}: ${r.primaryInstanceId}${r.fallbackInstanceIds.length ? `(备 ${r.fallbackInstanceIds[0]})` : ''}`).join('\n')
|
|
1834
1955
|
const cells = caps.map(cap => {
|
|
1835
1956
|
const route = draft.routes.find(r => r.market === market && r.capability === cap)
|
|
1836
|
-
const options = [
|
|
1957
|
+
const options = [{ value: '', label: '未配置' }, ...draft.providers.filter(p => p.enabled && state.data.adapters.find(a => a.adapterId === p.adapterId)?.capabilities.includes(cap)).map(p => ({ value: p.id, label: p.id }))]
|
|
1837
1958
|
// 每个能力可单独探一次: 结果只做诊断展示, 不影响能否保存
|
|
1838
1959
|
const probeKey = route ? `${route.primaryInstanceId}:${cap}:${market}` : null
|
|
1839
1960
|
const probe = probeKey ? (draft.probes || {})[probeKey] : null
|
|
1840
1961
|
const probing = probeKey ? (draft.probing || {})[probeKey] : false
|
|
1841
1962
|
return h('div', { className: 'ssb-route-cell ssb-route-cell-probe', key: cap },
|
|
1842
|
-
h('
|
|
1963
|
+
h('div', { className: 'ssb-route-cell-main' }, h('span', { className: 'ssb-route-cell-label' }, CAP_LABEL[cap]), h(Select, { value: route?.primaryInstanceId || '', label: CAP_LABEL[cap], options, onChange: value => change({ routes: [...draft.routes.filter(r => r !== route), ...(value ? [routeFor(market, cap, value)] : [])] }) })),
|
|
1843
1964
|
route ? h('button', {
|
|
1844
1965
|
className: 'ssb-probe', disabled: probing, title: '单独测这一条能力:拉一次真实数据,报告成败与耗时',
|
|
1845
1966
|
onClick: quiet(async () => {
|
|
@@ -1866,10 +1987,10 @@ window.__ModuleLoader__.load({
|
|
|
1866
1987
|
const advanced = tuned.map(route => {
|
|
1867
1988
|
const cap = route.capability
|
|
1868
1989
|
const updateRoute = patch => change({ routes: draft.routes.map(r => r === route ? { ...r, ...patch } : r) })
|
|
1869
|
-
const options = [
|
|
1990
|
+
const options = [{ value: '', label: '无' }, ...draft.providers.filter(p => p.enabled && state.data.adapters.find(a => a.adapterId === p.adapterId)?.capabilities.includes(cap) && p.id !== route.primaryInstanceId).map(p => ({ value: p.id, label: p.id }))]
|
|
1870
1991
|
return h('div', { className: 'ssb-route-tune', key: cap },
|
|
1871
1992
|
h('span', { className: 'ssb-route-tune-label' }, CAP_LABEL[cap]),
|
|
1872
|
-
h('
|
|
1993
|
+
h('div', { className: 'ssb-field' }, h('span', null, '备用源'), h(Select, { value: route.fallbackInstanceIds[0] || '', label: '备用源', options, onChange: value => updateRoute({ fallbackInstanceIds: value ? [value] : [], failoverMode: 'off' }) })),
|
|
1873
1994
|
h(Toggle, { label: '自动切换', disabled: !route.fallbackInstanceIds.length, checked: route.failoverMode === 'network', onChange: on => updateRoute({ failoverMode: on ? 'network' : 'off' }) }),
|
|
1874
1995
|
cap === 'quotes' ? h(Toggle, { label: '接受延迟未知', checked: route.acceptUnknownDelay, onChange: on => updateRoute({ acceptUnknownDelay: on }) }) : null,
|
|
1875
1996
|
cap === 'quotes' ? h('label', { className: 'ssb-field ssb-route-delay' }, h('span', null, '最大延迟秒'), h('input', { type: 'number', min: 0, value: route.maxDelaySeconds ?? '', placeholder: '不限', onChange: e => updateRoute({ maxDelaySeconds: e.target.value ? Number(e.target.value) : null }) })) : null)
|
|
@@ -1918,7 +2039,10 @@ window.__ModuleLoader__.load({
|
|
|
1918
2039
|
h('h3', null, '目录缓存'), h('div', { className: 'ssb-toolbar' }, ...Object.keys(BROWSE_MARKETS).filter(market => (state.data.control.routes || []).some(r => r.capability === 'catalog' && r.market === market)).map(market => h(Button, { key: market, disabled: state.busy.sync, onClick: quiet(async () => { const results = await runtime.sync(market); const errors = results.filter(r => !r.ok); if (errors.length) tools.toast?.show(errors.map(r => r.error.message).join(';'), { kind: 'error' }) }) }, `同步${BROWSE_MARKETS[market]}`))),
|
|
1919
2040
|
...state.data.catalogs.map(c => h('p', { key: c.source, className: 'ssb-muted' }, `${c.source} · ${timeText(c.fetchedAt)}${c.stale ? ' · 已过期' : ''}${c.complete ? '' : ' · 目录可能不完整'}`)),
|
|
1920
2041
|
...Object.entries(state.data.routeSelections).filter(([id, selected]) => selected.providerInstanceId !== saved.routes.find(r => r.id === id)?.primaryInstanceId).map(([id, selected]) => h('div', { className: 'ssb-banner', key: id }, `${id}当前使用备用源 ${selected.providerInstanceId}。`, h(Button, { disabled: state.busy.switch, onClick: quiet(() => runtime.switchPrimary(id)) }, '检查并切回主源')))) :
|
|
1921
|
-
h(React.Fragment, null, h('h3', null, '显示偏好(即改即存)'), h('div', { className: 'ssb-toolbar' },
|
|
2042
|
+
h(React.Fragment, null, h('h3', null, '显示偏好(即改即存)'), h('div', { className: 'ssb-toolbar' },
|
|
2043
|
+
h('div', { className: 'ssb-field' }, h('span', null, '刷新间隔'), h(Select, { value: saved.preferences.refreshSeconds, label: '刷新间隔', disabled: state.busy.write || state.busy.configuration, options: [15, 30, 60].map(n => ({ value: n, label: `${n}秒` })), onChange: value => quiet(() => runtime.preferences({ refreshSeconds: value }))() })),
|
|
2044
|
+
h('div', { className: 'ssb-field' }, h('span', null, '悬浮盯盘刷新'), h(Select, { value: saved.preferences.floatRefreshSeconds ?? FLOAT_FALLBACK_SECONDS, label: '悬浮盯盘刷新', disabled: state.busy.write || state.busy.configuration, options: FLOAT_INTERVALS.map(n => ({ value: n, label: `${n}秒` })), onChange: value => quiet(() => runtime.preferences({ floatRefreshSeconds: value }))() })),
|
|
2045
|
+
h('div', { className: 'ssb-field' }, h('span', null, '涨跌颜色'), h(Select, { value: saved.preferences.colorMode, label: '涨跌颜色', disabled: state.busy.write || state.busy.configuration, options: [{ value: 'red-up', label: '红涨绿跌' }, { value: 'green-up', label: '绿涨红跌' }], onChange: value => quiet(() => runtime.preferences({ colorMode: value }))() }))))
|
|
1922
2046
|
const controlRoutes = saved.routes || []
|
|
1923
2047
|
const enabled = (saved.providers || []).filter(p => p.enabled).length
|
|
1924
2048
|
const markets = new Set(controlRoutes.map(r => r.market)).size
|
|
@@ -1931,21 +2055,43 @@ window.__ModuleLoader__.load({
|
|
|
1931
2055
|
pane)
|
|
1932
2056
|
}
|
|
1933
2057
|
const CSS = `
|
|
1934
|
-
.ssb-root,.ssb-float-root { --ssb-accent:var(--dsw-alias-brand-primary); --ssb-accent-deep:var(--dsw-alias-button-primary-hover); --ssb-on-accent:var(--dsw-alias-label-primary-inverted); --ssb-accent-wash:color-mix(in srgb,var(--dsw-alias-brand-primary) 12%,transparent); --ssb-ok:var(--dsw-alias-state-success-primary); --ssb-warn:var(--dsw-alias-state-warn-primary); --ssb-danger:var(--dsw-alias-state-error-primary); --ssb-bg:var(--dsw-alias-bg-layer-1); --ssb-bg-sub:var(--dsw-alias-bg-layer-2); --ssb-bg-muted:var(--dsw-alias-bg-module-platform); --ssb-border:var(--dsw-alias-border-l2); --ssb-text:var(--dsw-alias-label-primary); --ssb-text-sub:var(--dsw-alias-label-secondary); --ssb-text-dim:var(--dsw-alias-label-tertiary); --ssb-radius-sm:
|
|
2058
|
+
.ssb-root,.ssb-float-root { --ssb-accent:var(--dsw-alias-brand-primary); --ssb-accent-deep:var(--dsw-alias-button-primary-hover); --ssb-on-accent:var(--dsw-alias-label-primary-inverted); --ssb-accent-wash:color-mix(in srgb,var(--dsw-alias-brand-primary) 12%,transparent); --ssb-ok:var(--dsw-alias-state-success-primary); --ssb-warn:var(--dsw-alias-state-warn-primary); --ssb-danger:var(--dsw-alias-state-error-primary); --ssb-bg:var(--dsw-alias-bg-layer-1); --ssb-bg-sub:var(--dsw-alias-bg-layer-2); --ssb-bg-muted:var(--dsw-alias-bg-module-platform); --ssb-border:var(--dsw-alias-border-l2); --ssb-text:var(--dsw-alias-label-primary); --ssb-text-sub:var(--dsw-alias-label-secondary); --ssb-text-dim:var(--dsw-alias-label-tertiary); --ssb-hover:var(--dsw-alias-interactive-bg-hover); --ssb-radius-sm:var(--dsw-radius-sm); --ssb-radius-md:var(--dsw-radius-md); --ssb-radius-lg:var(--dsw-radius-lg); }
|
|
1935
2059
|
/* 图表区分色: 亮色取中低明度保证白底上不糊, 取值由 test/chart-colors.test.mjs 卡对比度与线间色差 */
|
|
1936
2060
|
.ssb-root,.ssb-float-root { --ssb-chart-ma-fast: hsl(45 96% 40%); --ssb-chart-ma-mid: hsl(280 88% 52%); --ssb-chart-ma-slow: hsl(189 94% 38%); --ssb-chart-ma-long: hsl(239 84% 56%); --ssb-chart-ema: hsl(330 81% 50%); --ssb-chart-boll-mid: hsl(217 91% 50%); --ssb-chart-boll-rail: hsl(213 90% 62%); --ssb-chart-bbi: hsl(160 84% 34%); --ssb-chart-cost: hsl(20 92% 45%); --ssb-chart-target: hsl(305 80% 45%); }
|
|
1937
2061
|
/* 暗色整体提亮一档, 否则深色线条直接溶进背景; 明暗标记由宿主写在 body 上 */
|
|
1938
2062
|
[data-ds-dark-theme] .ssb-root,[data-ds-dark-theme] .ssb-float-root { --ssb-chart-ma-fast: hsl(45 96% 58%); --ssb-chart-ma-mid: hsl(280 90% 72%); --ssb-chart-ma-slow: hsl(189 90% 58%); --ssb-chart-ma-long: hsl(239 88% 76%); --ssb-chart-ema: hsl(330 85% 68%); --ssb-chart-boll-mid: hsl(217 92% 68%); --ssb-chart-boll-rail: hsl(213 94% 80%); --ssb-chart-bbi: hsl(160 80% 56%); --ssb-chart-cost: hsl(20 95% 58%); --ssb-chart-target: hsl(305 85% 70%); }
|
|
1939
2063
|
/* 悬浮盯盘挂在 body 上, 与面板同源取色但不需要面板的整屏布局 */
|
|
1940
|
-
.ssb-root { height:100%; min-width:0; overflow:auto; color:var(--ssb-text); background:var(--ssb-bg); font:inherit; font-size:
|
|
1941
|
-
.ssb-float-root { color:var(--ssb-text); font:inherit; font-size:
|
|
2064
|
+
.ssb-root { height:100%; min-width:0; overflow:auto; color:var(--ssb-text); background:var(--ssb-bg); font:inherit; font-size:13px; line-height:20px; }
|
|
2065
|
+
.ssb-float-root { color:var(--ssb-text); font:inherit; font-size:13px; line-height:20px; }
|
|
1942
2066
|
.ssb-root *,.ssb-float-root * { box-sizing:border-box; }
|
|
1943
|
-
.ssb-page { max-width:1200px; margin:0 auto; padding:
|
|
1944
|
-
.ssb-root h1 { margin:0; font-size:20px; line-height:
|
|
1945
|
-
.ssb-tablist { display:flex; gap:
|
|
1946
|
-
|
|
1947
|
-
.ssb-
|
|
1948
|
-
|
|
2067
|
+
.ssb-page { max-width:1200px; margin:0 auto; padding:24px; }
|
|
2068
|
+
.ssb-root h1 { margin:0; font-size:20px; font-weight:500; line-height:28px; }.ssb-root h2 { margin:0; font-size:16px; font-weight:600; line-height:24px; }.ssb-root h3 { margin:24px 0 12px; font-size:14px; }
|
|
2069
|
+
.ssb-tablist { display:flex; gap:24px; border-bottom:.5px solid var(--ssb-border); margin:0 0 16px; }
|
|
2070
|
+
/* 自选分组 tab: 横向可滚动, 与设置页 tab 同一形态, 只在容器边距上去掉页面级间距 */
|
|
2071
|
+
.ssb-tabs { display:flex; gap:4px; border-bottom:.5px solid var(--ssb-border); padding:0 16px; overflow-x:auto; }.ssb-tabs .ssb-tab { flex:0 0 auto; padding:10px 8px; }
|
|
2072
|
+
/* 分组标签编辑: 已选 tags 用 chips, 可加入的已有标签用虚线 pill, 都是可点按钮而不是纯装饰 */
|
|
2073
|
+
.ssb-tag-editor { display:grid; gap:8px; }.ssb-tag-chips,.ssb-tag-pills { display:flex; flex-wrap:wrap; gap:6px; }
|
|
2074
|
+
.ssb-tag-chip { display:inline-flex; align-items:center; height:24px; padding:0 4px 0 8px; border-radius:999px; background:var(--ssb-accent-wash); color:var(--ssb-accent); font-size:11px; }
|
|
2075
|
+
.ssb-tag-x { display:inline-flex; align-items:center; justify-content:center; min-width:24px; height:24px; border:0; background:transparent; color:inherit; font:inherit; line-height:1; padding:0; cursor:pointer; }.ssb-tag-x:hover { color:var(--ssb-danger); }
|
|
2076
|
+
.ssb-tag-pill { border:1px dashed var(--ssb-border); background:transparent; color:var(--ssb-text-sub); border-radius:999px; height:24px; padding:0 10px; font:inherit; font-size:11px; cursor:pointer; }.ssb-tag-pill:hover { border-color:var(--ssb-accent); color:var(--ssb-accent); }
|
|
2077
|
+
.ssb-tag-rename { padding:0 16px 8px; }.ssb-section-head .ssb-toolbar { margin:0; }.ssb-tab { font:inherit; font-size:13px; color:var(--ssb-text-sub); background:transparent; border:0; border-bottom:2px solid transparent; padding:10px 2px; cursor:pointer; }.ssb-tab-on { color:var(--ssb-text); border-bottom-color:var(--ssb-accent); font-weight:600; }.ssb-header,.ssb-toolbar,.ssb-section-head,.ssb-row-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }.ssb-header { justify-content:space-between; align-items:flex-start; margin-bottom:16px; gap:16px; }.ssb-header-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }.ssb-header p { margin:6px 0 0; }.ssb-section-head { justify-content:space-between; padding:16px; }.ssb-section-head h2[tabindex="-1"]:focus { outline:none; }.ssb-toolbar { margin:12px 0; }
|
|
2078
|
+
.ssb-button { color:var(--ssb-text); background:transparent; border:1px solid var(--ssb-border); border-radius:var(--ssb-radius-sm); min-height:32px; padding:0 12px; font:inherit; font-size:13px; cursor:pointer; transition:background .15s; white-space:nowrap; }.ssb-button:hover { background:var(--dsw-alias-interactive-bg-hover); }.ssb-button.ssb-primary { background:var(--ssb-accent); color:var(--ssb-on-accent); border-color:var(--ssb-accent); }.ssb-button.ssb-primary:hover { background:var(--ssb-accent-deep); }.ssb-button.ssb-danger { color:var(--ssb-danger); }.ssb-root button:disabled { opacity:.5; cursor:not-allowed; }.ssb-root :focus-visible { outline:2px solid var(--dsw-alias-state-business-primary); outline-offset:2px; }
|
|
2079
|
+
.ssb-root input:not([type=checkbox]) { background:var(--ssb-bg); color:var(--ssb-text); border:1px solid var(--ssb-border); border-radius:var(--ssb-radius-sm); min-height:32px; padding:6px 8px; font:inherit; max-width:100%; }
|
|
2080
|
+
.ssb-select { position:relative; display:inline-flex; min-width:0; max-width:100%; }
|
|
2081
|
+
.ssb-select-trigger { display:inline-flex; align-items:center; justify-content:space-between; gap:8px; min-height:32px; padding:6px 8px; background:var(--ssb-bg); color:var(--ssb-text); border:1px solid var(--ssb-border); border-radius:var(--ssb-radius-sm); font:inherit; font-size:13px; line-height:1.4; text-align:left; cursor:pointer; max-width:100%; }
|
|
2082
|
+
.ssb-select-trigger:hover:not(:disabled) { border-color:var(--ssb-text-dim); }
|
|
2083
|
+
.ssb-select-trigger:disabled { opacity:.5; cursor:not-allowed; }
|
|
2084
|
+
.ssb-select-value { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
2085
|
+
.ssb-select-caret { flex:none; width:6px; height:6px; border-right:1.5px solid var(--ssb-text-sub); border-bottom:1.5px solid var(--ssb-text-sub); transform:translateY(-2px) rotate(45deg); }
|
|
2086
|
+
.ssb-select-menu { position:fixed; z-index:2; display:flex; flex-direction:column; gap:1px; padding:4px; overflow:auto; background:var(--ssb-bg-sub); border:1px solid var(--ssb-border); border-radius:var(--ssb-radius-sm); box-shadow:var(--dsw-shadow-lv3); }
|
|
2087
|
+
.ssb-select-menu[hidden] { display:none; }
|
|
2088
|
+
.ssb-select-option { display:flex; align-items:center; min-height:28px; padding:4px 8px; border-radius:var(--ssb-radius-sm); font-size:13px; color:var(--ssb-text); white-space:nowrap; cursor:pointer; }
|
|
2089
|
+
.ssb-select-option-active { background:var(--ssb-hover); }
|
|
2090
|
+
.ssb-select-option[aria-selected="true"] { color:var(--ssb-accent); }
|
|
2091
|
+
.ssb-select-option[aria-selected="true"].ssb-select-option-active { background:var(--ssb-accent-wash); }.ssb-field { display:flex; flex-direction:column; gap:6px; min-width:0; }.ssb-muted { color:var(--ssb-text-sub); }.ssb-code,.ssb-source { display:block; font-size:11px; }.ssb-code,.ssb-number { font-family:var(--ds-font-family-code); font-variant-numeric:tabular-nums; }.ssb-code { color:var(--ssb-text-sub); margin-top:4px; }.ssb-small { font-size:13px; margin-left:12px; }
|
|
2092
|
+
.ssb-content { display:grid; grid-template-columns:minmax(0,1fr); gap:16px; }
|
|
2093
|
+
/* 浮层须压过宿主侧栏拖拽手柄; 取 60 与其它插件弹窗同档, 仍在宿主抽屉遮罩之下 */
|
|
2094
|
+
.ssb-overlay { position:fixed; inset:0; background:color-mix(in srgb, var(--dsw-alias-label-primary) 45%, transparent); display:flex; z-index:60; animation:ssb-fade .15s ease-out; }.ssb-drawer { animation:ssb-slide .2s ease-out; }.ssb-modal-card { animation:ssb-pop .18s ease-out; }@keyframes ssb-fade { from { opacity:0; } }@keyframes ssb-slide { from { transform:translateX(40px); opacity:0; } }@keyframes ssb-pop { from { transform:scale(.96); opacity:0; } }.ssb-overlay-drawer { justify-content:flex-end; }.ssb-overlay-modal { align-items:center; justify-content:center; padding:24px; }.ssb-drawer { width:min(80vw,94vw); height:100%; overflow:auto; background:var(--ssb-bg); border-left:1px solid var(--ssb-border); box-shadow:var(--dsw-shadow-lv3); padding:16px; }.ssb-modal-card { width:min(880px,94vw); max-height:88vh; overflow:auto; background:var(--ssb-bg); border:1px solid var(--ssb-border); border-radius:var(--ssb-radius-lg); box-shadow:var(--dsw-shadow-lv3); padding:16px; }.ssb-drawer-head { display:flex; justify-content:flex-end; }.ssb-drawer .ssb-detail, .ssb-drawer .ssb-settings { border:0; padding:0; background:transparent; }.ssb-list-pane,.ssb-detail { border:.5px solid var(--ssb-border); border-radius:var(--ssb-radius-md); min-width:0; }.ssb-detail { padding:16px; background:var(--ssb-bg-sub); }.ssb-detail .ssb-section-head { padding:0; }.ssb-detail-price { font-size:28px; margin:20px 0 4px; }.ssb-table-scroll { max-height:65vh; overflow:auto; border-radius:0 0 var(--ssb-radius-md) var(--ssb-radius-md); }.ssb-foot { margin:12px 0 4px; }.ssb-table { width:100%; border-collapse:collapse; table-layout:auto; }.ssb-table th { color:var(--ssb-text-sub); font-weight:400; font-size:12px; background:var(--ssb-bg-sub); position:sticky; top:0; z-index:1; }.ssb-table td,.ssb-table th { padding:8px 12px; text-align:left; border-top:.5px solid var(--ssb-border); }.ssb-table td.ssb-number { text-align:right; white-space:nowrap; }.ssb-table tr:hover { background:var(--dsw-alias-interactive-bg-hover); }.ssb-selected { background:var(--ssb-accent-wash); }.ssb-stock-name { font:inherit; color:inherit; background:transparent; border:0; padding:0; text-align:left; cursor:pointer; }.ssb-stale td.ssb-number { opacity:.65; }.ssb-up { color:var(--ssb-danger); }.ssb-down { color:var(--ssb-ok); }.ssb-green-up .ssb-up { color:var(--ssb-ok); }.ssb-green-up .ssb-down { color:var(--ssb-danger); }
|
|
1949
2095
|
.ssb-table th.ssb-number { text-align:right; }.ssb-table th.ssb-col-status { text-align:right; }
|
|
1950
2096
|
.ssb-table td { vertical-align:middle; padding-top:8px; padding-bottom:8px; }.ssb-table td:first-child { max-width:240px; }
|
|
1951
2097
|
.ssb-stock-name { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; }
|
|
@@ -1977,10 +2123,10 @@ window.__ModuleLoader__.load({
|
|
|
1977
2123
|
.ssb-row .ssb-code { margin-top:0; flex:0 0 auto; font-size:11px; color:var(--ssb-text-dim); }
|
|
1978
2124
|
.ssb-cell-price,.ssb-cell-pct,.ssb-cell-change,.ssb-cell-open,.ssb-cell-amount,.ssb-cell-amplitude,.ssb-cell-pl { text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; font-family:var(--ds-font-family-code); }
|
|
1979
2125
|
.ssb-cell-range { white-space:nowrap; color:var(--ssb-text-dim); font-variant-numeric:tabular-nums; font-family:var(--ds-font-family-code); }
|
|
1980
|
-
.ssb-cell-price { font-size:
|
|
2126
|
+
.ssb-cell-price { font-size:14px; font-weight:600; }
|
|
1981
2127
|
.ssb-cell-amount,.ssb-cell-amplitude,.ssb-cell-open { color:var(--ssb-text-dim); }
|
|
1982
2128
|
.ssb-col-status { justify-self:end; }
|
|
1983
|
-
.ssb-pill { display:inline-block; padding:0
|
|
2129
|
+
.ssb-pill { display:inline-block; padding:0 6px; border-radius:var(--ssb-radius-sm); background:color-mix(in srgb, currentColor 12%, transparent); }
|
|
1984
2130
|
|
|
1985
2131
|
|
|
1986
2132
|
|
|
@@ -1993,7 +2139,7 @@ window.__ModuleLoader__.load({
|
|
|
1993
2139
|
.ssb-cell-open,.ssb-cell-range,.ssb-cell-amount,.ssb-cell-amplitude,.ssb-cell-pl { display:none; }
|
|
1994
2140
|
.ssb-row-sub { display:flex; gap:10px; margin-top:2px; padding-left:20px; font-size:12px; color:var(--ssb-text-dim); font-variant-numeric:tabular-nums; font-family:var(--ds-font-family-code); }
|
|
1995
2141
|
}
|
|
1996
|
-
.ssb-kv { display:inline-flex; gap:
|
|
2142
|
+
.ssb-kv { display:inline-flex; gap:4px; white-space:nowrap; }
|
|
1997
2143
|
/* 悬浮盯盘: 固定右下角, 尺寸以 4px 刻度, 只做轻边框分层不挂阴影 */
|
|
1998
2144
|
.ssb-float { position:fixed; right:24px; bottom:24px; z-index:60; width:288px; max-height:calc(100vh - 48px); display:flex; flex-direction:column; gap:8px; padding:12px; background:var(--ssb-bg); border:1px solid var(--ssb-border); border-radius:var(--ssb-radius-lg); box-shadow:var(--dsw-shadow-lv3); font-size:12px; }
|
|
1999
2145
|
/* 拖动只从标题条发起: touch-action 取的是路径交集, 父级给 none 会把列表的 pan-y 一起废掉 */
|
|
@@ -2019,12 +2165,11 @@ window.__ModuleLoader__.load({
|
|
|
2019
2165
|
.ssb-float-hover strong { font-size:12px; font-weight:600; }
|
|
2020
2166
|
/* 右侧价格刻度: 每个价位配一个实心小点, 只给数字看不出对应位置 */
|
|
2021
2167
|
.ssb-float-axis { position:absolute; top:0; right:0; bottom:0; width:40px; pointer-events:none; font-size:11px; color:var(--ssb-text-dim); font-variant-numeric:tabular-nums; font-family:var(--ds-font-family-code); }
|
|
2022
|
-
.ssb-float-tick { position:absolute; right:36px; width:6px; height:2px; border-radius:
|
|
2168
|
+
.ssb-float-tick { position:absolute; right:36px; width:6px; height:2px; border-radius:999px; background:var(--ssb-text-sub); transform:translateY(-50%); }
|
|
2023
2169
|
.ssb-float-tick-value { position:absolute; right:1px; transform:translateY(-50%); white-space:nowrap; }
|
|
2024
2170
|
/* 标记价常驻行: 图外再给一份完整清单, 范围外的标记也能看到 */
|
|
2025
2171
|
.ssb-float-marks { display:flex; flex-wrap:wrap; gap:2px 8px; font-size:11px; font-variant-numeric:tabular-nums; font-family:var(--ds-font-family-code); }
|
|
2026
2172
|
/* 列表悬停浮层用 fixed 定位, 列表容器的 overflow:auto 裁不到它 */
|
|
2027
|
-
.ssb-float-rowtip { position:fixed; z-index:70; width:184px; padding:6px 8px; display:flex; flex-direction:column; gap:2px; pointer-events:none; border:1px solid var(--ssb-border); border-radius:var(--ssb-radius-sm); background:var(--ssb-bg); box-shadow:var(--dsw-shadow-lv3); font-size:11px; line-height:1.4; color:var(--ssb-text-sub); font-variant-numeric:tabular-nums; font-family:var(--ds-font-family-code); }
|
|
2028
2173
|
/* 曲线用 currentColor 取色: 有涨跌时由 .ssb-up/.ssb-down 决定, 只在两者都没有时退回次要文字色 */
|
|
2029
2174
|
.ssb-float-chart:not(.ssb-up):not(.ssb-down) { color:var(--ssb-text-sub); }
|
|
2030
2175
|
.ssb-float-line { fill:none; stroke:currentColor; stroke-width:1.5; vector-effect:non-scaling-stroke; }
|
|
@@ -2048,9 +2193,8 @@ window.__ModuleLoader__.load({
|
|
|
2048
2193
|
.ssb-float-live:disabled { opacity:.5; cursor:not-allowed; }
|
|
2049
2194
|
/* 列表模式: 每行一只标的, 点击切到该只的图形 */
|
|
2050
2195
|
.ssb-float-list,.ssb-float-picker { flex:0 1 auto; min-height:0; display:flex; flex-direction:column; gap:2px; max-height:min(300px, 45vh); overflow:auto; }
|
|
2051
|
-
.ssb-picker-group { display:flex; flex-direction:column; gap:2px; }
|
|
2052
2196
|
.ssb-picker-head { display:flex; align-items:center; gap:6px; padding:4px 2px 2px; font-size:11px; color:var(--ssb-text-dim); border-top:1px solid var(--ssb-border); }
|
|
2053
|
-
.ssb-picker
|
|
2197
|
+
.ssb-float-picker .ssb-picker-head:first-child { border-top:none; }
|
|
2054
2198
|
.ssb-picker-head > span { flex:1 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
2055
2199
|
.ssb-picker-all { flex:0 0 auto; padding:1px 6px; font:inherit; font-size:11px; color:var(--ssb-accent); background:transparent; border:1px solid var(--ssb-border); border-radius:var(--ssb-radius-sm); cursor:pointer; }
|
|
2056
2200
|
.ssb-picker-all:hover { border-color:var(--ssb-accent); }
|
|
@@ -2066,9 +2210,8 @@ window.__ModuleLoader__.load({
|
|
|
2066
2210
|
.ssb-float-mode { padding:2px 6px; font:inherit; font-size:11px; color:var(--ssb-text-sub); background:transparent; border:1px solid transparent; border-radius:var(--ssb-radius-sm); cursor:pointer; }
|
|
2067
2211
|
.ssb-float-mode.on { color:var(--ssb-text); border-color:var(--ssb-border); background:var(--ssb-bg-sub); }
|
|
2068
2212
|
.ssb-float-picker .ssb-switch { font-size:11px; }
|
|
2069
|
-
.ssb-group-head { display:flex; align-items:center; gap:8px; flex-wrap:wrap; height:32px; padding:0 12px; border-top:1px solid var(--ssb-border); background:var(--ssb-bg-sub); font-size:12px; color:var(--ssb-text-sub); }
|
|
2070
2213
|
.ssb-dot { display:inline-block; width:6px; height:6px; border-radius:50%; background:var(--ssb-ok); flex:0 0 auto; }.ssb-dot.ssb-dot-warn { background:var(--ssb-warn); }.ssb-dot.ssb-dot-danger { background:var(--ssb-danger); }.ssb-dot.ssb-dot-idle { background:var(--ssb-text-dim); }
|
|
2071
|
-
.ssb-facts { display:grid; grid-template-columns:1fr 1fr; gap:8px; border-top:1px solid var(--ssb-border); padding-top:16px; margin-top:16px; }.ssb-mark-list { list-style:none; margin:0; padding:0; display:flex; flex-direction:column;
|
|
2214
|
+
.ssb-facts { display:grid; grid-template-columns:1fr 1fr; gap:8px; border-top:1px solid var(--ssb-border); padding-top:16px; margin-top:16px; }.ssb-mark-list { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; }.ssb-mark-row { display:grid; grid-template-columns:44px minmax(0,1fr) 72px auto; align-items:center; gap:8px; min-height:32px; border-bottom:1px solid var(--ssb-border); }.ssb-mark-row:last-child { border-bottom:0; }.ssb-mark-row .ssb-number { justify-self:end; }.ssb-mark-row .ssb-button { min-height:24px; padding:2px 8px; border-color:transparent; }.ssb-mark-row .ssb-button:hover { background:color-mix(in srgb, var(--ssb-danger) 10%, transparent); }.ssb-mark-kind { color:var(--ssb-text-sub); font-size:11px; }.ssb-mark-pct { justify-self:end; font-variant-numeric:tabular-nums; }.ssb-credential { display:grid; gap:8px; justify-items:start; }.ssb-credential .ssb-field { width:100%; }.ssb-credential-actions { display:flex; align-items:center; gap:8px; }.ssb-facts dt { color:var(--ssb-text-sub); }.ssb-facts dd { margin:0; text-align:right; overflow-wrap:anywhere; font-family:var(--ds-font-family-code); }.ssb-detail-forms { display:grid; gap:12px; border-top:1px solid var(--ssb-border); padding-top:16px; margin-top:16px; }.ssb-forms-head { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }.ssb-forms-head h3 { margin:0; font-size:12px; font-weight:600; color:var(--ssb-text-sub); }.ssb-forms-actions { margin:0; }.ssb-forms-body { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:16px 32px; align-items:start; }.ssb-form-block { display:grid; gap:8px; align-content:start; min-width:0; max-width:480px; }.ssb-form-block h4 { margin:0; font-size:11px; font-weight:400; color:var(--ssb-text-dim); }.ssb-inline-form { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }.ssb-inline-field { display:flex; align-items:center; gap:8px; min-width:0; }.ssb-field-label { flex:0 0 auto; color:var(--ssb-text-sub); font-size:12px; }.ssb-root .ssb-inline-form input { min-height:28px; padding:4px 8px; font-size:12px; }.ssb-input-num { width:112px; }.ssb-input-group,.ssb-input-alias { width:168px; }.ssb-form-hint { margin:0; color:var(--ssb-text-dim); font-size:11px; }.ssb-form-error { color:var(--ssb-text-sub); font-size:11px; }.ssb-seg { display:inline-flex; height:28px; border:1px solid var(--ssb-border); border-radius:var(--ssb-radius-sm); overflow:hidden; background:var(--ssb-bg); }.ssb-seg-opt { border:0; background:transparent; color:var(--ssb-text-sub); font:inherit; font-size:12px; padding:0 10px; cursor:pointer; transition:background .15s; }.ssb-seg-opt + .ssb-seg-opt { border-left:1px solid var(--ssb-border); }.ssb-seg-opt:hover { background:var(--dsw-alias-interactive-bg-hover); }.ssb-seg-opt.ssb-seg-on { background:var(--ssb-accent-wash); color:var(--ssb-accent); font-weight:500; }
|
|
2072
2215
|
.ssb-settings-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; flex-wrap:wrap; }.ssb-settings-intro { min-width:0; display:grid; gap:6px; }.ssb-settings-intro p { margin:0; }
|
|
2073
2216
|
.ssb-provider-head { display:flex; align-items:flex-end; justify-content:space-between; gap:12px; flex-wrap:wrap; }.ssb-provider-adapter { flex:0 0 240px; }.ssb-provider-switches { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }.ssb-provider-desc { margin:8px 0 0; }.ssb-provider-advanced { margin-top:8px; }.ssb-provider-advanced > summary { cursor:pointer; }
|
|
2074
2217
|
/* 摘要行: 数据源与市场默认收成一行, 点开才展开编辑区 */
|
|
@@ -2110,11 +2253,11 @@ window.__ModuleLoader__.load({
|
|
|
2110
2253
|
.ssb-menu-title { padding:8px 8px 2px; font-size:11px; color:var(--ssb-text-dim); }.ssb-kline-holder { height:340px; border:1px solid var(--ssb-border); border-radius:var(--ssb-radius-sm); }
|
|
2111
2254
|
.ssb-kline-chart { position:relative; }
|
|
2112
2255
|
/* 十字线读数: 贴光标右上, 指针穿透, 不挡拖动时间轴 */
|
|
2113
|
-
.ssb-kline-tip { position:absolute; z-index:3; width:200px; padding:
|
|
2256
|
+
.ssb-kline-tip { position:absolute; z-index:3; width:200px; padding:8px 10px; border:1px solid var(--ssb-border); border-radius:var(--ssb-radius-md); background:var(--ssb-bg-sub); box-shadow:var(--dsw-shadow-lv3); font-size:12px; line-height:1.5; color:var(--ssb-text-sub); font-family:var(--ds-font-family-code); font-variant-numeric:tabular-nums; pointer-events:none; }
|
|
2114
2257
|
.ssb-kline-tip-time { color:var(--ssb-text); }.ssb-kline-skeleton { height:340px; border:1px dashed var(--ssb-border); border-radius:var(--ssb-radius-sm); display:flex; align-items:center; justify-content:center; color:var(--ssb-text-sub); margin-bottom:8px; }
|
|
2115
2258
|
.ssb-detail-grid { display:grid; grid-template-columns:minmax(0,1fr) 240px; gap:16px; align-items:start; }.ssb-detail-side { min-width:0; }.ssb-detail-side .ssb-facts { grid-template-columns:auto minmax(0,1fr); gap:6px 12px; }.ssb-detail-side .ssb-facts dt { white-space:nowrap; }
|
|
2116
|
-
.ssb-empty { padding:
|
|
2117
|
-
.ssb-switch { display:inline-flex; align-items:center; gap:8px; cursor:pointer; position:relative; }.ssb-switch input[type="checkbox"] { position:absolute; opacity:0; width:1px; height:1px; }.ssb-switch__track { display:inline-flex; flex-shrink:0; align-items:center; width:34px; height:19px; padding:3px; border-radius:999px; background:var(--ssb-bg-muted); border:1px solid var(--ssb-border); transition:background .15s ease; }.ssb-switch__thumb { width:13px; height:13px; border-radius:50%; background:var(--ssb-text-sub); transition:transform .15s ease; }.ssb-switch input[type="checkbox"]:checked + .ssb-switch__track { background:var(--ssb-accent); }.ssb-switch input[type="checkbox"]:checked + .ssb-switch__track .ssb-switch__thumb { transform:translateX(13px); background:var(--ssb-bg); }.ssb-switch input[type="checkbox"]:focus-visible + .ssb-switch__track { outline:2px solid var(--dsw-alias-state-business-primary); outline-offset:2px; }.ssb-switch input[type="checkbox"]:disabled + .ssb-switch__track { opacity:.5; cursor:not-allowed; }.ssb-switch:hover .ssb-switch__track { border-color:var(--ssb-accent); }
|
|
2259
|
+
.ssb-empty { padding:48px 16px; color:var(--ssb-text-sub); text-align:center; font-size:14px; }.ssb-banner { border:1px solid var(--ssb-border); border-left:3px solid var(--ssb-warn); border-radius:var(--ssb-radius-sm); padding:12px; margin:12px 0; display:flex; align-items:center; gap:12px; flex-wrap:wrap; }.ssb-banner-ok { border-left-color:var(--ssb-ok); }.ssb-error { border-left-color:var(--ssb-danger); }.ssb-banner p { margin:0; }.ssb-search-view { max-width:760px; border:1px solid var(--ssb-border); border-radius:var(--ssb-radius-md); background:var(--ssb-bg); padding-bottom:4px; }.ssb-panel-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px; border-bottom:.5px solid var(--ssb-border); flex-wrap:wrap; }.ssb-panel-head h2 { font-size:16px; margin:0; }.ssb-panel-body { padding:16px; display:flex; flex-direction:column; gap:12px; }.ssb-form-row { display:flex; gap:12px; align-items:flex-end; flex-wrap:wrap; }.ssb-form-row > .ssb-field { flex:0 0 176px; }.ssb-search-label { display:grid; gap:8px; margin-top:20px; }.ssb-form-row > .ssb-search-label { flex:1 1 300px; margin-top:0; }.ssb-results { display:grid; gap:8px; margin:16px; }.ssb-candidate { padding:10px 12px; display:flex; justify-content:space-between; align-items:center; gap:12px; background:transparent; border:1px solid var(--ssb-border); border-radius:var(--ssb-radius-sm); color:var(--ssb-text); font:inherit; cursor:pointer; }.ssb-candidate:hover { border-color:var(--ssb-accent); }.ssb-candidate.ssb-selected { background:var(--ssb-accent-wash); border-color:var(--ssb-accent); }.ssb-peek { display:flex; flex:1; flex-direction:column; gap:2px; text-align:left; cursor:pointer; min-width:0; }.ssb-peek:hover strong { text-decoration:underline; }.ssb-provider { border:1px solid var(--ssb-border); border-radius:var(--ssb-radius-md); padding:16px; margin:12px 0; min-width:0; }.ssb-provider legend { padding:0 6px; color:var(--ssb-text-sub); }.ssb-provider details { grid-column:1 / -1; }.ssb-provider summary { cursor:pointer; }.ssb-reqlog { margin:8px 0 0; padding:0 0 0 18px; color:var(--ssb-text-sub); }.ssb-form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }.ssb-route-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(132px,1fr)); gap:12px; }.ssb-route-cell { display:grid; gap:6px; min-width:0; }.ssb-route-cell-label { color:var(--ssb-text-sub); font-size:11px; }.ssb-route-cell select { width:100%; min-width:0; }.ssb-route-advanced { margin-top:12px; }.ssb-route-advanced > summary { cursor:pointer; }.ssb-route-tune { display:flex; align-items:flex-end; gap:12px; flex-wrap:wrap; padding:8px 0; border-top:1px solid var(--ssb-border); }.ssb-route-tune-label { min-width:32px; color:var(--ssb-text-sub); }.ssb-route-delay { flex:0 0 120px; }
|
|
2260
|
+
.ssb-switch { display:inline-flex; align-items:center; gap:8px; cursor:pointer; position:relative; }.ssb-switch input[type="checkbox"] { position:absolute; opacity:0; width:1px; height:1px; }.ssb-switch__track { display:inline-flex; flex-shrink:0; align-items:center; width:34px; height:19px; padding:3px; border-radius:999px; background:var(--ssb-bg-muted); border:1px solid var(--ssb-border); transition:background .15s ease; }.ssb-switch__thumb { width:13px; height:13px; border-radius:50%; background:var(--ssb-text-sub); transition:transform .15s ease; }.ssb-switch input[type="checkbox"]:checked + .ssb-switch__track { background:var(--ssb-accent); }.ssb-switch input[type="checkbox"]:checked + .ssb-switch__track .ssb-switch__thumb { transform:translateX(13px); background:var(--ssb-bg); }.ssb-switch input[type="checkbox"]:focus-visible + .ssb-switch__track { outline:2px solid var(--dsw-alias-state-business-primary); outline-offset:2px; }.ssb-switch input[type="checkbox"]:disabled + .ssb-switch__track { opacity:.5; cursor:not-allowed; }.ssb-switch:hover .ssb-switch__track { border-color:var(--ssb-accent); }
|
|
2118
2261
|
@media(max-width:720px) { .ssb-detail-grid { grid-template-columns:minmax(0,1fr); } }
|
|
2119
2262
|
@media(max-width:959px) { .ssb-content { grid-template-columns:minmax(0,1fr); }.ssb-page { padding:16px; } }
|
|
2120
2263
|
@media(max-width:479px) { .ssb-page { padding:12px; }.ssb-header { align-items:flex-start; gap:12px; }.ssb-aux { display:none; }.ssb-table td,.ssb-table th { padding:8px; }.ssb-form-grid { grid-template-columns:minmax(0,1fr); }.ssb-detail-price { font-size:24px; }.ssb-button { min-height:36px; }.ssb-section-head { padding:12px; } }
|
|
@@ -2131,14 +2274,20 @@ window.__ModuleLoader__.load({
|
|
|
2131
2274
|
}, [view.view])
|
|
2132
2275
|
return h('div', { className: `ssb-root${data?.control.preferences.colorMode === 'green-up' ? ' ssb-green-up' : ''}`, ref: root },
|
|
2133
2276
|
React.createElement('style', { 'data-plugin': '@mzzsfy/dsh-stock-assistant', dangerouslySetInnerHTML: { __html: CSS } }),
|
|
2134
|
-
h('div', { className: 'ssb-page' }, h('header', { className: 'ssb-header' },
|
|
2135
|
-
h(
|
|
2136
|
-
h(
|
|
2137
|
-
|
|
2138
|
-
h(
|
|
2139
|
-
h('div', { className: 'ssb-
|
|
2140
|
-
|
|
2141
|
-
|
|
2277
|
+
h('div', { className: 'ssb-page' }, h('header', { className: 'ssb-header' },
|
|
2278
|
+
h('div', null, h('h1', null, '股票'), h('p', { className: 'ssb-muted' }, scopeText(data?.control.watchlist.order || []))),
|
|
2279
|
+
h('div', { className: 'ssb-header-actions' },
|
|
2280
|
+
h(Button, { disabled: !data || state.busy.refresh, onClick: quiet(() => runtime.refresh()) }, state.busy.refresh ? '刷新中…' : '刷新'),
|
|
2281
|
+
h(Button, { primary: floating.open, 'aria-pressed': floating.open, onClick: () => setFloating({ open: !floating.open }) }, floating.open ? '收起盯盘' : '悬浮盯盘'),
|
|
2282
|
+
h('div', { className: 'ssb-more', style: { position: 'relative' } }, h(Button, { 'aria-label': '更多操作', 'aria-expanded': !!view.menuOpen, onClick: () => runtime.updateView({ menuOpen: !view.menuOpen }) }, '更多'), view.menuOpen ? h('div', { className: 'ssb-menu', style: { position: 'absolute', right: 0, top: 'calc(100% + 4px)', background: 'var(--ssb-bg)', border: '1px solid var(--ssb-border)', borderRadius: 'var(--ssb-radius-md)', padding: '8px', display: 'flex', flexDirection: 'column', gap: '4px', zIndex: 10, minWidth: '140px' }, role: 'menu' },
|
|
2283
|
+
h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px', padding: '4px 8px' } }, h(Toggle, { label: '暂停采集', checked: state.paused, onChange: runtime.setPaused })),
|
|
2284
|
+
h('div', { className: 'ssb-muted', style: { padding: '0 8px', fontSize: '11px' } }, `${(data?.control.providers || []).filter(p => p.enabled).length}/${(data?.control.providers || []).length} 源启用${state.data?.klineReady ? ` · K线 ${Object.keys(state.data.klineReady).length} 市场` : ''}`),
|
|
2285
|
+
h(Button, { onClick: () => { runtime.updateView({ view: 'list', overlay: 'settings', menuOpen: false }) } }, '设置'),
|
|
2286
|
+
h(Button, { onClick: () => { runtime.updateView({ menuOpen: false }); layout.selectPanel(null) } }, '返回对话')) : null))),
|
|
2287
|
+
h('nav', { className: 'ssb-tablist', 'aria-label': '股票视图' },
|
|
2288
|
+
h('button', { type: 'button', className: 'ssb-tab' + (view.view === 'list' ? ' ssb-tab-on' : ''), 'aria-current': view.view === 'list' ? 'page' : undefined, onClick: () => runtime.updateView({ view: 'list' }) }, '自选'),
|
|
2289
|
+
h('button', { type: 'button', className: 'ssb-tab' + (view.view === 'browse' ? ' ssb-tab-on' : ''), 'aria-current': view.view === 'browse' ? 'page' : undefined, onClick: () => { runtime.updateView({ view: 'browse' }); if (!runtime.getSnapshot().view.browseRows) quiet(() => runtime.loadBrowse('XSHG', 0))() } }, '市场'),
|
|
2290
|
+
h('button', { type: 'button', className: 'ssb-tab' + (view.view === 'search' ? ' ssb-tab-on' : ''), 'aria-current': view.view === 'search' ? 'page' : undefined, onClick: () => runtime.updateView({ view: 'search' }) }, '搜索')),
|
|
2142
2291
|
state.error ? h('div', { className: 'ssb-banner ssb-error', role: 'alert' }, state.error, h(Button, { onClick: () => runtime.updateView({ view: 'list', overlay: 'settings' }) }, '检查设置')) : null,
|
|
2143
2292
|
state.view.notice ? h('div', { className: 'ssb-banner', role: 'status' }, state.view.notice, h(Button, { onClick: () => runtime.updateView({ notice: '' }) }, '知道了')) : null,
|
|
2144
2293
|
data?.ensureError ? h('div', { className: 'ssb-banner', role: 'status' }, `后台目录同步失败:${data.ensureError.message}。可在设置中手动同步。`, h(Button, { onClick: () => runtime.updateView({ view: 'list', overlay: 'settings' }) }, '前往设置')) : null,
|
|
@@ -2176,7 +2325,7 @@ window.__ModuleLoader__.load({
|
|
|
2176
2325
|
return () => { for (const stop of disposers.reverse()) stop() }
|
|
2177
2326
|
}, 'stock-assistant main panel')
|
|
2178
2327
|
},
|
|
2179
|
-
__testing: { createPageRuntime, StockPage, FloatingTicker, FloatHeader, FloatPicker, FloatList, FloatChart, FloatFoot, Sparkline, dragOrder, quiet, seriesMA, seriesEMA, seriesBoll, seriesBBI, readPref, writePref, klineKeyOf, klineShipPlan, finiteOr, formatAmount, toneClass, priceTextOf,
|
|
2328
|
+
__testing: { createPageRuntime, StockPage, FloatingTicker, FloatHeader, FloatPicker, FloatList, FloatChart, FloatFoot, Sparkline, Select, dropdownPlacement, dragOrder, quiet, seriesMA, seriesEMA, seriesBoll, seriesBBI, readPref, writePref, klineKeyOf, klineShipPlan, finiteOr, formatAmount, toneClass, priceTextOf, tagTabs, resolveTab, costBaseOf, markPct, pollPlan, QUIET_STATES, POLL_EVERY, floatPollDelay, floatIntervalOf, FLOAT_INTERVALS, FLOAT_FALLBACK_SECONDS, timestampOf, floatFreshness, priceTimeOf, clockText, staleAfter, markAlertOf, markAlertText, deliverMarkAlert, sparkIndexAt, candleTimeText, quoteTipLines, crosshairTipLines, crosshairTimeText, timeKeyOf, crosshairTipStyle, rowTipPositionOf, sparkRangeOf, sparkTicksOf, seriesPaintPlan, sanitizeCandles, themeSignature },
|
|
2180
2329
|
}
|
|
2181
2330
|
},
|
|
2182
2331
|
})
|