create-coralite 0.33.0 → 0.34.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 +24 -23
- 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 +24 -23
- 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,29 +27,30 @@
|
|
|
27
27
|
import { defineComponent } from 'coralite'
|
|
28
28
|
|
|
29
29
|
export default defineComponent({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
defaultExport: 'confetti'
|
|
35
|
-
}
|
|
36
|
-
],
|
|
37
|
-
script ({ values, helpers, imports }) {
|
|
38
|
-
const button = helpers.refs('count-button')
|
|
39
|
-
const step = values.step ? parseInt(values.step) : 1
|
|
40
|
-
let count = 0
|
|
41
|
-
|
|
42
|
-
button.addEventListener('click', () => {
|
|
43
|
-
// increment the counter by the specified step value
|
|
44
|
-
count += step
|
|
45
|
-
|
|
46
|
-
// update the button's text content to reflect the new count value
|
|
47
|
-
button.textContent = `Count is ${count}`
|
|
48
|
-
|
|
49
|
-
// Explode confetti :)
|
|
50
|
-
imports.confetti()
|
|
51
|
-
})
|
|
30
|
+
attributes: {
|
|
31
|
+
step: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: 1
|
|
52
34
|
}
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
async data () {
|
|
38
|
+
return {
|
|
39
|
+
count: 0
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
async script ({ state, refs }) {
|
|
44
|
+
const { default: confetti } = await import('https://esm.sh/canvas-confetti@latest')
|
|
45
|
+
const button = refs('count-button')
|
|
46
|
+
|
|
47
|
+
button.addEventListener('click', () => {
|
|
48
|
+
// Coralite automatically patches the {{ count }} token in the template.
|
|
49
|
+
state.count += state.step
|
|
50
|
+
|
|
51
|
+
// Explode confetti :)
|
|
52
|
+
confetti()
|
|
53
|
+
})
|
|
53
54
|
}
|
|
54
55
|
})
|
|
55
56
|
</script>
|
|
@@ -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,29 +27,30 @@
|
|
|
27
27
|
import { defineComponent } from 'coralite'
|
|
28
28
|
|
|
29
29
|
export default defineComponent({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
defaultExport: 'confetti'
|
|
35
|
-
}
|
|
36
|
-
],
|
|
37
|
-
script ({ values, helpers, imports }) {
|
|
38
|
-
const button = helpers.refs('count-button')
|
|
39
|
-
const step = values.step ? parseInt(values.step) : 1
|
|
40
|
-
let count = 0
|
|
41
|
-
|
|
42
|
-
button.addEventListener('click', () => {
|
|
43
|
-
// increment the counter by the specified step value
|
|
44
|
-
count += step
|
|
45
|
-
|
|
46
|
-
// update the button's text content to reflect the new count value
|
|
47
|
-
button.textContent = `Count is ${count}`
|
|
48
|
-
|
|
49
|
-
// Explode confetti :)
|
|
50
|
-
imports.confetti()
|
|
51
|
-
})
|
|
30
|
+
attributes: {
|
|
31
|
+
step: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: 1
|
|
52
34
|
}
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
async data () {
|
|
38
|
+
return {
|
|
39
|
+
count: 0
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
async script ({ state, refs }) {
|
|
44
|
+
const { default: confetti } = await import('https://esm.sh/canvas-confetti@latest')
|
|
45
|
+
const button = refs('count-button')
|
|
46
|
+
|
|
47
|
+
button.addEventListener('click', () => {
|
|
48
|
+
// Coralite automatically patches the {{ count }} token in the template.
|
|
49
|
+
state.count += state.step
|
|
50
|
+
|
|
51
|
+
// Explode confetti :)
|
|
52
|
+
confetti()
|
|
53
|
+
})
|
|
53
54
|
}
|
|
54
55
|
})
|
|
55
56
|
</script>
|
|
@@ -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
|
}
|