text-shadow
v1.0.2
Published
Shadow Laboratory
Downloads
33
Readme
text-shadow — Shadow Lab
A scientific CSS text-shadow builder that models shadows as optical systems.
Pick a physical model, adjust its parameters, and copy production-ready CSS.
Run locally
npm run devOpens http://localhost:8080 via http-server.
File structure
text-shadow/
├── index.html ← HTML shell (custom elements only, no logic)
├── styles.css ← All CSS: tokens, layout, preview, keyframe animations
├── src/
│ ├── main.js ← Entry point: imports and registers all custom elements
│ ├── reactive.js ← Signal/Scope/Concern reactive primitives
│ ├── context.js ← ApplicationContext (state root) and AppElement base class
│ ├── utils/
│ │ ├── math.js ← clamp, round, lightVector, shadowEntry
│ │ └── color.js ← hex/rgb/hsl conversions, luminance, contrast ratio
│ ├── domain/
│ │ ├── effects.js ← EFFECTS config — developer-editable model definitions
│ │ ├── presets.js ← PRESETS config — developer-editable preset library
│ │ ├── state.js ← BASE_STATE, FONT_STACKS, state factory functions
│ │ └── model.js ← buildShadowModel, buildAudit, normalise/patch helpers
│ └── components/
│ ├── layout.js ← Structural custom elements (navbar, card, grid…)
│ └── features.js ← Feature custom elements (editor, preview, audit…)
├── AGENTS.md ← Guide for AI agents working on this codebase
└── SKILL.md ← Reference for the shadow model skillAdding an effect
See the top of src/domain/effects.js for a step-by-step template.
The short version:
- Add an entry to
EFFECTSineffects.js - Add its id to
GLOBAL_RANGE_USAGEineffects.js - Add a CSS generation block in
model.js - Optionally add presets in
presets.js
Adding a preset
See the top of src/domain/presets.js for a copy-paste template.
Technology
- Vanilla ES modules — no bundler, no framework
- Bootstrap 5.3 for layout and base styles
- Web Components (Custom Elements v1) for the component model
- A tiny hand-written reactive layer (
src/reactive.js)
