@dice-roller/vue 1.3.3 → 1.4.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,121 @@
1
+ import type { PropType } from 'vue';
2
+ import type { BootstrapVariant, BootstrapBackgroundVariant, BootstrapBorderVariant, BootstrapTextVariant, BootstrapButtonVariant } from '../types.js';
3
+ import type { DiceRollerLabels, DiceRollerInputAttrs, DiceRollerSlots } from '../types.js';
4
+ declare const _default: typeof __VLS_export;
5
+ export default _default;
6
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
7
+ bgVariant: {
8
+ type: PropType<BootstrapBackgroundVariant>;
9
+ validator(value: string): boolean;
10
+ };
11
+ borderVariant: {
12
+ type: PropType<BootstrapBorderVariant>;
13
+ validator(value: string): boolean;
14
+ };
15
+ btnLabel: {
16
+ type: StringConstructor;
17
+ default: string;
18
+ };
19
+ btnVariant: {
20
+ type: PropType<BootstrapButtonVariant>;
21
+ default: string;
22
+ validator(value: string): boolean;
23
+ };
24
+ id: StringConstructor;
25
+ notation: StringConstructor;
26
+ labels: PropType<Partial<DiceRollerLabels>>;
27
+ inputAttrs: {
28
+ type: PropType<DiceRollerInputAttrs>;
29
+ default: () => {};
30
+ };
31
+ outputBgVariant: {
32
+ type: PropType<BootstrapBackgroundVariant>;
33
+ validator(value: string): boolean;
34
+ };
35
+ outputBorderVariant: {
36
+ type: PropType<BootstrapBorderVariant>;
37
+ validator(value: string): boolean;
38
+ };
39
+ outputTextVariant: {
40
+ type: PropType<BootstrapTextVariant>;
41
+ validator(value: string): boolean;
42
+ };
43
+ outputVariant: {
44
+ type: PropType<BootstrapVariant>;
45
+ validator(value: string): boolean;
46
+ };
47
+ textVariant: {
48
+ type: PropType<BootstrapTextVariant>;
49
+ validator(value: string): boolean;
50
+ };
51
+ variant: {
52
+ type: PropType<BootstrapVariant>;
53
+ validator(value: string): boolean;
54
+ };
55
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
56
+ roll: (notation: string, result: import("@dice-roller/rpg-dice-roller").DiceRoll | null) => any;
57
+ "notation:change": (notation: string) => any;
58
+ "update:notation": (notation: string) => any;
59
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
60
+ bgVariant: {
61
+ type: PropType<BootstrapBackgroundVariant>;
62
+ validator(value: string): boolean;
63
+ };
64
+ borderVariant: {
65
+ type: PropType<BootstrapBorderVariant>;
66
+ validator(value: string): boolean;
67
+ };
68
+ btnLabel: {
69
+ type: StringConstructor;
70
+ default: string;
71
+ };
72
+ btnVariant: {
73
+ type: PropType<BootstrapButtonVariant>;
74
+ default: string;
75
+ validator(value: string): boolean;
76
+ };
77
+ id: StringConstructor;
78
+ notation: StringConstructor;
79
+ labels: PropType<Partial<DiceRollerLabels>>;
80
+ inputAttrs: {
81
+ type: PropType<DiceRollerInputAttrs>;
82
+ default: () => {};
83
+ };
84
+ outputBgVariant: {
85
+ type: PropType<BootstrapBackgroundVariant>;
86
+ validator(value: string): boolean;
87
+ };
88
+ outputBorderVariant: {
89
+ type: PropType<BootstrapBorderVariant>;
90
+ validator(value: string): boolean;
91
+ };
92
+ outputTextVariant: {
93
+ type: PropType<BootstrapTextVariant>;
94
+ validator(value: string): boolean;
95
+ };
96
+ outputVariant: {
97
+ type: PropType<BootstrapVariant>;
98
+ validator(value: string): boolean;
99
+ };
100
+ textVariant: {
101
+ type: PropType<BootstrapTextVariant>;
102
+ validator(value: string): boolean;
103
+ };
104
+ variant: {
105
+ type: PropType<BootstrapVariant>;
106
+ validator(value: string): boolean;
107
+ };
108
+ }>> & Readonly<{
109
+ onRoll?: ((notation: string, result: import("@dice-roller/rpg-dice-roller").DiceRoll | null) => any) | undefined;
110
+ "onNotation:change"?: ((notation: string) => any) | undefined;
111
+ "onUpdate:notation"?: ((notation: string) => any) | undefined;
112
+ }>, {
113
+ btnLabel: string;
114
+ inputAttrs: DiceRollerInputAttrs;
115
+ btnVariant: BootstrapButtonVariant;
116
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, DiceRollerSlots>;
117
+ type __VLS_WithSlots<T, S> = T & {
118
+ new (): {
119
+ $slots: S;
120
+ };
121
+ };
@@ -0,0 +1,36 @@
1
+ import type { PropType } from 'vue';
2
+ import type { DiceRollerLabels, DiceRollerSlotProps } from '../types.js';
3
+ type __VLS_Slots = {
4
+ default?: (props: DiceRollerSlotProps) => import('vue').VNodeChild;
5
+ };
6
+ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
7
+ notation: StringConstructor;
8
+ labels: {
9
+ type: PropType<Partial<DiceRollerLabels>>;
10
+ default: () => {};
11
+ };
12
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
+ roll: (notation: string, result: import("@dice-roller/rpg-dice-roller").DiceRoll | null) => any;
14
+ "notation:change": (notation: string) => any;
15
+ "update:notation": (notation: string) => any;
16
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
17
+ notation: StringConstructor;
18
+ labels: {
19
+ type: PropType<Partial<DiceRollerLabels>>;
20
+ default: () => {};
21
+ };
22
+ }>> & Readonly<{
23
+ onRoll?: ((notation: string, result: import("@dice-roller/rpg-dice-roller").DiceRoll | null) => any) | undefined;
24
+ "onNotation:change"?: ((notation: string) => any) | undefined;
25
+ "onUpdate:notation"?: ((notation: string) => any) | undefined;
26
+ }>, {
27
+ labels: Partial<DiceRollerLabels>;
28
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
29
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
30
+ declare const _default: typeof __VLS_export;
31
+ export default _default;
32
+ type __VLS_WithSlots<T, S> = T & {
33
+ new (): {
34
+ $slots: S;
35
+ };
36
+ };
@@ -0,0 +1,47 @@
1
+ import type { PropType } from 'vue';
2
+ import type { DiceRollerLabels, DiceRollerInputAttrs, DiceRollerSlots } from '../types.js';
3
+ type __VLS_Slots = DiceRollerSlots;
4
+ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
5
+ btnLabel: {
6
+ type: StringConstructor;
7
+ default: string;
8
+ };
9
+ id: StringConstructor;
10
+ notation: StringConstructor;
11
+ labels: PropType<Partial<DiceRollerLabels>>;
12
+ inputAttrs: {
13
+ type: PropType<DiceRollerInputAttrs>;
14
+ default: () => {};
15
+ };
16
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
+ roll: (notation: string, result: import("@dice-roller/rpg-dice-roller").DiceRoll | null) => any;
18
+ "notation:change": (notation: string) => any;
19
+ "update:notation": (notation: string) => any;
20
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
21
+ btnLabel: {
22
+ type: StringConstructor;
23
+ default: string;
24
+ };
25
+ id: StringConstructor;
26
+ notation: StringConstructor;
27
+ labels: PropType<Partial<DiceRollerLabels>>;
28
+ inputAttrs: {
29
+ type: PropType<DiceRollerInputAttrs>;
30
+ default: () => {};
31
+ };
32
+ }>> & Readonly<{
33
+ onRoll?: ((notation: string, result: import("@dice-roller/rpg-dice-roller").DiceRoll | null) => any) | undefined;
34
+ "onNotation:change"?: ((notation: string) => any) | undefined;
35
+ "onUpdate:notation"?: ((notation: string) => any) | undefined;
36
+ }>, {
37
+ btnLabel: string;
38
+ inputAttrs: DiceRollerInputAttrs;
39
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
40
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
41
+ declare const _default: typeof __VLS_export;
42
+ export default _default;
43
+ type __VLS_WithSlots<T, S> = T & {
44
+ new (): {
45
+ $slots: S;
46
+ };
47
+ };
@@ -0,0 +1,3 @@
1
+ export declare function useIdGenerator(prefix?: string): {
2
+ id: import("vue").Ref<string, string>;
3
+ };
@@ -0,0 +1,8 @@
1
+ import type { UseDiceRollerOptions, UseDiceRollerReturn } from '../types.js';
2
+ /**
3
+ * Create an independent dice roller inside setup() or <script setup lang="ts">.
4
+ * notation and labels accept plain values, refs or getters.
5
+ * Source updates are silent; local edits call onNotationChange once.
6
+ * onRoll receives (notation, result), including null for empty/failed rolls.
7
+ */
8
+ export declare function useDiceRoller(options?: UseDiceRollerOptions): UseDiceRollerReturn;
@@ -0,0 +1 @@
1
+ export * from './index.js';
@@ -0,0 +1,6 @@
1
+ export { default as DiceRoller } from './components/DiceRoller.vue';
2
+ export { default as DiceRollerTailwind } from './components/DiceRollerTailwind.vue';
3
+ export { default as DiceRollerBootstrap } from './components/DiceRollerBootstrap.vue';
4
+ export { default as DiceRollerRenderless } from './components/DiceRollerRenderless.vue';
5
+ export { useDiceRoller } from './composables/useDiceRoller.js';
6
+ export type * from './types.js';
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,67 @@
1
+ import type { DiceRoll } from '@dice-roller/rpg-dice-roller';
2
+ import type { ComputedRef, InputHTMLAttributes, MaybeRefOrGetter, VNodeChild, WritableComputedRef, Ref } from 'vue';
3
+ export interface DiceRollerLabels {
4
+ notation: string;
5
+ copy: string;
6
+ copied: string;
7
+ copyError: string;
8
+ invalidNotation: string;
9
+ error: string;
10
+ }
11
+ export type DiceRollerInputAttrs = Omit<InputHTMLAttributes, 'id' | 'value' | 'type' | 'name'> & Record<string, unknown>;
12
+ export interface UseDiceRollerOptions {
13
+ notation?: MaybeRefOrGetter<string | null | undefined>;
14
+ labels?: MaybeRefOrGetter<Partial<DiceRollerLabels> | undefined>;
15
+ onNotationChange?: (notation: string) => void;
16
+ onRoll?: (notation: string, result: DiceRoll | null) => void;
17
+ }
18
+ export interface DiceRollerClipboard {
19
+ copy: () => Promise<void>;
20
+ copied: boolean;
21
+ text: string;
22
+ isSupported: boolean;
23
+ error: string | null;
24
+ }
25
+ export interface DiceRollerInputHandlers {
26
+ input: (event: Event) => void;
27
+ change: (event: Event) => void;
28
+ keydown: (event: KeyboardEvent) => void;
29
+ }
30
+ export interface UseDiceRollerReturn {
31
+ currentNotation: WritableComputedRef<string>;
32
+ error: Ref<string | null>;
33
+ output: Ref<DiceRoll | null>;
34
+ roll: () => void;
35
+ labels: ComputedRef<DiceRollerLabels>;
36
+ setNotation: (notation: string) => void;
37
+ bind: ComputedRef<{
38
+ value: string;
39
+ }>;
40
+ on: DiceRollerInputHandlers;
41
+ copy: DiceRollerClipboard;
42
+ }
43
+ export type DiceRollerEmits = {
44
+ 'notation:change': [notation: string];
45
+ 'update:notation': [notation: string];
46
+ roll: [notation: string, result: DiceRoll | null];
47
+ };
48
+ export type DiceRollerSlots = {
49
+ button?: () => VNodeChild;
50
+ };
51
+ export interface DiceRollerSlotProps {
52
+ currentNotation: string;
53
+ error: string | null;
54
+ output: DiceRoll | null;
55
+ roll: () => void;
56
+ labels: DiceRollerLabels;
57
+ bind: {
58
+ value: string;
59
+ };
60
+ on: DiceRollerInputHandlers;
61
+ copy: DiceRollerClipboard;
62
+ }
63
+ export type BootstrapVariant = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'light' | 'dark';
64
+ export type BootstrapBackgroundVariant = BootstrapVariant | 'body' | 'white' | 'transparent';
65
+ export type BootstrapBorderVariant = BootstrapVariant | 'white';
66
+ export type BootstrapTextVariant = BootstrapVariant | 'body' | 'muted' | 'white' | 'black-50' | 'white-50';
67
+ export type BootstrapButtonVariant = BootstrapVariant | 'link' | `outline-${BootstrapVariant}`;