@autumnsgrove/gossamer 0.1.0 → 0.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autumnsgrove/gossamer",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "ASCII visual effects library - Threads of light for your web applications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -16,7 +16,9 @@
16
16
  "types": "./dist/svelte/index.d.ts",
17
17
  "svelte": "./dist/svelte/index.js",
18
18
  "import": "./dist/svelte/index.js"
19
- }
19
+ },
20
+ "./svelte/style.css": "./dist/style.css",
21
+ "./style.css": "./dist/style.css"
20
22
  },
21
23
  "files": [
22
24
  "dist",
@@ -28,7 +30,11 @@
28
30
  "test": "vitest run",
29
31
  "test:watch": "vitest",
30
32
  "test:coverage": "vitest run --coverage",
31
- "clean": "rm -rf dist"
33
+ "clean": "rm -rf dist",
34
+ "prepublishOnly": "pnpm run clean && pnpm run build",
35
+ "export-gif": "tsx scripts/export-gif.ts",
36
+ "export-gif:all": "tsx scripts/export-gif.ts --all",
37
+ "export-gif:random": "tsx scripts/export-gif.ts --random"
32
38
  },
33
39
  "keywords": [
34
40
  "ascii",
@@ -65,8 +71,11 @@
65
71
  "devDependencies": {
66
72
  "@sveltejs/vite-plugin-svelte": "^4.0.0",
67
73
  "@types/node": "^20.10.0",
74
+ "canvas": "^3.2.1",
75
+ "gif-encoder-2": "^1.0.5",
68
76
  "jsdom": "^27.4.0",
69
77
  "svelte": "^5.0.0",
78
+ "tsx": "^4.21.0",
70
79
  "typescript": "^5.3.0",
71
80
  "vite": "^5.0.0",
72
81
  "vite-plugin-dts": "^3.7.0",
package/src/characters.ts CHANGED
@@ -106,6 +106,61 @@ export const CHARACTER_SETS: Record<string, CharacterSet> = {
106
106
  characters: ' +-×÷=≠≈∞',
107
107
  bestFor: ['abstract patterns', 'tech themes', 'decorative'],
108
108
  },
109
+
110
+ // ==========================================================================
111
+ // GLASS-OPTIMIZED CHARACTER SETS
112
+ // Designed for subtle overlays on Glass components
113
+ // More characters = more visible gradations
114
+ // ==========================================================================
115
+
116
+ 'glass-dots': {
117
+ name: 'Glass Dots',
118
+ description: 'Soft dot gradations for glass overlays',
119
+ characters: ' ·∘∙○•●',
120
+ bestFor: ['glass overlays', 'subtle backgrounds', 'mist effects'],
121
+ },
122
+
123
+ 'glass-mist': {
124
+ name: 'Glass Mist',
125
+ description: 'Ethereal mist effect for glass',
126
+ characters: ' .·∙•◦○◉●',
127
+ bestFor: ['glass overlays', 'fog effects', 'ambient backgrounds'],
128
+ },
129
+
130
+ 'glass-dust': {
131
+ name: 'Glass Dust',
132
+ description: 'Floating dust particles',
133
+ characters: ' ˙·∘°•◦○',
134
+ bestFor: ['glass overlays', 'particle effects', 'light scatter'],
135
+ },
136
+
137
+ 'glass-soft': {
138
+ name: 'Glass Soft',
139
+ description: 'Soft block gradations for glass',
140
+ characters: ' ·░▒▓',
141
+ bestFor: ['glass overlays', 'soft gradients', 'frosted effect'],
142
+ },
143
+
144
+ 'glass-sparkle': {
145
+ name: 'Glass Sparkle',
146
+ description: 'Subtle sparkles for glass',
147
+ characters: ' ·.✧✦✫★',
148
+ bestFor: ['glass overlays', 'highlight effects', 'magical themes'],
149
+ },
150
+
151
+ 'glass-wave': {
152
+ name: 'Glass Wave',
153
+ description: 'Flowing wave patterns for glass',
154
+ characters: ' .~∼≈≋',
155
+ bestFor: ['glass overlays', 'water effects', 'flowing motion'],
156
+ },
157
+
158
+ 'glass-organic': {
159
+ name: 'Glass Organic',
160
+ description: 'Natural, organic feel for glass',
161
+ characters: ' .·:;∘○◦•●',
162
+ bestFor: ['glass overlays', 'nature themes', 'grove aesthetic'],
163
+ },
109
164
  };
110
165
 
111
166
  /**
package/src/colors.ts ADDED
@@ -0,0 +1,234 @@
1
+ /**
2
+ * Gossamer Color Palettes
3
+ *
4
+ * Grove-themed color palettes for ASCII effects.
5
+ * Designed to complement Glass UI components.
6
+ */
7
+
8
+ /**
9
+ * Color definition with metadata
10
+ */
11
+ export interface ColorDef {
12
+ /** Hex color value */
13
+ hex: string;
14
+ /** Human-readable name */
15
+ name: string;
16
+ /** Recommended opacity for glass overlays (0-1) */
17
+ glassOpacity?: number;
18
+ }
19
+
20
+ /**
21
+ * Grove Green palette - Primary brand colors
22
+ */
23
+ export const GROVE_GREEN = {
24
+ 50: { hex: '#f0fdf4', name: 'Grove Green 50', glassOpacity: 0.3 },
25
+ 100: { hex: '#dcfce7', name: 'Grove Green 100', glassOpacity: 0.25 },
26
+ 200: { hex: '#bbf7d0', name: 'Grove Green 200', glassOpacity: 0.2 },
27
+ 300: { hex: '#86efac', name: 'Grove Green 300', glassOpacity: 0.18 },
28
+ 400: { hex: '#4ade80', name: 'Grove Green 400', glassOpacity: 0.15 },
29
+ 500: { hex: '#22c55e', name: 'Grove Green 500', glassOpacity: 0.12 },
30
+ 600: { hex: '#16a34a', name: 'Grove Green 600', glassOpacity: 0.1 },
31
+ 700: { hex: '#15803d', name: 'Grove Green 700', glassOpacity: 0.1 },
32
+ 800: { hex: '#166534', name: 'Grove Green 800', glassOpacity: 0.08 },
33
+ 900: { hex: '#14532d', name: 'Grove Green 900', glassOpacity: 0.08 },
34
+ } as const;
35
+
36
+ /**
37
+ * Cream palette - Light/warm backgrounds
38
+ */
39
+ export const CREAM = {
40
+ 50: { hex: '#fefdfb', name: 'Cream 50', glassOpacity: 0.4 },
41
+ 100: { hex: '#fdfcf8', name: 'Cream 100', glassOpacity: 0.35 },
42
+ 200: { hex: '#faf8f3', name: 'Cream 200', glassOpacity: 0.3 },
43
+ 300: { hex: '#f5f2ea', name: 'Cream 300', glassOpacity: 0.25 },
44
+ 400: { hex: '#ede9de', name: 'Cream 400', glassOpacity: 0.2 },
45
+ 500: { hex: '#e2ddd0', name: 'Cream 500', glassOpacity: 0.18 },
46
+ 600: { hex: '#d4cec0', name: 'Cream 600', glassOpacity: 0.15 },
47
+ 700: { hex: '#c4bdb0', name: 'Cream 700', glassOpacity: 0.12 },
48
+ 800: { hex: '#b0a99c', name: 'Cream 800', glassOpacity: 0.1 },
49
+ 900: { hex: '#9a9387', name: 'Cream 900', glassOpacity: 0.08 },
50
+ } as const;
51
+
52
+ /**
53
+ * Bark palette - Dark/earth tones
54
+ */
55
+ export const BARK = {
56
+ 50: { hex: '#faf7f5', name: 'Bark 50', glassOpacity: 0.3 },
57
+ 100: { hex: '#f0ebe6', name: 'Bark 100', glassOpacity: 0.25 },
58
+ 200: { hex: '#e0d5cc', name: 'Bark 200', glassOpacity: 0.2 },
59
+ 300: { hex: '#ccb59c', name: 'Bark 300', glassOpacity: 0.18 },
60
+ 400: { hex: '#b89a7a', name: 'Bark 400', glassOpacity: 0.15 },
61
+ 500: { hex: '#a57c5a', name: 'Bark 500', glassOpacity: 0.12 },
62
+ 600: { hex: '#8a6344', name: 'Bark 600', glassOpacity: 0.1 },
63
+ 700: { hex: '#6f4d39', name: 'Bark 700', glassOpacity: 0.1 },
64
+ 800: { hex: '#553a2a', name: 'Bark 800', glassOpacity: 0.08 },
65
+ 900: { hex: '#3d2914', name: 'Bark 900', glassOpacity: 0.06 },
66
+ } as const;
67
+
68
+ /**
69
+ * Status colors
70
+ */
71
+ export const STATUS = {
72
+ success: { hex: '#22c55e', name: 'Success', glassOpacity: 0.12 },
73
+ warning: { hex: '#f59e0b', name: 'Warning', glassOpacity: 0.12 },
74
+ error: { hex: '#dc2626', name: 'Error', glassOpacity: 0.1 },
75
+ info: { hex: '#0ea5e9', name: 'Info', glassOpacity: 0.12 },
76
+ } as const;
77
+
78
+ /**
79
+ * Combined Grove color schemes for easy access
80
+ */
81
+ export const GROVE_COLORS = {
82
+ // Greens
83
+ grove: GROVE_GREEN[500].hex,
84
+ 'grove-light': GROVE_GREEN[300].hex,
85
+ 'grove-dark': GROVE_GREEN[700].hex,
86
+ 'grove-muted': GROVE_GREEN[400].hex,
87
+
88
+ // Creams
89
+ cream: CREAM[50].hex,
90
+ 'cream-warm': CREAM[200].hex,
91
+ 'cream-deep': CREAM[500].hex,
92
+
93
+ // Barks
94
+ bark: BARK[900].hex,
95
+ 'bark-light': BARK[500].hex,
96
+ 'bark-medium': BARK[700].hex,
97
+
98
+ // Utility
99
+ white: '#ffffff',
100
+ black: '#000000',
101
+ transparent: 'transparent',
102
+ } as const;
103
+
104
+ /**
105
+ * Glass-optimized color schemes
106
+ * Pre-configured for use with Glass components
107
+ */
108
+ export const GLASS_SCHEMES = {
109
+ // Light mode schemes (on light backgrounds)
110
+ 'grove-mist': {
111
+ color: GROVE_GREEN[500].hex,
112
+ background: 'transparent',
113
+ opacity: 0.12,
114
+ description: 'Subtle green mist for light glass',
115
+ },
116
+ 'cream-haze': {
117
+ color: CREAM[600].hex,
118
+ background: 'transparent',
119
+ opacity: 0.15,
120
+ description: 'Warm cream haze for cozy glass',
121
+ },
122
+ 'bark-shadow': {
123
+ color: BARK[700].hex,
124
+ background: 'transparent',
125
+ opacity: 0.08,
126
+ description: 'Soft earth shadow for depth',
127
+ },
128
+
129
+ // Dark mode schemes (on dark backgrounds)
130
+ 'grove-glow': {
131
+ color: GROVE_GREEN[400].hex,
132
+ background: '#1a1915',
133
+ opacity: 0.15,
134
+ description: 'Glowing green for dark glass',
135
+ },
136
+ 'cream-dust': {
137
+ color: CREAM[300].hex,
138
+ background: '#1a1915',
139
+ opacity: 0.1,
140
+ description: 'Dusty cream particles in dark',
141
+ },
142
+ 'moonlight': {
143
+ color: '#e2e8f0',
144
+ background: '#1a1915',
145
+ opacity: 0.08,
146
+ description: 'Cool moonlight glow',
147
+ },
148
+
149
+ // Accent schemes
150
+ 'spring-fresh': {
151
+ color: GROVE_GREEN[300].hex,
152
+ background: 'transparent',
153
+ opacity: 0.18,
154
+ description: 'Fresh spring green overlay',
155
+ },
156
+ 'autumn-warm': {
157
+ color: '#d97706',
158
+ background: 'transparent',
159
+ opacity: 0.1,
160
+ description: 'Warm autumn amber tones',
161
+ },
162
+ 'winter-frost': {
163
+ color: '#93c5fd',
164
+ background: 'transparent',
165
+ opacity: 0.12,
166
+ description: 'Cool frost blue overlay',
167
+ },
168
+ } as const;
169
+
170
+ export type GroveColorName = keyof typeof GROVE_COLORS;
171
+ export type GlassSchemeName = keyof typeof GLASS_SCHEMES;
172
+
173
+ /**
174
+ * Get a Grove color by name
175
+ */
176
+ export function getGroveColor(name: GroveColorName | string): string {
177
+ if (name in GROVE_COLORS) {
178
+ return GROVE_COLORS[name as GroveColorName];
179
+ }
180
+ // If it's already a hex color, return it
181
+ if (name.startsWith('#')) {
182
+ return name;
183
+ }
184
+ // Default to grove green
185
+ return GROVE_COLORS.grove;
186
+ }
187
+
188
+ /**
189
+ * Get a glass scheme by name
190
+ */
191
+ export function getGlassScheme(name: GlassSchemeName | string): {
192
+ color: string;
193
+ background: string;
194
+ opacity: number;
195
+ } {
196
+ if (name in GLASS_SCHEMES) {
197
+ const scheme = GLASS_SCHEMES[name as GlassSchemeName];
198
+ return {
199
+ color: scheme.color,
200
+ background: scheme.background,
201
+ opacity: scheme.opacity,
202
+ };
203
+ }
204
+ // Default to grove-mist
205
+ return {
206
+ color: GLASS_SCHEMES['grove-mist'].color,
207
+ background: GLASS_SCHEMES['grove-mist'].background,
208
+ opacity: GLASS_SCHEMES['grove-mist'].opacity,
209
+ };
210
+ }
211
+
212
+ /**
213
+ * List all Grove color names
214
+ */
215
+ export function getGroveColorNames(): string[] {
216
+ return Object.keys(GROVE_COLORS);
217
+ }
218
+
219
+ /**
220
+ * List all glass scheme names
221
+ */
222
+ export function getGlassSchemeNames(): string[] {
223
+ return Object.keys(GLASS_SCHEMES);
224
+ }
225
+
226
+ /**
227
+ * Apply opacity to a hex color, returning rgba string
228
+ */
229
+ export function hexToRgba(hex: string, opacity: number): string {
230
+ const r = parseInt(hex.slice(1, 3), 16);
231
+ const g = parseInt(hex.slice(3, 5), 16);
232
+ const b = parseInt(hex.slice(5, 7), 16);
233
+ return `rgba(${r}, ${g}, ${b}, ${opacity})`;
234
+ }
package/src/index.ts CHANGED
@@ -43,7 +43,7 @@ export interface PresetConfig {
43
43
  /** Character set */
44
44
  characters: string;
45
45
  /** Pattern type */
46
- pattern: 'perlin' | 'waves' | 'static' | 'ripple' | 'fbm';
46
+ pattern: 'perlin' | 'waves' | 'static' | 'ripple' | 'fbm' | 'clouds' | 'plasma' | 'vortex' | 'matrix' | 'gradient' | 'diamond' | 'fractal';
47
47
  /** Pattern frequency */
48
48
  frequency: number;
49
49
  /** Pattern amplitude */
@@ -110,17 +110,32 @@ export type { RenderConfig } from './renderer';
110
110
 
111
111
  // Patterns
112
112
  export {
113
+ // Core noise functions
113
114
  perlinNoise2D,
114
115
  fbmNoise,
115
- wavePattern,
116
- ripplePattern,
117
116
  staticNoise,
118
117
  seededNoise2D,
118
+ // Pattern generators
119
+ wavePattern,
120
+ ripplePattern,
121
+ cloudsPattern,
122
+ plasmaPattern,
123
+ vortexPattern,
124
+ matrixPattern,
125
+ gradientPattern,
126
+ diamondPattern,
127
+ fractalPattern,
128
+ // Grid generation (legacy API)
119
129
  generateBrightnessGrid,
120
130
  gridToImageData,
131
+ // Performance-optimized API
132
+ createBrightnessBuffer,
133
+ fillBrightnessBuffer,
134
+ getBufferValue,
135
+ // Config
121
136
  DEFAULT_PATTERN_CONFIG,
122
137
  } from './patterns';
123
- export type { PatternConfig, PatternType } from './patterns';
138
+ export type { PatternConfig, PatternType, BrightnessBuffer } from './patterns';
124
139
 
125
140
  // Characters
126
141
  export {
@@ -134,6 +149,22 @@ export {
134
149
  } from './characters';
135
150
  export type { CharacterSet } from './characters';
136
151
 
152
+ // Colors (Grove palette)
153
+ export {
154
+ GROVE_GREEN,
155
+ CREAM,
156
+ BARK,
157
+ STATUS,
158
+ GROVE_COLORS,
159
+ GLASS_SCHEMES,
160
+ getGroveColor,
161
+ getGlassScheme,
162
+ getGroveColorNames,
163
+ getGlassSchemeNames,
164
+ hexToRgba,
165
+ } from './colors';
166
+ export type { ColorDef, GroveColorName, GlassSchemeName } from './colors';
167
+
137
168
  // Animation
138
169
  export {
139
170
  createAnimationLoop,