Skip to content

Commit b00200d

Browse files
committed
edit: docs
1 parent ccfc836 commit b00200d

File tree

6 files changed

+33
-89
lines changed

6 files changed

+33
-89
lines changed

docs.md

+2-66
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,6 @@ ___
1919
<dd></dd>
2020
</dl>
2121

22-
## Functions
23-
24-
<dl>
25-
<dt><a href="#el">el(sel, [par])</a> ⇒ <code>HTMLElement</code></dt>
26-
<dd><p>DOM helper - Get one DOM element</p>
27-
</dd>
28-
<dt><a href="#els">els(sel, [par])</a> ⇒ <code>NodeList</code></dt>
29-
<dd><p>DOM helper - Get multiple DOM elements</p>
30-
</dd>
31-
<dt><a href="#elNew">elNew(tag, [prop])</a> ⇒ <code>HTMLElement</code></dt>
32-
<dd><p>DOM helper - Create new DOM element</p>
33-
</dd>
34-
<dt><a href="#keysArray">keysArray(keys)</a> ⇒ <code>Array.&lt;string&gt;</code></dt>
35-
<dd><p>Convert a string or array of strings - to array</p>
36-
</dd>
37-
</dl>
38-
3922
## Typedefs
4023

4124
<dl>
@@ -112,7 +95,7 @@ Kioboard
11295
| Param | Type | Default | Description |
11396
| --- | --- | --- | --- |
11497
| options | <code>Object</code> | | |
115-
| options.parent | <code>string</code> \| <code>NodeList</code> \| <code>undefined</code> | <code>&quot;body&quot;</code> | Element to insert kioboard into |
98+
| options.parent | <code>string</code> \| <code>Element</code> \| <code>undefined</code> | <code>&quot;body&quot;</code> | Element to insert kioboard into |
11699
| options.inputs | <code>string</code> \| <code>NodeList</code> \| <code>HTMLElement</code> \| <code>undefined</code> | <code>&quot;[data-kioboard]&quot;</code> | Selector string, Element or elements. The input(s) to bind to |
117100
| options.input | <code>HTMLInputElement</code> \| <code>HTMLTextAreaElement</code> | <code>options.inputs[0]</code> | The currently active input |
118101
| [options.layoutName] | <code>string</code> \| <code>undefined</code> | | The /layouts/<name>.js to use |
@@ -588,7 +571,7 @@ Respects also the input's maxlength.
588571

589572
| Param | Type | Default | Description |
590573
| --- | --- | --- | --- |
591-
| val | <code>string</code> | <code>&quot;\&quot;\&quot;&quot;</code> | Text to insert at caret position or highlighted section |
574+
| val | <code>string</code> | | Text to insert at caret position or highlighted section |
592575
| from | <code>number</code> | <code>this.input.selectionStart</code> | |
593576
| to | <code>number</code> | <code>this.input.selectionEnd</code> | |
594577

@@ -636,53 +619,6 @@ kio.init();
636619
| --- | --- | --- |
637620
| key | <code>string</code> | The last pressed key |
638621

639-
<a name="el"></a>
640-
641-
## el(sel, [par]) ⇒ <code>HTMLElement</code>
642-
DOM helper - Get one DOM element
643-
644-
**Kind**: global function
645-
646-
| Param | Type | Description |
647-
| --- | --- | --- |
648-
| sel | <code>string</code> | Selector |
649-
| [par] | <code>HTMLElement</code> | Optional parent defaults to window.document |
650-
651-
<a name="els"></a>
652-
653-
## els(sel, [par]) ⇒ <code>NodeList</code>
654-
DOM helper - Get multiple DOM elements
655-
656-
**Kind**: global function
657-
658-
| Param | Type | Description |
659-
| --- | --- | --- |
660-
| sel | <code>string</code> | Selector |
661-
| [par] | <code>HTMLElement</code> | Optional parent defaults to window.document |
662-
663-
<a name="elNew"></a>
664-
665-
## elNew(tag, [prop]) ⇒ <code>HTMLElement</code>
666-
DOM helper - Create new DOM element
667-
668-
**Kind**: global function
669-
670-
| Param | Type | Description |
671-
| --- | --- | --- |
672-
| tag | <code>string</code> | Tag name |
673-
| [prop] | <code>Object</code> | Optional element properties |
674-
675-
<a name="keysArray"></a>
676-
677-
## keysArray(keys) ⇒ <code>Array.&lt;string&gt;</code>
678-
Convert a string or array of strings - to array
679-
680-
**Kind**: global function
681-
682-
| Param | Type |
683-
| --- | --- |
684-
| keys | <code>string</code> \| <code>Array.&lt;string&gt;</code> |
685-
686622
<a name="ActionFunction"></a>
687623

