openguessr-ui 0.2.1 → 0.2.3

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 CHANGED
@@ -242,6 +242,7 @@ The popup component is used for dialogs. It takes the following props:
242
242
  - `open`: Whether the popup is open
243
243
  - `slim`: Reduces the max width
244
244
  - `verySlim`: Reduces the max width further
245
+ - `ultraSlim`: Reduces the max width even further
245
246
  - `frameless`: Reduces the padding, e.g. for iframes
246
247
  - `onuserclose`: Called when the user closes the popup
247
248
 
@@ -400,6 +401,14 @@ The title separator component is used to separate content inside popups or conta
400
401
  - `noMargin`: Removes the default top and bottom margin (`--layout-margin`)
401
402
  - `class`: Class passthrough
402
403
 
404
+ ### ExperimentSign
405
+
406
+ The experiment sign is a sign that should be placed on the main page of an experimental OpenGuessr project. For the "Learn more" to work, the ConfirmPopup has to be mounted. The sign takes the following props:
407
+
408
+ - `class`: Class passthrough
409
+
410
+ It's typically placed in the lower left-hand corner with spacing of `--layout-margin` towards the edges.
411
+
403
412
  ## Attachments
404
413
 
405
414
  Attachments utilize Svelte's `{@attach...}` syntax.
@@ -446,6 +455,8 @@ new Audio(sounds.basic_button).play();
446
455
  | item_select | Selecting an item (e.g. a pin, badge, or flag) |
447
456
  | item_locked | Trying to select a locked item |
448
457
 
458
+ No sound should be played for lightweight actions such as clicks on links or tiny "X" buttons that lack standard button styling (like the one used in the persistent tooltip).
459
+
449
460
  The components don't play sounds themselves. Instead, they should be played via callbacks:
450
461
 
451
462
  - Collapsible `ontoggle`: `toggle_button`
package/base.css CHANGED
@@ -8,11 +8,11 @@
8
8
  *,
9
9
  *::before,
10
10
  *::after {
11
- box-sizing: border-box;
11
+ box-sizing: border-box;
12
12
  }
13
13
 
14
- /* This UI library is for games, not sites, double-tap to zoom or drag down to refresh are not wanted */
15
14
  html {
15
+ /* This UI library is for games, not sites, double-tap to zoom or drag down to refresh are not wanted */
16
16
  overscroll-behavior: none;
17
17
  touch-action: none;
18
18
  }
@@ -0,0 +1,59 @@
1
+ <script>
2
+ import { showConfirmPopup } from "../confirmPopup.svelte.js";
3
+ import experimentStars from "../images/experiment_stars.png";
4
+
5
+ let { class: classes } = $props();
6
+ </script>
7
+
8
+ <div class="sign {classes}">
9
+ <img alt="stars" src={experimentStars} class="stars" />
10
+ <h3>Experiment</h3>
11
+ <p class="subtitle">
12
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
13
+ An OpenGuessr experiment.
14
+ <span
15
+ role="button"
16
+ class="learn-more"
17
+ tabindex="0"
18
+ onclick={() =>
19
+ showConfirmPopup(
20
+ "Experiment",
21
+ "Experiments are new ideas brought to life with help from artificial intelligence and built upon the robust foundations of OpenGuessr.",
22
+ )}>Learn more</span
23
+ >.
24
+ </p>
25
+ </div>
26
+
27
+ <style>
28
+ .sign {
29
+ background-color: var(--panel-color);
30
+ box-shadow: var(--panel-shadow);
31
+ border-radius: var(--layout-margin);
32
+ padding: var(--layout-margin);
33
+ contain: layout;
34
+ display: flex;
35
+ flex-direction: column;
36
+ gap: var(--content-margin);
37
+ backdrop-filter: blur(var(--normal-blur));
38
+ }
39
+
40
+ .stars {
41
+ position: absolute;
42
+ width: 150px;
43
+ height: 150px;
44
+ top: -73px;
45
+ right: -35px;
46
+ pointer-events: none;
47
+ user-select: none;
48
+ }
49
+
50
+ .subtitle {
51
+ opacity: 0.5;
52
+ padding-right: var(--box-margin);
53
+ }
54
+
55
+ .learn-more {
56
+ text-decoration: underline;
57
+ cursor: pointer;
58
+ }
59
+ </style>
@@ -8,7 +8,7 @@
8
8
  import { backOut } from "svelte/easing";
9
9
  import { fade, scale } from "svelte/transition";
10
10
 
11
- let { children, frameless, slim, verySlim, open = $bindable(false), onuserclose } = $props();
11
+ let { children, frameless, slim, verySlim, ultraSlim, open = $bindable(false), onuserclose } = $props();
12
12
 
13
13
  let zIndex = $state(0);
14
14
 
@@ -65,7 +65,7 @@
65
65
  class="ui-window"
66
66
  transition:scale={{ easing: backOut, duration: 250, start: 0.9 }}
67
67
  class:frame-less={frameless}
68
- style:max-width={verySlim ? "600px" : slim ? "750px" : "850px"}
68
+ style:max-width={ultraSlim ? "450px" : verySlim ? "600px" : slim ? "750px" : "850px"}
69
69
  >
70
70
  <button class="close-popup-button standard-button bright" aria-label="close" onclick={close}
71
71
  ><X strokeWidth={2.25} /></button
@@ -102,7 +102,6 @@
102
102
  }
103
103
 
104
104
  /* Compact in-box variant, plus the button */
105
-
106
105
  .segmented-input-box-compact .segment-input::placeholder {
107
106
  font-size: 18px;
108
107
  }
Binary file
package/index.js CHANGED
@@ -10,6 +10,7 @@ export { default as RoomCodeInput } from "./components/RoomCodeInput.svelte";
10
10
  export { default as Tabs } from "./components/Tabs.svelte";
11
11
  export { default as Ticker } from "./components/Ticker.svelte";
12
12
  export { default as TitleSeparator } from "./components/TitleSeparator.svelte";
13
+ export { default as ExperimentSign } from "./components/ExperimentSign.svelte";
13
14
  export { tooltip } from "./tooltip.svelte.js";
14
15
  export { showNotification } from "./notifications.svelte.js";
15
16
  export { showConfirmPopup } from "./confirmPopup.svelte.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openguessr-ui",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite example"
@@ -14,6 +14,7 @@
14
14
  "components",
15
15
  "fonts",
16
16
  "vector-graphics",
17
+ "images",
17
18
  "sound-effects",
18
19
  "variables.css",
19
20
  "base.css",