poe-svelte-ui-lib 2.1.3 → 2.3.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 +15 -1
- package/dist/Accordion/Accordion.svelte +1 -1
- package/dist/Button/Button.svelte +2 -1
- package/dist/GUIRenderer/GUIRenderer.svelte +72 -7
- package/dist/Graph/Graph.svelte +11 -7
- package/dist/PeriodChart/PeriodChart.svelte +3 -2
- package/dist/Select/README.md +1 -0
- package/dist/Select/Select.svelte +39 -6
- package/dist/Switch/Switch.svelte +2 -1
- package/dist/Table/README.md +2 -1
- package/dist/Table/Table.svelte +218 -198
- package/dist/TextField/TextField.svelte +5 -5
- package/dist/WidgetMap/mission/MissionActions.svelte +2 -1
- package/dist/defaults.d.ts +1 -1
- package/dist/defaults.js +18 -18
- package/dist/gui.d.ts +11 -1
- package/dist/gui.js +103 -2
- package/dist/locales/constructor.d.ts +5 -0
- package/dist/locales/constructor.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -85,7 +85,21 @@ npm install poe-svelte-ui-lib
|
|
|
85
85
|
|
|
86
86
|
## GUI устройства
|
|
87
87
|
|
|
88
|
-
GUI из конструктора рисует `GUIRenderer`. Он раскладывает сетку (
|
|
88
|
+
GUI из конструктора рисует `GUIRenderer`. Он раскладывает сетку (23 колонки, строка `6rem`), вкладывает компоненты в `Accordion` и `Tabs` (по `parentId`, номер вкладки - после 35-го знака `id`), берёт значения переменных, разбирает битовые поля, собирает пакеты команд и ведёт смарт-виджеты и файлы. Приложение отвечает за транспорт, выбор модуля, загрузку GUI и хранилище значений.
|
|
89
|
+
|
|
90
|
+
### Раскладка и правила для автора GUI
|
|
91
|
+
|
|
92
|
+
Сетка - 23 колонки: в неё ровно встают 2, 3, 4, 6 и 12 одинаковых групп с пустой колонкой между ними (11, 7, 5, 3 и 1 колонка на группу). Рендерер понимает GUI по группам, поэтому автор соблюдает правила:
|
|
93
|
+
|
|
94
|
+
1. Группа - параметры одного объекта (мотор, канал, контур регулятора). Внутри группы блоки стоят вплотную, без пустых клеток.
|
|
95
|
+
2. Группы рядом разделяет пустая колонка.
|
|
96
|
+
3. Группы друг под другом разделяет пустая строка или блок во всю ширину (`Divider`, заголовок, график).
|
|
97
|
+
4. Заголовок группы - `TextField` в её первой строке на всю ширину группы.
|
|
98
|
+
5. Поля внутри группы - строками формы: «Напряжение | Ток», «Кол-во ПП | Скорость».
|
|
99
|
+
6. Широкий блок (график, таблица, смарт-виджет, список кнопками) - во всю ширину своей группы.
|
|
100
|
+
7. Блок не перекрывает пустую клетку-границу, иначе он склеит две группы.
|
|
101
|
+
|
|
102
|
+
На компьютере сетка такая, как в конструкторе; пустая колонка между группами сжимается до узкой полосы, пустая строка - до обычного зазора. Если рендерер уже 640px (телефон, узкая панель), блоки раскладываются по группам: одинаковые группы из мелких блоков (каналы) - карточками по 2-3 в ряд, остальные - друг под другом, поля группы - строками с переносом. `Accordion` раскладывает своё содержимое так же, колонок у него не меньше, чем у самого дальнего блока.
|
|
89
103
|
|
|
90
104
|
```svelte
|
|
91
105
|
<UI.GUIRenderer components={module.UIBlocks} {link} persistKey={module.ModSN} viewer={!canManage} render={{ VideoViewer: video }} onError={addMessage} />
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
icon={label?.icon}
|
|
40
40
|
class="flex h-[18px] w-[18px] shrink-0 items-center justify-center text-[color-mix(in_srgb,var(--accent-text)_70%,var(--font-color))] [&_svg]:h-full [&_svg]:w-full"
|
|
41
41
|
/>
|
|
42
|
-
<span class={twMerge(`min-w-0
|
|
42
|
+
<span class={twMerge(`min-w-0 text-[15px] leading-snug font-semibold wrap-break-word`, label.class)}>{label?.name}</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
{#if chevron}
|
|
@@ -80,7 +80,8 @@
|
|
|
80
80
|
/>
|
|
81
81
|
|
|
82
82
|
{#if content.name?.trim()}
|
|
83
|
-
|
|
83
|
+
<!-- Длинная подпись на узкой кнопке - в две строки, а не обрезка -->
|
|
84
|
+
<span class="line-clamp-2 text-center leading-[1.05] wrap-break-word">{content.name}</span>
|
|
84
85
|
{#if keyBind.key && keyBind.showHint}
|
|
85
86
|
<span class="ml-1 text-[11px] font-medium tabular-nums opacity-80">
|
|
86
87
|
{keyBind.ctrlKey ? "Ctrl+" : ""}{keyBind.shiftKey ? "Shift+" : ""}{keyBind.altKey ? "Alt+" : ""}{keyBind.key}
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
widgetPacket,
|
|
20
20
|
widgetPrefixes,
|
|
21
21
|
writeBits,
|
|
22
|
+
layoutFlow,
|
|
23
|
+
layoutColumns,
|
|
24
|
+
flowMinWidth,
|
|
25
|
+
type FlowNode,
|
|
22
26
|
type DeviceLink,
|
|
23
27
|
type DevicePacket,
|
|
24
28
|
} from "../gui"
|
|
@@ -182,7 +186,21 @@
|
|
|
182
186
|
return (Array.isArray(external) ? external : (component.properties.options ?? [])) as IOption[]
|
|
183
187
|
}
|
|
184
188
|
|
|
189
|
+
/* ********************************************************** */
|
|
190
|
+
/* Уже NARROW_MAX_PX (телефон, узкая панель) - раскладка по группам автора (layoutFlow в gui.ts), иначе его сетка */
|
|
191
|
+
const NARROW_MAX_PX = 640
|
|
192
|
+
let width = $state(0)
|
|
193
|
+
const narrow = $derived(width > 0 && width < NARROW_MAX_PX)
|
|
194
|
+
|
|
195
|
+
/* Группа из мелких блоков (канал, мотор) - в рамке; виджеты и графики - уже карточки */
|
|
196
|
+
const framed = (node: FlowNode) => node.kind !== "leaf" && Number.isFinite(flowMinWidth(node))
|
|
197
|
+
|
|
185
198
|
const cellStyle = (component: UIComponent, fixedHeight: boolean) => {
|
|
199
|
+
/* Телефон: место задаёт раскладка, высота по содержимому; графику и видео - высота из конструктора, не больше 20rem */
|
|
200
|
+
if (narrow) {
|
|
201
|
+
const fixed = component.type === "Graph" || component.type === "PeriodChart" || component.type === "VideoViewer"
|
|
202
|
+
return fixed ? `height: min(${component.position.height * GUI_GRID.cellHeight}rem, 20rem);` : ""
|
|
203
|
+
}
|
|
186
204
|
const area = `grid-area: ${component.position.row} / ${component.position.col} / span ${spanRows(component)} / span ${component.position.width};`
|
|
187
205
|
const auto = component.type === "Accordion" || isWidgetType(component.type)
|
|
188
206
|
const height = `${component.position.height * GUI_GRID.cellHeight}rem`
|
|
@@ -194,12 +212,58 @@
|
|
|
194
212
|
const writable = (component: UIComponent) => !viewer && COMPONENTS[component.type].io !== "none"
|
|
195
213
|
</script>
|
|
196
214
|
|
|
197
|
-
<div
|
|
198
|
-
{
|
|
199
|
-
{@render Cell(component, false)}
|
|
200
|
-
{/each}
|
|
215
|
+
<div bind:clientWidth={width}>
|
|
216
|
+
{@render Layout((tree.get("") ?? []).filter(visible), GUI_GRID.columns, false)}
|
|
201
217
|
</div>
|
|
202
218
|
|
|
219
|
+
<!-- Блоки одного контейнера: на телефоне раскладка по группам, на компьютере сетка автора -->
|
|
220
|
+
{#snippet Layout(list: UIComponent[], total: number, fixedHeight: boolean)}
|
|
221
|
+
{#if narrow}
|
|
222
|
+
{@render Flow(layoutFlow(list))}
|
|
223
|
+
{:else}
|
|
224
|
+
<div class="grid gap-2" style="grid-template-columns: {layoutColumns(list, total)}">
|
|
225
|
+
{#each list as component (component.id)}
|
|
226
|
+
{@render Cell(component, fixedHeight)}
|
|
227
|
+
{/each}
|
|
228
|
+
</div>
|
|
229
|
+
{/if}
|
|
230
|
+
{/snippet}
|
|
231
|
+
|
|
232
|
+
{#snippet Flow(node: FlowNode)}
|
|
233
|
+
{#if node.kind === "leaf"}
|
|
234
|
+
{@render Cell(node.component, false)}
|
|
235
|
+
{:else if node.kind === "stack"}
|
|
236
|
+
<div class="flex min-w-0 flex-col gap-2">
|
|
237
|
+
{#each node.items as item, index (index)}
|
|
238
|
+
{@render Flow(item)}
|
|
239
|
+
{/each}
|
|
240
|
+
</div>
|
|
241
|
+
{:else}
|
|
242
|
+
{@const widths = node.items.map(flowMinWidth)}
|
|
243
|
+
{@const same = node.kind === "groups" && widths.every((w) => w === widths[0] && Number.isFinite(w))}
|
|
244
|
+
{#if same}
|
|
245
|
+
<!-- Одинаковые группы (каналы) - сеткой, сколько поместится -->
|
|
246
|
+
<div class="grid gap-2" style="grid-template-columns: repeat(auto-fill, minmax(min({widths[0] + 18}px, 100%), 1fr))">
|
|
247
|
+
{#each node.items as item, index (index)}
|
|
248
|
+
<div class="min-w-0 {framed(item) ? 'rounded-xl border border-(--hairline-color) p-2' : ''}">{@render Flow(item)}</div>
|
|
249
|
+
{/each}
|
|
250
|
+
</div>
|
|
251
|
+
{:else}
|
|
252
|
+
<div class="flex flex-wrap gap-2">
|
|
253
|
+
{#each node.items as item, index (index)}
|
|
254
|
+
{@const framedGroup = node.kind === "groups" && framed(item)}
|
|
255
|
+
<div
|
|
256
|
+
class="min-w-0 {framedGroup ? 'rounded-xl border border-(--hairline-color) p-2' : ''}"
|
|
257
|
+
style="flex: 1 1 {Number.isFinite(widths[index]) ? `${widths[index] + (framedGroup ? 18 : 0)}px` : '100%'}"
|
|
258
|
+
>
|
|
259
|
+
{@render Flow(item)}
|
|
260
|
+
</div>
|
|
261
|
+
{/each}
|
|
262
|
+
</div>
|
|
263
|
+
{/if}
|
|
264
|
+
{/if}
|
|
265
|
+
{/snippet}
|
|
266
|
+
|
|
203
267
|
{#snippet Cell(component: UIComponent, fixedHeight: boolean)}
|
|
204
268
|
{#if visible(component)}
|
|
205
269
|
{@const id = component.properties.id ?? ""}
|
|
@@ -209,9 +273,10 @@
|
|
|
209
273
|
{@render render[component.type]?.(component)}
|
|
210
274
|
{:else if component.type === "Accordion"}
|
|
211
275
|
<Accordion {...component.properties}>
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
276
|
+
<!-- Своя сетка содержимого во всю ширину аккордеона: колонок не меньше, чем у самого дальнего блока -->
|
|
277
|
+
<div class="min-w-0" style="grid-column: 1 / -1; grid-row: 1 / -1">
|
|
278
|
+
{@render Layout(childrenOf(component).filter(visible), component.properties.size?.width ?? 1, !!component.properties.image)}
|
|
279
|
+
</div>
|
|
215
280
|
</Accordion>
|
|
216
281
|
{:else if component.type === "Tabs"}
|
|
217
282
|
<Tabs {...component.properties} Components={Cell} apiArray={childrenOf(component)} />
|
package/dist/Graph/Graph.svelte
CHANGED
|
@@ -273,7 +273,7 @@
|
|
|
273
273
|
ctx.clearRect(0, 0, width, height)
|
|
274
274
|
|
|
275
275
|
const data = lines()
|
|
276
|
-
const { padding, minX, timeSpan, yMin, yMax, getX, getY } = computeGeometry(data)
|
|
276
|
+
const { padding, graphWidth, minX, timeSpan, yMin, yMax, getX, getY } = computeGeometry(data)
|
|
277
277
|
const style = getComputedStyle(canvas)
|
|
278
278
|
|
|
279
279
|
/* Сетка в стиле PeriodChart: пунктир цветом --faint-color темы, подписи тем же цветом без прозрачности */
|
|
@@ -287,6 +287,9 @@
|
|
|
287
287
|
/* Сетка X */
|
|
288
288
|
ctx.textAlign = "center"
|
|
289
289
|
|
|
290
|
+
/* Подпись на каждой линии сетки, если влезает; на узком холсте - через одну или реже, чтобы не слипались */
|
|
291
|
+
const labelWidth = Math.max(ctx.measureText(formatAxisLabel(minX, timeSpan)).width, ctx.measureText(formatAxisLabel(minX + timeSpan, timeSpan)).width)
|
|
292
|
+
const labelStep = [1, 2, 5, 10].find((step) => (graphWidth / 10) * step >= labelWidth + 6) ?? 10
|
|
290
293
|
for (let i = 0; i <= 10; i++) {
|
|
291
294
|
const t = minX + (i / 10) * timeSpan
|
|
292
295
|
const x = getX(t)
|
|
@@ -297,7 +300,7 @@
|
|
|
297
300
|
ctx.stroke()
|
|
298
301
|
ctx.globalAlpha = 1
|
|
299
302
|
ctx.textBaseline = "top"
|
|
300
|
-
ctx.fillText(formatAxisLabel(t, timeSpan), x, height - padding.bottom + 2)
|
|
303
|
+
if (i % labelStep === 0) ctx.fillText(formatAxisLabel(t, timeSpan), x, height - padding.bottom + 2)
|
|
301
304
|
}
|
|
302
305
|
|
|
303
306
|
/* Сетка Y */
|
|
@@ -349,12 +352,13 @@
|
|
|
349
352
|
}
|
|
350
353
|
</script>
|
|
351
354
|
|
|
352
|
-
|
|
355
|
+
<!-- @container: раскладка по ширине самого графика - уже 28rem панель уходит под холст -->
|
|
356
|
+
<div class={`@container relative flex w-full flex-col items-center justify-center ${wrapperClass}`}>
|
|
353
357
|
{#if label.name}
|
|
354
358
|
<h5 class={`w-full px-4 text-center ${label.class}`}>{label.name}</h5>
|
|
355
359
|
{/if}
|
|
356
360
|
|
|
357
|
-
<div class="flex w-full min-w-0 flex-row gap-4">
|
|
361
|
+
<div class="flex w-full min-w-0 flex-col gap-3 @md:flex-row @md:gap-4">
|
|
358
362
|
<!-- График: холст абсолютно поверх контейнера - его пиксельная ширина не распирает контейнер, иначе в сетке/flex с 1fr ширина растёт по кругу (ResizeObserver) -->
|
|
359
363
|
<!-- design-handoff, раздел 9: рамка --hairline-color без тени, тултип в оформлении общего Tooltip.svelte -->
|
|
360
364
|
<div bind:this={container} class="relative h-64 min-w-0 grow overflow-hidden rounded-[14px] border border-(--hairline-color)">
|
|
@@ -378,8 +382,8 @@
|
|
|
378
382
|
{/if}
|
|
379
383
|
</div>
|
|
380
384
|
|
|
381
|
-
<!-- Панель
|
|
382
|
-
<div class="flex w-48 flex-col gap-2">
|
|
385
|
+
<!-- Панель настроек: справа от холста, на узком - под ним, развёртка и значения рядом -->
|
|
386
|
+
<div class="grid w-full grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)] gap-x-3 gap-y-2 @md:flex @md:w-48 @md:flex-col @md:gap-2">
|
|
383
387
|
{#if !isHistoryMode}
|
|
384
388
|
<!-- Развертка по горизонтали -->
|
|
385
389
|
<Select
|
|
@@ -391,7 +395,7 @@
|
|
|
391
395
|
{/if}
|
|
392
396
|
|
|
393
397
|
<!-- Переменные и их значение: сетка, а не таблица - имя обрезается «…», значение не переносится -->
|
|
394
|
-
<div class="flex flex-col gap-1">
|
|
398
|
+
<div class="flex flex-col gap-1 first:col-span-full">
|
|
395
399
|
<h5 class="text-[12px] font-semibold text-(--muted-color)">{$T("ui.graph.values")}</h5>
|
|
396
400
|
<div class="grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-2 gap-y-1 text-[13px]">
|
|
397
401
|
{#each legend as item, i}
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
const labelStep = $derived(Math.ceil(values.length / 12) || 1)
|
|
83
83
|
</script>
|
|
84
84
|
|
|
85
|
-
<div class={twMerge("relative flex w-full flex-col gap-3", wrapperClass)} style={accentStyle(accent)}>
|
|
85
|
+
<div class={twMerge("@container relative flex w-full flex-col gap-3", wrapperClass)} style={accentStyle(accent)}>
|
|
86
86
|
{#if label.name}
|
|
87
87
|
<h5 class={twMerge("w-full text-[13px] font-semibold text-(--muted-color)", label.class)}>{label.name}</h5>
|
|
88
88
|
{/if}
|
|
@@ -94,7 +94,8 @@
|
|
|
94
94
|
<button
|
|
95
95
|
type="button"
|
|
96
96
|
class={twMerge(
|
|
97
|
-
|
|
97
|
+
/* на узком месте отступы меньше, длинное имя уровня переносится, а не выходит за край */
|
|
98
|
+
"min-w-0 flex-1 cursor-pointer rounded-[7px] px-1.5 py-1.5 text-[13px] leading-tight wrap-break-word transition-colors duration-150 @md:px-3",
|
|
98
99
|
index === currentLevelIndex
|
|
99
100
|
? "bg-(--back-color) font-semibold text-(--font-color) shadow-(--elevation-1)"
|
|
100
101
|
: "font-medium text-(--muted-color) hover:text-(--font-color)",
|
package/dist/Select/README.md
CHANGED
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
- `listHeight` понимает `rem` и `px`. Другое значение даёт 256 px.
|
|
63
63
|
- В виде `input` в списке остаются варианты, в названии которых есть введённый текст. `onInput` получает текст при каждом вводе. `onUpdate` вызывается при выборе варианта, Enter и уходе из поля. Текст, которого нет в списке, становится новым значением. Если у первого варианта числовое значение, введённое число отправляется числом.
|
|
64
64
|
- Клавиатура: стрелки открывают список и ходят по вариантам, Enter выбирает, Escape закрывает список.
|
|
65
|
+
- Если варианты `buttons` не помещаются по ширине целиком, группа показывается выпадающим списком. Место появилось - снова кнопки.
|
|
65
66
|
- В виде `buttons` вариант с `icon` показывает иконку, а `name` уходит в подсказку. Так узкие панели не обрезают подписи.
|
|
66
67
|
- В виде `buttons` вариант со своим цветом (`accent`) залит им всегда, а выбранный отмечается рамкой. Так сделана палитра цветов в панелях свойств.
|
|
67
68
|
- `fitContent` делает кнопки одинаковыми по самой длинной подписи, без переноса текста. Подходит для шапок и переключателей режима.
|
|
@@ -39,10 +39,34 @@
|
|
|
39
39
|
let portalElement: HTMLDivElement | undefined = $state()
|
|
40
40
|
let anchorRect: DOMRect | null = $state(null)
|
|
41
41
|
|
|
42
|
+
/* type="buttons" на узком месте: если варианты не помещаются целиком, группа показывается выпадающим списком */
|
|
43
|
+
let measureElement: HTMLDivElement | undefined = $state()
|
|
44
|
+
let anchorWidth = $state(Infinity)
|
|
45
|
+
let buttonsNeed = $state(0)
|
|
46
|
+
$effect(() => {
|
|
47
|
+
if (type !== "buttons" || !measureElement) return
|
|
48
|
+
void options
|
|
49
|
+
const measure = () => {
|
|
50
|
+
const widest = Math.max(0, ...[...measureElement!.children].map((child) => child.getBoundingClientRect().width))
|
|
51
|
+
/* сегменты равной ширины: самый широкий текст + отступы 2×12, разделители и рамка */
|
|
52
|
+
buttonsNeed = options.length * (widest + 24) + options.length + 1
|
|
53
|
+
}
|
|
54
|
+
measure()
|
|
55
|
+
void document.fonts?.ready.then(measure)
|
|
56
|
+
})
|
|
57
|
+
const shownType = $derived(type === "buttons" && anchorWidth < buttonsNeed ? "select" : type)
|
|
58
|
+
|
|
42
59
|
const selectedValues = $derived(multiSelect ? (Array.isArray(value) ? (value as T[]) : []) : [value as T])
|
|
43
60
|
const isSelected = (option: IOption<T>) => selectedValues.includes(option.value)
|
|
44
61
|
const current = $derived(multiSelect ? undefined : options.find((option) => option.value === value))
|
|
45
|
-
const valueText = $derived(
|
|
62
|
+
const valueText = $derived(
|
|
63
|
+
multiSelect
|
|
64
|
+
? options
|
|
65
|
+
.filter(isSelected)
|
|
66
|
+
.map((option) => option.name ?? String(option.value))
|
|
67
|
+
.join(", ")
|
|
68
|
+
: (current?.name ?? (value == null || Array.isArray(value) ? "" : String(value))),
|
|
69
|
+
)
|
|
46
70
|
const visibleOptions = $derived(
|
|
47
71
|
type === "input" && draft ? options.filter((option) => (option.name ?? "").toLowerCase().includes(draft!.toLowerCase())) : options,
|
|
48
72
|
)
|
|
@@ -170,10 +194,19 @@
|
|
|
170
194
|
</script>
|
|
171
195
|
|
|
172
196
|
<div class={twMerge(`flex w-full flex-col gap-1`, wrapperClass)}>
|
|
173
|
-
<div class="relative flex w-full flex-col gap-1" bind:this={anchorElement}>
|
|
174
|
-
<FieldLabel {label} for={
|
|
197
|
+
<div class="relative flex w-full flex-col gap-1" bind:this={anchorElement} bind:clientWidth={anchorWidth}>
|
|
198
|
+
<FieldLabel {label} for={shownType === "buttons" ? undefined : uid} id={`${uid}-label`} />
|
|
199
|
+
|
|
200
|
+
{#if type === "buttons"}
|
|
201
|
+
<!-- Невидимые подписи вариантов: по их ширине решается, помещается ли группа кнопок -->
|
|
202
|
+
<div bind:this={measureElement} class="pointer-events-none invisible absolute top-0 left-0 flex h-0 w-max overflow-hidden" aria-hidden="true">
|
|
203
|
+
{#each options as option, index (option.id ?? index)}
|
|
204
|
+
<span class="text-[13px] font-semibold whitespace-nowrap {option.icon ? 'w-[18px]' : ''}">{option.icon ? "" : option.name}</span>
|
|
205
|
+
{/each}
|
|
206
|
+
</div>
|
|
207
|
+
{/if}
|
|
175
208
|
|
|
176
|
-
{#if
|
|
209
|
+
{#if shownType === "select"}
|
|
177
210
|
<button
|
|
178
211
|
id={uid}
|
|
179
212
|
class={twMerge(`${fieldBase} flex items-center justify-between gap-2 ${fieldState}`, disabled ? "" : "cursor-pointer")}
|
|
@@ -198,7 +231,7 @@
|
|
|
198
231
|
stroke-linejoin="round"><path d="M6 9l6 6 6-6" /></svg
|
|
199
232
|
>
|
|
200
233
|
</button>
|
|
201
|
-
{:else if
|
|
234
|
+
{:else if shownType === "input"}
|
|
202
235
|
<input
|
|
203
236
|
id={uid}
|
|
204
237
|
value={draft ?? valueText}
|
|
@@ -271,7 +304,7 @@
|
|
|
271
304
|
</div>
|
|
272
305
|
{/if}
|
|
273
306
|
|
|
274
|
-
{#if isOpen &&
|
|
307
|
+
{#if isOpen && shownType !== "buttons"}
|
|
275
308
|
<div
|
|
276
309
|
use:portal
|
|
277
310
|
bind:this={portalElement}
|
|
@@ -54,7 +54,8 @@
|
|
|
54
54
|
<!-- Подпись по умолчанию по центру - над переключателем, который тоже по центру; выравнивание из label.class важнее -->
|
|
55
55
|
<h5 class={twMerge(`w-full text-center text-[12px] font-semibold text-(--muted-color)`, label.class)}>{label.name}</h5>
|
|
56
56
|
{/if}
|
|
57
|
-
|
|
57
|
+
<!-- Биты переносятся на новую строку, если не помещаются -->
|
|
58
|
+
<div class="flex w-full flex-wrap items-center justify-around gap-x-4 gap-y-2">
|
|
58
59
|
{#each bits as option, index (index)}
|
|
59
60
|
<div class="flex flex-col gap-1" style={accentStyle(option.accent)}>
|
|
60
61
|
{#if option.name && bitMode}
|
package/dist/Table/README.md
CHANGED
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
- `visibleRows` - сколько строк видно без прокрутки. Высоту таблица считает по первым строкам.
|
|
66
66
|
- `clearButton` добавляет кнопку очистки в узкой колонке справа (`2.5rem`), она не перекрывает заголовки. Очистку можно вызвать и из кода: `clear()`.
|
|
67
67
|
|
|
68
|
-
**Подгрузка.** Если задан `cursor` и передан `loader`, при прокрутке почти до конца (последние 50 px) таблица вызывает `getData`. Пока `loader()` возвращает `true`, повторных вызовов нет. `cursor = null` выключает подгрузку. Без `loader` подгрузка не работает.
|
|
68
|
+
**Подгрузка.** Если задан `cursor` и передан `loader`, при прокрутке почти до конца (последние 50 px) таблица вызывает `getData`. Если строк меньше высоты таблицы, она сама зовёт `getData`, пока не заполнится. Пока `loader()` возвращает `true`, повторных вызовов нет. `cursor = null` выключает подгрузку. Без `loader` подгрузка не работает.
|
|
69
69
|
|
|
70
70
|
</details>
|
|
71
71
|
|
|
@@ -79,6 +79,7 @@
|
|
|
79
79
|
- Ширину колонки в знаках моноширинного текста считает `tableMonoWidth(знаков, знаковПодписи?)` из `columnWidth.ts`. Колонка растёт вместе с размером шрифта и не бывает уже заголовка. Пример: `width: tableMonoWidth(6, 2)` для `0x0000`.
|
|
80
80
|
- Колонка с `width: "0%"` скрыта. Без `width` колонка занимает `minmax(0, 1fr)`.
|
|
81
81
|
- Колонки с выравниванием вправо показывают цифры одинаковой ширины.
|
|
82
|
+
- Если колонки не помещаются (заданные ширины и по 5rem на гибкие), таблица прокручивается вбок, а не обрезается.
|
|
82
83
|
- Текстовая ячейка выводит `render(row)`, без него - значение по `key`: массив вариантов `{ name, value }` списком `name`, другой объект - как JSON. Всё выводится как текст, HTML - только с `html: true`, данные тогда экранирует вызывающий. Ссылку задаёт `href(row)`: ячейка становится `<a>` с текстом внутри, HTML для этого не нужен. `
|
|
83
84
|
` в тексте переносит строку. Цвет из строки задаёт `accent(row)` (роль темы, как у компонентов), с `badge: true` текст стоит на мягкой подложке своего цвета; ячейка из одних бейджей ставит их вплотную с переносом. `onClick(row)` делает текст кнопкой (открыть папку и т.п.), сортировка по `key` при этом остаётся. Несколько элементов ячейки встают в ряд, со `stack: true` у колонки - столбиком.
|
|
84
85
|
- `modal: true` открывает по нажатию содержимое ячейки целиком: длинные строки переносятся, отступы сохраняются, кнопка в окне копирует текст. `modal` - сниппет `Snippet<[row]>`: в окне своё содержимое (без кнопки внизу), так устроено окно xPOE-Debug.
|
package/dist/Table/Table.svelte
CHANGED
|
@@ -113,6 +113,13 @@
|
|
|
113
113
|
let gridTemplate = $derived(
|
|
114
114
|
[...header.filter((c) => c.width !== "0%").map((c) => c.width || "minmax(0, 1fr)"), ...(dataBuffer.clearButton ? [ACTIONS_COLUMN] : [])].join(" "),
|
|
115
115
|
)
|
|
116
|
+
/* Наименьшая ширина таблицы: заданные ширины колонок и по 5rem на гибкие; уже - прокрутка вбок, а не обрезка */
|
|
117
|
+
let minTableWidth = $derived(
|
|
118
|
+
`calc(${[
|
|
119
|
+
...header.filter((c) => c.width !== "0%").map((c) => (!c.width || c.width.includes("fr") ? "5rem" : c.width)),
|
|
120
|
+
...(dataBuffer.clearButton ? [ACTIONS_COLUMN] : []),
|
|
121
|
+
].join(" + ")})`,
|
|
122
|
+
)
|
|
116
123
|
const columnContent = (column: ITableHeader<Row>, row: Row) => (typeof column.content === "function" ? column.content(row) : (column.content ?? []))
|
|
117
124
|
const sortKey = (column: ITableHeader<Row>) =>
|
|
118
125
|
typeof column.content === "function"
|
|
@@ -135,17 +142,28 @@
|
|
|
135
142
|
tableHeight = height
|
|
136
143
|
}
|
|
137
144
|
|
|
145
|
+
/* Следующая порция, когда низ таблицы виден: при прокрутке и если строки ещё не заполнили высоту таблицы */
|
|
146
|
+
const loadMore = () => {
|
|
147
|
+
if (!container || cursor === null || !loader || loader()) return
|
|
148
|
+
const { scrollTop, clientHeight, scrollHeight } = container
|
|
149
|
+
if (scrollTop + clientHeight >= scrollHeight - 50) getData()
|
|
150
|
+
}
|
|
151
|
+
|
|
138
152
|
$effect(() => {
|
|
139
153
|
void entries
|
|
140
154
|
tick().then(() => {
|
|
141
155
|
measure()
|
|
142
156
|
if (autoscroll && isAutoscroll && !dataBuffer.logger && container) container.scrollTop = container.scrollHeight
|
|
157
|
+
loadMore()
|
|
143
158
|
})
|
|
144
159
|
})
|
|
145
160
|
|
|
146
161
|
$effect(() => {
|
|
147
162
|
if (!container) return
|
|
148
|
-
const observer = new ResizeObserver(
|
|
163
|
+
const observer = new ResizeObserver(() => {
|
|
164
|
+
measure()
|
|
165
|
+
loadMore()
|
|
166
|
+
})
|
|
149
167
|
observer.observe(container)
|
|
150
168
|
return () => observer.disconnect()
|
|
151
169
|
})
|
|
@@ -154,7 +172,7 @@
|
|
|
154
172
|
if (!container) return
|
|
155
173
|
const { scrollTop, clientHeight, scrollHeight } = container
|
|
156
174
|
isAutoscroll = scrollHeight - scrollTop <= clientHeight + 50
|
|
157
|
-
|
|
175
|
+
loadMore()
|
|
158
176
|
}
|
|
159
177
|
|
|
160
178
|
/* ********************************************************** */
|
|
@@ -234,217 +252,219 @@
|
|
|
234
252
|
<span class={twMerge(`w-full pb-2 text-[12px] font-semibold text-(--muted-color)`, label.class)}>{label.name}</span>
|
|
235
253
|
{/if}
|
|
236
254
|
|
|
237
|
-
<div class="relative flex h-full w-full flex-col overflow-hidden rounded-[14px] border border-(--hairline-color) bg-(--back-color)">
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
{#
|
|
245
|
-
{
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
255
|
+
<div class="relative flex h-full w-full flex-col overflow-x-auto overflow-y-hidden rounded-[14px] border border-(--hairline-color) bg-(--back-color)">
|
|
256
|
+
<div class="flex min-h-0 w-full flex-1 flex-col" style="min-width: {minTableWidth};">
|
|
257
|
+
<!-- Шапка -->
|
|
258
|
+
<div
|
|
259
|
+
class="grid border-b border-(--hairline-color) bg-[var(--table-header-color,var(--accent-soft))] text-[11px] font-bold tracking-[0.06em] text-[color-mix(in_srgb,var(--accent-color)_35%,var(--font-color))] uppercase"
|
|
260
|
+
style={`grid-template-columns: ${gridTemplate}; padding-right: ${scrollbarWidth}px;`}
|
|
261
|
+
>
|
|
262
|
+
{#each header as column, index (column)}
|
|
263
|
+
{#if column.width !== "0%"}
|
|
264
|
+
{@const key = sortKey(column)}
|
|
265
|
+
<div
|
|
266
|
+
class={twMerge(
|
|
267
|
+
`flex items-center gap-1 border-l px-3 py-2 ${outline && index !== 0 ? "border-(--hairline-color)" : "border-transparent"}
|
|
249
268
|
${column.align === "center" ? "justify-center text-center" : column.align === "right" ? "justify-end text-right" : "justify-start text-left"}`,
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
269
|
+
column.label?.class,
|
|
270
|
+
)}
|
|
271
|
+
>
|
|
272
|
+
<span>{$T(column.label?.name ?? "")}</span>
|
|
273
|
+
{#if key !== undefined && !stash}
|
|
274
|
+
<button
|
|
275
|
+
class="inline-flex cursor-pointer items-center rounded px-1 text-(--muted-color) transition-colors duration-150 hover:bg-(--back-color) hover:text-(--font-color)"
|
|
276
|
+
onclick={() => sortBy(key)}
|
|
277
|
+
>
|
|
278
|
+
↑↓
|
|
279
|
+
</button>
|
|
280
|
+
{/if}
|
|
281
|
+
</div>
|
|
282
|
+
{/if}
|
|
283
|
+
{/each}
|
|
284
|
+
{#if dataBuffer.clearButton}
|
|
285
|
+
<div class="flex items-center justify-center tracking-normal normal-case">
|
|
286
|
+
<Button
|
|
287
|
+
componentClass={twMerge("size-7 p-1.5 text-(--muted-color) hover:text-(--red-text)", dataBuffer.clearClass)}
|
|
288
|
+
content={{ icon: ButtonClear, info: { text: $T("common.table.clear"), side: "left" } }}
|
|
289
|
+
onClick={clear}
|
|
290
|
+
/>
|
|
262
291
|
</div>
|
|
263
292
|
{/if}
|
|
264
|
-
|
|
265
|
-
{#if dataBuffer.clearButton}
|
|
266
|
-
<div class="flex items-center justify-center tracking-normal normal-case">
|
|
267
|
-
<Button
|
|
268
|
-
componentClass={twMerge("size-7 p-1.5 text-(--muted-color) hover:text-(--red-text)", dataBuffer.clearClass)}
|
|
269
|
-
content={{ icon: ButtonClear, info: { text: $T("common.table.clear"), side: "left" } }}
|
|
270
|
-
onClick={clear}
|
|
271
|
-
/>
|
|
272
|
-
</div>
|
|
273
|
-
{/if}
|
|
274
|
-
</div>
|
|
293
|
+
</div>
|
|
275
294
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
295
|
+
{#if entries.length > 0}
|
|
296
|
+
<!-- Тело с прокруткой -->
|
|
297
|
+
<div class="relative flex-1 overflow-y-auto bg-(--back-color)" bind:this={container} onscroll={handleScroll}>
|
|
298
|
+
<div
|
|
299
|
+
class="min-w-0"
|
|
300
|
+
bind:this={rowsEl}
|
|
301
|
+
style={dataBuffer.visibleRows && tableHeight && entries.length > dataBuffer.visibleRows ? `height: ${tableHeight}px;` : ""}
|
|
302
|
+
>
|
|
303
|
+
{#each entries as entry, i (entry.key)}
|
|
304
|
+
{@const row = withPicks(entry.row)}
|
|
305
|
+
<div
|
|
306
|
+
class="grid border-t border-(--hairline-color) transition-colors duration-150 hover:bg-(--accent-soft)"
|
|
307
|
+
style={`grid-template-columns: ${gridTemplate};`}
|
|
308
|
+
>
|
|
309
|
+
{#each header as column, j (column)}
|
|
310
|
+
{#if column.width !== "0%"}
|
|
311
|
+
{@const contents = columnContent(column, row) as ITableContent<Row>[]}
|
|
312
|
+
<!-- Одни бейджи - вплотную с переносом; stack - столбиком; иначе - в ряд равными долями -->
|
|
313
|
+
{@const badges = contents.length > 1 && contents.every((c) => c.type === "text" && c.data.badge)}
|
|
314
|
+
<div
|
|
315
|
+
class="relative {badges
|
|
316
|
+
? 'flex flex-wrap gap-1'
|
|
317
|
+
: 'grid gap-x-2'} min-h-7 w-full min-w-0 items-center px-3 py-1 text-[length:var(--table-font-size,13px)] wrap-break-word
|
|
299
318
|
{column.align === 'center'
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
319
|
+
? 'justify-center justify-items-center text-center'
|
|
320
|
+
: column.align === 'right'
|
|
321
|
+
? 'justify-end justify-items-end text-right tabular-nums'
|
|
322
|
+
: 'justify-start justify-items-start text-left'}
|
|
304
323
|
{j !== 0 ? 'border-l' : ''} {outline ? 'border-(--hairline-color)' : 'border-transparent'} {column.disableSelect
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
</button>
|
|
325
|
-
{:else if content.type === "select"}
|
|
326
|
-
{@const select = content.data}
|
|
327
|
-
{@const options = (Array.isArray(row[select.key]) ? row[select.key] : []) as IOption<string | number>[]}
|
|
328
|
-
{@const current = (row as Record<string, unknown>)[valueKey(select.key)]}
|
|
329
|
-
{@const open = dropdown?.row === i && dropdown.col === j && dropdown.index === index ? dropdown : null}
|
|
330
|
-
<div class="relative w-full select-none">
|
|
331
|
-
<button
|
|
332
|
-
class="h-7 w-full cursor-pointer rounded-lg border border-(--border-color) bg-(--field-color) px-2 text-left text-[13px] transition-[border-color,box-shadow] duration-150 outline-none hover:border-(--faint-color) focus:border-(--accent-text) focus:shadow-(--focus-shadow-color)"
|
|
333
|
-
onclick={(e) => toggleDropdown(e, i, j, index)}
|
|
334
|
-
>
|
|
335
|
-
{options.find((o) => o.value === current)?.name ?? $T("common.select_tag")}
|
|
324
|
+
? 'select-none'
|
|
325
|
+
: 'select-all'}"
|
|
326
|
+
style={badges ? undefined : `grid-template-columns: ${column.stack ? "minmax(0, 1fr)" : `repeat(${contents.length}, minmax(0, 1fr))`};`}
|
|
327
|
+
>
|
|
328
|
+
{#each contents as content, index}
|
|
329
|
+
{#if content.type === "button"}
|
|
330
|
+
{@const button = resolve(content.data, row)}
|
|
331
|
+
{@const title = resolve(button.title, row)}
|
|
332
|
+
<button class="{buttonClass(button, row)} bg-(--bg-color)" onclick={() => buttonClick(row, button)} {title} aria-label={title}>
|
|
333
|
+
{#if button.icon}
|
|
334
|
+
<span class="flex size-4 shrink-0 items-center justify-center overflow-visible [&_svg]:h-full [&_svg]:w-full">
|
|
335
|
+
{#if typeof button.icon === "string"}
|
|
336
|
+
{@html sanitizeHtml(button.icon)}
|
|
337
|
+
{:else}
|
|
338
|
+
<button.icon />
|
|
339
|
+
{/if}
|
|
340
|
+
</span>
|
|
341
|
+
{/if}
|
|
342
|
+
{$T(resolve(button.name, row) ?? "")}
|
|
336
343
|
</button>
|
|
337
|
-
|
|
344
|
+
{:else if content.type === "select"}
|
|
345
|
+
{@const select = content.data}
|
|
346
|
+
{@const options = (Array.isArray(row[select.key]) ? row[select.key] : []) as IOption<string | number>[]}
|
|
347
|
+
{@const current = (row as Record<string, unknown>)[valueKey(select.key)]}
|
|
348
|
+
{@const open = dropdown?.row === i && dropdown.col === j && dropdown.index === index ? dropdown : null}
|
|
349
|
+
<div class="relative w-full select-none">
|
|
350
|
+
<button
|
|
351
|
+
class="h-7 w-full cursor-pointer rounded-lg border border-(--border-color) bg-(--field-color) px-2 text-left text-[13px] transition-[border-color,box-shadow] duration-150 outline-none hover:border-(--faint-color) focus:border-(--accent-text) focus:shadow-(--focus-shadow-color)"
|
|
352
|
+
onclick={(e) => toggleDropdown(e, i, j, index)}
|
|
353
|
+
>
|
|
354
|
+
{options.find((o) => o.value === current)?.name ?? $T("common.select_tag")}
|
|
355
|
+
</button>
|
|
356
|
+
{#if open}
|
|
357
|
+
<div
|
|
358
|
+
class="fixed z-50 max-h-[40vh] overflow-y-auto rounded-[10px] border border-(--hairline-color) bg-(--back-color) p-1 shadow-(--elevation-2)"
|
|
359
|
+
style="top: {open.rect.bottom + 4}px; left: {open.rect.left}px; width: {open.rect.width}px;"
|
|
360
|
+
transition:slide={{ duration: slideDuration }}
|
|
361
|
+
>
|
|
362
|
+
{#each options as option (option.id ?? option.value)}
|
|
363
|
+
<button
|
|
364
|
+
class={twMerge(
|
|
365
|
+
"flex h-8 w-full cursor-pointer items-center rounded-md px-2.5 text-left text-[13px] transition-colors duration-150 hover:bg-(--container-color)",
|
|
366
|
+
option.accent && "text-(--accent-text)",
|
|
367
|
+
)}
|
|
368
|
+
style={accentStyle(option.accent)}
|
|
369
|
+
onclick={(e) => selectOption(e, entry.row, select.key, option)}
|
|
370
|
+
>
|
|
371
|
+
{option.name}
|
|
372
|
+
</button>
|
|
373
|
+
{/each}
|
|
374
|
+
</div>
|
|
375
|
+
{/if}
|
|
376
|
+
</div>
|
|
377
|
+
{:else if content.type === "image"}
|
|
378
|
+
{@const image = content.data}
|
|
379
|
+
{@const src = resolve(image.src, row)}
|
|
380
|
+
<div
|
|
381
|
+
class="flex items-center justify-center [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full [&_svg]:max-w-full"
|
|
382
|
+
style={`width: ${image.width || "2rem"}; height: ${image.height || "2rem"};`}
|
|
383
|
+
>
|
|
384
|
+
{#if src}
|
|
385
|
+
<img {src} alt={image.alt ?? "Image"} class={twMerge("h-full w-full object-cover", image.class)} loading="lazy" />
|
|
386
|
+
{:else if typeof image.defaultIcon === "string"}
|
|
387
|
+
{@html sanitizeHtml(image.defaultIcon)}
|
|
388
|
+
{:else if image.defaultIcon}
|
|
389
|
+
<image.defaultIcon />
|
|
390
|
+
{/if}
|
|
391
|
+
</div>
|
|
392
|
+
{:else if content.type === "progressBar"}
|
|
393
|
+
{@const bar = content.data}
|
|
394
|
+
<div class="grid h-7 w-full grid-cols-[3.5rem_1fr] items-center gap-2">
|
|
395
|
+
<span class="text-right text-[12px] font-semibold tabular-nums">{roundToClean(Number(row[bar.key] ?? 0))}{bar.units}</span>
|
|
396
|
+
<div class="relative my-auto h-1.5 overflow-hidden rounded-full bg-(--container-color)">
|
|
397
|
+
<div
|
|
398
|
+
class="absolute top-0 left-0 flex h-full rounded-full bg-(--bg-color,var(--accent-color))"
|
|
399
|
+
style="width: {progressPercent(row[bar.key] as number, bar.minNum, bar.maxNum)}%;"
|
|
400
|
+
></div>
|
|
401
|
+
</div>
|
|
402
|
+
</div>
|
|
403
|
+
{:else if content.type === "text"}
|
|
404
|
+
{@const text = content.data}
|
|
405
|
+
{@const value = cellContent(row, text)}
|
|
406
|
+
{@const accent = text.accent?.(row)}
|
|
407
|
+
<!-- w-full + min-w-0: при justify-items-start ячейка иначе берёт ширину по содержимому и truncate не даёт «…»;
|
|
408
|
+
в тексте - перенос строки -->
|
|
409
|
+
<div class="flex w-full min-w-0 items-center">
|
|
338
410
|
<div
|
|
339
|
-
class="
|
|
340
|
-
|
|
341
|
-
|
|
411
|
+
class="max-w-full min-w-0 wrap-break-word {text.truncated ? 'truncate' : 'whitespace-pre-line'} {accent
|
|
412
|
+
? 'text-(--accent-text)'
|
|
413
|
+
: ''} {accent && text.badge ? 'w-fit rounded-md bg-(--accent-soft) px-1.5 text-[12px] font-medium' : 'w-full'}"
|
|
414
|
+
style={accentStyle(accent)}
|
|
415
|
+
onmouseenter={text.tooltip
|
|
416
|
+
? (e) => {
|
|
417
|
+
const tip = typeof text.tooltip === "function" ? text.tooltip(row) : cellText(row, text)
|
|
418
|
+
if (tip) tooltip = { show: true, text: tip, x: e.clientX, y: e.clientY }
|
|
419
|
+
}
|
|
420
|
+
: undefined}
|
|
421
|
+
onmouseleave={text.tooltip ? () => (tooltip.show = false) : undefined}
|
|
422
|
+
onmousemove={text.tooltip ? (e) => ((tooltip.x = e.clientX), (tooltip.y = e.clientY)) : undefined}
|
|
423
|
+
role="presentation"
|
|
342
424
|
>
|
|
343
|
-
{#
|
|
425
|
+
{#if text.modal}
|
|
344
426
|
<button
|
|
345
|
-
class={
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
427
|
+
class="cursor-pointer text-left {text.truncated ? 'block w-full max-w-full truncate' : 'w-fit'}"
|
|
428
|
+
onclick={(e) => {
|
|
429
|
+
e.stopPropagation()
|
|
430
|
+
modal = { row, text }
|
|
431
|
+
modalOpen = true
|
|
432
|
+
}}
|
|
351
433
|
>
|
|
352
|
-
{
|
|
434
|
+
{#if text.html}{@html sanitizeHtml(value)}{:else}{value}{/if}
|
|
353
435
|
</button>
|
|
354
|
-
{
|
|
436
|
+
{:else if text.onClick}
|
|
437
|
+
<button
|
|
438
|
+
class="cursor-pointer text-left hover:underline"
|
|
439
|
+
onclick={(e) => {
|
|
440
|
+
e.stopPropagation()
|
|
441
|
+
text.onClick?.(row)
|
|
442
|
+
}}>{value}</button
|
|
443
|
+
>
|
|
444
|
+
{:else if text.href}
|
|
445
|
+
<a class="underline" href={text.href(row)}>{value}</a>
|
|
446
|
+
{:else if text.html}
|
|
447
|
+
{@html sanitizeHtml(value)}
|
|
448
|
+
{:else}
|
|
449
|
+
{value}
|
|
450
|
+
{/if}
|
|
355
451
|
</div>
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
{:else if content.type === "image"}
|
|
359
|
-
{@const image = content.data}
|
|
360
|
-
{@const src = resolve(image.src, row)}
|
|
361
|
-
<div
|
|
362
|
-
class="flex items-center justify-center [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full [&_svg]:max-w-full"
|
|
363
|
-
style={`width: ${image.width || "2rem"}; height: ${image.height || "2rem"};`}
|
|
364
|
-
>
|
|
365
|
-
{#if src}
|
|
366
|
-
<img {src} alt={image.alt ?? "Image"} class={twMerge("h-full w-full object-cover", image.class)} loading="lazy" />
|
|
367
|
-
{:else if typeof image.defaultIcon === "string"}
|
|
368
|
-
{@html sanitizeHtml(image.defaultIcon)}
|
|
369
|
-
{:else if image.defaultIcon}
|
|
370
|
-
<image.defaultIcon />
|
|
371
|
-
{/if}
|
|
372
|
-
</div>
|
|
373
|
-
{:else if content.type === "progressBar"}
|
|
374
|
-
{@const bar = content.data}
|
|
375
|
-
<div class="grid h-7 w-full grid-cols-[3.5rem_1fr] items-center gap-2">
|
|
376
|
-
<span class="text-right text-[12px] font-semibold tabular-nums">{roundToClean(Number(row[bar.key] ?? 0))}{bar.units}</span>
|
|
377
|
-
<div class="relative my-auto h-1.5 overflow-hidden rounded-full bg-(--container-color)">
|
|
378
|
-
<div
|
|
379
|
-
class="absolute top-0 left-0 flex h-full rounded-full bg-(--bg-color,var(--accent-color))"
|
|
380
|
-
style="width: {progressPercent(row[bar.key] as number, bar.minNum, bar.maxNum)}%;"
|
|
381
|
-
></div>
|
|
382
|
-
</div>
|
|
383
|
-
</div>
|
|
384
|
-
{:else if content.type === "text"}
|
|
385
|
-
{@const text = content.data}
|
|
386
|
-
{@const value = cellContent(row, text)}
|
|
387
|
-
{@const accent = text.accent?.(row)}
|
|
388
|
-
<!-- w-full + min-w-0: при justify-items-start ячейка иначе берёт ширину по содержимому и truncate не даёт «…»;
|
|
389
|
-
в тексте - перенос строки -->
|
|
390
|
-
<div class="flex w-full min-w-0 items-center">
|
|
391
|
-
<div
|
|
392
|
-
class="max-w-full min-w-0 wrap-break-word {text.truncated ? 'truncate' : 'whitespace-pre-line'} {accent
|
|
393
|
-
? 'text-(--accent-text)'
|
|
394
|
-
: ''} {accent && text.badge ? 'w-fit rounded-md bg-(--accent-soft) px-1.5 text-[12px] font-medium' : 'w-full'}"
|
|
395
|
-
style={accentStyle(accent)}
|
|
396
|
-
onmouseenter={text.tooltip
|
|
397
|
-
? (e) => {
|
|
398
|
-
const tip = typeof text.tooltip === "function" ? text.tooltip(row) : cellText(row, text)
|
|
399
|
-
if (tip) tooltip = { show: true, text: tip, x: e.clientX, y: e.clientY }
|
|
400
|
-
}
|
|
401
|
-
: undefined}
|
|
402
|
-
onmouseleave={text.tooltip ? () => (tooltip.show = false) : undefined}
|
|
403
|
-
onmousemove={text.tooltip ? (e) => ((tooltip.x = e.clientX), (tooltip.y = e.clientY)) : undefined}
|
|
404
|
-
role="presentation"
|
|
405
|
-
>
|
|
406
|
-
{#if text.modal}
|
|
407
|
-
<button
|
|
408
|
-
class="cursor-pointer text-left {text.truncated ? 'block w-full max-w-full truncate' : 'w-fit'}"
|
|
409
|
-
onclick={(e) => {
|
|
410
|
-
e.stopPropagation()
|
|
411
|
-
modal = { row, text }
|
|
412
|
-
modalOpen = true
|
|
413
|
-
}}
|
|
414
|
-
>
|
|
415
|
-
{#if text.html}{@html sanitizeHtml(value)}{:else}{value}{/if}
|
|
416
|
-
</button>
|
|
417
|
-
{:else if text.onClick}
|
|
418
|
-
<button
|
|
419
|
-
class="cursor-pointer text-left hover:underline"
|
|
420
|
-
onclick={(e) => {
|
|
421
|
-
e.stopPropagation()
|
|
422
|
-
text.onClick?.(row)
|
|
423
|
-
}}>{value}</button
|
|
424
|
-
>
|
|
425
|
-
{:else if text.href}
|
|
426
|
-
<a class="underline" href={text.href(row)}>{value}</a>
|
|
427
|
-
{:else if text.html}
|
|
428
|
-
{@html sanitizeHtml(value)}
|
|
429
|
-
{:else}
|
|
430
|
-
{value}
|
|
452
|
+
{#if text.copy}
|
|
453
|
+
<CopyButton class="ml-1.5" text={() => cellText(row, text)} />
|
|
431
454
|
{/if}
|
|
432
455
|
</div>
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
{#if dataBuffer.clearButton}<div></div>{/if}
|
|
443
|
-
</div>
|
|
444
|
-
{/each}
|
|
456
|
+
{/if}
|
|
457
|
+
{/each}
|
|
458
|
+
</div>
|
|
459
|
+
{/if}
|
|
460
|
+
{/each}
|
|
461
|
+
{#if dataBuffer.clearButton}<div></div>{/if}
|
|
462
|
+
</div>
|
|
463
|
+
{/each}
|
|
464
|
+
</div>
|
|
445
465
|
</div>
|
|
446
|
-
|
|
447
|
-
|
|
466
|
+
{/if}
|
|
467
|
+
</div>
|
|
448
468
|
|
|
449
469
|
{#if tooltip.show}
|
|
450
470
|
<div
|
|
@@ -458,7 +478,7 @@
|
|
|
458
478
|
{/if}
|
|
459
479
|
<!-- Нижнее поле для сводной информации -->
|
|
460
480
|
{#if footer}
|
|
461
|
-
<div class="flex h-8 items-center justify-center border-t border-(--hairline-color) bg-(--container-color)">
|
|
481
|
+
<div class="sticky left-0 flex h-8 shrink-0 items-center justify-center border-t border-(--hairline-color) bg-(--container-color)">
|
|
462
482
|
<span class="text-[12px] font-semibold text-(--muted-color)">{footer}</span>
|
|
463
483
|
</div>
|
|
464
484
|
{/if}
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
let { wrapperClass = "", accent, background = false, underline = false, content = { name: "", class: "", size: "base" } }: ITextFieldProps = $props()
|
|
8
8
|
|
|
9
|
-
/* Размеры по шкале темы: 13 / 15 / 24 / 34 / 44 с весом и трекингом по
|
|
9
|
+
/* Размеры по шкале темы: 13 / 15 / 24 / 34 / 44 с весом и трекингом по роли; на телефоне крупные меньше: 20 / 26 / 32 */
|
|
10
10
|
const textSize = {
|
|
11
11
|
small: "text-[13px] leading-[1.45] text-(--muted-color)",
|
|
12
12
|
base: "text-[15px] leading-[1.5]",
|
|
13
|
-
large: "text-[24px] leading-[1.2] font-[650] tracking-[-0.015em]",
|
|
14
|
-
huge: "text-[34px] leading-[1.15] font-[650] tracking-[-0.02em]",
|
|
15
|
-
massive: "text-[44px] leading-[1.08] font-bold tracking-[-0.025em]",
|
|
13
|
+
large: "text-[24px] leading-[1.2] max-sm:text-[20px] font-[650] tracking-[-0.015em]",
|
|
14
|
+
huge: "text-[34px] leading-[1.15] max-sm:text-[26px] font-[650] tracking-[-0.02em]",
|
|
15
|
+
massive: "text-[44px] leading-[1.08] max-sm:text-[32px] font-bold tracking-[-0.025em]",
|
|
16
16
|
} as const
|
|
17
17
|
</script>
|
|
18
18
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
wrapperClass,
|
|
24
24
|
)}
|
|
25
25
|
>
|
|
26
|
-
<p class={twMerge(`w-full text-pretty ${textSize[content.size ?? "base"]}`, accent ? "text-(--accent-text)" : "", content.class)}>
|
|
26
|
+
<p class={twMerge(`w-full text-pretty wrap-break-word ${textSize[content.size ?? "base"]}`, accent ? "text-(--accent-text)" : "", content.class)}>
|
|
27
27
|
{content.name}
|
|
28
28
|
</p>
|
|
29
29
|
</div>
|
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
let off = $derived(disabled || !text)
|
|
51
51
|
</script>
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
<!-- Три кнопки в ряд, на узком месте переносятся -->
|
|
54
|
+
<div class="grid grid-cols-[repeat(auto-fit,minmax(7rem,1fr))] gap-3">
|
|
54
55
|
<div class="min-w-0" use:hint={{ text: $T("widget.mission.hint.download"), enabled: hints }}>
|
|
55
56
|
<Button variant="primary" content={{ name: $T("widget.mission.download") }} disabled={off} onClick={download} />
|
|
56
57
|
</div>
|
package/dist/defaults.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare const COMPONENT_SIZES: Record<UIType, {
|
|
|
6
6
|
width: number;
|
|
7
7
|
height: number;
|
|
8
8
|
}>;
|
|
9
|
-
export declare const minComponentWidth: (type: string) => 1 |
|
|
9
|
+
export declare const minComponentWidth: (type: string) => 1 | 7;
|
|
10
10
|
export declare const createComponent: <K extends UIType>(type: K, { col, row }?: {
|
|
11
11
|
col?: number;
|
|
12
12
|
row?: number;
|
package/dist/defaults.js
CHANGED
|
@@ -62,35 +62,35 @@ export const COMPONENT_DEFAULTS = {
|
|
|
62
62
|
VideoViewer: { label, showSelect: true },
|
|
63
63
|
Divider: { type: "line", width: 2, anchor: "center" },
|
|
64
64
|
};
|
|
65
|
-
/* Размер нового компонента в клетках
|
|
65
|
+
/* Размер нового компонента в клетках сетки: компактный, автор растягивает по месту; каркас (разделитель, аккордеон, вкладки) - во всю ширину */
|
|
66
66
|
export const COMPONENT_SIZES = {
|
|
67
|
-
WidgetWiFi: { width:
|
|
68
|
-
WidgetDeviceInfo: { width:
|
|
69
|
-
WidgetFileSystem: { width:
|
|
70
|
-
WidgetStackInfo: { width:
|
|
71
|
-
WidgetRGBStrip: { width:
|
|
72
|
-
WidgetPFD: { width:
|
|
73
|
-
WidgetMap: { width:
|
|
67
|
+
WidgetWiFi: { width: 7, height: 1 },
|
|
68
|
+
WidgetDeviceInfo: { width: 7, height: 1 },
|
|
69
|
+
WidgetFileSystem: { width: 7, height: 1 },
|
|
70
|
+
WidgetStackInfo: { width: 7, height: 1 },
|
|
71
|
+
WidgetRGBStrip: { width: 7, height: 1 },
|
|
72
|
+
WidgetPFD: { width: 7, height: 1 },
|
|
73
|
+
WidgetMap: { width: 7, height: 1 },
|
|
74
74
|
Accordion: { width: GUI_GRID.columns, height: 1 },
|
|
75
75
|
Tabs: { width: GUI_GRID.columns, height: 4 },
|
|
76
|
-
Input: { width:
|
|
77
|
-
Select: { width:
|
|
78
|
-
Slider: { width:
|
|
76
|
+
Input: { width: 3, height: 1 },
|
|
77
|
+
Select: { width: 3, height: 1 },
|
|
78
|
+
Slider: { width: 3, height: 1 },
|
|
79
79
|
Switch: { width: 2, height: 1 },
|
|
80
|
-
FileAttach: { width:
|
|
80
|
+
FileAttach: { width: 7, height: 1 },
|
|
81
81
|
Joystick: { width: 4, height: 3 },
|
|
82
82
|
Button: { width: 2, height: 1 },
|
|
83
|
-
Table: { width:
|
|
84
|
-
ProgressBar: { width:
|
|
83
|
+
Table: { width: 11, height: 2 },
|
|
84
|
+
ProgressBar: { width: 3, height: 1 },
|
|
85
85
|
TextField: { width: 3, height: 1 },
|
|
86
|
-
Graph: { width:
|
|
87
|
-
PeriodChart: { width:
|
|
86
|
+
Graph: { width: 7, height: 3 },
|
|
87
|
+
PeriodChart: { width: 7, height: 4 },
|
|
88
88
|
Widget: { width: 3, height: 3 },
|
|
89
89
|
VideoViewer: { width: 7, height: 7 },
|
|
90
90
|
Divider: { width: GUI_GRID.columns, height: 1 },
|
|
91
91
|
};
|
|
92
|
-
/* Наименьшая ширина: смарт-виджет не уже
|
|
93
|
-
export const minComponentWidth = (type) => (isWidgetType(type) ?
|
|
92
|
+
/* Наименьшая ширина: смарт-виджет не уже 7 клеток (треть сетки), иначе шапка и поля не помещаются */
|
|
93
|
+
export const minComponentWidth = (type) => (isWidgetType(type) ? 7 : 1);
|
|
94
94
|
/* Новый компонент в клетке (col, row) области шириной areaWidth; tab - номер вкладки родителя Tabs (последний знак id). Не помещающийся компонент сужается, но не меньше minComponentWidth - тогда сдвигается влево */
|
|
95
95
|
export const createComponent = (type, { col = 1, row = 1 } = {}, parentId = "", { tab, areaWidth = GUI_GRID.columns } = {}) => {
|
|
96
96
|
const uuid = crypto.randomUUID();
|
package/dist/gui.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DeviceTransport } from "./fsTransfer";
|
|
2
2
|
import type { IUIComponentHandler, IWidgetFileSystemInfo, IWidgetStackInfo, UIComponent } from "./types";
|
|
3
3
|
export declare const GUI_GRID: {
|
|
4
|
-
readonly columns:
|
|
4
|
+
readonly columns: 23;
|
|
5
5
|
readonly cellHeight: 6;
|
|
6
6
|
};
|
|
7
7
|
export declare const isWidgetType: (type: string) => boolean;
|
|
@@ -151,3 +151,13 @@ export declare const mergeDevicePayload: (values: {
|
|
|
151
151
|
get(key: string): unknown;
|
|
152
152
|
set(key: string, value: never): unknown;
|
|
153
153
|
}, prefix: string, argument: string, payload: unknown) => void;
|
|
154
|
+
export type FlowNode = {
|
|
155
|
+
kind: "leaf";
|
|
156
|
+
component: UIComponent;
|
|
157
|
+
} | {
|
|
158
|
+
kind: "stack" | "groups" | "line";
|
|
159
|
+
items: FlowNode[];
|
|
160
|
+
};
|
|
161
|
+
export declare const layoutFlow: (list: UIComponent[]) => FlowNode;
|
|
162
|
+
export declare const flowMinWidth: (node: FlowNode) => number;
|
|
163
|
+
export declare const layoutColumns: (list: UIComponent[], total: number) => string;
|
package/dist/gui.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* $lib/gui.ts - чистые правила рендерера GUI устройства (GUIRenderer): сетка, поля смарт-виджетов, битовые поля, сборка пакетов команд, слияние ответа устройства в хранилище значений. Без Svelte - проверяются тестами против dist */
|
|
2
2
|
import { bitFieldGet, bitFieldSet } from "./bitField.js";
|
|
3
|
-
/* Сетка GUI:
|
|
4
|
-
export const GUI_GRID = { columns:
|
|
3
|
+
/* Сетка GUI: 23 колонки (2, 3, 4, 6 и 12 равных групп с пустой колонкой между ними), высота строки в rem - общая для конструктора и рендерера */
|
|
4
|
+
export const GUI_GRID = { columns: 23, cellHeight: 6 };
|
|
5
5
|
/* Смарт-виджет - тип с префиксом Widget, кроме примитива Widget */
|
|
6
6
|
export const isWidgetType = (type) => type.startsWith("Widget") && type !== "Widget";
|
|
7
7
|
/* Строк сетки у компонента: аккордеон и смарт-виджеты - одна строка, растущая по содержимому */
|
|
@@ -219,3 +219,104 @@ export const mergeDevicePayload = (values, prefix, argument, payload) => {
|
|
|
219
219
|
put(prefix + name, value);
|
|
220
220
|
}
|
|
221
221
|
};
|
|
222
|
+
/* ********************************************************** */
|
|
223
|
+
/* Раскладка по правилам автора: группа - блоки вплотную; группы разделяет пустая строка или блок во всю ширину (друг под другом), пустая колонка (рядом); см. README «Раскладка и правила для автора GUI» */
|
|
224
|
+
const rows = (c) => [c.position.row, c.position.row + spanRows(c)];
|
|
225
|
+
const cols = (c) => [c.position.col, c.position.col + c.position.width];
|
|
226
|
+
/* Деление по оси: gap - новая часть только через пустую клетку (граница групп), без gap - на любой границе (строки формы) */
|
|
227
|
+
const split = (list, range, gap) => {
|
|
228
|
+
const sorted = [...list].sort((a, b) => range(a)[0] - range(b)[0]);
|
|
229
|
+
const parts = [];
|
|
230
|
+
let end = -Infinity;
|
|
231
|
+
for (const c of sorted) {
|
|
232
|
+
const [start, stop] = range(c);
|
|
233
|
+
if (gap ? start > end : start >= end)
|
|
234
|
+
parts.push([c]);
|
|
235
|
+
else
|
|
236
|
+
parts[parts.length - 1].push(c);
|
|
237
|
+
end = Math.max(end, stop);
|
|
238
|
+
}
|
|
239
|
+
return parts;
|
|
240
|
+
};
|
|
241
|
+
const leaf = (component) => ({ kind: "leaf", component });
|
|
242
|
+
/* Группа без пустых клеток внутри: строки формы сверху вниз, в строке блоки рядом; блок в несколько строк (джойстик) встаёт рядом со своими соседями */
|
|
243
|
+
const form = (list) => {
|
|
244
|
+
if (list.length === 1)
|
|
245
|
+
return leaf(list[0]);
|
|
246
|
+
const bands = split(list, rows, false);
|
|
247
|
+
if (bands.length > 1)
|
|
248
|
+
return { kind: "stack", items: bands.map(form) };
|
|
249
|
+
const columns = split(list, cols, false);
|
|
250
|
+
if (columns.length > 1)
|
|
251
|
+
return { kind: "line", items: columns.map(form) };
|
|
252
|
+
return { kind: "stack", items: [...list].sort((a, b) => a.position.row - b.position.row || a.position.col - b.position.col).map(leaf) };
|
|
253
|
+
};
|
|
254
|
+
/* Участки между блоками во всю ширину (разделитель, график): такой блок - тоже граница разделов */
|
|
255
|
+
const parts = (list) => {
|
|
256
|
+
const out = [];
|
|
257
|
+
let run = [];
|
|
258
|
+
for (const band of split(list, rows, false)) {
|
|
259
|
+
if (split(band, cols, false).length > 1) {
|
|
260
|
+
run.push(...band);
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
if (run.length)
|
|
264
|
+
out.push(run);
|
|
265
|
+
out.push(band);
|
|
266
|
+
run = [];
|
|
267
|
+
}
|
|
268
|
+
if (run.length)
|
|
269
|
+
out.push(run);
|
|
270
|
+
return out;
|
|
271
|
+
};
|
|
272
|
+
export const layoutFlow = (list) => {
|
|
273
|
+
if (list.length === 1)
|
|
274
|
+
return leaf(list[0]);
|
|
275
|
+
const sections = split(list, rows, true);
|
|
276
|
+
if (sections.length > 1)
|
|
277
|
+
return { kind: "stack", items: sections.map(layoutFlow) };
|
|
278
|
+
const runs = parts(list);
|
|
279
|
+
if (runs.length > 1)
|
|
280
|
+
return { kind: "stack", items: runs.map(layoutFlow) };
|
|
281
|
+
const groups = split(list, cols, true);
|
|
282
|
+
if (groups.length > 1)
|
|
283
|
+
return { kind: "groups", items: groups.map(layoutFlow) };
|
|
284
|
+
return form(list);
|
|
285
|
+
};
|
|
286
|
+
/* Наименьшая удобная ширина блока на телефоне, px; не указан - во всю ширину */
|
|
287
|
+
const MIN_PX = {
|
|
288
|
+
Switch: 90,
|
|
289
|
+
Input: 120,
|
|
290
|
+
Select: 130,
|
|
291
|
+
Slider: 120,
|
|
292
|
+
Button: 110,
|
|
293
|
+
TextField: 100,
|
|
294
|
+
ProgressBar: 140,
|
|
295
|
+
Widget: 120,
|
|
296
|
+
Joystick: 200,
|
|
297
|
+
};
|
|
298
|
+
export const flowMinWidth = (node) => {
|
|
299
|
+
if (node.kind === "leaf") {
|
|
300
|
+
/* Список кнопками - по ширине вариантов, не поместится в пол-экрана - во всю ширину */
|
|
301
|
+
const props = node.component.properties;
|
|
302
|
+
if (node.component.type === "Select" && props.type === "buttons") {
|
|
303
|
+
const px = 44 * (props.options?.length ?? 2);
|
|
304
|
+
return px > 300 ? Infinity : Math.max(px, 120);
|
|
305
|
+
}
|
|
306
|
+
return MIN_PX[node.component.type] ?? Infinity;
|
|
307
|
+
}
|
|
308
|
+
const widths = node.items.map(flowMinWidth);
|
|
309
|
+
return node.kind === "stack" ? Math.max(...widths) : widths.reduce((sum, w) => sum + w + 8, -8);
|
|
310
|
+
};
|
|
311
|
+
/* Компьютер: сетка из колонок автора, внутренние пустые колонки (границы групп) - узкая полоса вместо полной колонки */
|
|
312
|
+
const GUTTER = "0.75rem";
|
|
313
|
+
export const layoutColumns = (list, total) => {
|
|
314
|
+
const used = new Set();
|
|
315
|
+
for (const c of list)
|
|
316
|
+
for (let col = c.position.col; col < c.position.col + c.position.width; col++)
|
|
317
|
+
used.add(col);
|
|
318
|
+
const count = Math.max(total, ...list.map((c) => c.position.col + c.position.width - 1));
|
|
319
|
+
const first = Math.min(...used);
|
|
320
|
+
const last = Math.max(...used);
|
|
321
|
+
return Array.from({ length: count }, (_, i) => (i + 1 > first && i + 1 < last && !used.has(i + 1) ? GUTTER : "minmax(0, 1fr)")).join(" ");
|
|
322
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const constructorTranslations = {
|
|
2
2
|
"library.overview": { ru: "Обзор", en: "Overview", zh: "概览" },
|
|
3
3
|
"library.examples": { ru: "Примеры", en: "Examples", zh: "示例" },
|
|
4
|
+
"library.phone": { ru: "Телефон", en: "Phone", zh: "手机" },
|
|
4
5
|
"library.regexp": { ru: "Регулярные выражения", en: "Regular expressions", zh: "正则表达式" },
|
|
5
6
|
"library.theme": { ru: "Тема", en: "Theme", zh: "主题" },
|
|
6
7
|
"library.icons": { ru: "Иконки", en: "Icons", zh: "图标" },
|