688624
## ActionFunction : <code>function</code>

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
height: 300dvh;
1818
color: #333;
1919
background: linear-gradient(0deg, rgba(17,170,238,1) 0%, rgba(16,208,255,1) 100%);
20-
background: #222;
20+
/* background: #222; */
2121
}
2222

2323
#app {

index.js

+14-9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import Kioboard from "./src/kioboard.js";
66
// kio.load("hr");
77

88
const myLayout = {
9-
name: "XXX",
109
layers: {
1110
default: [
1211
"a b c backspace",
@@ -19,7 +18,7 @@ const myLayout = {
1918
"extras space",
2019
],
2120
myExtras: [
22-
"! $ & backspace 1 \u1234",
21+
"! $ & backspace 1",
2322
"% # * enter",
2423
"default space",
2524
]
@@ -35,15 +34,21 @@ const myLayout = {
3534
};
3635

3736
// const kio = new Kioboard(myLayout);
38-
const kio = new Kioboard({ inputs: ".kio1", layoutName: "en" });
39-
const kio2 = new Kioboard({ inputs: ".kio2", layoutName: "hr", shiftState: 2 });
37+
const kio = new Kioboard({
38+
inputs: ".kio1",
39+
theme: "my-custom",
40+
isAlwaysVisible: true,
41+
...myLayout
42+
})
4043

44+
const kio2 = new Kioboard({ inputs: ".kio2", layoutName: "hr" });
4145

42-
kio.load("de", (layout) => {
43-
console.log(`Loaded: layouts/${kio.layoutName}.js layout`, layout);
44-
kio.show(); // Optionally, show it!
45-
kio.sequence("shift H default e l l o space emoji default shift W default o r l d shift ! default", 300);
46-
});
46+
47+
// kio.load("de", (layout) => {
48+
// console.log(`Loaded: layouts/${kio.layoutName}.js layout`, layout);
49+
// kio.show(); // Optionally, show it!
50+
// kio.sequence("shift H default e l l o space emoji default shift W default o r l d shift ! default", 300);
51+
// });
4752

4853
// const kio = new Kioboard().load("de", (data) => {
4954
// console.log(`loaded`, kio, data);

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@rbuljan/kioboard",
33
"description": "Virtual keyboard for digital signage kiosk touch screens",
4-
"version": "0.1.4",
4+
"version": "0.1.5",
55
"author": {
66
"name": "Roko C. Buljan",
77
"url": "https://github.com/rokobuljan"

readme.md

+9-10
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,16 @@ your **virtual keyboard** for digital signage kiosk touchscreens
66

77
## Features
88

9-
- [x] Fully customizable layouts
10-
- [x] Fully customizable buttons icons
9+
- [x] Fully customizable layouts and layers
1110
- [x] Fully customizable buttons actions
11+
- [x] Fully customizable buttons icons (Unicode, SVG)
1212
- [x] Themes: default, flat, glass. In light and dark mode
13-
- [x] Layout files (contribute to the project!)
13+
- [x] Language presets (contribute to the project!)
1414
- [x] Shift + Caps-Lock
1515
- [x] Close Kioboard button
16+
- [x] Togle or set initial visibility
1617
- [x] Drag/move Kioboard handler
17-
- [x] Customizable button icons (supported: Unicode, SVG)
18-
- [x] Per-button custom action callbacks
19-
- [x] Toggle Kioboard visibility or set as permanently open
20-
- [x] Different layouts per input-sets
18+
- [x] Different layouts per input groups
2119
- [x] Long key press - repeat input
2220

2321
## Usage
@@ -48,10 +46,11 @@ Customization options example:
4846
const kio = new Kioboard({
4947
layoutName: "en", // "en|de|es|fr|hr" // Contribute for more!
5048
inputs: "[data-kioboard]", // selector|Element|Element[]|NodeList
49+
input: null, // The curently active input Element
5150
parent: "body", // selector|Element
52-
theme: "default", // "default|flat|glass-(light|dark)"
51+
theme: "default", // "default|flat|glass"-"light|dark"
5352
layerName: "default",
54-
layers: {}, // instead of layoutName use custom layers
53+
layers: {}, // custom layers
5554
icons: {}, // custom icons
5655
isEnterSubmit: true, // should Enter submit closest Form
5756
isVisible: false, // On init
@@ -76,7 +75,7 @@ const kio = new Kioboard({
7675

7776
## Feature requests / issues
7877

79-
[Github: rokobuljan/kioboard/issues &rarr;](https://github.com/rokobuljan/kioboard/issues)
78+
[GitHub: rokobuljan/kioboard/issues &rarr;](https://github.com/rokobuljan/kioboard/issues)
8079

8180
## Licence
8281

src/kioboard.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Emitter from "./emitter.js";
33

44
/**
55
* DOM helper - Get one DOM element
6+
* @ignore
67
* @param {string} sel Selector
78
* @param {HTMLElement=} par Optional parent defaults to window.document
89
* @returns {HTMLElement}
@@ -11,6 +12,7 @@ const el = (sel, par = document) => par.querySelector(sel);
1112

1213
/**
1314
* DOM helper - Get multiple DOM elements
15+
* @ignore
1416
* @param {string} sel Selector
1517
* @param {HTMLElement=} par Optional parent defaults to window.document
1618
* @returns {NodeList}
@@ -19,6 +21,7 @@ const els = (sel, par = document) => par.querySelectorAll(sel);
1921

2022
/**
2123
* DOM helper - Create new DOM element
24+
* @ignore
2225
* @param {string} tag Tag name
2326
* @param {Object=} prop Optional element properties
2427
* @returns {HTMLElement}
@@ -27,6 +30,7 @@ const elNew = (tag, prop) => Object.assign(document.createElement(tag), prop);
2730

2831
/**
2932
* Convert a string or array of strings - to array
33+
* @ignore
3034
* @param {string|Array<string>} keys
3135
* @returns {Array<string>}
3236
*/
@@ -136,7 +140,7 @@ class Kioboard {
136140

137141
/**
138142
* @param {Object} options
139-
* @param {string|NodeList|undefined} options.parent=body - Element to insert kioboard into
143+
* @param {string|Element|undefined} options.parent=body - Element to insert kioboard into
140144
* @param {string|NodeList|HTMLElement|undefined} options.inputs=[data-kioboard]] Selector string, Element or elements. The input(s) to bind to
141145
* @param {HTMLInputElement|HTMLTextAreaElement} options.input=options.inputs[0]] The currently active input
142146
* @param {string|undefined} [options.layoutName] The /layouts/<name>.js to use
@@ -860,7 +864,7 @@ class Kioboard {
860864
/**
861865
* Insert value at caret position.
862866
* Respects also the input's maxlength.
863-
* @param {string} val="" Text to insert at caret position or highlighted section
867+
* @param {string} val Text to insert at caret position or highlighted section
864868
* @param {number} from=this.input.selectionStart
865869
* @param {number} to=this.input.selectionEnd
866870
* @example

0 commit comments

Comments
 (0)