lensfx 0.1.1 → 0.1.3
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/CHANGELOG.md +69 -53
- package/README.md +39 -0
- package/dist/cdn/lensfx.js +1717 -0
- package/dist/cdn/lensfx.js.map +1 -0
- package/dist/cdn/lensfx.min.js +371 -0
- package/dist/cdn/lensfx.min.js.map +1 -0
- package/dist/index.d.mts +3 -368
- package/dist/index.d.ts +3 -368
- package/dist/index.js +413 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +413 -1
- package/dist/index.mjs.map +1 -1
- package/dist/lensfx.css +1 -1
- package/dist/vanilla.d.mts +493 -0
- package/dist/vanilla.d.ts +493 -0
- package/dist/vanilla.js +1694 -0
- package/dist/vanilla.js.map +1 -0
- package/dist/vanilla.mjs +1675 -0
- package/dist/vanilla.mjs.map +1 -0
- package/package.json +29 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,53 +1,69 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to `lensfx` will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [0.1.
|
|
9
|
-
|
|
10
|
-
### Added
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `lensfx` will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.3] - 2026-10-17
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Zero-dependency vanilla DOM engine: `createLens(target, options)` with real-time SVG displacement, chromatic aberration, pointer tracking (`interactive: true`), responsive auto-resizing via `ResizeObserver`, and dynamic lifecycle controls (`setPosition`, `update`, `destroy`).
|
|
12
|
+
- Standalone CDN IIFE builds (`dist/cdn/lensfx.min.js` and `dist/cdn/lensfx.js`) attaching to `window.lensfx` for direct `<script>` tag usage without bundlers or React.
|
|
13
|
+
- Subpath exports `"lensfx/vanilla"` and `"lensfx/cdn"` in `package.json`.
|
|
14
|
+
- Standard CDN distribution fields (`unpkg`, `jsdelivr`) pointing to `dist/cdn/lensfx.min.js`.
|
|
15
|
+
- Made peer dependencies (`react`, `react-dom`, `framer-motion`) optional for vanilla JS consumers.
|
|
16
|
+
- Live standalone CDN showcase demo (`examples/cdn-demo.html`).
|
|
17
|
+
|
|
18
|
+
## [0.1.2] - 2026-10-17
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- Refined package description and registry metadata to emphasize clean optical physics, real DOM refraction, and SVG filter mechanics.
|
|
22
|
+
- Cleaned up internal documentation and comments across engine and primitive layers.
|
|
23
|
+
|
|
24
|
+
## [0.1.1] - 2026-10-17
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
#### Engine Layer (`lensfx`)
|
|
29
|
+
- Pure mathematical optics engine:
|
|
30
|
+
- Error function (`erf`) calculation for Gaussian surface profiles.
|
|
31
|
+
- Optical dome constant calculation (`computeDomeConstants`).
|
|
32
|
+
- Radial gradient generation for spherical dome profiles (`domeGradient`).
|
|
33
|
+
- SVG `feColorMatrix` calculation for aspect ratio corrections (`colorMatrixValues`).
|
|
34
|
+
- SVG mask URI generation for rounded-rectangle lens clipping (`getSvgMaskDataUri`).
|
|
35
|
+
- Real-time and asynchronous displacement map generator (`createDisplacementMapGeneratorSync`, `generateDisplacementMapAsync`).
|
|
36
|
+
- Pre-calibrated lens optical constants (`SWITCH_GLASS_DEFAULTS`, `SLIDER_GLASS_DEFAULTS`, dark/light theme overrides).
|
|
37
|
+
|
|
38
|
+
#### Primitives Layer
|
|
39
|
+
- `<Lens>` unstyled behavioral glass component:
|
|
40
|
+
- SVG `feDisplacementMap` real-time DOM refraction (preserves text selection, pointer events, form inputs).
|
|
41
|
+
- Chromatic aberration separation (red, green, blue optical channels).
|
|
42
|
+
- Multi-lens context support (`Lens.General` / `Lens.Group`) for sharing one background across multiple moving lenses.
|
|
43
|
+
- Offscreen generation pausing (`pauseOffscreen`) via `IntersectionObserver`.
|
|
44
|
+
- Motion value interpolation for 60fps gesture and scroll-driven physics via Framer Motion.
|
|
45
|
+
|
|
46
|
+
#### Components Layer
|
|
47
|
+
- `<LensSwitch>` accessible glass toggle switch with spring physics, keyboard support (Space / Enter), and full controlled/uncontrolled state.
|
|
48
|
+
- `<LensSlider>` accessible optical glass range slider with tick quantization, track fill refraction, and thumb dome physics.
|
|
49
|
+
- `<LensToggleGroup>` segmented radio control with real-time sliding optical lens and glowing active indicator.
|
|
50
|
+
|
|
51
|
+
#### WebGL Layer
|
|
52
|
+
- `VideoRefractionRenderer` WebGL 1 shader fallback for live HTML5 `<video>` elements on WebKit / Safari.
|
|
53
|
+
- `QRRefractionRenderer` WebGL 2 (#version 300 es) interactive QR code refraction engine with O(1) uniform texture lookup.
|
|
54
|
+
|
|
55
|
+
#### Design Tokens
|
|
56
|
+
- Design token stylesheet `lensfx/styles` (`dist/lensfx.css`) providing namespaced CSS custom properties (`--lensfx-*`) for colors, radii, shadows, animations, auto dark-mode (`prefers-color-scheme`), and accessibility (`prefers-reduced-motion`, `:focus-visible`).
|
|
57
|
+
|
|
58
|
+
#### Developer Experience & Tooling
|
|
59
|
+
- Dual ESM and CJS bundle output with TypeScript declarations (`tsup`).
|
|
60
|
+
- `"use client"` directive injection for Next.js App Router (RSC) compatibility.
|
|
61
|
+
- Tree-shaking enabled with `sideEffects: ["*.css"]`.
|
|
62
|
+
- Comprehensive Vitest unit & integration test suite (50 tests covering pure math, switch, slider, and toggle group).
|
|
63
|
+
- Size-limit bundle gate (core engine < 10 kB, full library < 80 kB).
|
|
64
|
+
- GitHub Actions CI workflow for type checking, testing, building, and bundle size tracking.
|
|
65
|
+
|
|
66
|
+
## [0.1.0] - 2026-10-16
|
|
67
|
+
|
|
68
|
+
### Added
|
|
69
|
+
- Initial experimental release of optical glass refraction engine.
|
package/README.md
CHANGED
|
@@ -67,6 +67,45 @@ That's it. Zero configuration for a working lens.
|
|
|
67
67
|
|
|
68
68
|
---
|
|
69
69
|
|
|
70
|
+
### Vanilla JS / Static HTML (via CDN — No React, No Bundler)
|
|
71
|
+
|
|
72
|
+
You don't need npm, React, or a bundler. Drop a `<script>` tag into any static `.html` file:
|
|
73
|
+
|
|
74
|
+
```html
|
|
75
|
+
<!-- jsDelivr (always latest) -->
|
|
76
|
+
<script src="https://cdn.jsdelivr.net/npm/lensfx/dist/cdn/lensfx.min.js"></script>
|
|
77
|
+
|
|
78
|
+
<!-- or unpkg -->
|
|
79
|
+
<!-- <script src="https://unpkg.com/lensfx/dist/cdn/lensfx.min.js"></script> -->
|
|
80
|
+
|
|
81
|
+
<div id="card" style="width: 400px; height: 300px; position: relative;">
|
|
82
|
+
<h2>Refracted content</h2>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<script>
|
|
86
|
+
const lens = lensfx.createLens("#card", {
|
|
87
|
+
width: 200,
|
|
88
|
+
height: 120,
|
|
89
|
+
radius: 28,
|
|
90
|
+
depth: 2.5,
|
|
91
|
+
chroma: 0.7,
|
|
92
|
+
interactive: true, // tracks cursor automatically
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// Dynamic API
|
|
96
|
+
// lens.setPosition(x, y);
|
|
97
|
+
// lens.update({ depth: 3 });
|
|
98
|
+
// lens.destroy();
|
|
99
|
+
</script>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Or import the zero-dependency vanilla engine via npm:
|
|
103
|
+
```ts
|
|
104
|
+
import { createLens } from "lensfx/vanilla";
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
70
109
|
## Components
|
|
71
110
|
|
|
72
111
|
### `<Lens>` — primitive (unstyled)
|