跳到正文
FunCoding

air-conditioner-skin

Design and ship custom skins for the YunYouJun cloud air conditioner (云空调). Use when an AI coding agent is asked to re-skin, theme, or restyle the air conditioner — either lightly with CSS `--acw-*` variables and Shadow DOM `::part()` on `@yunlefun-home/air-conditioner-widget`, or deeply by building a brand-new shell on top of the headless `createAirConditionerHeadless` API from `@yunlefun-home/air-conditioner-core` (React, Vue, Svelte, Solid, vanilla). Keeps the real 16–31°C rules, per-mode temperature memory, mist, drip, swing, audio, and full accessibility intact.

Star
3,457
许可证
MIT
最近提交
2026年12月2日

skills/air-conditioner-skin/SKILL.md

在 GitHub 上查看

Air Conditioner Skin

Give the cloud air conditioner a new look without re-implementing how it works. Behavior lives in @yunlefun-home/air-conditioner-core; the skin is yours (or your AI's) to invent. This follows the Vercel AI SDK UI / Reka UI idea: logic sinks into a headless core, visuals stay free.

Install this skill:

npx skills add YunYouJun/air-conditioner

Live demo: https://docs.ac.yunyoujun.cn/guide/ai-skin (English: /en/guide/ai-skin).

Note: Shadow DOM ::part() hooks, locale, and createAirConditionerHeadless live on main (and ship in the next release after v0.4.4). If your project is pinned to 0.4.4 or earlier, build from main or upgrade once released.

Pick a tier

GoalTierWhat you touch
Recolor / reshape the ready-made widget, keep its layoutTier 1 · light re-skinCSS only: --acw-* variables + ::part() on <air-conditioner-widget>
Invent a completely different device (retro window AC, cyberpunk panel, pixel handheld…)Tier 2 · headlessYour own markup + createAirConditionerHeadless from core

Start with Tier 1 when the user only wants colors, radii, shadows, or fonts. Use Tier 2 when the silhouette, controls, or layout change.

Tier 1 · Light re-skin with ::part() and --acw-*

The widget renders into Shadow DOM, so internal class names are private. Style it only through these public hooks.

npm install @yunlefun-home/air-conditioner-widget
import { cdnAssets, mountAirConditioner } from '@yunlefun-home/air-conditioner-widget'

// Browser only, after the DOM is ready.
mountAirConditioner(document.querySelector('#ac')!, {
  ...cdnAssets,
  placement: 'inline', // 'inline' | 'top-left' | 'top-right'
  locale: 'en', // 'zh' (default) | 'en'
  enableAudio: false,
})
/* Cream skin: cream-white unit, caramel remote, soft rounded keys */
air-conditioner-widget {
  --acw-text-color: #3b2f22;
  --acw-border-color: #eadfcd;
  --acw-led-on: #f59e0b;
  --acw-wind-cold: #a5d8ff;
  --acw-wind-hot: #ffc9a3;
}

air-conditioner-widget::part(unit) {
  filter: sepia(0.18) saturate(1.1);
}

air-conditioner-widget::part(remote) {
  --acw-remote-key: #f6e7cf;
  --acw-remote-icon: #7c4a1e;
  --acw-remote-power: #c2410c;
  border-radius: 28px;
  background: #fff8ee;
}

air-conditioner-widget::part(lcd) {
  background: #efe3cf;
  color: #4a3420;
}

Custom properties set on a ::part() element override the defaults declared inside the shadow tree, so the remote's --acw-remote-* palette can be swapped from outside.

::part() reference

PartElement
rootWhole widget wrapper (data-status, data-mode live here)
unitIndoor unit (shell, louver, display, airflow)
displaySeven-segment temperature window on the unit
windAirflow lines below the unit
noteEnergy-saving paper note blown out of the vent
dockContainer for the remote toggle + remote
toggle"Open remote / Hide remote" button (floating placements)
remote-panelCollapsible panel around the remote
remoteThe remote control body
lcdSmall screen on the remote
energy-labelEnergy-efficiency sticker on the unit

--acw-* reference

VariableDefaultMeaning
--acw-text-color#141414 (#fafafa dark)Text and icon color
--acw-border-color#e0e0e0Shell outlines
--acw-display-color#ccccccUnlit display segments
--acw-led-on#38f709Power LED when on
--acw-wind-trackrgba(187,187,187,.28)Airflow track
--acw-wind-cold / --acw-wind-hot#8cc4f2 / #f6ad7bAirflow colors per mode
--acw-remote-key / --acw-remote-icon#f2f3f5 / #5f6368Remote keys (set on ::part(remote))
--acw-remote-power / --acw-remote-cold / --acw-remote-hot#e5484d / #1e88e5 / #fb8c00Remote accent keys (set on ::part(remote))
--acw-floating-z-index1000Stacking order for corner placements
--acw-motion-duration-* / --acw-motion-ease-*from core acMotionMotion tokens; collapse under reduced motion
--acw-mist0–1Cold-mist density (written by the widget from state)
--acw-drip-cyclee.g. 12000msCondensation drip interval (only when dripping)
--acw-wind-pace / --acw-wind-strengthper fan speedAirflow speed / opacity (written from state)

The last three are outputs derived from state: read them in your CSS, do not hard-code them.

Tier 2 · Headless core: build any shell

npm install @yunlefun-home/air-conditioner-core

createAirConditionerHeadless(options?) wraps the real store and returns commands plus prop getters. Spread the getters onto your own elements; every getter already knows the current state and locale.

import { createAirConditionerHeadless } from '@yunlefun-home/air-conditioner-core'

const ac = createAirConditionerHeadless({
  locale: 'en', // 'zh' | 'en' — screen-reader labels
  storage: null, // or a Storage-like object; defaults to localStorage in browsers
  initialState: { status: true, mode: 'cold', temperature: 26 },
})

ac.subscribe(() => render(ac.getState()))
ac.run('power') // 'power' | 'cold' | 'hot' | 'increase' | 'decrease' | 'swing' | 'sound' | 'fan'
MemberPurpose
getState() / subscribe(listener) / dispatch(action) / storeRaw store access; subscribe returns an unsubscribe function
run(command)Remote-control command; cold / hot power the unit on like a real remote
togglePower() setMode(mode, powerOn?) increase() decrease() cycleFan() toggleSwing() cycleSound() reset()Named shortcuts
getRootProps()data-status data-mode data-fan data-swing data-sound data-drip data-temperature + style with --acw-mist --acw-wind-pace --acw-wind-strength (--acw-drip-cycle when dripping)
getUnitProps()role="region" + aria-label summary + state data-*
getDisplayProps()role="img" + aria-label summary for your readout
getButtonProps(command)type="button", data-command, localized aria-label, aria-pressed (power / cold / hot / swing), aria-disabled at the temperature limits
bindTempButton(el, 'increase' | 'decrease')Press-and-hold repeat that accelerates and stops at the limit; handles keyboard clicks too. Returns cleanup
limits / localeActive temperature limits (default 16–31 °C, step 1) and label language

Pure helpers for server rendering or other stores: getAcDisplayText(state, locale), getAcRootAttrs(state), getAcUnitAttrs(state, locale), getAcDisplayAttrs(state, locale), getAcButtonAttrs(state, command, locale, limits).

Sound is optional and separate: createAcAudioController(elements, { soundMode, fanSpeed }) plays beeps and the fan loop; feed it the state's sound and fan. Asset URLs come from resolveAcAudioAssets(baseUrl).

React (useSyncExternalStore)

import type { CSSProperties } from 'react'
import { createAirConditionerHeadless } from '@yunlefun-home/air-conditioner-core'
import { useEffect, useRef, useState, useSyncExternalStore } from 'react'

export function CyberAc() {
  const [ac] = useState(() => createAirConditionerHeadless({ locale: 'en', storage: null }))
  const state = useSyncExternalStore(ac.subscribe, ac.getState, ac.getState)
  const plus = useRef<HTMLButtonElement>(null)
  useEffect(() => ac.bindTempButton(plus.current!, 'increase'), [ac])

  const { style, ...root } = ac.getRootProps()
  return (
    <div className="cyber" {...root} style={style as CSSProperties}>
      <output {...ac.getDisplayProps()}>
        {state.temperature}
        °C
      </output>
      <button {...ac.getButtonProps('power')} onClick={() => ac.run('power')}>Power</button>
      <button ref={plus} {...ac.getButtonProps('increase')}>+</button>
    </div>
  )
}

state is a new object after every change, so the snapshot is stable for React.

Vue 3

In Vue, feed the reactive state into the pure helpers so every binding updates on its own:

<script setup lang="ts">
import type { Directive } from 'vue'
import {
  createAirConditionerHeadless,
  getAcButtonAttrs,
  getAcDisplayAttrs,
  getAcRootAttrs,
} from '@yunlefun-home/air-conditioner-core'
import { onBeforeUnmount, shallowRef } from 'vue'

const ac = createAirConditionerHeadless({ locale: 'zh', storage: null })
const state = shallowRef(ac.getState())
const stop = ac.subscribe(() => {
  state.value = ac.getState()
})
onBeforeUnmount(stop)

const cleanups = new WeakMap<HTMLElement, () => void>()
const vTemp: Directive<HTMLElement, 'increase' | 'decrease'> = {
  mounted: (el, { value }) => cleanups.set(el, ac.bindTempButton(el, value)),
  unmounted: el => cleanups.get(el)?.(),
}
</script>

<template>
  <div class="retro" v-bind="getAcRootAttrs(state)">
    <span v-bind="getAcDisplayAttrs(state, 'zh')">{{ state.temperature }}°C</span>
    <button v-bind="getAcButtonAttrs(state, 'power', 'zh', ac.limits)" @click="ac.run('power')">
      电源
    </button>
    <button v-temp="'increase'" v-bind="getAcButtonAttrs(state, 'increase', 'zh', ac.limits)">
      +
    </button>
  </div>
</template>

State reference

interface AcState {
  status: boolean // power
  mode: 'cold' | 'hot'
  temperature: number // current mode's target, clamped to limits (default 16–31)
  temperatures?: Record<'cold' | 'hot', number> // per-mode memory, like a real remote
  sound: 'normal' | 'sleep' | 'mute'
  swing: boolean
  fan?: 'auto' | 'low' | 'medium' | 'high'
}

type AcRemoteCommand = 'power' | 'cold' | 'hot' | 'increase' | 'decrease' | 'swing' | 'sound' | 'fan'

data-* reference (from getRootProps())

AttributeValuesStyle idea
data-statuson / offLight up displays, open louvers, start airflow
data-modecold / hotIce-cyan vs lava-orange accents
data-fanauto / low / medium / highFan bars; pair with --acw-wind-pace
data-swingon / offSweep animation for louvers / airflow
data-soundnormal / sleep / muteSpeaker icon
data-dripon / offShow a condensation droplet using --acw-drip-cycle
data-temperature"16"–"31"Gauges, knob angle

Design recipes

  1. Retro '94 window AC — warm beige plastic (#efe6d2), inset louver grille whose slats tilt open when data-status="on" and sweep when data-swing="on", amber seven-segment readout (Digital-7 font, glow via text-shadow), chunky mechanical keys with a 3px key-base shadow that collapses on :active, a rotary knob mapped from limits.min..limits.max to −135°…135°, red power key with a green LED.
  2. Cyber liquid-cooled — dark brushed-metal panel (repeating-linear-gradient grain), chamfered corners via clip-path, a HUD ring gauge with conic-gradient filled by (temperature - min) / (max - min), glow strip that is ice-cyan for cold, lava-orange for hot, slate when off; flow speed from calc(1.8s * var(--acw-wind-pace)).
  3. 8-Bit pixel handheld — Game Boy style body with stepped pixel borders (box-shadow in 4px steps), LCD palette per state (mint for cold, amber for hot, unlit olive when off), pixel-art snowflake / sun / power icons drawn with box-shadow, D-pad up/down = increase/decrease, left/right = cold/hot, A = power, B = fan, SELECT = swing.

Pitfalls checklist

  • Never hard-code 16 / 31. Read ac.limits (real devices such as Home Assistant climate entities report their own range and step). Use aria-disabled from getButtonProps to dim the limit keys.
  • Respect prefers-reduced-motion. Stop louver sweeps, airflow loops, and drips; keep static state cues (color, labels).
  • Do not reach into the widget's Shadow DOM or depend on internal .acw-* classes — only ::part() and --acw-* are public.
  • Keep accessible names. Spread getButtonProps(); if you show visible text, make sure it matches the stable label (e.g. visible "Power", aria-label="Power" with aria-pressed conveying on/off). Keep focus outlines visible.
  • Use bindTempButton for + / − instead of your own setInterval; it accelerates, stops at the limit, and does not double-fire on keyboard.
  • Do not fake state. Derive every visual from getState() / getRootProps() so switching skins or syncing with real devices stays correct.
  • SSR: create the headless instance on the client (or pass storage: null) and only call bindTempButton after mount.
  • Audio needs a user gesture. Start createAcAudioController after the first interaction and honor sound: 'mute'.

相似的 Skill

reverse-engineer-anything

MOmorluto/rea486k近 7 天新增 8,943 个 star

reverse-engineer-anything

MOmorluto/rea486k近 7 天新增 8,943 个 star

test-driven-development

OBobra/superpowers331k近 7 天新增 4,772 个 star

精选

accessibility

审计 Web、iOS、Android 的无障碍合规,支持键盘导航与屏幕阅读器。

AFaffaan-m/ECC315k近 7 天新增 4,381 个 star

ai-regression-testing

AFaffaan-m/ECC315k近 7 天新增 4,381 个 star

agent-runtime-gateway-smoke-test

AFaffaan-m/ECC315k近 7 天新增 4,381 个 star