create-coralite 0.33.1 → 0.35.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/package.json +1 -1
- package/templates/css/package.json +1 -1
- package/templates/css/src/components/coralite-counter.html +17 -9
- package/templates/css/src/components/coralite-footer.html +9 -6
- package/templates/scss/package.json +1 -1
- package/templates/scss/src/components/coralite-counter.html +17 -9
- package/templates/scss/src/components/coralite-footer.html +12 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template id="coralite-counter">
|
|
2
2
|
<button ref="count-button" type="button" class="btn">
|
|
3
|
-
Count is
|
|
3
|
+
Count is {{ count }}
|
|
4
4
|
</button>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
@@ -27,18 +27,26 @@
|
|
|
27
27
|
import { defineComponent } from 'coralite'
|
|
28
28
|
|
|
29
29
|
export default defineComponent({
|
|
30
|
-
|
|
30
|
+
attributes: {
|
|
31
|
+
step: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: 1
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
async data () {
|
|
38
|
+
return {
|
|
39
|
+
count: 0
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
async script ({ state, refs }) {
|
|
31
44
|
const { default: confetti } = await import('https://esm.sh/canvas-confetti@latest')
|
|
32
45
|
const button = refs('count-button')
|
|
33
|
-
const step = properties.step ? parseInt(properties.step) : 1
|
|
34
|
-
let count = 0
|
|
35
46
|
|
|
36
47
|
button.addEventListener('click', () => {
|
|
37
|
-
//
|
|
38
|
-
count += step
|
|
39
|
-
|
|
40
|
-
// update the button's text content to reflect the new count value
|
|
41
|
-
button.textContent = `Count is ${count}`
|
|
48
|
+
// Coralite automatically patches the {{ count }} token in the template.
|
|
49
|
+
state.count += state.step
|
|
42
50
|
|
|
43
51
|
// Explode confetti :)
|
|
44
52
|
confetti()
|
|
@@ -8,13 +8,16 @@
|
|
|
8
8
|
import { defineComponent } from 'coralite'
|
|
9
9
|
|
|
10
10
|
export default defineComponent({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
attributes: {
|
|
12
|
+
name: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: 'coralite'
|
|
15
|
+
}
|
|
16
|
+
},
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
getters: {
|
|
19
|
+
capitaliseName: (state) => {
|
|
20
|
+
return state.name[0].toUpperCase() + state.name.slice(1)
|
|
18
21
|
}
|
|
19
22
|
}
|
|
20
23
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template id="coralite-counter">
|
|
2
2
|
<button ref="count-button" type="button" class="btn">
|
|
3
|
-
Count is
|
|
3
|
+
Count is {{ count }}
|
|
4
4
|
</button>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
@@ -27,18 +27,26 @@
|
|
|
27
27
|
import { defineComponent } from 'coralite'
|
|
28
28
|
|
|
29
29
|
export default defineComponent({
|
|
30
|
-
|
|
30
|
+
attributes: {
|
|
31
|
+
step: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: 1
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
async data () {
|
|
38
|
+
return {
|
|
39
|
+
count: 0
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
async script ({ state, refs }) {
|
|
31
44
|
const { default: confetti } = await import('https://esm.sh/canvas-confetti@latest')
|
|
32
45
|
const button = refs('count-button')
|
|
33
|
-
const step = properties.step ? parseInt(properties.step) : 1
|
|
34
|
-
let count = 0
|
|
35
46
|
|
|
36
47
|
button.addEventListener('click', () => {
|
|
37
|
-
//
|
|
38
|
-
count += step
|
|
39
|
-
|
|
40
|
-
// update the button's text content to reflect the new count value
|
|
41
|
-
button.textContent = `Count is ${count}`
|
|
48
|
+
// Coralite automatically patches the {{ count }} token in the template.
|
|
49
|
+
state.count += state.step
|
|
42
50
|
|
|
43
51
|
// Explode confetti :)
|
|
44
52
|
confetti()
|
|
@@ -8,12 +8,19 @@
|
|
|
8
8
|
import { defineComponent } from 'coralite'
|
|
9
9
|
|
|
10
10
|
export default defineComponent({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
attributes: {
|
|
12
|
+
name: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: ''
|
|
15
|
+
}
|
|
16
|
+
},
|
|
16
17
|
|
|
18
|
+
getters: {
|
|
19
|
+
capitaliseName: (state) => {
|
|
20
|
+
if (state.name) {
|
|
21
|
+
return state.name[0].toUpperCase() + state.name.slice(1)
|
|
22
|
+
}
|
|
23
|
+
|
|
17
24
|
return 'Coralite'
|
|
18
25
|
}
|
|
19
26
|
}
|