openguessr-ui 0.1.0 → 0.1.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/README.md +18 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,9 +13,9 @@ These core concepts define how UI should be structured.
|
|
|
13
13
|
|
|
14
14
|
### Core concepts
|
|
15
15
|
|
|
16
|
-
- **Boxes:** Boxes house controls, text, or other boxes.
|
|
16
|
+
- **Boxes:** Boxes house controls, text, images, or other boxes.
|
|
17
17
|
|
|
18
|
-
- **Panels:** Panels are
|
|
18
|
+
- **Panels:** Panels are used for floating UI. They typically include controls rather than loads of text or images, perfect for HUDs.
|
|
19
19
|
|
|
20
20
|
- **Containers:** Containers contain boxes. The popup acts as a layout/container hybird that also contains boxes.
|
|
21
21
|
|
|
@@ -23,7 +23,7 @@ These core concepts define how UI should be structured.
|
|
|
23
23
|
|
|
24
24
|
### Hierarchy
|
|
25
25
|
|
|
26
|
-
1. Every element starts in layout space (level 1), where `--layout-margin` defines the spacing between grouped elements
|
|
26
|
+
1. Every element starts in layout space (level 1), where `--layout-margin` defines the spacing between grouped elements, the padding, and the border radii of children. For separating unrelated elements, `--layout-spacer` is used.
|
|
27
27
|
|
|
28
28
|
2. The second level is containers, where the spacing and padding is `--box-margin`, and the border radii of children are as well.
|
|
29
29
|
|
|
@@ -31,7 +31,7 @@ These core concepts define how UI should be structured.
|
|
|
31
31
|
|
|
32
32
|
4. On the fourth level there is either content or smaller boxes. Smaller boxes still use `--box-margin` for padding and spacing, but `--content-margin` for border radii.
|
|
33
33
|
|
|
34
|
-
The content level (inside buttons, chips, tabs, or other controls) uses spacing of `--content-margin`. Placing content directly into layouts or containers is not allowed, it
|
|
34
|
+
The content level (inside buttons, chips, tabs, or other controls) uses spacing of `--content-margin`. Placing content directly into layouts or containers is not allowed, it needs to sit inside a box or panel.
|
|
35
35
|
|
|
36
36
|
Popups take some properties from layouts and some from containers. They use `--layout-margin` for spacing, but content inside them is boxes (level 3) with `--box-margin` for border radii. Panels typically live in layout space (level 1), but have unique spacing rules (as outlined above).
|
|
37
37
|
|
|
@@ -64,20 +64,20 @@ These variables are used for colors:
|
|
|
64
64
|
| --overlay-color | Dark overlays |
|
|
65
65
|
| --overlay-color-dark | Full-screen menu overlays |
|
|
66
66
|
| --bright-green-color | Experience, perks |
|
|
67
|
-
| --bright-green-color-soft| Indicators
|
|
67
|
+
| --bright-green-color-soft| Indicators |
|
|
68
68
|
| --bright-green-color-dark | Experience, perk backgrounds |
|
|
69
69
|
| --background-color | Opaque background |
|
|
70
70
|
| --dark-shadow-color | Text or drop shadows |
|
|
71
71
|
|
|
72
72
|
> [!TIP]
|
|
73
|
-
> There should be at most one `--brand-color` element visible at a time (the primary action). Green colors should
|
|
73
|
+
> There should be at most one `--brand-color` element visible at a time (the primary action). Green colors should not be used for success, use bright styling instead (e.g. `rgba(255, 255, 255, 0.2)`).
|
|
74
74
|
|
|
75
75
|
These variabels are used for box shadows:
|
|
76
76
|
|
|
77
77
|
| Variable | Used for |
|
|
78
78
|
| -------- | ------- |
|
|
79
79
|
| --button-shadow | Buttons |
|
|
80
|
-
| --button-shadow-dark |
|
|
80
|
+
| --button-shadow-dark | Dark buttons |
|
|
81
81
|
| --box-shadow-top | Boxes that fade out towards the bottom |
|
|
82
82
|
| --box-shadow-bottom | Boxes that fade out towards the top |
|
|
83
83
|
| --box-shadow | Boxes |
|
|
@@ -108,7 +108,7 @@ Boxes typically use this base styling:
|
|
|
108
108
|
}
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
-
Their width
|
|
111
|
+
Their width shouldn't grow to fit the container or Popup they are in.
|
|
112
112
|
|
|
113
113
|
#### Text inside boxes
|
|
114
114
|
|
|
@@ -169,7 +169,7 @@ Layouts typically use this base styling:
|
|
|
169
169
|
|
|
170
170
|
### Buttons
|
|
171
171
|
|
|
172
|
-
Buttons should always be placed in a box or panel, not just on a blank page. Large buttons
|
|
172
|
+
Buttons should always be placed in a box or panel, not just on a blank page. Large buttons shouldn't be put into a box.
|
|
173
173
|
|
|
174
174
|
To create a button, apply the `standard-button` class. This will create a red primary button. To make it secondary, add `bright`.
|
|
175
175
|
|
|
@@ -181,7 +181,7 @@ Large buttons with short text inside often look unnaturally slim when placed as
|
|
|
181
181
|
|
|
182
182
|
Regular buttons typically have the icon placed on the left side.
|
|
183
183
|
|
|
184
|
-
Large buttons with text place the icon towards the right and use `space-between` to ensure that when multiple buttons are present, icons and text are perfectly aligned
|
|
184
|
+
Large buttons with text place the icon towards the right and use `space-between` to ensure that when multiple buttons are present in a stack, icons and text are perfectly horizontally aligned, making it easier to scan through them at a glance.
|
|
185
185
|
|
|
186
186
|
### Icons
|
|
187
187
|
|
|
@@ -263,7 +263,7 @@ The chip component is used for small pieces of information, such as a "New" or "
|
|
|
263
263
|
- `italic`: Makes the text italic, typically combined with red
|
|
264
264
|
- `mutedOpacity`: Makes the text muted, red variant typically disables this
|
|
265
265
|
- `onclick`: Makes the chip clickable
|
|
266
|
-
- `class`, `style`: Class passthrough
|
|
266
|
+
- `class`, `style`: Class and style passthrough
|
|
267
267
|
|
|
268
268
|
### Collapsible
|
|
269
269
|
|
|
@@ -361,7 +361,7 @@ The room code input component is used for entering 6-character room codes. It ta
|
|
|
361
361
|
|
|
362
362
|
- `segments`: The entered characters
|
|
363
363
|
- `inPage`: Set to false when used in panels, boxes etc.
|
|
364
|
-
- `onsubmit`: Called with the code when enter or the submit button is pressed
|
|
364
|
+
- `onsubmit`: Called with the code when the enter or the submit button is pressed
|
|
365
365
|
|
|
366
366
|
### Tabs
|
|
367
367
|
|
|
@@ -411,6 +411,8 @@ Usage example:
|
|
|
411
411
|
<button {@attach tooltip({ text: "Settings" })}><GearsIcon /></button>
|
|
412
412
|
```
|
|
413
413
|
|
|
414
|
+
Options:
|
|
415
|
+
|
|
414
416
|
- `text`: The tooltip text
|
|
415
417
|
- `imageSrc`: Image shown above the text
|
|
416
418
|
- `imageAspectRatio`: Aspect ratio of the image
|
|
@@ -434,12 +436,12 @@ import basicButtonSound from "openguessr-ui/sound-effects/basic_button.ogg";
|
|
|
434
436
|
| basic_button | Default sound for standard buttons and tabs |
|
|
435
437
|
| juicy_button | Selection-like choices (e.g. map selection) |
|
|
436
438
|
| start_button | Starting or joining a game |
|
|
437
|
-
| toggle_button | Anything that toggles
|
|
438
|
-
| change_value | Changing a value
|
|
439
|
-
| item_select | Selecting an item
|
|
439
|
+
| toggle_button | Anything that toggles (e.g. collapsibles) |
|
|
440
|
+
| change_value | Changing a value (e.g. through a ticker) |
|
|
441
|
+
| item_select | Selecting an item (e.g. a pin, badge, or flag) |
|
|
440
442
|
| item_locked | Trying to select a locked item |
|
|
441
443
|
|
|
442
|
-
The components don't play sounds themselves. Instead,
|
|
444
|
+
The components don't play sounds themselves. Instead, they should be played via callbacks:
|
|
443
445
|
|
|
444
446
|
- Collapsible `ontoggle`: `toggle_button`
|
|
445
447
|
- Ticker `onchange`: `change_value`
|