@yunlefun-home/air-conditioner-widget 0.0.0-stage → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 YunYouJun 云游君 <me@yunyoujun.cn>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,62 @@
1
- # Temporary Holding Version
1
+ # Air Conditioner widget
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A framework-independent Web Component with a floating air conditioner and a collapsible remote. Supports ESM, CommonJS and TypeScript; no React or Vue host is required.
4
+
5
+ ## npm (recommended)
6
+
7
+ ```bash
8
+ npm install @yunlefun-home/air-conditioner-widget
9
+ ```
10
+
11
+ ```ts
12
+ import { cdnAssets, mountAirConditioner } from '@yunlefun-home/air-conditioner-widget'
13
+
14
+ // On the client, after the DOM is ready. Importing the package during SSR is safe.
15
+ const widget = mountAirConditioner(document.body, {
16
+ ...cdnAssets,
17
+ placement: 'top-right', // 'top-left' | 'top-right' | 'inline'
18
+ storageKey: 'my-blog:ac',
19
+ enableAudio: false,
20
+ })
21
+
22
+ // On component / route teardown, release listeners and audio:
23
+ // widget.remove()
24
+ ```
25
+
26
+ `cdnAssets` explicitly loads fonts, audio and the logo from jsDelivr, pinned to the exact version of the installed npm package. Your application bundles the JavaScript itself. Omit it and provide `assetsBaseUrl` and `logoUrl` to self-host assets. Importing the package does not automatically mount or fetch anything.
27
+
28
+ You can also call `defineAirConditionerElement({ ...cdnAssets, enableAudio: false })`, then render `<air-conditioner-widget placement="top-right"></air-conditioner-widget>`.
29
+
30
+ ## Script (no build required)
31
+
32
+ Add this exact-version URL to a site's shared header or footer:
33
+
34
+ ```html
35
+ <script defer src="https://cdn.jsdelivr.net/npm/@yunlefun-home/air-conditioner-widget@0.4.3/dist/embed/embed.js" data-placement="top-right"></script>
36
+ ```
37
+
38
+ Use `data-placement="top-left"` for the left corner, `data-audio="true"` for audio, and `data-storage-key="my-blog:ac"` for a local storage key. Audio is disabled by default in the script installer. The remote opens on click, touch, Enter, or Space and closes with Escape. Loading the script twice keeps a single widget.
39
+
40
+ Upgrade by changing the exact version; avoid `latest` in production. [Try the installation demo](https://yunyoujun.github.io/air-conditioner/widget/).
41
+
42
+ ## Self-hosting and offline use
43
+
44
+ The npm package includes all runtime assets. Copy its `dist/embed/` directory into your site's static directory, for example:
45
+
46
+ ```bash
47
+ mkdir -p public/widget
48
+ cp -R node_modules/@yunlefun-home/air-conditioner-widget/dist/embed/. public/widget/
49
+ ```
50
+
51
+ For the API, replace `...cdnAssets` with `assetsBaseUrl: '/widget/assets'` and `logoUrl: '/widget/yun-logo.svg'`. Include your deployment prefix if applicable. For plain HTML use `<script defer src="/widget/embed.js"></script>`. Keep the assets next to the script. The included `index.html` is the official CDN installation demo; omit it for a strictly offline site.
52
+
53
+ For use from another origin, serve these files with `Access-Control-Allow-Origin: *`. Sites with a Content Security Policy must allow the chosen origin for scripts, fonts, images, media and fetch, and permit the widget's inline styles.
54
+
55
+ From source, run `pnpm -C packages/widget build`. `pnpm react:build` also includes the installer under `packages/react/dist/widget/`.
56
+
57
+ ## Source and assets
58
+
59
+ - Source: https://github.com/YunYouJun/air-conditioner (MIT; see `LICENSE`).
60
+ - Font: [Digital-7 by Style-7](https://www.dafont.com/digital-7.font), described upstream as free for personal use.
61
+ - Fan recording: [Air Extractor Fan by InspectorJ](https://freesound.org/people/InspectorJ/sounds/403664/), processed by this project.
62
+ - The bundle copies the font, button/start sounds and logo from this repository's `packages/react/public/`. Third-party assets retain their own licenses.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 YunYouJun 云游君 <me@yunyoujun.cn>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,62 @@
1
+ # Air Conditioner widget
2
+
3
+ A framework-independent Web Component with a floating air conditioner and a collapsible remote. Supports ESM, CommonJS and TypeScript; no React or Vue host is required.
4
+
5
+ ## npm (recommended)
6
+
7
+ ```bash
8
+ npm install @yunlefun-home/air-conditioner-widget
9
+ ```
10
+
11
+ ```ts
12
+ import { cdnAssets, mountAirConditioner } from '@yunlefun-home/air-conditioner-widget'
13
+
14
+ // On the client, after the DOM is ready. Importing the package during SSR is safe.
15
+ const widget = mountAirConditioner(document.body, {
16
+ ...cdnAssets,
17
+ placement: 'top-right', // 'top-left' | 'top-right' | 'inline'
18
+ storageKey: 'my-blog:ac',
19
+ enableAudio: false,
20
+ })
21
+
22
+ // On component / route teardown, release listeners and audio:
23
+ // widget.remove()
24
+ ```
25
+
26
+ `cdnAssets` explicitly loads fonts, audio and the logo from jsDelivr, pinned to the exact version of the installed npm package. Your application bundles the JavaScript itself. Omit it and provide `assetsBaseUrl` and `logoUrl` to self-host assets. Importing the package does not automatically mount or fetch anything.
27
+
28
+ You can also call `defineAirConditionerElement({ ...cdnAssets, enableAudio: false })`, then render `<air-conditioner-widget placement="top-right"></air-conditioner-widget>`.
29
+
30
+ ## Script (no build required)
31
+
32
+ Add this exact-version URL to a site's shared header or footer:
33
+
34
+ ```html
35
+ <script defer src="https://cdn.jsdelivr.net/npm/@yunlefun-home/air-conditioner-widget@0.4.3/dist/embed/embed.js" data-placement="top-right"></script>
36
+ ```
37
+
38
+ Use `data-placement="top-left"` for the left corner, `data-audio="true"` for audio, and `data-storage-key="my-blog:ac"` for a local storage key. Audio is disabled by default in the script installer. The remote opens on click, touch, Enter, or Space and closes with Escape. Loading the script twice keeps a single widget.
39
+
40
+ Upgrade by changing the exact version; avoid `latest` in production. [Try the installation demo](https://yunyoujun.github.io/air-conditioner/widget/).
41
+
42
+ ## Self-hosting and offline use
43
+
44
+ The npm package includes all runtime assets. Copy its `dist/embed/` directory into your site's static directory, for example:
45
+
46
+ ```bash
47
+ mkdir -p public/widget
48
+ cp -R node_modules/@yunlefun-home/air-conditioner-widget/dist/embed/. public/widget/
49
+ ```
50
+
51
+ For the API, replace `...cdnAssets` with `assetsBaseUrl: '/widget/assets'` and `logoUrl: '/widget/yun-logo.svg'`. Include your deployment prefix if applicable. For plain HTML use `<script defer src="/widget/embed.js"></script>`. Keep the assets next to the script. The included `index.html` is the official CDN installation demo; omit it for a strictly offline site.
52
+
53
+ For use from another origin, serve these files with `Access-Control-Allow-Origin: *`. Sites with a Content Security Policy must allow the chosen origin for scripts, fonts, images, media and fetch, and permit the widget's inline styles.
54
+
55
+ From source, run `pnpm -C packages/widget build`. `pnpm react:build` also includes the installer under `packages/react/dist/widget/`.
56
+
57
+ ## Source and assets
58
+
59
+ - Source: https://github.com/YunYouJun/air-conditioner (MIT; see `LICENSE`).
60
+ - Font: [Digital-7 by Style-7](https://www.dafont.com/digital-7.font), described upstream as free for personal use.
61
+ - Fan recording: [Air Extractor Fan by InspectorJ](https://freesound.org/people/InspectorJ/sounds/403664/), processed by this project.
62
+ - The bundle copies the font, button/start sounds and logo from this repository's `packages/react/public/`. Third-party assets retain their own licenses.
Binary file