Skip to content

chuspeeism/dashi-ppt-skill / skills/dashi-ppt

dashi-ppt

Flagged

制作 PPT、演示文稿、幻灯片、汇报材料时使用。Dashi PPT 基于预置视觉主题组合页面,生成可离线打开、可在浏览器编辑的 HTML 演示,支持导出 PPTX / PDF 文件。

FileKindSize
.gitignoreother173 B
README.mdmarkdown3.9 KB
SKILL.mdskill md25.4 KB
agents/openai.yamlconfig292 B
assets/skill/dashi-ppt-favicon.pngbinary2.0 KB
assets/skill/dashi-ppt-small.pngbinary895 B
assets/skill/dashi-ppt.pngbinary12.6 KB
assets/skill/theme-style-grid.pngbinary2.1 MB
project/.npmrcother40 B
project/assets/skill/dashi-ppt-favicon.pngbinary2.0 KB
project/assets/social-icons/bilibili.svgother7.9 KB
project/assets/social-icons/douyin.svgother4.7 KB
project/assets/social-icons/github.svgother1.3 KB
project/assets/social-icons/redbook.svgother3.5 KB
project/assets/template-swiss.htmlother465.5 KB
project/assets/ui-icons/sidebar.svgother1.3 KB
project/assets/unicorn/automations_remix_scene.jsonconfig42.9 KB
project/assets/unicorn/goey_balls_remix_scene.jsonconfig14.2 KB
project/assets/unicorn/media/blue_noise_med.pngbinary206.4 KB
project/assets/unicorn/media/font_atlas.pngbinary64.6 KB
project/assets/unicorn/moving_into_remix_scene.jsonconfig67.8 KB
project/assets/unicorn/tech_background_remix_scene.jsonconfig52.2 KB
project/distribution-source.jsonconfig517 B
project/i18n/zh-en.jsonconfig574.5 KB
project/layout-manifest.jsonconfig3.4 MB
project/npmrc.templateother40 B
project/package-lock.jsonmanifest21.8 KB
project/package.jsonmanifest1.2 KB
project/packages/html-deck-to-pptx/LICENSEother1.6 KB
project/packages/html-deck-to-pptx/README.mdmarkdown2.2 KB
project/packages/html-deck-to-pptx/index.mjsscript719 B
project/packages/html-deck-to-pptx/package.jsonmanifest840 B
project/packages/html-deck-to-pptx/src/editable.mjsscript143 B
project/packages/html-deck-to-pptx/src/screenshot.mjsscript147 B
project/scripts/chrome-path.mjsscript6.1 KB
project/scripts/command-paths.mjsscript334 B
project/scripts/ensure-registry.mjsscript2.1 KB
project/scripts/export-pptx.mjsscript6.4 KB
project/scripts/goal-scaffold.mjsscript31.3 KB
project/scripts/inspect-layout.mjsscript2.1 KB
project/scripts/layout-query.mjsscript3.4 KB
project/scripts/media-formats.mjsscript1.3 KB
project/scripts/openssl-path.mjsscript2.2 KB
project/scripts/persist-deck-state.mjsscript6.7 KB
project/scripts/preview-export-auth.mjsscript1.0 KB
project/scripts/preview-freshness.mjsscript6.2 KB
project/scripts/preview-path.mjsscript569 B
project/scripts/preview/ensure-tmpdir.mjsscript3.4 KB
project/scripts/preview/export-routes.mjsscript24.2 KB
project/scripts/preview/launch-export-browser.mjsscript2.5 KB
project/scripts/preview/mime.mjsscript671 B
project/scripts/preview/network.mjsscript799 B
project/scripts/preview/static-serve.mjsscript1.2 KB
project/scripts/preview/tls.mjsscript2.7 KB
project/scripts/render-goal-deck.jsxother2.5 KB
project/scripts/scrub-local-paths.mjsscript898 B
project/scripts/serve-preview-https.mjsscript10.7 KB
project/scripts/skill-workflow-utils.mjsscript1.4 KB
project/scripts/stage-media.mjsexecutablescript14.7 KB
project/scripts/start-preview-server.mjsscript16.1 KB
project/scripts/validate-goal-copy.mjsscript25.4 KB
project/scripts/validate-goal-spec.mjsscript80.7 KB
project/scripts/validate-swiss-deck.mjsscript34.1 KB
project/scripts/workflow-telemetry.mjsscript6.1 KB
project/scripts/workflow/copy-contract.mjsscript19.2 KB
project/scripts/workflow/inspect-fillplan.mjsscript70.6 KB
project/scripts/workflow/layout-allocation.mjsscript8.5 KB
project/scripts/workflow/layout-query.mjsscript64.4 KB
project/scripts/workflow/media-slots.mjsscript15.8 KB
project/scripts/workflow/theme-registry.mjsscript16.1 KB
project/scripts/write-safe-props.mjsscript17.7 KB
project/src/accepted-themes.mjsscript570 B
project/src/components/bespoke/BespokeSlide.jsxother32.0 KB
project/src/components/bespoke/theme-profiles.mjsscript11.5 KB
project/src/components/index.jsxother71 B
project/src/components/shell/SlideShell.jsxother1.5 KB
project/src/components/shell/index.jsxother47 B
project/src/components/themes/canonical-metadata.mjsscript4.6 KB
project/src/components/themes/chart-safety.mjsscript1.9 KB
project/src/components/themes/client-runtime.jsxother57.9 KB
project/src/components/themes/decorative-overrides.mjsscript859 B
project/src/components/themes/generated-metadata.jsscript4.4 MB
project/src/components/themes/index.jsxother2.8 KB
project/src/components/themes/runtime-build.mjsscript7.3 KB
project/src/components/themes/runtime-helpers.jsxother6.2 KB
project/src/components/themes/theme-registry-codegen.mjsscript7.2 KB
project/src/components/themes/theme01/metadata.jsscript363.9 KB
project/src/components/themes/theme01/source/slides/theme.jsscript5.6 KB
project/src/components/themes/theme02/metadata.jsscript384.6 KB
project/src/components/themes/theme02/overrides.jsscript114 B
project/src/components/themes/theme02/source/src/gxnTheme.jsscript19.6 KB
project/src/components/themes/theme03/metadata.jsscript512.5 KB
project/src/components/themes/theme03/overrides.jsscript1.2 KB
project/src/components/themes/theme03/source/assets/3d/01.pngbinary635.1 KB
project/src/components/themes/theme03/source/assets/3d/02.pngbinary865.2 KB
project/src/components/themes/theme03/source/assets/3d/03.pngbinary921.8 KB
project/src/components/themes/theme03/source/assets/3d/04.pngbinary1.1 MB
project/src/components/themes/theme03/source/assets/3d/05.pngbinary920.3 KB
project/src/components/themes/theme03/source/assets/3d/06.pngbinary1.2 MB
project/src/components/themes/theme03/source/assets/3d/07.pngbinary1.6 MB
project/src/components/themes/theme03/source/assets/3d/08.pngbinary1.4 MB
project/src/components/themes/theme03/source/assets/3d/09.pngbinary1.9 MB
project/src/components/themes/theme03/source/assets/3d/10.pngbinary1.4 MB
project/src/components/themes/theme03/source/assets/3d/11.pngbinary1.6 MB
project/src/components/themes/theme03/source/assets/3d/12.pngbinary1.8 MB
project/src/components/themes/theme03/source/src/icons.jsscript799 B
project/src/components/themes/theme03/source/src/preset3d.jsscript119 B
project/src/components/themes/theme03/source/src/presetBase.jsscript3.4 KB
project/src/components/themes/theme03/source/src/registry.jsscript22.3 KB
project/src/components/themes/theme03/source/src/slides/safeProps.jsscript504 B
project/src/components/themes/theme03/source/src/theme.cssother5.4 KB
project/src/components/themes/theme03/source/src/theme.jsscript3.0 KB
project/src/components/themes/theme04/TEXT_CONTROL_POLICY.mdmarkdown344 B
project/src/components/themes/theme04/metadata.jsscript324.4 KB
project/src/components/themes/theme04/overrides.jsscript118 B
project/src/components/themes/theme04/source/image-slot.jsscript41.0 KB
project/src/components/themes/theme05/metadata.jsscript492.0 KB
project/src/components/themes/theme05/source/styles/exc-covers.cssother9.6 KB
project/src/components/themes/theme05/source/styles/pulse-deck.cssother288.9 KB
project/src/components/themes/theme06/metadata.jsscript331.7 KB
project/src/components/themes/theme07/metadata.jsscript319.6 KB
project/src/components/themes/theme07/source/src/theme.jsscript2.9 KB
project/src/components/themes/theme08/metadata.jsscript366.7 KB
project/src/components/themes/theme08/source/image-slot.jsscript45 B
project/src/components/themes/theme09/metadata.jsscript378.4 KB
project/src/components/themes/theme10/metadata.jsscript294.2 KB
project/src/components/themes/theme11/metadata.jsscript399.9 KB
project/src/components/themes/theme12/metadata.jsscript311.7 KB
project/src/components/themes/theme12/source/src/index.jsscript23.1 KB
project/src/components/themes/theme12/source/src/swTheme.jsscript2.3 KB
project/src/components/themes/unicorn-background.jsxother2.0 KB
project/src/control-naming.mjsscript17.2 KB
project/src/deckComposer.jsxother18.8 KB
project/src/generated-metadata-writer.mjsscript722 B
project/src/i18n-core.mjsscript2.3 KB
project/src/i18n.mjsscript1.8 KB
project/src/metadata-serialize.mjsscript6.1 KB
project/src/options.jsxother1.5 KB
project/src/prop-contract-core.mjsscript70.1 KB
project/src/propContracts.jsxother658 B
project/src/react-shim.jsscript51 B
project/src/renderDeck.jsxother14.0 KB
project/src/runtime-assets.mjsscript1.7 KB
project/src/types.d.tsscript1.7 KB
project/src/variant-contract.mjsscript28.8 KB
project/src/variant-materializer.mjsscript9.0 KB
project/src/view-model/context.jsxother382 B
project/src/view-model/index.jsxother26.0 KB
project/src/view-model/schema-v2-canonical.mjsscript471 B
references/examples/annual-review.jsonconfig14.9 KB
references/examples/portfolio.jsonconfig13.1 KB
references/goal-spec.schema.jsonconfig9.9 KB
references/layout-roles.mdmarkdown1.7 KB
references/options.mdmarkdown7.5 KB
scripts/check_latest_version.mjsexecutablescript3.1 KB
scripts/render_goal_deck.ps1script4.5 KB
scripts/render_goal_deck.shexecutablescript2.3 KB

