@marianmeres/stuic 3.80.0 → 3.81.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.
@@ -38,7 +38,7 @@
38
38
  import type { AssetPreviewNormalized } from "../AssetsPreview/_internal/assets-preview-types.js";
39
39
  import AssetsPreviewInline from "../AssetsPreview/AssetsPreviewInline.svelte";
40
40
  import Button from "../Button/Button.svelte";
41
- import IconSwap from "../IconSwap/IconSwap.svelte";
41
+ import ButtonGroupRadio from "../ButtonGroupRadio/ButtonGroupRadio.svelte";
42
42
  import { bookPagesToAssets } from "./_internal/book-pages-to-assets.js";
43
43
  import Book, {
44
44
  buildSpreads,
@@ -105,15 +105,6 @@
105
105
  );
106
106
 
107
107
  const MODE_SWITCH_ICON_SIZE = 19;
108
- const modeSwitchStates = [
109
- iconBookOpen({ size: MODE_SWITCH_ICON_SIZE, strokeWidth: 2 }),
110
- iconFileImage({ size: MODE_SWITCH_ICON_SIZE, strokeWidth: 2 }),
111
- ];
112
- let modeSwitchActive = $derived(useInline ? 1 : 0);
113
-
114
- function toggleMode() {
115
- manualMode = useInline ? "book" : "inline";
116
- }
117
108
 
118
109
  let inlineAssets = $derived(useInline ? bookPagesToAssets(pages, baseUrl) : []);
119
110
 
@@ -393,17 +384,27 @@
393
384
  {/if}
394
385
  {/if}
395
386
  {#if !noModeSwitch && !forceInline && !belowThreshold && pages.length > 0}
396
- <Button
397
- type="button"
398
- iconButton
399
- class="absolute bottom-4 right-4 border-0"
400
- onclick={toggleMode}
401
- tooltip={() => ({
402
- content: useInline ? "Switch to book view" : "Switch to inline view",
387
+ <ButtonGroupRadio
388
+ size="sm"
389
+ class="absolute bottom-4 right-4 w-auto"
390
+ value={useInline ? "inline" : "book"}
391
+ options={[
392
+ {
393
+ label: iconBookOpen({ size: MODE_SWITCH_ICON_SIZE, strokeWidth: 2 }),
394
+ value: "book",
395
+ },
396
+ {
397
+ label: iconFileImage({ size: MODE_SWITCH_ICON_SIZE, strokeWidth: 2 }),
398
+ value: "inline",
399
+ },
400
+ ]}
401
+ buttonProps={(i) => ({
402
+ tooltip: () => ({ content: i === 0 ? "Book view" : "Inline view" }),
403
403
  })}
404
- >
405
- <IconSwap states={modeSwitchStates} active={modeSwitchActive} duration={200} />
406
- </Button>
404
+ onButtonClick={(i) => {
405
+ manualMode = i === 0 ? "book" : "inline";
406
+ }}
407
+ />
407
408
  {/if}
408
409
  </div>
409
410
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "3.80.0",
3
+ "version": "3.81.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && pnpm run prepack",
@@ -79,7 +79,7 @@
79
79
  "vitest": "^3.2.4"
80
80
  },
81
81
  "dependencies": {
82
- "@marianmeres/clog": "^3.18.1",
82
+ "@marianmeres/clog": "^3.19.0",
83
83
  "@marianmeres/cron": "^2.0.0",
84
84
  "@marianmeres/design-tokens": "^1.4.1",
85
85
  "@marianmeres/icons-fns": "^5.0.0",
@@ -88,7 +88,7 @@
88
88
  "@marianmeres/parse-boolean": "^2.1.0",
89
89
  "@marianmeres/ticker": "^1.17.1",
90
90
  "@marianmeres/tree": "^2.3.0",
91
- "libphonenumber-js": "^1.13.0",
91
+ "libphonenumber-js": "^1.13.1",
92
92
  "runed": "^0.23.4",
93
93
  "tailwind-merge": "^3.6.0"
94
94
  }