shardlight 0.1.0
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 +21 -0
- package/README.md +328 -0
- package/dist/baker-BmlWqsXG.d.ts +290 -0
- package/dist/chunk-MARSXMGB.js +263 -0
- package/dist/chunk-MARSXMGB.js.map +1 -0
- package/dist/chunk-W7WG7K5R.js +67 -0
- package/dist/chunk-W7WG7K5R.js.map +1 -0
- package/dist/chunk-ZWPHIC3K.js +1786 -0
- package/dist/chunk-ZWPHIC3K.js.map +1 -0
- package/dist/core/index.d.ts +901 -0
- package/dist/core/index.js +3 -0
- package/dist/core/index.js.map +1 -0
- package/dist/createShardLight-DTUyJQML.d.ts +56 -0
- package/dist/effects-bjjSnDyP.d.ts +287 -0
- package/dist/r3f/index.d.ts +59 -0
- package/dist/r3f/index.js +164 -0
- package/dist/r3f/index.js.map +1 -0
- package/dist/react/index.d.ts +62 -0
- package/dist/react/index.js +204 -0
- package/dist/react/index.js.map +1 -0
- package/dist/testing/index.d.ts +44 -0
- package/dist/testing/index.js +81 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/three/index.d.ts +13 -0
- package/dist/three/index.js +4 -0
- package/dist/three/index.js.map +1 -0
- package/package.json +121 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { CURRENT_VERSION, NullContextError, abortError, acquireSource, blob, buildLayers, cacheSize, canvas2dBaker, canvasToBlob, clearCache, clusters, collapse, collapseTrigger, computeFrame, createCanvas, createLightModel, createScheduler, defineEffect, definePreset, defineShardKind, definedOnly, disposeSource, ember, fan, flicker, freeCanvas, get2dContext, getEffect, getPreset, getShardKind, halo, hashString, hover, isAbortError, isBrowser, isCssIdentifier, isLowMemoryDevice, layerId, listEffects, listPresets, listShardKinds, makeRgba, migrateConfig, mulberry32, parseColor, prewarm, pulse, registerBuiltInEffects, registerBuiltInKinds, registerBuiltInPresets, registerEffect, registerPreset, registerShardKind, releasePrewarm, releaseSource, resolveConfig, shardSeed, sparkle, spin, stableStringify, star, starburst, sun, unregisterEffect, unregisterPreset, unregisterShardKind } from '../chunk-ZWPHIC3K.js';
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { P as Preset, a as ShardLightConfig, S as ShardInput, E as EffectConfig, B as Baker } from './baker-BmlWqsXG.js';
|
|
3
|
+
import { Layer, LightModel, SetValues } from './core/index.js';
|
|
4
|
+
|
|
5
|
+
interface CreateShardLightOptions {
|
|
6
|
+
preset?: Preset | null;
|
|
7
|
+
config?: Partial<ShardLightConfig>;
|
|
8
|
+
shards?: ShardInput[];
|
|
9
|
+
effects?: EffectConfig[];
|
|
10
|
+
color?: string;
|
|
11
|
+
/** World units (plane edge). */
|
|
12
|
+
size?: number;
|
|
13
|
+
/** Texture edge. Default 1024. */
|
|
14
|
+
resolution?: number;
|
|
15
|
+
rayScale?: number;
|
|
16
|
+
baker?: Baker;
|
|
17
|
+
/** Default true: effects run from `onBeforeRender`. */
|
|
18
|
+
autoUpdate?: boolean;
|
|
19
|
+
/** Faces the camera. Default false. */
|
|
20
|
+
billboard?: boolean;
|
|
21
|
+
/** Circular hit radius at the centre, as a fraction of the half-edge. */
|
|
22
|
+
hitRadius?: number;
|
|
23
|
+
/** Seconds for hover to ease in/out. Default 0.25; 0 snaps. */
|
|
24
|
+
hoverEase?: number;
|
|
25
|
+
/** Seconds for the click collapse to ease in/out. Default 0.3; 0 snaps. */
|
|
26
|
+
collapseEase?: number;
|
|
27
|
+
/** Custom material factory, for custom shading. */
|
|
28
|
+
material?: (layer: Layer) => THREE.Material;
|
|
29
|
+
renderOrder?: number;
|
|
30
|
+
depthTest?: boolean;
|
|
31
|
+
toneMapped?: boolean;
|
|
32
|
+
onReady?: () => void;
|
|
33
|
+
}
|
|
34
|
+
interface ShardLightController {
|
|
35
|
+
object: THREE.Group;
|
|
36
|
+
model: LightModel;
|
|
37
|
+
set(values: SetValues): void;
|
|
38
|
+
/** Ease the whole-light hover amount toward 0 or 1. */
|
|
39
|
+
setHover(hovered: boolean): void;
|
|
40
|
+
/** Ease the collapse toward expanded / collapsed. */
|
|
41
|
+
setCollapsed(collapsed: boolean): void;
|
|
42
|
+
/** Flip between expanded and collapsed. */
|
|
43
|
+
toggleCollapsed(): void;
|
|
44
|
+
update(patch: Partial<CreateShardLightOptions>): void;
|
|
45
|
+
tick(dt: number): void;
|
|
46
|
+
ready: Promise<void>;
|
|
47
|
+
dispose(): void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The three.js adapter: one additive plane per layer. It wraps a
|
|
51
|
+
* `createLightModel()` and turns the model's layers and frame values into
|
|
52
|
+
* meshes, scales and opacities.
|
|
53
|
+
*/
|
|
54
|
+
declare function createShardLight(options?: CreateShardLightOptions): ShardLightController;
|
|
55
|
+
|
|
56
|
+
export { type CreateShardLightOptions as C, type ShardLightController as S, createShardLight as c };
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ComponentType } from 'react';
|
|
3
|
+
import { ParamsOf, ShardKindDefinition } from './core/index.js';
|
|
4
|
+
import { c as ShardBase, E as EffectConfig } from './baker-BmlWqsXG.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* `<Shard>` props: a stable `id`, an optional `kind`, and any of that kind's
|
|
8
|
+
* flat parameters. Returns `null` and registers itself with the nearest
|
|
9
|
+
* `<ShardLight>` / `<ShardLightMesh>`.
|
|
10
|
+
*/
|
|
11
|
+
interface ShardProps {
|
|
12
|
+
id: string;
|
|
13
|
+
kind?: string;
|
|
14
|
+
[param: string]: unknown;
|
|
15
|
+
}
|
|
16
|
+
declare function Shard(props: ShardProps): null;
|
|
17
|
+
|
|
18
|
+
/** Props for a component made by `createShardComponent`. */
|
|
19
|
+
type ShardComponentProps<D> = Omit<ShardBase, 'kind'> & {
|
|
20
|
+
id: string;
|
|
21
|
+
} & Partial<ParamsOf<D>>;
|
|
22
|
+
/**
|
|
23
|
+
* Make a typed component for a shard kind: `const Dots = createShardComponent(dots)`
|
|
24
|
+
*. Works in both React entries.
|
|
25
|
+
*/
|
|
26
|
+
declare function createShardComponent<D extends ShardKindDefinition<any, any>>(def: D): ComponentType<ShardComponentProps<D>>;
|
|
27
|
+
|
|
28
|
+
/** The built-in kinds as typed components. Shared by DOM and R3F. */
|
|
29
|
+
declare const Glow: react.ComponentType<ShardComponentProps<ShardKindDefinition<"blob", {
|
|
30
|
+
readonly strength: {
|
|
31
|
+
readonly type: "number";
|
|
32
|
+
readonly default: 1;
|
|
33
|
+
readonly min: 0;
|
|
34
|
+
readonly max: 2;
|
|
35
|
+
};
|
|
36
|
+
readonly size: {
|
|
37
|
+
readonly type: "number";
|
|
38
|
+
readonly default: 0.5;
|
|
39
|
+
readonly min: 0;
|
|
40
|
+
readonly max: 2;
|
|
41
|
+
};
|
|
42
|
+
readonly hardness: {
|
|
43
|
+
readonly type: "number";
|
|
44
|
+
readonly default: 0;
|
|
45
|
+
readonly min: 0;
|
|
46
|
+
readonly max: 0.999;
|
|
47
|
+
};
|
|
48
|
+
readonly falloff: {
|
|
49
|
+
readonly type: "number";
|
|
50
|
+
readonly default: 2;
|
|
51
|
+
readonly min: 0.1;
|
|
52
|
+
readonly max: 8;
|
|
53
|
+
};
|
|
54
|
+
readonly aspect: {
|
|
55
|
+
readonly type: "number";
|
|
56
|
+
readonly default: 1;
|
|
57
|
+
readonly min: 0.1;
|
|
58
|
+
readonly max: 10;
|
|
59
|
+
};
|
|
60
|
+
readonly angle: {
|
|
61
|
+
readonly type: "angle";
|
|
62
|
+
readonly default: 0;
|
|
63
|
+
};
|
|
64
|
+
readonly softness: {
|
|
65
|
+
readonly type: "number";
|
|
66
|
+
readonly default: 0;
|
|
67
|
+
readonly min: 0;
|
|
68
|
+
readonly max: 50;
|
|
69
|
+
readonly unit: "px";
|
|
70
|
+
};
|
|
71
|
+
readonly variance: {
|
|
72
|
+
readonly type: "number";
|
|
73
|
+
readonly default: 0;
|
|
74
|
+
readonly min: 0;
|
|
75
|
+
readonly max: 1;
|
|
76
|
+
};
|
|
77
|
+
}>>>;
|
|
78
|
+
declare const Rays: react.ComponentType<ShardComponentProps<ShardKindDefinition<"fan", {
|
|
79
|
+
readonly strength: {
|
|
80
|
+
readonly type: "number";
|
|
81
|
+
readonly default: 1;
|
|
82
|
+
readonly min: 0;
|
|
83
|
+
readonly max: 2;
|
|
84
|
+
};
|
|
85
|
+
readonly size: {
|
|
86
|
+
readonly type: "number";
|
|
87
|
+
readonly default: 1;
|
|
88
|
+
readonly min: 0;
|
|
89
|
+
readonly max: 2;
|
|
90
|
+
};
|
|
91
|
+
readonly count: {
|
|
92
|
+
readonly type: "number";
|
|
93
|
+
readonly default: 4;
|
|
94
|
+
readonly min: 1;
|
|
95
|
+
readonly max: 256;
|
|
96
|
+
readonly step: 1;
|
|
97
|
+
};
|
|
98
|
+
readonly angle: {
|
|
99
|
+
readonly type: "angle";
|
|
100
|
+
readonly default: 0;
|
|
101
|
+
};
|
|
102
|
+
readonly jitter: {
|
|
103
|
+
readonly type: "number";
|
|
104
|
+
readonly default: 0;
|
|
105
|
+
readonly min: 0;
|
|
106
|
+
readonly max: 1;
|
|
107
|
+
};
|
|
108
|
+
readonly inner: {
|
|
109
|
+
readonly type: "number";
|
|
110
|
+
readonly default: 0;
|
|
111
|
+
readonly min: 0;
|
|
112
|
+
readonly max: 1;
|
|
113
|
+
};
|
|
114
|
+
readonly variance: {
|
|
115
|
+
readonly type: "number";
|
|
116
|
+
readonly default: 0;
|
|
117
|
+
readonly min: 0;
|
|
118
|
+
readonly max: 1;
|
|
119
|
+
};
|
|
120
|
+
readonly width: {
|
|
121
|
+
readonly type: "number";
|
|
122
|
+
readonly default: 4;
|
|
123
|
+
readonly min: 0;
|
|
124
|
+
readonly max: 100;
|
|
125
|
+
readonly unit: "px";
|
|
126
|
+
readonly ray: true;
|
|
127
|
+
};
|
|
128
|
+
readonly taper: {
|
|
129
|
+
readonly type: "number";
|
|
130
|
+
readonly default: 1;
|
|
131
|
+
readonly min: 0;
|
|
132
|
+
readonly max: 1;
|
|
133
|
+
};
|
|
134
|
+
readonly falloff: {
|
|
135
|
+
readonly type: "number";
|
|
136
|
+
readonly default: 1;
|
|
137
|
+
readonly min: 0;
|
|
138
|
+
readonly max: 8;
|
|
139
|
+
};
|
|
140
|
+
readonly fadeIn: {
|
|
141
|
+
readonly type: "number";
|
|
142
|
+
readonly default: 0;
|
|
143
|
+
readonly min: 0;
|
|
144
|
+
readonly max: 1;
|
|
145
|
+
};
|
|
146
|
+
readonly softness: {
|
|
147
|
+
readonly type: "number";
|
|
148
|
+
readonly default: 1;
|
|
149
|
+
readonly min: 0;
|
|
150
|
+
readonly max: 50;
|
|
151
|
+
readonly unit: "px";
|
|
152
|
+
readonly ray: true;
|
|
153
|
+
};
|
|
154
|
+
}>>>;
|
|
155
|
+
declare const Streaks: react.ComponentType<ShardComponentProps<ShardKindDefinition<"clusters", {
|
|
156
|
+
readonly clusters: {
|
|
157
|
+
readonly type: "number";
|
|
158
|
+
readonly default: 4;
|
|
159
|
+
readonly min: 1;
|
|
160
|
+
readonly max: 64;
|
|
161
|
+
readonly step: 1;
|
|
162
|
+
};
|
|
163
|
+
readonly perCluster: {
|
|
164
|
+
readonly type: "number";
|
|
165
|
+
readonly default: 5;
|
|
166
|
+
readonly min: 1;
|
|
167
|
+
readonly max: 64;
|
|
168
|
+
readonly step: 1;
|
|
169
|
+
};
|
|
170
|
+
readonly spread: {
|
|
171
|
+
readonly type: "number";
|
|
172
|
+
readonly default: 20;
|
|
173
|
+
readonly min: 0;
|
|
174
|
+
readonly max: 360;
|
|
175
|
+
};
|
|
176
|
+
readonly inner: {
|
|
177
|
+
readonly type: "number";
|
|
178
|
+
readonly default: 0.1;
|
|
179
|
+
readonly min: 0;
|
|
180
|
+
readonly max: 1;
|
|
181
|
+
};
|
|
182
|
+
readonly strength: {
|
|
183
|
+
readonly type: "number";
|
|
184
|
+
readonly default: 0.5;
|
|
185
|
+
readonly min: 0;
|
|
186
|
+
readonly max: 2;
|
|
187
|
+
};
|
|
188
|
+
readonly size: {
|
|
189
|
+
readonly type: "number";
|
|
190
|
+
readonly default: 0.5;
|
|
191
|
+
readonly min: 0;
|
|
192
|
+
readonly max: 2;
|
|
193
|
+
};
|
|
194
|
+
readonly angle: {
|
|
195
|
+
readonly type: "angle";
|
|
196
|
+
readonly default: 0;
|
|
197
|
+
};
|
|
198
|
+
readonly variance: {
|
|
199
|
+
readonly type: "number";
|
|
200
|
+
readonly default: 0.5;
|
|
201
|
+
readonly min: 0;
|
|
202
|
+
readonly max: 1;
|
|
203
|
+
};
|
|
204
|
+
readonly width: {
|
|
205
|
+
readonly type: "number";
|
|
206
|
+
readonly default: 2;
|
|
207
|
+
readonly min: 0;
|
|
208
|
+
readonly max: 100;
|
|
209
|
+
readonly unit: "px";
|
|
210
|
+
readonly ray: true;
|
|
211
|
+
};
|
|
212
|
+
readonly taper: {
|
|
213
|
+
readonly type: "number";
|
|
214
|
+
readonly default: 0.5;
|
|
215
|
+
readonly min: 0;
|
|
216
|
+
readonly max: 1;
|
|
217
|
+
};
|
|
218
|
+
readonly falloff: {
|
|
219
|
+
readonly type: "number";
|
|
220
|
+
readonly default: 1;
|
|
221
|
+
readonly min: 0;
|
|
222
|
+
readonly max: 8;
|
|
223
|
+
};
|
|
224
|
+
readonly fadeIn: {
|
|
225
|
+
readonly type: "number";
|
|
226
|
+
readonly default: 0.1;
|
|
227
|
+
readonly min: 0;
|
|
228
|
+
readonly max: 1;
|
|
229
|
+
};
|
|
230
|
+
readonly softness: {
|
|
231
|
+
readonly type: "number";
|
|
232
|
+
readonly default: 1;
|
|
233
|
+
readonly min: 0;
|
|
234
|
+
readonly max: 50;
|
|
235
|
+
readonly unit: "px";
|
|
236
|
+
readonly ray: true;
|
|
237
|
+
};
|
|
238
|
+
}>>>;
|
|
239
|
+
declare const Halo: react.ComponentType<ShardComponentProps<ShardKindDefinition<"halo", {
|
|
240
|
+
readonly strength: {
|
|
241
|
+
readonly type: "number";
|
|
242
|
+
readonly default: 0.1;
|
|
243
|
+
readonly min: 0;
|
|
244
|
+
readonly max: 2;
|
|
245
|
+
};
|
|
246
|
+
readonly size: {
|
|
247
|
+
readonly type: "number";
|
|
248
|
+
readonly default: 0.5;
|
|
249
|
+
readonly min: 0;
|
|
250
|
+
readonly max: 2;
|
|
251
|
+
};
|
|
252
|
+
readonly width: {
|
|
253
|
+
readonly type: "number";
|
|
254
|
+
readonly default: 0.05;
|
|
255
|
+
readonly min: 0;
|
|
256
|
+
readonly max: 2;
|
|
257
|
+
};
|
|
258
|
+
readonly falloff: {
|
|
259
|
+
readonly type: "number";
|
|
260
|
+
readonly default: 1;
|
|
261
|
+
readonly min: 0;
|
|
262
|
+
readonly max: 8;
|
|
263
|
+
};
|
|
264
|
+
readonly softness: {
|
|
265
|
+
readonly type: "number";
|
|
266
|
+
readonly default: 0;
|
|
267
|
+
readonly min: 0;
|
|
268
|
+
readonly max: 50;
|
|
269
|
+
readonly unit: "px";
|
|
270
|
+
};
|
|
271
|
+
readonly variance: {
|
|
272
|
+
readonly type: "number";
|
|
273
|
+
readonly default: 0;
|
|
274
|
+
readonly min: 0;
|
|
275
|
+
readonly max: 1;
|
|
276
|
+
};
|
|
277
|
+
}>>>;
|
|
278
|
+
|
|
279
|
+
/** `true` adds the effect with its defaults; an object adds it with those params. */
|
|
280
|
+
type EffectShorthand = boolean | Record<string, unknown>;
|
|
281
|
+
/**
|
|
282
|
+
* Turn the `flicker` / `collapse` shorthands into effect configs and append them
|
|
283
|
+
* to any explicit `effects`.
|
|
284
|
+
*/
|
|
285
|
+
declare function normalizeEffects(effects?: readonly EffectConfig[] | null, flicker?: EffectShorthand, collapse?: EffectShorthand): EffectConfig[];
|
|
286
|
+
|
|
287
|
+
export { type EffectShorthand as E, Glow as G, Halo as H, Rays as R, Shard as S, type ShardComponentProps as a, type ShardProps as b, Streaks as c, createShardComponent as d, normalizeEffects as n };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { GroupProps } from '@react-three/fiber';
|
|
3
|
+
import * as THREE from 'three';
|
|
4
|
+
import { S as ShardInput, E as EffectConfig } from '../baker-BmlWqsXG.js';
|
|
5
|
+
export { B as Baker, P as Preset, a as ShardLightConfig } from '../baker-BmlWqsXG.js';
|
|
6
|
+
import { SetValues, LightModel } from '../core/index.js';
|
|
7
|
+
export { Layer } from '../core/index.js';
|
|
8
|
+
import { E as EffectShorthand } from '../effects-bjjSnDyP.js';
|
|
9
|
+
export { G as Glow, H as Halo, R as Rays, S as Shard, a as ShardComponentProps, b as ShardProps, c as Streaks, d as createShardComponent, n as normalizeEffects } from '../effects-bjjSnDyP.js';
|
|
10
|
+
import { C as CreateShardLightOptions } from '../createShardLight-DTUyJQML.js';
|
|
11
|
+
|
|
12
|
+
interface ShardLightMeshProps extends Omit<GroupProps, 'ref'> {
|
|
13
|
+
preset?: CreateShardLightOptions['preset'];
|
|
14
|
+
config?: CreateShardLightOptions['config'];
|
|
15
|
+
/** Overrides the preset's colour for the whole light. */
|
|
16
|
+
color?: string;
|
|
17
|
+
/** Plain shard objects; `<Shard>` children are also accepted. */
|
|
18
|
+
shards?: ShardInput[];
|
|
19
|
+
effects?: EffectConfig[];
|
|
20
|
+
flicker?: EffectShorthand;
|
|
21
|
+
/** Click the light to collapse it (click again to expand). */
|
|
22
|
+
collapse?: EffectShorthand;
|
|
23
|
+
size?: number;
|
|
24
|
+
resolution?: number;
|
|
25
|
+
rayScale?: number;
|
|
26
|
+
baker?: CreateShardLightOptions['baker'];
|
|
27
|
+
autoUpdate?: boolean;
|
|
28
|
+
billboard?: boolean;
|
|
29
|
+
hitRadius?: number;
|
|
30
|
+
/** Seconds for hover to ease in/out. Default 0.25; 0 snaps. */
|
|
31
|
+
hoverEase?: number;
|
|
32
|
+
/** Seconds for the click collapse to ease in/out. Default 0.3; 0 snaps. */
|
|
33
|
+
collapseEase?: number;
|
|
34
|
+
material?: CreateShardLightOptions['material'];
|
|
35
|
+
renderOrder?: number;
|
|
36
|
+
depthTest?: boolean;
|
|
37
|
+
toneMapped?: boolean;
|
|
38
|
+
onReady?: () => void;
|
|
39
|
+
}
|
|
40
|
+
interface ShardLightHandle {
|
|
41
|
+
set(values: SetValues): void;
|
|
42
|
+
/** Ease the whole-light hover amount toward 0 or 1. */
|
|
43
|
+
setHover(hovered: boolean): void;
|
|
44
|
+
/** Ease the collapse toward expanded / collapsed. */
|
|
45
|
+
setCollapsed(collapsed: boolean): void;
|
|
46
|
+
/** Flip between expanded and collapsed. */
|
|
47
|
+
toggleCollapsed(): void;
|
|
48
|
+
ready: Promise<void>;
|
|
49
|
+
object: THREE.Group | null;
|
|
50
|
+
model: LightModel | null;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* `<ShardLightMesh>`: a thin wrapper over `createShardLight`,
|
|
54
|
+
* mounting its `object` with `<primitive>` and pushing prop and `<Shard>`
|
|
55
|
+
* changes into `update()`.
|
|
56
|
+
*/
|
|
57
|
+
declare const ShardLightMesh: react.ForwardRefExoticComponent<ShardLightMeshProps & react.RefAttributes<ShardLightHandle>>;
|
|
58
|
+
|
|
59
|
+
export { EffectConfig, EffectShorthand, LightModel, SetValues, ShardInput, type ShardLightHandle, ShardLightMesh, type ShardLightMeshProps };
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { useShardRegistry, normalizeEffects, ShardLightContext } from '../chunk-W7WG7K5R.js';
|
|
2
|
+
export { Glow, Halo, Rays, Shard, Streaks, createShardComponent, normalizeEffects } from '../chunk-W7WG7K5R.js';
|
|
3
|
+
import { createShardLight } from '../chunk-MARSXMGB.js';
|
|
4
|
+
import { collapseTrigger } from '../chunk-ZWPHIC3K.js';
|
|
5
|
+
import { forwardRef, useMemo, useState, useEffect, useImperativeHandle } from 'react';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
var ShardLightMesh = forwardRef(
|
|
9
|
+
function ShardLightMesh2(props, ref) {
|
|
10
|
+
const {
|
|
11
|
+
preset,
|
|
12
|
+
config,
|
|
13
|
+
color,
|
|
14
|
+
shards: shardsProp,
|
|
15
|
+
effects,
|
|
16
|
+
flicker,
|
|
17
|
+
collapse,
|
|
18
|
+
size,
|
|
19
|
+
resolution,
|
|
20
|
+
rayScale,
|
|
21
|
+
baker,
|
|
22
|
+
autoUpdate,
|
|
23
|
+
billboard,
|
|
24
|
+
hitRadius,
|
|
25
|
+
hoverEase,
|
|
26
|
+
collapseEase,
|
|
27
|
+
material,
|
|
28
|
+
renderOrder,
|
|
29
|
+
depthTest,
|
|
30
|
+
toneMapped,
|
|
31
|
+
onReady,
|
|
32
|
+
children,
|
|
33
|
+
...groupProps
|
|
34
|
+
} = props;
|
|
35
|
+
const { registry, shards: childShards } = useShardRegistry();
|
|
36
|
+
const effectsList = useMemo(
|
|
37
|
+
() => normalizeEffects(effects, flicker, collapse),
|
|
38
|
+
[effects, flicker, collapse]
|
|
39
|
+
);
|
|
40
|
+
const shards = useMemo(
|
|
41
|
+
() => [...childShards, ...shardsProp ?? []],
|
|
42
|
+
[childShards, shardsProp]
|
|
43
|
+
);
|
|
44
|
+
const [controller, setController] = useState(null);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
const created = createShardLight({
|
|
47
|
+
preset,
|
|
48
|
+
config,
|
|
49
|
+
color,
|
|
50
|
+
shards,
|
|
51
|
+
effects: effectsList,
|
|
52
|
+
size,
|
|
53
|
+
resolution,
|
|
54
|
+
rayScale,
|
|
55
|
+
baker,
|
|
56
|
+
autoUpdate,
|
|
57
|
+
billboard,
|
|
58
|
+
hitRadius,
|
|
59
|
+
hoverEase,
|
|
60
|
+
collapseEase,
|
|
61
|
+
material,
|
|
62
|
+
renderOrder,
|
|
63
|
+
depthTest,
|
|
64
|
+
toneMapped
|
|
65
|
+
});
|
|
66
|
+
setController(created);
|
|
67
|
+
return () => {
|
|
68
|
+
created.dispose();
|
|
69
|
+
setController(null);
|
|
70
|
+
};
|
|
71
|
+
}, []);
|
|
72
|
+
const updateKey = JSON.stringify({
|
|
73
|
+
preset,
|
|
74
|
+
config,
|
|
75
|
+
color,
|
|
76
|
+
shards,
|
|
77
|
+
effects: effectsList,
|
|
78
|
+
size,
|
|
79
|
+
resolution,
|
|
80
|
+
rayScale,
|
|
81
|
+
renderOrder,
|
|
82
|
+
depthTest,
|
|
83
|
+
toneMapped,
|
|
84
|
+
autoUpdate,
|
|
85
|
+
billboard,
|
|
86
|
+
hitRadius,
|
|
87
|
+
hoverEase,
|
|
88
|
+
collapseEase
|
|
89
|
+
});
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
controller?.update({
|
|
92
|
+
preset,
|
|
93
|
+
config,
|
|
94
|
+
color,
|
|
95
|
+
shards,
|
|
96
|
+
effects: effectsList,
|
|
97
|
+
size,
|
|
98
|
+
resolution,
|
|
99
|
+
rayScale,
|
|
100
|
+
baker,
|
|
101
|
+
autoUpdate,
|
|
102
|
+
billboard,
|
|
103
|
+
hitRadius,
|
|
104
|
+
hoverEase,
|
|
105
|
+
collapseEase,
|
|
106
|
+
material,
|
|
107
|
+
renderOrder,
|
|
108
|
+
depthTest,
|
|
109
|
+
toneMapped
|
|
110
|
+
});
|
|
111
|
+
}, [controller, updateKey]);
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
if (!controller) return;
|
|
114
|
+
let alive = true;
|
|
115
|
+
controller.ready.then(() => {
|
|
116
|
+
if (alive) onReady?.();
|
|
117
|
+
});
|
|
118
|
+
return () => {
|
|
119
|
+
alive = false;
|
|
120
|
+
};
|
|
121
|
+
}, [controller]);
|
|
122
|
+
useImperativeHandle(
|
|
123
|
+
ref,
|
|
124
|
+
() => ({
|
|
125
|
+
set: (values) => controller?.set(values),
|
|
126
|
+
setHover: (hovered) => controller?.setHover(hovered),
|
|
127
|
+
setCollapsed: (collapsed) => controller?.setCollapsed(collapsed),
|
|
128
|
+
toggleCollapsed: () => controller?.toggleCollapsed(),
|
|
129
|
+
ready: controller?.ready ?? Promise.resolve(),
|
|
130
|
+
object: controller?.object ?? null,
|
|
131
|
+
model: controller?.model ?? null
|
|
132
|
+
}),
|
|
133
|
+
[controller]
|
|
134
|
+
);
|
|
135
|
+
if (!controller) return null;
|
|
136
|
+
const { onPointerOver, onPointerOut, onClick, ...restGroupProps } = groupProps;
|
|
137
|
+
return /* @__PURE__ */ jsx(ShardLightContext.Provider, { value: registry, children: /* @__PURE__ */ jsx(
|
|
138
|
+
"primitive",
|
|
139
|
+
{
|
|
140
|
+
object: controller.object,
|
|
141
|
+
...restGroupProps,
|
|
142
|
+
onPointerOver: (event) => {
|
|
143
|
+
controller.setHover(true);
|
|
144
|
+
onPointerOver?.(event);
|
|
145
|
+
},
|
|
146
|
+
onPointerOut: (event) => {
|
|
147
|
+
controller.setHover(false);
|
|
148
|
+
onPointerOut?.(event);
|
|
149
|
+
},
|
|
150
|
+
onClick: (event) => {
|
|
151
|
+
const trigger = collapseTrigger(controller.model.resolved.effects);
|
|
152
|
+
if (trigger === "click") controller.toggleCollapsed();
|
|
153
|
+
else if (trigger === "once") controller.setCollapsed(true);
|
|
154
|
+
onClick?.(event);
|
|
155
|
+
},
|
|
156
|
+
children
|
|
157
|
+
}
|
|
158
|
+
) });
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
export { ShardLightMesh };
|
|
163
|
+
//# sourceMappingURL=index.js.map
|
|
164
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/r3f/ShardLightMesh.tsx"],"names":["ShardLightMesh"],"mappings":";;;;;;;AAgEO,IAAM,cAAA,GAAiB,UAAA;AAAA,EAC5B,SAASA,eAAAA,CAAe,KAAA,EA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AA,UAAA,CAAW,SAAS,KAAK,CAAA;AACzB,UAAA,YAAA,GAAe,KAAK,CAAA;AAAA,QACtB,CAAA;AAAA,QACA,OAAA,EAAS,CAAC,KAAA,KAAkC;AAC1C,UAAA,MAAM,OAAA,GAAU,eAAA,CAAgB,UAAA,CAAW,KAAA,CAAM,SAAS,OAAO,CAAA;AACjE,UAAA,IAAI,OAAA,KAAY,OAAA,EAAS,UAAA,CAAW,eAAA,EAAgB;AAAA,eAAA,IAC3C,OAAA,KAAY,MAAA,EAAQ,UAAA,CAAW,YAAA,CAAa,IAAI,CAAA;AACzD,UAAA,OAAA,GAAU,KAAK,CAAA;AAAA,QACjB,CAAA;AAAA,QAEC;AAAA;AAAA,KACH,EACF,CAAA;AAAA,EAEJ;AACF","file":"index.js","sourcesContent":["import { forwardRef, useEffect, useImperativeHandle, useMemo, useState } from 'react';\nimport type { GroupProps, ThreeEvent } from '@react-three/fiber';\nimport type * as THREE from 'three';\nimport {\n normalizeEffects,\n ShardLightContext,\n useShardRegistry,\n type EffectShorthand,\n} from '../shared-react/index.js';\nimport {\n createShardLight,\n type CreateShardLightOptions,\n type ShardLightController,\n} from '../three/index.js';\nimport { collapseTrigger } from '../core/index.js';\nimport type { EffectConfig, LightModel, SetValues, ShardInput } from '../core/index.js';\n\nexport interface ShardLightMeshProps extends Omit<GroupProps, 'ref'> {\n preset?: CreateShardLightOptions['preset'];\n config?: CreateShardLightOptions['config'];\n /** Overrides the preset's colour for the whole light. */\n color?: string;\n /** Plain shard objects; `<Shard>` children are also accepted. */\n shards?: ShardInput[];\n effects?: EffectConfig[];\n flicker?: EffectShorthand;\n /** Click the light to collapse it (click again to expand). */\n collapse?: EffectShorthand;\n size?: number;\n resolution?: number;\n rayScale?: number;\n baker?: CreateShardLightOptions['baker'];\n autoUpdate?: boolean;\n billboard?: boolean;\n hitRadius?: number;\n /** Seconds for hover to ease in/out. Default 0.25; 0 snaps. */\n hoverEase?: number;\n /** Seconds for the click collapse to ease in/out. Default 0.3; 0 snaps. */\n collapseEase?: number;\n material?: CreateShardLightOptions['material'];\n renderOrder?: number;\n depthTest?: boolean;\n toneMapped?: boolean;\n onReady?: () => void;\n}\n\nexport interface ShardLightHandle {\n set(values: SetValues): void;\n /** Ease the whole-light hover amount toward 0 or 1. */\n setHover(hovered: boolean): void;\n /** Ease the collapse toward expanded / collapsed. */\n setCollapsed(collapsed: boolean): void;\n /** Flip between expanded and collapsed. */\n toggleCollapsed(): void;\n ready: Promise<void>;\n object: THREE.Group | null;\n model: LightModel | null;\n}\n\n/**\n * `<ShardLightMesh>`: a thin wrapper over `createShardLight`,\n * mounting its `object` with `<primitive>` and pushing prop and `<Shard>`\n * changes into `update()`.\n */\nexport const ShardLightMesh = forwardRef<ShardLightHandle, ShardLightMeshProps>(\n function ShardLightMesh(props, ref) {\n const {\n preset,\n config,\n color,\n shards: shardsProp,\n effects,\n flicker,\n collapse,\n size,\n resolution,\n rayScale,\n baker,\n autoUpdate,\n billboard,\n hitRadius,\n hoverEase,\n collapseEase,\n material,\n renderOrder,\n depthTest,\n toneMapped,\n onReady,\n children,\n ...groupProps\n } = props;\n\n const { registry, shards: childShards } = useShardRegistry();\n const effectsList = useMemo(\n () => normalizeEffects(effects, flicker, collapse),\n [effects, flicker, collapse],\n );\n const shards = useMemo(\n () => [...childShards, ...(shardsProp ?? [])],\n [childShards, shardsProp],\n );\n\n const [controller, setController] = useState<ShardLightController | null>(null);\n\n // Create the controller once, on mount.\n useEffect(() => {\n const created = createShardLight({\n preset,\n config,\n color,\n shards,\n effects: effectsList,\n size,\n resolution,\n rayScale,\n baker,\n autoUpdate,\n billboard,\n hitRadius,\n hoverEase,\n collapseEase,\n material,\n renderOrder,\n depthTest,\n toneMapped,\n });\n setController(created);\n return () => {\n created.dispose();\n setController(null);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const updateKey = JSON.stringify({\n preset,\n config,\n color,\n shards,\n effects: effectsList,\n size,\n resolution,\n rayScale,\n renderOrder,\n depthTest,\n toneMapped,\n autoUpdate,\n billboard,\n hitRadius,\n hoverEase,\n collapseEase,\n });\n\n useEffect(() => {\n controller?.update({\n preset,\n config,\n color,\n shards,\n effects: effectsList,\n size,\n resolution,\n rayScale,\n baker,\n autoUpdate,\n billboard,\n hitRadius,\n hoverEase,\n collapseEase,\n material,\n renderOrder,\n depthTest,\n toneMapped,\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [controller, updateKey]);\n\n useEffect(() => {\n if (!controller) return;\n let alive = true;\n controller.ready.then(() => {\n if (alive) onReady?.();\n });\n return () => {\n alive = false;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [controller]);\n\n useImperativeHandle(\n ref,\n () => ({\n set: (values: SetValues) => controller?.set(values),\n setHover: (hovered: boolean) => controller?.setHover(hovered),\n setCollapsed: (collapsed: boolean) => controller?.setCollapsed(collapsed),\n toggleCollapsed: () => controller?.toggleCollapsed(),\n ready: controller?.ready ?? Promise.resolve(),\n object: controller?.object ?? null,\n model: controller?.model ?? null,\n }),\n [controller],\n );\n\n if (!controller) return null;\n\n const { onPointerOver, onPointerOut, onClick, ...restGroupProps } = groupProps;\n\n return (\n <ShardLightContext.Provider value={registry}>\n <primitive\n object={controller.object}\n {...restGroupProps}\n onPointerOver={(event: ThreeEvent<PointerEvent>) => {\n controller.setHover(true);\n onPointerOver?.(event);\n }}\n onPointerOut={(event: ThreeEvent<PointerEvent>) => {\n controller.setHover(false);\n onPointerOut?.(event);\n }}\n onClick={(event: ThreeEvent<MouseEvent>) => {\n const trigger = collapseTrigger(controller.model.resolved.effects);\n if (trigger === 'click') controller.toggleCollapsed();\n else if (trigger === 'once') controller.setCollapsed(true);\n onClick?.(event);\n }}\n >\n {children}\n </primitive>\n </ShardLightContext.Provider>\n );\n },\n);\n"]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
3
|
+
import { P as Preset, a as ShardLightConfig, E as EffectConfig, B as Baker } from '../baker-BmlWqsXG.js';
|
|
4
|
+
export { b as ShardConfig, S as ShardInput } from '../baker-BmlWqsXG.js';
|
|
5
|
+
import { SetValues, LightModel } from '../core/index.js';
|
|
6
|
+
export { ChannelValues, Layer } from '../core/index.js';
|
|
7
|
+
import { E as EffectShorthand } from '../effects-bjjSnDyP.js';
|
|
8
|
+
export { G as Glow, H as Halo, R as Rays, S as Shard, a as ShardComponentProps, b as ShardProps, c as Streaks, d as createShardComponent, n as normalizeEffects } from '../effects-bjjSnDyP.js';
|
|
9
|
+
|
|
10
|
+
interface ShardLightProps {
|
|
11
|
+
/** Starting config. Omitted or `null` = start empty. */
|
|
12
|
+
preset?: Preset | null;
|
|
13
|
+
/** Data-driven alternative or addition to children. */
|
|
14
|
+
config?: Partial<ShardLightConfig>;
|
|
15
|
+
/** Shorthand for `config.color`. */
|
|
16
|
+
color?: string;
|
|
17
|
+
/** CSS edge length of the light box. */
|
|
18
|
+
size?: number | string;
|
|
19
|
+
/** Bake size. `'auto'` uses rendered size × DPR, capped. */
|
|
20
|
+
resolution?: number | 'auto';
|
|
21
|
+
/** Thins every ray. */
|
|
22
|
+
rayScale?: number;
|
|
23
|
+
effects?: EffectConfig[];
|
|
24
|
+
flicker?: EffectShorthand;
|
|
25
|
+
/** Click the light to collapse it (click again to expand). */
|
|
26
|
+
collapse?: EffectShorthand;
|
|
27
|
+
/** Static channel values. */
|
|
28
|
+
channels?: Record<string, {
|
|
29
|
+
scale?: number;
|
|
30
|
+
opacity?: number;
|
|
31
|
+
}>;
|
|
32
|
+
/** CSS `mix-blend-mode` of the whole light. Default `plus-lighter`. */
|
|
33
|
+
blend?: string;
|
|
34
|
+
baker?: Baker;
|
|
35
|
+
/** Fires once every layer is baked and decoded. */
|
|
36
|
+
onReady?: () => void;
|
|
37
|
+
/** Shown until it's ready (SSR, first paint). */
|
|
38
|
+
fallback?: ReactNode;
|
|
39
|
+
className?: string;
|
|
40
|
+
style?: CSSProperties;
|
|
41
|
+
children?: ReactNode;
|
|
42
|
+
}
|
|
43
|
+
/** The root `<div>` plus the imperative API. */
|
|
44
|
+
type ShardLightHandle = HTMLDivElement & {
|
|
45
|
+
set(values: SetValues): void;
|
|
46
|
+
setChannel(channel: string, values: {
|
|
47
|
+
scale?: number;
|
|
48
|
+
opacity?: number;
|
|
49
|
+
rotation?: number;
|
|
50
|
+
}): void;
|
|
51
|
+
/** Drives the whole-light hover amount (`spin`/`hover` shards use it). */
|
|
52
|
+
setHover(hovered: boolean): void;
|
|
53
|
+
/** Eases the light toward collapsed (click behavior). */
|
|
54
|
+
setCollapsed(collapsed: boolean): void;
|
|
55
|
+
/** Flips between expanded and collapsed. */
|
|
56
|
+
toggleCollapsed(): void;
|
|
57
|
+
readonly ready: Promise<void>;
|
|
58
|
+
readonly model: LightModel | null;
|
|
59
|
+
};
|
|
60
|
+
declare const ShardLight: react.ForwardRefExoticComponent<ShardLightProps & react.RefAttributes<ShardLightHandle>>;
|
|
61
|
+
|
|
62
|
+
export { Baker, EffectConfig, EffectShorthand, LightModel, Preset, SetValues, ShardLight, ShardLightConfig, type ShardLightHandle, type ShardLightProps };
|