project/scripts/workflow/copy-contract.mjs

View on GitHub
// @ts-check
// copy 预算与角色词表域:文案密度/字符预算、文案根/路径展开、可填文案叶子判定。
import { getDecorativeKeys } from '../../src/components/themes/decorative-overrides.mjs';
import {
  FREE_TEXT_ARRAY_FIELD_PATHS,
  isMediaArrayKey,
  isNonContentContractValue,
  isPrunedContractOmit,
  isSerializedReactElementLike,
  pruneContractValue,
  reactElementText,
} from '../../src/prop-contract-core.mjs';
import {
  arrayFieldName,
  getLayoutRecord,
  isNumericPathSegment,
  isPlainObject,
  normalizeName,
} from './theme-registry.mjs';
import { getMediaSlots } from './media-slots.mjs';

export function getCopyBudgetsForLayout(layout) {
  const record = getLayoutRecord(layout);
  if (!record) return {};
  const mediaSlots = getMediaSlots(record);
  const decorativeKeys = getDecorativeKeys(record.page.key);
  const copyKeyRoots = getCopyKeyRoots(record.defaultProps, record.controls, mediaSlots, decorativeKeys);
  return getCopyBudgets(record.defaultProps, copyKeyRoots);
}

// 顶层文案根:对象 copy 仍是单根(copy),内部路径由 expandCopyKeys/collectCopyBudgets 递归。
export function getCopyKeyRoots(defaultProps, controls, mediaSlots, decorativeKeys = []) {
  const controlKeys = new Set(controls.map(control => control.key));
  const mediaFields = new Set(mediaSlots.map(slot => slot.field));
  const decorative = new Set(decorativeKeys);
  return Object.entries(defaultProps || {})
    .filter(([key, value]) => {
      if ((controlKeys.has(key) && key !== 'copy') || decorative.has(key)) return false;
      // 媒体数组根:项内带 CJK 文本字段(照片图注/贴纸,如 theme08 photos[].caption)时保留为文案根,
      // 媒体源字段(src/url)由字段级黑名单剪除;纯媒体数组照旧排除。
      if (mediaFields.has(key) || isMediaArrayKey(key)) {
        const rows = Array.isArray(value) ? value.filter(item => item && typeof item === 'object' && !Array.isArray(item)) : [];
        const carriesCopy = rows.some(row => Object.entries(row).some(([f, v]) =>
          typeof v === 'string' && /[一-龥]/.test(v) && !/^(src|url|image|img|poster|video|href)$/i.test(f)));
        if (!carriesCopy) return false;
      }
      const pruned = pruneContractValue(value, key);
      return !isPrunedContractOmit(pruned) && pruned !== null && isCopyValue(pruned) && hasFillableCopyLeaf(pruned, key);
    })
    .map(([key]) => key);
}

