@alpinejs/docs 3.9.5-revision.1 → 3.9.6-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
package/src/en/directives/on.md
CHANGED
|
@@ -13,7 +13,7 @@ Here's an example of simple button that shows an alert when clicked.
|
|
|
13
13
|
<button x-on:click="alert('Hello World!')">Say Hi</button>
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
> `x-on` can only listen for events with lower case names, as HTML
|
|
16
|
+
> `x-on` can only listen for events with lower case names, as HTML attributes are case-insensitive. Writing `x-on:CLICK` will listen for an event named `click`. If you need to listen for a custom event with a camelCase name, you can use the [`.camel` helper](#camel) to work around this limitation. Alternatively, you can use [`x-bind`](/directives/bind.md#bind-directives) to attach an `x-on` directive to an element in javascript code (where case will be preserved).
|
|
17
17
|
|
|
18
18
|
<a name="shorthand-syntax"></a>
|
|
19
19
|
## Shorthand syntax
|
|
@@ -46,15 +46,17 @@ You can override these defaults with modifiers attached to `x-transition`. Let's
|
|
|
46
46
|
<a name="customizing-duration"></a>
|
|
47
47
|
### Customizing duration
|
|
48
48
|
|
|
49
|
+
Initially, the duration is set to be 150 milliseconds when entering, and 75 milliseconds when leaving.
|
|
50
|
+
|
|
49
51
|
You can configure the duration you want for a transition with the `.duration` modifier:
|
|
50
52
|
|
|
51
53
|
```alpine
|
|
52
54
|
<div ... x-transition.duration.500ms>
|
|
53
55
|
```
|
|
54
56
|
|
|
55
|
-
The above `<div>` will transition for 500 milliseconds when entering, and
|
|
57
|
+
The above `<div>` will transition for 500 milliseconds when entering, and 500 milliseconds when leaving.
|
|
56
58
|
|
|
57
|
-
|
|
59
|
+
If you wish to customize the durations specifically for entering and leaving, you can do that like so:
|
|
58
60
|
|
|
59
61
|
```alpine
|
|
60
62
|
<div ...
|
|
@@ -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://unpkg.com/alpinejs@3.9.
|
|
36
|
+
<script defer src="https://unpkg.com/alpinejs@3.9.6/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/magics/store.md
CHANGED
|
@@ -6,7 +6,7 @@ title: store
|
|
|
6
6
|
|
|
7
7
|
# $store
|
|
8
8
|
|
|
9
|
-
You can use `$store` to conveniently access global Alpine stores registered using [`Alpine.store(...)`](
|
|
9
|
+
You can use `$store` to conveniently access global Alpine stores registered using [`Alpine.store(...)`](/magics/store). For example:
|
|
10
10
|
|
|
11
11
|
```alpine
|
|
12
12
|
<button x-data @click="$store.darkMode.toggle()">Toggle Dark Mode</button>
|
|
@@ -107,3 +107,32 @@ You can customize the duration of the collapse/expand transition by appending th
|
|
|
107
107
|
</div>
|
|
108
108
|
</div>
|
|
109
109
|
<!-- END_VERBATIM -->
|
|
110
|
+
|
|
111
|
+
<a name="dot-min"></a>
|
|
112
|
+
### .min
|
|
113
|
+
|
|
114
|
+
By default, `x-collapse`'s "collapsed" state sets the height of the element to `0px` and also sets `display: none;`.
|
|
115
|
+
|
|
116
|
+
Sometimes, it's helpful to "cut-off" an element rather than fully hide it. By using the `.min` modifier, you can set a minimum height for `x-collapse`'s "collapsed" state. For example:
|
|
117
|
+
|
|
118
|
+
```alpine
|
|
119
|
+
<div x-data="{ expanded: false }">
|
|
120
|
+
<button @click="expanded = ! expanded">Toggle Content</button>
|
|
121
|
+
|
|
122
|
+
<p x-show="expanded" x-collapse.min.50px>
|
|
123
|
+
...
|
|
124
|
+
</p>
|
|
125
|
+
</div>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
<!-- START_VERBATIM -->
|
|
129
|
+
<div x-data="{ expanded: false }" class="demo">
|
|
130
|
+
<button @click="expanded = ! expanded">Toggle Content</button>
|
|
131
|
+
|
|
132
|
+
<div x-show="expanded" x-collapse.min.50px>
|
|
133
|
+
<div class="pt-4">
|
|
134
|
+
Reprehenderit eu excepteur ullamco esse cillum reprehenderit exercitation labore non. Dolore dolore ea dolore veniam sint in sint ex Lorem ipsum. Sint laborum deserunt deserunt amet voluptate cillum deserunt. Amet nisi pariatur sit ut id. Ipsum est minim est commodo id dolor sint id quis sint Lorem.
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
<!-- END_VERBATIM -->
|