-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
374 lines (342 loc) · 16.1 KB
/
Copy pathindex.html
File metadata and controls
374 lines (342 loc) · 16.1 KB
1
2
3
4
5
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
32
33
34
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Sprinkle - high power behaviors for HTML</title>
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="sprinkle.min.css" />
<meta name="sprinkle-svg-path" content="./icons/" />
<style>
.demo-card {
margin-bottom: 2.5rem;
}
.demo-card h3 {
font-size: 1.1rem;
margin: 0 0 0.5rem;
}
.demo-card h3 code {
font-size: 0.85em;
}
.demo-card > p {
color: var(--text-color);
margin-bottom: 1rem;
}
.doc-demo {
padding: 1rem;
border: 1px solid var(--border-color);
border-left: 3px solid var(--accent);
border-radius: 6px;
margin-bottom: 0.75rem;
background: var(--bg-color);
}
.doc-demo select,
.doc-demo button {
vertical-align: middle;
}
.doc-code pre {
margin: 0;
}
.demos-sub {
margin-bottom: 2rem;
}
</style>
</head>
<body>
<header class="top-nav" sticky>
<nav>
<a href="index.html" class="brand"
><span class="bracket">[</span
><span class="bracket">]</span> spr<span class="accent"
>inkle</span
></a
>
<a href="docs.html">Docs</a>
<a href="examples/dashboard.html">Examples</a>
<a href="https://github.com/forge-kernel/sprinkle">GitHub</a>
</nav>
</header>
<div class="hero-banner">
<h1 class="brand-logo">
<span class="bracket">[</span
><span class="bracket">]</span> spr<span class="accent"
>inkle</span
>
</h1>
<p class="tagline">high power behaviors for HTML</p>
<p class="manifesto">
Upgrade native form controls and layout structures with single
attributes.<br />
Zero JavaScript boilerplate. Zero dependencies. No build step
required.
</p>
<a href="#demos" class="cta-link">See what it can do ↓</a>
</div>
<main>
<section id="demos">
<h2>See what Sprinkle can do</h2>
<p class="lead demos-sub">
These are live, interactive components. Every one started as
a native HTML element — then gained behavior through a
single attribute. No JavaScript written, no build step.
</p>
<!-- Demo 1: combo-box -->
<div class="demo-card">
<h3>Searchable Select — <code>combo-box</code></h3>
<p>
A native <code><select></code> becomes a
searchable combobox with option categories and
multi-select pills.
</p>
<div class="doc-demo">
<select name="framework" combo-box searchable>
<option value="">Select a framework…</option>
<option value="react" category="Frontend">
React
</option>
<option value="vue" category="Frontend">Vue</option>
<option value="angular" category="Frontend">
Angular
</option>
<option value="laravel" category="Backend">
Laravel
</option>
<option value="django" category="Backend">
Django
</option>
<option value="rails" category="Backend">
Ruby on Rails
</option>
<option value="postgres" category="Database">
PostgreSQL
</option>
<option value="mysql" category="Database">
MySQL
</option>
<option value="mongo" category="Database">
MongoDB
</option>
</select>
<select name="tags[]" multiple combo-box searchable>
<option value="" disabled>
Select technologies…
</option>
<option value="php">PHP</option>
<option value="js" selected>JavaScript</option>
<option value="css" selected>CSS</option>
<option value="html">HTML</option>
<option value="python">Python</option>
</select>
</div>
<div class="doc-code">
<pre><code><select name="framework" combo-box searchable>
<option value="react" category="Frontend">React</option>
<option value="vue" category="Frontend">Vue</option>
<option value="laravel" category="Backend">Laravel</option>
&hellip;
</select>
<select name="tags[]" multiple combo-box searchable>
<option value="js" selected>JavaScript</option>
<option value="css" selected>CSS</option>
&hellip;
</select></code></pre>
</div>
</div>
<!-- Demo 2: drop-zone -->
<div class="demo-card">
<h3>File Upload Zone — <code>drop-zone</code></h3>
<p>
A <code><label></code> wrapping a file input
becomes a drag-and-drop upload area with image preview
and file removal.
</p>
<div class="doc-demo">
<label drop-zone>
<span>Drop an image here or click to browse</span>
<input
type="file"
name="image"
accept="image/*"
multiple
/>
</label>
</div>
<div class="doc-code">
<pre><code><label drop-zone>
<span>Drop an image here or click to browse</span>
<input type="file" name="image" accept="image/*" multiple />
</label></code></pre>
</div>
</div>
<!-- Demo 3: drawer + modal -->
<div class="demo-card">
<h3>
Dialogs & Drawers — <code>drawer</code> +
<code>modal</code>
</h3>
<p>
Slide-in drawers and centered modals using the native
<code><dialog></code> element — no
<code>showModal()</code> calls, just
<code>command-for</code> attributes.
</p>
<div class="doc-demo">
<button command-for="demo-drawer" command="show-modal">
Open Drawer
</button>
<dialog drawer="left" close-outside id="demo-drawer">
<div class="sprinkle-modal-header">
Menu
<button
class="sprinkle-modal-close"
command-for="demo-drawer"
command="close"
>
×
</button>
</div>
<div class="sprinkle-modal-body">
<ul nav>
<li><a href="#">Dashboard</a></li>
<li><a href="#">Projects</a></li>
<li><a href="#">Settings</a></li>
</ul>
<hr />
<button
command-for="demo-modal"
command="show-modal"
>
Show Confirmation
</button>
</div>
</dialog>
<dialog modal close-outside id="demo-modal">
<div class="sprinkle-modal-header">
Confirm
<button
class="sprinkle-modal-close"
command-for="demo-modal"
command="close"
>
×
</button>
</div>
<div class="sprinkle-modal-body">
Are you sure you want to proceed?
</div>
<div class="sprinkle-modal-footer">
<button
command-for="demo-modal"
command="close"
>
Cancel
</button>
<button>Confirm</button>
</div>
</dialog>
</div>
<div class="doc-code">
<pre><code><dialog drawer="left" close-outside id="nav">
&hellip; menu content &hellip;
</dialog>
<dialog modal close-outside id="confirm">
&hellip; confirmation content &hellip;
</dialog>
<button command-for="nav" command="show-modal">Open</button>
<button command-for="confirm" command="show-modal">Confirm</button></code></pre>
</div>
</div>
</section>
<section id="introduction">
<h2>How it works</h2>
<p>
<strong>Sprinkle</strong> provides a set of HTML attributes
that map directly to small pieces of behavior or styling. It
focuses on adding UX polish — like tooltips,
dropdowns, modals, and character counters — without
requiring a heavy JavaScript framework, build steps, or
external dependencies.
</p>
<p>
Every directive works gracefully, degrading to native
elements if JavaScript is disabled. It is designed to
progressively enhance your already-existing HTML.
</p>
</section>
<section id="motivation">
<h2>Motivation</h2>
<p>
Modern web development often jumps straight to heavy UI
component libraries or full JavaScript frameworks for simple
interactive features. Sprinkle takes a different approach:
</p>
<ul>
<li>
<strong>HTML-first:</strong> You write the markup and
styles, we provide the enhancement layer.
</li>
<li>
<strong>CSS handles the rest:</strong> Everything that
can be handled purely by CSS (avatars, breadcrumbs,
modals, dropdown layouts) is handled by CSS.
</li>
<li>
<strong>Minimal footprint:</strong> Only ~47KB minified
for both CSS and JS.
</li>
<li>
<strong>No build steps:</strong> Just include a
<code><script defer></code> before your
<code></body></code> and a
<code><link></code> in your
<code></head></code>.
</li>
</ul>
<p>
This is <em>not</em> a UI component library, not a
replacement for HTML, and not a polyfill. It relies on
modern browser APIs like <code>MutationObserver</code>,
<code>IntersectionObserver</code>,
<code><dialog></code>, and
<code>CSS @starting-style</code>.
</p>
</section>
<section id="quick-start">
<h2>Quick Start</h2>
<p>To use Sprinkle, simply add the CSS and JS to your page:</p>
<pre><code><span class="comment"><!-- In your <head> --></span>
<span class="tag"><link</span> <span class="attr-name">rel=</span><span class="attr-value">"stylesheet"</span> <span class="attr-name">href=</span><span class="attr-value">"path/to/sprinkle.css"</span><span class="tag">></span>
<span class="comment"><!-- Before your </body> --></span>
<span class="tag"><script</span> <span class="attr-name">src=</span><span class="attr-value">"path/to/sprinkle.js"</span> <span class="attr-name">defer</span><span class="tag">></script></span></code></pre>
<p>
Once included, you can start using directives directly in
your HTML:
</p>
<pre><code><span class="comment"><!-- A tooltip --></span>
<span class="tag"><button</span> <span class="attr-name">tooltip=</span><span class="attr-value">"This cannot be undone"</span><span class="tag">></span>Delete<span class="tag"></button></span>
<span class="comment"><!-- A copy button --></span>
<span class="tag"><button</span> <span class="attr-name">copy=</span><span class="attr-value">"#email"</span><span class="tag">></span>Copy Email<span class="tag"></button></span>
<span class="tag"><span</span> <span class="attr-name">id=</span><span class="attr-value">"email"</span><span class="tag">></span>hello@example.com<span class="tag"></span></span>
<span class="comment"><!-- An auto-growing textarea --></span>
<span class="tag"><textarea</span> <span class="attr-name">autosize</span><span class="tag">></textarea></span></code></pre>
<p>
Check out the <a href="docs.html">documentation</a> to see
all available directives, or browse the
<a href="examples/dashboard.html">examples</a> for
real-world usage.
</p>
</section>
</main>
<footer>
<p>
Sprinkle is a free and open-source library released under the
<a
href="https://github.com/forge-kernel/sprinkle/blob/main/LICENSE"
>MIT License</a
>.
</p>
<p>Enhancing HTML, simply.</p>
</footer>
<script src="./sprinkle.min.js" defer></script>
</body>
</html>