@votax572002/fluxfx 0.1.4 → 0.1.5
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/README.md +63 -0
- package/dist/fluxfx.min.js +688 -49
- package/dist/index.cjs +688 -49
- package/dist/index.d.cts +72 -1
- package/dist/index.d.ts +72 -1
- package/dist/index.js +688 -49
- package/dist/react.cjs +688 -49
- package/dist/react.d.cts +144 -4
- package/dist/react.d.ts +144 -4
- package/dist/react.js +688 -49
- package/package.json +48 -48
package/dist/index.d.cts
CHANGED
|
@@ -4,6 +4,10 @@ type ProtectionLabel = 'normal' | 'reduced-res' | 'low-fps' | 'survival';
|
|
|
4
4
|
type QualityLevel = 'low' | 'medium' | 'high';
|
|
5
5
|
type ThemeMode = 'auto' | 'light' | 'dark';
|
|
6
6
|
type LayerMode = 'background' | 'overlay';
|
|
7
|
+
type PrismShape = 'prism' | 'torus' | 'orb';
|
|
8
|
+
type DeviceTarget = 'all' | 'desktop' | 'mobile' | 'tablet';
|
|
9
|
+
type ImageFitMode = 'cover' | 'contain';
|
|
10
|
+
type ImagePosition = 'center' | 'top' | 'bottom';
|
|
7
11
|
type UniformValue = number | [number, number] | [number, number, number] | [number, number, number, number] | Float32Array;
|
|
8
12
|
interface PerformanceOptions {
|
|
9
13
|
/** Enable adaptive DPR scaling when FPS drops (default: true) */
|
|
@@ -20,6 +24,18 @@ interface PerformanceOptions {
|
|
|
20
24
|
respectReducedMotion?: boolean;
|
|
21
25
|
/** Track container scroll progress (uScroll) and velocity (uScrollVel) (default: false) */
|
|
22
26
|
trackScroll?: boolean;
|
|
27
|
+
/** Target specific device class: 'all' | 'desktop' | 'mobile' | 'tablet' (default: 'all') */
|
|
28
|
+
device?: DeviceTarget;
|
|
29
|
+
/** Minimum viewport width in px required to mount/run the effect */
|
|
30
|
+
minWidth?: number;
|
|
31
|
+
/** Maximum viewport width in px allowed to mount/run the effect */
|
|
32
|
+
maxWidth?: number;
|
|
33
|
+
/** Shortcut: disable effect cleanly on mobile viewports (< mobileBreakpoint) */
|
|
34
|
+
disableOnMobile?: boolean;
|
|
35
|
+
/** Shortcut: disable effect cleanly on desktop viewports (>= mobileBreakpoint) */
|
|
36
|
+
disableOnDesktop?: boolean;
|
|
37
|
+
/** Viewport breakpoint in px separating mobile vs desktop (default: 768) */
|
|
38
|
+
mobileBreakpoint?: number;
|
|
23
39
|
}
|
|
24
40
|
interface FXInstance {
|
|
25
41
|
readonly isWebGL?: boolean;
|
|
@@ -61,6 +77,37 @@ interface FXOptions extends PerformanceOptions {
|
|
|
61
77
|
perspective?: number;
|
|
62
78
|
glare?: boolean;
|
|
63
79
|
strength?: number;
|
|
80
|
+
shape?: PrismShape;
|
|
81
|
+
depth?: number;
|
|
82
|
+
gloss?: number;
|
|
83
|
+
distortion?: number;
|
|
84
|
+
baseImage?: string;
|
|
85
|
+
revealImage?: string;
|
|
86
|
+
image?: string;
|
|
87
|
+
fit?: ImageFitMode;
|
|
88
|
+
position?: ImagePosition;
|
|
89
|
+
softness?: number;
|
|
90
|
+
edgeNoise?: number;
|
|
91
|
+
edgeGlow?: number;
|
|
92
|
+
ambient?: boolean;
|
|
93
|
+
clickReveal?: boolean;
|
|
94
|
+
activeIndex?: number;
|
|
95
|
+
focused?: boolean;
|
|
96
|
+
wrap?: boolean;
|
|
97
|
+
spread?: number;
|
|
98
|
+
depthScale?: number;
|
|
99
|
+
curve?: number;
|
|
100
|
+
parallax?: boolean | number;
|
|
101
|
+
focusOffsetX?: number;
|
|
102
|
+
focusScale?: number;
|
|
103
|
+
spotRadius?: number;
|
|
104
|
+
spotIntensity?: number;
|
|
105
|
+
spotPosition?: [number, number] | 'center' | 'left' | 'right';
|
|
106
|
+
onChange?: (detail: {
|
|
107
|
+
index: number;
|
|
108
|
+
focused: boolean;
|
|
109
|
+
element: HTMLElement | null;
|
|
110
|
+
}) => void;
|
|
64
111
|
[key: string]: unknown;
|
|
65
112
|
}
|
|
66
113
|
|
|
@@ -88,6 +135,15 @@ declare class FluxEngine {
|
|
|
88
135
|
private visibilityCallbacks;
|
|
89
136
|
private removeTicker;
|
|
90
137
|
private removeVisibilitySub;
|
|
138
|
+
private hasResizeListener;
|
|
139
|
+
private resizeRaf;
|
|
140
|
+
private isDeviceAllowed;
|
|
141
|
+
private hasDeviceConstraints;
|
|
142
|
+
private mountEntryInstance;
|
|
143
|
+
private unmountEntryInstance;
|
|
144
|
+
private attachEntryObserver;
|
|
145
|
+
private handleViewportResize;
|
|
146
|
+
private syncResizeWatcher;
|
|
91
147
|
private ensureObserver;
|
|
92
148
|
private ensureVisibilitySub;
|
|
93
149
|
private hasActiveTickWork;
|
|
@@ -138,6 +194,7 @@ interface WebGLQuadOptions extends PerformanceOptions {
|
|
|
138
194
|
adaptToSurface?: boolean;
|
|
139
195
|
overlayOpacity?: number;
|
|
140
196
|
uniforms?: Record<string, UniformValue>;
|
|
197
|
+
textures?: Record<string, string>;
|
|
141
198
|
interactive?: boolean;
|
|
142
199
|
}
|
|
143
200
|
declare class WebGLQuad {
|
|
@@ -200,6 +257,12 @@ declare class WebGLQuad {
|
|
|
200
257
|
private feedbackMaxDim;
|
|
201
258
|
private feedbackFloat;
|
|
202
259
|
private customUniforms;
|
|
260
|
+
private textureUrls;
|
|
261
|
+
private textureUnits;
|
|
262
|
+
private loadedImages;
|
|
263
|
+
private mainTextures;
|
|
264
|
+
private textureLoadTokens;
|
|
265
|
+
private nextTextureUnit;
|
|
203
266
|
private mouse;
|
|
204
267
|
private targetMouse;
|
|
205
268
|
private mouseVel;
|
|
@@ -336,6 +399,13 @@ declare class WebGLQuad {
|
|
|
336
399
|
pause(): void;
|
|
337
400
|
resume(): void;
|
|
338
401
|
destroy(): void;
|
|
402
|
+
private resolveTextureUrl;
|
|
403
|
+
private destroyMainTextures;
|
|
404
|
+
private bindMainTextures;
|
|
405
|
+
private uploadImageTexture;
|
|
406
|
+
private reuploadLoadedTextures;
|
|
407
|
+
private clearTextureSlot;
|
|
408
|
+
private syncTexturesFromOptions;
|
|
339
409
|
}
|
|
340
410
|
|
|
341
411
|
interface WebGLEffectConfig {
|
|
@@ -346,9 +416,10 @@ interface WebGLEffectConfig {
|
|
|
346
416
|
feedbackFloat?: boolean;
|
|
347
417
|
defaultColors: [string, string, string];
|
|
348
418
|
resolveUniforms?: (options: FXOptions) => Record<string, UniformValue>;
|
|
419
|
+
resolveTextures?: (options: FXOptions) => Record<string, string>;
|
|
349
420
|
}
|
|
350
421
|
declare function createWebGLEffect(config: WebGLEffectConfig): FXPlugin;
|
|
351
422
|
|
|
352
423
|
declare const FluxFX: FluxEngine;
|
|
353
424
|
|
|
354
|
-
export { type FXInstance, type FXOptions, type FXPlugin, FluxEngine, FluxFX, type FluxStats, type LayerMode, type QualityLevel, type ThemeMode, type WebGLEffectConfig, WebGLQuad, createWebGLEffect };
|
|
425
|
+
export { type DeviceTarget, type FXInstance, type FXOptions, type FXPlugin, FluxEngine, FluxFX, type FluxStats, type ImageFitMode, type ImagePosition, type LayerMode, type PrismShape, type QualityLevel, type ThemeMode, type WebGLEffectConfig, WebGLQuad, createWebGLEffect };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,10 @@ type ProtectionLabel = 'normal' | 'reduced-res' | 'low-fps' | 'survival';
|
|
|
4
4
|
type QualityLevel = 'low' | 'medium' | 'high';
|
|
5
5
|
type ThemeMode = 'auto' | 'light' | 'dark';
|
|
6
6
|
type LayerMode = 'background' | 'overlay';
|
|
7
|
+
type PrismShape = 'prism' | 'torus' | 'orb';
|
|
8
|
+
type DeviceTarget = 'all' | 'desktop' | 'mobile' | 'tablet';
|
|
9
|
+
type ImageFitMode = 'cover' | 'contain';
|
|
10
|
+
type ImagePosition = 'center' | 'top' | 'bottom';
|
|
7
11
|
type UniformValue = number | [number, number] | [number, number, number] | [number, number, number, number] | Float32Array;
|
|
8
12
|
interface PerformanceOptions {
|
|
9
13
|
/** Enable adaptive DPR scaling when FPS drops (default: true) */
|
|
@@ -20,6 +24,18 @@ interface PerformanceOptions {
|
|
|
20
24
|
respectReducedMotion?: boolean;
|
|
21
25
|
/** Track container scroll progress (uScroll) and velocity (uScrollVel) (default: false) */
|
|
22
26
|
trackScroll?: boolean;
|
|
27
|
+
/** Target specific device class: 'all' | 'desktop' | 'mobile' | 'tablet' (default: 'all') */
|
|
28
|
+
device?: DeviceTarget;
|
|
29
|
+
/** Minimum viewport width in px required to mount/run the effect */
|
|
30
|
+
minWidth?: number;
|
|
31
|
+
/** Maximum viewport width in px allowed to mount/run the effect */
|
|
32
|
+
maxWidth?: number;
|
|
33
|
+
/** Shortcut: disable effect cleanly on mobile viewports (< mobileBreakpoint) */
|
|
34
|
+
disableOnMobile?: boolean;
|
|
35
|
+
/** Shortcut: disable effect cleanly on desktop viewports (>= mobileBreakpoint) */
|
|
36
|
+
disableOnDesktop?: boolean;
|
|
37
|
+
/** Viewport breakpoint in px separating mobile vs desktop (default: 768) */
|
|
38
|
+
mobileBreakpoint?: number;
|
|
23
39
|
}
|
|
24
40
|
interface FXInstance {
|
|
25
41
|
readonly isWebGL?: boolean;
|
|
@@ -61,6 +77,37 @@ interface FXOptions extends PerformanceOptions {
|
|
|
61
77
|
perspective?: number;
|
|
62
78
|
glare?: boolean;
|
|
63
79
|
strength?: number;
|
|
80
|
+
shape?: PrismShape;
|
|
81
|
+
depth?: number;
|
|
82
|
+
gloss?: number;
|
|
83
|
+
distortion?: number;
|
|
84
|
+
baseImage?: string;
|
|
85
|
+
revealImage?: string;
|
|
86
|
+
image?: string;
|
|
87
|
+
fit?: ImageFitMode;
|
|
88
|
+
position?: ImagePosition;
|
|
89
|
+
softness?: number;
|
|
90
|
+
edgeNoise?: number;
|
|
91
|
+
edgeGlow?: number;
|
|
92
|
+
ambient?: boolean;
|
|
93
|
+
clickReveal?: boolean;
|
|
94
|
+
activeIndex?: number;
|
|
95
|
+
focused?: boolean;
|
|
96
|
+
wrap?: boolean;
|
|
97
|
+
spread?: number;
|
|
98
|
+
depthScale?: number;
|
|
99
|
+
curve?: number;
|
|
100
|
+
parallax?: boolean | number;
|
|
101
|
+
focusOffsetX?: number;
|
|
102
|
+
focusScale?: number;
|
|
103
|
+
spotRadius?: number;
|
|
104
|
+
spotIntensity?: number;
|
|
105
|
+
spotPosition?: [number, number] | 'center' | 'left' | 'right';
|
|
106
|
+
onChange?: (detail: {
|
|
107
|
+
index: number;
|
|
108
|
+
focused: boolean;
|
|
109
|
+
element: HTMLElement | null;
|
|
110
|
+
}) => void;
|
|
64
111
|
[key: string]: unknown;
|
|
65
112
|
}
|
|
66
113
|
|
|
@@ -88,6 +135,15 @@ declare class FluxEngine {
|
|
|
88
135
|
private visibilityCallbacks;
|
|
89
136
|
private removeTicker;
|
|
90
137
|
private removeVisibilitySub;
|
|
138
|
+
private hasResizeListener;
|
|
139
|
+
private resizeRaf;
|
|
140
|
+
private isDeviceAllowed;
|
|
141
|
+
private hasDeviceConstraints;
|
|
142
|
+
private mountEntryInstance;
|
|
143
|
+
private unmountEntryInstance;
|
|
144
|
+
private attachEntryObserver;
|
|
145
|
+
private handleViewportResize;
|
|
146
|
+
private syncResizeWatcher;
|
|
91
147
|
private ensureObserver;
|
|
92
148
|
private ensureVisibilitySub;
|
|
93
149
|
private hasActiveTickWork;
|
|
@@ -138,6 +194,7 @@ interface WebGLQuadOptions extends PerformanceOptions {
|
|
|
138
194
|
adaptToSurface?: boolean;
|
|
139
195
|
overlayOpacity?: number;
|
|
140
196
|
uniforms?: Record<string, UniformValue>;
|
|
197
|
+
textures?: Record<string, string>;
|
|
141
198
|
interactive?: boolean;
|
|
142
199
|
}
|
|
143
200
|
declare class WebGLQuad {
|
|
@@ -200,6 +257,12 @@ declare class WebGLQuad {
|
|
|
200
257
|
private feedbackMaxDim;
|
|
201
258
|
private feedbackFloat;
|
|
202
259
|
private customUniforms;
|
|
260
|
+
private textureUrls;
|
|
261
|
+
private textureUnits;
|
|
262
|
+
private loadedImages;
|
|
263
|
+
private mainTextures;
|
|
264
|
+
private textureLoadTokens;
|
|
265
|
+
private nextTextureUnit;
|
|
203
266
|
private mouse;
|
|
204
267
|
private targetMouse;
|
|
205
268
|
private mouseVel;
|
|
@@ -336,6 +399,13 @@ declare class WebGLQuad {
|
|
|
336
399
|
pause(): void;
|
|
337
400
|
resume(): void;
|
|
338
401
|
destroy(): void;
|
|
402
|
+
private resolveTextureUrl;
|
|
403
|
+
private destroyMainTextures;
|
|
404
|
+
private bindMainTextures;
|
|
405
|
+
private uploadImageTexture;
|
|
406
|
+
private reuploadLoadedTextures;
|
|
407
|
+
private clearTextureSlot;
|
|
408
|
+
private syncTexturesFromOptions;
|
|
339
409
|
}
|
|
340
410
|
|
|
341
411
|
interface WebGLEffectConfig {
|
|
@@ -346,9 +416,10 @@ interface WebGLEffectConfig {
|
|
|
346
416
|
feedbackFloat?: boolean;
|
|
347
417
|
defaultColors: [string, string, string];
|
|
348
418
|
resolveUniforms?: (options: FXOptions) => Record<string, UniformValue>;
|
|
419
|
+
resolveTextures?: (options: FXOptions) => Record<string, string>;
|
|
349
420
|
}
|
|
350
421
|
declare function createWebGLEffect(config: WebGLEffectConfig): FXPlugin;
|
|
351
422
|
|
|
352
423
|
declare const FluxFX: FluxEngine;
|
|
353
424
|
|
|
354
|
-
export { type FXInstance, type FXOptions, type FXPlugin, FluxEngine, FluxFX, type FluxStats, type LayerMode, type QualityLevel, type ThemeMode, type WebGLEffectConfig, WebGLQuad, createWebGLEffect };
|
|
425
|
+
export { type DeviceTarget, type FXInstance, type FXOptions, type FXPlugin, FluxEngine, FluxFX, type FluxStats, type ImageFitMode, type ImagePosition, type LayerMode, type PrismShape, type QualityLevel, type ThemeMode, type WebGLEffectConfig, WebGLQuad, createWebGLEffect };
|