@ramstack/alpinegear-main 1.4.2 → 1.4.4
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 +163 -187
- package/alpinegear-main.esm.js +623 -615
- package/alpinegear-main.esm.min.js +1 -1
- package/alpinegear-main.js +623 -624
- package/alpinegear-main.min.js +1 -1
- package/package.json +9 -3
package/README.md
CHANGED
|
@@ -1,187 +1,163 @@
|
|
|
1
|
-
# @ramstack/alpinegear-main
|
|
2
|
-
[](https://www.npmjs.com/package/@ramstack/alpinegear-main)
|
|
3
|
-
[](https://github.com/rameel/ramstack.alpinegear.js/blob/main/LICENSE)
|
|
4
|
-
|
|
5
|
-
`@ramstack/alpinegear-main` is a combined plugin for [Alpine.js](https://alpinejs.dev/) that includes several useful directives.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
import
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Alpine.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
</
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
Provides the `x-when` directive, which allows for conditional rendering of elements similar to `x-if`, but supports multiple root elements.
|
|
165
|
-
|
|
166
|
-
**[@ramstack/alpinegear-destroy](https://www.npmjs.com/package/@ramstack/alpinegear-destroy)** ([README](https://github.com/rameel/ramstack.alpinegear.js/tree/main/src/plugins/destroy))<br>
|
|
167
|
-
Provides the `x-destroy` directive, which is the opposite of `x-init` and allows you to hook into the cleanup phase
|
|
168
|
-
of any element, running a callback when the element is removed from the DOM.
|
|
169
|
-
|
|
170
|
-
**[@ramstack/alpinegear-hotkey](https://www.npmjs.com/package/@ramstack/alpinegear-hotkey)** ([README](https://github.com/rameel/ramstack.alpinegear.js/tree/main/src/plugins/hotkey))<br>
|
|
171
|
-
Provides the `x-hotkey` directive, which allows you to easily handle keyboard shortcuts within your Alpine.js components or application.
|
|
172
|
-
|
|
173
|
-
**[@ramstack/alpinegear-router](https://www.npmjs.com/package/@ramstack/alpinegear-router)** ([README](https://github.com/rameel/ramstack.alpinegear.js/tree/main/src/plugins/router))<br>
|
|
174
|
-
Provides the `x-router` and `x-route` directives, which enable client-side navigation and routing functionality within your Alpine.js application.
|
|
175
|
-
|
|
176
|
-
**[@ramstack/alpinegear-dialog](https://www.npmjs.com/package/@ramstack/alpinegear-dialog)** ([README](https://github.com/rameel/ramstack.alpinegear.js/tree/main/src/plugins/dialog))<br>
|
|
177
|
-
Provides a headless dialog directive for Alpine.js based on the native HTML `<dialog>` element.
|
|
178
|
-
It supports declarative composition, value-based close semantics, and both modal and non-modal dialogs,
|
|
179
|
-
with optional Promise-based imperative control.
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
## Contributions
|
|
183
|
-
Bug reports and contributions are welcome.
|
|
184
|
-
|
|
185
|
-
## License
|
|
186
|
-
This package is released as open source under the **MIT License**.
|
|
187
|
-
See the [LICENSE](https://github.com/rameel/ramstack.alpinegear.js/blob/main/LICENSE) file for more details.
|
|
1
|
+
# @ramstack/alpinegear-main
|
|
2
|
+
[](https://www.npmjs.com/package/@ramstack/alpinegear-main)
|
|
3
|
+
[](https://github.com/rameel/ramstack.alpinegear.js/blob/main/LICENSE)
|
|
4
|
+
|
|
5
|
+
`@ramstack/alpinegear-main` is a combined plugin for [Alpine.js](https://alpinejs.dev/) that includes several useful directives.
|
|
6
|
+
This plugin aggregates multiple individual plugins, providing a convenient all-in-one package.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
### Using CDN
|
|
11
|
+
To include the CDN version of this plugin, add the following `<script>` tag before the core `alpine.js` file:
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<!-- alpine.js plugin -->
|
|
15
|
+
<script src="https://cdn.jsdelivr.net/npm/@ramstack/alpinegear-main@1/alpinegear-main.min.js" defer></script>
|
|
16
|
+
|
|
17
|
+
<!-- alpine.js -->
|
|
18
|
+
<script src="https://cdn.jsdelivr.net/npm/alpinejs@3/dist/cdn.min.js" defer></script>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Using NPM
|
|
22
|
+
Alternatively, you can install the plugin via `npm`:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install --save @ramstack/alpinegear-main
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Then initialize it in your bundle:
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
import Alpine from "alpinejs";
|
|
32
|
+
import main from "@ramstack/alpinegear-main";
|
|
33
|
+
|
|
34
|
+
Alpine.plugin(main);
|
|
35
|
+
Alpine.start();
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Included Plugins
|
|
39
|
+
|
|
40
|
+
**[@ramstack/alpinegear-bound](https://github.com/rameel/ramstack.alpinegear.js/tree/main/src/plugins/bound)** ([README](https://github.com/rameel/ramstack.alpinegear.js/tree/main/src/plugins/bound))<br>
|
|
41
|
+
Provides the `x-bound` directive, which allows for two-way binding of input elements and their associated data properties.
|
|
42
|
+
It works similarly to the binding provided by [Svelte](https://svelte.dev/docs/element-directives#bind-property)
|
|
43
|
+
and also supports synchronizing values between two `Alpine.js` data properties.
|
|
44
|
+
|
|
45
|
+
```html
|
|
46
|
+
<div x-data="{ width: 0, height: 0, files: [] }">
|
|
47
|
+
<input &files="files" type="file" accept="image/jpeg" />
|
|
48
|
+
|
|
49
|
+
<img &naturalwidth="width" &naturalheight="height" src="..." />
|
|
50
|
+
|
|
51
|
+
...
|
|
52
|
+
|
|
53
|
+
For other examples, see README
|
|
54
|
+
|
|
55
|
+
</div>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
**[@ramstack/alpinegear-format](https://github.com/rameel/ramstack.alpinegear.js/tree/main/src/plugins/format)** ([README](https://github.com/rameel/ramstack.alpinegear.js/tree/main/src/plugins/format))<br>
|
|
60
|
+
Provides `x-format` directive, which allows you to easily interpolate text using a template syntax
|
|
61
|
+
similar to what's available in `Vue.js`.
|
|
62
|
+
|
|
63
|
+
```html
|
|
64
|
+
<div x-data="{ message: 'Hello, World!'}" x-format>
|
|
65
|
+
<span>Message: {{ message }}</span>
|
|
66
|
+
</div>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
**[@ramstack/alpinegear-template](https://github.com/rameel/ramstack.alpinegear.js/tree/main/src/plugins/template)** ([README](https://github.com/rameel/ramstack.alpinegear.js/tree/main/src/plugins/template))<br>
|
|
71
|
+
Provides `x-template` directive, allowing to define a template once anywhere in the DOM and reference it by its ID.
|
|
72
|
+
|
|
73
|
+
This helps avoid duplicating templates, simplifying markup and making it easier to manage.
|
|
74
|
+
|
|
75
|
+
Moreover, it enables recursive templates, allowing you to create components like a **tree view** with ease,
|
|
76
|
+
something that would otherwise be quite complex to implement.
|
|
77
|
+
|
|
78
|
+
```html
|
|
79
|
+
<template id="treeitem">
|
|
80
|
+
<span x-format>{{ model.name }}</span>
|
|
81
|
+
|
|
82
|
+
<template x-if="model.list">
|
|
83
|
+
<ul>
|
|
84
|
+
<template x-for="item in model.list">
|
|
85
|
+
<li x-template="treeitem" x-data="{ model: item }"></li>
|
|
86
|
+
</template>
|
|
87
|
+
</ul>
|
|
88
|
+
</template>
|
|
89
|
+
</template>
|
|
90
|
+
|
|
91
|
+
<ul x-data="json">
|
|
92
|
+
<li x-template="treeitem"></li>
|
|
93
|
+
</ul>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
**[@ramstack/alpinegear-fragment](https://github.com/rameel/ramstack.alpinegear.js/tree/main/src/plugins/fragment)** ([README](https://github.com/rameel/ramstack.alpinegear.js/tree/main/src/plugins/fragment))<br>
|
|
98
|
+
Provides the `x-fragment` directive, allowing for fragment-like behavior similar to what's available in frameworks
|
|
99
|
+
like `Vue.js` or `React`, where multiple root elements can be grouped together.
|
|
100
|
+
|
|
101
|
+
It is particularly useful when you want to avoid wrapping elements in unnecessary container tags.
|
|
102
|
+
|
|
103
|
+
```html
|
|
104
|
+
<dl>
|
|
105
|
+
<template x-for="item in items" :key="item.id">
|
|
106
|
+
<template x-fragment>
|
|
107
|
+
<dt x-text="item.term"></dt>
|
|
108
|
+
<dd x-text="item.description"></dd>
|
|
109
|
+
</template>
|
|
110
|
+
</template>
|
|
111
|
+
</dl>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
**[@ramstack/alpinegear-match](https://github.com/rameel/ramstack.alpinegear.js/tree/main/src/plugins/match)** ([README](https://github.com/rameel/ramstack.alpinegear.js/tree/main/src/plugins/match))<br>
|
|
116
|
+
Provides the `x-match` directive, which functions similarly to the `switch` statement in many programming languages,
|
|
117
|
+
allowing to conditionally render elements based on matching cases.
|
|
118
|
+
|
|
119
|
+
```html
|
|
120
|
+
<template x-for="n in numbers">
|
|
121
|
+
<template x-match>
|
|
122
|
+
<div x-case="n % 3 == 0 && n % 5 == 0">Fizz Buzz</div>
|
|
123
|
+
<div x-case="n % 3 == 0">Fizz</div>
|
|
124
|
+
<div x-case="n % 5 == 0">Buzz</div>
|
|
125
|
+
<div x-default x-text="n"></div>
|
|
126
|
+
</template>
|
|
127
|
+
</template>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
**[@ramstack/alpinegear-when](https://github.com/rameel/ramstack.alpinegear.js/tree/main/src/plugins/when)** ([README](https://github.com/rameel/ramstack.alpinegear.js/tree/main/src/plugins/when))<br>
|
|
132
|
+
Provides the `x-when` directive, which allows for conditional rendering of elements similar to `x-if`,
|
|
133
|
+
but supports multiple root elements.
|
|
134
|
+
|
|
135
|
+
```html
|
|
136
|
+
<template x-for="item in items" :key="item.id">
|
|
137
|
+
<template x-when="item.visible">
|
|
138
|
+
<dt x-text="item.term"></dt>
|
|
139
|
+
<dd x-text="item.description"></dd>
|
|
140
|
+
</template>
|
|
141
|
+
</template>
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Source Code
|
|
145
|
+
You can find the source code for this plugin on GitHub:
|
|
146
|
+
|
|
147
|
+
https://github.com/rameel/ramstack.alpinegear.js/tree/main/src/plugins/main
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
## Related packages
|
|
151
|
+
This package is part of **[AlpineGear](https://github.com/rameel/ramstack.alpinegear.js)** —
|
|
152
|
+
a collection of utilities and directives for [Alpine.js](https://alpinejs.dev).
|
|
153
|
+
|
|
154
|
+
You can find the full list of related packages and their documentation here:
|
|
155
|
+
https://github.com/rameel/ramstack.alpinegear.js
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
## Contributions
|
|
159
|
+
Bug reports and contributions are welcome.
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
This package is released as open source under the **MIT License**.
|
|
163
|
+
See the [LICENSE](https://github.com/rameel/ramstack.alpinegear.js/blob/main/LICENSE) file for more details.
|