@gigo-ui/components 1.0.0-release → 1.0.1

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.
Files changed (33) hide show
  1. package/README.md +158 -132
  2. package/dist/components/chaos/BlackHoleSink.svelte +81 -0
  3. package/dist/components/chaos/BlackHoleSink.svelte.d.ts +16 -0
  4. package/dist/components/chaos/GigoCompactor.svelte +103 -0
  5. package/dist/components/chaos/GigoCompactor.svelte.d.ts +16 -0
  6. package/dist/components/chaos/PixelDissolve.svelte +81 -0
  7. package/dist/components/chaos/PixelDissolve.svelte.d.ts +16 -0
  8. package/dist/components/chaos/ShatterPane.svelte +84 -0
  9. package/dist/components/chaos/ShatterPane.svelte.d.ts +16 -0
  10. package/dist/components/chaos/internal/BlackHoleEngine.svelte +167 -0
  11. package/dist/components/chaos/internal/BlackHoleEngine.svelte.d.ts +11 -0
  12. package/dist/components/chaos/internal/CompactorEngine.svelte +195 -0
  13. package/dist/components/chaos/internal/CompactorEngine.svelte.d.ts +11 -0
  14. package/dist/components/chaos/internal/PixelDissolveEngine.svelte +168 -0
  15. package/dist/components/chaos/internal/PixelDissolveEngine.svelte.d.ts +11 -0
  16. package/dist/components/chaos/internal/ShatterEngine.svelte +208 -0
  17. package/dist/components/chaos/internal/ShatterEngine.svelte.d.ts +11 -0
  18. package/dist/docs/component-data.js +8 -0
  19. package/dist/docs/components/chaos/black-hole-sink.d.ts +2 -0
  20. package/dist/docs/components/chaos/black-hole-sink.js +71 -0
  21. package/dist/docs/components/chaos/gigo-compactor.d.ts +2 -0
  22. package/dist/docs/components/chaos/gigo-compactor.js +71 -0
  23. package/dist/docs/components/chaos/pixel-dissolve.d.ts +2 -0
  24. package/dist/docs/components/chaos/pixel-dissolve.js +71 -0
  25. package/dist/docs/components/chaos/shatter-pane.d.ts +2 -0
  26. package/dist/docs/components/chaos/shatter-pane.js +71 -0
  27. package/dist/index.d.ts +5 -1
  28. package/dist/index.js +4 -0
  29. package/dist/styles/globals.css +3 -0
  30. package/dist/types/index.d.ts +32 -0
  31. package/dist/utils/destruction-engine.d.ts +26 -0
  32. package/dist/utils/destruction-engine.js +75 -0
  33. package/package.json +73 -66
