ice-web-components 1.0.0 → 1.1.0

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/README.md CHANGED
@@ -27,31 +27,23 @@ rings and shadows) is drawn by the engine.
27
27
  - **Bootstrap 5 token theme** (plus a dark theme) — swap with one call.
28
28
  - **No name collisions with the engine** — the package’s runtime exports are
29
29
  disjoint from `ice-render`’s (there is a regression test for it).
30
- - **Actually tested** — 705 unit tests (98 suites: form validation, overlay
31
- positioning, keyboard navigation, sort/hover/focus edge cases, the Minesweeper,
32
- Tetris and Snake rule models) plus five browser QA suites (`qa:admin`, `qa:gallery`,
33
- `qa:workbench`, `qa:xp`, `qa:arcade` — 198 assertions) that drive the demo pages with
30
+ - **Actually tested** — 723 unit tests (99 suites: form validation, overlay
31
+ positioning, keyboard navigation, sort/hover/focus edge cases, and the Minesweeper,
32
+ Tetris, Snake, 2048 and CHIP-8 rule/machine models) plus five browser QA suites
33
+ (`qa:admin`, `qa:gallery`, `qa:workbench`, `qa:xp`, `qa:arcade` — 208 assertions) that drive the demo pages with
34
34
  real mouse and keyboard events and fail on any console error.
35
35
 
36
36
  ## Quick start
37
37
 
38
- > **Install**: `1.0.0` is the first tagged release. The engine (`ice-render`) is on npm;
39
- > the component library ships as a tarball / git dependency for now use one of the following:
38
+ > **Install**: both packages are on npm now `npm install ice-web-components` (it pulls
39
+ > `ice-render` as a dependency). `1.0.0` is the first published release; from a checkout you
40
+ > can also `npm install /path/to/ice-web-components` or `npm install git+https://github.com/ice-render/ice-web-components.git`.
40
41
 
41
42
  ```bash
42
- # a local path (the usual thing inside a monorepo / workspace)
43
- npm install /path/to/ice-web-components
44
-
45
- # ② straight from git
46
- npm install git+https://github.com/ice-render/ice-web-components.git
47
-
48
- # ③ pack it, then install the tarball
49
- (cd /path/to/ice-web-components && npm pack) # produces ice-web-components-0.0.1.tgz
50
- npm install /path/to/ice-web-components-0.0.1.tgz
43
+ npm install ice-web-components # + ice-render, pulled automatically
51
44
  ```
52
45
 
53
- All three pull the `ice-render@^1.3.0` dependency from npm. The published tarball
54
- contains `dist/` only (cjs + esm + umd + type declarations).
46
+ The published tarball contains `dist/` only (cjs + esm + umd + type declarations).
55
47
 
