yzsp-studio/mediakit-shared-suite / ppt
ppt
Unverified飞书幻灯片:创建和编辑幻灯片。创建演示文稿、读取幻灯片内容、管理幻灯片页面(创建、删除、读取、局部替换)。当用户需要创建或编辑幻灯片、读取或修改单个页面时使用。
scripts/svg_relation_lib/attributes/status.py
View on GitHub"""
A7 · Status attribute · discrete state (RAG semantic)
字段:status ∈ {up/down/stable, healthy/warning/critical, pass/fail/wait}
v1 aliases: trend, healthy, tone
默认视觉通道:color_rag (red / amber / green)
备用通道:icon
"""
from __future__ import annotations
from dataclasses import dataclass
from typing import Optional, Tuple
_RAG_COLORS = {
"green": "#16a34a",
"amber": "#f59e0b",
"red": "#dc2626",
}
_ICON_MAP = {
"green": "check",
"amber": "warning",
"red": "cross",
}
def _normalize_status(v) -> Optional[str]:
"""把各种 status 字符串归一到 red / amber / green。"""
s = str(v).strip().lower()
green_set = {"up", "healthy", "pass", "ok", "success", "good", "green", "positive"}
amber_set = {"stable", "warning", "warn", "wait", "pending", "neutral", "amber", "yellow", "hold"}
red_set = {"down", "critical", "fail", "failed", "error", "bad", "red", "negative", "danger"}
if s in green_set:
return "green"
if s in amber_set:
return "amber"
if s in red_set:
return "red"
if s in _RAG_COLORS:
return s
return None
@dataclass
class Status:
"""Status attribute · 离散状态 (RAG)。"""
field_name: str = "status"
v1_aliases: Tuple[str, ...] = ("trend", "healthy", "tone", "state")
channel: str = "color_rag"
fallback_channel: str = "icon"
def resolve_value(self, element: dict) -> Optional[str]:
for name in (self.field_name,) + tuple(self.v1_aliases):
if name in element and element[name] is not None:
normalized = _normalize_status(element[name])
if normalized is not None:
return normalized
return None
def encode(self, value: str, channel: str, palette=None) -> dict:
rag = value if value in _RAG_COLORS else "amber"
if channel == "color_rag":
color = _RAG_COLORS[rag]
return {"fill": color, "stroke": color}
if channel == "icon":
return {"icon": _ICON_MAP.get(rag, "circle")}
return {}
DEFAULT_STATUS = Status()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |