@nmnmcc/standard 0.4.0 → 0.5.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/README.md +45 -68
- package/dist/Extend.js +1 -1
- package/dist/{Standard-BPpzr5SM.js → Standard-BC6CfFOv.js} +116 -159
- package/dist/Standard.js +1 -1
- package/dist/Ui-DSgtM8Tf.js +591 -0
- package/dist/Ui.d.ts +4 -4
- package/dist/Ui.js +1 -1
- package/dist/index.js +2 -2
- package/dist/standard/page/page.d.ts +4 -6
- package/dist/standard/page/page.d.ts.map +1 -1
- package/dist/standard/tokens/tokens.d.ts +20 -103
- package/dist/standard/tokens/tokens.d.ts.map +1 -1
- package/dist/standard.css +1 -1
- package/dist/ui/flap/flap.d.ts +10 -10
- package/dist/ui/flap/flap.d.ts.map +1 -1
- package/dist/ui/modal/modal.d.ts +4 -1
- package/dist/ui/modal/modal.d.ts.map +1 -1
- package/dist/ui/navigator/navigator.d.ts +58 -59
- package/dist/ui/navigator/navigator.d.ts.map +1 -1
- package/dist/ui/notice/notice.d.ts +6 -1
- package/dist/ui/notice/notice.d.ts.map +1 -1
- package/dist/ui/sheet/sheet.d.ts +9 -9
- package/dist/ui/toasts/toasts.d.ts +8 -7
- package/dist/ui/toasts/toasts.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/standard/page/page.module.css +85 -47
- package/src/standard/page/page.module.d.css.ts +4 -2
- package/src/standard/page/page.ts +83 -1
- package/src/standard/tokens/tokens.ts +20 -268
- package/src/ui/dialog/dialog.module.css +24 -11
- package/src/ui/flap/flap.module.css +108 -52
- package/src/ui/flap/flap.module.d.css.ts +6 -1
- package/src/ui/flap/flap.ts +140 -13
- package/src/ui/modal/modal.module.css +73 -22
- package/src/ui/modal/modal.module.d.css.ts +1 -0
- package/src/ui/modal/modal.ts +21 -15
- package/src/ui/navigator/navigator.module.css +334 -176
- package/src/ui/navigator/navigator.module.d.css.ts +2 -10
- package/src/ui/navigator/navigator.ts +111 -106
- package/src/ui/notice/notice.ts +7 -2
- package/src/ui/popover/popover.ts +3 -3
- package/src/ui/sheet/sheet.module.css +51 -58
- package/src/ui/sheet/sheet.ts +9 -9
- package/src/ui/toasts/toasts.module.css +70 -11
- package/src/ui/toasts/toasts.module.d.css.ts +1 -0
- package/src/ui/toasts/toasts.ts +148 -4
- package/dist/Ui-B9xQqqNT.js +0 -468
package/README.md
CHANGED
|
@@ -34,8 +34,8 @@ src/
|
|
|
34
34
|
Extend.ts the door left open for layers built on top
|
|
35
35
|
Node.ts the nodes that builders take and return
|
|
36
36
|
standard/ the language
|
|
37
|
-
tokens/ tokens.ts: the Schemas of the tokens, and
|
|
38
|
-
page/ page, plus the reset, the fonts, and how
|
|
37
|
+
tokens/ tokens.ts: the Schemas of the tokens, and turn; classes.ts: the classes for the tokens; tokens.module.css
|
|
38
|
+
page/ page, plus the reset, the fonts, and how a view turns on a page change
|
|
39
39
|
layout/ section, grid, col, stack, row, rule
|
|
40
40
|
text/ text, em, code, listing, link, br
|
|
41
41
|
colour/ the colour algorithm: it computes the palette from hues
|
|
@@ -108,9 +108,9 @@ route to it or call `Component.provide`, use the API of `effect/ui` itself.
|
|
|
108
108
|
| A twelve-column grid | `span` and `start` can only be 1–12; when a start is out of range, CSS shortens the span |
|
|
109
109
|
| A fixed type scale | The `role` of `s.text(role, …)` is one of seven string literals |
|
|
110
110
|
| The same spacing everywhere | `gap` and `pad` can only be values on the spacing scale |
|
|
111
|
-
| Colour is flat and comes from the palette | There is no limit on the number of colours: `accent` can be any colour of the palette, and the page and every `section` can each choose their own. The colour values are only in the stylesheet
|
|
111
|
+
| Colour is flat and comes from the palette | There is no limit on the number of colours: `accent` can be any colour of the palette, and the page and every `section` can each choose their own. The colour values are only in the stylesheet |
|
|
112
112
|
| Flush left, not centred | `align` has no `center`. What is written in a block starts at its top left, however large the block is made: tiles, cards, tabs and segments in a row all start on one line. Only a single glyph in a square of its own (a pictogram in a button, a page number, the letter of a roundel) has the same room on every side |
|
|
113
|
-
| No ornament | There are no rounded corners
|
|
113
|
+
| No ornament | There are no rounded corners or shadows to choose |
|
|
114
114
|
|
|
115
115
|
There is no `class`, `style` or `attr` on `s`. The key of the node type `Standard.Node` is a `symbol` that is
|
|
116
116
|
not exported, so the builders of `s` are the only way to make a node.
|
|
@@ -195,52 +195,27 @@ Anyone who imports this entry point is responsible for keeping the result in Swi
|
|
|
195
195
|
There are no hover styles: when the pointer rests on a control, nothing changes. A press gives the `:active` feedback, the same for a mouse and a finger.
|
|
196
196
|
The smallest touch target of a control is `--s-target` (44px for a fine pointer, 48px for a coarse one, `pointer: coarse`). `touch-action: manipulation` removes the tap delay.
|
|
197
197
|
|
|
198
|
-
###
|
|
198
|
+
### A change of view
|
|
199
199
|
|
|
200
|
-
The
|
|
201
|
-
|
|
200
|
+
The navigator is the post of a revolving door, and every view is a leaf of that door. A change of view is the door turning by a quarter of a turn,
|
|
201
|
+
on the edge of the window the navigator is at, and which way it turns is said by the history:
|
|
202
202
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
`Standard.travel` takes the route table (a `Route.union` of `effect/ui`) and two of its routes, and returns `forward` / `back` combined with `down` / `up`
|
|
208
|
-
(for the same place it returns an empty array). The app does not say where a route is; the table does, so the addresses have to be written the way the canvas is drawn:
|
|
209
|
-
|
|
210
|
-
An address is `/section/page`, and under a page whatever is under it:
|
|
211
|
-
|
|
212
|
-
- **The section, along the line of reading**: the first segment. Sections lie in the order the table first names them: from `/read/…` to `/settings/…` is forward.
|
|
213
|
-
- **The page, down the page**: the second segment. The pages of a section lie in the order the table declares them, and every section starts at the top.
|
|
214
|
-
So from the second page of one section to the fifth of another is forward and down, at 45 degrees, and to the first of another forward and up.
|
|
215
|
-
- **Under a page, forward again**: each segment after the second is a step forward from its page: `/read/topics/:id` is straight along from `/read/topics`,
|
|
216
|
-
and a checkout that follows the basket is `/order/basket/checkout`. Params that follow one another are one step between them.
|
|
217
|
-
- **Params in order**: a `Schema.Literals` param takes a place for each literal, in the order they are given. A param of any other Schema takes one place, and two of its values
|
|
218
|
-
are in the order a list of them would be read in: numbers as numbers, `B9` before `B10`, `2026-11-24` before `2026-12-02`.
|
|
219
|
-
So a post that should lie in the order of its date is `/read/latest/:date/:id`.
|
|
220
|
-
- **`/` is not a place**: redirect it to the first page, with `Route.redirect("/", …)`.
|
|
203
|
+
- **The history goes on** (a link is pressed): the new view turns in from in front of the window, and the view that is left turns on the same way, back from the window. This is `in`.
|
|
204
|
+
- **The history goes back**: the door turns the other way. The view that is left turns out to the front, and the one before it comes back from behind. This is `out`.
|
|
221
205
|
|
|
222
|
-
|
|
223
|
-
and leave the addresses as they are:
|
|
206
|
+
Nothing slides across, up or down, and nothing moves at an angle.
|
|
224
207
|
|
|
225
208
|
```ts
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
[{ at: "Latest", under: ["Post"] }, "Archive", { at: "Topics", under: ["Topic"] }],
|
|
229
|
-
["Saved", "Write"],
|
|
230
|
-
["Display"]
|
|
231
|
-
])
|
|
232
|
-
|
|
233
|
-
Navigated: ($, { route }) => $.evolve({ route }).viewTransition(Canvas.travel($.model.route, route))
|
|
209
|
+
// The Model keeps the entry of the history it is at: the `index` of the router's `Location`.
|
|
210
|
+
Navigated: ($, { route, at }) => $.evolve({ route, at }).viewTransition(Standard.turn($.model.at, at))
|
|
234
211
|
```
|
|
235
212
|
|
|
236
|
-
|
|
237
|
-
A place is the tag of a route, for all its addresses (in the order of their params, as above), or a route, for one address: `BlogRoute.Post({ params: { id } })`.
|
|
238
|
-
An address is at the place that names it, and failing that at the place of its tag. Every route but the catch-all has to be on the canvas, or `canvas` throws.
|
|
239
|
-
A canvas that depends on the Model, such as the posts there are, is drawn in `update`.
|
|
213
|
+
`Standard.turn(from, to)` takes two entries of the history and returns `["in"]`, `["out"]`, or an empty array for the same entry.
|
|
240
214
|
|
|
241
|
-
You do not need to mark which part will
|
|
242
|
-
|
|
243
|
-
|
|
215
|
+
You do not need to mark which part will turn: what turns is the screen seen in the window, wherever the page is scrolled to, with whatever was in front of the page.
|
|
216
|
+
Things that should stay in place (for example the `navigator` of ui) carry a `view-transition-name`. The view in front of the window is over them for as long as it turns,
|
|
217
|
+
and the view behind it is under them. With no navigator a view turns on the edge of the window where the page starts.
|
|
218
|
+
**Nothing fades**: state changes instantly, and what changes place really moves.
|
|
244
219
|
The duration tokens are `--s-quick`, `--s-move` and `--s-travel`; with the system's “reduce motion” setting, all of them are 0.
|
|
245
220
|
|
|
246
221
|
### New builders and options in this version
|
|
@@ -394,7 +369,7 @@ Interactive components built on top of the `Standard` module.
|
|
|
394
369
|
Two starting points:
|
|
395
370
|
|
|
396
371
|
- **Everything is designed around interactive components, not around screen space.** Every builder is a component that “a person does one thing to”: press, choose, switch on and off, follow, close.
|
|
397
|
-
- **The app is one canvas with no edges, and the screen is only a window onto it.** Nothing is fixed to the window.
|
|
372
|
+
- **The app is one canvas with no edges, and the screen is only a window onto it.** Nothing is fixed to the window. The navigator is the post of a revolving door, and the page is a leaf of that door: a thing that opens (`sheet`, `dialog`, the pane of the navigator) comes in front of the page, and the page turns away from it on the navigator.
|
|
398
373
|
|
|
399
374
|
Like Metro, it learns from the signage of public transport. But what it takes is the **method**, not the **look**: one sign says only one thing and can be read at a glance;
|
|
400
375
|
direction is shown by position and arrows; colour tells things of the same kind apart and never carries the meaning alone; at any time you know where you are and what comes next.
|
|
@@ -443,11 +418,11 @@ context menus and so on) and what to use instead, see the Not provided page of t
|
|
|
443
418
|
|
|
444
419
|
The navigator (`navigator`) is the old sidebar made general: every place in the app that you can go to is in it, on two levels. The first level is the groups (an icon and a name); the second level is the pages of the selected group. It can be placed in three positions:
|
|
445
420
|
|
|
446
|
-
| `place` | First level
|
|
447
|
-
| ---------------------- |
|
|
448
|
-
| `"side"` (the default) | A
|
|
449
|
-
| `"top"` | A row along the top, with icons and names
|
|
450
|
-
| `"bottom"` | A row of tabs along the bottom (the icon above the name), within reach of the thumb
|
|
421
|
+
| `place` | First level | Second level |
|
|
422
|
+
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
|
|
423
|
+
| `"side"` (the default) | A column against the starting edge of the page, always there and always as wide: the link home, and under it the groups, one to a row | In the same column, in front of the groups: it turns in over them, and the row at its head turns it out again |
|
|
424
|
+
| `"top"` | A row along the top, with icons and names | A list that drops straight down from under the pressed group and hangs over the page like a menu |
|
|
425
|
+
| `"bottom"` | A row of tabs along the bottom (the icon above the name), within reach of the thumb | A pane that turns up over the tabs, with the page names listed vertically |
|
|
451
426
|
|
|
452
427
|
In a narrow window (a mobile device) it is always the bottom bar, whatever `place` says.
|
|
453
428
|
|
|
@@ -458,10 +433,10 @@ s.page({ accent },
|
|
|
458
433
|
label: "Contents",
|
|
459
434
|
brand: { name: "Standard", colour: "red" },
|
|
460
435
|
place: "side", // or "top", "bottom"
|
|
461
|
-
mode: "docked", // or "sheet"
|
|
462
436
|
shown: model.group, onShow: (index, as) => Message.ShowedGroup({ index, as }),
|
|
463
|
-
open: model.pane !== null, //
|
|
464
|
-
|
|
437
|
+
open: model.pane !== null, // only the groups, by default
|
|
438
|
+
onClose: (as) => Message.ToggledPane({ open: false, as }),
|
|
439
|
+
home: { label: "Home", href: "/" },
|
|
465
440
|
groups // { label, icon, colour?, links: { label, href, icon?, current? }[] }[]
|
|
466
441
|
},
|
|
467
442
|
s.section({ as: "main" }, …),
|
|
@@ -470,35 +445,37 @@ s.page({ accent },
|
|
|
470
445
|
)
|
|
471
446
|
```
|
|
472
447
|
|
|
473
|
-
- **
|
|
474
|
-
- **The back button**: with `back: { label, onPress, disabled
|
|
475
|
-
- **Closing and opening**: normally only the first level shows. Pressing
|
|
476
|
-
- **
|
|
477
|
-
- **Sheet (`sheet`)**:
|
|
478
|
-
- **
|
|
479
|
-
-
|
|
480
|
-
-
|
|
448
|
+
- **Home, and the brand mark**: `home: { label, href }` is the link to the page the app starts at. It comes first in the first level, as a house. There is no hamburger button. When `brand: { name, icon?, src?, colour? }` is given, the mark and the name of the app are the link home, in place of the house. The mark can be an image or an icon; when neither is given it is a block of colour (in `colour` if that is given, otherwise in the accent). With the bottom bar it is in the bar along the top of the page.
|
|
449
|
+
- **The back button**: with `back: { label, onPress, disabled? }`, an arrow sits in the corner where the page starts, before the brand mark. It points back, always.
|
|
450
|
+
- **Closing and opening**: normally only the first level shows. Pressing any group opens the second level; pressing a group only changes what the second level shows. It does not navigate to a page, and it is the Model that opens it in the same `onShow`. `onClose` is sent when the second level is to go: by pressing the selected group in the top bar and the bottom bar, and by the row that goes back at the head of the second level in the sidebar.
|
|
451
|
+
- **The sidebar is one whole, with its levels in depth**: it is always there, always as wide, and takes its room from the page. Its two levels are not side by side: the second level is in front of the first. It turns in over the groups on the edge of the window, as the next leaf of a door, and turns out again, and the groups stay behind it all the time. For the Model it is `"docked"`: on a page change it stays as it is, and the new page turns in.
|
|
452
|
+
- **Sheet (`sheet`)**: the bottom bar. Its second level takes up no space: it comes up in front of the page.
|
|
453
|
+
- **A revolving door**: the navigator is the post, and the page is a leaf of the door. Whenever something is in front of the page (the second level of a top bar or a bottom bar, a `sheet`, a `dialog`), the page turns away by 15 degrees on the edge of the window the navigator is at. It is seen in depth, so its far edge is smaller, and the further back a part of it is, the more of the page's ground it takes: paler in the light scheme, darker in the dark scheme. It turns back when nothing is in front of it. What comes in does not slide in: it is the next leaf of the door, and turns in on the same post, from a quarter of a turn out of the window. That is how a `sheet`, a `dialog` and the pane of the navigator come in. At rest a `sheet` and a `dialog` are never over the navigator, but whatever turns in or out is over it for as long as it turns; a `menu` and a `popover` are drawn out of their button, and the page does not turn for them. A small script tells the stylesheet where the window is on the page (`--s-ui-seen`), so the turn is right wherever the page is scrolled to.
|
|
454
|
+
- **The top bar**: the list turns down out of the bar and hangs over the page. It takes up no space; for the Model it is a `"menu"`. After a page is chosen it closes, as the new page turns in.
|
|
455
|
+
- **`as`**: the last argument of `onShow` and of `onClose` tells the Model how the navigator is held in the window where the press happened: `"docked"` for the sidebar, `"menu"` for the top bar, `"sheet"` for the bottom bar (in a narrow window it is always `"sheet"`). From this the Model decides whether to close it on a page change.
|
|
456
|
+
- **A page change is always the same movement**: the door turns. The sidebar stays as it is. A bottom bar or a top bar is closed in the same update: its second level was in front of the page that is left, so it goes with that page.
|
|
481
457
|
- **Colour**: the selected group and all of its second level are one block of the group's colour. That is the colour of the group if one is given, otherwise the accent. The text on it is the ink or the paper that goes with this colour. The current page is the other way round: its ground is the colour of the text, and its text is the group's colour. In all three positions the list runs vertically, and the block of colour sweeps from the old row to the new one, in step with the page; the names do not move.
|
|
482
|
-
- **A group must have an icon**:
|
|
458
|
+
- **A group must have an icon**: in the bottom bar the icon is over the name, and in the others before it.
|
|
483
459
|
- **Popover direction**: `menu` and `popover` open downwards by default; they open upwards when there is not enough room below the button and there is more room above it. The arrow on the button points in the direction it will open, even before it is open, and the opening animation is pulled out from the button in that direction. The direction is decided again when the page scrolls and when the window changes.
|
|
484
460
|
- **No lines as markers**: selected, current and emphasised things are always whole blocks of colour. The selected item of `tabs`, `options` and `pagination` is a block of colour; `card` and `tile` are filled completely when a colour is given; `notice` and `sheet` are surfaces one step deeper than the ground, and `dialog` is a block of the accent; `pager` is two blocks side by side; links are in the accent and bold, with no underline.
|
|
485
461
|
|
|
486
462
|
- **Where you are**: the name of the page is the largest text on the page; in the `header`, the current page and the tab it is in are marked.
|
|
487
463
|
- **Where to go**: the `pager` at the foot of the page gives the names of the previous page and the next page. All the others are in the `header`, two taps away at most: the tab, then the page.
|
|
488
|
-
- **Where you came from**:
|
|
464
|
+
- **Where you came from**: the page you go to turns in over the one you leave, and on going back it turns out again, the way it came. When there really are levels, there is `trail`.
|
|
489
465
|
|
|
490
466
|
### Motion
|
|
491
467
|
|
|
492
468
|
**Nothing fades.** State changes instantly; a thing whose position changes moves over as a whole block, so that the eye can follow it.
|
|
493
469
|
|
|
494
|
-
- **A view change is the
|
|
495
|
-
- **
|
|
470
|
+
- **A view change is the door turning**: `Standard.turn(from, to)` says from two entries of the history whether the view turns in (the history goes on) or out (it goes back). What turns is the screen seen in the window (wherever the page is scrolled to): the new one in from the front as the old one turns on to the back, or the other way round; `navigator` and `toasts` stay in place.
|
|
471
|
+
- **The page turns away from what opens**: a `sheet`, a `dialog` and the pane of the navigator come in front of the page. The page does not slide: it turns by 15 degrees on the navigator, and the shade on it comes and goes with the turn. A page with no navigator has nothing to turn on: it slides away from a sheet by as much as the sheet slides in.
|
|
496
472
|
- **The large buttons at the bottom of a dialog**: when `dialog` is given `actions` (a list; `tile` takes the same one), the answers are large buttons side by side at the bottom, flush against the left, right and bottom edges of the dialog, with no gap between them (a little like Carbon). The primary button comes last, and is a block of the dialog's text colour with text in the colour of the dialog's ground. The others come before it, and are one step darker or lighter than the ground of the dialog. When there is only one button, it fills the bottom from edge to edge.
|
|
497
|
-
- **A dialog
|
|
473
|
+
- **A dialog on a page with no navigator**: a thin backdrop in the colour of the page's ground is laid over the page. In the light scheme this makes what is behind lighter (whiter), and in the dark scheme darker. The backdrop and the dialog appear and disappear together, and they do not fade.
|
|
498
474
|
- **State changes instantly**: in `tabs` and `options`, the selected item becomes a block of colour at once, with no colour transition.
|
|
499
|
-
- **Readouts flip**:
|
|
500
|
-
- `menu` / `popover` are “pulled” out of the button (what moves is the edge); `dialog` is lowered from above the window; `toasts`
|
|
501
|
-
- Duration tokens: `--s-quick` (parts of a control), `--s-move` (things on the page), `--s-travel` (the
|
|
475
|
+
- **Readouts flip**: `flap` is a split-flap board, as at an airport. Each cell is a drum of flaps, and a glyph is on two of them, its top half on one and its bottom half on the next, with the hinge between. When the value changes, the flaps fall one after another through every glyph between, each one hinged on the middle of the cell, in shade when it is edge on. The drum turns one way only: from 7 to 6 is by way of 8, 9 and 0 to 5. A cell that goes from a figure to a figure has a drum of the ten figures; any other has every glyph. Each cell turns by itself, so they come to rest one after another. One flap takes `--s-quick` to fall.
|
|
476
|
+
- `menu` / `popover` are “pulled” out of the button (what moves is the edge); `dialog` turns in on the navigator, or with no navigator is lowered from above the window; `toasts` are in the top corner of the window, at the end of the line, one under another with a hairline between them; each turns in on the window's edge and turns out the same way. Give each `s.notice` in it a `key`, such as the toast's id: then the one that is taken away is the one that turns out. They are over everything else in the window, always: `s.toasts` is in the browser's top layer, and is put in it again, last, whenever a sheet or a dialog opens.
|
|
477
|
+
- Duration tokens: `--s-quick` (parts of a control), `--s-move` (things on the page), `--s-travel` (a leaf of the door turning); with the system's “reduce motion” setting, all of them are 0.
|
|
478
|
+
- **Shift slows everything**: while Shift is held down, every movement in the window takes ten times as long, so that it can be looked at. One that is on its way is slowed from where it is. A link of the app that is pressed with Shift down is followed in this window, not opened in a new one, so a change of view can be looked at too; a link that goes somewhere else is left to the browser. `s.page` does this.
|
|
502
479
|
|
|
503
480
|
### One interaction model
|
|
504
481
|
|
|
@@ -513,5 +490,5 @@ All the components share one `.control` in the stylesheet, so the mouse, the fin
|
|
|
513
490
|
|
|
514
491
|
### Still Swiss Style
|
|
515
492
|
|
|
516
|
-
The stylesheet holds the same line as `Standard`: no
|
|
493
|
+
The stylesheet holds the same line as `Standard`: no shadows, no centred text. The only curves are the true circles of the line roundels and of the station markers.
|
|
517
494
|
The class names come from typed CSS Modules (and are built as `s-ui-*`); the builders take no `class` / `style`.
|
package/dist/Extend.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { _ as accent, n as builders, S as button, E as component, D as content, O as contents, v as gap, k as node, y as pad, b as tone } from "./Standard-BC6CfFOv.js";
|