Skip to content

majiayu000/spellbook / skills/form-motion

form-motion

Verified

FORM UI 动效词典:10 个克制、跟手、可访问的界面微交互,每个都配原始提示词、可改项、验收标准和自动验收脚本——连续形变按钮、液体标签指示器、弹性滑块、柔性开关、原位展开卡片、层叠通知、命令面板、拖动排序、跟随提示、自绘折线图。共用一个从当前位置和速度重定向的阻尼弹簧。当用户说「按钮自己变成加载和完成」「选中条像软糖追过去」「拖到头还能拽一点」「开关圆点拉长」「卡片原位展开」「通知层叠」「Cmd+K 命令面板」「拖动排序」「提示跟随鼠标」「折线自己画出来」,或点名 FORM 动效库、要把某个样例用到自己的页面时使用。只在明确请求时触发,忽略顺带提及。

FileKindSize
SKILL.mdskill md9.3 KB
assets/motion.jsscript3.1 KB
assets/reference.htmlother96.6 KB
assets/skins/hud.cssother4.2 KB
references/catalog.jsonconfig14.6 KB
references/samples.mdmarkdown18.7 KB
scripts/build_samples_md.pyscript5.2 KB
scripts/lib/env.mjsscript3.5 KB
scripts/package.jsonmanifest285 B
scripts/verify.mjsscript35.2 KB

scripts/lib/env.mjs

View on GitHub
// Find a Chromium and an ffmpeg that already exist on this machine, so the
// scripts run without `npx playwright install` or a PATH tweak.
import { existsSync, readdirSync } from 'node:fs';
import { join } from 'node:path';
import { homedir, platform } from 'node:os';
import { execFileSync } from 'node:child_process';
import { createRequire } from 'node:module';

const require = createRequire(import.meta.url);

function cacheDirs() {
  const h = homedir();
  return [
    process.env.PLAYWRIGHT_BROWSERS_PATH,
    platform() === 'darwin' && join(h, 'Library/Caches/ms-playwright'),
    platform() === 'linux' && join(h, '.cache/ms-playwright'),
    platform() === 'win32' && join(h, 'AppData/Local/ms-playwright'),
  ].filter(Boolean);
}

// Relative paths of the executable inside a ms-playwright browser folder.
const EXES = [
  'chrome-headless-shell-mac-arm64/chrome-headless-shell',
  'chrome-headless-shell-mac-x64/chrome-headless-shell',
  'chrome-headless-shell-linux64/chrome-headless-shell',
  'chrome-headless-shell-win64/chrome-headless-shell.exe',
  'chrome-mac-arm64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing',
  'chrome-mac-x64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing',
  'chrome-linux64/chrome',
  'chrome-mac/Chromium.app/Contents/MacOS/Chromium',
  'chrome-mac-arm64/Chromium.app/Contents/MacOS/Chromium',
  'chrome-linux/chrome',
  'chrome-win/chrome.exe',
];
const SYSTEM = [
  '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
  '/Applications/Chromium.app/Contents/MacOS/Chromium',
  '/usr/bin/chromium', '/usr/bin/chromium-browser', '/usr/bin/google-chrome',
];

export function findChromium() {
  if (process.env.CHROMIUM_PATH && existsSync(process.env.CHROMIUM_PATH)) return { path: process.env.CHROMIUM_PATH, from: 'CHROMIUM_PATH' };
  // What the installed playwright expects, if it is there.
  try {
    const p = require('playwright').chromium.executablePath();
    if (p && existsSync(p)) return { path: p, from: 'playwright default' };
  } catch {}
  // Newest cached build of any version: headless shell first, then full chromium.
  for (const dir of cacheDirs()) {
    if (!existsSync(dir)) continue;
    const names = readdirSync(dir).filter(n => /^chromium(_headless_shell)?-\d+$/.test(n))
      .sort((a, b) => (b.includes('headless') - a.includes('headless')) || (+b.split('-')[1] - +a.split('-')[1]));
    for (const n of names) for (const e of EXES) {
      const p = join(dir, n, e);
      if (existsSync(p)) return { path: p, from: `cache ${n}` };
    }
  }
  for (const p of SYSTEM) if (existsSync(p)) return { path: p, from: 'system browser' };
  return null;
}

export function findFfmpeg() {
  const cands = [process.env.FFMPEG_PATH, 'ffmpeg', '/opt/homebrew/bin/ffmpeg', '/usr/local/bin/ffmpeg', '/usr/bin/ffmpeg'].filter(Boolean);
  for (const c of cands) {
    try { execFileSync(c, ['-version'], { stdio: 'ignore' }); return { path: c, from: c === 'ffmpeg' ? 'PATH' : c }; } catch {}
  }
  // Playwright ships an ffmpeg for video recording, but without libx264, so it is only a last resort.
  return null;
}

export async function launch(opts = {}) {
  let chromium;
  try { ({ chromium } = require('playwright')); }
  catch { throw new Error('playwright is not installed: run `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm install` in ' + new URL("..", import.meta.url).pathname); }
  const c = findChromium();
  if (!c) throw new Error('no Chromium found: run `npx playwright install chromium-headless-shell` or set CHROMIUM_PATH');
  return chromium.launch({ executablePath: c.path, ...opts });
}
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall