@alpinejs/docs 3.13.2-revision.2 → 3.13.3-revision.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
CHANGED
|
@@ -307,6 +307,19 @@ By default, any data stored in a property via `x-model` is stored as a string. T
|
|
|
307
307
|
<span x-text="typeof age"></span>
|
|
308
308
|
```
|
|
309
309
|
|
|
310
|
+
<a name="boolean"></a>
|
|
311
|
+
### `.boolean`
|
|
312
|
+
|
|
313
|
+
By default, any data stored in a property via `x-model` is stored as a string. To force Alpine to store the value as a JavaScript boolean, add the `.boolean` modifier. Both integers (1/0) and strings (true/false) are valid boolean values.
|
|
314
|
+
|
|
315
|
+
```alpine
|
|
316
|
+
<select x-model.boolean="isActive">
|
|
317
|
+
<option value="true">Yes</option>
|
|
318
|
+
<option value="false">No</option>
|
|
319
|
+
</select>
|
|
320
|
+
<span x-text="typeof isActive"></span>
|
|
321
|
+
```
|
|
322
|
+
|
|
310
323
|
<a name="debounce"></a>
|
|
311
324
|
### `.debounce`
|
|
312
325
|
|
|
@@ -33,7 +33,7 @@ This is by far the simplest way to get started with Alpine. Include the followin
|
|
|
33
33
|
Notice the `@3.x.x` in the provided CDN link. This will pull the latest version of Alpine version 3. For stability in production, it's recommended that you hardcode the latest version in the CDN link.
|
|
34
34
|
|
|
35
35
|
```alpine
|
|
36
|
-
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.13.
|
|
36
|
+
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.13.3/dist/cdn.min.js"></script>
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
That's it! Alpine is now available for use inside your page.
|
package/src/en/plugins/anchor.md
CHANGED
|
@@ -32,7 +32,7 @@ You can include the CDN build of this plugin as a `<script>` tag, just make sure
|
|
|
32
32
|
|
|
33
33
|
### Via NPM
|
|
34
34
|
|
|
35
|
-
You can install
|
|
35
|
+
You can install Anchor from NPM for use inside your bundle like so:
|
|
36
36
|
|
|
37
37
|
```shell
|
|
38
38
|
npm install @alpinejs/anchor
|
|
@@ -76,7 +76,7 @@ For example, here's a simple dropdown anchored to the button that toggles it:
|
|
|
76
76
|
<button x-ref="button" @click="open = ! open">Toggle</button>
|
|
77
77
|
</div>
|
|
78
78
|
|
|
79
|
-
<div x-show="open" x-anchor="$refs.button" class="bg-white rounded p-4 border shadow">
|
|
79
|
+
<div x-show="open" x-anchor="$refs.button" class="bg-white rounded p-4 border shadow z-10">
|
|
80
80
|
Dropdown content
|
|
81
81
|
</div>
|
|
82
82
|
</div>
|
|
@@ -110,7 +110,7 @@ Here is an example of using `.bottom-start` to position a dropdown below and to
|
|
|
110
110
|
<button x-ref="button" @click="open = ! open">Toggle</button>
|
|
111
111
|
</div>
|
|
112
112
|
|
|
113
|
-
<div x-show="open" x-anchor.bottom-start="$refs.button" class="bg-white rounded p-4 border shadow">
|
|
113
|
+
<div x-show="open" x-anchor.bottom-start="$refs.button" class="bg-white rounded p-4 border shadow z-10">
|
|
114
114
|
Dropdown content
|
|
115
115
|
</div>
|
|
116
116
|
</div>
|
|
@@ -137,7 +137,7 @@ You can add an offset to your anchored element using the `.offset.[px value]` mo
|
|
|
137
137
|
<button x-ref="button" @click="open = ! open">Toggle</button>
|
|
138
138
|
</div>
|
|
139
139
|
|
|
140
|
-
<div x-show="open" x-anchor.offset.10="$refs.button" class="bg-white rounded p-4 border shadow">
|
|
140
|
+
<div x-show="open" x-anchor.offset.10="$refs.button" class="bg-white rounded p-4 border shadow z-10">
|
|
141
141
|
Dropdown content
|
|
142
142
|
</div>
|
|
143
143
|
</div>
|
|
@@ -146,7 +146,7 @@ You can add an offset to your anchored element using the `.offset.[px value]` mo
|
|
|
146
146
|
<a name="manual-styling"></a>
|
|
147
147
|
## Manual styling
|
|
148
148
|
|
|
149
|
-
By default, `x-
|
|
149
|
+
By default, `x-anchor` applies the positioning styles to your element under the hood. If you'd prefer full control over styling, you can pass the `.no-style` modifer and use the `$anchor` magic to access the values inside another Alpine expression.
|
|
150
150
|
|
|
151
151
|
Below is an example of bypassing `x-anchor`'s internal styling and instead applying the styles yourself using `x-bind:style`:
|
|
152
152
|
|
|
@@ -174,7 +174,7 @@ Below is an example of bypassing `x-anchor`'s internal styling and instead apply
|
|
|
174
174
|
x-show="open"
|
|
175
175
|
x-anchor.no-style="$refs.button"
|
|
176
176
|
x-bind:style="{ position: 'absolute', top: $anchor.y+'px', left: $anchor.x+'px' }"
|
|
177
|
-
class="bg-white rounded p-4 border shadow"
|
|
177
|
+
class="bg-white rounded p-4 border shadow z-10"
|
|
178
178
|
>
|
|
179
179
|
Dropdown content
|
|
180
180
|
</div>
|