Files
aurora-admin/frameworks-mobile/SwipeCell.html
T
aurora-admin f1fbfc2ddb
Regression / regression (push) Canceled after 0s
feat(品牌标识): 几何 K 图标(favicon/顶栏标记/theme-color) + 并行会话成果入库
## 品牌标识(本次会话)

起因:品牌此前没有任何图形标识 —— 唯一 favicon 是内联 data-URI 里的字母「A」,
那是 v2.0.0「Aurora Admin → Kole UI」改名漏掉的一处(PC 顶栏也是「A」,
移动端站已是「K」;移动端文档站则完全没有 favicon)。

- 几何:24 网格三个互不接触的笔画(竖 + 两斜),圆头描边;
  描边 2.25 → 16px 标签页尺寸下正好 1.5px = 规范原文「描边1.5px」
- 取色分两套(刻意):favicon 硬编码品牌蓝/白(渲染在浏览器标签栏,不继承 kole-dark);
  顶栏标记走 currentColor(实测暗色下自动转 rgb(20,22,28))
- 新增 theme-color 双条(light #FFFFFF / dark #1C1F26,取 --kole-color-card-bg)
- 修 site/app.js hero 标语 KOLE ADMIN → KOLE UI(改名变形残留)
- 移动端 7 个模板补 favicon(此前计数 0)

验收:门禁 9 条全 OK(site-routing/site-routes/mobile-docs/mobile-site/isolation/
theme/nav/i18n/icons);PC 回归 1464/1464 · 移动端 807/807,各连跑 8 次一致;
两端 favicon 405 字节逐字节一致;PC 站控制台错误 1→0。

## 并行会话成果(本次一并入库)

- 图标系统:2576 图标(TDesign/Element Plus,MIT)+ 11 端注入 + 5 个构建门禁工具
  + IconPreview 预览页 + ICON-SPEC.md 冻结规格
- 移动端平台:47 组件 × 6 端 + 文档站 53 页 + 隔离门禁
- PC 组件:103 个大后台组件 / 组件11 批次
- uni-app:PC 端试点 + 移动端端实现 + 真实编译验证

## 工程

- .gitignore 补 .scratch/ 与 .zcode-preexisting-*.txt(会话中间产物,实测 9.1MB,不入库)
- CHANGELOG 补品牌标识条目
- ROADMAP 登 S8-P4(品牌标识任务包 + og:image/apple-touch-icon 未做部分)
2026-09-21 10:05:48 +08:00

168 lines
7.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
<title>Kole UI Mobile · SwipeCell(H5)</title>
<link rel="stylesheet" href="../.design_library/kole-ui-mobile/colors_and_type.css">
<link rel="stylesheet" href="SwipeCell.css">
<style>
body { margin: 0; background: var(--kole-color-page-bg); font-family: var(--kole-font-family); color: var(--kole-color-text-body); }
.demo { max-width: 375px; margin: 0 auto; padding: var(--kole-m-gutter) 0; }
.demo-label { margin: 0; padding: var(--kole-space-12) var(--kole-m-gutter) var(--kole-space-8);
font-size: var(--kole-m-font-size-label); color: var(--kole-color-text-secondary); }
.demo-frame { position: relative; max-width: 375px; margin: 0 auto; overflow: hidden;
background: var(--kole-color-card-bg); border-block: 1px solid var(--kole-color-border); }
</style>
</head>
<body>
<div class="demo">
<section class="demo-block" data-demo="left-single">
<p class="demo-label">左滑 · 单个操作(direction=left / actions=1,在行上向左拖动)</p>
<div class="demo-frame" data-assert="swipecell-left-single">
<div class="kole-m-swipecell" id="sc-left-1" data-state="closed"
data-behavior="swipe-sets-class:#sc-left-1|is-open">
<div class="kole-m-swipecell__actions">
<button class="kole-m-swipecell__action" type="button" aria-label="标记为已完成">完成</button>
</div>
<div class="kole-m-swipecell__content">
<span class="kole-m-swipecell__title">订单 20260920-001</span>
<span class="kole-m-swipecell__desc">2026-09-20 09:12 · 待处理</span>
</div>
</div>
</div>
</section>
<section class="demo-block" data-demo="left-double">
<p class="demo-label">左滑 · 两个操作(actions=2,data-state 由 closed 变 open)</p>
<div class="demo-frame" data-assert="swipecell-left-double">
<div class="kole-m-swipecell" id="sc-left-2" data-state="closed"
data-behavior="swipe-sets-attr:#sc-left-2|data-state|open">
<div class="kole-m-swipecell__actions">
<button class="kole-m-swipecell__action" type="button" aria-label="标记为已完成">完成</button>
<button class="kole-m-swipecell__action kole-m-swipecell__action--danger" type="button" aria-label="删除订单">删除</button>
</div>
<div class="kole-m-swipecell__content">
<span class="kole-m-swipecell__title">订单 20260920-002</span>
<span class="kole-m-swipecell__desc">2026-09-20 10:40 · 待处理</span>
</div>
</div>
</div>
</section>
<section class="demo-block" data-demo="right-single">
<p class="demo-label">右滑 · 单个操作(direction=right,在行上向右拖动)</p>
<div class="demo-frame" data-assert="swipecell-right-single">
<div class="kole-m-swipecell kole-m-swipecell--right" id="sc-right-1" data-state="closed"
data-behavior="swipe-sets-class:#sc-right-1|is-open|right">
<div class="kole-m-swipecell__actions">
<button class="kole-m-swipecell__action" type="button" aria-label="标记为已读">已读</button>
</div>
<div class="kole-m-swipecell__content">
<span class="kole-m-swipecell__title">订单 20260920-003</span>
<span class="kole-m-swipecell__desc">2026-09-20 11:05 · 未读</span>
</div>
</div>
</div>
</section>
<section class="demo-block" data-demo="open">
<p class="demo-label">已展开态(is-open:操作按钮可键盘聚焦,滑动不是唯一路径)</p>
<div class="demo-frame" data-assert="swipecell-open">
<div class="kole-m-swipecell is-open" id="sc-open" data-state="open" style="--kole-m-swipecell-offset: -144px">
<div class="kole-m-swipecell__actions">
<button class="kole-m-swipecell__action" type="button" aria-label="标记为已完成">完成</button>
<button class="kole-m-swipecell__action kole-m-swipecell__action--danger" type="button" aria-label="删除订单">删除</button>
</div>
<div class="kole-m-swipecell__content">
<span class="kole-m-swipecell__title">订单 20260920-004</span>
<span class="kole-m-swipecell__desc">已滑出操作区,点击内容区先收起</span>
</div>
</div>
</div>
</div>
</section>
<script>
/* 手势:纵向位移更大时取消滑动(让位给页面滚动);横向位移 > 10px 才算滑动。
松手按是否超过操作区宽度一半决定展开/回弹;is-open 与 data-state 同一函数写入。 */
(function () {
var THRESHOLD = 10;
function apply(cell, open) {
var right = cell.classList.contains('kole-m-swipecell--right');
var width = cell.querySelector('.kole-m-swipecell__actions').offsetWidth || 72;
var offset = open ? (right ? width : -width) : 0;
cell.style.setProperty('--kole-m-swipecell-offset', offset + 'px');
cell.classList.toggle('is-open', open);
cell.setAttribute('data-state', open ? 'open' : 'closed');
}
document.querySelectorAll('.kole-m-swipecell').forEach(function (cell) {
var startX = 0, startY = 0, dx = 0, dragging = false, decided = false, width = 72;
cell.addEventListener('pointerdown', function (e) {
startX = e.clientX;
startY = e.clientY;
dx = 0;
decided = false;
width = cell.querySelector('.kole-m-swipecell__actions').offsetWidth || 72;
});
cell.addEventListener('pointermove', function (e) {
dx = e.clientX - startX;
var dy = e.clientY - startY;
if (!decided) {
if (Math.abs(dx) < THRESHOLD && Math.abs(dy) < THRESHOLD) return;
decided = true;
if (Math.abs(dy) > Math.abs(dx)) return; /* 纵向为主:交给页面滚动 */
dragging = true;
cell.classList.add('is-dragging');
}
if (!dragging) return;
var clamped = Math.max(-width, Math.min(width, dx));
cell.style.setProperty('--kole-m-swipecell-offset', clamped + 'px');
});
function end() {
if (dragging) {
dragging = false;
cell.classList.remove('is-dragging');
apply(cell, Math.abs(dx) > width / 2);
} else if (cell.classList.contains('is-open')) {
apply(cell, false); /* 展开态点击内容区先收起 */
}
decided = false;
}
cell.addEventListener('pointerup', end);
cell.addEventListener('pointercancel', end);
});
})();
</script>
<script>
/* ?demo=<id> → 只显示该演示块:文档站为每个演示单独起一个 375×640 预览帧。
无参数时全部显示 —— 测试页与回归走无参数路径,行为不变。 */
(function () {
var id = new URLSearchParams(location.search).get('demo');
if (!id) return;
var blocks = Array.prototype.slice.call(document.querySelectorAll('.demo-block'));
var hit = false;
blocks.forEach(function (b) {
var on = b.getAttribute('data-demo') === id;
if (on) hit = true;
b.hidden = !on;
});
if (!hit) { blocks.forEach(function (b) { b.hidden = false; }); return; }
document.body.classList.add('demo-single');
/* 单块模式去掉 min-height:100vh —— 否则内容高度随帧高变化(帧高→vh→内容高)形成反馈环,
自适应量到的永远是视口高度而不是内容高度。 */
var demoBox = document.querySelector('.demo');
if (demoBox) demoBox.style.minHeight = 'auto';
/* 单块模式:帧内不再重复显示演示标题行(文档页已给出标题与说明) */
blocks.forEach(function (b) {
var label = b.querySelector('.demo-label');
if (label && !b.hidden) label.hidden = true;
});
})();
</script>
</body>
</html>