@microi.net/cli 5.9.5 → 5.9.6
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/.codebuddy-plugin/marketplace.json +2 -2
- package/.codebuddy-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.workbuddy-plugin/marketplace.json +2 -2
- package/.workbuddy-plugin/plugin.json +1 -1
- package/assets/build-meta.json +6 -6
- package/cordis.patch.yml +1 -1
- package/package.json +1 -1
- package/scripts/mcp-server.js +2 -1
- package/scripts/microi-cli.js +44 -49
- package/scripts/microi-codex-router.js +2 -1
- package/scripts/microi-skills.meta.json +238 -238
- package/skills/.microi-skills-version.json +2 -2
- package/skills/.progressive-disclosure-manifest.json +20 -20
- package/skills/ai-engine/agents/openai.yaml +4 -4
- package/skills/app-store/agents/openai.yaml +4 -4
- package/skills/datasource-engine/agents/openai.yaml +4 -4
- package/skills/job-engine/agents/openai.yaml +4 -4
- package/skills/message-notification/agents/openai.yaml +5 -5
- package/skills/microi-ai-app-auth.js +652 -652
- package/skills/microi-ai-application/agents/openai.yaml +4 -4
- package/skills/microi-codex-installer/SKILL.md +1 -1
- package/skills/microi-codex-installer/agents/openai.yaml +7 -7
- package/skills/microi-db-schema/agents/openai.yaml +4 -4
- package/skills/microi-docs-coverage/scripts/audit-doc-skill-coverage.mjs +894 -894
- package/skills/microi-solution-quotation/agents/openai.yaml +4 -4
- package/skills/microi-solution-quotation/scripts/build_solution_quote.py +296 -296
- package/skills/microi-system-delivery/SKILL.md +16 -4
- package/skills/microi-system-delivery/references/progressive-01-/346/240/207/345/207/206/345/267/245/344/275/234/346/265/201.md +39 -1
- package/skills/microi-system-delivery/references/progressive-02-/350/207/252/345/212/250/345/214/226/346/265/213/350/257/225/345/277/205/351/241/273/350/246/206/347/233/226/347/232/204/345/235/221.md +3 -3
- package/skills/microi.v8.js +1921 -1921
- package/skills/module-engine/SKILL.md +26 -0
- package/skills/ocr-engine/agents/openai.yaml +4 -4
- package/skills/page-engine/SKILL.md +21 -0
- package/skills/page-engine/examples/compact-dashboard.json +1444 -1444
- package/skills/playwright-e2e/references/progressive-03-microi-helper-/346/250/241/346/235/277.md +3 -3
- package/skills/report-engine/SKILL.md +12 -0
- package/skills/report-engine/agents/openai.yaml +4 -4
- package/skills/scripts/optimize-progressive-disclosure.mjs +204 -204
- package/skills/scripts/refresh-progressive-disclosure.mjs +64 -64
- package/skills/scripts/sync-embedded-skills.mjs +46 -46
- package/skills/scripts/validate-progressive-disclosure.mjs +57 -57
- package/skills/search-engine/agents/openai.yaml +4 -4
- package/skills/translate-engine/agents/openai.yaml +4 -4
- package/skills/ui-design/assets/pattern-showcase/app.js +54 -54
- package/skills/ui-design/assets/pattern-showcase/index.html +163 -163
- package/skills/ui-design/assets/pattern-showcase/styles.css +311 -311
- package/skills/unity-integration/agents/openai.yaml +4 -4
- package/skills/v8-image-processing/agents/openai.yaml +4 -4
- package/skills/v8-mq-mqtt/scripts/check-mqtt-skill-coverage.mjs +203 -203
- package/skills/v8-tcp-integration/agents/openai.yaml +4 -4
- package/skills/vision-engine/agents/openai.yaml +4 -4
- package/skills/workspace-conventions/SKILL.md +2 -2
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import crypto from 'node:crypto';
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { fileURLToPath } from 'node:url';
|
|
5
|
-
|
|
6
|
-
// 后端只持有自包含的知识快照;规则正文仍以 microi.skills 为唯一可编辑事实源。
|
|
7
|
-
const skillsRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
8
|
-
const serverRoot = path.resolve(skillsRoot, '../Microi.Server/Microi.AI');
|
|
9
|
-
const project = fs.readFileSync(path.join(serverRoot, 'Microi.AI.csproj'), 'utf8');
|
|
10
|
-
const manifest = JSON.parse(fs.readFileSync(path.join(skillsRoot, '.progressive-disclosure-manifest.json'), 'utf8'));
|
|
11
|
-
const check = process.argv.includes('--check');
|
|
12
|
-
const names = process.argv.slice(2).filter(value => value !== '--check');
|
|
13
|
-
if (!names.length) throw new Error('请显式指定本次需要同步的 Skill 名称。');
|
|
14
|
-
const stripMarkers = text => text.replace(/<!--\s*\/?microi-progressive:[^>]*-->\r?\n?/g, '');
|
|
15
|
-
const digest = text => crypto.createHash('sha256').update(text).digest('hex');
|
|
16
|
-
const results = [];
|
|
17
|
-
|
|
18
|
-
for (const name of names) {
|
|
19
|
-
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(name)) throw new Error(`无效 Skill 名称:${name}`);
|
|
20
|
-
const file = `skill-${name}.md`;
|
|
21
|
-
// 不擅自新增程序集资源;只有现有项目明确注册的知识快照可以由此脚本刷新。
|
|
22
|
-
if (!project.includes(`Resource\\${file}`)) throw new Error(`后端尚未注册 ${file},请先审阅资源归属。`);
|
|
23
|
-
let text = fs.readFileSync(path.join(skillsRoot, name, 'SKILL.md'), 'utf8');
|
|
24
|
-
const references = manifest.skills[name]?.references || [];
|
|
25
|
-
if (references.length) {
|
|
26
|
-
const route = text.indexOf('## 详细参考路由(渐进披露)');
|
|
27
|
-
const end = text.indexOf('<!-- microi-progressive:end -->', route);
|
|
28
|
-
if (route < 0 || end < route) throw new Error(`${name} 缺少受控参考路由,停止覆盖快照。`);
|
|
29
|
-
text = text.slice(0, route) + text.slice(end + '<!-- microi-progressive:end -->'.length);
|
|
30
|
-
for (const reference of references) {
|
|
31
|
-
const source = path.resolve(skillsRoot, name, reference.path);
|
|
32
|
-
const relative = path.relative(path.join(skillsRoot, name), source);
|
|
33
|
-
if (relative.startsWith('..') || path.isAbsolute(relative)) throw new Error('参考文件越过 Skill 目录。');
|
|
34
|
-
// 平台 AI 读取程序集时不能打开工作区相对路径,必须带上渐进参考的完整正文。
|
|
35
|
-
text += `\n\n${fs.readFileSync(source, 'utf8')}`;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
text = `${stripMarkers(text).replace(/\r\n/g, '\n').trimEnd()}\n`;
|
|
39
|
-
const target = path.join(serverRoot, 'Resource', file);
|
|
40
|
-
const before = fs.existsSync(target) ? fs.readFileSync(target, 'utf8') : '';
|
|
41
|
-
const changed = before.replace(/\r\n/g, '\n') !== text;
|
|
42
|
-
if (changed && !check) fs.writeFileSync(target, text, 'utf8');
|
|
43
|
-
results.push({ name, changed, sha256: digest(text) });
|
|
44
|
-
}
|
|
45
|
-
console.log(JSON.stringify({ check, results }, null, 2));
|
|
46
|
-
if (check && results.some(item => item.changed)) process.exitCode = 1;
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
|
|
6
|
+
// 后端只持有自包含的知识快照;规则正文仍以 microi.skills 为唯一可编辑事实源。
|
|
7
|
+
const skillsRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
8
|
+
const serverRoot = path.resolve(skillsRoot, '../Microi.Server/Microi.AI');
|
|
9
|
+
const project = fs.readFileSync(path.join(serverRoot, 'Microi.AI.csproj'), 'utf8');
|
|
10
|
+
const manifest = JSON.parse(fs.readFileSync(path.join(skillsRoot, '.progressive-disclosure-manifest.json'), 'utf8'));
|
|
11
|
+
const check = process.argv.includes('--check');
|
|
12
|
+
const names = process.argv.slice(2).filter(value => value !== '--check');
|
|
13
|
+
if (!names.length) throw new Error('请显式指定本次需要同步的 Skill 名称。');
|
|
14
|
+
const stripMarkers = text => text.replace(/<!--\s*\/?microi-progressive:[^>]*-->\r?\n?/g, '');
|
|
15
|
+
const digest = text => crypto.createHash('sha256').update(text).digest('hex');
|
|
16
|
+
const results = [];
|
|
17
|
+
|
|
18
|
+
for (const name of names) {
|
|
19
|
+
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(name)) throw new Error(`无效 Skill 名称:${name}`);
|
|
20
|
+
const file = `skill-${name}.md`;
|
|
21
|
+
// 不擅自新增程序集资源;只有现有项目明确注册的知识快照可以由此脚本刷新。
|
|
22
|
+
if (!project.includes(`Resource\\${file}`)) throw new Error(`后端尚未注册 ${file},请先审阅资源归属。`);
|
|
23
|
+
let text = fs.readFileSync(path.join(skillsRoot, name, 'SKILL.md'), 'utf8');
|
|
24
|
+
const references = manifest.skills[name]?.references || [];
|
|
25
|
+
if (references.length) {
|
|
26
|
+
const route = text.indexOf('## 详细参考路由(渐进披露)');
|
|
27
|
+
const end = text.indexOf('<!-- microi-progressive:end -->', route);
|
|
28
|
+
if (route < 0 || end < route) throw new Error(`${name} 缺少受控参考路由,停止覆盖快照。`);
|
|
29
|
+
text = text.slice(0, route) + text.slice(end + '<!-- microi-progressive:end -->'.length);
|
|
30
|
+
for (const reference of references) {
|
|
31
|
+
const source = path.resolve(skillsRoot, name, reference.path);
|
|
32
|
+
const relative = path.relative(path.join(skillsRoot, name), source);
|
|
33
|
+
if (relative.startsWith('..') || path.isAbsolute(relative)) throw new Error('参考文件越过 Skill 目录。');
|
|
34
|
+
// 平台 AI 读取程序集时不能打开工作区相对路径,必须带上渐进参考的完整正文。
|
|
35
|
+
text += `\n\n${fs.readFileSync(source, 'utf8')}`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
text = `${stripMarkers(text).replace(/\r\n/g, '\n').trimEnd()}\n`;
|
|
39
|
+
const target = path.join(serverRoot, 'Resource', file);
|
|
40
|
+
const before = fs.existsSync(target) ? fs.readFileSync(target, 'utf8') : '';
|
|
41
|
+
const changed = before.replace(/\r\n/g, '\n') !== text;
|
|
42
|
+
if (changed && !check) fs.writeFileSync(target, text, 'utf8');
|
|
43
|
+
results.push({ name, changed, sha256: digest(text) });
|
|
44
|
+
}
|
|
45
|
+
console.log(JSON.stringify({ check, results }, null, 2));
|
|
46
|
+
if (check && results.some(item => item.changed)) process.exitCode = 1;
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import crypto from 'node:crypto'
|
|
2
|
-
import fs from 'node:fs'
|
|
3
|
-
import path from 'node:path'
|
|
4
|
-
import { fileURLToPath } from 'node:url'
|
|
5
|
-
|
|
6
|
-
const skillsRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
|
7
|
-
const manifest = JSON.parse(fs.readFileSync(path.join(skillsRoot, '.progressive-disclosure-manifest.json'), 'utf8'))
|
|
8
|
-
const hash = (value) => crypto.createHash('sha256').update(value).digest('hex')
|
|
9
|
-
const lineCount = (value) => value.length === 0 ? 0 : value.split(/\r?\n/).length
|
|
10
|
-
|
|
11
|
-
// 可只验证显式修改的 Skill;默认仍检查全库,不能为并行工作区的历史漂移改写共同基线。
|
|
12
|
-
const requested = process.argv.slice(2)
|
|
13
|
-
for (const name of requested) {
|
|
14
|
-
if (!Object.hasOwn(manifest.skills, name)) throw new Error(`Unknown progressive-disclosure skill: ${name}`)
|
|
15
|
-
}
|
|
16
|
-
const selected = Object.entries(manifest.skills).filter(([name]) => requested.length === 0 || requested.includes(name))
|
|
17
|
-
let checkedChunks = 0
|
|
18
|
-
for (const [skillName, skill] of selected) {
|
|
19
|
-
const entryPath = path.join(skillsRoot, skillName, 'SKILL.md')
|
|
20
|
-
const entry = fs.readFileSync(entryPath, 'utf8')
|
|
21
|
-
const begin = entry.indexOf('<!-- microi-progressive:begin -->')
|
|
22
|
-
if (begin < 0) throw new Error(`${skillName}: missing progressive begin marker`)
|
|
23
|
-
const prefix = entry.slice(0, begin)
|
|
24
|
-
if (hash(prefix) !== skill.prefixSha256) throw new Error(`${skillName}: entry prefix changed`)
|
|
25
|
-
if (lineCount(entry) > manifest.policy.maxEntryLines) throw new Error(`${skillName}: entry exceeds line budget`)
|
|
26
|
-
|
|
27
|
-
const sources = new Map([[`${skillName}/SKILL.md`, entry]])
|
|
28
|
-
for (const reference of skill.references) {
|
|
29
|
-
const relative = `${skillName}/${reference.path}`
|
|
30
|
-
const content = fs.readFileSync(path.join(skillsRoot, relative), 'utf8')
|
|
31
|
-
if (lineCount(content) > 300) throw new Error(`${relative}: reference exceeds 300 lines`)
|
|
32
|
-
sources.set(relative, content)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const ordered = []
|
|
36
|
-
for (const chunk of skill.chunks) {
|
|
37
|
-
const source = sources.get(chunk.destination)
|
|
38
|
-
if (source == null) throw new Error(`${skillName}: missing ${chunk.destination}`)
|
|
39
|
-
const open = `<!-- microi-progressive:chunk id=${chunk.id} sha256=${chunk.sha256} -->`
|
|
40
|
-
const startMarker = source.indexOf(open)
|
|
41
|
-
if (startMarker < 0) throw new Error(`${skillName}: missing chunk ${chunk.id}`)
|
|
42
|
-
const contentStart = startMarker + open.length + (source.startsWith('\r\n', startMarker + open.length) ? 2 : 1)
|
|
43
|
-
const close = '<!-- /microi-progressive:chunk -->'
|
|
44
|
-
const contentEnd = source.indexOf(close, contentStart)
|
|
45
|
-
if (contentEnd < 0) throw new Error(`${skillName}: unterminated chunk ${chunk.id}`)
|
|
46
|
-
const raw = source.slice(contentStart, contentEnd)
|
|
47
|
-
if (hash(raw) !== chunk.sha256) throw new Error(`${skillName}: chunk ${chunk.id} changed`)
|
|
48
|
-
ordered[chunk.ordinal] = raw
|
|
49
|
-
checkedChunks += 1
|
|
50
|
-
}
|
|
51
|
-
const reconstructed = prefix + ordered.join('')
|
|
52
|
-
if (hash(reconstructed) !== skill.originalSha256) {
|
|
53
|
-
throw new Error(`${skillName}: reconstructed knowledge differs from original`)
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
console.log(`Validated ${selected.length} skills and ${checkedChunks} lossless chunks${requested.length ? ' (explicit scope)' : ''}.`)
|
|
1
|
+
import crypto from 'node:crypto'
|
|
2
|
+
import fs from 'node:fs'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
import { fileURLToPath } from 'node:url'
|
|
5
|
+
|
|
6
|
+
const skillsRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
|
7
|
+
const manifest = JSON.parse(fs.readFileSync(path.join(skillsRoot, '.progressive-disclosure-manifest.json'), 'utf8'))
|
|
8
|
+
const hash = (value) => crypto.createHash('sha256').update(value).digest('hex')
|
|
9
|
+
const lineCount = (value) => value.length === 0 ? 0 : value.split(/\r?\n/).length
|
|
10
|
+
|
|
11
|
+
// 可只验证显式修改的 Skill;默认仍检查全库,不能为并行工作区的历史漂移改写共同基线。
|
|
12
|
+
const requested = process.argv.slice(2)
|
|
13
|
+
for (const name of requested) {
|
|
14
|
+
if (!Object.hasOwn(manifest.skills, name)) throw new Error(`Unknown progressive-disclosure skill: ${name}`)
|
|
15
|
+
}
|
|
16
|
+
const selected = Object.entries(manifest.skills).filter(([name]) => requested.length === 0 || requested.includes(name))
|
|
17
|
+
let checkedChunks = 0
|
|
18
|
+
for (const [skillName, skill] of selected) {
|
|
19
|
+
const entryPath = path.join(skillsRoot, skillName, 'SKILL.md')
|
|
20
|
+
const entry = fs.readFileSync(entryPath, 'utf8')
|
|
21
|
+
const begin = entry.indexOf('<!-- microi-progressive:begin -->')
|
|
22
|
+
if (begin < 0) throw new Error(`${skillName}: missing progressive begin marker`)
|
|
23
|
+
const prefix = entry.slice(0, begin)
|
|
24
|
+
if (hash(prefix) !== skill.prefixSha256) throw new Error(`${skillName}: entry prefix changed`)
|
|
25
|
+
if (lineCount(entry) > manifest.policy.maxEntryLines) throw new Error(`${skillName}: entry exceeds line budget`)
|
|
26
|
+
|
|
27
|
+
const sources = new Map([[`${skillName}/SKILL.md`, entry]])
|
|
28
|
+
for (const reference of skill.references) {
|
|
29
|
+
const relative = `${skillName}/${reference.path}`
|
|
30
|
+
const content = fs.readFileSync(path.join(skillsRoot, relative), 'utf8')
|
|
31
|
+
if (lineCount(content) > 300) throw new Error(`${relative}: reference exceeds 300 lines`)
|
|
32
|
+
sources.set(relative, content)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const ordered = []
|
|
36
|
+
for (const chunk of skill.chunks) {
|
|
37
|
+
const source = sources.get(chunk.destination)
|
|
38
|
+
if (source == null) throw new Error(`${skillName}: missing ${chunk.destination}`)
|
|
39
|
+
const open = `<!-- microi-progressive:chunk id=${chunk.id} sha256=${chunk.sha256} -->`
|
|
40
|
+
const startMarker = source.indexOf(open)
|
|
41
|
+
if (startMarker < 0) throw new Error(`${skillName}: missing chunk ${chunk.id}`)
|
|
42
|
+
const contentStart = startMarker + open.length + (source.startsWith('\r\n', startMarker + open.length) ? 2 : 1)
|
|
43
|
+
const close = '<!-- /microi-progressive:chunk -->'
|
|
44
|
+
const contentEnd = source.indexOf(close, contentStart)
|
|
45
|
+
if (contentEnd < 0) throw new Error(`${skillName}: unterminated chunk ${chunk.id}`)
|
|
46
|
+
const raw = source.slice(contentStart, contentEnd)
|
|
47
|
+
if (hash(raw) !== chunk.sha256) throw new Error(`${skillName}: chunk ${chunk.id} changed`)
|
|
48
|
+
ordered[chunk.ordinal] = raw
|
|
49
|
+
checkedChunks += 1
|
|
50
|
+
}
|
|
51
|
+
const reconstructed = prefix + ordered.join('')
|
|
52
|
+
if (hash(reconstructed) !== skill.originalSha256) {
|
|
53
|
+
throw new Error(`${skillName}: reconstructed knowledge differs from original`)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
console.log(`Validated ${selected.length} skills and ${checkedChunks} lossless chunks${requested.length ? ' (explicit scope)' : ''}.`)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface:
|
|
2
|
-
display_name: "搜索引擎"
|
|
3
|
-
short_description: "配置租户隔离的索引、同步、查询、重建、权限过滤和故障恢复"
|
|
4
|
-
default_prompt: "使用 $search-engine 设计并验收当前 Microi 搜索能力。"
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "搜索引擎"
|
|
3
|
+
short_description: "配置租户隔离的索引、同步、查询、重建、权限过滤和故障恢复"
|
|
4
|
+
default_prompt: "使用 $search-engine 设计并验收当前 Microi 搜索能力。"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface:
|
|
2
|
-
display_name: "翻译引擎"
|
|
3
|
-
short_description: "管理多语言词条、租户翻译配置、缓存、批量翻译与隐私验收"
|
|
4
|
-
default_prompt: "使用 $translate-engine 设计并验收当前 Microi 翻译能力。"
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "翻译引擎"
|
|
3
|
+
short_description: "管理多语言词条、租户翻译配置、缓存、批量翻译与隐私验收"
|
|
4
|
+
default_prompt: "使用 $translate-engine 设计并验收当前 Microi 翻译能力。"
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
(function () {
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
var root = document.documentElement;
|
|
5
|
-
var themeToggle = document.getElementById('themeToggle');
|
|
6
|
-
var filterButtons = Array.prototype.slice.call(document.querySelectorAll('[data-filter]'));
|
|
7
|
-
var cards = Array.prototype.slice.call(document.querySelectorAll('[data-kind]'));
|
|
8
|
-
var form = document.getElementById('flowForm');
|
|
9
|
-
var nameInput = document.getElementById('workspaceName');
|
|
10
|
-
var status = document.getElementById('formStatus');
|
|
11
|
-
var submit = document.getElementById('flowSubmit');
|
|
12
|
-
|
|
13
|
-
themeToggle.addEventListener('click', function () {
|
|
14
|
-
var nextTheme = root.dataset.mciTheme === 'dark' ? 'light' : 'dark';
|
|
15
|
-
root.dataset.mciTheme = nextTheme;
|
|
16
|
-
themeToggle.setAttribute('aria-pressed', nextTheme === 'light' ? 'true' : 'false');
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
filterButtons.forEach(function (button) {
|
|
20
|
-
button.addEventListener('click', function () {
|
|
21
|
-
var filter = button.dataset.filter;
|
|
22
|
-
filterButtons.forEach(function (item) { item.classList.toggle('is-active', item === button); });
|
|
23
|
-
cards.forEach(function (card) {
|
|
24
|
-
var visible = filter === 'all' || card.dataset.kind === filter;
|
|
25
|
-
card.classList.toggle('is-hidden', !visible);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
form.addEventListener('submit', function (event) {
|
|
31
|
-
event.preventDefault();
|
|
32
|
-
var value = nameInput.value.trim();
|
|
33
|
-
status.className = 'mci-flow-card__status';
|
|
34
|
-
if (value.length < 2 || value.length > 24) {
|
|
35
|
-
status.textContent = '请输入 2—24 个字符的空间名称。';
|
|
36
|
-
status.classList.add('is-error');
|
|
37
|
-
nameInput.focus();
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
submit.disabled = true;
|
|
42
|
-
submit.classList.add('is-loading');
|
|
43
|
-
submit.querySelector('span').textContent = '正在创建';
|
|
44
|
-
status.textContent = '正在校验空间配置,请稍候…';
|
|
45
|
-
|
|
46
|
-
window.setTimeout(function () {
|
|
47
|
-
submit.disabled = false;
|
|
48
|
-
submit.classList.remove('is-loading');
|
|
49
|
-
submit.querySelector('span').textContent = '重新演示';
|
|
50
|
-
status.textContent = '“' + value + '”已准备好,可以继续邀请成员。';
|
|
51
|
-
status.classList.add('is-success');
|
|
52
|
-
}, 760);
|
|
53
|
-
});
|
|
54
|
-
}());
|
|
1
|
+
(function () {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var root = document.documentElement;
|
|
5
|
+
var themeToggle = document.getElementById('themeToggle');
|
|
6
|
+
var filterButtons = Array.prototype.slice.call(document.querySelectorAll('[data-filter]'));
|
|
7
|
+
var cards = Array.prototype.slice.call(document.querySelectorAll('[data-kind]'));
|
|
8
|
+
var form = document.getElementById('flowForm');
|
|
9
|
+
var nameInput = document.getElementById('workspaceName');
|
|
10
|
+
var status = document.getElementById('formStatus');
|
|
11
|
+
var submit = document.getElementById('flowSubmit');
|
|
12
|
+
|
|
13
|
+
themeToggle.addEventListener('click', function () {
|
|
14
|
+
var nextTheme = root.dataset.mciTheme === 'dark' ? 'light' : 'dark';
|
|
15
|
+
root.dataset.mciTheme = nextTheme;
|
|
16
|
+
themeToggle.setAttribute('aria-pressed', nextTheme === 'light' ? 'true' : 'false');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
filterButtons.forEach(function (button) {
|
|
20
|
+
button.addEventListener('click', function () {
|
|
21
|
+
var filter = button.dataset.filter;
|
|
22
|
+
filterButtons.forEach(function (item) { item.classList.toggle('is-active', item === button); });
|
|
23
|
+
cards.forEach(function (card) {
|
|
24
|
+
var visible = filter === 'all' || card.dataset.kind === filter;
|
|
25
|
+
card.classList.toggle('is-hidden', !visible);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
form.addEventListener('submit', function (event) {
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
var value = nameInput.value.trim();
|
|
33
|
+
status.className = 'mci-flow-card__status';
|
|
34
|
+
if (value.length < 2 || value.length > 24) {
|
|
35
|
+
status.textContent = '请输入 2—24 个字符的空间名称。';
|
|
36
|
+
status.classList.add('is-error');
|
|
37
|
+
nameInput.focus();
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
submit.disabled = true;
|
|
42
|
+
submit.classList.add('is-loading');
|
|
43
|
+
submit.querySelector('span').textContent = '正在创建';
|
|
44
|
+
status.textContent = '正在校验空间配置,请稍候…';
|
|
45
|
+
|
|
46
|
+
window.setTimeout(function () {
|
|
47
|
+
submit.disabled = false;
|
|
48
|
+
submit.classList.remove('is-loading');
|
|
49
|
+
submit.querySelector('span').textContent = '重新演示';
|
|
50
|
+
status.textContent = '“' + value + '”已准备好,可以继续邀请成员。';
|
|
51
|
+
status.classList.add('is-success');
|
|
52
|
+
}, 760);
|
|
53
|
+
});
|
|
54
|
+
}());
|