@splendidlabz/svelte 4.11.0 → 4.12.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @splendidlabz/svelte
2
2
 
3
+ ## 4.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a7cafd9: Add Noise component (SVG feTurbulence-based texture overlay) to the SVG package.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [293c7a0]
12
+ - Updated dependencies [d6adbe4]
13
+ - @splendidlabz/styles@4.10.1
14
+
3
15
  ## 4.11.0
4
16
 
5
17
  ### Minor Changes
@@ -0,0 +1,57 @@
1
+ <script>
2
+ let {
3
+ class: klass = '',
4
+ frequency = 0.9,
5
+ octaves = 2,
6
+ alpha = 0.6,
7
+ opacity = 0.18,
8
+ blend = 'overlay',
9
+ seed,
10
+ } = $props()
11
+
12
+ // frequency — how zoomed in the noise is.
13
+ // low (0.01–0.1): large blobs, clouds, smoke
14
+ // high (0.5–1): fine grain, film noise, static
15
+ //
16
+ // octaves — layers of noise stacked on top of each other.
17
+ // Each octave adds finer detail at double the frequency (costs render perf).
18
+ // low (1): smooth, soft, single frequency
19
+ // high (4–8): complex, detailed texture
20
+ //
21
+ // Combinations:
22
+ // frequency: 0.05, octaves: 6 → realistic cloudy smoke
23
+ // frequency: 0.9, octaves: 2 → subtle film grain overlay (default)
24
+ // frequency: 0.3, octaves: 4 → mid-range crumpled paper texture
25
+
26
+ // seed — omit to let the browser pick. Pass a number to lock noise across
27
+ // renders or to get a different pattern per instance.
28
+ const seedAttr = $derived(seed != null ? ` seed='${seed}'` : '')
29
+
30
+ const svg = $derived(
31
+ "<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'>" +
32
+ "<filter id='n'>" +
33
+ `<feTurbulence type='fractalNoise' baseFrequency='${frequency}' numOctaves='${octaves}' stitchTiles='stitch'${seedAttr}/>` +
34
+ `<feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ${alpha} 0'/>` +
35
+ '</filter>' +
36
+ "<rect width='100%' height='100%' filter='url(%23n)'/>" +
37
+ '</svg>',
38
+ )
39
+
40
+ const bg = $derived(`url("data:image/svg+xml;utf8,${svg}")`)
41
+ </script>
42
+
43
+ <div
44
+ style:background-image={bg}
45
+ style:opacity
46
+ style:mix-blend-mode={blend}
47
+ class="Noise {klass}"
48
+ aria-hidden="true"
49
+ ></div>
50
+
51
+ <style>
52
+ .Noise {
53
+ position: absolute;
54
+ inset: 0;
55
+ pointer-events: none;
56
+ }
57
+ </style>
@@ -1,3 +1,4 @@
1
1
  import SVG from './SVG.svelte'
2
2
  import SVGGradient from './SVGGradient.svelte'
3
- export { SVG, SVGGradient }
3
+ import Noise from './Noise.svelte'
4
+ export { SVG, SVGGradient, Noise }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@splendidlabz/svelte",
3
3
  "type": "module",
4
- "version": "4.11.0",
4
+ "version": "4.12.0",
5
5
  "sideEffects": false,
6
6
  "homepage": "https://splendidlabz.com/docs/svelte",
7
7
  "scripts": {