56
48
  ```ts
57
49
  import { ICE } from 'ice-render';
@@ -224,8 +216,8 @@ that window is active; closing the window stops its step timer.
224
216
 
225
217
  Not a web page but a **handheld console**: the shell, the screen bezel, the HUD cards,
226
218
  the buttons and the sound switch are all ICE components, and there is not a single
227
- bitmap asset in the picture. Three cartridges are plugged in, and the cartridge row at
228
- the top switches between them (a fourth slot, Chinese chess, is disabled for now).
219
+ bitmap asset in the picture. Four cartridges are plugged in, and the cartridge row at
220
+ the top switches between them (a fifth slot, Chinese chess, is disabled for now).
229
221
 
230
222
  | | |
231
223
  |---|---|
@@ -256,10 +248,32 @@ weight and text colour, so a 4×4 board with 16 numbers is still one node.
256
248
 
257
249
  ![ICE Arcade · 2048](docs/images/arcade-2048.png)
258
250
 
259
- Both games are pure models that never touch the canvas; the page only reads the model
251
+ **Cartridge 4 CHIP-8** (`ICEChip8Model`, 19 unit tests). The odd one out: instead of
252
+ “the rules of a game” it is **an actual virtual machine** — 4 KB of memory, `V0`–`VF`,
253
+ the 16-bit `I` register, a 64×32 monochrome framebuffer, two 60 Hz timers and a 16-key
254
+ keypad. 35 opcodes are implemented (`00E0` / `1NNN` / `2NNN` / `DXYN` / `EX9E` / `FX0A` /
255
+ `FX29` / `FX33` / `FX55` …), including `DXYN`’s XOR drawing with the classic
256
+ `VF = collision` flag and `FX0A` blocking key waits.
257
+
258
+ The console ships a **self-written demo ROM** (no external ROM, no copyright questions):
259
+ it clears the screen, draws an 8×8 smiley, moves it, flips its velocity when a wall is
260
+ reached, and loops — which exercises conditional skips and two’s-complement arithmetic
261
+ as well as drawing. Both the 2048-cell framebuffer and the 4×4 machine keypad are single
262
+ `ICETileMap` nodes; the keys light up while pressed, which makes the `keydown` / `keyup`
263
+ path visible. On that cartridge the machine owns its 16 keys (`1 2 3 4 / Q W E R / A S D F
264
+ / Z X C V`), so the console hands even `R` to the ROM and keeps `P` for pause.
265
+
266
+ ![ICE Arcade · CHIP-8](docs/images/arcade-chip8.png)
267
+
268
+ All four games are pure models that never touch the canvas; the page only reads the model
260
269
  and paints cells. Switching a cartridge tears the old board down, builds the new one
261
- and re-captions the HUD, so a third game is a registry entry plus a `mount()`.
262
- Switching away from the tab pauses whatever is running.
270
+ and re-captions the HUD, so another game is a registry entry plus a `mount()`.
271
+ Switching away from the tab pauses whatever is running (CHIP-8 also drops its pressed
272
+ keys, otherwise a lost `keyup` would leave `FX0A` waiting forever).
273
+
274
+ | Pause overlay (`已暂停`) |
275
+ |---|
276
+ | ![ICE Arcade paused](docs/images/arcade-paused.png) |
263
277
 
264
278
  Under the hood this page is where the engine work happens:
265
279
 
@@ -279,6 +293,10 @@ Under the hood this page is where the engine work happens:
279
293
  - Toasts are **replaced, not stacked**: a console only needs one status line, and the QA
280
294
  caught a stack of three toasts covering the cartridge row (the click never reached the
281
295
  button). `ICEMessage` still supports stacking for pages that want it.
296
+ - CHIP-8 also drove two engine fixes: an offscreen-cache bug where a bitmap baked the
297
+ *ancestor’s* opacity (so the pause plate faded in but its “已暂停” text never appeared —
298
+ translucent subtrees are no longer cached, and stale bitmaps are dropped), and
299
+ keyboard routing that lets a cartridge declare the keys it owns.
282
300
 
283
301
  | Leaderboard (`ICEModal` + `ICETable` + `ICEScrollPane`) |
284
302
  |---|
@@ -300,7 +318,7 @@ Under the hood this page is where the engine work happens:
300
318
  | Feedback & status | `ICEAlert` `ICEModal` `ICEDrawer` `ICEMessage` `ICENotification` `ICETooltip` `ICEPopover` `ICEPopconfirm` `ICETour` `ICEFloatButton` `ICEEmpty` `ICESkeleton` `ICESpin` `ICEResult` `ICESteps` `ICEOverlayManager` |
301
319
  | Navigation | `ICEMenu` `ICEBreadcrumb` `ICEAnchor` `ICEBackTop` `ICEDropdown` `ICEPagination` `ICETabs` |
302
320
  | Layout & core | `ICEWidget` `ICEContainer` `ICEHoverManager` `ICEFocusManager` `ICEMessageManager` `ICEManager` (`ICEPainter` / `ICELayoutManager` are types) |
303
- | Models | `ICEButtonModel` `ICEToggleModel` `ICEBoundedRangeModel` `ICESelectionModel` `ICEFormModel` |
321
+ | Models | `ICEButtonModel` `ICEToggleModel` `ICEBoundedRangeModel` `ICESelectionModel` `ICEFormModel` `ICETetrisModel` `ICESnakeModel` `ICE2048Model` `ICEChip8Model` `ICEMinesweeperModel` `ICEHighScoreModel` |
304
322
 
305
323
  Helper functions: `attachTooltip` `attachPopover` `attachPopconfirm` `attachDropdown`
306
324
  `openModal` `openDrawer` `getICEOverlayManager` `getICEFocusManager` `getICEMessageManager`