Skip to content

AI Custom Skins ​

Couture workshop: the compressor core stays the same—16–31°C limits, per-mode temperature memory, cold mist, condensation drips, swing, and sound all included. The shell goes to your AI designer: a '90s window unit, a cyberpunk liquid-cooled panel, or a pixel handheld.

The three demo units below share one real core state. Set the retro unit to 28°C in heat mode, then switch to the cyber or pixel shell—temperature, mode, power, fan speed, and swing all carry over.

Philosophy: Behavior in Core, Skins by AI ​

Inspired by Vercel AI SDK UI and Reka UI: the library owns how it works, not how it looks.

  • Behavior lives in core: the @yunlefun-home/air-conditioner-core reducer decides temperature limits, per-mode temperature recall, mist density, drip rhythm, and fan speed. createAirConditionerHeadless wraps all of it into commands and prop getters.
  • The shell is yours: getRootProps() hands you data-* state and --acw-* CSS variables; getButtonProps() hands you aria-pressed, aria-disabled, and screen-reader labels. You write the HTML and CSS—or let an AI write it.
  • Accessibility for free: screen-reader summaries, pressed states, press-and-hold temperature repeat, and limit stops all come from core, no matter how many skins you ship.

Two Re-Skin Tiers ​

Tier 1 · Light re-skinTier 2 · Headless shell
Best forColors, radii, shadows, fontsA whole new device silhouette and key layout
Package@yunlefun-home/air-conditioner-widget@yunlefun-home/air-conditioner-core
HowCSS --acw-* variables + ::part()createAirConditionerHeadless + your own DOM
FrameworkAny page, zero JS changesReact / Vue / Svelte / Solid / vanilla

Tier 1: A CSS-only Cream Skin ​

The widget renders in Shadow DOM. Restyle it only through the public ::part() hooks and --acw-* variables—never internal class names:

css
air-conditioner-widget {
  --acw-text-color: #3b2f22;
  --acw-led-on: #f59e0b;
  --acw-wind-cold: #a5d8ff;
}

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

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

Available parts: root, unit, display, wind, note, dock, toggle, remote-panel, remote, lcd, energy-label.

Tier 2: React + useSyncExternalStore ​

tsx
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)
  // Press-and-hold repeat that stops at 31°C
  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>
  )
}

Tier 2: Vue 3 ​

In Vue, feed the reactive state straight into the pure helpers and the template updates on its own:

vue
<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: 'en', storage: null })
const state = shallowRef(ac.getState())
onBeforeUnmount(ac.subscribe(() => {
  state.value = ac.getState()
}))

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, 'en')">{{ state.temperature }}°C</span>
    <button v-bind="getAcButtonAttrs(state, 'power', 'en', ac.limits)" @click="ac.run('power')">
      Power
    </button>
    <button v-temp="'increase'" v-bind="getAcButtonAttrs(state, 'increase', 'en', ac.limits)">
      +
    </button>
  </div>
</template>

Official Skill for AI Coding Agents ​

The repo ships an Agent Skill: skills/air-conditioner-skin/SKILL.md. It covers the full API for both tiers, quick references for AcState / AcRemoteCommand / data-* / --acw-* / ::part(), three design recipes, and a pitfalls checklist.

bash
npx skills add YunYouJun/air-conditioner

Once installed, copy any prompt from the showroom above and hand it to your AI—or describe your own style and mention "use the air-conditioner-skin skill".

Re-skin pitfalls

  • Never hard-code 16 / 31—read ac.limits. Real devices such as Home Assistant climate entities report their own range and step.
  • Respect prefers-reduced-motion: stop swing sweeps, airflow loops, and drips, and keep state cues in color and text.
  • Only restyle the widget through ::part() and --acw-*; never reach into its Shadow DOM for internal .acw-* classes.

Released under the MIT License · The only catch is no actual wind