package/README.md CHANGED
@@ -1,132 +1,158 @@
1
- # 🌀 @gigo-ui/components
2
-
3
- ### _High-Performance Components for Low-Performance Experiences._
4
-
5
- [![Svelte](https://img.shields.io/badge/Svelte-5.0+-FF3E00?logo=svelte&logoColor=white)](https://svelte.dev)
6
- [![SvelteKit](https://img.shields.io/badge/SvelteKit-2.0+-FF3E00?logo=svelte&logoColor=white)](https://svelte.dev)
7
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
8
- [![Tailwind](https://img.shields.io/badge/Tailwind_CSS-4.0+-06B6D4?logo=tailwindcss&logoColor=white)](https://tailwindcss.com/)
9
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
10
-
11
- A Svelte 5 component library of intentionally terrible UI patterns. Every component is production-quality code implementing the worst UX ideas imaginable.
12
-
13
- Built with modern runes (`$state`, `$derived`, `$effect`, `$bindable`), TypeScript, and Tailwind CSS 4.
14
-
15
- ---
16
-
17
- ## Install
18
-
19
- ```bash
20
- pnpm add @gigo-ui/components
21
- ```
22
-
23
- ## Quick Start
24
-
25
- ```svelte
26
- <script lang="ts">
27
- import { ShatterPane, CatchSubmit } from '@gigo-ui/components';
28
-
29
- let broken = $state(false);
30
- </script>
31
-
32
- <ShatterPane bind:isShattered={broken}>
33
- <div class="card">
34
- <h2>Fragile Content</h2>
35
- <CatchSubmit label="Submit" />
36
- </div>
37
- </ShatterPane>
38
-
39
- <button onclick={() => broken = true}>Break it</button>
40
- ```
41
-
42
- ---
43
-
44
- ## Components
45
-
46
- ### 🌪 Chaos (Destruction Overlays)
47
-
48
- Wrap any component. One function call and it's physically destroyed.
49
-
50
- | Component | Effect | Engine |
51
- | :---------------- | :------------------------------- | :------------------------------------- |
52
- | **GigoCompactor** | Voxel crush implosion | Three.js InstancedMesh + Rapier3D WASM |
53
- | **ShatterPane** | Voronoi glass fracture | Canvas2D + physics sim |
54
- | **PixelDissolve** | Per-pixel wave contagion | Canvas2D particle system |
55
- | **BlackHoleSink** | Gravitational singularity | Canvas2D warp + accretion glow |
56
- | **ChaosButton** | Button with random chaos effects | CSS transforms |
57
- | **ChaosForm** | Form that fights back | DOM manipulation |
58
-
59
- ### 😈 BadUI (Hostile Interactions)
60
-
61
- Technically functional. Emotionally devastating.
62
-
63
- | Component | What it does |
64
- | :------------------- | :---------------------------------------- |
65
- | **RotaryDial** | Rotary phone dial for number input |
66
- | **GravityInput** | Characters fall with gravity as you type |
67
- | **PasswordPeekhole** | Tiny draggable circle to view password |
68
- | **ProgressDoom** | Progress bar that regresses randomly |
69
- | **CatchSubmit** | Submit button that runs from your cursor |
70
- | **SliderPhone** | Single slider for entering phone numbers |
71
- | **GhostCard** | Cards that vanish and reappear corrupted |
72
- | **DropdownCalc** | Dropdown menus for basic arithmetic |
73
- | **VolumeSlider** | Deliberately confusing volume control |
74
- | **ColorPickerWrong** | Color picker that picks the wrong color |
75
- | **TermsSidescroll** | Terms of service in a horizontal scroller |
76
-
77
- ### 🛠 Standard (The Bait)
78
-
79
- Normal, usable components to lull users into a false sense of security.
80
-
81
- | Component | Purpose |
82
- | :------------- | :-------------- |
83
- | **Button** | Standard button |
84
- | **Card** | Content card |
85
- | **Carousel** | Image carousel |
86
- | **Form** | Form container |
87
- | **Input** | Text input |
88
- | **Modal** | Dialog overlay |
89
- | **Navigation** | Nav component |
90
-
91
- ---
92
-
93
- ## Breaker Overlays
94
-
95
- The destruction overlays are the flagship feature. They snapshot any wrapped content, then destroy it with real physics:
96
-
97
- ```svelte
98
- <script lang="ts">
99
- import { GigoCompactor } from '@gigo-ui/components';
100
-
101
- let compactor: GigoCompactor;
102
- </script>
103
-
104
- <GigoCompactor bind:this={compactor} cols={20} rows={20} intensity={8}>
105
- <div class="card">This will be voxelized</div>
106
- </GigoCompactor>
107
-
108
- <button onclick={() => compactor.crush()}>Crush</button>
109
- <button onclick={() => compactor.restore()}>Restore</button>
110
- ```
111
-
112
- Each overlay lazy-loads its engine only when triggered. Three.js, Rapier WASM, and html-to-image are all dynamically imported — zero cost until destruction begins.
113
-
114
- | Overlay | Method | Prop | Size |
115
- | :------------ | :------------------------- | :------------ | :-------------------- |
116
- | GigoCompactor | `crush()` / `restore()` | `isGarbage` | ~180KB (Three+Rapier) |
117
- | ShatterPane | `shatter()` / `restore()` | `isShattered` | ~2KB |
118
- | PixelDissolve | `dissolve()` / `restore()` | `isDead` | ~2KB |
119
- | BlackHoleSink | `consume()` / `restore()` | `isConsumed` | ~2KB |
120
-
121
- ---
122
-
123
- ## Requirements
124
-
125
- - Svelte 5.0+
126
- - SvelteKit 2.0+
127
- - Tailwind CSS 4.0+
128
- - TypeScript 5.0+
129
-
130
- ## License
131
-
132
- MIT
1
+ # 🌀 @gigo-ui/components
2
+
3
+ ### _High-Performance Components for Low-Performance Experiences._
4
+
5
+ [![Svelte](https://img.shields.io/badge/Svelte-5.0+-FF3E00?logo=svelte&logoColor=white)](https://svelte.dev)
6
+ [![SvelteKit](https://img.shields.io/badge/SvelteKit-2.0+-FF3E00?logo=svelte&logoColor=white)](https://svelte.dev)
7
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
8
+ [![Tailwind](https://img.shields.io/badge/Tailwind_CSS-4.0+-06B6D4?logo=tailwindcss&logoColor=white)](https://tailwindcss.com/)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
10
+
11
+ A Svelte 5 component library of intentionally terrible UI patterns. Every component is production-quality code implementing the worst UX ideas imaginable.
12
+
13
+ Built with modern runes (`$state`, `$derived`, `$effect`, `$bindable`), TypeScript, and Tailwind CSS 4.
14
+
15
+ ---
16
+
17
+ ## Install
18
+
19
+ ```bash
20
+ pnpm add @gigo-ui/components
21
+ ```
22
+
23
+ ## Styles (Required)
24
+
25
+ Import the package stylesheet once near your app root:
26
+
27
+ ```svelte
28
+ <script lang="ts">
29
+ import '@gigo-ui/components/globals.css';
30
+ </script>
31
+ ```
32
+
33
+ The stylesheet includes Tailwind v4 directives and `@source` scanning for this package, so utility classes used inside components are generated in consumer builds.
34
+
35
+ To customize theme tokens, override variables after importing the package CSS:
36
+
37
+ ```css
38
+ /* app.css */
39
+ @import "@gigo-ui/components/globals.css";
40
+
41
+ :root {
42
+ --primary: #2563eb;
43
+ --background: #ffffff;
44
+ --foreground: #111827;
45
+ }
46
+ ```
47
+
48
+ ## Quick Start
49
+
50
+ ```svelte
51
+ <script lang="ts">
52
+ import '@gigo-ui/components/globals.css';
53
+ import { ShatterPane, CatchSubmit } from '@gigo-ui/components';
54
+
55
+ let broken = $state(false);
56
+ </script>
57
+
58
+ <ShatterPane bind:isShattered={broken}>
59
+ <div class="card">
60
+ <h2>Fragile Content</h2>
61
+ <CatchSubmit label="Submit" />
62
+ </div>
63
+ </ShatterPane>
64
+
65
+ <button onclick={() => broken = true}>Break it</button>
66
+ ```
67
+
68
+ ---
69
+
70
+ ## Components
71
+
72
+ ### 🌪 Chaos (Destruction Overlays)
73
+
74
+ Wrap any component. One function call and it's physically destroyed.
75
+
76
+ | Component | Effect | Engine |
77
+ | :---------------- | :------------------------------- | :------------------------------------- |
78
+ | **GigoCompactor** | Voxel crush implosion | Three.js InstancedMesh + Rapier3D WASM |
79
+ | **ShatterPane** | Voronoi glass fracture | Canvas2D + physics sim |
80
+ | **PixelDissolve** | Per-pixel wave contagion | Canvas2D particle system |
81
+ | **BlackHoleSink** | Gravitational singularity | Canvas2D warp + accretion glow |
82
+ | **ChaosButton** | Button with random chaos effects | CSS transforms |
83
+ | **ChaosForm** | Form that fights back | DOM manipulation |
84
+
85
+ ### 😈 BadUI (Hostile Interactions)
86
+
87
+ Technically functional. Emotionally devastating.
88
+
89
+ | Component | What it does |
90
+ | :------------------- | :---------------------------------------- |
91
+ | **RotaryDial** | Rotary phone dial for number input |
92
+ | **GravityInput** | Characters fall with gravity as you type |
93
+ | **PasswordPeekhole** | Tiny draggable circle to view password |
94
+ | **ProgressDoom** | Progress bar that regresses randomly |
95
+ | **CatchSubmit** | Submit button that runs from your cursor |
96
+ | **SliderPhone** | Single slider for entering phone numbers |
97
+ | **GhostCard** | Cards that vanish and reappear corrupted |
98
+ | **DropdownCalc** | Dropdown menus for basic arithmetic |
99
+ | **VolumeSlider** | Deliberately confusing volume control |
100
+ | **ColorPickerWrong** | Color picker that picks the wrong color |
101
+ | **TermsSidescroll** | Terms of service in a horizontal scroller |
102
+
103
+ ### 🛠 Standard (The Bait)
104
+
105
+ Normal, usable components to lull users into a false sense of security.
106
+
107
+ | Component | Purpose |
108
+ | :------------- | :-------------- |
109
+ | **Button** | Standard button |
110
+ | **Card** | Content card |
111
+ | **Carousel** | Image carousel |
112
+ | **Form** | Form container |
113
+ | **Input** | Text input |
114
+ | **Modal** | Dialog overlay |
115
+ | **Navigation** | Nav component |
116
+
117
+ ---
118
+
119
+ ## Breaker Overlays
120
+
121
+ The destruction overlays are the flagship feature. They snapshot any wrapped content, then destroy it with real physics:
122
+
123
+ ```svelte
124
+ <script lang="ts">
125
+ import { GigoCompactor } from '@gigo-ui/components';
126
+
127
+ let compactor: GigoCompactor;
128
+ </script>
129
+
130
+ <GigoCompactor bind:this={compactor} cols={20} rows={20} intensity={8}>
131
+ <div class="card">This will be voxelized</div>
132
+ </GigoCompactor>
133
+
134
+ <button onclick={() => compactor.crush()}>Crush</button>
135
+ <button onclick={() => compactor.restore()}>Restore</button>
136
+ ```
137
+
138
+ Each overlay lazy-loads its engine only when triggered. Three.js, Rapier WASM, and html-to-image are all dynamically imported — zero cost until destruction begins.
139
+
140
+ | Overlay | Method | Prop | Size |
141
+ | :------------ | :------------------------- | :------------ | :-------------------- |
142
+ | GigoCompactor | `crush()` / `restore()` | `isGarbage` | ~180KB (Three+Rapier) |
143
+ | ShatterPane | `shatter()` / `restore()` | `isShattered` | ~2KB |
144
+ | PixelDissolve | `dissolve()` / `restore()` | `isDead` | ~2KB |
145
+ | BlackHoleSink | `consume()` / `restore()` | `isConsumed` | ~2KB |
146
+
147
+ ---
148
+
149
+ ## Requirements
150
+
151
+ - Svelte 5.0+
152
+ - SvelteKit 2.0+
153
+ - Tailwind CSS 4.0+
154
+ - TypeScript 5.0+
155
+
156
+ ## License
157
+
158
+ MIT
@@ -0,0 +1,81 @@
1
+ <!-- Black hole wrapper — singularity + accretion engine -->
2
+ <script lang="ts">
3
+ import type { Snippet } from 'svelte';
4
+ import { captureSnapshot } from '../../utils/destruction-engine.js';
5
+
6
+ export interface BlackHoleSinkProps {
7
+ isConsumed?: boolean;
8
+ resolution?: number;
9
+ intensity?: number;
10
+ glowColor?: string;
11
+ debugMode?: boolean;
12
+ class?: string;
13
+ children: Snippet;
14
+ }
15
+
16
+ let {
17
+ isConsumed = $bindable(false),
18
+ resolution = 4,
19
+ intensity = 7,
20
+ glowColor = 'rgba(255,120,0,0.7)',
21
+ debugMode = false,
22
+ class: className = '',
23
+ children,
24
+ }: BlackHoleSinkProps = $props();
25
+
26
+ let wrapper: HTMLDivElement | undefined = $state();
27
+ let snapshotData: string | null = $state(null);
28
+ let snapshotRect: DOMRect | null = $state(null);
29
+ let isCapturing = $state(false);
30
+ let EngineComponent: any = $state(null);
31
+ let hidden = $state(false);
32
+
33
+ $effect(() => {
34
+ if (isConsumed && !snapshotData && !isCapturing && wrapper) doCapture();
35
+ });
36
+
37
+ async function doCapture() {
38
+ if (!wrapper || isCapturing) return;
39
+ isCapturing = true;
40
+ try {
41
+ const result = await captureSnapshot(wrapper);
42
+ snapshotRect = result.rect;
43
+ snapshotData = result.dataURL;
44
+ hidden = true;
45
+ const mod = await import('./internal/BlackHoleEngine.svelte');
46
+ EngineComponent = mod.default;
47
+ } catch (err) {
48
+ if (debugMode) console.error('[BlackHoleSink] capture failed', err);
49
+ hidden = false;
50
+ } finally {
51
+ isCapturing = false;
52
+ }
53
+ }
54
+
55
+ export function consume() { if (wrapper) { isConsumed = true; doCapture(); } }
56
+ export function restore() {
57
+ isConsumed = false;
58
+ hidden = false; snapshotData = null; snapshotRect = null; EngineComponent = null;
59
+ }
60
+ </script>
61
+
62
+ <div
63
+ bind:this={wrapper}
64
+ class={className}
65
+ style:visibility={hidden ? 'hidden' : 'visible'}
66
+ data-gigo-blackhole="true"
67
+ >
68
+ {@render children()}
69
+ </div>
70
+
71
+ {#if EngineComponent && snapshotData && snapshotRect}
72
+ {@const Engine = EngineComponent}
73
+ <Engine
74
+ snapshot={snapshotData}
75
+ rect={snapshotRect}
76
+ {resolution}
77
+ {intensity}
78
+ {glowColor}
79
+ {debugMode}
80
+ />
81
+ {/if}
@@ -0,0 +1,16 @@
1
+ import type { Snippet } from 'svelte';
2
+ export interface BlackHoleSinkProps {
3
+ isConsumed?: boolean;
4
+ resolution?: number;
5
+ intensity?: number;
6
+ glowColor?: string;
7
+ debugMode?: boolean;
8
+ class?: string;
9
+ children: Snippet;
10
+ }
11
+ declare const BlackHoleSink: import("svelte").Component<BlackHoleSinkProps, {
12
+ consume: () => void;
13
+ restore: () => void;
14
+ }, "isConsumed">;
15
+ type BlackHoleSink = ReturnType<typeof BlackHoleSink>;
16
+ export default BlackHoleSink;
@@ -0,0 +1,103 @@
1
+
2
+ <script lang="ts">
3
+ import { onDestroy } from 'svelte';
4
+ import type { Snippet } from 'svelte';
5
+ import { captureSnapshot } from '../../utils/destruction-engine.js';
6
+
7
+ export interface GigoCompactorProps {
8
+ isGarbage?: boolean;
9
+ cols?: number;
10
+ rows?: number;
11
+ intensity?: number; // 0–10
12
+ debugMode?: boolean;
13
+ class?: string;
14
+ children: Snippet;
15
+ }
16
+
17
+ let {
18
+ isGarbage = $bindable(false),
19
+ cols = 20,
20
+ rows = 20,
21
+ intensity = 7,
22
+ debugMode = false,
23
+ class: className = '',
24
+ children,
25
+ }: GigoCompactorProps = $props();
26
+
27
+
28
+ let wrapper: HTMLDivElement | undefined = $state();
29
+ let snapshotData: string | null = $state(null);
30
+ let snapshotRect: DOMRect | null = $state(null);
31
+ let isCapturing = $state(false);
32
+ let EngineComponent: any = $state(null);
33
+ let hidden = $state(false);
34
+
35
+
36
+ $effect(() => {
37
+ if (isGarbage && !snapshotData && !isCapturing && wrapper) {
38
+ doCapture();
39
+ }
40
+ });
41
+
42
+ async function doCapture() {
43
+ if (!wrapper || isCapturing) return;
44
+ isCapturing = true;
45
+
46
+ try {
47
+ const result = await captureSnapshot(wrapper);
48
+ snapshotRect = result.rect;
49
+ snapshotData = result.dataURL;
50
+ hidden = true; // preserve layout, hide original
51
+
52
+ // Lazy-load the engine only now
53
+ const mod = await import('./internal/CompactorEngine.svelte');
54
+ EngineComponent = mod.default;
55
+ } catch (err) {
56
+ if (debugMode) console.error('[GigoCompactor] capture failed', err);
57
+ // fail-safe: show original again
58
+ hidden = false;
59
+ } finally {
60
+ isCapturing = false;
61
+ }
62
+ }
63
+
64
+ export function crush() { if (wrapper) { isGarbage = true; doCapture(); } }
65
+ export function restore() {
66
+ isGarbage = false;
67
+ hidden = false; snapshotData = null; snapshotRect = null; EngineComponent = null;
68
+ }
69
+
70
+ onDestroy(() => {
71
+ restore()
72
+ });
73
+ </script>
74
+
75
+ <!-- Original slot content — hidden once physics takes over -->
76
+ <div
77
+ bind:this={wrapper}
78
+ class={className}
79
+ style:visibility={hidden ? 'hidden' : 'visible'}
80
+ data-gigo-compactor="true"
81
+ >
82
+ {@render children()}
83
+ </div>
84
+
85
+ {#if debugMode}
86
+ <div class="
87
+ fixed inset-0 pointer-events-none z-10000
88
+ ring-2 ring-offset-[-2px] ring-red-500/60
89
+ "></div>
90
+ {/if}
91
+
92
+ <!-- Physics engine — mounted lazily after snapshot is ready -->
93
+ {#if EngineComponent && snapshotData && snapshotRect}
94
+ {@const Engine = EngineComponent}
95
+ <Engine
96
+ snapshot={snapshotData}
97
+ rect={snapshotRect}
98
+ {cols}
99
+ {rows}
100
+ {intensity}
101
+ {debugMode}
102
+ />
103
+ {/if}
@@ -0,0 +1,16 @@
1
+ import type { Snippet } from 'svelte';
2
+ export interface GigoCompactorProps {
3
+ isGarbage?: boolean;
4
+ cols?: number;
5
+ rows?: number;
6
+ intensity?: number;
7
+ debugMode?: boolean;
8
+ class?: string;
9
+ children: Snippet;
10
+ }
11
+ declare const GigoCompactor: import("svelte").Component<GigoCompactorProps, {
12
+ crush: () => void;
13
+ restore: () => void;
14
+ }, "isGarbage">;
15
+ type GigoCompactor = ReturnType<typeof GigoCompactor>;
16
+ export default GigoCompactor;
@@ -0,0 +1,81 @@
1
+ <!-- Pixel dissolve wrapper — wave contagion engine -->
2
+ <script lang="ts">
3
+ import type { Snippet } from 'svelte';
4
+ import { captureSnapshot } from '../../utils/destruction-engine.js';
5
+
6
+ export interface PixelDissolveProps {
7
+ isDead?: boolean;
8
+ resolution?: number;
9
+ waveSeed?: number;
10
+ intensity?: number;
11
+ debugMode?: boolean;
12
+ class?: string;
13
+ children: Snippet;
14
+ }
15
+
16
+ let {
17
+ isDead = $bindable(false),
18
+ resolution = 3,
19
+ waveSeed = 8,
20
+ intensity = 7,
21
+ debugMode = false,
22
+ class: className = '',
23
+ children,
24
+ }: PixelDissolveProps = $props();
25
+
26
+ let wrapper: HTMLDivElement | undefined = $state();
27
+ let snapshotData: string | null = $state(null);
28
+ let snapshotRect: DOMRect | null = $state(null);
29
+ let isCapturing = $state(false);
30
+ let EngineComponent: any = $state(null);
31
+ let hidden = $state(false);
32
+
33
+ $effect(() => {
34
+ if (isDead && !snapshotData && !isCapturing && wrapper) doCapture();
35
+ });
36
+
37
+ async function doCapture() {
38
+ if (!wrapper || isCapturing) return;
39
+ isCapturing = true;
40
+ try {
41
+ const result = await captureSnapshot(wrapper);
42
+ snapshotRect = result.rect;
43
+ snapshotData = result.dataURL;
44
+ hidden = true;
45
+ const mod = await import('./internal/PixelDissolveEngine.svelte');
46
+ EngineComponent = mod.default;
47
+ } catch (err) {
48
+ if (debugMode) console.error('[PixelDissolve] capture failed', err);
49
+ hidden = false;
50
+ } finally {
51
+ isCapturing = false;
52
+ }
53
+ }
54
+
55
+ export function dissolve() { if (wrapper) { isDead = true; doCapture(); } }
56
+ export function restore() {
57
+ isDead = false;
58
+ hidden = false; snapshotData = null; snapshotRect = null; EngineComponent = null;
59
+ }
60
+ </script>
61
+
62
+ <div
63
+ bind:this={wrapper}
64
+ class={className}
65
+ style:visibility={hidden ? 'hidden' : 'visible'}
66
+ data-gigo-dissolve="true"
67
+ >
68
+ {@render children()}
69
+ </div>
70
+
71
+ {#if EngineComponent && snapshotData && snapshotRect}
72
+ {@const Engine = EngineComponent}
73
+ <Engine
74
+ snapshot={snapshotData}
75
+ rect={snapshotRect}
76
+ {resolution}
77
+ {waveSeed}
78
+ {intensity}
79
+ {debugMode}
80
+ />
81
+ {/if}
@@ -0,0 +1,16 @@
1
+ import type { Snippet } from 'svelte';
2
+ export interface PixelDissolveProps {
3
+ isDead?: boolean;
4
+ resolution?: number;
5
+ waveSeed?: number;
6
+ intensity?: number;
7
+ debugMode?: boolean;
8
+ class?: string;
9
+ children: Snippet;
10
+ }
11
+ declare const PixelDissolve: import("svelte").Component<PixelDissolveProps, {
12
+ dissolve: () => void;
13
+ restore: () => void;
14
+ }, "isDead">;
15
+ type PixelDissolve = ReturnType<typeof PixelDissolve>;
16
+ export default PixelDissolve;