@pibbl/core 0.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.
- package/LICENSE.txt +19 -0
- package/README.md +76 -0
- package/THIRD_PARTY_NOTICES.txt +205 -0
- package/dist/features/particles/index.d.ts +7 -0
- package/dist/features/particles/index.js +26 -0
- package/dist/features/particles/index.js.map +7 -0
- package/dist/features/particles/index.mjs +1 -0
- package/dist/features/particles/lib/canvas/birth-ledger.d.ts +69 -0
- package/dist/features/particles/lib/canvas/birth-ledger.js +752 -0
- package/dist/features/particles/lib/canvas/birth-ledger.js.map +7 -0
- package/dist/features/particles/lib/canvas/component.d.ts +14 -0
- package/dist/features/particles/lib/canvas/component.js +249 -0
- package/dist/features/particles/lib/canvas/component.js.map +7 -0
- package/dist/features/particles/lib/canvas/executor.d.ts +31 -0
- package/dist/features/particles/lib/canvas/executor.js +537 -0
- package/dist/features/particles/lib/canvas/executor.js.map +7 -0
- package/dist/features/particles/lib/canvas/primitive.d.ts +14 -0
- package/dist/features/particles/lib/canvas/primitive.js +50 -0
- package/dist/features/particles/lib/canvas/primitive.js.map +7 -0
- package/dist/features/particles/lib/canvas/raster-cache.d.ts +13 -0
- package/dist/features/particles/lib/canvas/raster-cache.js +106 -0
- package/dist/features/particles/lib/canvas/raster-cache.js.map +7 -0
- package/dist/features/particles/lib/color.d.ts +7 -0
- package/dist/features/particles/lib/color.js +159 -0
- package/dist/features/particles/lib/color.js.map +7 -0
- package/dist/features/particles/lib/compiler.d.ts +134 -0
- package/dist/features/particles/lib/compiler.js +443 -0
- package/dist/features/particles/lib/compiler.js.map +7 -0
- package/dist/features/particles/lib/curve.d.ts +19 -0
- package/dist/features/particles/lib/curve.js +129 -0
- package/dist/features/particles/lib/curve.js.map +7 -0
- package/dist/features/particles/lib/definition-records.d.ts +58 -0
- package/dist/features/particles/lib/definition-records.js +500 -0
- package/dist/features/particles/lib/definition-records.js.map +7 -0
- package/dist/features/particles/lib/definition.d.ts +18 -0
- package/dist/features/particles/lib/definition.js +602 -0
- package/dist/features/particles/lib/definition.js.map +7 -0
- package/dist/features/particles/lib/emission.d.ts +54 -0
- package/dist/features/particles/lib/emission.js +184 -0
- package/dist/features/particles/lib/emission.js.map +7 -0
- package/dist/features/particles/lib/flow/field.d.ts +81 -0
- package/dist/features/particles/lib/flow/field.js +585 -0
- package/dist/features/particles/lib/flow/field.js.map +7 -0
- package/dist/features/particles/lib/flow/hook.d.ts +158 -0
- package/dist/features/particles/lib/flow/hook.js +215 -0
- package/dist/features/particles/lib/flow/hook.js.map +7 -0
- package/dist/features/particles/lib/flow/population.d.ts +25 -0
- package/dist/features/particles/lib/flow/population.js +104 -0
- package/dist/features/particles/lib/flow/population.js.map +7 -0
- package/dist/features/particles/lib/particle.d.ts +113 -0
- package/dist/features/particles/lib/particle.js +192 -0
- package/dist/features/particles/lib/particle.js.map +7 -0
- package/dist/features/particles/lib/random.d.ts +16 -0
- package/dist/features/particles/lib/random.js +61 -0
- package/dist/features/particles/lib/random.js.map +7 -0
- package/dist/features/particles/lib/sample.d.ts +32 -0
- package/dist/features/particles/lib/sample.js +397 -0
- package/dist/features/particles/lib/sample.js.map +7 -0
- package/dist/features/particles/lib/signal-inputs.d.ts +6 -0
- package/dist/features/particles/lib/signal-inputs.js +41 -0
- package/dist/features/particles/lib/signal-inputs.js.map +7 -0
- package/dist/features/particles/lib/system/binding.d.ts +59 -0
- package/dist/features/particles/lib/system/binding.js +122 -0
- package/dist/features/particles/lib/system/binding.js.map +7 -0
- package/dist/features/particles/lib/system/controller.d.ts +58 -0
- package/dist/features/particles/lib/system/controller.js +1446 -0
- package/dist/features/particles/lib/system/controller.js.map +7 -0
- package/dist/features/particles/lib/system/hook.d.ts +13 -0
- package/dist/features/particles/lib/system/hook.js +52 -0
- package/dist/features/particles/lib/system/hook.js.map +7 -0
- package/dist/features/particles/lib/system/ownership.d.ts +26 -0
- package/dist/features/particles/lib/system/ownership.js +128 -0
- package/dist/features/particles/lib/system/ownership.js.map +7 -0
- package/dist/features/particles/lib/types.d.ts +983 -0
- package/dist/features/physics/2d-geometry.d.ts +216 -0
- package/dist/features/physics/2d-geometry.js +59 -0
- package/dist/features/physics/2d-geometry.js.map +7 -0
- package/dist/features/physics/2d-geometry.mjs +1 -0
- package/dist/features/physics/2d-testing.d.ts +80 -0
- package/dist/features/physics/2d-testing.js +141 -0
- package/dist/features/physics/2d-testing.js.map +7 -0
- package/dist/features/physics/2d-testing.mjs +1 -0
- package/dist/features/physics/2d.d.ts +165 -0
- package/dist/features/physics/2d.js +119 -0
- package/dist/features/physics/2d.js.map +7 -0
- package/dist/features/physics/2d.mjs +1 -0
- package/dist/features/physics/lib/2d/canvas/components.d.ts +46 -0
- package/dist/features/physics/lib/2d/canvas/components.js +212 -0
- package/dist/features/physics/lib/2d/canvas/components.js.map +7 -0
- package/dist/features/physics/lib/2d/canvas/custom.d.ts +24 -0
- package/dist/features/physics/lib/2d/canvas/custom.js +45 -0
- package/dist/features/physics/lib/2d/canvas/custom.js.map +7 -0
- package/dist/features/physics/lib/2d/canvas/debug.d.ts +23 -0
- package/dist/features/physics/lib/2d/canvas/debug.js +53 -0
- package/dist/features/physics/lib/2d/canvas/debug.js.map +7 -0
- package/dist/features/physics/lib/2d/canvas/inference.d.ts +9 -0
- package/dist/features/physics/lib/2d/canvas/inference.js +704 -0
- package/dist/features/physics/lib/2d/canvas/inference.js.map +7 -0
- package/dist/features/physics/lib/2d/canvas/presentation.d.ts +11 -0
- package/dist/features/physics/lib/2d/canvas/presentation.js +169 -0
- package/dist/features/physics/lib/2d/canvas/presentation.js.map +7 -0
- package/dist/features/physics/lib/2d/collision/analytic.d.ts +15 -0
- package/dist/features/physics/lib/2d/collision/analytic.js +151 -0
- package/dist/features/physics/lib/2d/collision/analytic.js.map +7 -0
- package/dist/features/physics/lib/2d/collision/casts.d.ts +37 -0
- package/dist/features/physics/lib/2d/collision/casts.js +631 -0
- package/dist/features/physics/lib/2d/collision/casts.js.map +7 -0
- package/dist/features/physics/lib/2d/collision/epa.d.ts +21 -0
- package/dist/features/physics/lib/2d/collision/epa.js +102 -0
- package/dist/features/physics/lib/2d/collision/epa.js.map +7 -0
- package/dist/features/physics/lib/2d/collision/gjk.d.ts +28 -0
- package/dist/features/physics/lib/2d/collision/gjk.js +233 -0
- package/dist/features/physics/lib/2d/collision/gjk.js.map +7 -0
- package/dist/features/physics/lib/2d/collision/manifold.d.ts +35 -0
- package/dist/features/physics/lib/2d/collision/manifold.js +238 -0
- package/dist/features/physics/lib/2d/collision/manifold.js.map +7 -0
- package/dist/features/physics/lib/2d/collision/pairs.d.ts +10 -0
- package/dist/features/physics/lib/2d/collision/pairs.js +285 -0
- package/dist/features/physics/lib/2d/collision/pairs.js.map +7 -0
- package/dist/features/physics/lib/2d/collision/support.d.ts +20 -0
- package/dist/features/physics/lib/2d/collision/support.js +155 -0
- package/dist/features/physics/lib/2d/collision/support.js.map +7 -0
- package/dist/features/physics/lib/2d/inspection-types.d.ts +159 -0
- package/dist/features/physics/lib/2d/math.d.ts +27 -0
- package/dist/features/physics/lib/2d/math.js +314 -0
- package/dist/features/physics/lib/2d/math.js.map +7 -0
- package/dist/features/physics/lib/2d/numeric-policy.d.ts +24 -0
- package/dist/features/physics/lib/2d/numeric-policy.js +51 -0
- package/dist/features/physics/lib/2d/numeric-policy.js.map +7 -0
- package/dist/features/physics/lib/2d/runtime/body-handle.d.ts +148 -0
- package/dist/features/physics/lib/2d/runtime/body-handle.js +305 -0
- package/dist/features/physics/lib/2d/runtime/body-handle.js.map +7 -0
- package/dist/features/physics/lib/2d/runtime/context.d.ts +9 -0
- package/dist/features/physics/lib/2d/runtime/context.js +57 -0
- package/dist/features/physics/lib/2d/runtime/context.js.map +7 -0
- package/dist/features/physics/lib/2d/runtime/controller.d.ts +106 -0
- package/dist/features/physics/lib/2d/runtime/controller.js +1317 -0
- package/dist/features/physics/lib/2d/runtime/controller.js.map +7 -0
- package/dist/features/physics/lib/2d/runtime/descriptors.d.ts +153 -0
- package/dist/features/physics/lib/2d/runtime/descriptors.js +526 -0
- package/dist/features/physics/lib/2d/runtime/descriptors.js.map +7 -0
- package/dist/features/physics/lib/2d/runtime/events.d.ts +56 -0
- package/dist/features/physics/lib/2d/runtime/events.js +153 -0
- package/dist/features/physics/lib/2d/runtime/events.js.map +7 -0
- package/dist/features/physics/lib/2d/runtime/obstacles.d.ts +22 -0
- package/dist/features/physics/lib/2d/runtime/obstacles.js +192 -0
- package/dist/features/physics/lib/2d/runtime/obstacles.js.map +7 -0
- package/dist/features/physics/lib/2d/runtime/ownership.d.ts +41 -0
- package/dist/features/physics/lib/2d/runtime/ownership.js +46 -0
- package/dist/features/physics/lib/2d/runtime/ownership.js.map +7 -0
- package/dist/features/physics/lib/2d/runtime/trace.d.ts +32 -0
- package/dist/features/physics/lib/2d/runtime/trace.js +22 -0
- package/dist/features/physics/lib/2d/runtime/trace.js.map +7 -0
- package/dist/features/physics/lib/2d/runtime/world-component.d.ts +18 -0
- package/dist/features/physics/lib/2d/runtime/world-component.js +41 -0
- package/dist/features/physics/lib/2d/runtime/world-component.js.map +7 -0
- package/dist/features/physics/lib/2d/runtime/world-props.d.ts +16 -0
- package/dist/features/physics/lib/2d/shape-records.d.ts +60 -0
- package/dist/features/physics/lib/2d/shape-records.js +26 -0
- package/dist/features/physics/lib/2d/shape-records.js.map +7 -0
- package/dist/features/physics/lib/2d/shapes.d.ts +191 -0
- package/dist/features/physics/lib/2d/shapes.js +543 -0
- package/dist/features/physics/lib/2d/shapes.js.map +7 -0
- package/dist/features/physics/lib/2d/types.d.ts +713 -0
- package/dist/features/physics/lib/2d/types.js +1 -0
- package/dist/features/physics/lib/2d/types.js.map +7 -0
- package/dist/features/physics/lib/2d/world/broad-phase.d.ts +77 -0
- package/dist/features/physics/lib/2d/world/broad-phase.js +762 -0
- package/dist/features/physics/lib/2d/world/broad-phase.js.map +7 -0
- package/dist/features/physics/lib/2d/world/ccd.d.ts +19 -0
- package/dist/features/physics/lib/2d/world/ccd.js +265 -0
- package/dist/features/physics/lib/2d/world/ccd.js.map +7 -0
- package/dist/features/physics/lib/2d/world/contact-cache.d.ts +81 -0
- package/dist/features/physics/lib/2d/world/contact-cache.js +497 -0
- package/dist/features/physics/lib/2d/world/contact-cache.js.map +7 -0
- package/dist/features/physics/lib/2d/world/integrator.d.ts +11 -0
- package/dist/features/physics/lib/2d/world/integrator.js +99 -0
- package/dist/features/physics/lib/2d/world/integrator.js.map +7 -0
- package/dist/features/physics/lib/2d/world/queries.d.ts +62 -0
- package/dist/features/physics/lib/2d/world/queries.js +424 -0
- package/dist/features/physics/lib/2d/world/queries.js.map +7 -0
- package/dist/features/physics/lib/2d/world/rapier-engine.js +7054 -0
- package/dist/features/physics/lib/2d/world/rapier-engine.js.map +7 -0
- package/dist/features/physics/lib/2d/world/rapier.d.ts +50 -0
- package/dist/features/physics/lib/2d/world/rapier.js +655 -0
- package/dist/features/physics/lib/2d/world/rapier.js.map +7 -0
- package/dist/features/physics/lib/2d/world/solver.d.ts +58 -0
- package/dist/features/physics/lib/2d/world/solver.js +660 -0
- package/dist/features/physics/lib/2d/world/solver.js.map +7 -0
- package/dist/features/physics/lib/2d/world/storage.d.ts +96 -0
- package/dist/features/physics/lib/2d/world/storage.js +371 -0
- package/dist/features/physics/lib/2d/world/storage.js.map +7 -0
- package/dist/features/physics/lib/2d/world/world.d.ts +265 -0
- package/dist/features/physics/lib/2d/world/world.js +1713 -0
- package/dist/features/physics/lib/2d/world/world.js.map +7 -0
- package/dist/features/physics/lib/shared/signal-inputs.d.ts +5 -0
- package/dist/features/physics/lib/shared/signal-inputs.js +20 -0
- package/dist/features/physics/lib/shared/signal-inputs.js.map +7 -0
- package/dist/features/physics/lib/shared/validation.d.ts +5 -0
- package/dist/features/physics/lib/shared/validation.js +48 -0
- package/dist/features/physics/lib/shared/validation.js.map +7 -0
- package/dist/features/sprites/formats/aseprite.js +23 -0
- package/dist/features/sprites/formats/aseprite.js.map +7 -0
- package/dist/features/sprites/formats/aseprite.mjs +1 -0
- package/dist/features/sprites/formats/texture-packer.js +14 -0
- package/dist/features/sprites/formats/texture-packer.js.map +7 -0
- package/dist/features/sprites/formats/texture-packer.mjs +1 -0
- package/dist/features/sprites/index.js +9 -0
- package/dist/features/sprites/index.js.map +7 -0
- package/dist/features/sprites/index.mjs +1 -0
- package/dist/features/sprites/loader.js +63 -0
- package/dist/features/sprites/loader.js.map +7 -0
- package/dist/features/sprites/model.js +64 -0
- package/dist/features/sprites/model.js.map +7 -0
- package/dist/features/sprites/sprite.js +31 -0
- package/dist/features/sprites/sprite.js.map +7 -0
- package/dist/features/textures/index.d.ts +22 -0
- package/dist/features/textures/index.js +31 -0
- package/dist/features/textures/index.js.map +7 -0
- package/dist/features/textures/index.mjs +1 -0
- package/dist/features/textures/lib/definitions.d.ts +117 -0
- package/dist/features/textures/lib/definitions.js +179 -0
- package/dist/features/textures/lib/definitions.js.map +7 -0
- package/dist/features/textures/lib/electric-boundary.d.ts +3 -0
- package/dist/features/textures/lib/electric-boundary.js +11 -0
- package/dist/features/textures/lib/electric-boundary.js.map +7 -0
- package/dist/features/textures/lib/electric-shared.d.ts +69 -0
- package/dist/features/textures/lib/electric-shared.js +43 -0
- package/dist/features/textures/lib/electric-shared.js.map +7 -0
- package/dist/features/textures/lib/electric-sources.d.ts +50 -0
- package/dist/features/textures/lib/electric-sources.js +43 -0
- package/dist/features/textures/lib/electric-sources.js.map +7 -0
- package/dist/features/textures/lib/lightning.d.ts +72 -0
- package/dist/features/textures/lib/lightning.js +139 -0
- package/dist/features/textures/lib/lightning.js.map +7 -0
- package/dist/features/textures/lib/material-field.d.ts +12 -0
- package/dist/features/textures/lib/material-field.js +31 -0
- package/dist/features/textures/lib/material-field.js.map +7 -0
- package/dist/features/textures/lib/palette.d.ts +45 -0
- package/dist/features/textures/lib/palette.js +52 -0
- package/dist/features/textures/lib/palette.js.map +7 -0
- package/dist/features/textures/lib/presentation.d.ts +54 -0
- package/dist/features/textures/lib/presentation.js +83 -0
- package/dist/features/textures/lib/presentation.js.map +7 -0
- package/dist/features/textures/lib/procedural-texture.d.ts +44 -0
- package/dist/features/textures/lib/procedural-texture.js +110 -0
- package/dist/features/textures/lib/procedural-texture.js.map +7 -0
- package/dist/features/textures/lib/rain-drops.d.ts +96 -0
- package/dist/features/textures/lib/rain-drops.js +322 -0
- package/dist/features/textures/lib/rain-drops.js.map +7 -0
- package/dist/features/textures/lib/reaction-diffusion.d.ts +67 -0
- package/dist/features/textures/lib/reaction-diffusion.js +210 -0
- package/dist/features/textures/lib/reaction-diffusion.js.map +7 -0
- package/dist/features/textures/lib/simulation.d.ts +16 -0
- package/dist/features/textures/lib/simulation.js +85 -0
- package/dist/features/textures/lib/simulation.js.map +7 -0
- package/dist/features/textures/lib/tendrils.d.ts +57 -0
- package/dist/features/textures/lib/tendrils.js +216 -0
- package/dist/features/textures/lib/tendrils.js.map +7 -0
- package/dist/features/textures/lib/wasm/cellular-bytes.d.ts +1 -0
- package/dist/features/textures/lib/wasm/cellular-bytes.js +5 -0
- package/dist/features/textures/lib/wasm/cellular-bytes.js.map +7 -0
- package/dist/features/textures/lib/wasm/electric.d.ts +88 -0
- package/dist/features/textures/lib/wasm/electric.js +299 -0
- package/dist/features/textures/lib/wasm/electric.js.map +7 -0
- package/dist/features/textures/lib/wasm/ink-bytes.d.ts +1 -0
- package/dist/features/textures/lib/wasm/ink-bytes.js +5 -0
- package/dist/features/textures/lib/wasm/ink-bytes.js.map +7 -0
- package/dist/features/textures/lib/wasm/lightning-bytes.d.ts +1 -0
- package/dist/features/textures/lib/wasm/lightning-bytes.js +5 -0
- package/dist/features/textures/lib/wasm/lightning-bytes.js.map +7 -0
- package/dist/features/textures/lib/wasm/marble-bytes.d.ts +1 -0
- package/dist/features/textures/lib/wasm/marble-bytes.js +5 -0
- package/dist/features/textures/lib/wasm/marble-bytes.js.map +7 -0
- package/dist/features/textures/lib/wasm/memory.d.ts +31 -0
- package/dist/features/textures/lib/wasm/memory.js +103 -0
- package/dist/features/textures/lib/wasm/memory.js.map +7 -0
- package/dist/features/textures/lib/wasm/paper-bytes.d.ts +1 -0
- package/dist/features/textures/lib/wasm/paper-bytes.js +5 -0
- package/dist/features/textures/lib/wasm/paper-bytes.js.map +7 -0
- package/dist/features/textures/lib/wasm/tendrils-bytes.d.ts +1 -0
- package/dist/features/textures/lib/wasm/tendrils-bytes.js +5 -0
- package/dist/features/textures/lib/wasm/tendrils-bytes.js.map +7 -0
- package/dist/features/textures/lib/wasm/water-surface-bytes.d.ts +1 -0
- package/dist/features/textures/lib/wasm/water-surface-bytes.js +5 -0
- package/dist/features/textures/lib/wasm/water-surface-bytes.js.map +7 -0
- package/dist/features/textures/lib/wasm/water-waves-bytes.d.ts +1 -0
- package/dist/features/textures/lib/wasm/water-waves-bytes.js +5 -0
- package/dist/features/textures/lib/wasm/water-waves-bytes.js.map +7 -0
- package/dist/features/textures/lib/water-surface.d.ts +92 -0
- package/dist/features/textures/lib/water-surface.js +378 -0
- package/dist/features/textures/lib/water-surface.js.map +7 -0
- package/dist/features/textures/lib/water-waves.d.ts +60 -0
- package/dist/features/textures/lib/water-waves.js +154 -0
- package/dist/features/textures/lib/water-waves.js.map +7 -0
- package/dist/features/viz/index.d.ts +28 -0
- package/dist/features/viz/index.js +45 -0
- package/dist/features/viz/index.js.map +7 -0
- package/dist/features/viz/index.mjs +1 -0
- package/dist/features/viz/lib/anchored-layout.d.ts +104 -0
- package/dist/features/viz/lib/anchored-layout.js +166 -0
- package/dist/features/viz/lib/anchored-layout.js.map +7 -0
- package/dist/features/viz/lib/axis.d.ts +10 -0
- package/dist/features/viz/lib/axis.js +116 -0
- package/dist/features/viz/lib/axis.js.map +7 -0
- package/dist/features/viz/lib/band-scale.d.ts +3 -0
- package/dist/features/viz/lib/band-scale.js +57 -0
- package/dist/features/viz/lib/band-scale.js.map +7 -0
- package/dist/features/viz/lib/bar-fill.d.ts +16 -0
- package/dist/features/viz/lib/bar-fill.js +53 -0
- package/dist/features/viz/lib/bar-fill.js.map +7 -0
- package/dist/features/viz/lib/bar-series.d.ts +150 -0
- package/dist/features/viz/lib/bar-series.js +152 -0
- package/dist/features/viz/lib/bar-series.js.map +7 -0
- package/dist/features/viz/lib/hover-card.d.ts +92 -0
- package/dist/features/viz/lib/hover-card.js +146 -0
- package/dist/features/viz/lib/hover-card.js.map +7 -0
- package/dist/features/viz/lib/hover-data.d.ts +12 -0
- package/dist/features/viz/lib/hover-data.js +50 -0
- package/dist/features/viz/lib/hover-data.js.map +7 -0
- package/dist/features/viz/lib/hover-placement.d.ts +46 -0
- package/dist/features/viz/lib/hover-placement.js +51 -0
- package/dist/features/viz/lib/hover-placement.js.map +7 -0
- package/dist/features/viz/lib/hover-queries.d.ts +60 -0
- package/dist/features/viz/lib/hover-queries.js +185 -0
- package/dist/features/viz/lib/hover-queries.js.map +7 -0
- package/dist/features/viz/lib/hover-types.d.ts +277 -0
- package/dist/features/viz/lib/layout-pie.d.ts +13 -0
- package/dist/features/viz/lib/layout-pie.js +159 -0
- package/dist/features/viz/lib/layout-pie.js.map +7 -0
- package/dist/features/viz/lib/line-series.d.ts +11 -0
- package/dist/features/viz/lib/line-series.js +89 -0
- package/dist/features/viz/lib/line-series.js.map +7 -0
- package/dist/features/viz/lib/linear-scale.d.ts +3 -0
- package/dist/features/viz/lib/linear-scale.js +70 -0
- package/dist/features/viz/lib/linear-scale.js.map +7 -0
- package/dist/features/viz/lib/nearest.d.ts +82 -0
- package/dist/features/viz/lib/nearest.js +51 -0
- package/dist/features/viz/lib/nearest.js.map +7 -0
- package/dist/features/viz/lib/paint.d.ts +2 -0
- package/dist/features/viz/lib/paint.js +17 -0
- package/dist/features/viz/lib/paint.js.map +7 -0
- package/dist/features/viz/lib/pie-layout.d.ts +31 -0
- package/dist/features/viz/lib/pie-layout.js +324 -0
- package/dist/features/viz/lib/pie-layout.js.map +7 -0
- package/dist/features/viz/lib/pie-slices.d.ts +51 -0
- package/dist/features/viz/lib/pie-slices.js +50 -0
- package/dist/features/viz/lib/pie-slices.js.map +7 -0
- package/dist/features/viz/lib/pie-types.d.ts +215 -0
- package/dist/features/viz/lib/plot-series.d.ts +13 -0
- package/dist/features/viz/lib/plot-series.js +53 -0
- package/dist/features/viz/lib/plot-series.js.map +7 -0
- package/dist/features/viz/lib/plot-types.d.ts +63 -0
- package/dist/features/viz/lib/point-data.d.ts +5 -0
- package/dist/features/viz/lib/point-data.js +17 -0
- package/dist/features/viz/lib/point-data.js.map +7 -0
- package/dist/features/viz/lib/point-geometry.d.ts +2 -0
- package/dist/features/viz/lib/point-geometry.js +24 -0
- package/dist/features/viz/lib/point-geometry.js.map +7 -0
- package/dist/features/viz/lib/point-series.d.ts +11 -0
- package/dist/features/viz/lib/point-series.js +118 -0
- package/dist/features/viz/lib/point-series.js.map +7 -0
- package/dist/features/viz/lib/point-types.d.ts +94 -0
- package/dist/features/viz/lib/scale-adjust.d.ts +11 -0
- package/dist/features/viz/lib/scale-adjust.js +25 -0
- package/dist/features/viz/lib/scale-adjust.js.map +7 -0
- package/dist/features/viz/lib/scale-context.d.ts +8 -0
- package/dist/features/viz/lib/scale-context.js +61 -0
- package/dist/features/viz/lib/scale-context.js.map +7 -0
- package/dist/features/viz/lib/scale.d.ts +11 -0
- package/dist/features/viz/lib/scale.js +80 -0
- package/dist/features/viz/lib/scale.js.map +7 -0
- package/dist/features/viz/lib/types.d.ts +414 -0
- package/dist/features/viz/lib/use-scale.d.ts +20 -0
- package/dist/features/viz/lib/use-scale.js +10 -0
- package/dist/features/viz/lib/use-scale.js.map +7 -0
- package/dist/filters/displacement-gpu.d.ts +38 -0
- package/dist/filters/displacement-gpu.js +243 -0
- package/dist/filters/displacement-gpu.js.map +7 -0
- package/dist/filters/displacement-math.d.ts +5 -0
- package/dist/filters/displacement-math.js +22 -0
- package/dist/filters/displacement-math.js.map +7 -0
- package/dist/filters/displacement.d.ts +13 -0
- package/dist/filters/displacement.js +65 -0
- package/dist/filters/displacement.js.map +7 -0
- package/dist/filters/filter-executor.d.ts +21 -0
- package/dist/filters/filter-executor.js +120 -0
- package/dist/filters/filter-executor.js.map +7 -0
- package/dist/filters/native-canvas-filter.d.ts +4 -0
- package/dist/filters/native-canvas-filter.js +105 -0
- package/dist/filters/native-canvas-filter.js.map +7 -0
- package/dist/filters/native-color.d.ts +2 -0
- package/dist/filters/native-color.js +200 -0
- package/dist/filters/native-color.js.map +7 -0
- package/dist/filters/native-operations.d.ts +8 -0
- package/dist/filters/native-operations.js +7 -0
- package/dist/filters/native-operations.js.map +7 -0
- package/dist/filters/native.d.ts +113 -0
- package/dist/filters/native.js +115 -0
- package/dist/filters/native.js.map +7 -0
- package/dist/filters/reflected-light.d.ts +12 -0
- package/dist/filters/reflected-light.js +93 -0
- package/dist/filters/reflected-light.js.map +7 -0
- package/dist/filters/reflection-gpu.d.ts +58 -0
- package/dist/filters/reflection-gpu.js +266 -0
- package/dist/filters/reflection-gpu.js.map +7 -0
- package/dist/filters/render-displacement-boundary.d.ts +12 -0
- package/dist/filters/render-displacement-boundary.js +116 -0
- package/dist/filters/render-displacement-boundary.js.map +7 -0
- package/dist/filters/render-reflection-boundary.d.ts +15 -0
- package/dist/filters/render-reflection-boundary.js +127 -0
- package/dist/filters/render-reflection-boundary.js.map +7 -0
- package/dist/filters.d.ts +5 -0
- package/dist/filters.js +29 -0
- package/dist/filters.js.map +7 -0
- package/dist/filters.mjs +1 -0
- package/dist/index.d.ts +111 -0
- package/dist/index.js +300 -0
- package/dist/index.js.map +7 -0
- package/dist/index.mjs +1 -0
- package/dist/internal.d.ts +160 -0
- package/dist/internal.js +320 -0
- package/dist/internal.js.map +7 -0
- package/dist/internal.mjs +1 -0
- package/dist/jsx-dev-runtime.d.ts +35 -0
- package/dist/jsx-dev-runtime.js +6 -0
- package/dist/jsx-dev-runtime.js.map +7 -0
- package/dist/jsx-dev-runtime.mjs +1 -0
- package/dist/jsx-runtime.d.ts +35 -0
- package/dist/jsx-runtime.js +7 -0
- package/dist/jsx-runtime.js.map +7 -0
- package/dist/jsx-runtime.mjs +1 -0
- package/dist/lib/animation/definition.d.ts +140 -0
- package/dist/lib/animation/definition.js +605 -0
- package/dist/lib/animation/definition.js.map +7 -0
- package/dist/lib/animation/easing.d.ts +55 -0
- package/dist/lib/animation/easing.js +112 -0
- package/dist/lib/animation/easing.js.map +7 -0
- package/dist/lib/animation/evaluate.d.ts +118 -0
- package/dist/lib/animation/evaluate.js +2398 -0
- package/dist/lib/animation/evaluate.js.map +7 -0
- package/dist/lib/animation/playback.d.ts +30 -0
- package/dist/lib/animation/playback.js +932 -0
- package/dist/lib/animation/playback.js.map +7 -0
- package/dist/lib/animation/program.d.ts +145 -0
- package/dist/lib/animation/program.js +741 -0
- package/dist/lib/animation/program.js.map +7 -0
- package/dist/lib/animation/spring.d.ts +30 -0
- package/dist/lib/animation/spring.js +324 -0
- package/dist/lib/animation/spring.js.map +7 -0
- package/dist/lib/animation/types.d.ts +418 -0
- package/dist/lib/animation/writer-leases.d.ts +47 -0
- package/dist/lib/animation/writer-leases.js +314 -0
- package/dist/lib/animation/writer-leases.js.map +7 -0
- package/dist/lib/backend/canvas-2d-backend.d.ts +4 -0
- package/dist/lib/backend/canvas-2d-backend.js +97 -0
- package/dist/lib/backend/canvas-2d-backend.js.map +7 -0
- package/dist/lib/backend/types.d.ts +309 -0
- package/dist/lib/backend/types.js +26 -0
- package/dist/lib/backend/types.js.map +7 -0
- package/dist/lib/components/arc-geometry.d.ts +4 -0
- package/dist/lib/components/arc-geometry.js +46 -0
- package/dist/lib/components/arc-geometry.js.map +7 -0
- package/dist/lib/components/arc.d.ts +55 -0
- package/dist/lib/components/arc.js +91 -0
- package/dist/lib/components/arc.js.map +7 -0
- package/dist/lib/components/circle.d.ts +49 -0
- package/dist/lib/components/circle.js +46 -0
- package/dist/lib/components/circle.js.map +7 -0
- package/dist/lib/components/clip.d.ts +43 -0
- package/dist/lib/components/clip.js +24 -0
- package/dist/lib/components/clip.js.map +7 -0
- package/dist/lib/components/ellipse.d.ts +53 -0
- package/dist/lib/components/ellipse.js +59 -0
- package/dist/lib/components/ellipse.js.map +7 -0
- package/dist/lib/components/g.d.ts +56 -0
- package/dist/lib/components/g.js +24 -0
- package/dist/lib/components/g.js.map +7 -0
- package/dist/lib/components/horizontal-line.d.ts +56 -0
- package/dist/lib/components/horizontal-line.js +71 -0
- package/dist/lib/components/horizontal-line.js.map +7 -0
- package/dist/lib/components/html-box.d.ts +16 -0
- package/dist/lib/components/html-box.js +57 -0
- package/dist/lib/components/html-box.js.map +7 -0
- package/dist/lib/components/img.d.ts +24 -0
- package/dist/lib/components/img.js +150 -0
- package/dist/lib/components/img.js.map +7 -0
- package/dist/lib/components/layer-node-equality.d.ts +65 -0
- package/dist/lib/components/layer-node-equality.js +91 -0
- package/dist/lib/components/layer-node-equality.js.map +7 -0
- package/dist/lib/components/layer.d.ts +34 -0
- package/dist/lib/components/layer.js +172 -0
- package/dist/lib/components/layer.js.map +7 -0
- package/dist/lib/components/line.d.ts +51 -0
- package/dist/lib/components/line.js +76 -0
- package/dist/lib/components/line.js.map +7 -0
- package/dist/lib/components/path.d.ts +28 -0
- package/dist/lib/components/path.js +47 -0
- package/dist/lib/components/path.js.map +7 -0
- package/dist/lib/components/polygon.d.ts +45 -0
- package/dist/lib/components/polygon.js +93 -0
- package/dist/lib/components/polygon.js.map +7 -0
- package/dist/lib/components/rect.d.ts +24 -0
- package/dist/lib/components/rect.js +83 -0
- package/dist/lib/components/rect.js.map +7 -0
- package/dist/lib/components/regular-polygon.d.ts +102 -0
- package/dist/lib/components/regular-polygon.js +112 -0
- package/dist/lib/components/regular-polygon.js.map +7 -0
- package/dist/lib/components/rounded-corner-style.d.ts +7 -0
- package/dist/lib/components/rounded-corner-style.js +40 -0
- package/dist/lib/components/rounded-corner-style.js.map +7 -0
- package/dist/lib/components/shape-style.d.ts +7 -0
- package/dist/lib/components/shape-style.js +52 -0
- package/dist/lib/components/shape-style.js.map +7 -0
- package/dist/lib/components/star.d.ts +56 -0
- package/dist/lib/components/star.js +98 -0
- package/dist/lib/components/star.js.map +7 -0
- package/dist/lib/components/structural-events.d.ts +10 -0
- package/dist/lib/components/structural-events.js +8 -0
- package/dist/lib/components/structural-events.js.map +7 -0
- package/dist/lib/components/svg-path.d.ts +23 -0
- package/dist/lib/components/svg-path.js +25 -0
- package/dist/lib/components/svg-path.js.map +7 -0
- package/dist/lib/components/text-layout.d.ts +31 -0
- package/dist/lib/components/text-layout.js +139 -0
- package/dist/lib/components/text-layout.js.map +7 -0
- package/dist/lib/components/text.d.ts +29 -0
- package/dist/lib/components/text.js +174 -0
- package/dist/lib/components/text.js.map +7 -0
- package/dist/lib/components/vertical-line.d.ts +57 -0
- package/dist/lib/components/vertical-line.js +71 -0
- package/dist/lib/components/vertical-line.js.map +7 -0
- package/dist/lib/components/wedge.d.ts +55 -0
- package/dist/lib/components/wedge.js +93 -0
- package/dist/lib/components/wedge.js.map +7 -0
- package/dist/lib/define-primitive.d.ts +82 -0
- package/dist/lib/define-primitive.js +85 -0
- package/dist/lib/define-primitive.js.map +7 -0
- package/dist/lib/development.d.ts +2 -0
- package/dist/lib/development.js +5 -0
- package/dist/lib/development.js.map +7 -0
- package/dist/lib/element/children.d.ts +16 -0
- package/dist/lib/element/children.js +333 -0
- package/dist/lib/element/children.js.map +7 -0
- package/dist/lib/element/create-element.d.ts +34 -0
- package/dist/lib/element/create-element.js +75 -0
- package/dist/lib/element/create-element.js.map +7 -0
- package/dist/lib/element/fragment.d.ts +15 -0
- package/dist/lib/element/fragment.js +11 -0
- package/dist/lib/element/fragment.js.map +7 -0
- package/dist/lib/element/jsx-runtime.d.ts +48 -0
- package/dist/lib/element/jsx-runtime.js +16 -0
- package/dist/lib/element/jsx-runtime.js.map +7 -0
- package/dist/lib/element/metadata.d.ts +96 -0
- package/dist/lib/element/metadata.js +160 -0
- package/dist/lib/element/metadata.js.map +7 -0
- package/dist/lib/element/resolve-primitive-inputs.d.ts +12 -0
- package/dist/lib/element/resolve-primitive-inputs.js +83 -0
- package/dist/lib/element/resolve-primitive-inputs.js.map +7 -0
- package/dist/lib/element/types.d.ts +123 -0
- package/dist/lib/element-enhancers.d.ts +134 -0
- package/dist/lib/element-enhancers.js +193 -0
- package/dist/lib/element-enhancers.js.map +7 -0
- package/dist/lib/events/adapters/clipboard.d.ts +9 -0
- package/dist/lib/events/adapters/clipboard.js +23 -0
- package/dist/lib/events/adapters/clipboard.js.map +7 -0
- package/dist/lib/events/adapters/drag.d.ts +12 -0
- package/dist/lib/events/adapters/drag.js +29 -0
- package/dist/lib/events/adapters/drag.js.map +7 -0
- package/dist/lib/events/adapters/editing.d.ts +15 -0
- package/dist/lib/events/adapters/editing.js +41 -0
- package/dist/lib/events/adapters/editing.js.map +7 -0
- package/dist/lib/events/adapters/keyboard-focus.d.ts +12 -0
- package/dist/lib/events/adapters/keyboard-focus.js +36 -0
- package/dist/lib/events/adapters/keyboard-focus.js.map +7 -0
- package/dist/lib/events/adapters/mouse.d.ts +17 -0
- package/dist/lib/events/adapters/mouse.js +32 -0
- package/dist/lib/events/adapters/mouse.js.map +7 -0
- package/dist/lib/events/adapters/pointer.d.ts +19 -0
- package/dist/lib/events/adapters/pointer.js +40 -0
- package/dist/lib/events/adapters/pointer.js.map +7 -0
- package/dist/lib/events/adapters/touch.d.ts +16 -0
- package/dist/lib/events/adapters/touch.js +36 -0
- package/dist/lib/events/adapters/touch.js.map +7 -0
- package/dist/lib/events/adapters/wheel.d.ts +10 -0
- package/dist/lib/events/adapters/wheel.js +16 -0
- package/dist/lib/events/adapters/wheel.js.map +7 -0
- package/dist/lib/events/boundary-transitions.d.ts +9 -0
- package/dist/lib/events/boundary-transitions.js +16 -0
- package/dist/lib/events/boundary-transitions.js.map +7 -0
- package/dist/lib/events/dispatch.d.ts +21 -0
- package/dist/lib/events/dispatch.js +1078 -0
- package/dist/lib/events/dispatch.js.map +7 -0
- package/dist/lib/events/event-definitions.d.ts +23 -0
- package/dist/lib/events/event-definitions.js +74 -0
- package/dist/lib/events/event-definitions.js.map +7 -0
- package/dist/lib/events/event-facade.d.ts +19 -0
- package/dist/lib/events/event-facade.js +188 -0
- package/dist/lib/events/event-facade.js.map +7 -0
- package/dist/lib/events/event-path.d.ts +3 -0
- package/dist/lib/events/event-path.js +43 -0
- package/dist/lib/events/event-path.js.map +7 -0
- package/dist/lib/events/hit-test.d.ts +13 -0
- package/dist/lib/events/hit-test.js +135 -0
- package/dist/lib/events/hit-test.js.map +7 -0
- package/dist/lib/events/native-listener-hub.d.ts +10 -0
- package/dist/lib/events/native-listener-hub.js +72 -0
- package/dist/lib/events/native-listener-hub.js.map +7 -0
- package/dist/lib/events/paint-entry.d.ts +66 -0
- package/dist/lib/events/paint-entry.js +30 -0
- package/dist/lib/events/paint-entry.js.map +7 -0
- package/dist/lib/events/pointer-capture.d.ts +23 -0
- package/dist/lib/events/pointer-capture.js +339 -0
- package/dist/lib/events/pointer-capture.js.map +7 -0
- package/dist/lib/events/propagation.d.ts +7 -0
- package/dist/lib/events/propagation.js +56 -0
- package/dist/lib/events/propagation.js.map +7 -0
- package/dist/lib/events/registrations.d.ts +120 -0
- package/dist/lib/events/registrations.js +397 -0
- package/dist/lib/events/registrations.js.map +7 -0
- package/dist/lib/events/resolver-input.d.ts +25 -0
- package/dist/lib/events/resolver-input.js +62 -0
- package/dist/lib/events/resolver-input.js.map +7 -0
- package/dist/lib/events/types.d.ts +596 -0
- package/dist/lib/execute-render.d.ts +9 -0
- package/dist/lib/execute-render.js +195 -0
- package/dist/lib/execute-render.js.map +7 -0
- package/dist/lib/filter/canvas-state.d.ts +2 -0
- package/dist/lib/filter/canvas-state.js +31 -0
- package/dist/lib/filter/canvas-state.js.map +7 -0
- package/dist/lib/filter/filter-region.d.ts +33 -0
- package/dist/lib/filter/filter-region.js +291 -0
- package/dist/lib/filter/filter-region.js.map +7 -0
- package/dist/lib/filter/filter-surface-pool.d.ts +38 -0
- package/dist/lib/filter/filter-surface-pool.js +252 -0
- package/dist/lib/filter/filter-surface-pool.js.map +7 -0
- package/dist/lib/filter/render-filter-boundary.d.ts +14 -0
- package/dist/lib/filter/render-filter-boundary.js +211 -0
- package/dist/lib/filter/render-filter-boundary.js.map +7 -0
- package/dist/lib/focus/directional-navigation.d.ts +12 -0
- package/dist/lib/focus/directional-navigation.js +86 -0
- package/dist/lib/focus/directional-navigation.js.map +7 -0
- package/dist/lib/focus/dom-focus-host.d.ts +13 -0
- package/dist/lib/focus/dom-focus-host.js +352 -0
- package/dist/lib/focus/dom-focus-host.js.map +7 -0
- package/dist/lib/focus/dom-tab-stops.d.ts +3 -0
- package/dist/lib/focus/dom-tab-stops.js +71 -0
- package/dist/lib/focus/dom-tab-stops.js.map +7 -0
- package/dist/lib/focus/focus-events.d.ts +4 -0
- package/dist/lib/focus/focus-events.js +78 -0
- package/dist/lib/focus/focus-events.js.map +7 -0
- package/dist/lib/focus/focus-manager.d.ts +121 -0
- package/dist/lib/focus/focus-manager.js +1131 -0
- package/dist/lib/focus/focus-manager.js.map +7 -0
- package/dist/lib/focus/geometry.d.ts +4 -0
- package/dist/lib/focus/geometry.js +64 -0
- package/dist/lib/focus/geometry.js.map +7 -0
- package/dist/lib/focus/html-focus-region.d.ts +27 -0
- package/dist/lib/focus/keyboard-defaults.d.ts +7 -0
- package/dist/lib/focus/keyboard-defaults.js +110 -0
- package/dist/lib/focus/keyboard-defaults.js.map +7 -0
- package/dist/lib/focus/policy-components.d.ts +45 -0
- package/dist/lib/focus/policy-components.js +94 -0
- package/dist/lib/focus/policy-components.js.map +7 -0
- package/dist/lib/focus/types.d.ts +37 -0
- package/dist/lib/focus/types.js +7 -0
- package/dist/lib/focus/types.js.map +7 -0
- package/dist/lib/geometry/circle.d.ts +22 -0
- package/dist/lib/geometry/circle.js +13 -0
- package/dist/lib/geometry/circle.js.map +7 -0
- package/dist/lib/geometry/circular-sweep.d.ts +54 -0
- package/dist/lib/geometry/circular-sweep.js +95 -0
- package/dist/lib/geometry/circular-sweep.js.map +7 -0
- package/dist/lib/geometry/ellipse.d.ts +26 -0
- package/dist/lib/geometry/ellipse.js +17 -0
- package/dist/lib/geometry/ellipse.js.map +7 -0
- package/dist/lib/geometry/line.d.ts +20 -0
- package/dist/lib/geometry/line.js +15 -0
- package/dist/lib/geometry/line.js.map +7 -0
- package/dist/lib/geometry/path-arc.d.ts +25 -0
- package/dist/lib/geometry/path-arc.js +57 -0
- package/dist/lib/geometry/path-arc.js.map +7 -0
- package/dist/lib/geometry/path-bend-guide.d.ts +31 -0
- package/dist/lib/geometry/path-bend-guide.js +282 -0
- package/dist/lib/geometry/path-bend-guide.js.map +7 -0
- package/dist/lib/geometry/path-bend-spans.d.ts +31 -0
- package/dist/lib/geometry/path-bend-spans.js +109 -0
- package/dist/lib/geometry/path-bend-spans.js.map +7 -0
- package/dist/lib/geometry/path-bending.d.ts +90 -0
- package/dist/lib/geometry/path-bending.js +202 -0
- package/dist/lib/geometry/path-bending.js.map +7 -0
- package/dist/lib/geometry/path-conversion.d.ts +19 -0
- package/dist/lib/geometry/path-conversion.js +114 -0
- package/dist/lib/geometry/path-conversion.js.map +7 -0
- package/dist/lib/geometry/path-geometry.d.ts +218 -0
- package/dist/lib/geometry/path-geometry.js +557 -0
- package/dist/lib/geometry/path-geometry.js.map +7 -0
- package/dist/lib/geometry/path-radial.d.ts +15 -0
- package/dist/lib/geometry/path-radial.js +107 -0
- package/dist/lib/geometry/path-radial.js.map +7 -0
- package/dist/lib/geometry/path-transforms.d.ts +233 -0
- package/dist/lib/geometry/path-transforms.js +478 -0
- package/dist/lib/geometry/path-transforms.js.map +7 -0
- package/dist/lib/geometry/path-utilities.d.ts +78 -0
- package/dist/lib/geometry/path-utilities.js +341 -0
- package/dist/lib/geometry/path-utilities.js.map +7 -0
- package/dist/lib/geometry/path-wang.d.ts +18 -0
- package/dist/lib/geometry/path-wang.js +136 -0
- package/dist/lib/geometry/path-wang.js.map +7 -0
- package/dist/lib/geometry/path-warp-bezier.d.ts +17 -0
- package/dist/lib/geometry/path-warp-bezier.js +109 -0
- package/dist/lib/geometry/path-warp-bezier.js.map +7 -0
- package/dist/lib/geometry/path-warp.d.ts +27 -0
- package/dist/lib/geometry/path-warp.js +165 -0
- package/dist/lib/geometry/path-warp.js.map +7 -0
- package/dist/lib/geometry/polygon.d.ts +21 -0
- package/dist/lib/geometry/polygon.js +12 -0
- package/dist/lib/geometry/polygon.js.map +7 -0
- package/dist/lib/geometry/rectangle.d.ts +38 -0
- package/dist/lib/geometry/rectangle.js +22 -0
- package/dist/lib/geometry/rectangle.js.map +7 -0
- package/dist/lib/geometry/regular-polygon.d.ts +88 -0
- package/dist/lib/geometry/regular-polygon.js +67 -0
- package/dist/lib/geometry/regular-polygon.js.map +7 -0
- package/dist/lib/geometry/resolve-path.d.ts +4 -0
- package/dist/lib/geometry/resolve-path.js +16 -0
- package/dist/lib/geometry/resolve-path.js.map +7 -0
- package/dist/lib/geometry/rounded-corners.d.ts +28 -0
- package/dist/lib/geometry/rounded-corners.js +118 -0
- package/dist/lib/geometry/rounded-corners.js.map +7 -0
- package/dist/lib/geometry/star.d.ts +39 -0
- package/dist/lib/geometry/star.js +90 -0
- package/dist/lib/geometry/star.js.map +7 -0
- package/dist/lib/geometry/svg-path.d.ts +21 -0
- package/dist/lib/geometry/svg-path.js +7 -0
- package/dist/lib/geometry/svg-path.js.map +7 -0
- package/dist/lib/geometry/transform-bend.d.ts +46 -0
- package/dist/lib/geometry/transform-bend.js +219 -0
- package/dist/lib/geometry/transform-bend.js.map +7 -0
- package/dist/lib/geometry/transform-guide.d.ts +57 -0
- package/dist/lib/geometry/transform-guide.js +157 -0
- package/dist/lib/geometry/transform-guide.js.map +7 -0
- package/dist/lib/geometry/transform-math.d.ts +21 -0
- package/dist/lib/geometry/transform-math.js +91 -0
- package/dist/lib/geometry/transform-math.js.map +7 -0
- package/dist/lib/geometry/transform-mesh.d.ts +39 -0
- package/dist/lib/geometry/transform-mesh.js +129 -0
- package/dist/lib/geometry/transform-mesh.js.map +7 -0
- package/dist/lib/geometry/validation.d.ts +6 -0
- package/dist/lib/geometry/validation.js +42 -0
- package/dist/lib/geometry/validation.js.map +7 -0
- package/dist/lib/global-state.d.ts +63 -0
- package/dist/lib/global-state.js +176 -0
- package/dist/lib/global-state.js.map +7 -0
- package/dist/lib/hooks/hook-slot.d.ts +30 -0
- package/dist/lib/hooks/hook-slot.js +66 -0
- package/dist/lib/hooks/hook-slot.js.map +7 -0
- package/dist/lib/hooks/use-animated-value.d.ts +24 -0
- package/dist/lib/hooks/use-animated-value.js +169 -0
- package/dist/lib/hooks/use-animated-value.js.map +7 -0
- package/dist/lib/hooks/use-canvas-context.d.ts +10 -0
- package/dist/lib/hooks/use-canvas-context.js +13 -0
- package/dist/lib/hooks/use-canvas-context.js.map +7 -0
- package/dist/lib/hooks/use-computed.d.ts +13 -0
- package/dist/lib/hooks/use-computed.js +91 -0
- package/dist/lib/hooks/use-computed.js.map +7 -0
- package/dist/lib/hooks/use-const.d.ts +10 -0
- package/dist/lib/hooks/use-const.js +15 -0
- package/dist/lib/hooks/use-const.js.map +7 -0
- package/dist/lib/hooks/use-cursor.d.ts +16 -0
- package/dist/lib/hooks/use-cursor.js +51 -0
- package/dist/lib/hooks/use-cursor.js.map +7 -0
- package/dist/lib/hooks/use-event-listener.d.ts +10 -0
- package/dist/lib/hooks/use-event-listener.js +24 -0
- package/dist/lib/hooks/use-event-listener.js.map +7 -0
- package/dist/lib/hooks/use-event-target.d.ts +14 -0
- package/dist/lib/hooks/use-event-target.js +30 -0
- package/dist/lib/hooks/use-event-target.js.map +7 -0
- package/dist/lib/hooks/use-layout-box.d.ts +9 -0
- package/dist/lib/hooks/use-layout-box.js +8 -0
- package/dist/lib/hooks/use-layout-box.js.map +7 -0
- package/dist/lib/hooks/use-line-path.d.ts +14 -0
- package/dist/lib/hooks/use-line-path.js +13 -0
- package/dist/lib/hooks/use-line-path.js.map +7 -0
- package/dist/lib/hooks/use-paint-target.d.ts +3 -0
- package/dist/lib/hooks/use-paint-target.js +34 -0
- package/dist/lib/hooks/use-paint-target.js.map +7 -0
- package/dist/lib/hooks/use-playback.d.ts +21 -0
- package/dist/lib/hooks/use-playback.js +87 -0
- package/dist/lib/hooks/use-playback.js.map +7 -0
- package/dist/lib/hooks/use-reaction.d.ts +19 -0
- package/dist/lib/hooks/use-reaction.js +245 -0
- package/dist/lib/hooks/use-reaction.js.map +7 -0
- package/dist/lib/hooks/use-rect-path.d.ts +20 -0
- package/dist/lib/hooks/use-rect-path.js +25 -0
- package/dist/lib/hooks/use-rect-path.js.map +7 -0
- package/dist/lib/hooks/use-ref.d.ts +17 -0
- package/dist/lib/hooks/use-ref.js +8 -0
- package/dist/lib/hooks/use-ref.js.map +7 -0
- package/dist/lib/hooks/use-region.d.ts +11 -0
- package/dist/lib/hooks/use-region.js +34 -0
- package/dist/lib/hooks/use-region.js.map +7 -0
- package/dist/lib/hooks/use-signal.d.ts +12 -0
- package/dist/lib/hooks/use-signal.js +12 -0
- package/dist/lib/hooks/use-signal.js.map +7 -0
- package/dist/lib/hooks/use-svg-path.d.ts +11 -0
- package/dist/lib/hooks/use-svg-path.js +13 -0
- package/dist/lib/hooks/use-svg-path.js.map +7 -0
- package/dist/lib/hooks/use-value-memo-slot.d.ts +12 -0
- package/dist/lib/hooks/use-value-memo-slot.js +45 -0
- package/dist/lib/hooks/use-value-memo-slot.js.map +7 -0
- package/dist/lib/hooks/use-visibility-transition.d.ts +103 -0
- package/dist/lib/hooks/use-visibility-transition.js +195 -0
- package/dist/lib/hooks/use-visibility-transition.js.map +7 -0
- package/dist/lib/html/html-service.d.ts +30 -0
- package/dist/lib/html/html-service.js +281 -0
- package/dist/lib/html/html-service.js.map +7 -0
- package/dist/lib/html/overlay-config.d.ts +3 -0
- package/dist/lib/html/overlay-config.js +37 -0
- package/dist/lib/html/overlay-config.js.map +7 -0
- package/dist/lib/html/portable-clips.d.ts +4 -0
- package/dist/lib/html/portable-clips.js +20 -0
- package/dist/lib/html/portable-clips.js.map +7 -0
- package/dist/lib/html/types.d.ts +110 -0
- package/dist/lib/layout/absolute.d.ts +57 -0
- package/dist/lib/layout/absolute.js +348 -0
- package/dist/lib/layout/absolute.js.map +7 -0
- package/dist/lib/layout/box.d.ts +19 -0
- package/dist/lib/layout/box.js +209 -0
- package/dist/lib/layout/box.js.map +7 -0
- package/dist/lib/layout/context.d.ts +13 -0
- package/dist/lib/layout/context.js +42 -0
- package/dist/lib/layout/context.js.map +7 -0
- package/dist/lib/layout/diagnostics.d.ts +15 -0
- package/dist/lib/layout/diagnostics.js +30 -0
- package/dist/lib/layout/diagnostics.js.map +7 -0
- package/dist/lib/layout/flex.d.ts +64 -0
- package/dist/lib/layout/flex.js +803 -0
- package/dist/lib/layout/flex.js.map +7 -0
- package/dist/lib/layout/flow.d.ts +53 -0
- package/dist/lib/layout/flow.js +400 -0
- package/dist/lib/layout/flow.js.map +7 -0
- package/dist/lib/layout/grid.d.ts +64 -0
- package/dist/lib/layout/grid.js +597 -0
- package/dist/lib/layout/grid.js.map +7 -0
- package/dist/lib/layout/measure.d.ts +19 -0
- package/dist/lib/layout/measure.js +144 -0
- package/dist/lib/layout/measure.js.map +7 -0
- package/dist/lib/layout/overlay.d.ts +42 -0
- package/dist/lib/layout/overlay.js +151 -0
- package/dist/lib/layout/overlay.js.map +7 -0
- package/dist/lib/layout/place-child.d.ts +12 -0
- package/dist/lib/layout/place-child.js +72 -0
- package/dist/lib/layout/place-child.js.map +7 -0
- package/dist/lib/layout/positioning-diagnostics.d.ts +3 -0
- package/dist/lib/layout/positioning-diagnostics.js +15 -0
- package/dist/lib/layout/positioning-diagnostics.js.map +7 -0
- package/dist/lib/layout/types.d.ts +78 -0
- package/dist/lib/manipulation/controller-types.d.ts +299 -0
- package/dist/lib/manipulation/controller.d.ts +57 -0
- package/dist/lib/manipulation/controller.js +464 -0
- package/dist/lib/manipulation/controller.js.map +7 -0
- package/dist/lib/manipulation/coordinates.d.ts +9 -0
- package/dist/lib/manipulation/coordinates.js +55 -0
- package/dist/lib/manipulation/coordinates.js.map +7 -0
- package/dist/lib/manipulation/degrees.d.ts +10 -0
- package/dist/lib/manipulation/degrees.js +9 -0
- package/dist/lib/manipulation/degrees.js.map +7 -0
- package/dist/lib/manipulation/frame.d.ts +24 -0
- package/dist/lib/manipulation/frame.js +101 -0
- package/dist/lib/manipulation/frame.js.map +7 -0
- package/dist/lib/manipulation/geometry.d.ts +4 -0
- package/dist/lib/manipulation/geometry.js +26 -0
- package/dist/lib/manipulation/geometry.js.map +7 -0
- package/dist/lib/manipulation/handles.d.ts +298 -0
- package/dist/lib/manipulation/handles.js +598 -0
- package/dist/lib/manipulation/handles.js.map +7 -0
- package/dist/lib/manipulation/manipulable.d.ts +65 -0
- package/dist/lib/manipulation/manipulable.js +47 -0
- package/dist/lib/manipulation/manipulable.js.map +7 -0
- package/dist/lib/manipulation/ownership.d.ts +15 -0
- package/dist/lib/manipulation/ownership.js +80 -0
- package/dist/lib/manipulation/ownership.js.map +7 -0
- package/dist/lib/manipulation/snap.d.ts +6 -0
- package/dist/lib/manipulation/snap.js +40 -0
- package/dist/lib/manipulation/snap.js.map +7 -0
- package/dist/lib/manipulation/solve.d.ts +2 -0
- package/dist/lib/manipulation/solve.js +563 -0
- package/dist/lib/manipulation/solve.js.map +7 -0
- package/dist/lib/manipulation/types.d.ts +178 -0
- package/dist/lib/mount-pibbl.d.ts +25 -0
- package/dist/lib/mount-pibbl.js +278 -0
- package/dist/lib/mount-pibbl.js.map +7 -0
- package/dist/lib/optional-services.d.ts +8 -0
- package/dist/lib/optional-services.js +11 -0
- package/dist/lib/optional-services.js.map +7 -0
- package/dist/lib/pibbl.d.ts +17 -0
- package/dist/lib/pibbl.js +21 -0
- package/dist/lib/pibbl.js.map +7 -0
- package/dist/lib/primitive-presentation.d.ts +24 -0
- package/dist/lib/primitive-presentation.js +102 -0
- package/dist/lib/primitive-presentation.js.map +7 -0
- package/dist/lib/render-layer/controller.d.ts +67 -0
- package/dist/lib/render-layer/controller.js +603 -0
- package/dist/lib/render-layer/controller.js.map +7 -0
- package/dist/lib/render-layer/define-render-layer.d.ts +17 -0
- package/dist/lib/render-layer/define-render-layer.js +90 -0
- package/dist/lib/render-layer/define-render-layer.js.map +7 -0
- package/dist/lib/render-layer/types.d.ts +315 -0
- package/dist/lib/render-target.d.ts +27 -0
- package/dist/lib/render-target.js +118 -0
- package/dist/lib/render-target.js.map +7 -0
- package/dist/lib/render-transaction.d.ts +10 -0
- package/dist/lib/render-transaction.js +46 -0
- package/dist/lib/render-transaction.js.map +7 -0
- package/dist/lib/render.d.ts +3 -0
- package/dist/lib/render.js +385 -0
- package/dist/lib/render.js.map +7 -0
- package/dist/lib/scheduler/realm-scheduler.d.ts +52 -0
- package/dist/lib/scheduler/realm-scheduler.js +964 -0
- package/dist/lib/scheduler/realm-scheduler.js.map +7 -0
- package/dist/lib/scheduler/renderer-participant.d.ts +257 -0
- package/dist/lib/scheduler/renderer-participant.js +216 -0
- package/dist/lib/scheduler/renderer-participant.js.map +7 -0
- package/dist/lib/scheduler/simulation-participant.d.ts +103 -0
- package/dist/lib/scheduler/simulation-participant.js +229 -0
- package/dist/lib/scheduler/simulation-participant.js.map +7 -0
- package/dist/lib/scheduler/testing.d.ts +56 -0
- package/dist/lib/scheduler/testing.js +71 -0
- package/dist/lib/scheduler/testing.js.map +7 -0
- package/dist/lib/scheduler/types.d.ts +103 -0
- package/dist/lib/signals/edge.d.ts +44 -0
- package/dist/lib/signals/edge.js +245 -0
- package/dist/lib/signals/edge.js.map +7 -0
- package/dist/lib/signals/graph.d.ts +220 -0
- package/dist/lib/signals/graph.js +1035 -0
- package/dist/lib/signals/graph.js.map +7 -0
- package/dist/lib/signals/input-provision.d.ts +3 -0
- package/dist/lib/signals/input-provision.js +67 -0
- package/dist/lib/signals/input-provision.js.map +7 -0
- package/dist/lib/signals/render-consumer.d.ts +21 -0
- package/dist/lib/signals/render-consumer.js +218 -0
- package/dist/lib/signals/render-consumer.js.map +7 -0
- package/dist/lib/signals/resolve-signal-value.d.ts +10 -0
- package/dist/lib/signals/resolve-signal-value.js +17 -0
- package/dist/lib/signals/resolve-signal-value.js.map +7 -0
- package/dist/lib/signals/types.d.ts +80 -0
- package/dist/lib/style/diagnostics.d.ts +83 -0
- package/dist/lib/style/diagnostics.js +63 -0
- package/dist/lib/style/diagnostics.js.map +7 -0
- package/dist/lib/style/empty-style.d.ts +3 -0
- package/dist/lib/style/empty-style.js +5 -0
- package/dist/lib/style/empty-style.js.map +7 -0
- package/dist/lib/style/filter-types.d.ts +243 -0
- package/dist/lib/style/filter-types.js +5 -0
- package/dist/lib/style/filter-types.js.map +7 -0
- package/dist/lib/style/filter.d.ts +7 -0
- package/dist/lib/style/filter.js +50 -0
- package/dist/lib/style/filter.js.map +7 -0
- package/dist/lib/style/normalize.d.ts +18 -0
- package/dist/lib/style/normalize.js +50 -0
- package/dist/lib/style/normalize.js.map +7 -0
- package/dist/lib/style/positioning.d.ts +32 -0
- package/dist/lib/style/positioning.js +81 -0
- package/dist/lib/style/positioning.js.map +7 -0
- package/dist/lib/style/resolve-built-in.d.ts +6 -0
- package/dist/lib/style/resolve-built-in.js +58 -0
- package/dist/lib/style/resolve-built-in.js.map +7 -0
- package/dist/lib/style/resolve-dispatch.d.ts +20 -0
- package/dist/lib/style/resolve-dispatch.js +167 -0
- package/dist/lib/style/resolve-dispatch.js.map +7 -0
- package/dist/lib/style/resolve-length.d.ts +16 -0
- package/dist/lib/style/resolve-length.js +54 -0
- package/dist/lib/style/resolve-length.js.map +7 -0
- package/dist/lib/style/responsive.d.ts +31 -0
- package/dist/lib/style/responsive.js +172 -0
- package/dist/lib/style/responsive.js.map +7 -0
- package/dist/lib/style/types.d.ts +338 -0
- package/dist/lib/surface/resolve-surface.d.ts +4 -0
- package/dist/lib/surface/resolve-surface.js +184 -0
- package/dist/lib/surface/resolve-surface.js.map +7 -0
- package/dist/lib/surface/root-surface.d.ts +7 -0
- package/dist/lib/surface/root-surface.js +171 -0
- package/dist/lib/surface/root-surface.js.map +7 -0
- package/dist/lib/surface/transform.d.ts +4 -0
- package/dist/lib/surface/transform.js +16 -0
- package/dist/lib/surface/transform.js.map +7 -0
- package/dist/lib/surface/types.d.ts +132 -0
- package/dist/lib/teardowns.d.ts +14 -0
- package/dist/lib/teardowns.js +50 -0
- package/dist/lib/teardowns.js.map +7 -0
- package/dist/lib/textures/texture-protocol.d.ts +124 -0
- package/dist/lib/textures/texture-protocol.js +40 -0
- package/dist/lib/textures/texture-protocol.js.map +7 -0
- package/dist/lib/textures/texture.d.ts +170 -0
- package/dist/lib/textures/texture.js +385 -0
- package/dist/lib/textures/texture.js.map +7 -0
- package/dist/lib/transitions/bifrost.d.ts +47 -0
- package/dist/lib/transitions/bifrost.js +91 -0
- package/dist/lib/transitions/bifrost.js.map +7 -0
- package/dist/lib/transitions/binding.d.ts +14 -0
- package/dist/lib/transitions/binding.js +35 -0
- package/dist/lib/transitions/binding.js.map +7 -0
- package/dist/lib/transitions/capture.d.ts +21 -0
- package/dist/lib/transitions/capture.js +91 -0
- package/dist/lib/transitions/capture.js.map +7 -0
- package/dist/lib/transitions/common.d.ts +130 -0
- package/dist/lib/transitions/common.js +57 -0
- package/dist/lib/transitions/common.js.map +7 -0
- package/dist/lib/transitions/define-transition.d.ts +64 -0
- package/dist/lib/transitions/define-transition.js +31 -0
- package/dist/lib/transitions/define-transition.js.map +7 -0
- package/dist/lib/transitions/embers-physics.d.ts +114 -0
- package/dist/lib/transitions/embers-physics.js +161 -0
- package/dist/lib/transitions/embers-physics.js.map +7 -0
- package/dist/lib/transitions/embers.d.ts +67 -0
- package/dist/lib/transitions/embers.js +196 -0
- package/dist/lib/transitions/embers.js.map +7 -0
- package/dist/lib/transitions/fade.d.ts +41 -0
- package/dist/lib/transitions/fade.js +31 -0
- package/dist/lib/transitions/fade.js.map +7 -0
- package/dist/lib/transitions/hologram.d.ts +47 -0
- package/dist/lib/transitions/hologram.js +94 -0
- package/dist/lib/transitions/hologram.js.map +7 -0
- package/dist/lib/transitions/wasm/bifrost-bytes.d.ts +1 -0
- package/dist/lib/transitions/wasm/bifrost-bytes.js +5 -0
- package/dist/lib/transitions/wasm/bifrost-bytes.js.map +7 -0
- package/dist/lib/transitions/wasm/bifrost-kernel.d.ts +1 -0
- package/dist/lib/transitions/wasm/bifrost-kernel.js +27 -0
- package/dist/lib/transitions/wasm/bifrost-kernel.js.map +7 -0
- package/dist/lib/transitions/wasm/embers-bytes.d.ts +1 -0
- package/dist/lib/transitions/wasm/embers-bytes.js +5 -0
- package/dist/lib/transitions/wasm/embers-bytes.js.map +7 -0
- package/dist/lib/transitions/wasm/hologram-bytes.d.ts +1 -0
- package/dist/lib/transitions/wasm/hologram-bytes.js +5 -0
- package/dist/lib/transitions/wasm/hologram-bytes.js.map +7 -0
- package/dist/lib/transitions/wasm/kernel.d.ts +7 -0
- package/dist/lib/transitions/wasm/kernel.js +26 -0
- package/dist/lib/transitions/wasm/kernel.js.map +7 -0
- package/dist/lib/types.d.ts +570 -0
- package/dist/lib/update.d.ts +8 -0
- package/dist/lib/update.js +20 -0
- package/dist/lib/update.js.map +7 -0
- package/dist/lib/util/get-2d-context.d.ts +2 -0
- package/dist/lib/util/get-2d-context.js +11 -0
- package/dist/lib/util/get-2d-context.js.map +7 -0
- package/dist/lib/util/get-mouse-coordinates.d.ts +2 -0
- package/dist/lib/util/get-mouse-coordinates.js +32 -0
- package/dist/lib/util/get-mouse-coordinates.js.map +7 -0
- package/dist/lib/util/is-hit.d.ts +11 -0
- package/dist/lib/util/is-hit.js +52 -0
- package/dist/lib/util/is-hit.js.map +7 -0
- package/dist/lib/util/is-transparent.d.ts +1 -0
- package/dist/lib/util/is-transparent.js +8 -0
- package/dist/lib/util/is-transparent.js.map +7 -0
- package/dist/lib/util/pixel-grid-adjustments.d.ts +8 -0
- package/dist/lib/util/pixel-grid-adjustments.js +28 -0
- package/dist/lib/util/pixel-grid-adjustments.js.map +7 -0
- package/dist/lib/util/push-clipping-path.d.ts +6 -0
- package/dist/lib/util/push-clipping-path.js +28 -0
- package/dist/lib/util/push-clipping-path.js.map +7 -0
- package/dist/lib/util/wire-common-events.d.ts +2 -0
- package/dist/lib/util/wire-common-events.js +15 -0
- package/dist/lib/util/wire-common-events.js.map +7 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +7 -0
- package/dist/types.mjs +1 -0
- package/package.json +149 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { validateSeed } from "./palette.js";
|
|
2
|
+
function range(value, min, max, name) {
|
|
3
|
+
if (!Number.isFinite(value) || value < min || value > max)
|
|
4
|
+
throw new RangeError(`${name} must be ${min}..${max}.`);
|
|
5
|
+
return value;
|
|
6
|
+
}
|
|
7
|
+
function point(p) {
|
|
8
|
+
return { x: range(p.x, 0, 1, "Point x"), y: range(p.y, 0, 1, "Point y") };
|
|
9
|
+
}
|
|
10
|
+
function electricOptions(o) {
|
|
11
|
+
return {
|
|
12
|
+
seed: validateSeed(o.seed),
|
|
13
|
+
branching: range(o.branching ?? 0.6, 0, 1, "Branching"),
|
|
14
|
+
glow: range(o.glow ?? 1, 0, 2, "Glow")
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function drawCore(context, p, strength, glow, radius = 0.038) {
|
|
18
|
+
if (strength <= 0) return;
|
|
19
|
+
const ctx = context.canvas.getContext("2d"), scale = Math.min(context.canvas.width, context.canvas.height);
|
|
20
|
+
const x = p.x * context.canvas.width, y = p.y * context.canvas.height;
|
|
21
|
+
const r = scale * radius * (0.5 + glow);
|
|
22
|
+
const gradient = ctx.createRadialGradient(x, y, 0, x, y, r);
|
|
23
|
+
gradient.addColorStop(0, `rgba(255,249,255,${strength})`);
|
|
24
|
+
gradient.addColorStop(0.1, `rgba(239,191,255,${strength * 0.95})`);
|
|
25
|
+
gradient.addColorStop(
|
|
26
|
+
0.35,
|
|
27
|
+
`rgba(179,60,255,${strength * 0.4 * glow / 2})`
|
|
28
|
+
);
|
|
29
|
+
gradient.addColorStop(1, "rgba(91,30,255,0)");
|
|
30
|
+
ctx.fillStyle = gradient;
|
|
31
|
+
ctx.fillRect(x - r, y - r, r * 2, r * 2);
|
|
32
|
+
ctx.fillStyle = `rgba(255,250,255,${strength})`;
|
|
33
|
+
ctx.beginPath();
|
|
34
|
+
ctx.arc(x, y, Math.max(0.65, scale * 4e-3), 0, Math.PI * 2);
|
|
35
|
+
ctx.fill();
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
drawCore,
|
|
39
|
+
electricOptions,
|
|
40
|
+
point,
|
|
41
|
+
range
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=electric-shared.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/features/textures/lib/electric-shared.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ElectricSource } from './electric-sources.js';\nimport type { LightningMessage, LightningOptions } from './lightning.js';\nimport type { TendrilsMessage, TendrilsOptions } from './tendrils.js';\nimport type { TextureContext } from \"@pibbl/core\";\nimport { validateSeed } from \"./palette.js\";\n\n/**\n * Coordinates are normalized to the complete texture, including its halo padding.\n *\n * @see {@link ElectricSource}\n * @see {@link LightningOptions}\n * @see {@link TendrilsOptions}\n * @see {@link LightningMessage}\n */\nexport interface ElectricPoint {\n /**\n * Horizontal coordinate or displacement in the containing coordinate system. See\n * {@link ElectricPoint}.\n */\n readonly x: number;\n /**\n * Vertical coordinate or displacement in the containing coordinate system. See\n * {@link ElectricPoint}.\n */\n readonly y: number;\n}\n/**\n * Deterministic seed, branching, and glow shared by electrical texture recipes.\n *\n * @see {@link TendrilsOptions}\n * @see {@link LightningOptions}\n */\nexport interface ElectricOptions {\n /**\n * Seed used for deterministic sampling or simulation initialization. See {@link ElectricOptions}\n * .\n */\n readonly seed?: number;\n /** 0..1, controls the number of secondary branches. */\n readonly branching?: number;\n /** 0..2, scales the soft halo without widening the white core. */\n readonly glow?: number;\n}\n/**\n * Pause or reseed/reset commands shared by electrical textures.\n *\n * @see {@link TendrilsMessage}\n * @see {@link LightningMessage}\n */\nexport type ElectricControl =\n | {\n /** The literal \"pause\" identifying this variant. See {@link ElectricControl}. */\n readonly type: \"pause\";\n /** Whether simulation or playback advancement is suspended. See {@link ElectricControl}. */\n readonly paused: boolean;\n }\n | {\n /** The literal \"reset\" identifying this variant. See {@link ElectricControl}. */\n readonly type: \"reset\";\n /**\n * Seed used for deterministic sampling or simulation initialization. See\n * {@link ElectricControl}.\n */\n readonly seed?: number;\n };\nexport function range(value: number, min: number, max: number, name: string) {\n if (!Number.isFinite(value) || value < min || value > max)\n throw new RangeError(`${name} must be ${min}..${max}.`);\n return value;\n}\nexport function point(p: ElectricPoint): ElectricPoint {\n return { x: range(p.x, 0, 1, \"Point x\"), y: range(p.y, 0, 1, \"Point y\") };\n}\nexport function electricOptions(o: ElectricOptions) {\n return {\n seed: validateSeed(o.seed),\n branching: range(o.branching ?? 0.6, 0, 1, \"Branching\"),\n glow: range(o.glow ?? 1, 0, 2, \"Glow\"),\n };\n}\nexport function drawCore(\n context: TextureContext,\n p: ElectricPoint,\n strength: number,\n glow: number,\n radius = 0.038,\n) {\n if (strength <= 0) return;\n const ctx = context.canvas.getContext(\"2d\")!,\n scale = Math.min(context.canvas.width, context.canvas.height);\n const x = p.x * context.canvas.width,\n y = p.y * context.canvas.height;\n const r = scale * radius * (0.5 + glow);\n const gradient = ctx.createRadialGradient(x, y, 0, x, y, r);\n gradient.addColorStop(0, `rgba(255,249,255,${strength})`);\n gradient.addColorStop(0.1, `rgba(239,191,255,${strength * 0.95})`);\n gradient.addColorStop(\n 0.35,\n `rgba(179,60,255,${(strength * 0.4 * glow) / 2})`,\n );\n gradient.addColorStop(1, \"rgba(91,30,255,0)\");\n ctx.fillStyle = gradient;\n ctx.fillRect(x - r, y - r, r * 2, r * 2);\n ctx.fillStyle = `rgba(255,250,255,${strength})`;\n ctx.beginPath();\n ctx.arc(x, y, Math.max(0.65, scale * 0.004), 0, Math.PI * 2);\n ctx.fill();\n}\n"],
|
|
5
|
+
"mappings": "AAIA,SAAS,oBAAoB;AA6DtB,SAAS,MAAM,OAAe,KAAa,KAAa,MAAc;AAC3E,MAAI,CAAC,OAAO,SAAS,KAAK,KAAK,QAAQ,OAAO,QAAQ;AACpD,UAAM,IAAI,WAAW,GAAG,IAAI,YAAY,GAAG,KAAK,GAAG,GAAG;AACxD,SAAO;AACT;AACO,SAAS,MAAM,GAAiC;AACrD,SAAO,EAAE,GAAG,MAAM,EAAE,GAAG,GAAG,GAAG,SAAS,GAAG,GAAG,MAAM,EAAE,GAAG,GAAG,GAAG,SAAS,EAAE;AAC1E;AACO,SAAS,gBAAgB,GAAoB;AAClD,SAAO;AAAA,IACL,MAAM,aAAa,EAAE,IAAI;AAAA,IACzB,WAAW,MAAM,EAAE,aAAa,KAAK,GAAG,GAAG,WAAW;AAAA,IACtD,MAAM,MAAM,EAAE,QAAQ,GAAG,GAAG,GAAG,MAAM;AAAA,EACvC;AACF;AACO,SAAS,SACd,SACA,GACA,UACA,MACA,SAAS,OACT;AACA,MAAI,YAAY,EAAG;AACnB,QAAM,MAAM,QAAQ,OAAO,WAAW,IAAI,GACxC,QAAQ,KAAK,IAAI,QAAQ,OAAO,OAAO,QAAQ,OAAO,MAAM;AAC9D,QAAM,IAAI,EAAE,IAAI,QAAQ,OAAO,OAC7B,IAAI,EAAE,IAAI,QAAQ,OAAO;AAC3B,QAAM,IAAI,QAAQ,UAAU,MAAM;AAClC,QAAM,WAAW,IAAI,qBAAqB,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAC1D,WAAS,aAAa,GAAG,oBAAoB,QAAQ,GAAG;AACxD,WAAS,aAAa,KAAK,oBAAoB,WAAW,IAAI,GAAG;AACjE,WAAS;AAAA,IACP;AAAA,IACA,mBAAoB,WAAW,MAAM,OAAQ,CAAC;AAAA,EAChD;AACA,WAAS,aAAa,GAAG,mBAAmB;AAC5C,MAAI,YAAY;AAChB,MAAI,SAAS,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AACvC,MAAI,YAAY,oBAAoB,QAAQ;AAC5C,MAAI,UAAU;AACd,MAAI,IAAI,GAAG,GAAG,KAAK,IAAI,MAAM,QAAQ,IAAK,GAAG,GAAG,KAAK,KAAK,CAAC;AAC3D,MAAI,KAAK;AACX;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { TendrilsMessage, TendrilsOptions } from "./tendrils.js";
|
|
2
|
+
import { type ElectricPoint } from "./electric-shared.js";
|
|
3
|
+
/**
|
|
4
|
+
* A weighted attachment site in normalized texture coordinates.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link ElectricPoint}
|
|
7
|
+
* @see {@link ElectricSourceMessage}
|
|
8
|
+
* @see {@link TendrilsOptions}
|
|
9
|
+
*/
|
|
10
|
+
export interface ElectricSource {
|
|
11
|
+
/** Stable identifier of this resource or connection. See {@link ElectricSource}. */
|
|
12
|
+
readonly id: string;
|
|
13
|
+
/** A point in the operation's coordinate system. See {@link ElectricPoint}. */
|
|
14
|
+
readonly point: ElectricPoint;
|
|
15
|
+
/** Relative sampling weight or source intensity. See {@link ElectricSource}. */
|
|
16
|
+
readonly weight: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Upserts, removes, or replaces the named source electrodes of an electrical texture.
|
|
20
|
+
*
|
|
21
|
+
* @see {@link ElectricSource}
|
|
22
|
+
* @see {@link TendrilsMessage}
|
|
23
|
+
*/
|
|
24
|
+
export type ElectricSourceMessage = {
|
|
25
|
+
/** The literal "upsert-source" identifying this variant. See {@link ElectricSourceMessage}. */
|
|
26
|
+
readonly type: "upsert-source";
|
|
27
|
+
/** Named electrode to insert or replace. See {@link ElectricSource}. */
|
|
28
|
+
readonly source: ElectricSource;
|
|
29
|
+
} | {
|
|
30
|
+
/** The literal "remove-source" identifying this variant. See {@link ElectricSourceMessage}. */
|
|
31
|
+
readonly type: "remove-source";
|
|
32
|
+
/** Stable identifier of this resource or connection. See {@link ElectricSourceMessage}. */
|
|
33
|
+
readonly id: string;
|
|
34
|
+
} | {
|
|
35
|
+
/** The literal "set-sources" identifying this variant. See {@link ElectricSourceMessage}. */
|
|
36
|
+
readonly type: "set-sources";
|
|
37
|
+
/** Named electrical source electrodes. See {@link ElectricSource}. */
|
|
38
|
+
readonly sources: readonly ElectricSource[];
|
|
39
|
+
};
|
|
40
|
+
export declare const MAX_ELECTRIC_SOURCES = 512;
|
|
41
|
+
export declare function sourceId(id: string): string;
|
|
42
|
+
export declare function source(value: ElectricSource): ElectricSource;
|
|
43
|
+
export declare function sources(values: readonly ElectricSource[]): ElectricSource[];
|
|
44
|
+
export interface SourceSite {
|
|
45
|
+
id: string;
|
|
46
|
+
point: ElectricPoint;
|
|
47
|
+
weight: number;
|
|
48
|
+
hash: number;
|
|
49
|
+
}
|
|
50
|
+
export declare function site(value: ElectricSource): SourceSite;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { point, range } from "./electric-shared.js";
|
|
2
|
+
const MAX_ELECTRIC_SOURCES = 512;
|
|
3
|
+
function sourceId(id) {
|
|
4
|
+
if (typeof id !== "string" || id.length < 1 || id.length > 128)
|
|
5
|
+
throw new RangeError("Electric source id must contain 1..128 characters.");
|
|
6
|
+
return id;
|
|
7
|
+
}
|
|
8
|
+
function source(value) {
|
|
9
|
+
return {
|
|
10
|
+
id: sourceId(value.id),
|
|
11
|
+
point: point(value.point),
|
|
12
|
+
weight: range(value.weight, 0, 1e6, "Source weight")
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function sources(values) {
|
|
16
|
+
if (!Array.isArray(values) || values.length > MAX_ELECTRIC_SOURCES)
|
|
17
|
+
throw new RangeError(
|
|
18
|
+
"Electric sources must be an array of at most 512 sites."
|
|
19
|
+
);
|
|
20
|
+
const ids = /* @__PURE__ */ new Set();
|
|
21
|
+
const result = values.map((value) => {
|
|
22
|
+
const next = source(value);
|
|
23
|
+
if (ids.has(next.id))
|
|
24
|
+
throw new TypeError(`Duplicate electric source id: ${next.id}`);
|
|
25
|
+
ids.add(next.id);
|
|
26
|
+
return next;
|
|
27
|
+
});
|
|
28
|
+
return result.sort((a, b) => a.id < b.id ? -1 : a.id > b.id ? 1 : 0);
|
|
29
|
+
}
|
|
30
|
+
function site(value) {
|
|
31
|
+
let hash = 2166136261;
|
|
32
|
+
for (let i = 0; i < value.id.length; i++)
|
|
33
|
+
hash = Math.imul(hash ^ value.id.charCodeAt(i), 16777619);
|
|
34
|
+
return { ...value, point: { ...value.point }, hash };
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
MAX_ELECTRIC_SOURCES,
|
|
38
|
+
site,
|
|
39
|
+
source,
|
|
40
|
+
sourceId,
|
|
41
|
+
sources
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=electric-sources.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/features/textures/lib/electric-sources.ts"],
|
|
4
|
+
"sourcesContent": ["import type { TendrilsMessage, TendrilsOptions } from './tendrils.js';\nimport { point, range, type ElectricPoint } from \"./electric-shared.js\";\n\n/**\n * A weighted attachment site in normalized texture coordinates.\n *\n * @see {@link ElectricPoint}\n * @see {@link ElectricSourceMessage}\n * @see {@link TendrilsOptions}\n */\nexport interface ElectricSource {\n /** Stable identifier of this resource or connection. See {@link ElectricSource}. */\n readonly id: string;\n /** A point in the operation's coordinate system. See {@link ElectricPoint}. */\n readonly point: ElectricPoint;\n /** Relative sampling weight or source intensity. See {@link ElectricSource}. */\n readonly weight: number;\n}\n/**\n * Upserts, removes, or replaces the named source electrodes of an electrical texture.\n *\n * @see {@link ElectricSource}\n * @see {@link TendrilsMessage}\n */\nexport type ElectricSourceMessage =\n | {\n /** The literal \"upsert-source\" identifying this variant. See {@link ElectricSourceMessage}. */\n readonly type: \"upsert-source\";\n /** Named electrode to insert or replace. See {@link ElectricSource}. */\n readonly source: ElectricSource;\n }\n | {\n /** The literal \"remove-source\" identifying this variant. See {@link ElectricSourceMessage}. */\n readonly type: \"remove-source\";\n /** Stable identifier of this resource or connection. See {@link ElectricSourceMessage}. */\n readonly id: string;\n }\n | {\n /** The literal \"set-sources\" identifying this variant. See {@link ElectricSourceMessage}. */\n readonly type: \"set-sources\";\n /** Named electrical source electrodes. See {@link ElectricSource}. */\n readonly sources: readonly ElectricSource[];\n };\n\nexport const MAX_ELECTRIC_SOURCES = 512;\nexport function sourceId(id: string): string {\n if (typeof id !== \"string\" || id.length < 1 || id.length > 128)\n throw new RangeError(\"Electric source id must contain 1..128 characters.\");\n return id;\n}\nexport function source(value: ElectricSource): ElectricSource {\n return {\n id: sourceId(value.id),\n point: point(value.point),\n weight: range(value.weight, 0, 1_000_000, \"Source weight\"),\n };\n}\nexport function sources(values: readonly ElectricSource[]): ElectricSource[] {\n if (!Array.isArray(values) || values.length > MAX_ELECTRIC_SOURCES)\n throw new RangeError(\n \"Electric sources must be an array of at most 512 sites.\",\n );\n const ids = new Set<string>();\n const result = values.map((value) => {\n const next = source(value);\n if (ids.has(next.id))\n throw new TypeError(`Duplicate electric source id: ${next.id}`);\n ids.add(next.id);\n return next;\n });\n return result.sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));\n}\nexport interface SourceSite {\n id: string;\n point: ElectricPoint;\n weight: number;\n hash: number;\n}\nexport function site(value: ElectricSource): SourceSite {\n let hash = 2166136261;\n for (let i = 0; i < value.id.length; i++)\n hash = Math.imul(hash ^ value.id.charCodeAt(i), 16777619);\n return { ...value, point: { ...value.point }, hash };\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,OAAO,aAAiC;AA2C1C,MAAM,uBAAuB;AAC7B,SAAS,SAAS,IAAoB;AAC3C,MAAI,OAAO,OAAO,YAAY,GAAG,SAAS,KAAK,GAAG,SAAS;AACzD,UAAM,IAAI,WAAW,oDAAoD;AAC3E,SAAO;AACT;AACO,SAAS,OAAO,OAAuC;AAC5D,SAAO;AAAA,IACL,IAAI,SAAS,MAAM,EAAE;AAAA,IACrB,OAAO,MAAM,MAAM,KAAK;AAAA,IACxB,QAAQ,MAAM,MAAM,QAAQ,GAAG,KAAW,eAAe;AAAA,EAC3D;AACF;AACO,SAAS,QAAQ,QAAqD;AAC3E,MAAI,CAAC,MAAM,QAAQ,MAAM,KAAK,OAAO,SAAS;AAC5C,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AACF,QAAM,MAAM,oBAAI,IAAY;AAC5B,QAAM,SAAS,OAAO,IAAI,CAAC,UAAU;AACnC,UAAM,OAAO,OAAO,KAAK;AACzB,QAAI,IAAI,IAAI,KAAK,EAAE;AACjB,YAAM,IAAI,UAAU,iCAAiC,KAAK,EAAE,EAAE;AAChE,QAAI,IAAI,KAAK,EAAE;AACf,WAAO;AAAA,EACT,CAAC;AACD,SAAO,OAAO,KAAK,CAAC,GAAG,MAAO,EAAE,KAAK,EAAE,KAAK,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,CAAE;AACvE;AAOO,SAAS,KAAK,OAAmC;AACtD,MAAI,OAAO;AACX,WAAS,IAAI,GAAG,IAAI,MAAM,GAAG,QAAQ;AACnC,WAAO,KAAK,KAAK,OAAO,MAAM,GAAG,WAAW,CAAC,GAAG,QAAQ;AAC1D,SAAO,EAAE,GAAG,OAAO,OAAO,EAAE,GAAG,MAAM,MAAM,GAAG,KAAK;AACrD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type ElectricControl, type ElectricOptions, type ElectricPoint } from "./electric-shared.js";
|
|
2
|
+
/**
|
|
3
|
+
* Electrical appearance, electrode positions, topology frequency, and base-connection controls.
|
|
4
|
+
*
|
|
5
|
+
* @see {@link ElectricOptions}
|
|
6
|
+
* @see {@link ElectricPoint}
|
|
7
|
+
* @see {@link lightning}
|
|
8
|
+
* @see {@link LightningMessage}
|
|
9
|
+
*/
|
|
10
|
+
export interface LightningOptions extends ElectricOptions {
|
|
11
|
+
/** Position of the positive electrode. See {@link ElectricPoint}. */
|
|
12
|
+
readonly positive?: ElectricPoint;
|
|
13
|
+
/** Position of the negative electrode. See {@link ElectricPoint}. */
|
|
14
|
+
readonly negative?: ElectricPoint;
|
|
15
|
+
/** Boundary edge used as the electrical connection's origin. See {@link LightningOptions}. */
|
|
16
|
+
readonly edge?: "top" | "right" | "bottom" | "left";
|
|
17
|
+
/** Enables the configured base connection; manual connections remain independent. */
|
|
18
|
+
readonly active?: boolean;
|
|
19
|
+
/** Topology refreshes per second, 1..30. Connections survive several refreshes. */
|
|
20
|
+
readonly frequency?: number;
|
|
21
|
+
/** Whether to draw the electrode contact core. See {@link LightningOptions}. */
|
|
22
|
+
readonly contactCore?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Control, connection management, and live configuration commands for a lightning texture.
|
|
26
|
+
*
|
|
27
|
+
* @see {@link ElectricControl}
|
|
28
|
+
* @see {@link ElectricPoint}
|
|
29
|
+
* @see {@link LightningOptions}
|
|
30
|
+
*/
|
|
31
|
+
export type LightningMessage = ElectricControl | {
|
|
32
|
+
/** The literal "connect" identifying this variant. See {@link LightningMessage}. */
|
|
33
|
+
readonly type: "connect";
|
|
34
|
+
/** Stable identifier of this resource or connection. See {@link LightningMessage}. */
|
|
35
|
+
readonly id: string;
|
|
36
|
+
/** Position of the positive electrode. See {@link ElectricPoint}. */
|
|
37
|
+
readonly positive: ElectricPoint;
|
|
38
|
+
/** Position of the negative electrode. See {@link ElectricPoint}. */
|
|
39
|
+
readonly negative: ElectricPoint;
|
|
40
|
+
} | {
|
|
41
|
+
/** The literal "disconnect" identifying this variant. See {@link LightningMessage}. */
|
|
42
|
+
readonly type: "disconnect";
|
|
43
|
+
/** Stable identifier of this resource or connection. See {@link LightningMessage}. */
|
|
44
|
+
readonly id: string;
|
|
45
|
+
} | {
|
|
46
|
+
/** The literal "configure" identifying this variant. See {@link LightningMessage}. */
|
|
47
|
+
readonly type: "configure";
|
|
48
|
+
/** Position of the positive electrode. See {@link ElectricPoint}. */
|
|
49
|
+
readonly positive?: ElectricPoint;
|
|
50
|
+
/** Position of the negative electrode. See {@link ElectricPoint}. */
|
|
51
|
+
readonly negative?: ElectricPoint;
|
|
52
|
+
/** Boundary edge used as the electrical connection's origin. See {@link LightningOptions}. */
|
|
53
|
+
readonly edge?: LightningOptions["edge"];
|
|
54
|
+
/** Current active operation or its presentation configuration. See {@link LightningMessage}. */
|
|
55
|
+
readonly active?: boolean;
|
|
56
|
+
/** Amount of secondary electrical branching. See {@link LightningMessage}. */
|
|
57
|
+
readonly branching?: number;
|
|
58
|
+
/** Intensity of the electrical halo around the core. See {@link LightningMessage}. */
|
|
59
|
+
readonly glow?: number;
|
|
60
|
+
/** Rate at which the pattern or motion repeats. See {@link LightningMessage}. */
|
|
61
|
+
readonly frequency?: number;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Persistent branching arcs between artistic positive/negative points.
|
|
65
|
+
*
|
|
66
|
+
* @param config - Lightning geometry, timing, and appearance settings. See
|
|
67
|
+
* {@link LightningOptions} .
|
|
68
|
+
* @returns A lightning texture recipe for useTexture.
|
|
69
|
+
*
|
|
70
|
+
* @see {@link LightningOptions}
|
|
71
|
+
*/
|
|
72
|
+
export declare function lightning(config?: LightningOptions): import("@pibbl/core").TextureRecipe<LightningMessage>;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { ElectricMemory } from "./wasm/electric.js";
|
|
2
|
+
import { lazyKernel } from "./wasm/memory.js";
|
|
3
|
+
import { bytes } from "./wasm/lightning-bytes.js";
|
|
4
|
+
const wasmModule = /* @__PURE__ */ lazyKernel(bytes);
|
|
5
|
+
import { defineTexture } from "@pibbl/core";
|
|
6
|
+
import { validateSeed } from "./palette.js";
|
|
7
|
+
import {
|
|
8
|
+
electricOptions,
|
|
9
|
+
point,
|
|
10
|
+
range
|
|
11
|
+
} from "./electric-shared.js";
|
|
12
|
+
function options(o) {
|
|
13
|
+
if (o.edge !== void 0 && !["top", "right", "bottom", "left"].includes(o.edge))
|
|
14
|
+
throw new TypeError("Unknown lightning edge.");
|
|
15
|
+
return {
|
|
16
|
+
...electricOptions(o),
|
|
17
|
+
positive: point(o.positive ?? { x: 0.2, y: 0.5 }),
|
|
18
|
+
negative: point(o.negative ?? { x: 0.8, y: 0.5 }),
|
|
19
|
+
edge: o.edge,
|
|
20
|
+
active: o.active ?? true,
|
|
21
|
+
frequency: range(o.frequency ?? 15, 1, 30, "Frequency"),
|
|
22
|
+
contactCore: o.contactCore ?? false
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function salt(id) {
|
|
26
|
+
let n = 0;
|
|
27
|
+
for (let i = 0; i < id.length; i++)
|
|
28
|
+
n = Math.imul(n, 31) + id.charCodeAt(i) | 0;
|
|
29
|
+
return n;
|
|
30
|
+
}
|
|
31
|
+
const recipe = /* @__PURE__ */ defineTexture({
|
|
32
|
+
defaultPlacement: { mode: "stretch" },
|
|
33
|
+
create(context, input) {
|
|
34
|
+
if (input.active !== false) context.requestFrame();
|
|
35
|
+
const config = options(input);
|
|
36
|
+
return {
|
|
37
|
+
kernel: new ElectricMemory(wasmModule()),
|
|
38
|
+
config,
|
|
39
|
+
inputKey: JSON.stringify(input),
|
|
40
|
+
time: 0,
|
|
41
|
+
paused: false,
|
|
42
|
+
connections: /* @__PURE__ */ new Map()
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
update(s, input, context) {
|
|
46
|
+
const key = JSON.stringify(input);
|
|
47
|
+
if (key === s.inputKey) return;
|
|
48
|
+
const next = options(input);
|
|
49
|
+
if (next.seed !== s.config.seed) {
|
|
50
|
+
s.time = 0;
|
|
51
|
+
s.connections.clear();
|
|
52
|
+
s.kernel.clearConnections();
|
|
53
|
+
}
|
|
54
|
+
s.config = next;
|
|
55
|
+
s.inputKey = key;
|
|
56
|
+
context.invalidate();
|
|
57
|
+
if (!s.paused && (next.active || s.connections.size))
|
|
58
|
+
context.requestFrame();
|
|
59
|
+
},
|
|
60
|
+
receive(s, m, context) {
|
|
61
|
+
switch (m.type) {
|
|
62
|
+
case "pause":
|
|
63
|
+
s.paused = m.paused;
|
|
64
|
+
break;
|
|
65
|
+
case "reset":
|
|
66
|
+
s.config.seed = m.seed === void 0 ? s.config.seed : validateSeed(m.seed);
|
|
67
|
+
s.time = 0;
|
|
68
|
+
s.connections.clear();
|
|
69
|
+
s.kernel.clearConnections();
|
|
70
|
+
break;
|
|
71
|
+
case "configure":
|
|
72
|
+
s.config = options({ ...s.config, ...m });
|
|
73
|
+
break;
|
|
74
|
+
case "connect": {
|
|
75
|
+
if (typeof m.id !== "string" || m.id.length > 128)
|
|
76
|
+
throw new RangeError(
|
|
77
|
+
"Connection id must be a string of at most 128 characters."
|
|
78
|
+
);
|
|
79
|
+
const positive = point(m.positive), negative = point(m.negative), old = s.connections.get(m.id);
|
|
80
|
+
if (old) {
|
|
81
|
+
old.positive = positive;
|
|
82
|
+
old.negative = negative;
|
|
83
|
+
old.active = true;
|
|
84
|
+
old.strength = 1;
|
|
85
|
+
} else if (s.connections.size < 24)
|
|
86
|
+
s.connections.set(
|
|
87
|
+
m.id,
|
|
88
|
+
Object.assign(s.kernel.connection(), {
|
|
89
|
+
positive,
|
|
90
|
+
negative,
|
|
91
|
+
strength: 1,
|
|
92
|
+
active: true,
|
|
93
|
+
salt: salt(m.id)
|
|
94
|
+
})
|
|
95
|
+
);
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
case "disconnect": {
|
|
99
|
+
const old = s.connections.get(m.id);
|
|
100
|
+
if (old) old.active = false;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
default:
|
|
104
|
+
throw new TypeError("Unknown lightning message.");
|
|
105
|
+
}
|
|
106
|
+
context.invalidate();
|
|
107
|
+
if (!s.paused && (s.config.active || s.connections.size))
|
|
108
|
+
context.requestFrame();
|
|
109
|
+
},
|
|
110
|
+
advance(s, frame, context) {
|
|
111
|
+
if (s.paused) return;
|
|
112
|
+
const dt = Math.min(50, frame.delta) / 1e3;
|
|
113
|
+
s.time += dt;
|
|
114
|
+
s.kernel.advanceLightning(dt);
|
|
115
|
+
for (const [id, c] of s.connections) {
|
|
116
|
+
if (c.strength < 5e-3) {
|
|
117
|
+
c.release();
|
|
118
|
+
s.connections.delete(id);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
context.invalidate();
|
|
122
|
+
if (s.config.active || s.connections.size) context.requestFrame();
|
|
123
|
+
},
|
|
124
|
+
rasterize(s, context) {
|
|
125
|
+
s.kernel.lightning(s.config, s.time, s.connections.values());
|
|
126
|
+
s.kernel.draw(context, s.config.glow);
|
|
127
|
+
},
|
|
128
|
+
dispose(s) {
|
|
129
|
+
s.connections.clear();
|
|
130
|
+
s.kernel.dispose();
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
function lightning(config = {}) {
|
|
134
|
+
return recipe(config);
|
|
135
|
+
}
|
|
136
|
+
export {
|
|
137
|
+
lightning
|
|
138
|
+
};
|
|
139
|
+
//# sourceMappingURL=lightning.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/features/textures/lib/lightning.ts"],
|
|
4
|
+
"sourcesContent": ["import { ElectricMemory, type ElectricConnection } from \"./wasm/electric.js\";\nimport { lazyKernel } from \"./wasm/memory.js\";\nimport { bytes } from \"./wasm/lightning-bytes.js\";\nconst wasmModule = /* @__PURE__ */ lazyKernel(bytes);\nimport { defineTexture } from \"@pibbl/core\";\nimport { validateSeed } from \"./palette.js\";\nimport {\n electricOptions,\n point,\n range,\n type ElectricControl,\n type ElectricOptions,\n type ElectricPoint,\n} from \"./electric-shared.js\";\n\n/**\n * Electrical appearance, electrode positions, topology frequency, and base-connection controls.\n *\n * @see {@link ElectricOptions}\n * @see {@link ElectricPoint}\n * @see {@link lightning}\n * @see {@link LightningMessage}\n */\nexport interface LightningOptions extends ElectricOptions {\n /** Position of the positive electrode. See {@link ElectricPoint}. */\n readonly positive?: ElectricPoint;\n /** Position of the negative electrode. See {@link ElectricPoint}. */\n readonly negative?: ElectricPoint;\n /** Boundary edge used as the electrical connection's origin. See {@link LightningOptions}. */\n readonly edge?: \"top\" | \"right\" | \"bottom\" | \"left\";\n /** Enables the configured base connection; manual connections remain independent. */\n readonly active?: boolean;\n /** Topology refreshes per second, 1..30. Connections survive several refreshes. */\n readonly frequency?: number;\n /** Whether to draw the electrode contact core. See {@link LightningOptions}. */\n readonly contactCore?: boolean;\n}\n/**\n * Control, connection management, and live configuration commands for a lightning texture.\n *\n * @see {@link ElectricControl}\n * @see {@link ElectricPoint}\n * @see {@link LightningOptions}\n */\nexport type LightningMessage =\n | ElectricControl\n | {\n /** The literal \"connect\" identifying this variant. See {@link LightningMessage}. */\n readonly type: \"connect\";\n /** Stable identifier of this resource or connection. See {@link LightningMessage}. */\n readonly id: string;\n /** Position of the positive electrode. See {@link ElectricPoint}. */\n readonly positive: ElectricPoint;\n /** Position of the negative electrode. See {@link ElectricPoint}. */\n readonly negative: ElectricPoint;\n }\n | {\n /** The literal \"disconnect\" identifying this variant. See {@link LightningMessage}. */\n readonly type: \"disconnect\";\n /** Stable identifier of this resource or connection. See {@link LightningMessage}. */\n readonly id: string;\n }\n | {\n /** The literal \"configure\" identifying this variant. See {@link LightningMessage}. */\n readonly type: \"configure\";\n /** Position of the positive electrode. See {@link ElectricPoint}. */\n readonly positive?: ElectricPoint;\n /** Position of the negative electrode. See {@link ElectricPoint}. */\n readonly negative?: ElectricPoint;\n /** Boundary edge used as the electrical connection's origin. See {@link LightningOptions}. */\n readonly edge?: LightningOptions[\"edge\"];\n /** Current active operation or its presentation configuration. See {@link LightningMessage}. */\n readonly active?: boolean;\n /** Amount of secondary electrical branching. See {@link LightningMessage}. */\n readonly branching?: number;\n /** Intensity of the electrical halo around the core. See {@link LightningMessage}. */\n readonly glow?: number;\n /** Rate at which the pattern or motion repeats. See {@link LightningMessage}. */\n readonly frequency?: number;\n };\nfunction options(o: LightningOptions) {\n if (\n o.edge !== undefined &&\n ![\"top\", \"right\", \"bottom\", \"left\"].includes(o.edge)\n )\n throw new TypeError(\"Unknown lightning edge.\");\n return {\n ...electricOptions(o),\n positive: point(o.positive ?? { x: 0.2, y: 0.5 }),\n negative: point(o.negative ?? { x: 0.8, y: 0.5 }),\n edge: o.edge,\n active: o.active ?? true,\n frequency: range(o.frequency ?? 15, 1, 30, \"Frequency\"),\n contactCore: o.contactCore ?? false,\n };\n}\ntype Connection = ElectricConnection;\ninterface State {\n kernel: ElectricMemory;\n config: ReturnType<typeof options>;\n inputKey: string;\n time: number;\n paused: boolean;\n connections: Map<string, Connection>;\n}\nfunction salt(id: string) {\n let n = 0;\n for (let i = 0; i < id.length; i++)\n n = (Math.imul(n, 31) + id.charCodeAt(i)) | 0;\n return n;\n}\nconst recipe = /* @__PURE__ */ defineTexture<\n LightningOptions,\n State,\n LightningMessage\n>({\n defaultPlacement: { mode: \"stretch\" },\n create(context, input) {\n if (input.active !== false) context.requestFrame();\n const config = options(input);\n return {\n kernel: new ElectricMemory(wasmModule()),\n config,\n inputKey: JSON.stringify(input),\n time: 0,\n paused: false,\n connections: new Map(),\n };\n },\n update(s, input, context) {\n const key = JSON.stringify(input);\n if (key === s.inputKey) return;\n const next = options(input);\n if (next.seed !== s.config.seed) {\n s.time = 0;\n s.connections.clear();\n s.kernel.clearConnections();\n }\n s.config = next;\n s.inputKey = key;\n context.invalidate();\n if (!s.paused && (next.active || s.connections.size))\n context.requestFrame();\n },\n receive(s, m, context) {\n switch (m.type) {\n case \"pause\":\n s.paused = m.paused;\n break;\n case \"reset\":\n s.config.seed =\n m.seed === undefined ? s.config.seed : validateSeed(m.seed);\n s.time = 0;\n s.connections.clear();\n s.kernel.clearConnections();\n break;\n case \"configure\":\n s.config = options({ ...s.config, ...m });\n break;\n case \"connect\": {\n if (typeof m.id !== \"string\" || m.id.length > 128)\n throw new RangeError(\n \"Connection id must be a string of at most 128 characters.\",\n );\n const positive = point(m.positive),\n negative = point(m.negative),\n old = s.connections.get(m.id);\n if (old) {\n old.positive = positive;\n old.negative = negative;\n old.active = true;\n old.strength = 1;\n } else if (s.connections.size < 24)\n s.connections.set(\n m.id,\n Object.assign(s.kernel.connection(), {\n positive,\n negative,\n strength: 1,\n active: true,\n salt: salt(m.id),\n }),\n );\n break;\n }\n case \"disconnect\": {\n const old = s.connections.get(m.id);\n if (old) old.active = false;\n break;\n }\n default:\n throw new TypeError(\"Unknown lightning message.\");\n }\n context.invalidate();\n if (!s.paused && (s.config.active || s.connections.size))\n context.requestFrame();\n },\n advance(s, frame, context) {\n if (s.paused) return;\n const dt = Math.min(50, frame.delta) / 1000;\n s.time += dt;\n s.kernel.advanceLightning(dt);\n for (const [id, c] of s.connections) {\n if (c.strength < 0.005) {\n c.release();\n s.connections.delete(id);\n }\n }\n context.invalidate();\n if (s.config.active || s.connections.size) context.requestFrame();\n },\n rasterize(s, context) {\n s.kernel.lightning(s.config, s.time, s.connections.values());\n s.kernel.draw(context, s.config.glow);\n },\n dispose(s) {\n s.connections.clear();\n s.kernel.dispose();\n },\n});\n/**\n * Persistent branching arcs between artistic positive/negative points.\n *\n * @param config - Lightning geometry, timing, and appearance settings. See\n * {@link LightningOptions} .\n * @returns A lightning texture recipe for useTexture.\n *\n * @see {@link LightningOptions}\n */\nexport function lightning(config: LightningOptions = {}) {\n return recipe(config);\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,sBAA+C;AACxD,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AACtB,MAAM,aAA6B,2BAAW,KAAK;AACnD,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAC7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAmEP,SAAS,QAAQ,GAAqB;AACpC,MACE,EAAE,SAAS,UACX,CAAC,CAAC,OAAO,SAAS,UAAU,MAAM,EAAE,SAAS,EAAE,IAAI;AAEnD,UAAM,IAAI,UAAU,yBAAyB;AAC/C,SAAO;AAAA,IACL,GAAG,gBAAgB,CAAC;AAAA,IACpB,UAAU,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC;AAAA,IAChD,UAAU,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC;AAAA,IAChD,MAAM,EAAE;AAAA,IACR,QAAQ,EAAE,UAAU;AAAA,IACpB,WAAW,MAAM,EAAE,aAAa,IAAI,GAAG,IAAI,WAAW;AAAA,IACtD,aAAa,EAAE,eAAe;AAAA,EAChC;AACF;AAUA,SAAS,KAAK,IAAY;AACxB,MAAI,IAAI;AACR,WAAS,IAAI,GAAG,IAAI,GAAG,QAAQ;AAC7B,QAAK,KAAK,KAAK,GAAG,EAAE,IAAI,GAAG,WAAW,CAAC,IAAK;AAC9C,SAAO;AACT;AACA,MAAM,SAAyB,8BAI7B;AAAA,EACA,kBAAkB,EAAE,MAAM,UAAU;AAAA,EACpC,OAAO,SAAS,OAAO;AACrB,QAAI,MAAM,WAAW,MAAO,SAAQ,aAAa;AACjD,UAAM,SAAS,QAAQ,KAAK;AAC5B,WAAO;AAAA,MACL,QAAQ,IAAI,eAAe,WAAW,CAAC;AAAA,MACvC;AAAA,MACA,UAAU,KAAK,UAAU,KAAK;AAAA,MAC9B,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,aAAa,oBAAI,IAAI;AAAA,IACvB;AAAA,EACF;AAAA,EACA,OAAO,GAAG,OAAO,SAAS;AACxB,UAAM,MAAM,KAAK,UAAU,KAAK;AAChC,QAAI,QAAQ,EAAE,SAAU;AACxB,UAAM,OAAO,QAAQ,KAAK;AAC1B,QAAI,KAAK,SAAS,EAAE,OAAO,MAAM;AAC/B,QAAE,OAAO;AACT,QAAE,YAAY,MAAM;AACpB,QAAE,OAAO,iBAAiB;AAAA,IAC5B;AACA,MAAE,SAAS;AACX,MAAE,WAAW;AACb,YAAQ,WAAW;AACnB,QAAI,CAAC,EAAE,WAAW,KAAK,UAAU,EAAE,YAAY;AAC7C,cAAQ,aAAa;AAAA,EACzB;AAAA,EACA,QAAQ,GAAG,GAAG,SAAS;AACrB,YAAQ,EAAE,MAAM;AAAA,MACd,KAAK;AACH,UAAE,SAAS,EAAE;AACb;AAAA,MACF,KAAK;AACH,UAAE,OAAO,OACP,EAAE,SAAS,SAAY,EAAE,OAAO,OAAO,aAAa,EAAE,IAAI;AAC5D,UAAE,OAAO;AACT,UAAE,YAAY,MAAM;AACpB,UAAE,OAAO,iBAAiB;AAC1B;AAAA,MACF,KAAK;AACH,UAAE,SAAS,QAAQ,EAAE,GAAG,EAAE,QAAQ,GAAG,EAAE,CAAC;AACxC;AAAA,MACF,KAAK,WAAW;AACd,YAAI,OAAO,EAAE,OAAO,YAAY,EAAE,GAAG,SAAS;AAC5C,gBAAM,IAAI;AAAA,YACR;AAAA,UACF;AACF,cAAM,WAAW,MAAM,EAAE,QAAQ,GAC/B,WAAW,MAAM,EAAE,QAAQ,GAC3B,MAAM,EAAE,YAAY,IAAI,EAAE,EAAE;AAC9B,YAAI,KAAK;AACP,cAAI,WAAW;AACf,cAAI,WAAW;AACf,cAAI,SAAS;AACb,cAAI,WAAW;AAAA,QACjB,WAAW,EAAE,YAAY,OAAO;AAC9B,YAAE,YAAY;AAAA,YACZ,EAAE;AAAA,YACF,OAAO,OAAO,EAAE,OAAO,WAAW,GAAG;AAAA,cACnC;AAAA,cACA;AAAA,cACA,UAAU;AAAA,cACV,QAAQ;AAAA,cACR,MAAM,KAAK,EAAE,EAAE;AAAA,YACjB,CAAC;AAAA,UACH;AACF;AAAA,MACF;AAAA,MACA,KAAK,cAAc;AACjB,cAAM,MAAM,EAAE,YAAY,IAAI,EAAE,EAAE;AAClC,YAAI,IAAK,KAAI,SAAS;AACtB;AAAA,MACF;AAAA,MACA;AACE,cAAM,IAAI,UAAU,4BAA4B;AAAA,IACpD;AACA,YAAQ,WAAW;AACnB,QAAI,CAAC,EAAE,WAAW,EAAE,OAAO,UAAU,EAAE,YAAY;AACjD,cAAQ,aAAa;AAAA,EACzB;AAAA,EACA,QAAQ,GAAG,OAAO,SAAS;AACzB,QAAI,EAAE,OAAQ;AACd,UAAM,KAAK,KAAK,IAAI,IAAI,MAAM,KAAK,IAAI;AACvC,MAAE,QAAQ;AACV,MAAE,OAAO,iBAAiB,EAAE;AAC5B,eAAW,CAAC,IAAI,CAAC,KAAK,EAAE,aAAa;AACnC,UAAI,EAAE,WAAW,MAAO;AACtB,UAAE,QAAQ;AACV,UAAE,YAAY,OAAO,EAAE;AAAA,MACzB;AAAA,IACF;AACA,YAAQ,WAAW;AACnB,QAAI,EAAE,OAAO,UAAU,EAAE,YAAY,KAAM,SAAQ,aAAa;AAAA,EAClE;AAAA,EACA,UAAU,GAAG,SAAS;AACpB,MAAE,OAAO,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,OAAO,CAAC;AAC3D,MAAE,OAAO,KAAK,SAAS,EAAE,OAAO,IAAI;AAAA,EACtC;AAAA,EACA,QAAQ,GAAG;AACT,MAAE,YAAY,MAAM;AACpB,MAAE,OAAO,QAAQ;AAAA,EACnB;AACF,CAAC;AAUM,SAAS,UAAU,SAA2B,CAAC,GAAG;AACvD,SAAO,OAAO,MAAM;AACtB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ProceduralTextureProps } from "./procedural-texture.js";
|
|
2
|
+
/**
|
|
3
|
+
* The supported static material generators: marble, paper, and cellular.
|
|
4
|
+
*
|
|
5
|
+
* @see {@link ProceduralTextureProps}
|
|
6
|
+
*/
|
|
7
|
+
export type TextureKind = "marble" | "paper" | "cellular";
|
|
8
|
+
export type MaterialGenerator = (width: number, height: number, seed: number, scale: number, detail: number, previous?: Float32Array) => Float32Array;
|
|
9
|
+
export declare const marbleField: MaterialGenerator;
|
|
10
|
+
export declare const paperField: MaterialGenerator;
|
|
11
|
+
export declare const cellularField: MaterialGenerator;
|
|
12
|
+
export declare function materialField(width: number, height: number, kind: TextureKind, seed: number, scale: number, detail: number, previous?: Float32Array): Float32Array;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { reuseFieldMemory, lazyKernel } from "./wasm/memory.js";
|
|
2
|
+
import { bytes as marbleBytes } from "./wasm/marble-bytes.js";
|
|
3
|
+
import { bytes as paperBytes } from "./wasm/paper-bytes.js";
|
|
4
|
+
import { bytes as cellularBytes } from "./wasm/cellular-bytes.js";
|
|
5
|
+
function generator(bytes) {
|
|
6
|
+
const module = lazyKernel(bytes);
|
|
7
|
+
return (width, height, seed, scale, detail, previous) => {
|
|
8
|
+
const owner = reuseFieldMemory(previous, module(), width, height);
|
|
9
|
+
const field = owner.fields[0];
|
|
10
|
+
owner.kernel.run(field.byteOffset, width, height, seed, scale, detail);
|
|
11
|
+
return field;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
const marbleField = /* @__PURE__ */ generator(marbleBytes);
|
|
15
|
+
const paperField = /* @__PURE__ */ generator(paperBytes);
|
|
16
|
+
const cellularField = /* @__PURE__ */ generator(cellularBytes);
|
|
17
|
+
const generators = {
|
|
18
|
+
marble: marbleField,
|
|
19
|
+
paper: paperField,
|
|
20
|
+
cellular: cellularField
|
|
21
|
+
};
|
|
22
|
+
function materialField(width, height, kind, seed, scale, detail, previous) {
|
|
23
|
+
return generators[kind](width, height, seed, scale, detail, previous);
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
cellularField,
|
|
27
|
+
marbleField,
|
|
28
|
+
materialField,
|
|
29
|
+
paperField
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=material-field.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/features/textures/lib/material-field.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ProceduralTextureProps } from './procedural-texture.js';\nimport { reuseFieldMemory, lazyKernel } from \"./wasm/memory.js\";\nimport { bytes as marbleBytes } from \"./wasm/marble-bytes.js\";\nimport { bytes as paperBytes } from \"./wasm/paper-bytes.js\";\nimport { bytes as cellularBytes } from \"./wasm/cellular-bytes.js\";\n/**\n * The supported static material generators: marble, paper, and cellular.\n *\n * @see {@link ProceduralTextureProps}\n */\nexport type TextureKind = \"marble\" | \"paper\" | \"cellular\";\nexport type MaterialGenerator = (\n width: number,\n height: number,\n seed: number,\n scale: number,\n detail: number,\n previous?: Float32Array,\n) => Float32Array;\nfunction generator(bytes: string): MaterialGenerator {\n const module = lazyKernel(bytes);\n return (width, height, seed, scale, detail, previous) => {\n const owner = reuseFieldMemory(previous, module(), width, height);\n const field = owner.fields[0];\n owner.kernel.run(field.byteOffset, width, height, seed, scale, detail);\n return field;\n };\n}\nexport const marbleField = /* @__PURE__ */ generator(marbleBytes);\nexport const paperField = /* @__PURE__ */ generator(paperBytes);\nexport const cellularField = /* @__PURE__ */ generator(cellularBytes);\nconst generators: Record<TextureKind, MaterialGenerator> = {\n marble: marbleField,\n paper: paperField,\n cellular: cellularField,\n};\nexport function materialField(\n width: number,\n height: number,\n kind: TextureKind,\n seed: number,\n scale: number,\n detail: number,\n previous?: Float32Array,\n): Float32Array {\n return generators[kind](width, height, seed, scale, detail, previous);\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,kBAAkB,kBAAkB;AAC7C,SAAS,SAAS,mBAAmB;AACrC,SAAS,SAAS,kBAAkB;AACpC,SAAS,SAAS,qBAAqB;AAevC,SAAS,UAAU,OAAkC;AACnD,QAAM,SAAS,WAAW,KAAK;AAC/B,SAAO,CAAC,OAAO,QAAQ,MAAM,OAAO,QAAQ,aAAa;AACvD,UAAM,QAAQ,iBAAiB,UAAU,OAAO,GAAG,OAAO,MAAM;AAChE,UAAM,QAAQ,MAAM,OAAO,CAAC;AAC5B,UAAM,OAAO,IAAI,MAAM,YAAY,OAAO,QAAQ,MAAM,OAAO,MAAM;AACrE,WAAO;AAAA,EACT;AACF;AACO,MAAM,cAA8B,0BAAU,WAAW;AACzD,MAAM,aAA6B,0BAAU,UAAU;AACvD,MAAM,gBAAgC,0BAAU,aAAa;AACpE,MAAM,aAAqD;AAAA,EACzD,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,UAAU;AACZ;AACO,SAAS,cACd,OACA,QACA,MACA,MACA,OACA,QACA,UACc;AACd,SAAO,WAAW,IAAI,EAAE,OAAO,QAAQ,MAAM,OAAO,QAAQ,QAAQ;AACtE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ProceduralTextureProps } from "./procedural-texture.js";
|
|
2
|
+
import type { ReactionDiffusionProps } from "./reaction-diffusion.js";
|
|
3
|
+
/**
|
|
4
|
+
* Ordered colors forming a texture's presentation ramp.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link texturePalettes}
|
|
7
|
+
* @see {@link ProceduralTextureProps}
|
|
8
|
+
* @see {@link ReactionDiffusionProps}
|
|
9
|
+
*/
|
|
10
|
+
export type TexturePalette = readonly string[];
|
|
11
|
+
/**
|
|
12
|
+
* Built-in immutable color ramps for procedural texture presentation.
|
|
13
|
+
*
|
|
14
|
+
* @see {@link TexturePalette}
|
|
15
|
+
*/
|
|
16
|
+
export declare const texturePalettes: Readonly<{
|
|
17
|
+
/** Dark blue through teal to pale yellow. See {@link texturePalettes}. */
|
|
18
|
+
lagoon: readonly string[];
|
|
19
|
+
/** Warm ivory through lavender to deep blue. See {@link texturePalettes}. */
|
|
20
|
+
porcelain: readonly string[];
|
|
21
|
+
/** Dark violet through coral to pale yellow. See {@link texturePalettes}. */
|
|
22
|
+
ember: readonly string[];
|
|
23
|
+
}>;
|
|
24
|
+
export declare function paletteLut(palette: TexturePalette): Uint8ClampedArray;
|
|
25
|
+
/**
|
|
26
|
+
* The width and height of a texture's raster grid.
|
|
27
|
+
*
|
|
28
|
+
* @see {@link TexturePalette}
|
|
29
|
+
* @see {@link ReactionDiffusionProps}
|
|
30
|
+
* @see {@link ProceduralTextureProps}
|
|
31
|
+
*/
|
|
32
|
+
export interface TextureResolution {
|
|
33
|
+
/**
|
|
34
|
+
* Horizontal extent in the units of the containing geometry or surface. See
|
|
35
|
+
* {@link TextureResolution}.
|
|
36
|
+
*/
|
|
37
|
+
readonly width: number;
|
|
38
|
+
/**
|
|
39
|
+
* Vertical extent in the units of the containing geometry or surface. See
|
|
40
|
+
* {@link TextureResolution}.
|
|
41
|
+
*/
|
|
42
|
+
readonly height: number;
|
|
43
|
+
}
|
|
44
|
+
export declare function validateResolution(value?: TextureResolution): TextureResolution;
|
|
45
|
+
export declare function validateSeed(seed?: number): number;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const texturePalettes = Object.freeze({
|
|
2
|
+
/** Dark blue through teal to pale yellow. See {@link texturePalettes}. */
|
|
3
|
+
lagoon: Object.freeze(["#081e2c", "#125568", "#50b8ad", "#e5efb3"]),
|
|
4
|
+
/** Warm ivory through lavender to deep blue. See {@link texturePalettes}. */
|
|
5
|
+
porcelain: Object.freeze(["#f2e7d4", "#b7a9c0", "#536194", "#172955"]),
|
|
6
|
+
/** Dark violet through coral to pale yellow. See {@link texturePalettes}. */
|
|
7
|
+
ember: Object.freeze(["#241526", "#893955", "#e88470", "#ffe3aa"])
|
|
8
|
+
});
|
|
9
|
+
function paletteLut(palette) {
|
|
10
|
+
if (palette.length < 2 || palette.length > 16)
|
|
11
|
+
throw new RangeError("Texture palette requires 2\u201316 #RRGGBB colors.");
|
|
12
|
+
const colors = palette.map((color) => {
|
|
13
|
+
if (!/^#[0-9a-f]{6}$/i.test(color))
|
|
14
|
+
throw new TypeError("Texture palette colors must use #RRGGBB.");
|
|
15
|
+
return [
|
|
16
|
+
parseInt(color.slice(1, 3), 16),
|
|
17
|
+
parseInt(color.slice(3, 5), 16),
|
|
18
|
+
parseInt(color.slice(5, 7), 16)
|
|
19
|
+
];
|
|
20
|
+
});
|
|
21
|
+
const lut = new Uint8ClampedArray(256 * 4);
|
|
22
|
+
for (let i = 0; i < 256; i++) {
|
|
23
|
+
const position = i / 255 * (colors.length - 1);
|
|
24
|
+
const lo = Math.min(colors.length - 2, Math.floor(position)), mix = position - lo;
|
|
25
|
+
for (let c = 0; c < 3; c++)
|
|
26
|
+
lut[i * 4 + c] = colors[lo][c] * (1 - mix) + colors[lo + 1][c] * mix;
|
|
27
|
+
lut[i * 4 + 3] = 255;
|
|
28
|
+
}
|
|
29
|
+
return lut;
|
|
30
|
+
}
|
|
31
|
+
function validateResolution(value = { width: 256, height: 160 }) {
|
|
32
|
+
if (![value.width, value.height].every(
|
|
33
|
+
(n) => Number.isInteger(n) && n >= 8 && n <= 1024
|
|
34
|
+
) || value.width * value.height > 262144) {
|
|
35
|
+
throw new RangeError(
|
|
36
|
+
"Texture resolution must contain integer dimensions from 8 to 1024 and at most 262144 cells."
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
return { width: value.width, height: value.height };
|
|
40
|
+
}
|
|
41
|
+
function validateSeed(seed = 42) {
|
|
42
|
+
if (!Number.isInteger(seed) || seed < 0 || seed > 4294967295)
|
|
43
|
+
throw new RangeError("Texture seed must be an unsigned 32-bit integer.");
|
|
44
|
+
return seed;
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
paletteLut,
|
|
48
|
+
texturePalettes,
|
|
49
|
+
validateResolution,
|
|
50
|
+
validateSeed
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=palette.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/features/textures/lib/palette.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ProceduralTextureProps } from './procedural-texture.js';\nimport type { ReactionDiffusionProps } from './reaction-diffusion.js';\n/**\n * Ordered colors forming a texture's presentation ramp.\n *\n * @see {@link texturePalettes}\n * @see {@link ProceduralTextureProps}\n * @see {@link ReactionDiffusionProps}\n */\nexport type TexturePalette = readonly string[];\n/**\n * Built-in immutable color ramps for procedural texture presentation.\n *\n * @see {@link TexturePalette}\n */\nexport const texturePalettes = Object.freeze({\n /** Dark blue through teal to pale yellow. See {@link texturePalettes}. */\n lagoon: Object.freeze([\"#081e2c\", \"#125568\", \"#50b8ad\", \"#e5efb3\"]),\n /** Warm ivory through lavender to deep blue. See {@link texturePalettes}. */\n porcelain: Object.freeze([\"#f2e7d4\", \"#b7a9c0\", \"#536194\", \"#172955\"]),\n /** Dark violet through coral to pale yellow. See {@link texturePalettes}. */\n ember: Object.freeze([\"#241526\", \"#893955\", \"#e88470\", \"#ffe3aa\"]),\n});\n\nexport function paletteLut(palette: TexturePalette): Uint8ClampedArray {\n if (palette.length < 2 || palette.length > 16)\n throw new RangeError(\"Texture palette requires 2\u201316 #RRGGBB colors.\");\n const colors = palette.map((color) => {\n if (!/^#[0-9a-f]{6}$/i.test(color))\n throw new TypeError(\"Texture palette colors must use #RRGGBB.\");\n return [\n parseInt(color.slice(1, 3), 16),\n parseInt(color.slice(3, 5), 16),\n parseInt(color.slice(5, 7), 16),\n ];\n });\n const lut = new Uint8ClampedArray(256 * 4);\n for (let i = 0; i < 256; i++) {\n const position = (i / 255) * (colors.length - 1);\n const lo = Math.min(colors.length - 2, Math.floor(position)),\n mix = position - lo;\n for (let c = 0; c < 3; c++)\n lut[i * 4 + c] = colors[lo][c] * (1 - mix) + colors[lo + 1][c] * mix;\n lut[i * 4 + 3] = 255;\n }\n return lut;\n}\n\n/**\n * The width and height of a texture's raster grid.\n *\n * @see {@link TexturePalette}\n * @see {@link ReactionDiffusionProps}\n * @see {@link ProceduralTextureProps}\n */\nexport interface TextureResolution {\n /**\n * Horizontal extent in the units of the containing geometry or surface. See\n * {@link TextureResolution}.\n */\n readonly width: number;\n /**\n * Vertical extent in the units of the containing geometry or surface. See\n * {@link TextureResolution}.\n */\n readonly height: number;\n}\nexport function validateResolution(\n value: TextureResolution = { width: 256, height: 160 },\n): TextureResolution {\n if (\n ![value.width, value.height].every(\n (n) => Number.isInteger(n) && n >= 8 && n <= 1024,\n ) ||\n value.width * value.height > 262144\n ) {\n throw new RangeError(\n \"Texture resolution must contain integer dimensions from 8 to 1024 and at most 262144 cells.\",\n );\n }\n return { width: value.width, height: value.height };\n}\nexport function validateSeed(seed = 42): number {\n if (!Number.isInteger(seed) || seed < 0 || seed > 0xffffffff)\n throw new RangeError(\"Texture seed must be an unsigned 32-bit integer.\");\n return seed;\n}\n"],
|
|
5
|
+
"mappings": "AAeO,MAAM,kBAAkB,OAAO,OAAO;AAAA;AAAA,EAE3C,QAAQ,OAAO,OAAO,CAAC,WAAW,WAAW,WAAW,SAAS,CAAC;AAAA;AAAA,EAElE,WAAW,OAAO,OAAO,CAAC,WAAW,WAAW,WAAW,SAAS,CAAC;AAAA;AAAA,EAErE,OAAO,OAAO,OAAO,CAAC,WAAW,WAAW,WAAW,SAAS,CAAC;AACnE,CAAC;AAEM,SAAS,WAAW,SAA4C;AACrE,MAAI,QAAQ,SAAS,KAAK,QAAQ,SAAS;AACzC,UAAM,IAAI,WAAW,oDAA+C;AACtE,QAAM,SAAS,QAAQ,IAAI,CAAC,UAAU;AACpC,QAAI,CAAC,kBAAkB,KAAK,KAAK;AAC/B,YAAM,IAAI,UAAU,0CAA0C;AAChE,WAAO;AAAA,MACL,SAAS,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE;AAAA,MAC9B,SAAS,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE;AAAA,MAC9B,SAAS,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE;AAAA,IAChC;AAAA,EACF,CAAC;AACD,QAAM,MAAM,IAAI,kBAAkB,MAAM,CAAC;AACzC,WAAS,IAAI,GAAG,IAAI,KAAK,KAAK;AAC5B,UAAM,WAAY,IAAI,OAAQ,OAAO,SAAS;AAC9C,UAAM,KAAK,KAAK,IAAI,OAAO,SAAS,GAAG,KAAK,MAAM,QAAQ,CAAC,GACzD,MAAM,WAAW;AACnB,aAAS,IAAI,GAAG,IAAI,GAAG;AACrB,UAAI,IAAI,IAAI,CAAC,IAAI,OAAO,EAAE,EAAE,CAAC,KAAK,IAAI,OAAO,OAAO,KAAK,CAAC,EAAE,CAAC,IAAI;AACnE,QAAI,IAAI,IAAI,CAAC,IAAI;AAAA,EACnB;AACA,SAAO;AACT;AAqBO,SAAS,mBACd,QAA2B,EAAE,OAAO,KAAK,QAAQ,IAAI,GAClC;AACnB,MACE,CAAC,CAAC,MAAM,OAAO,MAAM,MAAM,EAAE;AAAA,IAC3B,CAAC,MAAM,OAAO,UAAU,CAAC,KAAK,KAAK,KAAK,KAAK;AAAA,EAC/C,KACA,MAAM,QAAQ,MAAM,SAAS,QAC7B;AACA,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO,EAAE,OAAO,MAAM,OAAO,QAAQ,MAAM,OAAO;AACpD;AACO,SAAS,aAAa,OAAO,IAAY;AAC9C,MAAI,CAAC,OAAO,UAAU,IAAI,KAAK,OAAO,KAAK,OAAO;AAChD,UAAM,IAAI,WAAW,kDAAkD;AACzE,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ReactionDiffusionProps } from "./reaction-diffusion.js";
|
|
2
|
+
import type { ProceduralTextureProps } from "./procedural-texture.js";
|
|
3
|
+
/**
|
|
4
|
+
* Borrowed sources are valid only during the synchronous renderer callback.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link TextureRenderer}
|
|
7
|
+
*/
|
|
8
|
+
export interface TextureRenderFrame {
|
|
9
|
+
/** Current offscreen texture raster available to the presentation callback. See {@link TextureRenderFrame}. */
|
|
10
|
+
readonly source: OffscreenCanvas;
|
|
11
|
+
/** White with texture intensity as alpha, allocated lazily on first access. */
|
|
12
|
+
readonly mask: OffscreenCanvas;
|
|
13
|
+
/**
|
|
14
|
+
* Horizontal extent in the units of the containing geometry or surface. See
|
|
15
|
+
* {@link TextureRenderFrame}.
|
|
16
|
+
*/
|
|
17
|
+
readonly width: number;
|
|
18
|
+
/**
|
|
19
|
+
* Vertical extent in the units of the containing geometry or surface. See
|
|
20
|
+
* {@link TextureRenderFrame}.
|
|
21
|
+
*/
|
|
22
|
+
readonly height: number;
|
|
23
|
+
/** Width of the underlying texture raster in pixels. See {@link TextureRenderFrame}. */
|
|
24
|
+
readonly textureWidth: number;
|
|
25
|
+
/** Height of the underlying texture raster in pixels. See {@link TextureRenderFrame}. */
|
|
26
|
+
readonly textureHeight: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Custom presentation callback receiving an offscreen context and the current texture raster
|
|
30
|
+
* frame.
|
|
31
|
+
*
|
|
32
|
+
* @param context - Offscreen drawing context to paint into.
|
|
33
|
+
* @param texture - Current texture surface and frame metadata. See {@link TextureRenderFrame}.
|
|
34
|
+
*
|
|
35
|
+
* @see {@link TextureRenderFrame}
|
|
36
|
+
* @see {@link ReactionDiffusionProps}
|
|
37
|
+
* @see {@link ProceduralTextureProps}
|
|
38
|
+
*/
|
|
39
|
+
export type TextureRenderer = (context: OffscreenCanvasRenderingContext2D, texture: Readonly<TextureRenderFrame>) => void;
|
|
40
|
+
export declare class TextureRaster {
|
|
41
|
+
readonly width: number;
|
|
42
|
+
readonly height: number;
|
|
43
|
+
readonly surface: OffscreenCanvas;
|
|
44
|
+
readonly context: OffscreenCanvasRenderingContext2D;
|
|
45
|
+
private maskRaster?;
|
|
46
|
+
private maskSurface?;
|
|
47
|
+
private maskContext?;
|
|
48
|
+
private maskDirty;
|
|
49
|
+
constructor(width: number, height: number);
|
|
50
|
+
update(field: Float32Array, lut: Uint8ClampedArray, gain?: number): void;
|
|
51
|
+
private getMask;
|
|
52
|
+
draw(ctx: OffscreenCanvasRenderingContext2D, width: number, height: number, backingWidth: number, backingHeight: number, render?: TextureRenderer): void;
|
|
53
|
+
dispose(): void;
|
|
54
|
+
}
|