@grafctory/clay-widgets 0.0.0-stage → 0.4.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/LICENSE +201 -0
- package/README.md +46 -2
- package/dist/content/empty.css +107 -0
- package/dist/content/empty.d.ts +40 -0
- package/dist/content/empty.d.ts.map +1 -0
- package/dist/content/empty.js +42 -0
- package/dist/content/empty.js.map +1 -0
- package/dist/content/heading.css +34 -0
- package/dist/content/heading.d.ts +45 -0
- package/dist/content/heading.d.ts.map +1 -0
- package/dist/content/heading.js +49 -0
- package/dist/content/heading.js.map +1 -0
- package/dist/content/image.css +176 -0
- package/dist/content/image.d.ts +71 -0
- package/dist/content/image.d.ts.map +1 -0
- package/dist/content/image.js +63 -0
- package/dist/content/image.js.map +1 -0
- package/dist/content/infobox.css +186 -0
- package/dist/content/infobox.d.ts +72 -0
- package/dist/content/infobox.d.ts.map +1 -0
- package/dist/content/infobox.js +63 -0
- package/dist/content/infobox.js.map +1 -0
- package/dist/content/pill.css +76 -0
- package/dist/content/pill.d.ts +57 -0
- package/dist/content/pill.d.ts.map +1 -0
- package/dist/content/pill.js +48 -0
- package/dist/content/pill.js.map +1 -0
- package/dist/content/text.css +44 -0
- package/dist/content/text.d.ts +30 -0
- package/dist/content/text.d.ts.map +1 -0
- package/dist/content/text.js +42 -0
- package/dist/content/text.js.map +1 -0
- package/dist/controls/button.css +469 -0
- package/dist/controls/button.d.ts +116 -0
- package/dist/controls/button.d.ts.map +1 -0
- package/dist/controls/button.js +61 -0
- package/dist/controls/button.js.map +1 -0
- package/dist/controls/checkbox.css +23 -0
- package/dist/controls/checkbox.d.ts +54 -0
- package/dist/controls/checkbox.d.ts.map +1 -0
- package/dist/controls/checkbox.js +49 -0
- package/dist/controls/checkbox.js.map +1 -0
- package/dist/controls/choice.css +288 -0
- package/dist/controls/choice.d.ts +63 -0
- package/dist/controls/choice.d.ts.map +1 -0
- package/dist/controls/choice.js +52 -0
- package/dist/controls/choice.js.map +1 -0
- package/dist/controls/fieldset.css +37 -0
- package/dist/controls/fieldset.d.ts +49 -0
- package/dist/controls/fieldset.d.ts.map +1 -0
- package/dist/controls/fieldset.js +51 -0
- package/dist/controls/fieldset.js.map +1 -0
- package/dist/controls/form.css +50 -0
- package/dist/controls/form.d.ts +64 -0
- package/dist/controls/form.d.ts.map +1 -0
- package/dist/controls/form.js +62 -0
- package/dist/controls/form.js.map +1 -0
- package/dist/controls/input.css +57 -0
- package/dist/controls/input.d.ts +120 -0
- package/dist/controls/input.d.ts.map +1 -0
- package/dist/controls/input.js +78 -0
- package/dist/controls/input.js.map +1 -0
- package/dist/controls/label.css +73 -0
- package/dist/controls/label.d.ts +76 -0
- package/dist/controls/label.d.ts.map +1 -0
- package/dist/controls/label.js +73 -0
- package/dist/controls/label.js.map +1 -0
- package/dist/controls/radio.css +23 -0
- package/dist/controls/radio.d.ts +60 -0
- package/dist/controls/radio.d.ts.map +1 -0
- package/dist/controls/radio.js +50 -0
- package/dist/controls/radio.js.map +1 -0
- package/dist/controls/select.css +37 -0
- package/dist/controls/select.d.ts +62 -0
- package/dist/controls/select.d.ts.map +1 -0
- package/dist/controls/select.js +59 -0
- package/dist/controls/select.js.map +1 -0
- package/dist/controls/switch.css +154 -0
- package/dist/controls/switch.d.ts +44 -0
- package/dist/controls/switch.d.ts.map +1 -0
- package/dist/controls/switch.js +48 -0
- package/dist/controls/switch.js.map +1 -0
- package/dist/controls/textarea.css +50 -0
- package/dist/controls/textarea.d.ts +97 -0
- package/dist/controls/textarea.d.ts.map +1 -0
- package/dist/controls/textarea.js +75 -0
- package/dist/controls/textarea.js.map +1 -0
- package/dist/glyphs/icon.core.d.ts +52 -0
- package/dist/glyphs/icon.core.d.ts.map +1 -0
- package/dist/glyphs/icon.core.js +67 -0
- package/dist/glyphs/icon.core.js.map +1 -0
- package/dist/glyphs/icon.css +32 -0
- package/dist/glyphs/icon.d.ts +152 -0
- package/dist/glyphs/icon.d.ts.map +1 -0
- package/dist/glyphs/icon.js +167 -0
- package/dist/glyphs/icon.js.map +1 -0
- package/dist/glyphs/icon.md +76 -0
- package/dist/glyphs/logo.css +73 -0
- package/dist/glyphs/logo.d.ts +27 -0
- package/dist/glyphs/logo.d.ts.map +1 -0
- package/dist/glyphs/logo.js +49 -0
- package/dist/glyphs/logo.js.map +1 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +95 -0
- package/dist/index.js.map +1 -0
- package/dist/layouts/card.css +166 -0
- package/dist/layouts/card.d.ts +69 -0
- package/dist/layouts/card.d.ts.map +1 -0
- package/dist/layouts/card.js +57 -0
- package/dist/layouts/card.js.map +1 -0
- package/dist/layouts/stack.css +58 -0
- package/dist/layouts/stack.d.ts +64 -0
- package/dist/layouts/stack.d.ts.map +1 -0
- package/dist/layouts/stack.js +69 -0
- package/dist/layouts/stack.js.map +1 -0
- package/dist/layouts/strip.css +58 -0
- package/dist/layouts/strip.d.ts +72 -0
- package/dist/layouts/strip.d.ts.map +1 -0
- package/dist/layouts/strip.js +73 -0
- package/dist/layouts/strip.js.map +1 -0
- package/dist/layouts/tabs.core.d.ts +73 -0
- package/dist/layouts/tabs.core.d.ts.map +1 -0
- package/dist/layouts/tabs.core.js +65 -0
- package/dist/layouts/tabs.core.js.map +1 -0
- package/dist/layouts/tabs.css +260 -0
- package/dist/layouts/tabs.d.ts +57 -0
- package/dist/layouts/tabs.d.ts.map +1 -0
- package/dist/layouts/tabs.js +128 -0
- package/dist/layouts/tabs.js.map +1 -0
- package/dist/layouts/tree.css +138 -0
- package/dist/layouts/tree.d.ts +46 -0
- package/dist/layouts/tree.d.ts.map +1 -0
- package/dist/layouts/tree.js +69 -0
- package/dist/layouts/tree.js.map +1 -0
- package/dist/navigation/link.css +229 -0
- package/dist/navigation/link.d.ts +89 -0
- package/dist/navigation/link.d.ts.map +1 -0
- package/dist/navigation/link.js +91 -0
- package/dist/navigation/link.js.map +1 -0
- package/dist/navigation/path.css +122 -0
- package/dist/navigation/path.d.ts +42 -0
- package/dist/navigation/path.d.ts.map +1 -0
- package/dist/navigation/path.js +49 -0
- package/dist/navigation/path.js.map +1 -0
- package/dist/navigation/toc.core.d.ts +111 -0
- package/dist/navigation/toc.core.d.ts.map +1 -0
- package/dist/navigation/toc.core.js +60 -0
- package/dist/navigation/toc.core.js.map +1 -0
- package/dist/navigation/toc.css +53 -0
- package/dist/navigation/toc.d.ts +112 -0
- package/dist/navigation/toc.d.ts.map +1 -0
- package/dist/navigation/toc.js +321 -0
- package/dist/navigation/toc.js.map +1 -0
- package/dist/scopes/guard.css +26 -0
- package/dist/scopes/guard.d.ts +37 -0
- package/dist/scopes/guard.d.ts.map +1 -0
- package/dist/scopes/guard.js +60 -0
- package/dist/scopes/guard.js.map +1 -0
- package/dist/scopes/style.css +26 -0
- package/dist/scopes/style.d.ts +68 -0
- package/dist/scopes/style.d.ts.map +1 -0
- package/dist/scopes/style.js +108 -0
- package/dist/scopes/style.js.map +1 -0
- package/dist/shells/tool.css +778 -0
- package/dist/shells/tool.d.ts +164 -0
- package/dist/shells/tool.d.ts.map +1 -0
- package/dist/shells/tool.js +251 -0
- package/dist/shells/tool.js.map +1 -0
- package/dist/signals/more.css +42 -0
- package/dist/signals/more.d.ts +28 -0
- package/dist/signals/more.d.ts.map +1 -0
- package/dist/signals/more.js +61 -0
- package/dist/signals/more.js.map +1 -0
- package/dist/signals/note.css +221 -0
- package/dist/signals/note.d.ts +83 -0
- package/dist/signals/note.d.ts.map +1 -0
- package/dist/signals/note.js +72 -0
- package/dist/signals/note.js.map +1 -0
- package/dist/signals/toasts.css +463 -0
- package/dist/signals/toasts.d.ts +68 -0
- package/dist/signals/toasts.d.ts.map +1 -0
- package/dist/signals/toasts.js +160 -0
- package/dist/signals/toasts.js.map +1 -0
- package/package.json +331 -4
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2026 Metreeca srl
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Role-named glyphs.
|
|
18
|
+
*
|
|
19
|
+
* Provides the glyph a control is marked with under the name of the role it stands for: a screen asks for
|
|
20
|
+
* `Icon.Create` rather than for a plus sign, so retuning what a role looks like across an interface is a change to
|
|
21
|
+
* this module alone. The whole Lucide catalogue hangs off the same namespace, for a glyph no role covers:
|
|
22
|
+
* `<Icon.Rocket/>` costs a bundle no more than a direct import does, while a member picked at run time, `Icon[name]`,
|
|
23
|
+
* takes every glyph Lucide draws along with it.
|
|
24
|
+
*
|
|
25
|
+
* > [!NOTE]
|
|
26
|
+
* >
|
|
27
|
+
* > Glyphs are provided by Lucide under the ISC and MIT licences. Redistribution, including within a bundled
|
|
28
|
+
* > application, must preserve the copyright and permission notices reproduced in [Notices](./icon.md).
|
|
29
|
+
*
|
|
30
|
+
* An icon is hidden from assistive technology unless given a `role`, a `title` or an `aria-*` attribute: the control
|
|
31
|
+
* it marks carries the accessible name, and a glyph read out beside it would only name the control a second time.
|
|
32
|
+
*
|
|
33
|
+
* > [!IMPORTANT]
|
|
34
|
+
* >
|
|
35
|
+
* > An icon standing on its own, with no label beside it, states the accessible name itself, which is also what
|
|
36
|
+
* > brings it into the accessibility tree:
|
|
37
|
+
* >
|
|
38
|
+
* > ```tsx
|
|
39
|
+
* > <button onClick={close}><Icon.Close aria-label="Close"/></button>
|
|
40
|
+
* > ```
|
|
41
|
+
*
|
|
42
|
+
* **Standard Glyphs**
|
|
43
|
+
*
|
|
44
|
+
* Import the namespace once, then mark a control with any glyph Lucide draws, under the name Lucide gives it.
|
|
45
|
+
*
|
|
46
|
+
* ```tsx
|
|
47
|
+
* import { Icon } from "@grafctory/clay-widgets/icon";
|
|
48
|
+
*
|
|
49
|
+
* <button onClick={launch}><Icon.Rocket/> Deploy</button>
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* **Role Glyphs**
|
|
53
|
+
*
|
|
54
|
+
* Alongside them, the namespace carries role names, standing for what a control does rather than for what it draws.
|
|
55
|
+
* A control takes the role that matches its action, not the glyph that looks right: every control creating an item
|
|
56
|
+
* takes `Create`, wherever it appears, so one screen never says with a plus what another says with a pencil, and
|
|
57
|
+
* repointing a role at a different glyph restyles all of them at once. An action no role covers takes a standard
|
|
58
|
+
* glyph until a role is added for it, and then switches to that role along with every other control sharing it.
|
|
59
|
+
*
|
|
60
|
+
* ```tsx
|
|
61
|
+
* <button onClick={create}><Icon.Create/> New Item</button> // creating, wherever it appears
|
|
62
|
+
* <button onClick={insert}><Icon.Insert/> Add Member</button> // adding to a set, a role of its own
|
|
63
|
+
* <button onClick={launch}><Icon.Rocket/> Deploy</button> // no role covers deploying, yet
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* The roles on offer, under the area each one belongs to:
|
|
67
|
+
*
|
|
68
|
+
* | Role | Meaning |
|
|
69
|
+
* |------------------|--------------------------------------------------------------|
|
|
70
|
+
* | **Session** | who the reader is to the app |
|
|
71
|
+
* | `LogIn` | opens a session |
|
|
72
|
+
* | `LogOut` | ends the current one |
|
|
73
|
+
* | **Navigation** | where a control leads |
|
|
74
|
+
* | `Link` | marks an address, whether it leads inside the app or out |
|
|
75
|
+
* | `Open` | steps into an item |
|
|
76
|
+
* | `Back` | returns to the step before |
|
|
77
|
+
* | **Disclosure** | how much of a tree or a section is on show |
|
|
78
|
+
* | `Expand` | reveals the entries nested under an item, as in a tree |
|
|
79
|
+
* | `Collapse` | hides them again |
|
|
80
|
+
* | `Unfold` | reveals the content folded away below a control, in place |
|
|
81
|
+
* | `Fold` | folds it back |
|
|
82
|
+
* | `UnfoldAll` | reveals all the content folded away in a list or table |
|
|
83
|
+
* | `FoldAll` | folds it all back |
|
|
84
|
+
* | **Search** | narrowing what is on show |
|
|
85
|
+
* | `Search` | submits a query, or opens the field it is typed in |
|
|
86
|
+
* | `Clear` | empties that field |
|
|
87
|
+
* | `Reset` | withdraws every criterion the reader set to narrow a list |
|
|
88
|
+
* | `Options` | marks a facet narrowing by the values the reader picks |
|
|
89
|
+
* | **Ordering** | the sequence entries are shown in |
|
|
90
|
+
* | `Sort` | offers an order the reader has yet to choose |
|
|
91
|
+
* | `Increasing` | states the order in force, smallest first |
|
|
92
|
+
* | `Decreasing` | states it the other way about |
|
|
93
|
+
* | **Collections** | what a set holds |
|
|
94
|
+
* | `Insert` | adds an entry to a collection |
|
|
95
|
+
* | `Remove` | takes one out again |
|
|
96
|
+
* | **Records** | the life of a single item |
|
|
97
|
+
* | `Create` | brings a new item into being |
|
|
98
|
+
* | `Update` | edits the item on show |
|
|
99
|
+
* | `Save` | writes the edits back |
|
|
100
|
+
* | `Delete` | destroys it |
|
|
101
|
+
* | `Reload` | retrieves it again, after a failure or a change |
|
|
102
|
+
* | **Confirmation** | what becomes of what was entered |
|
|
103
|
+
* | `Accept` | commits it |
|
|
104
|
+
* | `Cancel` | abandons it, leaving things as they stood |
|
|
105
|
+
* | `Close` | dismisses what is on show, deciding nothing |
|
|
106
|
+
* | `Dismiss` | sets aside a notice or a failure, returning to the screen |
|
|
107
|
+
* | **Items** | acting on a single entry |
|
|
108
|
+
* | `Grip` | moves an entry, dragged or pressed for the moves open to it |
|
|
109
|
+
* | `More` | opens the actions an entry offers |
|
|
110
|
+
* | **Modes** | entering and leaving a way of working |
|
|
111
|
+
* | `Menu` | opens what a screen keeps out of the way until asked |
|
|
112
|
+
* | `Done` | leaves a mode, whatever it was entered for |
|
|
113
|
+
* | **Progress** | what the app is still working on |
|
|
114
|
+
* | `Busy` | stands while the app works on what the reader asked for |
|
|
115
|
+
* | **Notices** | what the app has to say unprompted |
|
|
116
|
+
* | `About` | tells the reader about the app itself |
|
|
117
|
+
* | `Info` | carries an aside the reader may skip |
|
|
118
|
+
* | `Alert` | warns of a consequence worth weighing first |
|
|
119
|
+
* | `Help` | offers guidance on the task at hand |
|
|
120
|
+
* | **Failures** | why what was asked for did not come back |
|
|
121
|
+
* | `Unauthorized` | stands where the reader has yet to identify themselves |
|
|
122
|
+
* | `Forbidden` | stands where they have, and are still not allowed in |
|
|
123
|
+
* | `NotFound` | stands where what was asked for does not exist |
|
|
124
|
+
* | `Gone` | stands where it existed and has since been withdrawn |
|
|
125
|
+
* | `Error` | stands where the server failed to answer at all |
|
|
126
|
+
*
|
|
127
|
+
* **Styling**
|
|
128
|
+
*
|
|
129
|
+
* A glyph is drawn at `--skin--scaling-100`, in the colour of the text around it and at `--skin--stroke-width`, so a
|
|
130
|
+
* control restyles its icon by restyling itself and a theme carries every icon along; the `size` prop plays no part,
|
|
131
|
+
* the stylesheet overriding it. A one-off takes a `class`, which Lucide merges into the `lucide lucide-<name>` list
|
|
132
|
+
* it already carries, or a `style`, which lands on the element and outranks both the stylesheet and the attributes
|
|
133
|
+
* Lucide sets:
|
|
134
|
+
*
|
|
135
|
+
* ```tsx
|
|
136
|
+
* <button style={{ fontSize: "1.5em" }}><Icon.Rocket/> Deploy</button> // the glyph follows the label
|
|
137
|
+
* <Icon.Alert class="urgent"/> // joins `lucide lucide-triangle-alert`
|
|
138
|
+
* <Icon.Sort style={{ strokeWidth: 1.5 }}/> // overrides the stroke-width attribute
|
|
139
|
+
* ```
|
|
140
|
+
*
|
|
141
|
+
* From a stylesheet, a glyph is reached either through a class of its own or through the ones Lucide writes, `lucide`
|
|
142
|
+
* on every glyph and `lucide-<name>` on each, and takes its measures from the design system rather than from
|
|
143
|
+
* literals. The rule sizing an icon is unlayered at a single class of specificity, so a consumer rule wins by naming
|
|
144
|
+
* an ancestor, whatever order the two sheets are emitted in:
|
|
145
|
+
*
|
|
146
|
+
* ```css
|
|
147
|
+
* .urgent {
|
|
148
|
+
* color: var(--skin--color-fail);
|
|
149
|
+
* }
|
|
150
|
+
*
|
|
151
|
+
* clay-toolbar .lucide {
|
|
152
|
+
* width: var(--skin--scaling-150);
|
|
153
|
+
* height: var(--skin--scaling-150);
|
|
154
|
+
* stroke-width: var(--skin--stroke-width);
|
|
155
|
+
* }
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* @document ./icon.md
|
|
159
|
+
*
|
|
160
|
+
* @see {@link https://lucide.dev/icons/ Lucide: icon catalogue}
|
|
161
|
+
* @see {@link https://lucide.dev/license Lucide: licence}
|
|
162
|
+
*
|
|
163
|
+
* @module icon
|
|
164
|
+
*/
|
|
165
|
+
import "./icon.css";
|
|
166
|
+
export * as Icon from "./icon.core.js";
|
|
167
|
+
//# sourceMappingURL=icon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.js","sourceRoot":"","sources":["../../src/glyphs/icon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoJG;AAEH,OAAO,YAAY,CAAC;AAGpB,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Notices
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
The glyphs handed out by the `icon` module are drawn by [Lucide](https://lucide.dev/), which carries two licences: ISC
|
|
6
|
+
for Lucide itself, and MIT for the icons it derives from [Feather](https://feathericons.com/). Both notices are
|
|
7
|
+
reproduced below, as Lucide ships them.
|
|
8
|
+
|
|
9
|
+
An application distributing a build that includes any glyph carries both notices with it. A bundle does not carry them
|
|
10
|
+
on its own: the `@license` banners in the `lucide-preact` sources survive an unminified build, but not the minifier this
|
|
11
|
+
repository's toolchain runs by default, and an `esbuild.legalComments` setting does not bring them back under Vite 8.
|
|
12
|
+
Copy the text below into a `NOTICE` or `THIRD-PARTY` file shipped beside the application, or configure the bundler to
|
|
13
|
+
keep legal comments and verify the built file actually contains them.
|
|
14
|
+
|
|
15
|
+
# Lucide
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
ISC License
|
|
19
|
+
|
|
20
|
+
Copyright (c) 2026 Lucide Icons and Contributors
|
|
21
|
+
|
|
22
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
23
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
24
|
+
copyright notice and this permission notice appear in all copies.
|
|
25
|
+
|
|
26
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
27
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
28
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
29
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
30
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
31
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
32
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
# Feather
|
|
36
|
+
|
|
37
|
+
The following Lucide icons are derived from the Feather project:
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
airplay, alert-circle, alert-octagon, alert-triangle, aperture, arrow-down-circle, arrow-down-left,
|
|
41
|
+
arrow-down-right, arrow-down, arrow-left-circle, arrow-left, arrow-right-circle, arrow-right, arrow-up-circle,
|
|
42
|
+
arrow-up-left, arrow-up-right, arrow-up, at-sign, calendar, cast, check, chevron-down, chevron-left,
|
|
43
|
+
chevron-right, chevron-up, chevrons-down, chevrons-left, chevrons-right, chevrons-up, circle, clipboard, clock,
|
|
44
|
+
code, columns, command, compass, corner-down-left, corner-down-right, corner-left-down, corner-left-up,
|
|
45
|
+
corner-right-down, corner-right-up, corner-up-left, corner-up-right, crosshair, database, divide-circle,
|
|
46
|
+
divide-square, dollar-sign, download, external-link, feather, frown, hash, headphones, help-circle, info, italic,
|
|
47
|
+
key, layout, life-buoy, link-2, link, loader, lock, log-in, log-out, maximize, meh, minimize, minimize-2,
|
|
48
|
+
minus-circle, minus-square, minus, monitor, moon, more-horizontal, more-vertical, move, music, navigation-2,
|
|
49
|
+
navigation, octagon, pause-circle, percent, plus-circle, plus-square, plus, power, radio, rss, search, server,
|
|
50
|
+
share, shopping-bag, sidebar, smartphone, smile, square, table-2, tablet, target, terminal, trash-2, trash,
|
|
51
|
+
triangle, tv, type, upload, x-circle, x-octagon, x-square, x, zoom-in, zoom-out
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
The MIT License (MIT) (for the icons listed above)
|
|
56
|
+
|
|
57
|
+
Copyright (c) 2013-present Cole Bemis
|
|
58
|
+
|
|
59
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
60
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
61
|
+
in the Software without restriction, including without limitation the rights
|
|
62
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
63
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
64
|
+
furnished to do so, subject to the following conditions:
|
|
65
|
+
|
|
66
|
+
The above copyright notice and this permission notice shall be included in all
|
|
67
|
+
copies or substantial portions of the Software.
|
|
68
|
+
|
|
69
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
70
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
71
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
72
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
73
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
74
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
75
|
+
SOFTWARE.
|
|
76
|
+
```
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2026 Metreeca srl
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/*
|
|
18
|
+
* A logo rides with the text it sits in, so a heading or a toolbar carrying one needs no measure of its own. The mark
|
|
19
|
+
* is fitted to a square box, which takes an image of any proportions without cropping it.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
* The side of the square the mark is fitted to. It is registered without a type, so `cap` is read off the face where
|
|
24
|
+
* the mark is drawn rather than where the value is stated: a logo in a heading is measured against the capitals of the
|
|
25
|
+
* heading, and one in a footer against those of the footer, from the one registration.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
@property --clay-logo-mark {
|
|
29
|
+
syntax: "*";
|
|
30
|
+
inherits: true;
|
|
31
|
+
initial-value: calc(1.5 * 1cap);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
clay-logo {
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
* The logo is a box exactly as tall as its mark, so a row centring its items centres the mark on the text beside
|
|
38
|
+
* it. In running text the box is raised to the same place, the middle of the capitals, and is short enough to sit
|
|
39
|
+
* within the line rather than pushing the lines above and below it apart, whatever the text size.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
display: inline-block;
|
|
43
|
+
vertical-align: calc(0.5cap - 0.5 * var(--clay-logo-mark));
|
|
44
|
+
|
|
45
|
+
/*
|
|
46
|
+
* The mark is a square measured against the capitals beside it. `cap` is read off the face in use, so an app
|
|
47
|
+
* changing its face carries the logo along rather than needing a figure retuned.
|
|
48
|
+
*
|
|
49
|
+
* It is set larger than the capitals rather than level with them. Matching them exactly reads as smaller: a
|
|
50
|
+
* mark is drawn open, with its weight spread over the whole square and gaps through it, while a letter is a
|
|
51
|
+
* solid stroke, so equal heights leave the mark looking the lighter of the two. The factor is optical
|
|
52
|
+
* compensation, below any ladder and answering to the eye rather than to a measure.
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
& > img {
|
|
56
|
+
|
|
57
|
+
display: block; /* The box takes the height of the mark alone, with no line around it. */
|
|
58
|
+
|
|
59
|
+
height: var(--clay-logo-mark);
|
|
60
|
+
aspect-ratio: 1;
|
|
61
|
+
|
|
62
|
+
object-fit: contain; /* The square takes an image of any proportions without cropping it. */
|
|
63
|
+
|
|
64
|
+
/*
|
|
65
|
+
* The mark is never enlarged as an image in the text is, nor shows the cursor offering it: a click and the
|
|
66
|
+
* pointer land on whatever holds the logo instead, so a logo inside a link still follows it.
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
pointer-events: none;
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import "./logo.css";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a logo.
|
|
4
|
+
*
|
|
5
|
+
* Shows the app icon as a square measured against the capitals beside it and level with the text, whether it stands
|
|
6
|
+
* in a row centring its items or in running text. A heading, a toolbar or a footer thus carries the mark
|
|
7
|
+
* without a measure of its own, and the mark reads as part of the line rather than as something dropped into it. The
|
|
8
|
+
* mark is fitted to that square whatever its proportions, so a wide or a tall one is shown whole rather than cropped.
|
|
9
|
+
*
|
|
10
|
+
* A document stating no icon leaves nothing behind, so a screen closes up rather than holding a gap for the mark.
|
|
11
|
+
*
|
|
12
|
+
* The mark is left out of the accessibility tree unless `name` states what it stands for, so a logo standing beside
|
|
13
|
+
* the app name is read once. It survives a forced colour scheme and a printed page, where a background image would be
|
|
14
|
+
* dropped.
|
|
15
|
+
*
|
|
16
|
+
* @param options The widget configuration
|
|
17
|
+
*
|
|
18
|
+
* @returns The logo, or nothing where the document states no icon
|
|
19
|
+
*/
|
|
20
|
+
export declare function Logo({ name }: {
|
|
21
|
+
/**
|
|
22
|
+
* The accessible name of the mark, required where nothing beside the logo names the app; decorative if omitted or
|
|
23
|
+
* empty, as it is wherever the app name is already on show beside it.
|
|
24
|
+
*/
|
|
25
|
+
name?: string;
|
|
26
|
+
}): import("@grafctory/core").Optional<import("preact").VNode<import("preact").ClassAttributes<HTMLElement> & import("preact").HTMLAttributes<EventTarget> & import("preact").SVGAttributes<SVGElement>>>;
|
|
27
|
+
//# sourceMappingURL=logo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logo.d.ts","sourceRoot":"","sources":["../../src/glyphs/logo.tsx"],"names":[],"mappings":"AA2BA,OAAO,YAAY,CAAC;AAGpB;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,IAAI,CAAC,EAEpB,IAAI,EAEJ,EAAE;IAEF;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CAEb,yMAMA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx } from "preact/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright © 2026 Metreeca srl
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* App mark.
|
|
19
|
+
*
|
|
20
|
+
* Offers the mark an app is recognised by, taken from its own document, so a screen carries it without being handed it.
|
|
21
|
+
*
|
|
22
|
+
* @module logo
|
|
23
|
+
*/
|
|
24
|
+
import { app } from "@grafctory/clay";
|
|
25
|
+
import { opt } from "@grafctory/core";
|
|
26
|
+
import { createElement } from "preact";
|
|
27
|
+
import "./logo.css";
|
|
28
|
+
/**
|
|
29
|
+
* Creates a logo.
|
|
30
|
+
*
|
|
31
|
+
* Shows the app icon as a square measured against the capitals beside it and level with the text, whether it stands
|
|
32
|
+
* in a row centring its items or in running text. A heading, a toolbar or a footer thus carries the mark
|
|
33
|
+
* without a measure of its own, and the mark reads as part of the line rather than as something dropped into it. The
|
|
34
|
+
* mark is fitted to that square whatever its proportions, so a wide or a tall one is shown whole rather than cropped.
|
|
35
|
+
*
|
|
36
|
+
* A document stating no icon leaves nothing behind, so a screen closes up rather than holding a gap for the mark.
|
|
37
|
+
*
|
|
38
|
+
* The mark is left out of the accessibility tree unless `name` states what it stands for, so a logo standing beside
|
|
39
|
+
* the app name is read once. It survives a forced colour scheme and a printed page, where a background image would be
|
|
40
|
+
* dropped.
|
|
41
|
+
*
|
|
42
|
+
* @param options The widget configuration
|
|
43
|
+
*
|
|
44
|
+
* @returns The logo, or nothing where the document states no icon
|
|
45
|
+
*/
|
|
46
|
+
export function Logo({ name }) {
|
|
47
|
+
return opt(app.icon, icon => createElement("clay-logo", {}, _jsx("img", { alt: name ?? "", src: icon })));
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=logo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logo.js","sourceRoot":"","sources":["../../src/glyphs/logo.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;GAMG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,YAAY,CAAC;AAGpB;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,IAAI,CAAC,EAEpB,IAAI,EAUJ;IAEA,OAAO,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,WAAW,EAAE,EAAE,EACzD,cAAK,GAAG,EAAE,IAAI,IAAI,EAAE,EAAE,GAAG,EAAE,IAAI,GAAG,CAClC,CAAC,CAAC;AAEJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preact interface components.
|
|
3
|
+
*
|
|
4
|
+
* Provides the defaults a widget's controls observe, and the attribute values and event handlers it builds out of
|
|
5
|
+
* state, so a control offers the surface the platform already carries without restating it. The widgets themselves
|
|
6
|
+
* come from their own modules, leaving a screen with the ones it renders and nothing else.
|
|
7
|
+
*
|
|
8
|
+
* Also tells the content of a slot apart from a slot left empty, so a widget renders nothing for a part it was not
|
|
9
|
+
* given and a screen hands over whatever it knows without checking what is missing.
|
|
10
|
+
*
|
|
11
|
+
* @module index
|
|
12
|
+
*/
|
|
13
|
+
import { type Optional } from "@grafctory/core";
|
|
14
|
+
/**
|
|
15
|
+
* The delay a self-submitting control waits out before acting on what was typed (ms).
|
|
16
|
+
*/
|
|
17
|
+
export declare const AutoDelay = 500;
|
|
18
|
+
/**
|
|
19
|
+
* The number of characters a self-submitting control waits for before acting on what was typed.
|
|
20
|
+
*/
|
|
21
|
+
export declare const AutoLength = 2;
|
|
22
|
+
/**
|
|
23
|
+
* The number of entries a self-submitting control offers at a time.
|
|
24
|
+
*/
|
|
25
|
+
export declare const AutoSize = 10;
|
|
26
|
+
/**
|
|
27
|
+
* Checks if a value is content.
|
|
28
|
+
*
|
|
29
|
+
* Values that JSX renders as nothing are not content: they are what a conditional such as `label && <Link/>` leaves
|
|
30
|
+
* in a slot when its condition fails. A component checks each slot to leave out the wrapper of a part it was given
|
|
31
|
+
* nothing for, rather than rendering an empty element. Any other value is content, `0` and whitespace included.
|
|
32
|
+
*
|
|
33
|
+
* @param value The value to check
|
|
34
|
+
*
|
|
35
|
+
* @returns True if the value is neither `undefined`, `null`, a boolean nor the empty string; false otherwise
|
|
36
|
+
*/
|
|
37
|
+
export declare function isContent(value: unknown): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Names the classes in force.
|
|
40
|
+
*
|
|
41
|
+
* Lets a component state which classes apply, rather than assembling the `class` attribute string that says so.
|
|
42
|
+
*
|
|
43
|
+
* @param classes The candidate class names, each against the state deciding whether it is in force
|
|
44
|
+
*
|
|
45
|
+
* @returns The names whose state holds, separated by spaces, or `undefined` if none does, so that the value is
|
|
46
|
+
* assigned to a `class` attribute without leaving an empty one behind
|
|
47
|
+
*/
|
|
48
|
+
export declare function classes(classes: Readonly<{
|
|
49
|
+
[name: string]: Optional<boolean>;
|
|
50
|
+
}>): Optional<string>;
|
|
51
|
+
/**
|
|
52
|
+
* Maps keys to what they do.
|
|
53
|
+
*
|
|
54
|
+
* Declares keyboard behaviour as the actions a component offers rather than as the dispatch selecting among them, and
|
|
55
|
+
* settles with the browser which keys the component has taken over.
|
|
56
|
+
*
|
|
57
|
+
* @param handlers The action taken for each key, named as `KeyboardEvent.key` reports it; a key whose browser default
|
|
58
|
+
* is to survive is left out of the map, which a caller assembles as the state of the moment requires
|
|
59
|
+
*
|
|
60
|
+
* @returns A keyboard handler taking the key it is given an action for, and claiming it from the browser default
|
|
61
|
+
*/
|
|
62
|
+
export declare function keys(handlers: Readonly<{
|
|
63
|
+
[key: string]: (event: KeyboardEvent) => void;
|
|
64
|
+
}>): (event: KeyboardEvent) => void;
|
|
65
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3D;;GAEG;AACH,eAAO,MAAM,SAAS,MAAM,CAAC;AAE7B;;GAEG;AACH,eAAO,MAAM,UAAU,IAAI,CAAC;AAE5B;;GAEG;AACH,eAAO,MAAM,QAAQ,KAAK,CAAC;AAK3B;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAOjD;AAGD;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAA;CAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAOlG;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;CAAE,CAAC,IAEjF,OAAO,aAAa,UAc5B"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2026 Metreeca srl
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Preact interface components.
|
|
18
|
+
*
|
|
19
|
+
* Provides the defaults a widget's controls observe, and the attribute values and event handlers it builds out of
|
|
20
|
+
* state, so a control offers the surface the platform already carries without restating it. The widgets themselves
|
|
21
|
+
* come from their own modules, leaving a screen with the ones it renders and nothing else.
|
|
22
|
+
*
|
|
23
|
+
* Also tells the content of a slot apart from a slot left empty, so a widget renders nothing for a part it was not
|
|
24
|
+
* given and a screen hands over whatever it knows without checking what is missing.
|
|
25
|
+
*
|
|
26
|
+
* @module index
|
|
27
|
+
*/
|
|
28
|
+
import { isBoolean } from "@grafctory/core";
|
|
29
|
+
/**
|
|
30
|
+
* The delay a self-submitting control waits out before acting on what was typed (ms).
|
|
31
|
+
*/
|
|
32
|
+
export const AutoDelay = 500;
|
|
33
|
+
/**
|
|
34
|
+
* The number of characters a self-submitting control waits for before acting on what was typed.
|
|
35
|
+
*/
|
|
36
|
+
export const AutoLength = 2;
|
|
37
|
+
/**
|
|
38
|
+
* The number of entries a self-submitting control offers at a time.
|
|
39
|
+
*/
|
|
40
|
+
export const AutoSize = 10;
|
|
41
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
42
|
+
/**
|
|
43
|
+
* Checks if a value is content.
|
|
44
|
+
*
|
|
45
|
+
* Values that JSX renders as nothing are not content: they are what a conditional such as `label && <Link/>` leaves
|
|
46
|
+
* in a slot when its condition fails. A component checks each slot to leave out the wrapper of a part it was given
|
|
47
|
+
* nothing for, rather than rendering an empty element. Any other value is content, `0` and whitespace included.
|
|
48
|
+
*
|
|
49
|
+
* @param value The value to check
|
|
50
|
+
*
|
|
51
|
+
* @returns True if the value is neither `undefined`, `null`, a boolean nor the empty string; false otherwise
|
|
52
|
+
*/
|
|
53
|
+
export function isContent(value) {
|
|
54
|
+
return value !== undefined
|
|
55
|
+
&& value !== null
|
|
56
|
+
&& value !== ""
|
|
57
|
+
&& !isBoolean(value);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Names the classes in force.
|
|
61
|
+
*
|
|
62
|
+
* Lets a component state which classes apply, rather than assembling the `class` attribute string that says so.
|
|
63
|
+
*
|
|
64
|
+
* @param classes The candidate class names, each against the state deciding whether it is in force
|
|
65
|
+
*
|
|
66
|
+
* @returns The names whose state holds, separated by spaces, or `undefined` if none does, so that the value is
|
|
67
|
+
* assigned to a `class` attribute without leaving an empty one behind
|
|
68
|
+
*/
|
|
69
|
+
export function classes(classes) {
|
|
70
|
+
return Object.entries(classes)
|
|
71
|
+
.filter(([, state]) => state)
|
|
72
|
+
.map(([name]) => name)
|
|
73
|
+
.join(" ") || undefined;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Maps keys to what they do.
|
|
77
|
+
*
|
|
78
|
+
* Declares keyboard behaviour as the actions a component offers rather than as the dispatch selecting among them, and
|
|
79
|
+
* settles with the browser which keys the component has taken over.
|
|
80
|
+
*
|
|
81
|
+
* @param handlers The action taken for each key, named as `KeyboardEvent.key` reports it; a key whose browser default
|
|
82
|
+
* is to survive is left out of the map, which a caller assembles as the state of the moment requires
|
|
83
|
+
*
|
|
84
|
+
* @returns A keyboard handler taking the key it is given an action for, and claiming it from the browser default
|
|
85
|
+
*/
|
|
86
|
+
export function keys(handlers) {
|
|
87
|
+
return (event) => {
|
|
88
|
+
const handler = handlers[event.key];
|
|
89
|
+
if (handler !== undefined) {
|
|
90
|
+
handler(event);
|
|
91
|
+
event.preventDefault();
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,SAAS,EAAiB,MAAM,iBAAiB,CAAC;AAG3D;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAC;AAE7B;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAE5B;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,CAAC;AAG3B,wHAAwH;AAExH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,SAAS,CAAC,KAAc;IAEvC,OAAO,KAAK,KAAK,SAAS;WACtB,KAAK,KAAK,IAAI;WACd,KAAK,KAAK,EAAE;WACZ,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAEvB,CAAC;AAGD;;;;;;;;;GASG;AACH,MAAM,UAAU,OAAO,CAAC,OAAwD;IAE/E,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;SAC5B,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC;SAC5B,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC;SACrB,IAAI,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC;AAE1B,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,IAAI,CAAC,QAAqE;IAEzF,OAAO,CAAC,KAAoB,EAAE,EAAE;QAE/B,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEpC,IAAK,OAAO,KAAK,SAAS,EAAG,CAAC;YAE7B,OAAO,CAAC,KAAK,CAAC,CAAC;YAEf,KAAK,CAAC,cAAc,EAAE,CAAC;QAExB,CAAC;IAEF,CAAC,CAAC;AAEH,CAAC"}
|