WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 3289250

Browse files
committed
readme updates to reflect recent changes
plus a note about "undo"
1 parent 3b7258c commit 3289250

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ It has a very limited selection of four elements and no external dependencies. T
1818
## Usage
1919
[Release 1.0]() has both source modules and tranpiled, minified bundles. The bundles are in the `dist/` directory. The source is in `src/` in the NPM package, and in the root directory in the repository (which makes it easier to create `dist/` versions of the test/demo apps for testing the `dist/` modules).
2020

21-
link to current release dist or src
22-
NPM package
23-
you're on your own
21+
- link to current release dist or src
22+
- NPM package
23+
- you're on your own...
2424

2525
For example, to import `<input-num>`:
2626
```html
@@ -130,10 +130,10 @@ To set `value` as an attribute, I use `"1"` for `true` and you must use `""` for
130130
- `data-default` / `default` is a boolean that sets the default value. If you don't use the `checked` property, then you have no need for it.
131131
- `data-show-default` / `showDefault` is a boolean that shows or hides the default value as a read-only box to the left.
132132
133-
### template-check.html
133+
### multi-check.html
134134
`<check-box>` and `<check-tri>` share a template file. The built-in template is potentially reusable because the shapes are simple and they are 100% externally styleable with `::part`. This is the `<template>`:
135135
```html
136-
<template id="template-check">
136+
<template>
137137
<svg id="shapes" part="shapes" viewbox="0 0 18 15" width="18" height="15">
138138
<defs> <!-- this template doesn't define #false -->
139139
<rect id="box" x="0.5" y="1.5" width="13" height="13" rx="2" ry="2"/>
@@ -200,8 +200,8 @@ An alternative is to put a flex container inside the template, as the template f
200200
201201
NOTE: The default value on initial page load is the first state defined. I see no need to set the `value` attribute in HTML. The toggle order is completely user-controlled, so just make your default state the first one. If you *really need* to declare the value in HTML, you must do it after `data-states` or the value won't validate. I did not see the value in adding code to make it order-independent.
202202
203-
### template-button.html
204-
The built-in template is a pair of playback buttons: play and stop. It's not nearly as reusable as **template-check.html**, but this is a more raw, open-ended kind of element. It requires customization to match its flexibility.
203+
### state-btn.html
204+
The built-in template is a pair of playback buttons: play and stop. It's not nearly as reusable as **multi-check.html**, but this is a more raw, open-ended kind of element. It requires customization to match its flexibility.
205205
206206
There is one template for all your buttons. One 'use' element and as many definitions as you need.
207207
@@ -212,7 +212,7 @@ The templates requires a `<defs>` that contains an element with a matching `btn-
212212
```
213213
To match this template:
214214
```html
215-
<template id="template-button">
215+
<template>
216216
<style>
217217
:host { --square:calc(1rem + var(--9-16ths)) }
218218
svg { width:var(--square); height:var(--square); }
@@ -243,6 +243,7 @@ Based on an informal survey and my own repeated frustrations, I came to the conc
243243
#### Spreadsheet Emulation
244244
- It stores an underlying `Number` separate from the formatted display, which is a `String` that can contain non-numeric characters. Inputting via keyboard reveals the unformatted, underlying value.
245245
- By default, the user confirms keyboard input by blurring the element (pressing `Tab`, `Shift+Tab`, or clicking elsewhere on the page), or via the `Enter` key or `OK` button. They cancel input via the `Esc` key or `Cancel` button. Cancelling reverts to the previous value. Setting the `data-blur-cancel` attribute cancels instead of confirming when blurring the element via tabbing or clicking elsewhere.
246+
NOTE: The inner `<input>` is `type="text"`, which has built-in undo functionality in the browsers via `Ctrl+Z` or whatever the appropriate keystokes are in the native OS. So you can undo an unwanted commit within the same session, though your mileage may vary by browser/OS.
246247
- By default, numbers are right-aligned, for keyboard input and formatted display. If you want to view a group of numbers in a vertical list, right-alignment is essential. Financials require it. The `data-no-align` attribute turns right-alignment off.
247248
- Spreadsheets have their own number formatting lingo. `<input-num>` uses [Intl.NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat), which is wrapped up in [locales](https://en.wikipedia.org/wiki/Locale_(computer_software)). `data-digits`, `data-units`, `data-locale`, `data-currency`, `data-accounting`, and `data-notation` are the formatting attributes. I have not implemented any of the `Intl.NumberFormat` rounding options [yet](https://github.com/sidewayss/html-elements/issues/6).
248249
@@ -377,7 +378,7 @@ for (const elm of document.getElementsByTagName("input-num")) {
377378
}
378379
```
379380
380-
### template-number.html
381+
### input-num.html
381382
The core of the template is a flex `<div>`, with three children:
382383
- `<input type="text" id="input" part="input"/>` - the text input
383384
- `<svg part="buttons">` - the spinner and confirm buttons

0 commit comments

Comments
 (0)