pollyroll 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.
@@ -0,0 +1,75 @@
1
+ import { a as RollEvent, b as RollSummary, i as SkinRef, e as MaterialPreset, M as MaterialParams, S as Skin } from './types-CnzvkHmJ.cjs';
2
+ export { L as LabelStyle, P as PatternName } from './types-CnzvkHmJ.cjs';
3
+
4
+ type LabelSet = 'd4' | 'd6' | 'd8' | 'd10' | 'd12' | 'd20' | 'd100tens' | 'd100ones' | 'dF';
5
+
6
+ interface TrayOptions {
7
+ skin?: SkinRef;
8
+ labelFont?: string;
9
+ dieScale?: number;
10
+ shadows?: boolean;
11
+ maxDpr?: number;
12
+ reducedMotion?: 'auto' | 'always' | 'never';
13
+ fadeAfterMs?: number | null;
14
+ /**
15
+ * Custom labels per label set; labels[set][i] replaces the i-th label of the set's natural
16
+ * sequence: d4 '1'..'4', d6 '1'..'6', d8 '1'..'8', d12 '1'..'12', d20 '1'..'20' (i = value − 1);
17
+ * d10 and d100ones '0'..'9' and d100tens '00'..'90' (i = digit); dF 0 = the −1 faces, 1 = the
18
+ * blank faces, 2 = the +1 faces. Missing entries use the default text.
19
+ */
20
+ labels?: Partial<Record<LabelSet, readonly string[]>>;
21
+ }
22
+ interface DiceTray {
23
+ /** Pre-simulates, remaps, animates, and resolves with the summary once every die has settled. */
24
+ playRoll(event: RollEvent): Promise<RollSummary>;
25
+ setSkin(skin: SkinRef): void;
26
+ /** Sets the die size for subsequent rolls; the dice already on screen keep their size. */
27
+ setDieScale(scale: number): void;
28
+ clear(): void;
29
+ resize(): void;
30
+ dispose(): void;
31
+ readonly supported: boolean;
32
+ }
33
+ type PresetParams = Readonly<Required<MaterialParams>>;
34
+ /** The full `MaterialParams` each named material renders with. */
35
+ declare const materialPresets: Readonly<Record<MaterialPreset, PresetParams>>;
36
+ /**
37
+ * Creates a WebGL2 dice tray on a canvas, or on an absolutely positioned overlay canvas appended to
38
+ * an element. Without WebGL2 `supported` is false and `playRoll` resolves immediately.
39
+ */
40
+ declare function createDiceTray(target: HTMLCanvasElement | HTMLElement, opts?: TrayOptions): DiceTray;
41
+
42
+ /** A shader failed to compile or a program failed to link; `log` holds the driver's info log. */
43
+ declare class PollyrollShaderError extends Error {
44
+ readonly log: string;
45
+ constructor(message: string, log: string);
46
+ }
47
+
48
+ /** White plastic with black printed labels; the default skin. */
49
+ declare const classic: Skin;
50
+ /** Black marbled stone with engraved gold labels. */
51
+ declare const obsidian: Skin;
52
+ /** Graded brass with engraved dark labels. */
53
+ declare const brass: Skin;
54
+ /** Ringed oak with engraved cream labels. */
55
+ declare const oak: Skin;
56
+ /** Blue glass with white printed labels. */
57
+ declare const sapphire: Skin;
58
+ /** Swirled red gem with printed pale-gold labels. */
59
+ declare const ruby: Skin;
60
+ /** Deep green glass with printed pale-gold labels. */
61
+ declare const emerald: Skin;
62
+ /** Swirled purple gem with printed pale labels. */
63
+ declare const amethyst: Skin;
64
+ /** Amber gem with printed dark-brown labels. */
65
+ declare const topaz: Skin;
66
+ /** Clear sea-blue glass with printed dark-blue labels. */
67
+ declare const aquamarine: Skin;
68
+ /** Lightly tinted smoky-quartz glass with printed white labels. */
69
+ declare const smoke: Skin;
70
+ /** A new skin: the resolved base with `overrides` applied on top. The base is not modified. */
71
+ declare function defineSkin(base: SkinRef, overrides: Partial<Skin>): Skin;
72
+ /** Adds or replaces the named preset `name`. Throws TypeError for an empty name. */
73
+ declare function registerSkin(name: string, skin: Skin): void;
74
+
75
+ export { type DiceTray, type LabelSet, MaterialParams, MaterialPreset, PollyrollShaderError, Skin, SkinRef, type TrayOptions, amethyst, aquamarine, brass, classic, createDiceTray, defineSkin, emerald, materialPresets, oak, obsidian, registerSkin, ruby, sapphire, smoke, topaz };
@@ -0,0 +1,75 @@
1
+ import { a as RollEvent, b as RollSummary, i as SkinRef, e as MaterialPreset, M as MaterialParams, S as Skin } from './types-CnzvkHmJ.js';
2
+ export { L as LabelStyle, P as PatternName } from './types-CnzvkHmJ.js';
3
+
4
+ type LabelSet = 'd4' | 'd6' | 'd8' | 'd10' | 'd12' | 'd20' | 'd100tens' | 'd100ones' | 'dF';
5
+
6
+ interface TrayOptions {
7
+ skin?: SkinRef;
8
+ labelFont?: string;
9
+ dieScale?: number;
10
+ shadows?: boolean;
11
+ maxDpr?: number;
12
+ reducedMotion?: 'auto' | 'always' | 'never';
13
+ fadeAfterMs?: number | null;
14
+ /**
15
+ * Custom labels per label set; labels[set][i] replaces the i-th label of the set's natural
16
+ * sequence: d4 '1'..'4', d6 '1'..'6', d8 '1'..'8', d12 '1'..'12', d20 '1'..'20' (i = value − 1);
17
+ * d10 and d100ones '0'..'9' and d100tens '00'..'90' (i = digit); dF 0 = the −1 faces, 1 = the
18
+ * blank faces, 2 = the +1 faces. Missing entries use the default text.
19
+ */
20
+ labels?: Partial<Record<LabelSet, readonly string[]>>;
21
+ }
22
+ interface DiceTray {
23
+ /** Pre-simulates, remaps, animates, and resolves with the summary once every die has settled. */
24
+ playRoll(event: RollEvent): Promise<RollSummary>;
25
+ setSkin(skin: SkinRef): void;
26
+ /** Sets the die size for subsequent rolls; the dice already on screen keep their size. */
27
+ setDieScale(scale: number): void;
28
+ clear(): void;
29
+ resize(): void;
30
+ dispose(): void;
31
+ readonly supported: boolean;
32
+ }
33
+ type PresetParams = Readonly<Required<MaterialParams>>;
34
+ /** The full `MaterialParams` each named material renders with. */
35
+ declare const materialPresets: Readonly<Record<MaterialPreset, PresetParams>>;
36
+ /**
37
+ * Creates a WebGL2 dice tray on a canvas, or on an absolutely positioned overlay canvas appended to
38
+ * an element. Without WebGL2 `supported` is false and `playRoll` resolves immediately.
39
+ */
40
+ declare function createDiceTray(target: HTMLCanvasElement | HTMLElement, opts?: TrayOptions): DiceTray;
41
+
42
+ /** A shader failed to compile or a program failed to link; `log` holds the driver's info log. */
43
+ declare class PollyrollShaderError extends Error {
44
+ readonly log: string;
45
+ constructor(message: string, log: string);
46
+ }
47
+
48
+ /** White plastic with black printed labels; the default skin. */
49
+ declare const classic: Skin;
50
+ /** Black marbled stone with engraved gold labels. */
51
+ declare const obsidian: Skin;
52
+ /** Graded brass with engraved dark labels. */
53
+ declare const brass: Skin;
54
+ /** Ringed oak with engraved cream labels. */
55
+ declare const oak: Skin;
56
+ /** Blue glass with white printed labels. */
57
+ declare const sapphire: Skin;
58
+ /** Swirled red gem with printed pale-gold labels. */
59
+ declare const ruby: Skin;
60
+ /** Deep green glass with printed pale-gold labels. */
61
+ declare const emerald: Skin;
62
+ /** Swirled purple gem with printed pale labels. */
63
+ declare const amethyst: Skin;
64
+ /** Amber gem with printed dark-brown labels. */
65
+ declare const topaz: Skin;
66
+ /** Clear sea-blue glass with printed dark-blue labels. */
67
+ declare const aquamarine: Skin;
68
+ /** Lightly tinted smoky-quartz glass with printed white labels. */
69
+ declare const smoke: Skin;
70
+ /** A new skin: the resolved base with `overrides` applied on top. The base is not modified. */
71
+ declare function defineSkin(base: SkinRef, overrides: Partial<Skin>): Skin;
72
+ /** Adds or replaces the named preset `name`. Throws TypeError for an empty name. */
73
+ declare function registerSkin(name: string, skin: Skin): void;
74
+
75
+ export { type DiceTray, type LabelSet, MaterialParams, MaterialPreset, PollyrollShaderError, Skin, SkinRef, type TrayOptions, amethyst, aquamarine, brass, classic, createDiceTray, defineSkin, emerald, materialPresets, oak, obsidian, registerSkin, ruby, sapphire, smoke, topaz };