Skip to content

Extract Thanos disintegrate effect into standalone npm package #154

Description

@cursor

Summary

Extract the Thanos-style DOM disintegration effect from src/shared/ui/effects/thanosDisintegrate/ into a framework-agnostic npm package with an optional React adapter (useThanosDisintegrate).

This issue is scoped for a separate agent session. Design notes, comparison tables, and a checklist live in the repo:

Context

  • ~62 source files, 58 unit tests, first consumer is cookie consent dismiss (PR Thanos disintegrate: morpheus masks, worker offload, review hardening #153).
  • Core API: runThanosDisintegrate(element, options) + useThanosDisintegrate() hook.
  • Features: dual-layer masks (modal + particles), chunk bitmask worker with main-thread fallback, 15+ mask strategies, SnapDOM/SVG capture, ThanosDisintegrateError for explicit failures.

Recommended approach (from design doc)

Decision Recommendation
Package layout pnpm workspace package (packages/thanos-disintegrate) before separate repo
SnapDOM Optional peer dependency
React hook Separate entry: thanos-disintegrate/react
Migration Re-export shim in src/shared/ui/effects/thanosDisintegrate/ for one release cycle

Acceptance criteria

  • Package builds and tests pass independently (pnpm test in package)
  • dStruct cookie consent still works via workspace dependency or shim
  • No #/ or dStruct-specific imports in published package
  • README documents mask modes, capture backends, and error codes
  • Peer deps documented: react (optional), @zumer/snapdom (optional)

Out of scope

  • Vue/Svelte adapters
  • Publishing to npm (unless explicitly requested in follow-up)
  • Changing the visual effect behavior

Labels / hints for agent

Read .cursorrules for dStruct conventions, but the library must not depend on MUI, Redux, tRPC, or i18n. Port prefersReducedMotion as an internal utility or option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions