Skip to content

Floating Widget · On-Site Install ​

— “Hey buddy, what do you do for a living?”
— “I install air conditioners on websites. Your blog looked a little overheated, so I mounted one in the corner.”

Mount a cloud air conditioner onto your blog, article, or plain HTML page: the indoor unit sits in the upper corner while the remote tucks into the lower corner on the same side. No wall drilling, no outdoor condenser, no copper pipes—what runs below is the real Web Component from this repository (zero React or Vue runtime), and the only downside is still no actual wind.

Three-Step Inspection ​

  1. Pick a wall: Choose Left wall or Right wall. The unit mounts to the upper corner immediately with the remote folded out of the way.
  2. Test the breaker: The demo unit ships powered on and cooling. Click Open remote in the bottom corner to adjust the temperature, switch modes, or power off. Collapse the remote or press Esc—the AC keeps humming along in the same state.
  3. Pack up cleanly: Pick On the floor to unmount it from the wall and keep reading; leaving this page automatically unmounts the demo unit so it never lingers elsewhere.

Installation Details

Keyboard users can navigate with Tab, Enter / Space, and press Esc to fold the remote and return focus to the toggle button. On short mobile landscape screens, the remote panel scrolls independently. Only the solid unit and expanded remote capture pointer events; the transparent airflow area lets clicks pass right through to your page.

Call the Technician: Install on Your Site ​

MethodBest ForHighlights
npm package (Recommended)Vite / Next / Nuxt / Astro projects with a bundlerLockfile-pinned version, full mount/unmount lifecycle control
Single <script> snippetBlog themes (Hexo / Hugo / Typecho / WordPress) or plain HTMLPaste one line into your global header or footer, zero build step
Self-hosted assetsIntranets, offline sites, or first-party domain hostingCopy bundled fonts, audio, and script into your static folder

Tick the mount corner, sound, and UI language on the work order below and the technician prints a ready-to-paste install snippet on the spot:

Work Order · Live Snippet

Measure the wall, print the install code

NO. AC-26
html
<script
  defer
  src="/widget/embed.js"
  data-placement="top-right"
  data-locale="en"
></script>

data-locale requires the self-hosted /widget/embed.js built from source (the pinned 0.4.4 CDN script still shows Chinese labels until the next npm release).

Call-out $0 · High-altitude fee $0 · Lifetime placebo-cooling warranty

For bundled projects: install via npm, keep versions locked in your lockfile, and manage mounting, events, and cleanup cleanly in client code.

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

// Run only in the browser after the DOM is ready. Do not call at SSR top level.
const widget = mountAirConditioner(document.body, {
  ...cdnAssets,
  placement: 'top-right', // 'top-left' | 'top-right' | 'inline'
  storageKey: 'my-blog:ac',
  enableAudio: false, // Stay quiet by default; turn on when needed
})

// widget.setAttribute('placement', 'top-left')
// Move back into a normal content container before switching back to inline.
// widget.setAttribute('placement', 'inline')

// Call on SPA route exit or component unmount to release listeners and audio.
// widget.remove()

cdnAssets loads fonts, audio, and the logo from jsDelivr pinned to the exact installed package version—no manual asset copying required. Your bundler still bundles the JS itself. For strict offline hosting, use the self-hosted setup below.

Inline mode uses normal document flow; switching to a corner floating mode starts with the remote folded. Floating overlays default to z-index: 1000, customizable via --acw-floating-z-index. Mounting onto document.body avoids ancestor transform or filter rules breaking position: fixed. See Web Component Guide for full options and events.

Single Script Snippet ​

For blogs and static HTML templates: open the standalone installer to preview and copy a version-pinned jsDelivr snippet. Bump the version explicitly when upgrading rather than using latest.

Paste this once into your site's global <head> or footer:

html
<script
  defer
  src="https://cdn.jsdelivr.net/npm/@yunlefun-home/[email protected]/dist/embed/embed.js"
  data-placement="top-right"
></script>

Both the unit and remote mount directly onto document.body. Fonts, logo, and audio load relative to the script URL—nothing needs to be copied into public/, and subpaths or blog routes will not break them.

AttributeDefaultPurpose
data-placementtop-rightSet to top-left to mount on the left corner
data-audiofalseSet to true to enable sound effects after user interaction
data-storage-keyac:embedStorage key for this site so separate blogs keep independent state
data-localezhSet to en for English remote labels, LCD, and screen-reader text. Ships with the next npm release / repo build; the pinned @0.4.4 script does not support it yet

Re-running the script will not stack duplicate widgets. For SPA blogs, place the script in your global shell; if you need to tear it down between routes, call document.querySelector('air-conditioner-embed')?.remove(). Changing init attributes such as audio requires a full reload.

The remote opens on click, touch, or keyboard activation—never on hover—so readers will not trigger it by accident while scrolling articles (revised from the original hover idea in #31). Works out of the box on VuePress and VitePress sites without a dedicated plugin.

Self-Hosted Deployment ​

All runtime assets are included inside the npm package. After installing, copy node_modules/@yunlefun-home/air-conditioner-widget/dist/embed/ to your static directory (for example public/widget/):

bash
mkdir -p public/widget
cp -R node_modules/@yunlefun-home/air-conditioner-widget/dist/embed/. public/widget/

When using the JS API, replace ...cdnAssets with assetsBaseUrl: '/widget/assets' and logoUrl: '/widget/yun-logo.svg' (prepending any base subpath). Plain HTML can load <script defer src="/widget/embed.js"></script>. The bundled index.html is the CDN demo page and may be omitted in strictly offline deployments.

You can also build the directory from source with pnpm -C packages/widget build:embed. The folder contains scripts, fonts, audio, logo, and license—never copy only the JS file. A full pnpm react:build copies it into packages/react/dist/widget/.

When serving /widget/* across origins, configure Access-Control-Allow-Origin: * so fonts and Web Audio fetches succeed. GitHub Pages sends this header by default, and Cloudflare Pages uses the repository's _headers file. Sites using a Content Security Policy must allow scripts, fonts, images, media/audio fetch from that origin, as well as inline styles injected into the document head and Shadow DOM.

Technician Q&A ​

“Hey buddy, what do you do for a living?”

I install air conditioners on websites. Mostly for thermal relief when code gets too hot or summer articles feel stuffy—purely psychological cooling, zero physical airflow guaranteed.

Will it block readers from clicking buttons on my site?

Only the solid AC unit and expanded remote accept clicks. The transparent airflow area below the unit is click-through, and the remote stays folded until clicked.

What if my site's sticky navbar sits above the AC?

Set --acw-floating-z-index (defaults to 1000) to ask the technician to hang it a little higher.

Can I move this unit into a full 3D smart home later?

The widget is built to stay lightweight and standalone. If you want a full 3D room with fans, TVs, and real Home Assistant climate.* device bindings, visit YunLeFun Home.

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