create-coralite 0.47.1 → 1.0.0-rc.1
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 +4 -2
- package/templates/css/src/components/coralite-card.html +27 -5
- package/templates/css/src/components/coralite-counter.html +22 -11
- package/templates/css/src/components/coralite-footer.html +16 -6
- package/templates/css/src/css/styles.css +10 -24
- package/templates/scss/package.json +4 -2
- package/templates/scss/src/components/coralite-card.html +27 -5
- package/templates/scss/src/components/coralite-counter.html +22 -11
- package/templates/scss/src/components/coralite-footer.html +16 -10
- package/templates/scss/src/scss/_variables.scss +18 -4
- package/templates/scss/src/scss/styles.scss +8 -2
- package/templates/scss/src/scss/_card.scss +0 -25
- package/templates/scss/src/scss/_font.scss +0 -1
package/package.json
CHANGED
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --experimental-import-meta-resolve\" coralite-scripts dev",
|
|
8
8
|
"test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --experimental-import-meta-resolve\" coralite-scripts test",
|
|
9
|
-
"build": "coralite-scripts build"
|
|
9
|
+
"build": "coralite-scripts build",
|
|
10
|
+
"check": "coralite-scripts check",
|
|
11
|
+
"fix": "coralite-scripts fix"
|
|
10
12
|
},
|
|
11
13
|
"devDependencies": {
|
|
12
|
-
"coralite-scripts": "^0.
|
|
14
|
+
"coralite-scripts": "^1.0.0-rc.1",
|
|
13
15
|
"cross-env": "^10.1.0"
|
|
14
16
|
}
|
|
15
17
|
}
|
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
<template id="coralite-card">
|
|
2
|
-
<div class="card
|
|
3
|
-
<
|
|
4
|
-
<slot></slot>
|
|
5
|
-
</div>
|
|
2
|
+
<div class="card-body">
|
|
3
|
+
<slot></slot>
|
|
6
4
|
</div>
|
|
7
|
-
</template>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<style>
|
|
8
|
+
:host {
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
gap: var(--spacer-1);
|
|
12
|
+
color: var(--light);
|
|
13
|
+
backdrop-filter: blur(10px);
|
|
14
|
+
border-color: #ffffff2e;
|
|
15
|
+
border-style: solid;
|
|
16
|
+
border-width: 0 1px;
|
|
17
|
+
border-radius: var(--border-radius);
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.card-body {
|
|
22
|
+
padding: var(--spacer-1);
|
|
23
|
+
margin: 0;
|
|
24
|
+
display: flex;
|
|
25
|
+
gap: var(--spacer-1);
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
}
|
|
29
|
+
</style>
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<style>
|
|
8
|
+
:host {
|
|
9
|
+
display: inline-block;
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
.btn {
|
|
9
13
|
background-color: var(--primary);
|
|
10
14
|
color: var(--body-bg);
|
|
@@ -27,34 +31,41 @@
|
|
|
27
31
|
import { defineComponent } from 'coralite'
|
|
28
32
|
|
|
29
33
|
export default defineComponent({
|
|
34
|
+
// Declare and validate component input attributes
|
|
30
35
|
attributes: {
|
|
31
36
|
step: {
|
|
32
37
|
type: Number,
|
|
33
|
-
default: 1
|
|
38
|
+
default: 1,
|
|
39
|
+
validate: (val) => val > 0 || 'Step must be greater than 0'
|
|
34
40
|
}
|
|
35
41
|
},
|
|
36
42
|
|
|
43
|
+
// Server-side initial state (executed during SSR/build and stripped from client bundle)
|
|
37
44
|
server () {
|
|
38
45
|
return {
|
|
39
46
|
count: 0
|
|
40
47
|
}
|
|
41
48
|
},
|
|
42
49
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
button.textContent = 'Count is loading....'
|
|
50
|
+
// Client-side interactive controller (executed in the browser upon hydration)
|
|
51
|
+
async client ({ state, signal, refs, emit }) {
|
|
52
|
+
// Dynamically import third-party modules ahead of time to avoid click latency
|
|
53
|
+
const { default: confetti } = await import('https://esm.sh/canvas-confetti@latest')
|
|
48
54
|
|
|
49
|
-
|
|
55
|
+
// Query element using its scoped ref attribute
|
|
56
|
+
const button = refs('count-button')
|
|
50
57
|
|
|
51
|
-
|
|
58
|
+
// Bind event listener with automatic signal cleanup on component unmount
|
|
59
|
+
button.addEventListener('click', () => {
|
|
60
|
+
// Direct reactive mutation triggers Coralite's O(1) microtask DOM updates
|
|
52
61
|
state.count += state.step
|
|
53
|
-
button.textContent = `Count is ${state.count}`
|
|
54
62
|
|
|
55
|
-
//
|
|
63
|
+
// Dispatch custom DOM event to parent listeners
|
|
64
|
+
emit('count-change', { count: state.count })
|
|
65
|
+
|
|
66
|
+
// Trigger confetti animation instantly
|
|
56
67
|
confetti()
|
|
57
68
|
}, { signal })
|
|
58
69
|
}
|
|
59
70
|
})
|
|
60
|
-
</script>
|
|
71
|
+
</script>
|
|
@@ -1,24 +1,34 @@
|
|
|
1
1
|
<template id="coralite-footer">
|
|
2
2
|
<footer class="text-center">
|
|
3
|
-
Made with <a href="https://coralite.dev/" target="_blank">{{
|
|
3
|
+
Made with <a href="https://coralite.dev/" target="_blank">{{ name }}</a> © {{ year }}
|
|
4
4
|
</footer>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
|
+
<style>
|
|
8
|
+
:host {
|
|
9
|
+
display: block;
|
|
10
|
+
margin-top: auto;
|
|
11
|
+
padding: var(--padding-y) 0;
|
|
12
|
+
text-align: center;
|
|
13
|
+
}
|
|
14
|
+
</style>
|
|
15
|
+
|
|
7
16
|
<script type="module">
|
|
8
17
|
import { defineComponent } from 'coralite'
|
|
9
18
|
|
|
10
19
|
export default defineComponent({
|
|
20
|
+
// Declare component attributes with automatic type coercion, defaults, and transformation
|
|
11
21
|
attributes: {
|
|
12
22
|
name: {
|
|
13
23
|
type: String,
|
|
14
|
-
|
|
24
|
+
// Synchronously transform and format attribute values before state application
|
|
25
|
+
transform: (val) => (val ? val.trim().charAt(0).toUpperCase() + val.trim().slice(1) : 'Coralite')
|
|
15
26
|
}
|
|
16
27
|
},
|
|
17
28
|
|
|
29
|
+
// Pure computed getters for derived or dynamic values
|
|
18
30
|
getters: {
|
|
19
|
-
|
|
20
|
-
return state.name[0].toUpperCase() + state.name.slice(1)
|
|
21
|
-
}
|
|
31
|
+
year: () => new Date().getFullYear()
|
|
22
32
|
}
|
|
23
33
|
})
|
|
24
|
-
</script>
|
|
34
|
+
</script>
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
/*
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Coralite Global Stylesheet
|
|
3
|
+
* -----------------------------------------------------------------
|
|
4
|
+
* 1. Design Tokens (:root CSS Custom Properties)
|
|
5
|
+
* 2. Reset & Typography (html, body, headings, links)
|
|
6
|
+
* 3. Layout & Utilities (.container, .d-flex, .gap, .text-center)
|
|
7
|
+
*/
|
|
3
8
|
|
|
4
9
|
/* Variables */
|
|
5
10
|
:root {
|
|
@@ -25,9 +30,9 @@
|
|
|
25
30
|
--padding-y: .5rem;
|
|
26
31
|
|
|
27
32
|
/* Fonts */
|
|
28
|
-
--font-body: "
|
|
29
|
-
--font-heading: "
|
|
30
|
-
--font-monospace: "
|
|
33
|
+
--font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
34
|
+
--font-heading: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
35
|
+
--font-monospace: "Courier New", courier, monospace;
|
|
31
36
|
--font-size: 20px;
|
|
32
37
|
|
|
33
38
|
/* Text */
|
|
@@ -131,22 +136,3 @@ img {
|
|
|
131
136
|
padding: var(--spacer-2);
|
|
132
137
|
margin: auto;
|
|
133
138
|
}
|
|
134
|
-
|
|
135
|
-
/* Components */
|
|
136
|
-
.card {
|
|
137
|
-
--card-border-color: #ffffff2e;
|
|
138
|
-
|
|
139
|
-
color: var(--light);
|
|
140
|
-
background-image: var(--gradient-glass);
|
|
141
|
-
backdrop-filter: blur(10px);
|
|
142
|
-
border-color: var(--card-border-color);
|
|
143
|
-
border-style: solid;
|
|
144
|
-
border-width: 0 1px;
|
|
145
|
-
border-radius: var(--border-radius);
|
|
146
|
-
overflow: hidden;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.card-body {
|
|
150
|
-
padding: var(--spacer-1);
|
|
151
|
-
margin: 0;
|
|
152
|
-
}
|
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --experimental-import-meta-resolve\" coralite-scripts dev",
|
|
8
8
|
"test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --experimental-import-meta-resolve\" coralite-scripts test",
|
|
9
|
-
"build": "coralite-scripts build"
|
|
9
|
+
"build": "coralite-scripts build",
|
|
10
|
+
"check": "coralite-scripts check",
|
|
11
|
+
"fix": "coralite-scripts fix"
|
|
10
12
|
},
|
|
11
13
|
"devDependencies": {
|
|
12
|
-
"coralite-scripts": "^0.
|
|
14
|
+
"coralite-scripts": "^1.0.0-rc.1",
|
|
13
15
|
"cross-env": "^10.1.0"
|
|
14
16
|
}
|
|
15
17
|
}
|
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
<template id="coralite-card">
|
|
2
|
-
<div class="card
|
|
3
|
-
<
|
|
4
|
-
<slot></slot>
|
|
5
|
-
</div>
|
|
2
|
+
<div class="card-body">
|
|
3
|
+
<slot></slot>
|
|
6
4
|
</div>
|
|
7
|
-
</template>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<style>
|
|
8
|
+
:host {
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
gap: var(--spacer-1);
|
|
12
|
+
color: var(--light);
|
|
13
|
+
backdrop-filter: blur(10px);
|
|
14
|
+
border-color: #ffffff2e;
|
|
15
|
+
border-style: solid;
|
|
16
|
+
border-width: 0 1px;
|
|
17
|
+
border-radius: var(--border-radius);
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.card-body {
|
|
22
|
+
padding: var(--spacer-1);
|
|
23
|
+
margin: 0;
|
|
24
|
+
display: flex;
|
|
25
|
+
gap: var(--spacer-1);
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
}
|
|
29
|
+
</style>
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<style>
|
|
8
|
+
:host {
|
|
9
|
+
display: inline-block;
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
.btn {
|
|
9
13
|
background-color: var(--primary);
|
|
10
14
|
color: var(--body-bg);
|
|
@@ -27,34 +31,41 @@
|
|
|
27
31
|
import { defineComponent } from 'coralite'
|
|
28
32
|
|
|
29
33
|
export default defineComponent({
|
|
34
|
+
// Declare and validate component input attributes
|
|
30
35
|
attributes: {
|
|
31
36
|
step: {
|
|
32
37
|
type: Number,
|
|
33
|
-
default: 1
|
|
38
|
+
default: 1,
|
|
39
|
+
validate: (val) => val > 0 || 'Step must be greater than 0'
|
|
34
40
|
}
|
|
35
41
|
},
|
|
36
42
|
|
|
43
|
+
// Server-side initial state (executed during SSR/build and stripped from client bundle)
|
|
37
44
|
server () {
|
|
38
45
|
return {
|
|
39
46
|
count: 0
|
|
40
47
|
}
|
|
41
48
|
},
|
|
42
49
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
button.textContent = 'Count is loading....'
|
|
50
|
+
// Client-side interactive controller (executed in the browser upon hydration)
|
|
51
|
+
async client ({ state, signal, refs, emit }) {
|
|
52
|
+
// Dynamically import third-party modules ahead of time to avoid click latency
|
|
53
|
+
const { default: confetti } = await import('https://esm.sh/canvas-confetti@latest')
|
|
48
54
|
|
|
49
|
-
|
|
55
|
+
// Query element using its scoped ref attribute
|
|
56
|
+
const button = refs('count-button')
|
|
50
57
|
|
|
51
|
-
|
|
58
|
+
// Bind event listener with automatic signal cleanup on component unmount
|
|
59
|
+
button.addEventListener('click', () => {
|
|
60
|
+
// Direct reactive mutation triggers Coralite's O(1) microtask DOM updates
|
|
52
61
|
state.count += state.step
|
|
53
|
-
button.textContent = `Count is ${state.count}`
|
|
54
62
|
|
|
55
|
-
//
|
|
63
|
+
// Dispatch custom DOM event to parent listeners
|
|
64
|
+
emit('count-change', { count: state.count })
|
|
65
|
+
|
|
66
|
+
// Trigger confetti animation instantly
|
|
56
67
|
confetti()
|
|
57
68
|
}, { signal })
|
|
58
69
|
}
|
|
59
70
|
})
|
|
60
|
-
</script>
|
|
71
|
+
</script>
|
|
@@ -1,28 +1,34 @@
|
|
|
1
1
|
<template id="coralite-footer">
|
|
2
2
|
<footer class="text-center">
|
|
3
|
-
Made with <a href="https://coralite.dev/" target="_blank">{{
|
|
3
|
+
Made with <a href="https://coralite.dev/" target="_blank">{{ name }}</a> © {{ year }}
|
|
4
4
|
</footer>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
|
+
<style>
|
|
8
|
+
:host {
|
|
9
|
+
display: block;
|
|
10
|
+
margin-top: auto;
|
|
11
|
+
padding: var(--padding-y) 0;
|
|
12
|
+
text-align: center;
|
|
13
|
+
}
|
|
14
|
+
</style>
|
|
15
|
+
|
|
7
16
|
<script type="module">
|
|
8
17
|
import { defineComponent } from 'coralite'
|
|
9
18
|
|
|
10
19
|
export default defineComponent({
|
|
20
|
+
// Declare component attributes with automatic type coercion, defaults, and transformation
|
|
11
21
|
attributes: {
|
|
12
22
|
name: {
|
|
13
23
|
type: String,
|
|
14
|
-
|
|
24
|
+
// Synchronously transform and format attribute values before state application
|
|
25
|
+
transform: (val) => (val ? val.trim().charAt(0).toUpperCase() + val.trim().slice(1) : 'Coralite')
|
|
15
26
|
}
|
|
16
27
|
},
|
|
17
28
|
|
|
29
|
+
// Pure computed getters for derived or dynamic values
|
|
18
30
|
getters: {
|
|
19
|
-
|
|
20
|
-
if (state.name) {
|
|
21
|
-
return state.name[0].toUpperCase() + state.name.slice(1)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return 'Coralite'
|
|
25
|
-
}
|
|
31
|
+
year: () => new Date().getFullYear()
|
|
26
32
|
}
|
|
27
33
|
})
|
|
28
|
-
</script>
|
|
34
|
+
</script>
|
|
@@ -26,9 +26,23 @@ $padding-x: 1rem;
|
|
|
26
26
|
$padding-y: .5rem;
|
|
27
27
|
|
|
28
28
|
/* fonts */
|
|
29
|
-
$font-body:
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
$font-body: -apple-system,
|
|
30
|
+
BlinkMacSystemFont,
|
|
31
|
+
"Segoe UI",
|
|
32
|
+
Roboto,
|
|
33
|
+
Helvetica,
|
|
34
|
+
Arial,
|
|
35
|
+
sans-serif;
|
|
36
|
+
$font-heading: -apple-system,
|
|
37
|
+
BlinkMacSystemFont,
|
|
38
|
+
"Segoe UI",
|
|
39
|
+
Roboto,
|
|
40
|
+
Helvetica,
|
|
41
|
+
Arial,
|
|
42
|
+
sans-serif;
|
|
43
|
+
$font-monospace: "Courier New",
|
|
44
|
+
courier,
|
|
45
|
+
monospace;
|
|
32
46
|
$font-size: 20px;
|
|
33
47
|
|
|
34
48
|
/* text */
|
|
@@ -54,4 +68,4 @@ $box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15);
|
|
|
54
68
|
--spacer-base: #{$spacer-base};
|
|
55
69
|
--box-shadow: #{$box-shadow};
|
|
56
70
|
--code-colour: #{$code-colour};
|
|
57
|
-
}
|
|
71
|
+
}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Coralite Global Stylesheet
|
|
3
|
+
* -----------------------------------------------------------------
|
|
4
|
+
* 1. Design Tokens (:root CSS Custom Properties)
|
|
5
|
+
* 2. Reset & Typography (html, body, headings, links)
|
|
6
|
+
* 3. Layout & Utilities (.container, .d-flex, .gap, .text-center)
|
|
7
|
+
*/
|
|
8
|
+
|
|
2
9
|
@use "./variables" as *;
|
|
3
10
|
@use "./base";
|
|
4
11
|
@use "./layout";
|
|
5
|
-
@use "./card";
|
|
6
12
|
|
|
7
13
|
body {
|
|
8
14
|
min-height: 100vh;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
@use "variables" as *;
|
|
2
|
-
|
|
3
|
-
$card-border-color: #ffffff2e;
|
|
4
|
-
|
|
5
|
-
.card {
|
|
6
|
-
color: $light;
|
|
7
|
-
background-image: var(--gradient-glass);
|
|
8
|
-
backdrop-filter: blur(10px);
|
|
9
|
-
border-color: $card-border-color;
|
|
10
|
-
border-style: solid;
|
|
11
|
-
border-width: 0 1px;
|
|
12
|
-
border-radius: $border-radius;
|
|
13
|
-
overflow: hidden;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.card-title {
|
|
17
|
-
padding: $spacer-1;
|
|
18
|
-
margin: 0;
|
|
19
|
-
border-bottom: 1px solid $card-border-color;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.card-body {
|
|
23
|
-
padding: $spacer-1;
|
|
24
|
-
margin: 0;
|
|
25
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&family=TikTok+Sans:wght@300..900&display=swap');
|