Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added — Drift reconvergence with celeste-tts-bot (sub-project #2)

- **`CorruptionCharsets`** — named registry backed by `src/data/charsets.json` (standard/soft/intense/all computed sets).
- **`CorruptionManager`** — unified `decode`/`flicker`/`hybrid` lifecycle with `visibilitychange` auto-cleanup.
- **`DecryptReveal`** — fixed-length decryption animation (`@whykusanagi/corrupted-theme/decrypt-reveal`). Renamed from CorruptionManager during 0.2.0 development to distinguish from TypingAnimation's streaming-typed pattern. Provides `.decode(element, finalText, opts)` for the chaos-buffer → resolved-text effect.
- **`CRTEffects`** — CRT post-processing layer (scanlines, chromatic aberration, flicker, screen shake, RGB split).
- **`animation-blocks`** — 10 classes: `TitleDecoder`, `ProgressBar`, `ScanlineSweep`, `TerminalBoot`, `GlitchPulse`, `ASCIIBorder`, `SystemDiagnostic`, `LoadingBarMulti`, `DataTransmission`, `TerminalPrompt`.
- **`corrupted-particles-background`** — auto-injector for behind-blur particles with DPR=1 performance mode.
Expand Down
34 changes: 18 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ For production hardening, add SRI hashes (published in `CHANGELOG.md` for each r
│ │ ├── timer-registry.js # lifecycle: tracked setTimeout/setInterval/rAF
│ │ ├── event-tracker.js # lifecycle: tracked addEventListener
│ │ ├── corruption-charsets.js # CorruptionCharsets registry (0.2.0)
│ │ ├── corruption-manager.js # CorruptionManager unified lifecycle (0.2.0)
│ │ ├── decrypt-reveal.js # DecryptReveal fixed-length decryption (0.2.0)
│ │ ├── websocket-manager.js # WebSocketManager auto-reconnect (0.2.0)
│ │ ├── random-utils.js # randomPick / randomInt / shuffle … (0.2.0)
│ │ ├── time-utils.js # formatTime / timeAgo / formatDuration … (0.2.0)
Expand Down Expand Up @@ -258,7 +258,7 @@ See [docs/CROSS_LANGUAGE_CONTRACT.md](docs/CROSS_LANGUAGE_CONTRACT.md) for the G
| `CorruptedParticles` | `includeLewd` | `nsfw` |
| `animation-blocks` | `lewdMode` | `nsfw` |
| `TypingAnimation` | `nsfw` | `nsfw` (unchanged) |
| `CorruptionManager` | — | `nsfw` |
| `DecryptReveal` | — | |

```js
// Correct — all components now use the same option name
Expand Down Expand Up @@ -414,8 +414,8 @@ import { initCountdown } from '@whykusanagi/corrupted-theme/countdown';

// 0.2.0 — Drift reconvergence (canonical corruption layer)
import { CorruptionCharsets } from '@whykusanagi/corrupted-theme/corruption-charsets';
import { CorruptionManager, decodeText, phraseFlicker, hybridDecode }
from '@whykusanagi/corrupted-theme/corruption-manager';
import { DecryptReveal, decodeText }
from '@whykusanagi/corrupted-theme/decrypt-reveal';
import { CRTEffects, applyCRTGlow } from '@whykusanagi/corrupted-theme/crt-effects';
import { TitleDecoder, ProgressBar, ScanlineSweep, TerminalBoot, GlitchPulse,
ASCIIBorder, SystemDiagnostic, LoadingBarMulti, DataTransmission, TerminalPrompt,
Expand Down Expand Up @@ -642,25 +642,27 @@ CorruptionCharsets.all; // union of every set

See [COMPONENTS_REFERENCE.md](docs/COMPONENTS_REFERENCE.md#corruptioncharsets) for all sets.

#### CorruptionManager
#### DecryptReveal

Unified lifecycle runner for all three canonical corruption patterns.
Fixed-length decryption animation. The target string is shown at its final length from frame 1 (scrambled with charset characters), then progressively resolves left-to-right to the target text.

**Distinct from TypingAnimation** — TypingAnimation grows the string over time (streaming/typed reveal with phrase-buffer flicker in the not-yet-revealed tail). DecryptReveal keeps the string at final length and scrambles unrevealed positions.

```js
import { CorruptionManager } from '@whykusanagi/corrupted-theme/corruption-manager';
import { DecryptReveal, decodeText } from '@whykusanagi/corrupted-theme/decrypt-reveal';

const mgr = new CorruptionManager({ nsfw: false });
const dr = new DecryptReveal({ charset: CorruptionCharsets.standard });

mgr.decode(el, 'SYSTEM READY', { duration: 2000 }); // Pattern 1
mgr.flicker(el, ['アイウエオ', '██████'], { duration: 3000 }); // Pattern 2
mgr.hybrid(el, ['CORRUPTION'], 'SIGNAL RESTORED', {}); // Pattern 3
mgr.stop(); // cancel all
mgr.destroy(); // full teardown
```
dr.decode(el, 'SYSTEM READY', { duration: 2000 });
dr.decode(el, 'アクセス許可', { duration: 3000, charset: CorruptionCharsets.kanji });
dr.stop(); // cancel all
dr.destroy(); // full teardown

One-shot helpers (no instance needed): `decodeText`, `phraseFlicker`, `hybridDecode` — each returns a cancel function.
// One-shot helper (no instance needed) — returns a cancel function
const cancel = decodeText(el, 'NEURAL CORE ONLINE', { duration: 1500 });
```

See [COMPONENTS_REFERENCE.md](docs/COMPONENTS_REFERENCE.md#corruptionmanager) for full method table.
See [COMPONENTS_REFERENCE.md](docs/COMPONENTS_REFERENCE.md#decryptreveal) for full method table.

#### CRTEffects

Expand Down
56 changes: 25 additions & 31 deletions docs/COMPONENTS_REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1280,57 +1280,53 @@ CorruptionCharsets.all; // union of every set

**Available sets:** `katakana`, `hiragana`, `kanji`, `symbols`, `blocks`, `standard`, `soft`, `intense`, `all`.

All getters return a `string` — index directly with `Math.random()` or pass as `charset` to `CorruptionManager` / animation block options.
All getters return a `string` — index directly with `Math.random()` or pass as `charset` to `DecryptReveal` / animation block options.

---

## CorruptionManager
## DecryptReveal

**Module:** `@whykusanagi/corrupted-theme/corruption-manager`
**Source:** `src/core/corruption-manager.js`
**Module:** `@whykusanagi/corrupted-theme/decrypt-reveal`
**Source:** `src/core/decrypt-reveal.js`
**Since:** 0.2.0

Unified lifecycle runner for all three canonical corruption patterns defined in `CORRUPTED_THEME_SPEC.md`. Tracks every active timer via `TimerRegistry` so a single `stop()` / `destroy()` call cleans up everything. Auto-stops when `document.hidden` becomes `true` (Visibility API).
Fixed-length decryption animation. The target string is shown at its final length from frame 1, scrambled with random characters from a charset, and progressively resolves left-to-right to the target text (chaos → order).

**Distinct from TypingAnimation:** TypingAnimation grows the string over time (streaming/typed reveal with a phrase-buffer flicker in the not-yet-revealed tail). DecryptReveal keeps the string at final length and scrambles unrevealed positions. Use DecryptReveal for code reveals, passwords, and terminal boot sequences.

Tracks every active timer via `TimerRegistry` so a single `stop()` / `destroy()` call cleans up everything. Auto-stops when `document.hidden` becomes `true` (Visibility API).

```js
import {
CorruptionManager,
DecryptReveal,
decodeText,
phraseFlicker,
hybridDecode,
} from '@whykusanagi/corrupted-theme/corruption-manager';

const mgr = new CorruptionManager({ nsfw: false, charset: CorruptionCharsets.standard });
} from '@whykusanagi/corrupted-theme/decrypt-reveal';

// Pattern 1 — character-by-character decode
const id1 = mgr.decode(el, 'SYSTEM READY', { duration: 2000 });
const dr = new DecryptReveal({ charset: CorruptionCharsets.standard });

// Pattern 2phrase flickering
const id2 = mgr.flicker(el, ['アイウエオ', 'LOADING...', '██████'], { duration: 3000, finalText: '' });
// Fixed-length decrypttext shown scrambled at full length, resolves left-to-right
const id1 = dr.decode(el, 'SYSTEM READY', { duration: 2000 });

// Pattern 3 — hybrid (flicker phase → decode phase)
const id3 = mgr.hybrid(el, ['CORRUPTION DETECTED'], 'SIGNAL RESTORED', { duration: 4000 });
// Override charset per-call
const id2 = dr.decode(el, 'アクセス許可', { duration: 3000, charset: CorruptionCharsets.kanji });

mgr.cleanup(id1); // cancel one animation early
mgr.stop(); // cancel all animations (Visibility API auto-calls this)
mgr.start(); // resume hook (intentional no-op — re-queue animations explicitly)
mgr.destroy(); // full teardown; instance not reusable after this
dr.cleanup(id1); // cancel one animation early
dr.stop(); // cancel all animations (Visibility API auto-calls this)
dr.start(); // resume hook (intentional no-op — re-queue animations explicitly)
dr.destroy(); // full teardown; instance not reusable after this
```

**Constructor Options:**

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `nsfw` | boolean | `false` | Include NSFW phrase pools when auto-generating default phrase lists |
| `charset` | string | `CorruptionCharsets.standard` | Default charset for decode/hybrid; overridable per call |
| `charset` | string | `CorruptionCharsets.standard` | Default charset for decode operations; overridable per call |

**Methods:**

| Method | Returns | Description |
|--------|---------|-------------|
| `decode(element, content, opts?)` | `number` | Start Pattern 1. `opts`: `duration` (ms), `charset` |
| `flicker(element, phrases, opts?)` | `number` | Start Pattern 2. `opts`: `duration`, `flickerInterval`, `finalText`, `nsfw` |
| `hybrid(element, phrases, content, opts?)` | `number` | Start Pattern 3. `opts`: `duration`, `charset`, `flickerInterval`, `nsfw` |
| `decode(element, content, opts?)` | `number` | Start decryption animation. `opts`: `duration` (ms), `charset` |
| `cleanup(id)` | `void` | Cancel one animation by its return ID |
| `stop()` | `void` | Cancel all active animations; element text preserved as-is |
| `start()` | `void` | No-op resume hook; re-queue animations explicitly |
Expand All @@ -1339,13 +1335,11 @@ mgr.destroy(); // full teardown; instance not reusable after this
| `isAnimating(id)` | `boolean` | Whether animation `id` is still running |
| `cleanupAll()` | `void` | **Deprecated** — alias for `stop()`. Removed in 0.3.x |

**Standalone one-shot exports** (no manager instance needed — each returns a cleanup `Function`):
**Standalone one-shot export** (no manager instance needed — returns a cleanup `Function`):

| Export | Signature |
|--------|-----------|
| `decodeText` | `(element, finalText, opts?) → Function` |
| `phraseFlicker` | `(element, phrases, finalText, opts?) → Function` |
| `hybridDecode` | `(element, flickerPhrases, finalText, opts?) → Function` |

---

Expand Down Expand Up @@ -1899,7 +1893,7 @@ Methods: `connect()`, `disconnect()`, `send(msg)`, `on(handler)`, `off(handler)`

### TimerRegistry

**Module:** `@whykusanagi/corrupted-theme/corruption-manager` (internal; also used directly in lib components)
**Module:** `@whykusanagi/corrupted-theme/decrypt-reveal` (internal; also used directly in lib components)
**Source:** `src/core/timer-registry.js`
**Type:** Class
**Since:** 0.1.x (merged with TimerManager API in 0.2.0)
Expand All @@ -1912,7 +1906,7 @@ Centralized timer tracking for component lifecycle cleanup. Wraps `setTimeout`,
- `destroy()`: calls `clearAll()` then sets `destroyed = true`

```js
import { TimerRegistry } from '@whykusanagi/corrupted-theme/corruption-manager';
import { TimerRegistry } from '@whykusanagi/corrupted-theme/decrypt-reveal';
// or import directly for internal use:
// import { TimerRegistry } from '@whykusanagi/corrupted-theme/src/core/timer-registry.js';

Expand Down
2 changes: 1 addition & 1 deletion docs/components/COMPONENT_LIBRARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ The 0.2.0 release adds a canonical JS layer on top of the CSS framework. Full AP

| Module | Class / Export | Purpose |
|--------|---------------|---------|
| `corruption-manager.js` | `CorruptionManager` | Lifecycle-managed multi-animation runner |
| `decrypt-reveal.js` | `DecryptReveal` | Fixed-length decryption animation |
| `corruption-charsets.js` | charset helpers | Canonical charset access from `src/data/charsets.json` |
| `corruption-phrases.js` | phrase helpers | Canonical phrase access from `src/data/phrases.json` |
| `typing-animation.js` | `TypingAnimation` | Buffer-style corruption with SFW/NSFW modes |
Expand Down
2 changes: 1 addition & 1 deletion docs/platforms/COMPONENT_MAPPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ The following JS modules have no CLI equivalent — they target browser/canvas/W

| npm Export | Class | Category | CLI Equivalent |
|------------|-------|----------|---------------|
| `./corruption-manager` | `CorruptionManager` | Core | None (CLI uses Go structs) |
| `./decrypt-reveal` | `DecryptReveal` | Core | None (CLI uses Go structs) |
| `./animation-blocks` | 10 block classes | Animation | `CorruptText()` + `CorruptTextJapanese()` (approximate) |
| `./crt-effects` | `CRTEffects` | Animation | None |
| `./corrupted-text` | `CorruptedText` | Corruption | `CorruptTextJapanese()` |
Expand Down
4 changes: 2 additions & 2 deletions docs/platforms/NPM_PACKAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ Example: 0.2.0

| Version | Date | Changes | Migration |
|---------|------|---------|-----------|
| **0.2.0** | 2026-05-18 | Canonical JSON data layer, CDN distribution, CorruptionManager, CRTEffects, animation-blocks (10 classes), 7 new widgets, 5 utility modules, glassmorphism CSS merge, UMD build, .container redesign | [Migration guide](../MIGRATION_CONTAINER_0.2.0.md) |
| **0.2.0** | 2026-05-18 | Canonical JSON data layer, CDN distribution, DecryptReveal, CRTEffects, animation-blocks (10 classes), 7 new widgets, 5 utility modules, glassmorphism CSS merge, UMD build, .container redesign | [Migration guide](../MIGRATION_CONTAINER_0.2.0.md) |
| 0.1.9 | 2026-04-19 | CorruptedText dedup, TypingAnimation buffer redesign, NSFW page consolidation, layout fix, orphan docs removed, CI workflow | N/A |
| 0.1.8 | 2026-03-01 | GLSL vortex, Canvas particles, new JS components | N/A |
| 0.1.7 | 2026-02-07 | Security, lifecycle, new components | N/A |
Expand Down Expand Up @@ -732,7 +732,7 @@ See [`docs/MIGRATION_CONTAINER_0.2.0.md`](../MIGRATION_CONTAINER_0.2.0.md) for t

- **`.container` class redesigned** — now controls max-width layout; replace old `.container` usage with new `.glass-container` variants where glass effect was intended
- **New canonical JSON data** — phrase lists and charsets live in `src/data/` instead of inline in JS
- **New JS exports** — 19 new modules available under `./corruption-manager`, `./animation-blocks`, `./crt-effects`, etc. in `package.json` exports map
- **New JS exports** — 19 new modules available under `./decrypt-reveal`, `./animation-blocks`, `./crt-effects`, etc. in `package.json` exports map
- **No removed exports** — all 0.1.x CSS classes and JS classes remain; 0.2.0 is additive

### From Custom CSS to Corrupted Theme
Expand Down
2 changes: 1 addition & 1 deletion docs/platforms/WEB_IMPLEMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,7 @@ Quick reference:
<!-- Individual JS module (ESM) -->
<script type="module">
import { CorruptedText } from 'https://corrupted.whykusanagi.xyz/src/lib/corrupted-text.js';
import { CorruptionManager } from 'https://corrupted.whykusanagi.xyz/src/core/corruption-manager.js';
import { DecryptReveal } from 'https://corrupted.whykusanagi.xyz/src/core/decrypt-reveal.js';
</script>
```

Expand Down
2 changes: 1 addition & 1 deletion examples/advanced/crt-effects.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
<a href="../basic/typing-animation.html"><i class="fas fa-keyboard"></i> Buffer Corruption</a>
<a href="../animation-blocks/index.html"><i class="fas fa-film"></i> Animation Blocks</a>
<a href="../advanced/crt-effects.html" class="active"><i class="fas fa-tv"></i> CRT Effects</a>
<a href="../advanced/corruption-manager.html"><i class="fas fa-sitemap"></i> Corruption Manager</a>
<a href="../advanced/decrypt-reveal.html"><i class="fas fa-key"></i> Decrypt Reveal</a>
<a href="../components/showcase.html"><i class="fas fa-th-large"></i> Widgets Showcase</a>
</div>
</li>
Expand Down
Loading
Loading