webcoreui 1.1.0-beta.3 → 1.1.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/README.md
CHANGED
|
@@ -40,14 +40,18 @@
|
|
|
40
40
|
- [Documentation](#documentation)
|
|
41
41
|
- [Getting started](#getting-started)
|
|
42
42
|
- [Prerequisites](#prerequisites)
|
|
43
|
-
- [Installation](#installation)
|
|
43
|
+
- [Installation with CLI](#installation-with-cli)
|
|
44
|
+
- [Manual Installation](#manual-installation)
|
|
44
45
|
- [Setup](#setup)
|
|
45
46
|
- [Using Components](#using-components)
|
|
46
47
|
- [Components](#components)
|
|
48
|
+
- [Blocks](#blocks)
|
|
49
|
+
- [Templates](#templates)
|
|
47
50
|
|
|
48
51
|
## Documentation
|
|
49
52
|
|
|
50
|
-
Full documentation available on [webcoreui.dev](https://webcoreui.dev).
|
|
53
|
+
- Full documentation available on [webcoreui.dev](https://webcoreui.dev).
|
|
54
|
+
- For installation steps, visit our [setup docs](https://webcoreui.dev/docs/setup).
|
|
51
55
|
|
|
52
56
|
## Getting Started
|
|
53
57
|
|
|
@@ -73,7 +77,28 @@ Depending on your project setup, you'll also need the following packages:
|
|
|
73
77
|
- [React](https://www.npmjs.com/package/react) - `v19.0`
|
|
74
78
|
- [React DOM](https://www.npmjs.com/package/react-dom) -`v19.0`
|
|
75
79
|
|
|
76
|
-
### Installation
|
|
80
|
+
### Installation with CLI
|
|
81
|
+
|
|
82
|
+
You can use our CLI tool to create a new Webcore project, or integrate it into an existing project more easily:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Create a new Webcore project
|
|
86
|
+
npm create webcore@latest
|
|
87
|
+
|
|
88
|
+
# Update configuration files for an existing Astro project
|
|
89
|
+
npm create webcore@lates config
|
|
90
|
+
|
|
91
|
+
# Create a new Webcore project with a specific template
|
|
92
|
+
npm create webcore@latest template [TemplateName] [destination]
|
|
93
|
+
|
|
94
|
+
# Use the "Portfolio" template on the current directory
|
|
95
|
+
npm create webcore@latest template Portfolio
|
|
96
|
+
|
|
97
|
+
# Create the "Portfolio" template in the "portfolio" directory
|
|
98
|
+
npm create webcore@latest template Portfolio ./portfolio
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Manual Installation
|
|
77
102
|
|
|
78
103
|
Install Webcore as a dependency by running one of the following command:
|
|
79
104
|
|
|
@@ -87,6 +112,16 @@ yarn add webcoreui
|
|
|
87
112
|
|
|
88
113
|
### Setup
|
|
89
114
|
|
|
115
|
+
Add the following integration to your Astro configuration file (`astro.config.mjs`) at the root of your project directory:
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
import { webcore } from 'webcoreui/integration'
|
|
119
|
+
|
|
120
|
+
export default defineConfig({
|
|
121
|
+
integrations: [webcore()]
|
|
122
|
+
})
|
|
123
|
+
```
|
|
124
|
+
|
|
90
125
|
Create an empty [`webcore.config.scss`](https://webcoreui.dev/docs/css-configuration#webcoreconfigscss) file at the root of your project to setup CSS configurations. Setup default styles and fonts by calling the following in your global SCSS file:
|
|
91
126
|
|
|
92
127
|
```scss
|
|
@@ -101,7 +136,7 @@ Create an empty [`webcore.config.scss`](https://webcoreui.dev/docs/css-configura
|
|
|
101
136
|
> [!TIP]
|
|
102
137
|
> You can download the fonts Webcore uses from the [`public/fonts`](https://github.com/Frontendland/webcoreui/tree/main/public/fonts) directory.
|
|
103
138
|
|
|
104
|
-
The `
|
|
139
|
+
The `setup` mixin can also accept the following options:
|
|
105
140
|
|
|
106
141
|
|
|
107
142
|
| Property | Default value | Purpose |
|
|
@@ -61,8 +61,9 @@ if (!Astro.slots.has('context')) {
|
|
|
61
61
|
on(ctx, 'contextmenu', (event: MouseEvent) => {
|
|
62
62
|
event.preventDefault()
|
|
63
63
|
|
|
64
|
+
const target = event.currentTarget as HTMLElement
|
|
65
|
+
|
|
64
66
|
if (!contents[i]) {
|
|
65
|
-
const target = event.currentTarget as HTMLElement
|
|
66
67
|
contents[i] = target.lastElementChild as HTMLDivElement
|
|
67
68
|
}
|
|
68
69
|
|
|
@@ -74,8 +75,12 @@ if (!Astro.slots.has('context')) {
|
|
|
74
75
|
})
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
const rect = target.getBoundingClientRect()
|
|
79
|
+
const x = event.clientX - rect.left
|
|
80
|
+
const y = event.clientY - rect.top
|
|
81
|
+
|
|
82
|
+
contents[i].style.top = `${y}px`
|
|
83
|
+
contents[i].style.left = `${x}px`
|
|
79
84
|
contents[i].dataset.show = 'true'
|
|
80
85
|
})
|
|
81
86
|
})
|
|
@@ -24,8 +24,13 @@
|
|
|
24
24
|
event.preventDefault()
|
|
25
25
|
|
|
26
26
|
if (content) {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const target = event.currentTarget as HTMLElement
|
|
28
|
+
const rect = target.getBoundingClientRect()
|
|
29
|
+
const x = event.clientX - rect.left
|
|
30
|
+
const y = event.clientY - rect.top
|
|
31
|
+
|
|
32
|
+
content.style.top = `${y}px`
|
|
33
|
+
content.style.left = `${x}px`
|
|
29
34
|
content.dataset.show = 'true'
|
|
30
35
|
}
|
|
31
36
|
}
|
|
@@ -24,8 +24,13 @@ const ContextMenu = ({
|
|
|
24
24
|
event.preventDefault()
|
|
25
25
|
|
|
26
26
|
if (content.current) {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const target = event.currentTarget as HTMLElement
|
|
28
|
+
const rect = target.getBoundingClientRect()
|
|
29
|
+
const x = event.clientX - rect.left
|
|
30
|
+
const y = event.clientY - rect.top
|
|
31
|
+
|
|
32
|
+
content.current.style.top = `${y}px`
|
|
33
|
+
content.current.style.left = `${x}px`
|
|
29
34
|
content.current.dataset.show = 'true'
|
|
30
35
|
}
|
|
31
36
|
}
|
package/package.json
CHANGED
package/utils/webcore.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { AstroIntegration } from 'astro'
|
|
2
|
-
import path from 'path'
|
|
3
|
-
|
|
4
|
-
export const webcore = (): AstroIntegration => {
|
|
5
|
-
return {
|
|
6
|
-
name: 'webcoreui',
|
|
7
|
-
hooks: {
|
|
8
|
-
'astro:config:setup': ({ updateConfig }) => {
|
|
9
|
-
updateConfig({
|
|
10
|
-
vite: {
|
|
11
|
-
ssr: {
|
|
12
|
-
noExternal: ['webcoreui']
|
|
13
|
-
},
|
|
14
|
-
css: {
|
|
15
|
-
preprocessorOptions: {
|
|
16
|
-
scss: {
|
|
17
|
-
loadPaths: [
|
|
18
|
-
path.resolve(process.cwd())
|
|
19
|
-
]
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
})
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|