@dice-roller/vue 0.1.9 → 1.0.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/LICENSE CHANGED
@@ -1,6 +1,7 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 Lee Langley-Rees
3
+ Copyright (c) 2020 - 2021 GreenImp Limited <greenimp.co.uk>
4
+ Copyright (c) 2021 - present GreenImp Media Limited <greenimp.co.uk>
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,32 +1,221 @@
1
1
  <p align="center">
2
- <img src="http://greenimp.github.io/rpg-dice-roller/dice-roller-logo.png" alt="RPG Dice Roller" style="max-width: 100%;" width="200"/>
2
+ <img src="https://dice-roller.github.io/documentation/dice-roller-logo.png" alt="RPG Dice Roller" style="max-width: 100%;" width="200"/>
3
3
  </p>
4
4
 
5
- # RPG Dice Roller Vue Component
5
+ # RPG Dice Roller Vue Components
6
6
 
7
7
  Vue.js component which allows rolling dice.
8
8
 
9
- It is built upon this [RPG dice roller](https://github.com/GreenImp/rpg-dice-roller), and is used in the [documentation](https://greenimp.github.io/rpg-dice-roller).
9
+ It is built upon this [RPG dice roller](https://github.com/dice-roller/rpg-dice-roller), and is used in the [documentation](https://dice-roller.github.io/documentation/).
10
10
 
11
- ## Project setup
12
- ```
11
+ ## Get started
12
+
13
+ ### Install
14
+
15
+ ```sh
13
16
  npm install @dice-roller/vue
14
17
  ```
15
18
 
16
- ### Compiles and hot-reloads for development
19
+ ### Components
20
+
21
+ ### Tailwind
22
+
23
+ If you're using [Tailwind](https://tailwindcss.com/) v3, you can use the pre-styled Tailwind component:
24
+
25
+ ```vue
26
+ <script>
27
+ import { DiceRollerTailwind } from '@dice-roller/vue'
28
+ </script>
29
+
30
+ <template>
31
+ <DiceRollerTailwind />
32
+ </template>
17
33
  ```
18
- npm run serve
34
+
35
+ #### Component reference
36
+
37
+ ##### Properties
38
+
39
+ | Property | Type | Default | Description |
40
+ | ----------- | -------- | -------- | --------------------------------------- |
41
+ | `btn-label` | `String` | `"Roll"` | Text content to place in the button |
42
+ | `id` | `String` | | The `id` attribute of the component |
43
+ | `notation` | `String` | | Notation string to set on the component |
44
+
45
+ ##### Slots
46
+
47
+ | Name | Description |
48
+ | -------- | ------------------------------ |
49
+ | `button` | Content to place in the button |
50
+
51
+ ##### Events
52
+
53
+ | Event | Arguments | Description |
54
+ | - | - | - |
55
+ | `notation:change` | `notation` - Current value of the notation input | Change event triggered by the user interaction. Emitted after the notation is changed |
56
+ | `roll` | `notation` - Value of the rolled notation.<br>`value` - The response of the roll | Emitted after a roll is made |
57
+
58
+ ### Bootstrap
59
+
60
+ If you're using [Bootstrap](https://getbootstrap.com/) v5, you can use the Bootstrap component:
61
+
62
+ ```vue
63
+ <script>
64
+ import { DiceRollerBootstrap } from '@dice-roller/vue'
65
+ </script>
66
+
67
+ <template>
68
+ <DiceRollerBootstrap />
69
+ </template>
19
70
  ```
20
71
 
21
- ### Compiles and minifies for production
72
+ The Bootstrap component is wrapped in a [card](https://getbootstrap.com/docs/5.2/components/card/), and uses other bootstrap components. It can be easily styled.
73
+
74
+ #### Component reference
75
+
76
+ ##### Properties
77
+
78
+ | Property | Type | Default | Description |
79
+ | ----------------------- | -------- | ----------- | ------------------------------------------------------------ |
80
+ | `bg-variant` | `String` | | Applies one of the Bootstrap theme colour variants to the background |
81
+ | `border-variant` | `String` | | Applies one of the Bootstrap theme colour variants to the border |
82
+ | `btn-label` | `String` | `"Roll"` | Text content to place in the button |
83
+ | `btn-variant` | `String` | `"primary"` | Applies one of the Bootstrap theme colour variants to the button |
84
+ | `id` | `String` | | The `id` attribute of the component |
85
+ | `notation` | `String` | | Notation string to set on the component |
86
+ | `output-bg-variant` | `String` | | Applies one of the Bootstrap theme colour variants to the background of the output container |
87
+ | `output-border-variant` | `String` | | Applies one of the Bootstrap theme colour variants to the border of the output container |
88
+ | `output-text-variant` | `String` | | Applies one of the Bootstrap theme colour variants to the text of the output container |
89
+ | `output-variant` | `String` | | Applies one of the Bootstrap theme colour variants to the output container. This defines the background colour and contrasting text. See Bootstrap [Color & background](https://getbootstrap.com/docs/5.2/helpers/color-background/). |
90
+ | `text-variant` | `String` | | Applies one of the Bootstrap theme colour variants to the text |
91
+ | `variant` | `String` | | Applies one of the Bootstrap theme colour variants to the component. This defines the background colour and contrasting text. See Bootstrap [Color & background](https://getbootstrap.com/docs/5.2/helpers/color-background/). |
92
+
93
+ ##### Slots
94
+
95
+ | Name | Description |
96
+ | -------- | ------------------------------ |
97
+ | `button` | Content to place in the button |
98
+
99
+ ##### Events
100
+
101
+ | Event | Arguments | Description |
102
+ | - | - | - |
103
+ | `notation:change` | `notation` - Current value of the notation input | Change event triggered by the user interaction. Emitted after the notation is changed |
104
+ | `roll` | `notation` - Value of the rolled notation.<br>`value` - The response of the roll | Emitted after a roll is made |
105
+
106
+ ### Plain HTML
107
+
108
+ There's also a basic component, which provides HTML markup, without any styling. It applies a class to the elements, so you can style it with your own CSS.
109
+
110
+ ```vue
111
+ <script>
112
+ import { DiceRoller } from '@dice-roller/vue'
113
+ </script>
114
+
115
+ <template>
116
+ <DiceRoller />
117
+ </template>
22
118
  ```
23
- npm run build
119
+
120
+ #### Component reference
121
+
122
+ ##### Properties
123
+
124
+ | Property | Type | Default | Description |
125
+ | ------------ | -------- | --------------- | --------------------------------------- |
126
+ | `btn-label` | `String` | `"Roll"` | Text content to place in the button |
127
+ | `class-name` | `String` | `"dice-roller"` | The class name of the component |
128
+ | `id` | `String` | | The `id` attribute of the component |
129
+ | `notation` | `String` | | Notation string to set on the component |
130
+
131
+ ##### Slots
132
+
133
+ | Name | Description |
134
+ | -------- | ------------------------------ |
135
+ | `button` | Content to place in the button |
136
+
137
+ ##### Events
138
+
139
+ | Event | Arguments | Description |
140
+ | - | - | - |
141
+ | `notation:change` | `notation` - Current value of the notation input | Change event triggered by the user interaction. Emitted after the notation is changed |
142
+ | `roll` | `notation` - Value of the rolled notation.<br>`value` - The response of the roll | Emitted after a roll is made |
143
+
144
+ ### Renderless component
145
+
146
+ If you want to write your own HTML markup, you can use the renderless component instead. This provides the logic and functionality, without any markup, so you can build your own.
147
+
148
+ ```vue
149
+ <script>
150
+ import { DiceRollerRenderless } from '@dice-roller/vue';
151
+ </script>
152
+
153
+ <template>
154
+ <DiceRollerRenderless v-slot="{ currentNotation, error, output, roll, on, bind }">
155
+ <div>
156
+ <div v-if="error">{{ error }}</div>
157
+
158
+ <input type="text" v-on="on" v-bind="bind" />
159
+
160
+ <button type="button" @click="roll">Roll</button>
161
+
162
+ <div>
163
+ <strong>Notation:</strong> <em>{{ currentNotation }}</em>
164
+ </div>
165
+
166
+ <output v-if="output">{{ output }}</output>
167
+ </div>
168
+ </DiceRollerRenderless>
169
+ </template>
24
170
  ```
25
171
 
26
- ### Lints and fixes files
172
+ #### Component reference
173
+
174
+ ##### Properties
175
+
176
+ | Property | Type | Default | Description |
177
+ | ---------- | -------- | ------- | --------------------------------------- |
178
+ | `notation` | `String` | | Notation string to set on the component |
179
+
180
+ ##### Slots
181
+
182
+ | Name | Description |
183
+ | --------- | ------------------------ |
184
+ | `default` | Content of the component |
185
+
186
+ ##### Events
187
+
188
+ | Event | Arguments | Description |
189
+ | - | - | - |
190
+ | `notation:change` | `notation` - Current value of the notation input | Change event triggered by the user interaction. Emitted after the notation is changed |
191
+ | `roll` | `notation` - Value of the rolled notation.<br>`value` - The response of the roll | Emitted after a roll is made |
192
+
193
+ ## Development
194
+
195
+ ### Customise configuration
196
+
197
+ See [Vite Configuration Reference](https://vitejs.dev/config/).
198
+
199
+ ### Project Setup
200
+
201
+ ```sh
202
+ npm install @dice-roller/vue
27
203
  ```
28
- npm run lint
204
+
205
+ #### Compile and Hot-Reload for Development
206
+
207
+ ```sh
208
+ npm run dev
209
+ ```
210
+
211
+ #### Compile and Minify for Production
212
+
213
+ ```sh
214
+ npm run build
29
215
  ```
30
216
 
31
- ### Customize configuration
32
- See [Configuration Reference](https://cli.vuejs.org/config/).
217
+ #### Lint with [ESLint](https://eslint.org/)
218
+
219
+ ```sh
220
+ npm run lint
221
+ ```
Binary file