Polish approved 1.0 scope and verify portable previews
This commit is contained in:
1 parent
1819f35f91
commit
2b45df2816
181 files changed
+996
-139
No files matched your search
@@ -88,4 +88,4 @@ Revision 04: отдельной иконки раскрытия Dock нет. Hov
|
||||
|
||||
## Содержимое и серверная статистика
|
||||
|
||||
Markdown — через Marked + DOMPurify и локальную подсветку; редактор — textarea с номерами строк, без исполнения кода. Разрешения/сохранение/запросы остаются у приложения. Хлебные крошки используют реальные ссылки на родителей. Графики имеют единицы, период, значения при наведении и числовое представление. Мини-логи окрашивают всю строку по уровню, сохраняя текст уровня. Детальные контракты: [CONTENT-WORKSPACES.md](../docs/CONTENT-WORKSPACES.md). Новые элементы 02.12.2026 ожидают утверждения и итоговых проверок.
|
||||
Markdown — через Marked + DOMPurify и локальную подсветку; редактор — textarea с номерами строк, без исполнения кода. Разрешения/сохранение/запросы остаются у приложения. Хлебные крошки используют реальные ссылки на родителей. Графики имеют единицы, период, значения при наведении и числовое представление. Мини-логи окрашивают всю строку по уровню, сохраняя текст уровня. Детальные контракты: [CONTENT-WORKSPACES.md](../docs/CONTENT-WORKSPACES.md). Состав 1.0 утверждён 02.12.2026; выпуск ожидает итоговых проверок и ручного просмотра.
|
||||
@@ -54,7 +54,7 @@ export function mountAccountSubmenu(parent) {
|
||||
}
|
||||
function position() {
|
||||
cancelAnimationFrame(frame);
|
||||
frame = requestAnimationFrame(() => {
|
||||
function place() {
|
||||
if (disposed || !open()) return;
|
||||
const viewport = window.visualViewport,
|
||||
vw = viewport?.width || document.documentElement.clientWidth,
|
||||
@@ -83,7 +83,9 @@ export function mountAccountSubmenu(parent) {
|
||||
oy + 12,
|
||||
Math.min(row.getBoundingClientRect().top, oy + vh - h - 12),
|
||||
) + "px";
|
||||
});
|
||||
}
|
||||
place();
|
||||
frame = requestAnimationFrame(place);
|
||||
}
|
||||
function close(restore = false) {
|
||||
clearTimeout(timer);
|
||||
|
||||
+24
-14
@@ -8,17 +8,18 @@ const types = new Set([
|
||||
"gauge",
|
||||
"sparkline",
|
||||
]);
|
||||
const format = (value, unit = "") =>
|
||||
value == null
|
||||
? "—"
|
||||
: `${new Intl.NumberFormat(undefined, { maximumFractionDigits: 2 }).format(value)}${unit ? " " + unit : ""}`;
|
||||
export function mountChart(root, initial) {
|
||||
const abort = new AbortController(),
|
||||
{ signal } = abort;
|
||||
let model,
|
||||
let options = {},
|
||||
model,
|
||||
active = -1,
|
||||
disposed = false;
|
||||
root.classList.add("metric-chart");
|
||||
const format = (value, unit = "") =>
|
||||
value == null
|
||||
? "—"
|
||||
: `${new Intl.NumberFormat(model.t("ru-RU", "en-US"), { maximumFractionDigits: 1 }).format(value)}${unit ? " " + unit : ""}`;
|
||||
function normalize(options) {
|
||||
const type = options.type || "line";
|
||||
if (!types.has(type)) throw new TypeError("Unknown chart type");
|
||||
@@ -132,7 +133,7 @@ export function mountChart(root, initial) {
|
||||
if (value == null) return;
|
||||
const from = type === "stacked" ? sum : 0,
|
||||
to = from + value;
|
||||
output += `<rect class="chart-bar series-${s}" x="${12 + index * group + (type === "stacked" ? group * 0.14 : group * 0.14 + s * width)}" y="${Math.min(y(from), y(to))}" width="${width}" height="${Math.max(1, Math.abs(y(to) - y(from)))}" rx="2"/>`;
|
||||
output += `<rect class="chart-bar series-${s}" x="${12 + index * group + (type === "stacked" ? group * 0.14 : group * 0.14 + s * width)}" y="${Math.min(y(from), y(to))}" width="${width}" height="${Math.abs(y(to) - y(from))}" rx="2"/>`;
|
||||
sum += value;
|
||||
});
|
||||
}
|
||||
@@ -148,6 +149,8 @@ export function mountChart(root, initial) {
|
||||
});
|
||||
if (run.length) runs.push(run);
|
||||
for (const points of runs) {
|
||||
if (points.length === 1)
|
||||
output += `<circle class="chart-bar series-${s}" cx="${points[0][0]}" cy="${points[0][1]}" r="3"/>`;
|
||||
const d = points
|
||||
.map(([px, py], index) => `${index ? "L" : "M"}${px},${py}`)
|
||||
.join(" ");
|
||||
@@ -212,9 +215,7 @@ export function mountChart(root, initial) {
|
||||
tooltip.hidden = false;
|
||||
tooltip.setAttribute("aria-live", keyboard ? "polite" : "off");
|
||||
const width = plot.clientWidth,
|
||||
px = round
|
||||
? width / 2
|
||||
: (model.count < 2 ? 0.5 : active / (model.count - 1)) * width;
|
||||
px = round ? width / 2 : (x(active) / 640) * width;
|
||||
tooltip.style.left =
|
||||
Math.max(
|
||||
6,
|
||||
@@ -235,14 +236,21 @@ export function mountChart(root, initial) {
|
||||
"pointermove",
|
||||
(event) => {
|
||||
const plot = event.target.closest(".chart-plot");
|
||||
if (!plot) return;
|
||||
if (!plot) {
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
if (["donut", "gauge"].includes(model.type)) {
|
||||
const slice = event.target.closest("[data-chart-slice]");
|
||||
if (slice) show(Number(slice.dataset.chartSlice));
|
||||
else hide();
|
||||
} else {
|
||||
const ratio =
|
||||
(event.clientX - plot.getBoundingClientRect().left) /
|
||||
Math.max(1, plot.clientWidth);
|
||||
(((event.clientX - plot.getBoundingClientRect().left) /
|
||||
Math.max(1, plot.clientWidth)) *
|
||||
640 -
|
||||
12) /
|
||||
616;
|
||||
show(
|
||||
["bar", "stacked"].includes(model.type)
|
||||
? Math.floor(ratio * model.count)
|
||||
@@ -307,9 +315,11 @@ export function mountChart(root, initial) {
|
||||
},
|
||||
{ signal },
|
||||
);
|
||||
function update(options) {
|
||||
function update(next) {
|
||||
if (disposed) return;
|
||||
model = normalize({ ...model, ...options });
|
||||
const candidate = { ...options, ...next };
|
||||
model = normalize(candidate);
|
||||
options = candidate;
|
||||
render();
|
||||
}
|
||||
update(initial);
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
}
|
||||
.markdown-body table {
|
||||
display: block;
|
||||
min-width: 0;
|
||||
width: max-content;
|
||||
max-width: 100%;
|
||||
overflow: auto;
|
||||
@@ -488,140 +489,140 @@
|
||||
margin: 4px 0 8px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.chart-heading h3 {
|
||||
.metric-chart .chart-heading h3 {
|
||||
font-size: 14px;
|
||||
margin: 0 0 5px;
|
||||
}
|
||||
.chart-heading p {
|
||||
.metric-chart .chart-heading p {
|
||||
font-size: 12px;
|
||||
color: var(--color-muted);
|
||||
margin: 0 0 12px;
|
||||
}
|
||||
.chart-plot {
|
||||
.metric-chart .chart-plot {
|
||||
position: relative;
|
||||
height: 180px;
|
||||
margin-top: 16px;
|
||||
min-width: 0;
|
||||
border-radius: 6px;
|
||||
}
|
||||
.chart-plot > svg {
|
||||
.metric-chart .chart-plot > svg {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.chart-grid {
|
||||
.metric-chart .chart-grid {
|
||||
stroke: var(--color-border);
|
||||
stroke-width: 1;
|
||||
stroke-dasharray: 4 5;
|
||||
vector-effect: non-scaling-stroke;
|
||||
}
|
||||
.series-0 {
|
||||
.metric-chart .series-0 {
|
||||
--series-color: var(--color-accent);
|
||||
}
|
||||
.series-1 {
|
||||
.metric-chart .series-1 {
|
||||
--series-color: var(--color-warning);
|
||||
}
|
||||
.series-2 {
|
||||
.metric-chart .series-2 {
|
||||
--series-color: var(--color-success);
|
||||
}
|
||||
.series-3 {
|
||||
.metric-chart .series-3 {
|
||||
--series-color: var(--color-danger);
|
||||
}
|
||||
.series-4 {
|
||||
.metric-chart .series-4 {
|
||||
--series-color: color-mix(
|
||||
in srgb,
|
||||
var(--color-accent) 50%,
|
||||
var(--color-text)
|
||||
);
|
||||
}
|
||||
.series-5 {
|
||||
.metric-chart .series-5 {
|
||||
--series-color: var(--color-muted);
|
||||
}
|
||||
.series-6 {
|
||||
.metric-chart .series-6 {
|
||||
--series-color: color-mix(
|
||||
in srgb,
|
||||
var(--color-warning) 65%,
|
||||
var(--color-text)
|
||||
);
|
||||
}
|
||||
.series-7 {
|
||||
.metric-chart .series-7 {
|
||||
--series-color: color-mix(
|
||||
in srgb,
|
||||
var(--color-success) 65%,
|
||||
var(--color-text)
|
||||
);
|
||||
}
|
||||
.chart-line {
|
||||
.metric-chart .chart-line {
|
||||
stroke: var(--series-color);
|
||||
fill: none;
|
||||
stroke-width: 2;
|
||||
vector-effect: non-scaling-stroke;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
.chart-area {
|
||||
.metric-chart .chart-area {
|
||||
fill: var(--series-color);
|
||||
opacity: 0.13;
|
||||
stroke: none;
|
||||
}
|
||||
.chart-bar {
|
||||
.metric-chart .chart-bar {
|
||||
fill: var(--series-color);
|
||||
opacity: 0.85;
|
||||
}
|
||||
.chart-crosshair {
|
||||
.metric-chart .chart-crosshair {
|
||||
stroke: var(--color-muted);
|
||||
stroke-width: 1;
|
||||
stroke-dasharray: 3 3;
|
||||
vector-effect: non-scaling-stroke;
|
||||
}
|
||||
.chart-crosshair[hidden] {
|
||||
.metric-chart .chart-crosshair[hidden] {
|
||||
display: none;
|
||||
}
|
||||
.chart-axis {
|
||||
.metric-chart .chart-axis {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
font:
|
||||
10px ui-monospace,
|
||||
11px ui-monospace,
|
||||
monospace;
|
||||
color: var(--color-muted);
|
||||
}
|
||||
.chart-scale {
|
||||
.metric-chart .chart-scale {
|
||||
font-size: 10px;
|
||||
color: var(--color-muted);
|
||||
margin-top: 6px;
|
||||
}
|
||||
.chart-legend {
|
||||
.metric-chart .chart-legend {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px 14px;
|
||||
margin-top: 12px;
|
||||
font-size: 11px;
|
||||
font-size: 12px;
|
||||
color: var(--color-muted);
|
||||
}
|
||||
.chart-legend > span {
|
||||
.metric-chart .chart-legend > span {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
.chart-legend i {
|
||||
.metric-chart .chart-legend i {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: var(--series-color);
|
||||
}
|
||||
.chart-data {
|
||||
.metric-chart .chart-data {
|
||||
margin-top: 14px;
|
||||
border: 0;
|
||||
}
|
||||
.chart-data summary {
|
||||
.metric-chart .chart-data summary {
|
||||
font-size: 11px;
|
||||
color: var(--color-muted);
|
||||
padding: 4px 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
.chart-data table {
|
||||
.metric-chart .chart-data table {
|
||||
font-size: 11px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
@@ -648,22 +649,22 @@
|
||||
.metric-chart .chart-tooltip strong {
|
||||
font-weight: 600;
|
||||
}
|
||||
.chart-round {
|
||||
.metric-chart .chart-round {
|
||||
max-width: 280px;
|
||||
height: 180px;
|
||||
margin-inline: auto;
|
||||
}
|
||||
.chart-ring-track {
|
||||
.metric-chart .chart-ring-track {
|
||||
fill: none;
|
||||
stroke: var(--color-border);
|
||||
stroke-width: 20;
|
||||
}
|
||||
.chart-ring {
|
||||
.metric-chart .chart-ring {
|
||||
fill: none;
|
||||
stroke: var(--series-color);
|
||||
stroke-width: 20;
|
||||
}
|
||||
.chart-center {
|
||||
.metric-chart .chart-center {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
@@ -672,15 +673,15 @@
|
||||
justify-content: center;
|
||||
pointer-events: none;
|
||||
}
|
||||
.chart-center strong {
|
||||
.metric-chart .chart-center strong {
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.chart-center span {
|
||||
.metric-chart .chart-center span {
|
||||
font-size: 10px;
|
||||
color: var(--color-muted);
|
||||
}
|
||||
.chart-empty {
|
||||
.metric-chart .chart-empty {
|
||||
min-height: 180px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
|
||||
@@ -93,6 +93,7 @@ export async function exportSystem(
|
||||
};
|
||||
const files = {};
|
||||
const paths = [
|
||||
"index.html",
|
||||
"icons/icons.js",
|
||||
"icons/index.html",
|
||||
"icons/catalog.css",
|
||||
@@ -199,6 +200,8 @@ export async function exportSystem(
|
||||
);
|
||||
files[`tokens/${theme}.json`] = JSON.stringify(tokens, null, 2);
|
||||
files[`tokens/${theme}.css`] = `:root {\n${cssVars(tokens)}\n}\n`;
|
||||
files[`tokens/dock/${theme}.css`] = files[`tokens/${theme}.css`];
|
||||
files[`tokens/dock/${theme}.json`] = files[`tokens/${theme}.json`];
|
||||
}
|
||||
files["selection.json"] = JSON.stringify(
|
||||
{
|
||||
@@ -223,10 +226,12 @@ export async function exportSystem(
|
||||
locale: state.locale,
|
||||
});
|
||||
if (state.accents[c.id]) exportParams.set("accent", state.accents[c.id]);
|
||||
files["index.html"] =
|
||||
`<!doctype html><meta charset="utf-8"><title>Anidev ${c.name}</title><script>location.replace('playground/frame.html?${exportParams}')<\/script>`;
|
||||
files["index.html"] = files["index.html"].replace(
|
||||
"</head>",
|
||||
`<script>const url=new URL(location.href);const defaults=new URLSearchParams(${JSON.stringify(exportParams.toString())});for(const [key,value] of defaults)if(!url.searchParams.has(key))url.searchParams.set(key,value);history.replaceState(null,"",url);<\/script></head>`,
|
||||
);
|
||||
files["README.md"] =
|
||||
`# Anidev / ${c.name}\nApproved Dock design — gallery snapshot, version 0.2.0.\nServe this folder over HTTP (for example python -m http.server 8080).\nOpen index.html.\nUse tokens/light.css or tokens/dark.css and components/system.css in any framework.\nFor the separate integration package and installable Skill, run npm run build:package in the source repository; this snapshot does not contain its build tools.\nThird-party terminal licenses are in vendor/xterm.\n`;
|
||||
`# Anidev / ${c.name}\nApproved Dock design — gallery snapshot, version 0.2.0. Scope 1.0 approved; release pending manual review.\nServe this folder over HTTP (for example python -m http.server 8080).\nOpen index.html.\nUse tokens/light.css or tokens/dark.css and components/system.css in any framework.\nFor the separate integration package and installable Skill, run npm run build:package in the source repository; this snapshot does not contain its build tools.\nThird-party licenses are in vendor/xterm and vendor/text. Server metrics, documents and Identity data are demonstrations; no real API or SSH transport is connected.\n`;
|
||||
const url = URL.createObjectURL(zip(files)),
|
||||
a = document.createElement("a");
|
||||
a.href = url;
|
||||
|
||||
@@ -103,20 +103,24 @@ export function mountStatistics(
|
||||
t,
|
||||
}),
|
||||
);
|
||||
const number = new Intl.NumberFormat(t("ru-RU", "en-US"), {
|
||||
minimumFractionDigits: 1,
|
||||
maximumFractionDigits: 1,
|
||||
});
|
||||
const kpis = {
|
||||
cpu: {
|
||||
label: t("CPU сейчас", "CPU now"),
|
||||
value: `${last(next.cpu).toFixed(1)} %`,
|
||||
value: `${number.format(last(next.cpu))} %`,
|
||||
values: next.cpu,
|
||||
},
|
||||
memory: {
|
||||
label: t("Память сейчас", "Memory now"),
|
||||
value: `${last(next.memory).toFixed(1)} / ${next.memoryTotal || 16} ${t("ГБ", "GB")}`,
|
||||
value: `${number.format(last(next.memory))} / ${next.memoryTotal || 16} ${t("ГБ", "GB")}`,
|
||||
values: next.memory,
|
||||
},
|
||||
network: {
|
||||
label: t("Входящий трафик", "Inbound traffic"),
|
||||
value: `${last(next.networkIn).toFixed(1)} ${t("МБ/с", "MB/s")}`,
|
||||
value: `${number.format(last(next.networkIn))} ${t("МБ/с", "MB/s")}`,
|
||||
values: next.networkIn,
|
||||
},
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user