// JAD-212:把文案根扁平化为可填路径。对象 copy 展开成 copy.eyebrow / copy.points[].t,
// 顶层数组展开成 items[].label,与扁平主题(theme01)形态一致。
export function expandCopyKeys(defaultProps, copyKeyRoots) {
  const keys = [];
  for (const root of copyKeyRoots) collectCopyPaths(defaultProps?.[root], root, keys);
  return [...new Set(keys)];
}

function collectCopyPaths(value, pathName, out) {
  value = pruneContractValue(value, pathName);
  if (isPrunedContractOmit(value)) return;
  if (typeof value === 'string' || typeof value === 'number' || isSerializedReactElementLike(value)) {
    if (isFillableCopyLeaf(pathName, value)) out.push(pathName);
    return;
  }
  if (Array.isArray(value)) {
    if (isCopyTupleArray(value)) {
      // 元组数组整体作为一个可填路径(specs[][]);写回时保持 [[...], ...] 形状。
      if (tupleLooksLikeCopy(value)
        && value.flat().some(x => (typeof x === 'string' || typeof x === 'number') && isFillableCopyLeaf(`${pathName}[][]`, x))) {
        out.push(`${pathName}[][]`);
      }
      return;
    }
    if (isCopySegmentRowsArray(value)) {
      // 富文本分段行数组(如 theme01 lines:[[{t,mark?},...],...])——按行展开成
      // `<key>[][].<field>`;mark 等样式标签不是文案,保持只读(不进 out),只收字符串叶子(t)。
      const tokens = value.filter(Array.isArray).flat().filter(isPlainObject);
      const merged = {};
      for (const tok of tokens) {
        for (const [key, item] of Object.entries(tok)) {
          if (!(key in merged) || merged[key] == null) merged[key] = item;
        }
      }
      for (const [key, item] of Object.entries(merged)) {
        if (key === 'mark' || typeof item !== 'string') continue;
        collectCopyPaths(item, `${pathName}[][].${key}`, out);
      }
      return;
    }
    const objects = value.filter(isPlainObject);
    if (objects.length) {
      // 并集全部对象项(样本取首个非 null):首项为 null 的字段(如漏斗首段 conv)也能进 copyKeys
      const merged = {};
      for (const obj of objects) {
        for (const [key, item] of Object.entries(obj)) {
          if (!(key in merged) || merged[key] == null) merged[key] = item;
        }
      }
      for (const [key, item] of Object.entries(merged)) collectCopyPaths(item, `${pathName}[].${key}`, out);
      return;
    }
    if (value.some(item => (typeof item === 'string' || typeof item === 'number') && isFillableCopyLeaf(`${pathName}[]`, item))) out.push(`${pathName}[]`);
    return;
  }
  if (!isPlainObject(value)) return;
  for (const [key, item] of Object.entries(value)) collectCopyPaths(item, `${pathName}.${key}`, out);
}

