@holtjs/craft 0.0.0-stage → 0.2.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 +24 -0
- package/LICENSE +201 -0
- package/NOTICE +10 -0
- package/README.md +91 -2
- package/dist/atlas-Pc12eQsg.js +112 -0
- package/dist/atlas.d.ts +75 -0
- package/dist/atlas.js +1 -0
- package/dist/hd3d-BozZnINB.js +1871 -0
- package/dist/hd3d.d.ts +112 -0
- package/dist/hd3d.js +1 -0
- package/dist/index.d.ts +187 -0
- package/dist/index.js +17 -0
- package/dist/inspect-NzY8Ac1j.js +466 -0
- package/dist/inspect.d.ts +36 -0
- package/dist/inspect.js +1 -0
- package/dist/pixel-D3jgByB5.js +728 -0
- package/dist/pixel.d.ts +79 -0
- package/dist/pixel.js +1 -0
- package/dist/rig-render-DZBV9u2H.js +6163 -0
- package/dist/rig-render-DoPVKQAF.d.ts +537 -0
- package/dist/rig3d-CPw8F6V2.js +1096 -0
- package/dist/rig3d-DeeG_PJj.d.ts +70 -0
- package/dist/rig3d.d.ts +3 -0
- package/dist/rig3d.js +3 -0
- package/dist/tilemap-BFH4_JLe.js +266 -0
- package/dist/tilemap.d.ts +61 -0
- package/dist/tilemap.js +1 -0
- package/llms.txt +18 -0
- package/package.json +77 -4
- package/skills/craft/SKILL.md +98 -0
- package/skills/craft/references/subpaths.md +39 -0
package/dist/pixel.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export type Rgb = readonly [number, number, number];
|
|
2
|
+
export type Rgba = readonly [number, number, number, number];
|
|
3
|
+
export type Ramp4 = readonly [Rgb, Rgb, Rgb, Rgb];
|
|
4
|
+
export interface PixelSpriteLike {
|
|
5
|
+
readonly width: number;
|
|
6
|
+
readonly height: number;
|
|
7
|
+
readonly rgba: Uint8ClampedArray;
|
|
8
|
+
}
|
|
9
|
+
export interface AsciiPixelGridSpec {
|
|
10
|
+
readonly width: number;
|
|
11
|
+
readonly height: number;
|
|
12
|
+
readonly palette: Readonly<Record<string, string>>;
|
|
13
|
+
readonly front: readonly string[];
|
|
14
|
+
readonly side?: readonly string[];
|
|
15
|
+
readonly back?: readonly string[];
|
|
16
|
+
readonly anchorX?: number;
|
|
17
|
+
readonly anchorY?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface CompilePixelGridOptions {
|
|
20
|
+
/** Facing direction index (`0 = front/S`, `1 = sideR/E`, `2 = back/N`, `3 = sideL/W`). Default `0`. */
|
|
21
|
+
readonly dir4?: 0 | 1 | 2 | 3;
|
|
22
|
+
/** Pad output canvas by `pad` pixels on all sides (useful before adding outline/shadow). Default `2`. */
|
|
23
|
+
readonly pad?: number;
|
|
24
|
+
/** Automatically apply 2D top-left crescent highlight & bottom-right shadow bevel to solid patches. Default `false`. */
|
|
25
|
+
readonly bevel?: boolean;
|
|
26
|
+
/** Add 4-connected 1px colored silhouette outline derived from adjacent pixel ramps. Default `false`. */
|
|
27
|
+
readonly outline?: boolean;
|
|
28
|
+
/** Add a grounded contact shadow ellipse beneath the sprite. Default `false`. */
|
|
29
|
+
readonly contactShadow?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare const mixRgb: (a: Rgb, b: Rgb, t: number) => Rgb;
|
|
32
|
+
export declare function parseHexRgb(hex: string): Rgb;
|
|
33
|
+
export declare function rgbToHex(rgb: Rgb): string;
|
|
34
|
+
/**
|
|
35
|
+
* Derive a 4-shade pixel-art color ramp `[light, base, shade, outline]` with warm sunlight shift
|
|
36
|
+
* in highlights and cool slate-plum shift in shadows & outlines (Graveyard Keeper / Eastward style).
|
|
37
|
+
*/
|
|
38
|
+
export declare function derivePixelRamp(hexOrRgb: string | Rgb): Ramp4;
|
|
39
|
+
/** Generate `count` (default 16) distinct hue/lightness palette variants from a base `#rrggbb` color. */
|
|
40
|
+
export declare function derivePaletteVariants(baseHex: string, count?: number): Ramp4[];
|
|
41
|
+
/** Integer-crisp zero-DOM RGBA pixel canvas for procedural sprites, tiles, and UI icons. */
|
|
42
|
+
export declare class PixelCanvas implements PixelSpriteLike {
|
|
43
|
+
readonly width: number;
|
|
44
|
+
readonly height: number;
|
|
45
|
+
readonly rgba: Uint8ClampedArray;
|
|
46
|
+
constructor(width: number, height: number, rgba?: Uint8ClampedArray);
|
|
47
|
+
clone(): PixelCanvas;
|
|
48
|
+
clear(rgb?: Rgb, alpha?: number): this;
|
|
49
|
+
setPixel(x: number, y: number, color: Rgb | string, alpha?: number): this;
|
|
50
|
+
getPixel(x: number, y: number): Rgba;
|
|
51
|
+
fillRect(x: number, y: number, w: number, h: number, color: Rgb | string, alpha?: number): this;
|
|
52
|
+
strokeRect(x: number, y: number, w: number, h: number, color: Rgb | string, alpha?: number): this;
|
|
53
|
+
fillEllipse(cx: number, cy: number, rx: number, ry: number, color: Rgb | string, alpha?: number): this;
|
|
54
|
+
drawLine(x0: number, y0: number, x1: number, y1: number, color: Rgb | string, alpha?: number): this;
|
|
55
|
+
blit(src: PixelSpriteLike, dstX: number, dstY: number, opts?: {
|
|
56
|
+
behind?: boolean;
|
|
57
|
+
flipX?: boolean;
|
|
58
|
+
}): this;
|
|
59
|
+
flipX(): PixelCanvas;
|
|
60
|
+
/** Apply 4x4 Bayer ordered dithering between `colorA` and `colorB` inside a rectangle (`ratio` in `[0, 1]`). */
|
|
61
|
+
applyOrderedDither(x: number, y: number, w: number, h: number, colorA: Rgb | string, colorB: Rgb | string, ratio?: number): this;
|
|
62
|
+
/** Add a 4-connected 1px selective dark-tinted outline around opaque silhouette edges. */
|
|
63
|
+
addSelectiveOutline(fixedColor?: Rgb | string): this;
|
|
64
|
+
/** Render a grounded translucent ellipse contact shadow beneath the lowest opaque pixel of the sprite. */
|
|
65
|
+
addContactShadow(opts?: {
|
|
66
|
+
alpha?: number;
|
|
67
|
+
rx?: number;
|
|
68
|
+
ry?: number;
|
|
69
|
+
offsetY?: number;
|
|
70
|
+
}): this;
|
|
71
|
+
toPng(): Uint8Array;
|
|
72
|
+
}
|
|
73
|
+
/** Compile a declarative ASCII/palette pixel grid (`front`/`side`/`back`) into a crisp `PixelCanvas`. */
|
|
74
|
+
export declare function compilePixelGrid(spec: AsciiPixelGridSpec, opts?: CompilePixelGridOptions): PixelCanvas;
|
|
75
|
+
/**
|
|
76
|
+
* Encode raw 8-bit `RGBA` pixels into a compressed standard PNG file (`Uint8Array`) in 100% pure TypeScript
|
|
77
|
+
* with zero runtime or Node built-in dependencies (works identically in Browser, Workers, Deno, Bun, Node).
|
|
78
|
+
*/
|
|
79
|
+
export declare function encodePngRgba(width: number, height: number, rgba: Uint8Array | Uint8ClampedArray): Uint8Array;
|
package/dist/pixel.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as PixelCanvas, n as compilePixelGrid, r as derivePaletteVariants, i as derivePixelRamp, a as encodePngRgba, o as mixRgb, s as parseHexRgb, l as rgbToHex } from "./pixel-D3jgByB5.js";
|