@mathonsunday/ascii-art-toolkit 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/README.md +281 -0
- package/dist/core/library.d.ts +77 -0
- package/dist/core/library.d.ts.map +1 -0
- package/dist/core/library.js +247 -0
- package/dist/core/library.js.map +1 -0
- package/dist/core/types.d.ts +74 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +9 -0
- package/dist/core/types.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/themes/deep-sea/creatures.d.ts +9 -0
- package/dist/themes/deep-sea/creatures.d.ts.map +1 -0
- package/dist/themes/deep-sea/creatures.js +378 -0
- package/dist/themes/deep-sea/creatures.js.map +1 -0
- package/dist/themes/deep-sea/environment.d.ts +8 -0
- package/dist/themes/deep-sea/environment.d.ts.map +1 -0
- package/dist/themes/deep-sea/environment.js +74 -0
- package/dist/themes/deep-sea/environment.js.map +1 -0
- package/dist/themes/deep-sea/index.d.ts +13 -0
- package/dist/themes/deep-sea/index.d.ts.map +1 -0
- package/dist/themes/deep-sea/index.js +16 -0
- package/dist/themes/deep-sea/index.js.map +1 -0
- package/dist/themes/deep-sea/structures.d.ts +8 -0
- package/dist/themes/deep-sea/structures.d.ts.map +1 -0
- package/dist/themes/deep-sea/structures.js +75 -0
- package/dist/themes/deep-sea/structures.js.map +1 -0
- package/dist/utils/validate.d.ts +40 -0
- package/dist/utils/validate.d.ts.map +1 -0
- package/dist/utils/validate.js +149 -0
- package/dist/utils/validate.js.map +1 -0
- package/package.json +32 -0
package/README.md
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
# ASCII Art Toolkit
|
|
2
|
+
|
|
3
|
+
A curated library for organizing and accessing high-quality ASCII art across projects.
|
|
4
|
+
|
|
5
|
+
## Philosophy
|
|
6
|
+
|
|
7
|
+
ASCII art is fundamentally **copy-pastable content**. This library's job is organization, not generation.
|
|
8
|
+
|
|
9
|
+
- Commission art from v0 or other design tools
|
|
10
|
+
- Add it to the library with clean TypeScript exports
|
|
11
|
+
- Apps query the library by theme, category, or random selection
|
|
12
|
+
- Over time, the library grows organically as you work on projects
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @veronica/ascii-art-toolkit
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { library } from '@veronica/ascii-art-toolkit';
|
|
24
|
+
|
|
25
|
+
// Get a random creature from deep-sea theme
|
|
26
|
+
const creature = library.random('deep-sea');
|
|
27
|
+
console.log(creature.art);
|
|
28
|
+
|
|
29
|
+
// Get all creatures in a category
|
|
30
|
+
const allFish = library.getByCategory('deep-sea', 'creature');
|
|
31
|
+
|
|
32
|
+
// Query with filters
|
|
33
|
+
const glowing = library.query({
|
|
34
|
+
theme: 'deep-sea',
|
|
35
|
+
category: 'creature',
|
|
36
|
+
tags: { bioluminescence: true },
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Get a specific piece by ID
|
|
40
|
+
const anglerfish = library.getById('deep-sea:anglerfish');
|
|
41
|
+
console.log(anglerfish?.zoom?.close); // Get the close-up version
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## API
|
|
45
|
+
|
|
46
|
+
### Library Methods
|
|
47
|
+
|
|
48
|
+
#### `random(theme: string): AsciiArt | undefined`
|
|
49
|
+
|
|
50
|
+
Get a random piece from a theme.
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
const creature = library.random('deep-sea');
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
#### `randomFromQuery(options: QueryOptions): AsciiArt | undefined`
|
|
57
|
+
|
|
58
|
+
Get a random piece that matches query options.
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
const menacing = library.randomFromQuery({
|
|
62
|
+
theme: 'deep-sea',
|
|
63
|
+
tags: { mood: ['menacing'] },
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
#### `getById(id: string): AsciiArt | undefined`
|
|
68
|
+
|
|
69
|
+
Get a piece by its ID.
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
const piece = library.getById('deep-sea:anglerfish');
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
#### `getByTheme(theme: string): AsciiArt[]`
|
|
76
|
+
|
|
77
|
+
Get all pieces from a theme.
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
const allDeepSea = library.getByTheme('deep-sea');
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
#### `getByCategory(theme: string, category: string): AsciiArt[]`
|
|
84
|
+
|
|
85
|
+
Get all pieces in a specific category.
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
const creatures = library.getByCategory('deep-sea', 'creature');
|
|
89
|
+
const environments = library.getByCategory('deep-sea', 'environment');
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
#### `query(options: QueryOptions): AsciiArt[]`
|
|
93
|
+
|
|
94
|
+
Advanced query with multiple filters.
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
const results = library.query({
|
|
98
|
+
theme: 'deep-sea',
|
|
99
|
+
category: 'creature',
|
|
100
|
+
tags: {
|
|
101
|
+
bioluminescence: true,
|
|
102
|
+
mood: ['ethereal'],
|
|
103
|
+
},
|
|
104
|
+
limit: 5,
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
#### `getThemes(): string[]`
|
|
109
|
+
|
|
110
|
+
List all registered themes.
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
const themes = library.getThemes(); // ['deep-sea']
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
#### `getCategories(theme: string): string[]`
|
|
117
|
+
|
|
118
|
+
List all categories in a theme.
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
const cats = library.getCategories('deep-sea');
|
|
122
|
+
// ['creature', 'environment', 'structure']
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
#### `getTagMetadata(theme: string): TagMetadata`
|
|
126
|
+
|
|
127
|
+
Get information about available tags in a theme.
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
const tags = library.getTagMetadata('deep-sea');
|
|
131
|
+
// {
|
|
132
|
+
// mood: { type: 'string[]', values: ['predatory', 'ethereal', ...] },
|
|
133
|
+
// bioluminescence: { type: 'boolean', values: [true, false] },
|
|
134
|
+
// ...
|
|
135
|
+
// }
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
#### `getStats(): { totalPieces: number; themes: ... }`
|
|
139
|
+
|
|
140
|
+
Get summary statistics about the library.
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
const stats = library.getStats();
|
|
144
|
+
console.log(stats.totalPieces); // 15 (for deep-sea theme)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Data Types
|
|
148
|
+
|
|
149
|
+
#### `AsciiArt`
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
interface AsciiArt {
|
|
153
|
+
id: string; // e.g., "deep-sea:anglerfish"
|
|
154
|
+
name: string; // Human-readable name
|
|
155
|
+
category: string; // 'creature' | 'structure' | 'environment' | 'scene'
|
|
156
|
+
theme: string; // Theme identifier
|
|
157
|
+
art: string; // The ASCII art string
|
|
158
|
+
|
|
159
|
+
description: string; // What it depicts
|
|
160
|
+
whyEffective: string; // Why this art works aesthetically
|
|
161
|
+
keyCharacters: string[]; // Important characters used
|
|
162
|
+
buildingBlocks: string[]; // Reusable patterns
|
|
163
|
+
techniques: string[]; // Techniques used
|
|
164
|
+
|
|
165
|
+
tags: {
|
|
166
|
+
mood?: string[]; // e.g., ['predatory', 'ethereal']
|
|
167
|
+
movement?: 'static' | 'dynamic';
|
|
168
|
+
density?: 'sparse' | 'medium' | 'dense';
|
|
169
|
+
size?: 'small' | 'medium' | 'large';
|
|
170
|
+
bioluminescence?: boolean;
|
|
171
|
+
[key: string]: any;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
zoom?: {
|
|
175
|
+
far?: string; // Simplified version
|
|
176
|
+
medium?: string; // Standard detail level
|
|
177
|
+
close?: string; // Detailed version
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Adding New Themes
|
|
183
|
+
|
|
184
|
+
1. Create a new folder in `themes/` with your theme name
|
|
185
|
+
2. Structure it like the `deep-sea/` theme:
|
|
186
|
+
```
|
|
187
|
+
themes/my-theme/
|
|
188
|
+
├── creatures.ts
|
|
189
|
+
├── structures.ts
|
|
190
|
+
├── environment.ts
|
|
191
|
+
├── index.ts
|
|
192
|
+
└── README.md
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
3. Define your pieces with the `AsciiArt` interface
|
|
196
|
+
|
|
197
|
+
4. Register in `index.ts`:
|
|
198
|
+
```typescript
|
|
199
|
+
import { myTheme } from './themes/my-theme/index';
|
|
200
|
+
library.registerTheme(myTheme);
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Workflow for Adding Pieces
|
|
204
|
+
|
|
205
|
+
1. Commission ASCII art from v0
|
|
206
|
+
2. Export as clean TypeScript (like `deep-sea-ascii-library.ts`)
|
|
207
|
+
3. Copy into appropriate theme file (creatures/structures/environment)
|
|
208
|
+
4. Add additional tags based on aesthetic judgment
|
|
209
|
+
5. Validate with `validateLibrary()`
|
|
210
|
+
|
|
211
|
+
## Validation
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
import { validateLibrary, validateThemePieces } from '@veronica/ascii-art-toolkit';
|
|
215
|
+
|
|
216
|
+
// Validate entire library
|
|
217
|
+
const result = validateLibrary();
|
|
218
|
+
if (!result.valid) {
|
|
219
|
+
console.error('Library errors:', result.errors);
|
|
220
|
+
console.warn('Warnings:', result.warnings);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Validate specific theme
|
|
224
|
+
const themeResult = validateThemePieces('deep-sea');
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Integration with Projects
|
|
228
|
+
|
|
229
|
+
### agentic-ui-lab
|
|
230
|
+
|
|
231
|
+
Replace static ASCII imports with library queries:
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
import { library } from '@veronica/ascii-art-toolkit';
|
|
235
|
+
|
|
236
|
+
// Instead of: import { anglerfish } from './rovAsciiVariants'
|
|
237
|
+
const creature = library.random('deep-sea');
|
|
238
|
+
|
|
239
|
+
// Display with zoom support
|
|
240
|
+
const displayArt = creature.zoom?.medium || creature.art;
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## Themes
|
|
244
|
+
|
|
245
|
+
### deep-sea
|
|
246
|
+
|
|
247
|
+
Bioluminescent creatures and structures of the deep ocean.
|
|
248
|
+
|
|
249
|
+
15 pieces across 3 categories:
|
|
250
|
+
- **Creatures** (8): Anglerfish, Giant Squid, Jellyfish, Octopus, Sea Turtle, Shark, Hermit Crab, Viperfish
|
|
251
|
+
- **Structures** (3): Treasure Chest, Deep Sea Diver, Submarine
|
|
252
|
+
- **Environment** (3): Coral Reef, School of Fish, Deep Sea Scene
|
|
253
|
+
|
|
254
|
+
See [Deep Sea Theme Guide](./themes/deep-sea/README.md) for details.
|
|
255
|
+
|
|
256
|
+
## Design Philosophy
|
|
257
|
+
|
|
258
|
+
### Why Copy-Paste Over Generation?
|
|
259
|
+
|
|
260
|
+
ASCII art requires aesthetic taste at every level. Unlike code generation, which can be algorithmically sound but visually boring, ASCII art succeeds entirely on visual appeal.
|
|
261
|
+
|
|
262
|
+
Trying to algorithmically generate good ASCII art fails because:
|
|
263
|
+
1. **Aesthetic judgment is hard** - What makes something look good involves style, proportion, character choice
|
|
264
|
+
2. **Context matters** - The same creature looks different in different themes
|
|
265
|
+
3. **Composition is crucial** - How elements are arranged and spaced determines impact
|
|
266
|
+
|
|
267
|
+
Instead, we:
|
|
268
|
+
1. Commission beautiful art from skilled designers (v0, Vizio, etc.)
|
|
269
|
+
2. Curate and organize pieces in themes
|
|
270
|
+
3. Let code handle organization, querying, and composition
|
|
271
|
+
4. Let humans handle aesthetic judgment
|
|
272
|
+
|
|
273
|
+
### Building Blocks
|
|
274
|
+
|
|
275
|
+
"Building blocks" in this library are **complete, proven pieces** - not fragments.
|
|
276
|
+
|
|
277
|
+
A building block is a full creature like the Anglerfish, not "head" or "tentacle". You can safely compose scenes using complete pieces, but composing from sub-pieces risks breaking the aesthetic quality.
|
|
278
|
+
|
|
279
|
+
## License
|
|
280
|
+
|
|
281
|
+
Personal use library - use as you see fit in your projects.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ASCII Art Toolkit - Library
|
|
3
|
+
*
|
|
4
|
+
* Main library class for organizing, querying, and accessing ASCII art.
|
|
5
|
+
* The library maintains a collection of themes, each containing curated pieces.
|
|
6
|
+
*/
|
|
7
|
+
import { AsciiArt, Theme, QueryOptions, ValidationResult, TagMetadata } from './types';
|
|
8
|
+
export declare class AsciiLibrary {
|
|
9
|
+
private themes;
|
|
10
|
+
private allPiecesById;
|
|
11
|
+
/**
|
|
12
|
+
* Register a theme in the library.
|
|
13
|
+
*/
|
|
14
|
+
registerTheme(theme: Theme): void;
|
|
15
|
+
/**
|
|
16
|
+
* Add a single piece to an existing theme.
|
|
17
|
+
*/
|
|
18
|
+
addPiece(theme: string, piece: AsciiArt): void;
|
|
19
|
+
/**
|
|
20
|
+
* Get a piece by its ID.
|
|
21
|
+
*/
|
|
22
|
+
getById(id: string): AsciiArt | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Get all pieces from a theme.
|
|
25
|
+
*/
|
|
26
|
+
getByTheme(theme: string): AsciiArt[];
|
|
27
|
+
/**
|
|
28
|
+
* Get pieces from a theme by category.
|
|
29
|
+
*/
|
|
30
|
+
getByCategory(theme: string, category: string): AsciiArt[];
|
|
31
|
+
/**
|
|
32
|
+
* Query the library with flexible options.
|
|
33
|
+
* Can filter by theme, category, and tags.
|
|
34
|
+
*/
|
|
35
|
+
query(options: QueryOptions): AsciiArt[];
|
|
36
|
+
/**
|
|
37
|
+
* Get a random piece from a theme.
|
|
38
|
+
*/
|
|
39
|
+
random(theme: string): AsciiArt | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Get a random piece matching query options.
|
|
42
|
+
*/
|
|
43
|
+
randomFromQuery(options: QueryOptions): AsciiArt | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Get all available theme names.
|
|
46
|
+
*/
|
|
47
|
+
getThemes(): string[];
|
|
48
|
+
/**
|
|
49
|
+
* Get all categories in a theme.
|
|
50
|
+
*/
|
|
51
|
+
getCategories(theme: string): string[];
|
|
52
|
+
/**
|
|
53
|
+
* Get metadata about all tags in a theme.
|
|
54
|
+
* Useful for understanding what query options are available.
|
|
55
|
+
*/
|
|
56
|
+
getTagMetadata(theme: string): TagMetadata;
|
|
57
|
+
/**
|
|
58
|
+
* Validate the library for data integrity issues.
|
|
59
|
+
*/
|
|
60
|
+
validate(): ValidationResult;
|
|
61
|
+
/**
|
|
62
|
+
* Get summary statistics about the library.
|
|
63
|
+
*/
|
|
64
|
+
getStats(): {
|
|
65
|
+
totalPieces: number;
|
|
66
|
+
themes: Record<string, {
|
|
67
|
+
pieces: number;
|
|
68
|
+
categories: string[];
|
|
69
|
+
}>;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Singleton instance of the library.
|
|
74
|
+
* All themes should be registered on this instance.
|
|
75
|
+
*/
|
|
76
|
+
export declare const library: AsciiLibrary;
|
|
77
|
+
//# sourceMappingURL=library.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../core/library.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,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
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ASCII Art Toolkit - Library
|
|
3
|
+
*
|
|
4
|
+
* Main library class for organizing, querying, and accessing ASCII art.
|
|
5
|
+
* The library maintains a collection of themes, each containing curated pieces.
|
|
6
|
+
*/
|
|
7
|
+
export class AsciiLibrary {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.themes = new Map();
|
|
10
|
+
this.allPiecesById = new Map();
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Register a theme in the library.
|
|
14
|
+
*/
|
|
15
|
+
registerTheme(theme) {
|
|
16
|
+
this.themes.set(theme.name, theme);
|
|
17
|
+
// Index all pieces by ID for quick lookup
|
|
18
|
+
theme.pieces.forEach((piece) => {
|
|
19
|
+
this.allPiecesById.set(piece.id, piece);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Add a single piece to an existing theme.
|
|
24
|
+
*/
|
|
25
|
+
addPiece(theme, piece) {
|
|
26
|
+
const t = this.themes.get(theme);
|
|
27
|
+
if (!t) {
|
|
28
|
+
throw new Error(`Theme "${theme}" not registered`);
|
|
29
|
+
}
|
|
30
|
+
// Verify ID matches theme
|
|
31
|
+
if (!piece.id.startsWith(`${theme}:`)) {
|
|
32
|
+
throw new Error(`Piece ID "${piece.id}" should start with "${theme}:" for theme "${theme}"`);
|
|
33
|
+
}
|
|
34
|
+
if (this.allPiecesById.has(piece.id)) {
|
|
35
|
+
throw new Error(`Piece with ID "${piece.id}" already exists`);
|
|
36
|
+
}
|
|
37
|
+
t.pieces.push(piece);
|
|
38
|
+
this.allPiecesById.set(piece.id, piece);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get a piece by its ID.
|
|
42
|
+
*/
|
|
43
|
+
getById(id) {
|
|
44
|
+
return this.allPiecesById.get(id);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get all pieces from a theme.
|
|
48
|
+
*/
|
|
49
|
+
getByTheme(theme) {
|
|
50
|
+
const t = this.themes.get(theme);
|
|
51
|
+
return t ? [...t.pieces] : [];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Get pieces from a theme by category.
|
|
55
|
+
*/
|
|
56
|
+
getByCategory(theme, category) {
|
|
57
|
+
const pieces = this.getByTheme(theme);
|
|
58
|
+
return pieces.filter((p) => p.category === category);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Query the library with flexible options.
|
|
62
|
+
* Can filter by theme, category, and tags.
|
|
63
|
+
*/
|
|
64
|
+
query(options) {
|
|
65
|
+
let results = [];
|
|
66
|
+
// Filter by theme
|
|
67
|
+
if (options.theme) {
|
|
68
|
+
results = this.getByTheme(options.theme);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
// If no theme specified, search across all themes
|
|
72
|
+
results = Array.from(this.allPiecesById.values());
|
|
73
|
+
}
|
|
74
|
+
// Filter by category
|
|
75
|
+
if (options.category) {
|
|
76
|
+
results = results.filter((p) => p.category === options.category);
|
|
77
|
+
}
|
|
78
|
+
// Filter by tags
|
|
79
|
+
if (options.tags) {
|
|
80
|
+
results = results.filter((piece) => {
|
|
81
|
+
return Object.entries(options.tags).every(([key, value]) => {
|
|
82
|
+
const pieceTag = piece.tags[key];
|
|
83
|
+
if (Array.isArray(value)) {
|
|
84
|
+
// If query value is array, check if piece tag includes any of those values
|
|
85
|
+
if (Array.isArray(pieceTag)) {
|
|
86
|
+
return value.some((v) => pieceTag.includes(v));
|
|
87
|
+
}
|
|
88
|
+
return value.includes(pieceTag);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
// Direct comparison
|
|
92
|
+
if (Array.isArray(pieceTag)) {
|
|
93
|
+
return pieceTag.includes(value);
|
|
94
|
+
}
|
|
95
|
+
return pieceTag === value;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
// Apply limit if specified
|
|
101
|
+
if (options.limit && options.limit > 0) {
|
|
102
|
+
results = results.slice(0, options.limit);
|
|
103
|
+
}
|
|
104
|
+
return results;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Get a random piece from a theme.
|
|
108
|
+
*/
|
|
109
|
+
random(theme) {
|
|
110
|
+
const pieces = this.getByTheme(theme);
|
|
111
|
+
if (pieces.length === 0)
|
|
112
|
+
return undefined;
|
|
113
|
+
return pieces[Math.floor(Math.random() * pieces.length)];
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Get a random piece matching query options.
|
|
117
|
+
*/
|
|
118
|
+
randomFromQuery(options) {
|
|
119
|
+
const results = this.query(options);
|
|
120
|
+
if (results.length === 0)
|
|
121
|
+
return undefined;
|
|
122
|
+
return results[Math.floor(Math.random() * results.length)];
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Get all available theme names.
|
|
126
|
+
*/
|
|
127
|
+
getThemes() {
|
|
128
|
+
return Array.from(this.themes.keys());
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Get all categories in a theme.
|
|
132
|
+
*/
|
|
133
|
+
getCategories(theme) {
|
|
134
|
+
const pieces = this.getByTheme(theme);
|
|
135
|
+
const categories = new Set(pieces.map((p) => p.category));
|
|
136
|
+
return Array.from(categories).sort();
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Get metadata about all tags in a theme.
|
|
140
|
+
* Useful for understanding what query options are available.
|
|
141
|
+
*/
|
|
142
|
+
getTagMetadata(theme) {
|
|
143
|
+
const pieces = this.getByTheme(theme);
|
|
144
|
+
const metadata = {};
|
|
145
|
+
pieces.forEach((piece) => {
|
|
146
|
+
Object.entries(piece.tags).forEach(([key, value]) => {
|
|
147
|
+
if (!metadata[key]) {
|
|
148
|
+
let type = 'string';
|
|
149
|
+
if (Array.isArray(value)) {
|
|
150
|
+
type = 'string[]';
|
|
151
|
+
}
|
|
152
|
+
else if (typeof value === 'boolean') {
|
|
153
|
+
type = 'boolean';
|
|
154
|
+
}
|
|
155
|
+
metadata[key] = {
|
|
156
|
+
type,
|
|
157
|
+
values: [],
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
// Collect unique values
|
|
161
|
+
if (Array.isArray(value)) {
|
|
162
|
+
value.forEach((v) => {
|
|
163
|
+
if (!metadata[key].values.includes(v) &&
|
|
164
|
+
!metadata[key].values.some((existing) => existing === v)) {
|
|
165
|
+
metadata[key].values.push(v);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
else if (value !== undefined && value !== null) {
|
|
170
|
+
if (!metadata[key].values.includes(value) &&
|
|
171
|
+
!metadata[key].values.some((existing) => existing === value)) {
|
|
172
|
+
metadata[key].values.push(value);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
return metadata;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Validate the library for data integrity issues.
|
|
181
|
+
*/
|
|
182
|
+
validate() {
|
|
183
|
+
const errors = [];
|
|
184
|
+
const warnings = [];
|
|
185
|
+
// Check for duplicate IDs
|
|
186
|
+
const seenIds = new Set();
|
|
187
|
+
Array.from(this.allPiecesById.keys()).forEach((id) => {
|
|
188
|
+
if (seenIds.has(id)) {
|
|
189
|
+
errors.push(`Duplicate piece ID: "${id}"`);
|
|
190
|
+
}
|
|
191
|
+
seenIds.add(id);
|
|
192
|
+
});
|
|
193
|
+
// Check each piece for required fields
|
|
194
|
+
this.allPiecesById.forEach((piece) => {
|
|
195
|
+
if (!piece.id)
|
|
196
|
+
errors.push(`Piece missing id`);
|
|
197
|
+
if (!piece.name)
|
|
198
|
+
errors.push(`Piece ${piece.id} missing name`);
|
|
199
|
+
if (!piece.category)
|
|
200
|
+
errors.push(`Piece ${piece.id} missing category`);
|
|
201
|
+
if (!piece.theme)
|
|
202
|
+
errors.push(`Piece ${piece.id} missing theme`);
|
|
203
|
+
if (!piece.art)
|
|
204
|
+
errors.push(`Piece ${piece.id} missing art`);
|
|
205
|
+
if (!piece.description)
|
|
206
|
+
warnings.push(`Piece ${piece.id} missing description`);
|
|
207
|
+
if (!piece.whyEffective)
|
|
208
|
+
warnings.push(`Piece ${piece.id} missing whyEffective`);
|
|
209
|
+
// Verify ID matches theme
|
|
210
|
+
if (!piece.id.startsWith(`${piece.theme}:`)) {
|
|
211
|
+
errors.push(`Piece ${piece.id} ID doesn't match theme "${piece.theme}"`);
|
|
212
|
+
}
|
|
213
|
+
// Check if theme exists
|
|
214
|
+
if (!this.themes.has(piece.theme)) {
|
|
215
|
+
errors.push(`Piece ${piece.id} references unregistered theme "${piece.theme}"`);
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
return {
|
|
219
|
+
valid: errors.length === 0,
|
|
220
|
+
errors,
|
|
221
|
+
warnings,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Get summary statistics about the library.
|
|
226
|
+
*/
|
|
227
|
+
getStats() {
|
|
228
|
+
const stats = {};
|
|
229
|
+
this.themes.forEach((theme) => {
|
|
230
|
+
const categories = new Set(theme.pieces.map((p) => p.category));
|
|
231
|
+
stats[theme.name] = {
|
|
232
|
+
pieces: theme.pieces.length,
|
|
233
|
+
categories: Array.from(categories).sort(),
|
|
234
|
+
};
|
|
235
|
+
});
|
|
236
|
+
return {
|
|
237
|
+
totalPieces: this.allPiecesById.size,
|
|
238
|
+
themes: stats,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Singleton instance of the library.
|
|
244
|
+
* All themes should be registered on this instance.
|
|
245
|
+
*/
|
|
246
|
+
export const library = new AsciiLibrary();
|
|
247
|
+
//# sourceMappingURL=library.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library.js","sourceRoot":"","sources":["../../core/library.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,OAAO,YAAY;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E,IAAI,CAAC,aAAa,CAAC,IAAI;YACpC,MAAM,EAAE,KAAK;SACd,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ASCII Art Toolkit - Core Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for the ASCII art library system.
|
|
5
|
+
* Designed around curated, high-quality ASCII art pieces that are
|
|
6
|
+
* organized by theme and queryable by flexible tags.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* A single piece of ASCII art with metadata.
|
|
10
|
+
*
|
|
11
|
+
* The id should follow the pattern: "theme:name" (e.g., "deep-sea:anglerfish")
|
|
12
|
+
* to ensure global uniqueness across all themes.
|
|
13
|
+
*/
|
|
14
|
+
export interface AsciiArt {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
category: 'creature' | 'structure' | 'environment' | 'scene';
|
|
18
|
+
theme: string;
|
|
19
|
+
art: string;
|
|
20
|
+
description: string;
|
|
21
|
+
whyEffective: string;
|
|
22
|
+
keyCharacters: string[];
|
|
23
|
+
buildingBlocks: string[];
|
|
24
|
+
techniques: string[];
|
|
25
|
+
tags: {
|
|
26
|
+
mood?: string[];
|
|
27
|
+
movement?: 'static' | 'dynamic';
|
|
28
|
+
density?: 'sparse' | 'medium' | 'dense';
|
|
29
|
+
size?: 'small' | 'medium' | 'large';
|
|
30
|
+
bioluminescence?: boolean;
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
};
|
|
33
|
+
zoom?: {
|
|
34
|
+
far?: string;
|
|
35
|
+
medium?: string;
|
|
36
|
+
close?: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A collection of ASCII art pieces organized by theme.
|
|
41
|
+
*/
|
|
42
|
+
export interface Theme {
|
|
43
|
+
name: string;
|
|
44
|
+
description: string;
|
|
45
|
+
pieces: AsciiArt[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Options for querying the library.
|
|
49
|
+
*/
|
|
50
|
+
export interface QueryOptions {
|
|
51
|
+
theme?: string;
|
|
52
|
+
category?: 'creature' | 'structure' | 'environment' | 'scene';
|
|
53
|
+
tags?: Record<string, any>;
|
|
54
|
+
limit?: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Result of library validation.
|
|
58
|
+
*/
|
|
59
|
+
export interface ValidationResult {
|
|
60
|
+
valid: boolean;
|
|
61
|
+
errors: string[];
|
|
62
|
+
warnings?: string[];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Metadata about available tags in a theme.
|
|
66
|
+
*/
|
|
67
|
+
export interface TagMetadata {
|
|
68
|
+
[key: string]: {
|
|
69
|
+
type: 'string' | 'boolean' | 'string[]' | 'enum';
|
|
70
|
+
values?: any[];
|
|
71
|
+
description?: string;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=types.d.ts.map
|