export function isColorString(value) {
  if (typeof value !== 'string') return false;
  const text = value.trim();
  return /^#[0-9a-fA-F]{3,8}$/.test(text)
    || /^(rgb|rgba|hsl|hsla)\(/i.test(text)
    || /^(linear|radial|conic)-gradient\(/i.test(text);
}

export function isColorArray(value) {
  return Array.isArray(value) && value.length > 0 && value.every(isColorString);
}

function isVisualConfigValue(pathName, value) {
  if (isVisualConfigLeaf(pathName, value)) return true;
  if (Array.isArray(value)) return isVisualConfigArray(pathName, value);
  if (!isPlainObject(value)) return false;
  const entries = Object.entries(value || {});
  const numericGroups = entries.filter(([key]) => isNumericPathSegment(key));
  return numericGroups.length > 0
    && numericGroups.length === entries.length
    && numericGroups.every(([key, item]) => isVisualConfigValue(`${pathName}.${key}`, item));
}

function isVisualConfigArray(pathName, value) {
  if (!Array.isArray(value) || !value.length) return false;
  if (isColorArray(value)) return true;
  const field = arrayFieldName(pathName);
  if (value.every(item => typeof item === 'number' && Number.isFinite(item))) return isVisualArrayField(field);
  const objects = value.filter(isPlainObject);
  if (!objects.length || objects.length !== value.filter(item => item != null).length) return false;
  const scalarFields = objects.flatMap(item => scalarObjectEntries(item).map(([key, itemValue]) => [key, itemValue]));
  if (!scalarFields.some(([key, itemValue]) => isVisualConfigLeaf(key, itemValue))) return false;
  return scalarFields.every(([key, itemValue]) => (
    isVisualConfigLeaf(key, itemValue) || isVisualDecorationLabelField(pathFieldName(key))
  ));
}

function scalarObjectEntries(value, prefix = '') {
  if (!isPlainObject(value)) return [];
  const rows = [];
  for (const [key, item] of Object.entries(value)) {
    const pathName = prefix ? `${prefix}.${key}` : key;
    if (Array.isArray(item)) continue;
    if (isPlainObject(item)) {
      rows.push(...scalarObjectEntries(item, pathName));
      continue;
    }
    rows.push([pathName, item]);
  }
  return rows;
}

function isVisualConfigLeaf(pathName, value) {
  const field = pathFieldName(pathName);
  if (isColorString(value)) return true;
  if (typeof value === 'number' && Number.isFinite(value)) return isVisualNumericField(field);
  if (typeof value === 'string' && isVisualStyleField(field) && (isTokenLike(value) || isCssVarLike(value))) return true;
  return false;
}

function isVisualNumericField(field) {
  return /^(x|y|l|t|r|w|h|cx|cy|dx|dy|box|width|height|left|top|right|bottom|ratio|rotate|rotation|angle|tilt|scale|sr|opacity|radius|z|zindex)$/i.test(String(field || ''));
}

function isVisualArrayField(field) {
  return /^(tilts?|rotations?|angles?|offsets?|positions?|coords?|coordinates?)$/i.test(String(field || ''));
}

function isVisualStyleField(field) {
  return /^(c|color|colour|accent|fill|stroke|background|bg|tint|hex|tone|subcolor)$/i.test(String(field || ''));
}

function isVisualDecorationLabelField(field) {
  return /^(ph|placeholder|label|sub|caption|cap)$/i.test(String(field || ''));
}

function isCssVarLike(value) {
  return /^var\(--[A-Za-z0-9_-]+\)$/.test(String(value || '').trim());
}

// 文案槽角色:eyebrow(短标签)/ title(标题)/ paragraph(段落)/ metric(数字)/ serial(序号)。
export function copyRoleForField(pathName) {
  return {
    metric: 'metric',
    serial: 'serial',
    tagline: 'eyebrow',
    display: 'title',
    brief: 'paragraph',
    body: 'paragraph',
    compact: 'eyebrow',
  }[inferCopyDensity(pathName)] || 'eyebrow';
}

export function buildCopyRoles(copyKeys = []) {
  const roles = {};
  // 扁平 copyKeys 已含 copy.eyebrow / items[].label 形态;数组路径(以 [] 结尾)按字段角色判定,不当 eyebrow 标题。
  for (const key of copyKeys) roles[key] = copyRoleForField(key);
  return roles;
}

const METRIC_FIELD_RE = /^(value|val|amount|amt|funding|fund|funds|budget|spend|investment|capital|revenue|sales|cost|price|arr|mrr|gmv|share|pct|percent|percentage|ratio|rate|portion|weight|num|number|score|index|rank|total|metric)$/;

export function isMetricFieldName(field) {
  return METRIC_FIELD_RE.test(normalizeName(field));
}

export function getCopyBudgets(defaultProps, copyKeys) {
  const budgets = {};
  for (const key of copyKeys) {
    collectCopyBudgets(defaultProps?.[key], key, budgets);
  }
  return budgets;
}

function collectCopyBudgets(value, pathName, budgets) {
  value = pruneContractValue(value, pathName);
  if (isPrunedContractOmit(value)) return;
  if (typeof value === 'string' || typeof value === 'number') {
    if (isFillableCopyLeaf(pathName, value)) setCopyBudget(budgets, pathName, copyBudget(pathName, value));
    return;
  }
  if (isSerializedReactElementLike(value)) {
    if (isFillableCopyLeaf(pathName, value)) setCopyBudget(budgets, pathName, copyBudget(pathName, reactElementText(value)));
    return;
  }
  if (Array.isArray(value)) {
    if (isCopyTupleArray(value) && !tupleLooksLikeCopy(value)) return;
    value.slice(0, 4).forEach(item => collectCopyBudgets(item, `${pathName}[]`, budgets));
    return;
  }
  if (!isPlainObject(value)) return;
  for (const [key, item] of Object.entries(value)) {
    collectCopyBudgets(item, `${pathName}.${key}`, budgets);
  }
}

function setCopyBudget(budgets, key, budget) {
  if (!budget) return;
  const existing = budgets[key];
  if (!existing || budget.maxChars < existing.maxChars) budgets[key] = budget;
}

export function copyBudget(pathName, value) {
  const density = inferCopyDensity(pathName);
  const length = charLength(value);
  const floor = { body: 18, serial: 4, tagline: 8 }[density] ?? 6;
  const base = Math.max(length, floor);
  const maxChars = {
    // serial/序号槽:物理可容字符极少(如 80px mono 大序号),收紧到 6–8。
    serial: Math.min(8, Math.max(6, Math.ceil(base * 1.2))),
    metric: Math.max(8, Math.min(16, Math.ceil(base * 1.4))),
    // 刊头 mono 标语(panelEn 等):单行不换行,约束在 ~14。
    tagline: Math.min(14, Math.max(12, Math.ceil(base * 1.1))),
    display: Math.max(18, Math.min(36, Math.ceil(base * 1.8))),
    compact: Math.max(18, Math.min(42, Math.ceil(base * 1.8))),
    brief: Math.max(36, Math.min(80, Math.ceil(base * 1.6))),
    body: Math.max(36, Math.min(120, Math.ceil(base * 2.2))),
  }[density];
  return { density, maxChars };
}

export function inferCopyDensity(pathName) {
  const normalized = String(pathName || '').toLowerCase();
  const field = normalized.split('.').at(-1)?.replace(/\[\]/g, '') || normalized;
  const nested = normalized.includes('.') || normalized.includes('[]');
  // 序号 / 刊号槽:物理容量极小,先于 metric 命中,避免被当成普通数字放宽到 16。
  if (!nested && /^(panelindex|panelno|panelnum|vol|volume|issueno|serialno|partno)$/.test(field)) return 'serial';
  if (!nested && /^(panelen|panelsub|paneltag)$/.test(field)) return 'tagline';
  if (isMetricFieldName(field)) return 'metric';
  if (!nested && /^(title|titletop|titlebottom|headline|headlinehl|headlinetail|statement|quote|word|brand|kicker)$/.test(field)) return 'display';
  if (/^(lead|subtitle|sub|desc|description|summary|note|caption|detail|footnote|intro|insight|excerpt|takeaway|reason|conclusion)$/.test(field)) return 'brief';
  if (/^(body|copy|paragraph)$/.test(field)) return 'body';
  if (/^(title|headline|label|name|kicker|tag|chip|pill|category)$/.test(field)) return 'compact';
  return 'compact';
}

// 文案长度按「视觉宽度」折算:全角(CJK 及全角标点)记 1,半角记 0.5(issue #15)。
// 预算本质是布局的物理容宽,1 个中文字 ≈ 2 个拉丁字母宽;此前按码点计数,英文/混排
// 文案(如 "GPT · Gemini · Claude",21 码点但视觉仅 ≈11 个中文字宽)被误拦,而预算
// 常数是按中文字符标定的——视觉宽度口径下中文文案计数不变,预算常数无需调整。
export function charLength(value) {
  let width = 0;
  for (const ch of String(value ?? '')) {
    const code = ch.codePointAt(0);
    const fullWidth = (code >= 0x1100 && code <= 0x115f) // Hangul Jamo
      || (code >= 0x2e80 && code <= 0xa4cf)   // CJK 部首/汉字/假名/注音等
      || (code >= 0xac00 && code <= 0xd7a3)   // Hangul 音节
      || (code >= 0xf900 && code <= 0xfaff)   // CJK 兼容汉字
      || (code >= 0xfe30 && code <= 0xfe4f)   // CJK 兼容形式
      || (code >= 0xff00 && code <= 0xff60)   // 全角 ASCII/标点
      || (code >= 0xffe0 && code <= 0xffe6)   // 全角符号
      || (code >= 0x3000 && code <= 0x303e)   // CJK 标点(含全角空格、「」)
      || (code >= 0x20000 && code <= 0x3fffd); // CJK 扩展
    width += fullWidth ? 1 : 0.5;
  }
  return Math.ceil(width);
}

function hasFillableCopyLeaf(value, pathName) {
  value = pruneContractValue(value, pathName);
  if (isPrunedContractOmit(value)) return false;
  if (typeof value === 'string' || typeof value === 'number' || isSerializedReactElementLike(value)) {
    return isFillableCopyLeaf(pathName, value);
  }
  if (Array.isArray(value)) {
    if (isCopyTupleArray(value) && !tupleLooksLikeCopy(value)) return false;
    return value.some(item => hasFillableCopyLeaf(item, `${pathName}[]`));
  }
  if (!isPlainObject(value)) return false;
  return Object.entries(value).some(([key, item]) => hasFillableCopyLeaf(item, `${pathName}.${key}`));
}

export function isFillableCopyLeaf(pathName, value) {
  const field = pathFieldName(pathName);
  if (/axesData\[\]\.id$/i.test(String(pathName || '')) && typeof value === 'string') return true;
  if (isNonContentContractValue(pathName, value)) return false;
  if (isColorString(value) && (/^(c|color|colour|accent|fill|stroke|background|bg|tint|hex)$/i.test(field) || /colou?r$/i.test(field))) return false;
  if (/placeholder$/i.test(field)) return false; // 图片槽占位提示:固定文案,不暴露(用户输入会被填错位置)
  if (/^(id|key|type|kind|mode|variant|style|layout|align|side|position|fit|icon|href|url|src|className|\w*Class|state)$/i.test(field)) {
    // 字段名撞结构词但值是自然文案(CJK 或多词文本,且非路径/枚举 token)——按文案放行:
    // theme07 columns[].kind="看好方向"(可见大标题)、theme05 copy.src="EXPANDED SLIDE · P61"(可见字幕)
    // theme11 rows[].cells[].state="partial"/"full"/"missing" 是驱动图标的闭集枚举,非自由文案。
    const text = typeof value === 'string' ? value.trim() : '';
    const looksLikeCopy = /[一-龥]/.test(text) || (/\S\s+\S/.test(text) && !/^[a-z0-9_\-./:]+$/i.test(text));
    if (!looksLikeCopy) return false;
  }
  // 'q' is ambiguous by name alone: a structural quadrant/scorecard token elsewhere (locked, see
  // FREE_TEXT_ARRAY_FIELD_PATHS comment in prop-contract-core.mjs) vs. a rewritable quarter-tick
  // label / quote / FAQ question here. Registered array[].field paths opt out of the token-like
  // exclusion so props:safe / goal-scaffold / validate-goal-spec treat them as authorable copy.
  if (/^(theme|tone|q)$/i.test(field) && isTokenLike(value) && !FREE_TEXT_ARRAY_FIELD_PATHS.has(normalizeArrayPathIndex(pathName))) return false;
  return true;
}

// "colsData[3].q" -> "colsData[].q": collapse a concrete array index back to the "[]" wildcard
// form FREE_TEXT_ARRAY_FIELD_PATHS is keyed by (collectCopyPaths already emits "[]" for shape
// probing, but other isFillableCopyLeaf callers pass concrete per-item paths).
function normalizeArrayPathIndex(pathName) {
  return String(pathName || '').replace(/\[\d+\]/g, '[]');
}

export function pathFieldName(pathName) {
  return String(pathName || '').split('.').pop()?.replace(/\[\]$/, '') || '';
}

function isTokenLike(value) {
  if (typeof value !== 'string') return false;
  const text = value.trim();
  return /^[A-Za-z0-9_-]{1,24}$/.test(text);
}

// 元组数组([[label, value], ...]):行全为标量数组。theme07 封面 specs、theme01 榜单 rows 属此形。
export function isCopyTupleArray(value) {
  if (!Array.isArray(value) || !value.length) return false;
  const rows = value.filter(item => item != null);
  return rows.length > 0 && rows.every(item => Array.isArray(item)
    && item.every(x => x == null || ['string', 'number'].includes(typeof x)));
}

// 元组叶子须含自然文案(CJK 或多词文本)才算 copy,或行首(index 0)是品牌词
// (见 isBrandLikeToken,logo 墙客户名需可替换)——排除代码型元组
// (如 theme10 热力/拼布矩阵的资产代码、logo 墙的样式标记)。
function tupleLooksLikeCopy(value) {
  const rows = value.filter(row => row != null);
  if (rows.some(row => row.some(x => /[\u4e00-\u9fa5]/.test(String(x ?? '')) || /\S\s+\S/.test(String(x ?? ''))))) return true;
  return rows.some(row => isBrandLikeToken(row?.[0]));
}

// Brand-like token: ALL-CAPS word (DAZZ) or TitleCase word (Multiply), i.e. a
// logo-wall client-name shape, distinct from lowercase asset codes (cm/eq/reit)
// and bare style flags ('.'/'soft'); only index 0 is checked here, so an
// index-1-only style tag never triggers exposure by itself.
function isBrandLikeToken(value) {
  if (typeof value !== 'string') return false;
  const text = value.trim();
  return /^[A-Z][A-Z0-9]+$/.test(text) || /^[A-Z][a-z0-9]+$/.test(text);
}

// 富文本分段行数组([[{t,mark?},...], ...]):行是数组(不是元组标量、也不是顶层对象数组),
// 行内元素是 {t,...} 小对象——theme01 SlideTypeStatement `lines` 属此形。与 isCopyTupleArray
// (行内是标量)、顶层对象数组(下方 isCopyValue 的 value.every(isPlainObject) 那支)都不同,
// 需单列一支才能被 isCopyValue 认作 copy 根、被 collectCopyPaths 展开成 `<key>[][].t`。
function isCopySegmentRowsArray(value) {
  if (!Array.isArray(value) || !value.length) return false;
  const rows = value.filter(item => item != null);
  if (!rows.length || !rows.every(row => Array.isArray(row) && row.length && row.every(isPlainObject))) return false;
  return rows.some(row => row.some(tok => typeof tok.t === 'string' && /\S/.test(tok.t)));
}

function isCopyValue(value) {
  if (value == null) return false;
  if (['string', 'number'].includes(typeof value)) return true;
  if (Array.isArray(value)) {
    return value.length > 0 && (
      value.every(item => item == null || ['string', 'number'].includes(typeof item) || isPlainObject(item))
      || isCopyTupleArray(value)
      || isCopySegmentRowsArray(value)
    );
  }
  return isPlainObject(value);
}
canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall