htmx-slide 0.0.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/CITATION.cff +21 -0
- package/LICENSE.adoc +134 -0
- package/README.adoc +255 -0
- package/build/htmx-slide.esm.js +1 -0
- package/build/htmx-slide.js +1 -0
- package/build/style.css +1 -0
- package/package.json +40 -0
package/CITATION.cff
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: Please use the following metadata when citing this project in your work.
|
|
3
|
+
title: htmx Slide
|
|
4
|
+
abstract: A htmx extension for slide show presentations using View Transitions.
|
|
5
|
+
version: 0.0.0
|
|
6
|
+
license: Hippocratic-2.1
|
|
7
|
+
date-released: 2026-05-23
|
|
8
|
+
authors:
|
|
9
|
+
- family-names: Kuhlmann
|
|
10
|
+
given-names: Brooke
|
|
11
|
+
affiliation: Alchemists
|
|
12
|
+
orcid: https://orcid.org/0000-0002-5810-6268
|
|
13
|
+
keywords:
|
|
14
|
+
- htmx
|
|
15
|
+
- extension
|
|
16
|
+
- element
|
|
17
|
+
- slide
|
|
18
|
+
- presentation
|
|
19
|
+
repository-code: https://github.com/bkuhlmann/htmx-select
|
|
20
|
+
repository-artifact: https://rubygems.org/gems/htmx-select
|
|
21
|
+
url: https://alchemists.io/projects/htmx-select
|
package/LICENSE.adoc
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
= Hippocratic License
|
|
2
|
+
|
|
3
|
+
Version: 2.1.0.
|
|
4
|
+
|
|
5
|
+
Purpose. The purpose of this License is for the Licensor named above to
|
|
6
|
+
permit the Licensee (as defined below) broad permission, if consistent
|
|
7
|
+
with Human Rights Laws and Human Rights Principles (as each is defined
|
|
8
|
+
below), to use and work with the Software (as defined below) within the
|
|
9
|
+
full scope of Licensor’s copyright and patent rights, if any, in the
|
|
10
|
+
Software, while ensuring attribution and protecting the Licensor from
|
|
11
|
+
liability.
|
|
12
|
+
|
|
13
|
+
Permission and Conditions. The Licensor grants permission by this
|
|
14
|
+
license ("License"), free of charge, to the extent of Licensor’s
|
|
15
|
+
rights under applicable copyright and patent law, to any person or
|
|
16
|
+
entity (the "Licensee") obtaining a copy of this software and
|
|
17
|
+
associated documentation files (the "Software"), to do everything with
|
|
18
|
+
the Software that would otherwise infringe (i) the Licensor’s copyright
|
|
19
|
+
in the Software or (ii) any patent claims to the Software that the
|
|
20
|
+
Licensor can license or becomes able to license, subject to all of the
|
|
21
|
+
following terms and conditions:
|
|
22
|
+
|
|
23
|
+
* Acceptance. This License is automatically offered to every person and
|
|
24
|
+
entity subject to its terms and conditions. Licensee accepts this
|
|
25
|
+
License and agrees to its terms and conditions by taking any action with
|
|
26
|
+
the Software that, absent this License, would infringe any intellectual
|
|
27
|
+
property right held by Licensor.
|
|
28
|
+
* Notice. Licensee must ensure that everyone who gets a copy of any part
|
|
29
|
+
of this Software from Licensee, with or without changes, also receives
|
|
30
|
+
the License and the above copyright notice (and if included by the
|
|
31
|
+
Licensor, patent, trademark and attribution notice). Licensee must cause
|
|
32
|
+
any modified versions of the Software to carry prominent notices stating
|
|
33
|
+
that Licensee changed the Software. For clarity, although Licensee is
|
|
34
|
+
free to create modifications of the Software and distribute only the
|
|
35
|
+
modified portion created by Licensee with additional or different terms,
|
|
36
|
+
the portion of the Software not modified must be distributed pursuant to
|
|
37
|
+
this License. If anyone notifies Licensee in writing that Licensee has
|
|
38
|
+
not complied with this Notice section, Licensee can keep this License by
|
|
39
|
+
taking all practical steps to comply within 30 days after the notice. If
|
|
40
|
+
Licensee does not do so, Licensee’s License (and all rights licensed
|
|
41
|
+
hereunder) shall end immediately.
|
|
42
|
+
* Compliance with Human Rights Principles and Human Rights Laws.
|
|
43
|
+
[arabic]
|
|
44
|
+
. Human Rights Principles.
|
|
45
|
+
[loweralpha]
|
|
46
|
+
.. Licensee is advised to consult the articles of the United Nations
|
|
47
|
+
Universal Declaration of Human Rights and the United Nations Global
|
|
48
|
+
Compact that define recognized principles of international human rights
|
|
49
|
+
(the "Human Rights Principles"). Licensee shall use the Software in a
|
|
50
|
+
manner consistent with Human Rights Principles.
|
|
51
|
+
.. Unless the Licensor and Licensee agree otherwise, any dispute,
|
|
52
|
+
controversy, or claim arising out of or relating to (i) Section 1(a)
|
|
53
|
+
regarding Human Rights Principles, including the breach of Section 1(a),
|
|
54
|
+
termination of this License for breach of the Human Rights Principles,
|
|
55
|
+
or invalidity of Section 1(a) or (ii) a determination of whether any Law
|
|
56
|
+
is consistent or in conflict with Human Rights Principles pursuant to
|
|
57
|
+
Section 2, below, shall be settled by arbitration in accordance with the
|
|
58
|
+
Hague Rules on Business and Human Rights Arbitration (the "Rules");
|
|
59
|
+
provided, however, that Licensee may elect not to participate in such
|
|
60
|
+
arbitration, in which event this License (and all rights licensed
|
|
61
|
+
hereunder) shall end immediately. The number of arbitrators shall be one
|
|
62
|
+
unless the Rules require otherwise.
|
|
63
|
+
+
|
|
64
|
+
Unless both the Licensor and Licensee agree to the contrary: (1) All
|
|
65
|
+
documents and information concerning the arbitration shall be public and
|
|
66
|
+
may be disclosed by any party; (2) The repository referred to under
|
|
67
|
+
Article 43 of the Rules shall make available to the public in a timely
|
|
68
|
+
manner all documents concerning the arbitration which are communicated
|
|
69
|
+
to it, including all submissions of the parties, all evidence admitted
|
|
70
|
+
into the record of the proceedings, all transcripts or other recordings
|
|
71
|
+
of hearings and all orders, decisions and awards of the arbitral
|
|
72
|
+
tribunal, subject only to the arbitral tribunal’s powers to take such
|
|
73
|
+
measures as may be necessary to safeguard the integrity of the arbitral
|
|
74
|
+
process pursuant to Articles 18, 33, 41 and 42 of the Rules; and (3)
|
|
75
|
+
Article 26(6) of the Rules shall not apply.
|
|
76
|
+
. Human Rights Laws. The Software shall not be used by any person or
|
|
77
|
+
entity for any systems, activities, or other uses that violate any Human
|
|
78
|
+
Rights Laws. "Human Rights Laws" means any applicable laws,
|
|
79
|
+
regulations, or rules (collectively, "Laws") that protect human,
|
|
80
|
+
civil, labor, privacy, political, environmental, security, economic, due
|
|
81
|
+
process, or similar rights; provided, however, that such Laws are
|
|
82
|
+
consistent and not in conflict with Human Rights Principles (a dispute
|
|
83
|
+
over the consistency or a conflict between Laws and Human Rights
|
|
84
|
+
Principles shall be determined by arbitration as stated above). Where
|
|
85
|
+
the Human Rights Laws of more than one jurisdiction are applicable or in
|
|
86
|
+
conflict with respect to the use of the Software, the Human Rights Laws
|
|
87
|
+
that are most protective of the individuals or groups harmed shall
|
|
88
|
+
apply.
|
|
89
|
+
. Indemnity. Licensee shall hold harmless and indemnify Licensor (and
|
|
90
|
+
any other contributor) against all losses, damages, liabilities,
|
|
91
|
+
deficiencies, claims, actions, judgments, settlements, interest, awards,
|
|
92
|
+
penalties, fines, costs, or expenses of whatever kind, including
|
|
93
|
+
Licensor’s reasonable attorneys’ fees, arising out of or relating to
|
|
94
|
+
Licensee’s use of the Software in violation of Human Rights Laws or
|
|
95
|
+
Human Rights Principles.
|
|
96
|
+
* Failure to Comply. Any failure of Licensee to act according to the
|
|
97
|
+
terms and conditions of this License is both a breach of the License and
|
|
98
|
+
an infringement of the intellectual property rights of the Licensor
|
|
99
|
+
(subject to exceptions under Laws, e.g., fair use). In the event of a
|
|
100
|
+
breach or infringement, the terms and conditions of this License may be
|
|
101
|
+
enforced by Licensor under the Laws of any jurisdiction to which
|
|
102
|
+
Licensee is subject. Licensee also agrees that the Licensor may enforce
|
|
103
|
+
the terms and conditions of this License against Licensee through
|
|
104
|
+
specific performance (or similar remedy under Laws) to the extent
|
|
105
|
+
permitted by Laws. For clarity, except in the event of a breach of this
|
|
106
|
+
License, infringement, or as otherwise stated in this License, Licensor
|
|
107
|
+
may not terminate this License with Licensee.
|
|
108
|
+
* Enforceability and Interpretation. If any term or provision of this
|
|
109
|
+
License is determined to be invalid, illegal, or unenforceable by a
|
|
110
|
+
court of competent jurisdiction, then such invalidity, illegality, or
|
|
111
|
+
unenforceability shall not affect any other term or provision of this
|
|
112
|
+
License or invalidate or render unenforceable such term or provision in
|
|
113
|
+
any other jurisdiction; provided, however, subject to a court
|
|
114
|
+
modification pursuant to the immediately following sentence, if any term
|
|
115
|
+
or provision of this License pertaining to Human Rights Laws or Human
|
|
116
|
+
Rights Principles is deemed invalid, illegal, or unenforceable against
|
|
117
|
+
Licensee by a court of competent jurisdiction, all rights in the
|
|
118
|
+
Software granted to Licensee shall be deemed null and void as between
|
|
119
|
+
Licensor and Licensee. Upon a determination that any term or provision
|
|
120
|
+
is invalid, illegal, or unenforceable, to the extent permitted by Laws,
|
|
121
|
+
the court may modify this License to affect the original purpose that
|
|
122
|
+
the Software be used in compliance with Human Rights Principles and
|
|
123
|
+
Human Rights Laws as closely as possible. The language in this License
|
|
124
|
+
shall be interpreted as to its fair meaning and not strictly for or
|
|
125
|
+
against any party.
|
|
126
|
+
* Disclaimer. TO THE FULL EXTENT ALLOWED BY LAW, THIS SOFTWARE COMES
|
|
127
|
+
"AS IS," WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED, AND LICENSOR AND
|
|
128
|
+
ANY OTHER CONTRIBUTOR SHALL NOT BE LIABLE TO ANYONE FOR ANY DAMAGES OR
|
|
129
|
+
OTHER LIABILITY ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE
|
|
130
|
+
OR THIS LICENSE, UNDER ANY KIND OF LEGAL CLAIM.
|
|
131
|
+
|
|
132
|
+
This Hippocratic License is an link:https://ethicalsource.dev[Ethical Source license] and is offered
|
|
133
|
+
for use by licensors and licensees at their own risk, on an "AS IS" basis, and with no warranties
|
|
134
|
+
express or implied, to the maximum extent permitted by Laws.
|
package/README.adoc
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
:toc: macro
|
|
2
|
+
:toclevels: 5
|
|
3
|
+
:figure-caption!:
|
|
4
|
+
|
|
5
|
+
:htmx_link: link:https://htmx.org[htmx]
|
|
6
|
+
:fullscreen_api_link: link:https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API[Fullscreen API]
|
|
7
|
+
:htmx_view_transitions_link: link:https://alchemists.io/articles/htmx_view_transitions[htmx View Transitions]
|
|
8
|
+
|
|
9
|
+
= htmx Slide
|
|
10
|
+
|
|
11
|
+
This library is a {htmx_link} link:https://htmx.org/extensions[extension] for rendering slides.
|
|
12
|
+
|
|
13
|
+
toc::[]
|
|
14
|
+
|
|
15
|
+
== Features
|
|
16
|
+
|
|
17
|
+
* Allows you to render slides with silky smooth CSS View Transitions.
|
|
18
|
+
* Provides keyboard shortcuts.
|
|
19
|
+
* Provides next, previous, last, and first slide transitions.
|
|
20
|
+
* Provides full screen toggling of your presentation.
|
|
21
|
+
* Works with dynamic or statically generated web sites.
|
|
22
|
+
|
|
23
|
+
== Screencasts
|
|
24
|
+
|
|
25
|
+
video::https://alchemists.io/videos/projects/htmx-slide/demo.mp4[poster=https://alchemists.io/images/projects/htmx-slide/demo.webp,width=780,height=858,role=focal_point]
|
|
26
|
+
|
|
27
|
+
== Requirements
|
|
28
|
+
|
|
29
|
+
. {htmx_link}.
|
|
30
|
+
. link:https://nodejs.org[Node] (optional, for development).
|
|
31
|
+
. link:https://www.ruby-lang.org[Ruby] (optional, for development).
|
|
32
|
+
|
|
33
|
+
== Setup
|
|
34
|
+
|
|
35
|
+
The following _assumes_ you are already using {htmx_link} and have it configured in the same manner as documented in this setup section.
|
|
36
|
+
|
|
37
|
+
To load CSS and JavaScript, add the following to your page:
|
|
38
|
+
|
|
39
|
+
[source,html]
|
|
40
|
+
----
|
|
41
|
+
<link href="https://unpkg.com/htmx-slide@latest/build/style.css" rel="stylesheet">
|
|
42
|
+
|
|
43
|
+
<script src="https://unpkg.com/htmx-slide@latest"
|
|
44
|
+
integrity="sha384-kW7IPCYLtM0LPnNd0hhzXbSjutJnlfSXEmvM8zbLx1maZly0KwK/+KGqqlX2ZC4X"
|
|
45
|
+
crossorigin="anonymous">
|
|
46
|
+
</script>
|
|
47
|
+
----
|
|
48
|
+
|
|
49
|
+
To use via Import Maps, add the following to your layout:
|
|
50
|
+
|
|
51
|
+
[source,html]
|
|
52
|
+
----
|
|
53
|
+
<link href="https://unpkg.com/htmx-slide@latest/build/style.css" rel="stylesheet">
|
|
54
|
+
|
|
55
|
+
<script type="importmap">
|
|
56
|
+
{
|
|
57
|
+
"imports": {
|
|
58
|
+
"htmx-slide": "https://unpkg.com/htmx-slide@latest"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<script type="module">
|
|
64
|
+
import "htmx-slide";
|
|
65
|
+
</script>
|
|
66
|
+
----
|
|
67
|
+
|
|
68
|
+
To install via link:https://www.npmjs.com[NPM], run:
|
|
69
|
+
|
|
70
|
+
[source,bash]
|
|
71
|
+
----
|
|
72
|
+
npm install htmx-slide
|
|
73
|
+
----
|
|
74
|
+
|
|
75
|
+
Once the library is installed, you only need to import it:
|
|
76
|
+
|
|
77
|
+
[source,js]
|
|
78
|
+
----
|
|
79
|
+
import "htmx-slide/build/style.css";
|
|
80
|
+
import "htmx-slide";
|
|
81
|
+
----
|
|
82
|
+
|
|
83
|
+
== Usage
|
|
84
|
+
|
|
85
|
+
To use, add a top-level element (`section` in this case) where you enable the `slide` extension. Once the extension has been able, you can then add your view port, progress bar, and actions. Example:
|
|
86
|
+
|
|
87
|
+
[source,html]
|
|
88
|
+
----
|
|
89
|
+
<section class="htmx-slide"
|
|
90
|
+
hx-select-oob="#slide, #progress, #actions"
|
|
91
|
+
hx-swap="transition:true"
|
|
92
|
+
hx-ext="slide">
|
|
93
|
+
|
|
94
|
+
<div class="container">
|
|
95
|
+
<div class="viewport">
|
|
96
|
+
<img id="slide" src="alien.svg" alt="One" class="slide" width="480" height="480">
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
<progress id="progress" class="progress" value="0" max="2"></progress>
|
|
100
|
+
|
|
101
|
+
<div id="actions" class="actions">
|
|
102
|
+
<a href="_three.html"
|
|
103
|
+
class="action"
|
|
104
|
+
data-direction="backward"
|
|
105
|
+
hx-get="_three.html"
|
|
106
|
+
hx-trigger="click, keyup[key=='ArrowLeft'] from:body"
|
|
107
|
+
hx-push_url="true">Previous</a>
|
|
108
|
+
|
|
109
|
+
<span class="status">1 of 3</span>
|
|
110
|
+
|
|
111
|
+
<a href="_two.html"
|
|
112
|
+
class="action"
|
|
113
|
+
data-direction="forward"
|
|
114
|
+
hx-get="_two.html"
|
|
115
|
+
hx-trigger="click, keyup[key=='ArrowRight'] from:body"
|
|
116
|
+
hx-push_url="true">Next</a>
|
|
117
|
+
|
|
118
|
+
<a href="_one.html"
|
|
119
|
+
class="action"
|
|
120
|
+
data-direction="backward"
|
|
121
|
+
hx-get="_one.html"
|
|
122
|
+
hx-trigger="click, keyup[key=='['] from:body"
|
|
123
|
+
hx-push_url="true">First</a>
|
|
124
|
+
|
|
125
|
+
<button data-fullscreen-trigger>[ ]</button>
|
|
126
|
+
|
|
127
|
+
<a href="_three.html"
|
|
128
|
+
class="action"
|
|
129
|
+
data-direction="forward"
|
|
130
|
+
hx-get="_three.html"
|
|
131
|
+
hx-trigger="click, keyup[key==']'] from:body"
|
|
132
|
+
hx-push_url="true">Last</a>
|
|
133
|
+
</div>
|
|
134
|
+
</section>
|
|
135
|
+
----
|
|
136
|
+
|
|
137
|
+
The above is the minimum to load the extension, the initial slide, and link to further slides. Here's the breakdown:
|
|
138
|
+
|
|
139
|
+
* `section` (required): The `section` element provides a semantic way to enable the extension and supply the minimum attributes. You're not limited to the `section` element as any valid HTML element would work for your top level element.
|
|
140
|
+
** `class` (optional): Necessary to style the extension. If you don't want to use the default styles then you can remove along with the associated `style.css`. The `style.css` is compiled from the style sheets located in the `lib/stylesheets` of this project. If you need a detailed breakdown on how CSS View Transitions and key frames work, check out the {htmx_view_transitions_link} article to learn more.
|
|
141
|
+
** `hx-select-oob` (optional): Allows you to define which elements should be selected as out of bounds updates when moving forward and backward through your slides since only the slide, progress, and action elements are the only elements that will change per each slide. The values _must_ be IDs, not classes.
|
|
142
|
+
** `hx-swap` (required): Ensures htmx enables CSS View Transitions properly. If missing, no transitions will fire.
|
|
143
|
+
** `hx-ext` (required): Ensures this extension is enabled.
|
|
144
|
+
* `.container` (required): Ensures the view port, progress bar, and associated actions don't expand the width of your slides.
|
|
145
|
+
* `.viewport` (required): Ensures contents of this element can be toggled via the {fullscreen_api_link}.
|
|
146
|
+
* `#slide` (required): Ensures this can be updated (swapped) out of bounds.
|
|
147
|
+
* `#progresss` (optional): Provides real-time progress. Delete and remove from `hx-select-oob` if not desired.
|
|
148
|
+
* `#actions` (required): Ensure you can navigate to the next, previous, first, and last slide. You can add or remove actions as desired. The above shows what's possible. When using action links, use the following attributes:
|
|
149
|
+
** `.action` (optional): Allows you to style the action if desired.
|
|
150
|
+
** `data-direction` (required): Ensures this extension knows which direction transition the slide depending on direction. Valid values are: `forward` or `backward`.
|
|
151
|
+
** `hx-get` (required): Gets the next slide.
|
|
152
|
+
** `hx-trigger`(required): Triggers the action. Feel free to customize keyboard short behavior as desired.
|
|
153
|
+
** `hx-push_url` (required): Ensures your browser history is always updated so the browser back and forward navigation always works.
|
|
154
|
+
* `data-fullscreen-trigger` (optional): Triggers full screen mode. The value is meant to be empty. If a value is supplied, it'll be ignored. You can, optionally, add a `data-fullscreen-target` with any valid CSS selector in case you want to target a different element for full screen toggle. The default is: `.viewport`.
|
|
155
|
+
|
|
156
|
+
In addition to the above, you can also add the following data attributes and enabling this extension. Example:
|
|
157
|
+
|
|
158
|
+
[source,html]
|
|
159
|
+
----
|
|
160
|
+
<section hx-ext="slide"
|
|
161
|
+
data-slide=".slide"
|
|
162
|
+
data-classes-left="htmx-slide-left"
|
|
163
|
+
data-classes-right="htmx-slide-right"
|
|
164
|
+
data-fullscreen-key="f"
|
|
165
|
+
data-fullscreen-trigger="[data-fullscreen-trigger]">
|
|
166
|
+
----
|
|
167
|
+
|
|
168
|
+
The above shows the default settings which is why you don't need to supply these when enabling this extension. Should the above defaults not be desired, then you can customize as follows:
|
|
169
|
+
|
|
170
|
+
* `data-slide`: Use any valid CSS selector to target a different slide element.
|
|
171
|
+
* `data-classes-left`: The CSS class associated your CSS View Transition and animation for leftward movement.
|
|
172
|
+
* `data-classes-right`: The CSS class associated your CSS View Transition and animation for rightward movement.
|
|
173
|
+
* `data-fullscreen-key`: The fullscreen keyboard shortcut.
|
|
174
|
+
* `data-fullscreen-trigger`: The element which triggers the full screen toggle (usually a button).
|
|
175
|
+
|
|
176
|
+
When building your implementation, the above shows the initial page to render. All subsequent pages only need to be HTML fragments/partials which have the elements shown in the `.container` as those are the only elements that need to change upon each HTTP GET request.
|
|
177
|
+
|
|
178
|
+
== Examples
|
|
179
|
+
|
|
180
|
+
Should you need real-word examples of this extension in production use, check out the following:
|
|
181
|
+
|
|
182
|
+
* link:https://alchemists.io/talks[Alchemists Talks]: A collection of talks (and associated slides) given at past presentations.
|
|
183
|
+
* link:https://alchemists.io/projects/terminus[Terminus]: A Hanami + htmx application for ePaper devices. Each playlist uses this extension for viewing screens rendered on your ePaper devices.
|
|
184
|
+
|
|
185
|
+
== Development
|
|
186
|
+
|
|
187
|
+
To contribute, run:
|
|
188
|
+
|
|
189
|
+
[source,bash]
|
|
190
|
+
----
|
|
191
|
+
git clone https://github.com/bkuhlmann/htmx-slide
|
|
192
|
+
cd htmx-slide
|
|
193
|
+
bin/setup
|
|
194
|
+
----
|
|
195
|
+
|
|
196
|
+
To build, run:
|
|
197
|
+
|
|
198
|
+
[source,bash]
|
|
199
|
+
----
|
|
200
|
+
bin/build
|
|
201
|
+
----
|
|
202
|
+
|
|
203
|
+
To view interactive demonstration, run
|
|
204
|
+
|
|
205
|
+
[source,bash]
|
|
206
|
+
----
|
|
207
|
+
# With default port.
|
|
208
|
+
bin/demo
|
|
209
|
+
|
|
210
|
+
# With custom port.
|
|
211
|
+
bin/demo 9050
|
|
212
|
+
----
|
|
213
|
+
|
|
214
|
+
== Tests
|
|
215
|
+
|
|
216
|
+
To test, run:
|
|
217
|
+
|
|
218
|
+
[source,bash]
|
|
219
|
+
----
|
|
220
|
+
bin/rake
|
|
221
|
+
----
|
|
222
|
+
|
|
223
|
+
== Deployment
|
|
224
|
+
|
|
225
|
+
To deploy, follow these steps:
|
|
226
|
+
|
|
227
|
+
. Ensure link:https://alchemists.io/projects/milestoner[Milestoner] is installed.
|
|
228
|
+
. Ensure you are on the `main` branch.
|
|
229
|
+
. Run the following:
|
|
230
|
+
|
|
231
|
+
[source,bash]
|
|
232
|
+
----
|
|
233
|
+
bin/build
|
|
234
|
+
npm publish
|
|
235
|
+
milestoner --publish
|
|
236
|
+
----
|
|
237
|
+
|
|
238
|
+
== link:https://alchemists.io/policies/license[License]
|
|
239
|
+
|
|
240
|
+
== link:https://alchemists.io/policies/security[Security]
|
|
241
|
+
|
|
242
|
+
== link:https://alchemists.io/policies/code_of_conduct[Code of Conduct]
|
|
243
|
+
|
|
244
|
+
== link:https://alchemists.io/policies/contributions[Contributions]
|
|
245
|
+
|
|
246
|
+
== link:https://alchemists.io/policies/developer_certificate_of_origin[Developer Certificate of Origin]
|
|
247
|
+
|
|
248
|
+
== link:https://alchemists.io/projects/htmx-slide/versions[Versions]
|
|
249
|
+
|
|
250
|
+
== link:https://alchemists.io/community[Community]
|
|
251
|
+
|
|
252
|
+
== Credits
|
|
253
|
+
|
|
254
|
+
* Built with link:https://alchemists.io/projects/rubysmith[Rubysmith].
|
|
255
|
+
* Engineered by link:https://alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import s from"htmx.org";(function(){const f="[hx-ext='slide']",a=i=>{const e=document.querySelector(i);e&&(document.fullscreenElement?document.exitFullscreen&&(document.exitPointerLock(),document.exitFullscreen()):e.requestFullscreen&&(e.requestPointerLock(),e.requestFullscreen()))};s.defineExtension("slide",{init:()=>{const i=r=>{const d=s.find(f);if(!d)return;const l=d.dataset,t=l.fullscreenTrigger||"[data-fullscreen-trigger]",c=s.find(t);if(!c)return;const o=c.dataset.fullscreenTarget||".viewport";if(r.type==="keydown"){const n=l.fullscreenKey||"f";r.key===n&&a(o)}else if(r.type==="click"){const n=r.target;(n.matches(t)||n.closest(t))&&a(o)}},e=document.body;e.addEventListener("click",i),e.addEventListener("keydown",i)},onEvent:(i,e)=>{const r=e.detail.elt;if(i==="htmx:beforeTransition"){const l=s.find(f).dataset,t=s.find(l.slide||".slide");if(!t)return;const c=l.classesLeft||"htmx-slide-left",o=l.classesRight||"htmx-slide-right",n=r.dataset.direction;s.removeClass(t,c),s.removeClass(t,o),n==="forward"?s.addClass(t,c):n==="backward"&&s.addClass(t,o)}}})})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(function(){const d="[hx-ext='slide']",f=n=>{const e=document.querySelector(n);e&&(document.fullscreenElement?document.exitFullscreen&&(document.exitPointerLock(),document.exitFullscreen()):e.requestFullscreen&&(e.requestPointerLock(),e.requestFullscreen()))};htmx.defineExtension("slide",{init:()=>{const n=i=>{const o=htmx.find(d);if(!o)return;const r=o.dataset,t=r.fullscreenTrigger||"[data-fullscreen-trigger]",l=htmx.find(t);if(!l)return;const c=l.dataset.fullscreenTarget||".viewport";if(i.type==="keydown"){const s=r.fullscreenKey||"f";i.key===s&&f(c)}else if(i.type==="click"){const s=i.target;(s.matches(t)||s.closest(t))&&f(c)}},e=document.body;e.addEventListener("click",n),e.addEventListener("keydown",n)},onEvent:(n,e)=>{const i=e.detail.elt;if(n==="htmx:beforeTransition"){const r=htmx.find(d).dataset,t=htmx.find(r.slide||".slide");if(!t)return;const l=r.classesLeft||"htmx-slide-left",c=r.classesRight||"htmx-slide-right",s=i.dataset.direction;htmx.removeClass(t,l),htmx.removeClass(t,c),s==="forward"?htmx.addClass(t,l):s==="backward"&&htmx.addClass(t,c)}}})})();
|
package/build/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@keyframes htmxSlideOutToLeft{0%{transform:translate(0)}to{transform:translate(-100%)}}@keyframes htmxSlideInFromRight{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes htmxSlideOutToRight{0%{transform:translate(0)}to{transform:translate(100%)}}@keyframes htmxSlideInFromLeft{0%{transform:translate(-100%)}to{transform:translate(0)}}@media(prefers-reduced-motion:no-preference){::view-transition-group(htmx-slide-left),::view-transition-group(htmx-slide-right){animation-duration:.8s;border-radius:.5rem;overflow:hidden}::view-transition-new(htmx-slide-left){animation-name:htmxSlideInFromRight}::view-transition-old(htmx-slide-left){animation-name:htmxSlideOutToLeft}::view-transition-new(htmx-slide-right){animation-name:htmxSlideInFromLeft}::view-transition-old(htmx-slide-right){animation-name:htmxSlideOutToRight}}.htmx-slide{align-items:center;display:flex;flex-direction:column;justify-content:center;.container,.viewport{align-items:center;display:flex;flex-direction:column;justify-content:center}.viewport:fullscreen{.slide{border-radius:0;box-shadow:none}}.slide{border-radius:.5rem;box-shadow:.7px .7px .7px #00000006,1.7px 1.7px 1.7px #00000008,3.5px 3.5px 3.5px #0000000a,7.3px 7.3px 7.3px #0000000c,20px 20px 20px #00000012}.progress{width:100%}.status{text-align:center}.actions{display:grid;grid-template:1fr / 1fr 1fr 1fr;width:100%;margin-top:1rem;gap:.5rem;[data-fullscreen-trigger]{background:none;cursor:pointer;display:flex;justify-content:center}[data-direction=forward]{text-align:right}}}.htmx-slide-left{view-transition-name:htmx-slide-left}.htmx-slide-right{view-transition-name:htmx-slide-right}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "htmx-slide",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "A htmx extension for slide show presentations using View Transitions.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "build/htmx-slide.esm.js",
|
|
7
|
+
"style": "build/style.css",
|
|
8
|
+
"files": [
|
|
9
|
+
"build",
|
|
10
|
+
"README.adoc",
|
|
11
|
+
"CITATION.cff",
|
|
12
|
+
"LICENSE.adoc"
|
|
13
|
+
],
|
|
14
|
+
"unpkg": "build/htmx-slide.js",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/bkuhlmann/htmx-slide.git"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"htmx",
|
|
21
|
+
"extension",
|
|
22
|
+
"slide",
|
|
23
|
+
"presentation"
|
|
24
|
+
],
|
|
25
|
+
"author": "Brooke Kuhlmann",
|
|
26
|
+
"license": "Hippocratic-2.1",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/bkuhlmann/htmx-slide/issues"
|
|
29
|
+
},
|
|
30
|
+
"funding": {
|
|
31
|
+
"url": "https://github.com/sponsors/bkuhlmann"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://alchemists.io/projects/htmx-slide",
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@eslint/js": "^10.0.1",
|
|
36
|
+
"esbuild": "^0.27.2",
|
|
37
|
+
"eslint": "^10.4.0",
|
|
38
|
+
"globals": "^17.3.0"
|
|
39
|
+
}
|
|
40
|
+
}
|