@sanity/themer 0.5.0 → 0.6.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/dist/tool.js CHANGED
@@ -1,16 +1,17 @@
1
+ import "@sanity/themer/bundle.css";
1
2
  import { a as DEFAULT_BACKGROUND, c as resolveThemeOptions, d as hslToHex, f as relativeLuminance, i as DEFAULT_ACCENT, l as isColor, n as buildTheme, o as SCHEMES, r as buildPalette, s as deriveTextColor, t as presets, u as hexToHsl } from "./presets-CqBgS3A-.js";
2
- import { c } from "react-compiler-runtime";
3
+ import { c } from "react/compiler-runtime";
3
4
  import { definePlugin, useColorSchemeValue } from "sanity";
4
- import { Badge, Box, Button, Card, Dialog, Flex, Layer, Stack, Text, TextInput, ThemeProvider, useRootTheme, useTheme_v2 } from "@sanity/ui";
5
+ import { Badge, Box, Button, Card, Dialog, Flex, Layer, Stack, Text, TextInput, ThemeProvider, useMediaIndex, useRootTheme, useTheme_v2 } from "@sanity/ui";
5
6
  import { useActor, useSelector } from "@xstate/react";
6
- import { createContext, useContext, useEffect, useRef, useState } from "react";
7
- import { assign, not, setup } from "xstate";
8
- import { styled } from "styled-components";
7
+ import { Activity, ViewTransition, addTransitionType, createContext, startTransition, useContext, useEffect, useRef, useState } from "react";
8
+ import { assign, not, setup, stateIn } from "xstate";
9
9
  import { ArrowLeftIcon } from "@sanity/icons/ArrowLeft";
10
10
  import { CloseIcon } from "@sanity/icons/Close";
11
11
  import { CodeBlockIcon } from "@sanity/icons/CodeBlock";
12
12
  import { SplitVerticalIcon } from "@sanity/icons/SplitVertical";
13
13
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
+ import { assignInlineVars } from "@vanilla-extract/dynamic";
14
15
  import { ResetIcon } from "@sanity/icons/Reset";
15
16
  import { TrashIcon } from "@sanity/icons/Trash";
16
17
  import { SparklesIcon } from "@sanity/icons/Sparkles";
@@ -19,10 +20,14 @@ import { ImageIcon } from "@sanity/icons/Image";
19
20
  import { useToast } from "@sanity/ui/toast";
20
21
  import { AddIcon } from "@sanity/icons/Add";
21
22
  import { RestoreIcon } from "@sanity/icons/Restore";
23
+ import { MotionConfig, Reorder, useDragControls } from "motion/react";
24
+ import { ArrowDownIcon } from "@sanity/icons/ArrowDown";
25
+ import { ArrowUpIcon } from "@sanity/icons/ArrowUp";
22
26
  import { CopyIcon } from "@sanity/icons/Copy";
23
27
  import { EditIcon } from "@sanity/icons/Edit";
24
28
  import { EllipsisHorizontalIcon } from "@sanity/icons/EllipsisHorizontal";
25
29
  import { Menu, MenuButton, MenuDivider, MenuItem } from "@sanity/ui/menu";
30
+ import scrollIntoView from "scroll-into-view-if-needed";
26
31
  import { ClipboardIcon } from "@sanity/icons/Clipboard";
27
32
  import { Code } from "@sanity/ui/code";
28
33
  import { registerLanguage } from "react-refractor";
@@ -72,14 +77,17 @@ function sameScheme(a, b) {
72
77
  const initialThemerState = {
73
78
  active: null,
74
79
  custom: [],
75
- removed: []
80
+ removed: [],
81
+ order: []
76
82
  };
77
83
  /**
78
84
  * Resolves the list of themes: the configured theme first, then the presets
79
85
  * (minus the ones that would only repeat the configured theme), then the
80
- * user's own themes. Removed themes are set aside so they can be restored,
81
- * and the active theme falls back to the configured one when its slug no
82
- * longer resolves.
86
+ * user's own themes — rearranged into the order the user dragged them into,
87
+ * with themes that order does not know about kept in that default order after
88
+ * the ones it does. Removed themes are set aside so they can be restored, and
89
+ * the active theme falls back to the configured one when its slug no longer
90
+ * resolves.
83
91
  *
84
92
  * @internal
85
93
  */
@@ -103,6 +111,8 @@ function resolveThemes(state, baseOptions) {
103
111
  source: "custom",
104
112
  ...theme.palette ? { palette: theme.palette } : {}
105
113
  });
114
+ let position = new Map(state.order.map((slug, index) => [slug, index])), rank = (theme) => position.get(theme.slug) ?? state.order.length;
115
+ all.sort((a, b) => rank(a) - rank(b));
106
116
  let removedSlugs = new Set(state.removed), themes = all.filter((theme) => !removedSlugs.has(theme.slug));
107
117
  return {
108
118
  themes,
@@ -219,6 +229,10 @@ const themerMachine = setup({
219
229
  removed: [...context.removed, params.slug]
220
230
  }),
221
231
  restore: assign(({ context }, params) => ({ removed: context.removed.filter((slug) => slug !== params.slug) })),
232
+ reorder: assign(({ context }, params) => {
233
+ let listed = new Set(themesOf(context).themes.map((theme) => theme.slug)), order = params.order.filter((slug) => listed.has(slug));
234
+ return { order: [...order, ...context.order.filter((slug) => !order.includes(slug))] };
235
+ }),
222
236
  delete: assign(({ context }, params) => {
223
237
  if (!context.custom.some((theme) => theme.slug === params.slug)) return {};
224
238
  let { [params.slug]: _deleted, ...images } = context.images;
@@ -254,7 +268,14 @@ const themerMachine = setup({
254
268
  initial: "single",
255
269
  states: {
256
270
  single: { on: { "preview.toggle": "split" } },
257
- split: { on: { "preview.toggle": "single" } }
271
+ split: { on: {
272
+ "preview.toggle": "single",
273
+ "sidebar.close": "single",
274
+ "sidebar.toggle": {
275
+ guard: stateIn({ sidebar: "open" }),
276
+ target: "single"
277
+ }
278
+ } }
258
279
  }
259
280
  },
260
281
  flow: {
@@ -316,6 +337,10 @@ const themerMachine = setup({
316
337
  type: "delete",
317
338
  params: ({ event }) => ({ slug: event.slug })
318
339
  } },
340
+ "theme.reorder": { actions: {
341
+ type: "reorder",
342
+ params: ({ event }) => ({ order: event.order })
343
+ } },
319
344
  "flow.list": ".list",
320
345
  "flow.removed": {
321
346
  target: ".removed",
@@ -341,22 +366,29 @@ const themerMachine = setup({
341
366
  });
342
367
  /** The part of the machine context that is persisted between sessions @internal */
343
368
  function selectStoredState(snapshot) {
344
- let { active, custom, removed } = snapshot.context;
369
+ let { active, custom, removed, order } = snapshot.context;
345
370
  return {
346
371
  active,
347
372
  custom,
348
- removed
373
+ removed,
374
+ order
349
375
  };
350
376
  }
351
- const Root$2 = styled(Box).withConfig({
352
- displayName: "Root",
353
- componentId: "sc-6lslk9-0"
354
- })`scrollbar-gutter:stable;`, ScrollAreaInsetContext = createContext({
377
+ var root$2 = "_1o50s7t0";
378
+ const ScrollAreaInsetContext = createContext({
355
379
  left: 0,
356
380
  right: 0,
357
381
  bottom: 0
358
382
  });
359
383
  /**
384
+ * The gutter the last scroll area measured. It is the same for every scroll
385
+ * area (the reserved gutter does not depend on the content), so the next one
386
+ * starts out with the right padding instead of shifting after its first
387
+ * measurement — which would also throw off anything scrolling into view as
388
+ * the content mounts.
389
+ */
390
+ let lastGutter = 0;
391
+ /**
360
392
  * The scrolling body of a sidebar flow. It always reserves the scrollbar's
361
393
  * space, so the content does not shift when the list grows or shrinks past
362
394
  * the point where it needs to scroll — and it takes that space out of its
@@ -366,11 +398,13 @@ const Root$2 = styled(Box).withConfig({
366
398
  * @internal
367
399
  */
368
400
  function ScrollArea(props) {
369
- let $ = c(15), { children, padding } = props, { space } = useTheme_v2(), ref = useRef(null), [gutter, setGutter] = useState(0), t0, t1;
401
+ let $ = c(15), { children, padding } = props, { space } = useTheme_v2(), ref = useRef(null), [gutter, setGutter] = useState(_temp$7), t0, t1;
370
402
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => {
371
403
  let element = ref.current;
372
404
  if (!element) return;
373
- let measure = () => setGutter(element.offsetWidth - element.clientWidth);
405
+ let measure = () => {
406
+ lastGutter = element.offsetWidth - element.clientWidth, setGutter(lastGutter);
407
+ };
374
408
  measure();
375
409
  let observer = new ResizeObserver(measure);
376
410
  return observer.observe(element), () => observer.disconnect();
@@ -389,7 +423,8 @@ function ScrollArea(props) {
389
423
  children
390
424
  }), $[8] = children, $[9] = inset, $[10] = t7) : t7 = $[10];
391
425
  let t8;
392
- return $[11] !== padding || $[12] !== t6 || $[13] !== t7 ? (t8 = /* @__PURE__ */ jsx(Root$2, {
426
+ return $[11] !== padding || $[12] !== t6 || $[13] !== t7 ? (t8 = /* @__PURE__ */ jsx(Box, {
427
+ className: root$2,
393
428
  flex: 1,
394
429
  overflow: "auto",
395
430
  padding,
@@ -398,6 +433,9 @@ function ScrollArea(props) {
398
433
  children: t7
399
434
  }), $[11] = padding, $[12] = t6, $[13] = t7, $[14] = t8) : t8 = $[14], t8;
400
435
  }
436
+ function _temp$7() {
437
+ return lastGutter;
438
+ }
401
439
  /**
402
440
  * Content that runs edge to edge in a scroll area — up to the scrollbar —
403
441
  * instead of sitting inside its padding. It goes last: it runs down to the
@@ -418,15 +456,27 @@ function ScrollAreaBleed(props) {
418
456
  children: props.children
419
457
  }), $[4] = props.children, $[5] = t3, $[6] = t4) : t4 = $[6], t4;
420
458
  }
421
- /**
422
- * The dark scheme covers the right side of the preview behind a diagonal cut,
423
- * like the "Auto" appearance preview in macOS System Settings shows both
424
- * schemes at once.
425
- */
426
- const Root$1 = styled.div.withConfig({
427
- displayName: "Root",
428
- componentId: "sc-w55yz9-0"
429
- })`position:relative;aspect-ratio:16 / 9;overflow:hidden;`, LIST_ROWS = [
459
+ var avatar = "_1aa9huuh", body = "_1aa9huui", button = "_1aa9huuq", colors = {
460
+ bg: "var(--_1aa9huu0)",
461
+ fg: "var(--_1aa9huu1)",
462
+ mutedFg: "var(--_1aa9huu2)",
463
+ border: "var(--_1aa9huu3)",
464
+ accent: "var(--_1aa9huu4)",
465
+ avatar: "var(--_1aa9huu5)",
466
+ selectedBg: "var(--_1aa9huu6)",
467
+ selectedFg: "var(--_1aa9huu7)",
468
+ inputBg: "var(--_1aa9huu8)",
469
+ inputBorder: "var(--_1aa9huu9)"
470
+ }, field = "_1aa9huun", footer = "_1aa9huup", form = "_1aa9huum", input = "_1aa9huuo", line = {
471
+ fg: "_1aa9huus _1aa9huur",
472
+ muted: "_1aa9huut _1aa9huur",
473
+ selected: "_1aa9huuu _1aa9huur"
474
+ }, list = "_1aa9huuj", listRow = "_1aa9huuk", logo = "_1aa9huuf", navbar = "_1aa9huue", pane = "_1aa9huul", root$1 = "_1aa9huua", spacer = "_1aa9huug", studio = {
475
+ light: "_1aa9huub",
476
+ dark: "_1aa9huud _1aa9huub"
477
+ };
478
+ /** The document rows in the list pane — the widths of their title lines */
479
+ const LIST_ROWS = [
430
480
  "62%",
431
481
  "46%",
432
482
  "70%",
@@ -447,7 +497,7 @@ function ThemePreview(props) {
447
497
  let $ = c(11), { options } = props, t0;
448
498
  $[0] === options ? t0 = $[1] : (t0 = buildTheme(options), $[0] = options, $[1] = t0);
449
499
  let theme = t0, t1;
450
- $[2] === Symbol.for("react.memo_cache_sentinel") ? (t1 = /* @__PURE__ */ jsx(MockStudio, {}), $[2] = t1) : t1 = $[2];
500
+ $[2] === Symbol.for("react.memo_cache_sentinel") ? (t1 = /* @__PURE__ */ jsx(MockStudio, { scheme: "light" }), $[2] = t1) : t1 = $[2];
451
501
  let t2;
452
502
  $[3] === theme ? t2 = $[4] : (t2 = /* @__PURE__ */ jsx(ThemeProvider, {
453
503
  scheme: "light",
@@ -456,7 +506,7 @@ function ThemePreview(props) {
456
506
  children: t1
457
507
  }), $[3] = theme, $[4] = t2);
458
508
  let t3;
459
- $[5] === Symbol.for("react.memo_cache_sentinel") ? (t3 = /* @__PURE__ */ jsx(MockStudio, { style: { clipPath: "polygon(58% 0, 100% 0, 100% 100%, 42% 100%)" } }), $[5] = t3) : t3 = $[5];
509
+ $[5] === Symbol.for("react.memo_cache_sentinel") ? (t3 = /* @__PURE__ */ jsx(MockStudio, { scheme: "dark" }), $[5] = t3) : t3 = $[5];
460
510
  let t4;
461
511
  $[6] === theme ? t4 = $[7] : (t4 = /* @__PURE__ */ jsx(ThemeProvider, {
462
512
  scheme: "dark",
@@ -465,178 +515,91 @@ function ThemePreview(props) {
465
515
  children: t3
466
516
  }), $[6] = theme, $[7] = t4);
467
517
  let t5;
468
- return $[8] !== t2 || $[9] !== t4 ? (t5 = /* @__PURE__ */ jsxs(Root$1, {
518
+ return $[8] !== t2 || $[9] !== t4 ? (t5 = /* @__PURE__ */ jsxs("div", {
469
519
  "aria-hidden": !0,
520
+ className: root$1,
470
521
  children: [t2, t4]
471
522
  }), $[8] = t2, $[9] = t4, $[10] = t5) : t5 = $[10], t5;
472
523
  }
473
524
  function MockStudio(props) {
474
- let $ = c(53), { color } = useTheme_v2(), primary = color.button.default.primary.enabled, selected = color.selectable.default.selected, input = color.input.default.enabled, border = `1px solid ${color.border}`, line = _temp$4, t0;
475
- $[0] !== color.bg || $[1] !== props.style ? (t0 = {
476
- position: "absolute",
477
- inset: 0,
478
- display: "flex",
479
- flexDirection: "column",
480
- background: color.bg,
481
- ...props.style
482
- }, $[0] = color.bg, $[1] = props.style, $[2] = t0) : t0 = $[2];
483
- let t1;
484
- $[3] === border ? t1 = $[4] : (t1 = {
485
- flex: "none",
486
- display: "flex",
487
- alignItems: "center",
488
- gap: 5,
489
- height: "18%",
490
- padding: "0 5%",
491
- borderBottom: border
492
- }, $[3] = border, $[4] = t1);
525
+ let $ = c(19), { scheme } = props, { color } = useTheme_v2(), selected = color.selectable.default.selected, inputColor = color.input.default.enabled, t0 = studio[scheme], t1;
526
+ $[0] !== color.avatar.blue.bg || $[1] !== color.bg || $[2] !== color.border || $[3] !== color.button.default.primary.enabled.bg || $[4] !== color.fg || $[5] !== color.muted.fg || $[6] !== inputColor.bg || $[7] !== inputColor.border || $[8] !== selected.bg || $[9] !== selected.fg ? (t1 = assignInlineVars({
527
+ [colors.bg]: color.bg,
528
+ [colors.fg]: color.fg,
529
+ [colors.mutedFg]: color.muted.fg,
530
+ [colors.border]: color.border,
531
+ [colors.accent]: color.button.default.primary.enabled.bg,
532
+ [colors.avatar]: color.avatar.blue.bg,
533
+ [colors.selectedBg]: selected.bg,
534
+ [colors.selectedFg]: selected.fg,
535
+ [colors.inputBg]: inputColor.bg,
536
+ [colors.inputBorder]: inputColor.border
537
+ }), $[0] = color.avatar.blue.bg, $[1] = color.bg, $[2] = color.border, $[3] = color.button.default.primary.enabled.bg, $[4] = color.fg, $[5] = color.muted.fg, $[6] = inputColor.bg, $[7] = inputColor.border, $[8] = selected.bg, $[9] = selected.fg, $[10] = t1) : t1 = $[10];
493
538
  let t2;
494
- $[5] === primary.bg ? t2 = $[6] : (t2 = /* @__PURE__ */ jsx("div", { style: {
495
- flex: "none",
496
- width: 8,
497
- height: 8,
498
- borderRadius: 2,
499
- background: primary.bg
500
- } }), $[5] = primary.bg, $[6] = t2);
539
+ $[11] === Symbol.for("react.memo_cache_sentinel") ? (t2 = /* @__PURE__ */ jsx("div", { className: logo }), $[11] = t2) : t2 = $[11];
501
540
  let t3;
502
- $[7] === color.fg ? t3 = $[8] : (t3 = /* @__PURE__ */ jsx("div", { style: line("22%", color.fg) }), $[7] = color.fg, $[8] = t3);
503
- let t4;
504
- $[9] === Symbol.for("react.memo_cache_sentinel") ? (t4 = /* @__PURE__ */ jsx("div", { style: { flex: 1 } }), $[9] = t4) : t4 = $[9];
505
- let t5;
506
- $[10] === color.avatar.blue.bg ? t5 = $[11] : (t5 = /* @__PURE__ */ jsx("div", { style: {
507
- flex: "none",
508
- width: 8,
509
- height: 8,
510
- borderRadius: "50%",
511
- background: color.avatar.blue.bg
512
- } }), $[10] = color.avatar.blue.bg, $[11] = t5);
513
- let t6;
514
- $[12] !== t1 || $[13] !== t2 || $[14] !== t3 || $[15] !== t5 ? (t6 = /* @__PURE__ */ jsxs("div", {
515
- style: t1,
541
+ $[12] === Symbol.for("react.memo_cache_sentinel") ? (t3 = /* @__PURE__ */ jsxs("div", {
542
+ className: navbar,
516
543
  children: [
517
544
  t2,
518
- t3,
519
- t4,
520
- t5
545
+ /* @__PURE__ */ jsx("div", {
546
+ className: line.fg,
547
+ style: { width: "22%" }
548
+ }),
549
+ /* @__PURE__ */ jsx("div", { className: spacer }),
550
+ /* @__PURE__ */ jsx("div", { className: avatar })
521
551
  ]
522
- }), $[12] = t1, $[13] = t2, $[14] = t3, $[15] = t5, $[16] = t6) : t6 = $[16];
552
+ }), $[12] = t3) : t3 = $[12];
553
+ let t4;
554
+ $[13] === Symbol.for("react.memo_cache_sentinel") ? (t4 = /* @__PURE__ */ jsx("div", {
555
+ className: list,
556
+ children: LIST_ROWS.map(_temp$6)
557
+ }), $[13] = t4) : t4 = $[13];
558
+ let t5;
559
+ $[14] === Symbol.for("react.memo_cache_sentinel") ? (t5 = /* @__PURE__ */ jsxs("div", {
560
+ className: form,
561
+ children: [/* @__PURE__ */ jsx("div", {
562
+ className: line.fg,
563
+ style: { width: "45%" }
564
+ }), FIELDS.map(_temp2)]
565
+ }), $[14] = t5) : t5 = $[14];
566
+ let t6;
567
+ $[15] === Symbol.for("react.memo_cache_sentinel") ? (t6 = /* @__PURE__ */ jsxs("div", {
568
+ className: body,
569
+ children: [t4, /* @__PURE__ */ jsxs("div", {
570
+ className: pane,
571
+ children: [t5, /* @__PURE__ */ jsx("div", {
572
+ className: footer,
573
+ children: /* @__PURE__ */ jsx("div", { className: button })
574
+ })]
575
+ })]
576
+ }), $[15] = t6) : t6 = $[15];
523
577
  let t7;
524
- $[17] === Symbol.for("react.memo_cache_sentinel") ? (t7 = {
525
- flex: 1,
526
- display: "flex",
527
- minHeight: 0
528
- }, $[17] = t7) : t7 = $[17];
529
- let t8;
530
- $[18] === border ? t8 = $[19] : (t8 = {
531
- flex: "none",
532
- display: "flex",
533
- flexDirection: "column",
534
- width: "36%",
535
- borderRight: border
536
- }, $[18] = border, $[19] = t8);
537
- let t9;
538
- $[20] !== color.muted || $[21] !== selected ? (t9 = LIST_ROWS.map((width_0, index) => {
539
- let isSelected = index === 1;
540
- return /* @__PURE__ */ jsx("div", {
541
- style: {
542
- flex: "none",
543
- display: "flex",
544
- alignItems: "center",
545
- height: "18%",
546
- padding: "0 9%",
547
- background: isSelected ? selected.bg : void 0
548
- },
549
- children: /* @__PURE__ */ jsx("div", { style: line(width_0, isSelected ? selected.fg : color.muted.fg) })
550
- }, width_0);
551
- }), $[20] = color.muted, $[21] = selected, $[22] = t9) : t9 = $[22];
552
- let t10;
553
- $[23] !== t8 || $[24] !== t9 ? (t10 = /* @__PURE__ */ jsx("div", {
554
- style: t8,
555
- children: t9
556
- }), $[23] = t8, $[24] = t9, $[25] = t10) : t10 = $[25];
557
- let t11, t12;
558
- $[26] === Symbol.for("react.memo_cache_sentinel") ? (t11 = {
559
- flex: 1,
560
- display: "flex",
561
- flexDirection: "column",
562
- minWidth: 0
563
- }, t12 = {
564
- flex: 1,
565
- display: "flex",
566
- flexDirection: "column",
567
- gap: 7,
568
- padding: "9% 8% 0",
569
- minHeight: 0,
570
- overflow: "hidden"
571
- }, $[26] = t11, $[27] = t12) : (t11 = $[26], t12 = $[27]);
572
- let t13;
573
- $[28] === color.fg ? t13 = $[29] : (t13 = /* @__PURE__ */ jsx("div", { style: line("45%", color.fg) }), $[28] = color.fg, $[29] = t13);
574
- let t14;
575
- $[30] !== color.muted || $[31] !== input ? (t14 = FIELDS.map((width_1) => /* @__PURE__ */ jsxs("div", {
576
- style: {
577
- flex: "none",
578
- display: "flex",
579
- flexDirection: "column",
580
- gap: 3
581
- },
582
- children: [/* @__PURE__ */ jsx("div", { style: line(width_1, color.muted.fg) }), /* @__PURE__ */ jsx("div", { style: {
583
- height: 12,
584
- borderRadius: 3,
585
- background: input.bg,
586
- boxShadow: `inset 0 0 0 1px ${input.border}`
587
- } })]
588
- }, width_1)), $[30] = color.muted, $[31] = input, $[32] = t14) : t14 = $[32];
589
- let t15;
590
- $[33] !== t13 || $[34] !== t14 ? (t15 = /* @__PURE__ */ jsxs("div", {
591
- style: t12,
592
- children: [t13, t14]
593
- }), $[33] = t13, $[34] = t14, $[35] = t15) : t15 = $[35];
594
- let t16;
595
- $[36] === border ? t16 = $[37] : (t16 = {
596
- flex: "none",
597
- display: "flex",
598
- alignItems: "center",
599
- justifyContent: "flex-end",
600
- height: "20%",
601
- padding: "0 8%",
602
- borderTop: border
603
- }, $[36] = border, $[37] = t16);
604
- let t17;
605
- $[38] === primary.bg ? t17 = $[39] : (t17 = /* @__PURE__ */ jsx("div", { style: {
606
- width: "32%",
607
- height: "50%",
608
- borderRadius: 3,
609
- background: primary.bg
610
- } }), $[38] = primary.bg, $[39] = t17);
611
- let t18;
612
- $[40] !== t16 || $[41] !== t17 ? (t18 = /* @__PURE__ */ jsx("div", {
613
- style: t16,
614
- children: t17
615
- }), $[40] = t16, $[41] = t17, $[42] = t18) : t18 = $[42];
616
- let t19;
617
- $[43] !== t15 || $[44] !== t18 ? (t19 = /* @__PURE__ */ jsxs("div", {
618
- style: t11,
619
- children: [t15, t18]
620
- }), $[43] = t15, $[44] = t18, $[45] = t19) : t19 = $[45];
621
- let t20;
622
- $[46] !== t10 || $[47] !== t19 ? (t20 = /* @__PURE__ */ jsxs("div", {
623
- style: t7,
624
- children: [t10, t19]
625
- }), $[46] = t10, $[47] = t19, $[48] = t20) : t20 = $[48];
626
- let t21;
627
- return $[49] !== t0 || $[50] !== t20 || $[51] !== t6 ? (t21 = /* @__PURE__ */ jsxs("div", {
628
- style: t0,
629
- children: [t6, t20]
630
- }), $[49] = t0, $[50] = t20, $[51] = t6, $[52] = t21) : t21 = $[52], t21;
631
- }
632
- function _temp$4(width, background) {
633
- return {
634
- flex: "none",
635
- width,
636
- height: 4,
637
- borderRadius: 2,
638
- background
639
- };
578
+ return $[16] !== t0 || $[17] !== t1 ? (t7 = /* @__PURE__ */ jsxs("div", {
579
+ className: t0,
580
+ style: t1,
581
+ children: [t3, t6]
582
+ }), $[16] = t0, $[17] = t1, $[18] = t7) : t7 = $[18], t7;
583
+ }
584
+ function _temp2(width_0) {
585
+ return /* @__PURE__ */ jsxs("div", {
586
+ className: field,
587
+ children: [/* @__PURE__ */ jsx("div", {
588
+ className: line.muted,
589
+ style: { width: width_0 }
590
+ }), /* @__PURE__ */ jsx("div", { className: input })]
591
+ }, width_0);
592
+ }
593
+ function _temp$6(width, index) {
594
+ let isSelected = index === 1;
595
+ return /* @__PURE__ */ jsx("div", {
596
+ className: listRow,
597
+ "data-selected": isSelected,
598
+ children: /* @__PURE__ */ jsx("div", {
599
+ className: isSelected ? line.selected : line.muted,
600
+ style: { width }
601
+ })
602
+ }, width);
640
603
  }
641
604
  /**
642
605
  * The floating preview card of a theme: the lo-fi studio mockup on a raised,
@@ -653,6 +616,7 @@ function ThemeThumbnail(props) {
653
616
  children: /* @__PURE__ */ jsx(ThemePreview, { options: props.options })
654
617
  }), $[0] = props.options, $[1] = t0), t0;
655
618
  }
619
+ var removedThumbnail = "_1vdkp0v0";
656
620
  /**
657
621
  * The flow for restoring removed themes: the presets and custom themes the
658
622
  * user took out of the list, each with a button to put it back — and, for
@@ -669,7 +633,7 @@ function RemovedThemes() {
669
633
  gap: 3,
670
634
  children: [
671
635
  /* @__PURE__ */ jsx(Box, {
672
- style: { opacity: .6 },
636
+ className: removedThumbnail,
673
637
  children: /* @__PURE__ */ jsx(ThemeThumbnail, { options: theme.options })
674
638
  }),
675
639
  /* @__PURE__ */ jsx(Text, {
@@ -1135,7 +1099,7 @@ function useImagePalette(onPalette) {
1135
1099
  setBusy(!0);
1136
1100
  let isCurrent = () => mountedRef.current && latestPickRef.current === pick, extract = async () => {
1137
1101
  let palette = extractImagePalette(await readImagePixels(file));
1138
- isCurrent() && (Object.values(palette).every(_temp$3) ? toast.push({
1102
+ isCurrent() && (Object.values(palette).every(_temp$5) ? toast.push({
1139
1103
  status: "warning",
1140
1104
  title: "Found no colors in that image"
1141
1105
  }) : onPaletteRef.current(palette, file));
@@ -1155,9 +1119,10 @@ function useImagePalette(onPalette) {
1155
1119
  pickImage
1156
1120
  }, $[7] = busy, $[8] = pickImage, $[9] = t5) : t5 = $[9], t5;
1157
1121
  }
1158
- function _temp$3(swatch) {
1122
+ function _temp$5(swatch) {
1159
1123
  return swatch === null;
1160
1124
  }
1125
+ var paletteGrid = "_17s80v42", tile = "_17s80v44", variantButton = "_17s80v46", variantFrame = "_17s80v47", variantRow = "_17s80v45", variantScale = "var(--_17s80v41)", variantScaleBox = "_17s80v48", variantWidth = "var(--_17s80v40)";
1161
1126
  /** The swatches on display: the vibrant family over the muted one */
1162
1127
  const TILES = [
1163
1128
  "vibrant",
@@ -1166,28 +1131,7 @@ const TILES = [
1166
1131
  "muted",
1167
1132
  "lightMuted",
1168
1133
  "darkMuted"
1169
- ], PaletteGrid = styled.div.withConfig({
1170
- displayName: "PaletteGrid",
1171
- componentId: "sc-j2tqre-0"
1172
- })`display:grid;grid-template-columns:repeat(3,${24}px);grid-auto-rows:${24}px;gap:${4}px;&[data-with-image='true']{grid-template-columns:${52}px repeat(3,${24}px);}`, ImageTile = styled.img.withConfig({
1173
- displayName: "ImageTile",
1174
- componentId: "sc-j2tqre-1"
1175
- })`display:block;grid-row:span 2;width:${52}px;height:${52}px;border-radius:3px;object-fit:cover;box-shadow:inset 0 0 0 1px var(--card-border-color);`, Tile = styled.span.withConfig({
1176
- displayName: "Tile",
1177
- componentId: "sc-j2tqre-2"
1178
- })`display:block;border-radius:3px;box-shadow:inset 0 0 0 1px var(--card-border-color);&[data-empty='true']{background:repeating-linear-gradient( -45deg,transparent 0 3px,var(--card-border-color) 3px 4px );}`, VariantRow = styled.div.withConfig({
1179
- displayName: "VariantRow",
1180
- componentId: "sc-j2tqre-3"
1181
- })`display:flex;gap:${8}px;margin:0 -${12}px;padding:0 ${12}px;overflow-x:auto;scroll-snap-type:x mandatory;scroll-padding-left:${12}px;scrollbar-width:thin;`, VariantButton = styled.button.withConfig({
1182
- displayName: "VariantButton",
1183
- componentId: "sc-j2tqre-4"
1184
- })`appearance:none;flex:none;display:block;box-sizing:border-box;width:calc(var(--variant-width) + 8px);margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;text-align:center;cursor:pointer;scroll-snap-align:start;&:focus{outline:none;}`, VariantFrame = styled.span.withConfig({
1185
- displayName: "VariantFrame",
1186
- componentId: "sc-j2tqre-5"
1187
- })`display:block;box-sizing:border-box;width:calc(var(--variant-width) + 8px);height:calc(var(--variant-width) * 9 / 16 + 8px);padding:4px;border-radius:7px;overflow:hidden;transition:box-shadow 100ms;${VariantButton}:hover &{box-shadow:inset 0 0 0 2px var(--card-border-color);}${VariantButton}[aria-pressed='true'] &{box-shadow:inset 0 0 0 2px var(--card-focus-ring-color);}${VariantButton}:focus-visible &{outline:2px solid var(--card-focus-ring-color);outline-offset:-2px;}`, VariantScale = styled.span.withConfig({
1188
- displayName: "VariantScale",
1189
- componentId: "sc-j2tqre-6"
1190
- })`display:block;width:${144}px;transform:scale(var(--variant-scale));transform-origin:top left;`;
1134
+ ];
1191
1135
  /**
1192
1136
  * Takes the colors of a theme from an image, on device: the image is read
1193
1137
  * into a canvas and its palette extracted right there — nothing is uploaded.
@@ -1200,13 +1144,13 @@ const TILES = [
1200
1144
  function ImagePaletteSection(props) {
1201
1145
  let $ = c(38), { imageUrl, onPalette, onVariant, onLucky, options, palette } = props, { busy, pickImage } = useImagePalette(onPalette), [dragging, setDragging] = useState(!1), dragDepth = useRef(0), t0;
1202
1146
  $[0] !== options || $[1] !== palette ? (t0 = palette ? currentImageVariant(options, palette) : null, $[0] = options, $[1] = palette, $[2] = t0) : t0 = $[2];
1203
- let current = t0, rowRef = useRef(null), [variantWidth, setVariantWidth] = useState(58), t1;
1147
+ let current = t0, rowRef = useRef(null), [thumbnailWidth, setThumbnailWidth] = useState(58), t1;
1204
1148
  $[3] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => {
1205
1149
  let row = rowRef.current;
1206
1150
  if (!row) return;
1207
1151
  let measure = () => {
1208
1152
  let visible = row.clientWidth - 12 - 16;
1209
- setVariantWidth(Math.max(24, Math.floor(visible / 2.5) - 8));
1153
+ setThumbnailWidth(Math.max(24, Math.floor(visible / 2.5) - 8));
1210
1154
  };
1211
1155
  measure();
1212
1156
  let observer = new ResizeObserver(measure);
@@ -1224,6 +1168,7 @@ function ImagePaletteSection(props) {
1224
1168
  let t4;
1225
1169
  $[7] !== options || $[8] !== palette ? (t4 = IMAGE_PALETTE_VARIANTS.flatMap((variant) => palette[variant] === null ? [] : [{
1226
1170
  variant,
1171
+ title: IMAGE_PALETTE_TITLES[variant],
1227
1172
  options: applyImagePalette(options, palette, variant)
1228
1173
  }]), $[7] = options, $[8] = palette, $[9] = t4) : t4 = $[9], t3 = t4;
1229
1174
  }
@@ -1263,11 +1208,13 @@ function ImagePaletteSection(props) {
1263
1208
  children: [t8, t9]
1264
1209
  }), $[19] = t9, $[20] = t10);
1265
1210
  let t11;
1266
- $[21] !== busy || $[22] !== current || $[23] !== imageUrl || $[24] !== onLucky || $[25] !== onVariant || $[26] !== palette || $[27] !== pickImage || $[28] !== variantWidth || $[29] !== variants ? (t11 = palette ? /* @__PURE__ */ jsxs(Fragment, { children: [
1267
- /* @__PURE__ */ jsxs(PaletteGrid, {
1211
+ $[21] !== busy || $[22] !== current || $[23] !== imageUrl || $[24] !== onLucky || $[25] !== onVariant || $[26] !== palette || $[27] !== pickImage || $[28] !== thumbnailWidth || $[29] !== variants ? (t11 = palette ? /* @__PURE__ */ jsxs(Fragment, { children: [
1212
+ /* @__PURE__ */ jsxs("div", {
1213
+ className: paletteGrid,
1268
1214
  "data-with-image": imageUrl !== void 0,
1269
- children: [imageUrl && /* @__PURE__ */ jsx(ImageTile, {
1215
+ children: [imageUrl && /* @__PURE__ */ jsx("img", {
1270
1216
  alt: "",
1217
+ className: "_17s80v43",
1271
1218
  src: imageUrl
1272
1219
  }), TILES.map((key) => {
1273
1220
  let hex = palette[key], title = IMAGE_PALETTE_TITLES[key];
@@ -1279,7 +1226,8 @@ function ImagePaletteSection(props) {
1279
1226
  }),
1280
1227
  placement: "bottom",
1281
1228
  portal: !0,
1282
- children: /* @__PURE__ */ jsx(Tile, {
1229
+ children: /* @__PURE__ */ jsx("span", {
1230
+ className: tile,
1283
1231
  "data-empty": hex === null,
1284
1232
  style: { background: hex ?? void 0 }
1285
1233
  })
@@ -1292,26 +1240,37 @@ function ImagePaletteSection(props) {
1292
1240
  muted: !0,
1293
1241
  size: 0,
1294
1242
  children: "Pick the swatch to build the theme around"
1295
- }), /* @__PURE__ */ jsx(VariantRow, {
1243
+ }), /* @__PURE__ */ jsx("div", {
1244
+ className: variantRow,
1296
1245
  ref: rowRef,
1297
- style: {
1298
- "--variant-width": `${variantWidth}px`,
1299
- "--variant-scale": variantWidth / 144
1300
- },
1246
+ style: assignInlineVars({
1247
+ [variantWidth]: `${thumbnailWidth}px`,
1248
+ [variantScale]: String(thumbnailWidth / 144)
1249
+ }),
1301
1250
  children: variants.map((t12) => {
1302
- let { variant: variant_0, options: variantOptions } = t12;
1303
- return /* @__PURE__ */ jsxs(VariantButton, {
1251
+ let { variant: variant_0, title: title_0, options: variantOptions } = t12;
1252
+ return /* @__PURE__ */ jsxs("button", {
1304
1253
  "aria-pressed": variant_0 === current,
1254
+ className: variantButton,
1305
1255
  onClick: () => onVariant(variant_0),
1306
1256
  type: "button",
1307
- children: [/* @__PURE__ */ jsx(VariantFrame, { children: /* @__PURE__ */ jsx(VariantScale, { children: /* @__PURE__ */ jsx(ThemeThumbnail, { options: variantOptions }) }) }), /* @__PURE__ */ jsx(Box, {
1257
+ children: [/* @__PURE__ */ jsx("span", {
1258
+ className: variantFrame,
1259
+ children: /* @__PURE__ */ jsx("span", {
1260
+ className: variantScaleBox,
1261
+ children: /* @__PURE__ */ jsx(ThemeThumbnail, { options: variantOptions })
1262
+ })
1263
+ }), /* @__PURE__ */ jsx(Box, {
1264
+ as: "span",
1265
+ display: "block",
1308
1266
  paddingTop: 1,
1309
1267
  children: /* @__PURE__ */ jsx(Text, {
1310
1268
  align: "center",
1269
+ as: "span",
1311
1270
  size: 0,
1312
1271
  textOverflow: "ellipsis",
1313
1272
  weight: variant_0 === current ? "medium" : "regular",
1314
- children: IMAGE_PALETTE_TITLES[variant_0]
1273
+ children: title_0
1315
1274
  })
1316
1275
  })]
1317
1276
  }, variant_0);
@@ -1340,7 +1299,7 @@ function ImagePaletteSection(props) {
1340
1299
  tooltip: "Take the colors from an image on your device",
1341
1300
  width: "fill"
1342
1301
  })]
1343
- }), $[21] = busy, $[22] = current, $[23] = imageUrl, $[24] = onLucky, $[25] = onVariant, $[26] = palette, $[27] = pickImage, $[28] = variantWidth, $[29] = variants, $[30] = t11) : t11 = $[30];
1302
+ }), $[21] = busy, $[22] = current, $[23] = imageUrl, $[24] = onLucky, $[25] = onVariant, $[26] = palette, $[27] = pickImage, $[28] = thumbnailWidth, $[29] = variants, $[30] = t11) : t11 = $[30];
1344
1303
  let t12;
1345
1304
  $[31] !== t10 || $[32] !== t11 ? (t12 = /* @__PURE__ */ jsxs(Stack, {
1346
1305
  gap: 3,
@@ -1351,7 +1310,7 @@ function ImagePaletteSection(props) {
1351
1310
  border: !0,
1352
1311
  onDragEnter: t4,
1353
1312
  onDragLeave: t5,
1354
- onDragOver: _temp$2,
1313
+ onDragOver: _temp$4,
1355
1314
  onDrop: t6,
1356
1315
  padding: 3,
1357
1316
  radius: 3,
@@ -1359,27 +1318,33 @@ function ImagePaletteSection(props) {
1359
1318
  children: t12
1360
1319
  }), $[34] = t12, $[35] = t6, $[36] = t7, $[37] = t13) : t13 = $[37], t13;
1361
1320
  }
1362
- function _temp$2(event_0) {
1321
+ function _temp$4(event_0) {
1363
1322
  event_0.preventDefault();
1364
1323
  }
1324
+ var colorRowText = "os3rj2", range = "os3rj1", swatch = "os3rj0";
1365
1325
  const SCHEME_TITLES = {
1366
1326
  dark: "Dark mode",
1367
1327
  light: "Light mode"
1368
- }, SPLIT_HINTS = {
1369
- dark: "Shown on the right",
1370
- light: "Shown on the left"
1371
- }, SCHEME_OPTION_KEYS = [
1328
+ };
1329
+ /**
1330
+ * Where the split preview shows a scheme: the Studio's own scheme stays next
1331
+ * to the sidebar (or at the bottom, stacked on small screens), the other one
1332
+ * takes the far side
1333
+ */
1334
+ function splitHint(own, mobile) {
1335
+ return mobile ? own ? "Shown at the bottom" : "Shown at the top" : own ? "Shown on the right, next to the themer" : "Shown on the left";
1336
+ }
1337
+ const SCHEME_OPTION_KEYS = [
1372
1338
  "accent",
1373
1339
  "text",
1374
1340
  "background",
1375
1341
  "contrast"
1376
- ], Swatch = styled.input.withConfig({
1377
- displayName: "Swatch",
1378
- componentId: "sc-rahyxu-0"
1379
- })`box-sizing:border-box;flex:none;width:33px;height:33px;padding:0;border:1px solid var(--card-border-color);border-radius:4px;background:none;cursor:pointer;&::-webkit-color-swatch-wrapper{padding:0;}&::-webkit-color-swatch{border:none;border-radius:3px;}&::-moz-color-swatch{border:none;border-radius:3px;}`, Range = styled.input.withConfig({
1380
- displayName: "Range",
1381
- componentId: "sc-rahyxu-1"
1382
- })`display:block;width:100%;margin:0;accent-color:var(--card-focus-ring-color);`;
1342
+ ];
1343
+ /**
1344
+ * `<input type="color">` paints the color into a shadow-DOM swatch that brings
1345
+ * its own border and padding, which then sits inside ours as a second border.
1346
+ * Stripping that chrome leaves the themed border as the only one.
1347
+ */
1383
1348
  /**
1384
1349
  * The flow for editing one of the user's own themes: its title, a live
1385
1350
  * preview, and a card per color scheme with the accent/text/background
@@ -1390,7 +1355,7 @@ const SCHEME_TITLES = {
1390
1355
  * @internal
1391
1356
  */
1392
1357
  function ThemeEditor(props) {
1393
- let $ = c(41), { focusTitle, slug } = props, { themes, images, split, send } = useThemer(), t0;
1358
+ let $ = c(42), { focusTitle, slug } = props, { themes, images, split, mobile, send } = useThemer(), t0;
1394
1359
  if ($[0] !== slug || $[1] !== themes) {
1395
1360
  let t1;
1396
1361
  $[3] === slug ? t1 = $[4] : (t1 = (candidate) => candidate.slug === slug && candidate.source === "custom", $[3] = slug, $[4] = t1), t0 = themes.find(t1), $[0] = slug, $[1] = themes, $[2] = t0;
@@ -1435,7 +1400,7 @@ function ThemeEditor(props) {
1435
1400
  title
1436
1401
  }), $[23] = send, $[24] = slug, $[25] = t7, $[26] = t8) : (t7 = $[25], t8 = $[26]);
1437
1402
  let t9;
1438
- return $[27] !== applyVariant || $[28] !== focusTitle || $[29] !== split || $[30] !== t2 || $[31] !== t3 || $[32] !== t4 || $[33] !== t5 || $[34] !== t6 || $[35] !== t7 || $[36] !== t8 || $[37] !== theme.options || $[38] !== theme.palette || $[39] !== theme.title ? (t9 = /* @__PURE__ */ jsx(ThemeEditorForm, {
1403
+ return $[27] !== applyVariant || $[28] !== focusTitle || $[29] !== mobile || $[30] !== split || $[31] !== t2 || $[32] !== t3 || $[33] !== t4 || $[34] !== t5 || $[35] !== t6 || $[36] !== t7 || $[37] !== t8 || $[38] !== theme.options || $[39] !== theme.palette || $[40] !== theme.title ? (t9 = /* @__PURE__ */ jsx(ThemeEditorForm, {
1439
1404
  focusTitle,
1440
1405
  imageUrl: t2,
1441
1406
  onDone: t3,
@@ -1448,11 +1413,12 @@ function ThemeEditor(props) {
1448
1413
  options: theme.options,
1449
1414
  palette: theme.palette,
1450
1415
  split,
1416
+ mobile,
1451
1417
  title: theme.title
1452
- }), $[27] = applyVariant, $[28] = focusTitle, $[29] = split, $[30] = t2, $[31] = t3, $[32] = t4, $[33] = t5, $[34] = t6, $[35] = t7, $[36] = t8, $[37] = theme.options, $[38] = theme.palette, $[39] = theme.title, $[40] = t9) : t9 = $[40], t9;
1418
+ }), $[27] = applyVariant, $[28] = focusTitle, $[29] = mobile, $[30] = split, $[31] = t2, $[32] = t3, $[33] = t4, $[34] = t5, $[35] = t6, $[36] = t7, $[37] = t8, $[38] = theme.options, $[39] = theme.palette, $[40] = theme.title, $[41] = t9) : t9 = $[41], t9;
1453
1419
  }
1454
1420
  function ThemeEditorForm(props) {
1455
- let $ = c(49), { focusTitle, imageUrl, onDone, onLucky, onOptionsChange, onPalette, onRemove, onTitleChange, onVariant, options, palette, split, title } = props, studioScheme = useColorSchemeValue(), t0;
1421
+ let $ = c(50), { focusTitle, imageUrl, onDone, onLucky, onOptionsChange, onPalette, onRemove, onTitleChange, onVariant, options, palette, split, mobile, title } = props, studioScheme = useColorSchemeValue(), t0;
1456
1422
  $[0] === options ? t0 = $[1] : (t0 = resolveThemeOptions(options), $[0] = options, $[1] = t0);
1457
1423
  let resolved = t0, t1;
1458
1424
  $[2] === options ? t1 = $[3] : (t1 = buildPalette(options), $[2] = options, $[3] = t1);
@@ -1476,7 +1442,7 @@ function ThemeEditorForm(props) {
1476
1442
  }), $[9] = t4) : t4 = $[9];
1477
1443
  let t5;
1478
1444
  $[10] === onTitleChange ? t5 = $[11] : (t5 = (event) => onTitleChange(event.currentTarget.value), $[10] = onTitleChange, $[11] = t5);
1479
- let t6 = focusTitle ? _temp$1 : void 0, t7;
1445
+ let t6 = focusTitle ? _temp$3 : void 0, t7;
1480
1446
  $[12] !== focusTitle || $[13] !== t5 || $[14] !== t6 || $[15] !== title ? (t7 = /* @__PURE__ */ jsxs(Stack, {
1481
1447
  gap: 2,
1482
1448
  children: [t4, /* @__PURE__ */ jsx(TextInput, {
@@ -1499,19 +1465,20 @@ function ThemeEditorForm(props) {
1499
1465
  palette
1500
1466
  }), $[17] = imageUrl, $[18] = onLucky, $[19] = onPalette, $[20] = onVariant, $[21] = options, $[22] = palette, $[23] = t8) : t8 = $[23];
1501
1467
  let t9;
1502
- $[24] !== options || $[25] !== palettes || $[26] !== patchScheme || $[27] !== resolved || $[28] !== split || $[29] !== studioScheme ? (t9 = SCHEMES.map((scheme_0) => /* @__PURE__ */ jsx(SchemeCard, {
1468
+ $[24] !== mobile || $[25] !== options || $[26] !== palettes || $[27] !== patchScheme || $[28] !== resolved || $[29] !== split || $[30] !== studioScheme ? (t9 = SCHEMES.map((scheme_0) => /* @__PURE__ */ jsx(SchemeCard, {
1503
1469
  active: split || scheme_0 === studioScheme,
1504
1470
  onChange: (changes_0) => patchScheme(scheme_0, changes_0),
1505
1471
  options: options[scheme_0] ?? {},
1506
1472
  palette: palettes[scheme_0],
1507
1473
  resolved: resolved[scheme_0],
1508
1474
  scheme: scheme_0,
1509
- split
1510
- }, scheme_0)), $[24] = options, $[25] = palettes, $[26] = patchScheme, $[27] = resolved, $[28] = split, $[29] = studioScheme, $[30] = t9) : t9 = $[30];
1475
+ split,
1476
+ splitHint: splitHint(scheme_0 === studioScheme, mobile)
1477
+ }, scheme_0)), $[24] = mobile, $[25] = options, $[26] = palettes, $[27] = patchScheme, $[28] = resolved, $[29] = split, $[30] = studioScheme, $[31] = t9) : t9 = $[31];
1511
1478
  let t10;
1512
- $[31] === t9 ? t10 = $[32] : (t10 = /* @__PURE__ */ jsx(ScrollAreaBleed, { children: t9 }), $[31] = t9, $[32] = t10);
1479
+ $[32] === t9 ? t10 = $[33] : (t10 = /* @__PURE__ */ jsx(ScrollAreaBleed, { children: t9 }), $[32] = t9, $[33] = t10);
1513
1480
  let t11;
1514
- $[33] !== t10 || $[34] !== t3 || $[35] !== t7 || $[36] !== t8 ? (t11 = /* @__PURE__ */ jsx(ScrollArea, {
1481
+ $[34] !== t10 || $[35] !== t3 || $[36] !== t7 || $[37] !== t8 ? (t11 = /* @__PURE__ */ jsx(ScrollArea, {
1515
1482
  padding: 3,
1516
1483
  children: /* @__PURE__ */ jsxs(Stack, {
1517
1484
  gap: 4,
@@ -1522,26 +1489,26 @@ function ThemeEditorForm(props) {
1522
1489
  t10
1523
1490
  ]
1524
1491
  })
1525
- }), $[33] = t10, $[34] = t3, $[35] = t7, $[36] = t8, $[37] = t11) : t11 = $[37];
1492
+ }), $[34] = t10, $[35] = t3, $[36] = t7, $[37] = t8, $[38] = t11) : t11 = $[38];
1526
1493
  let t12;
1527
- $[38] === onRemove ? t12 = $[39] : (t12 = /* @__PURE__ */ jsx(TooltipButton, {
1494
+ $[39] === onRemove ? t12 = $[40] : (t12 = /* @__PURE__ */ jsx(TooltipButton, {
1528
1495
  icon: TrashIcon,
1529
1496
  mode: "ghost",
1530
1497
  onClick: onRemove,
1531
1498
  text: "Remove",
1532
1499
  tone: "critical",
1533
1500
  tooltip: "Remove the theme — it can be restored until it is deleted"
1534
- }), $[38] = onRemove, $[39] = t12);
1501
+ }), $[39] = onRemove, $[40] = t12);
1535
1502
  let t13;
1536
- $[40] === Symbol.for("react.memo_cache_sentinel") ? (t13 = /* @__PURE__ */ jsx(Box, { flex: 1 }), $[40] = t13) : t13 = $[40];
1503
+ $[41] === Symbol.for("react.memo_cache_sentinel") ? (t13 = /* @__PURE__ */ jsx(Box, { flex: 1 }), $[41] = t13) : t13 = $[41];
1537
1504
  let t14;
1538
- $[41] === onDone ? t14 = $[42] : (t14 = /* @__PURE__ */ jsx(Button, {
1505
+ $[42] === onDone ? t14 = $[43] : (t14 = /* @__PURE__ */ jsx(Button, {
1539
1506
  mode: "ghost",
1540
1507
  onClick: onDone,
1541
1508
  text: "Done"
1542
- }), $[41] = onDone, $[42] = t14);
1509
+ }), $[42] = onDone, $[43] = t14);
1543
1510
  let t15;
1544
- $[43] !== t12 || $[44] !== t14 ? (t15 = /* @__PURE__ */ jsx(Card, {
1511
+ $[44] !== t12 || $[45] !== t14 ? (t15 = /* @__PURE__ */ jsx(Card, {
1545
1512
  borderTop: !0,
1546
1513
  padding: 3,
1547
1514
  children: /* @__PURE__ */ jsxs(Flex, {
@@ -1552,11 +1519,11 @@ function ThemeEditorForm(props) {
1552
1519
  t14
1553
1520
  ]
1554
1521
  })
1555
- }), $[43] = t12, $[44] = t14, $[45] = t15) : t15 = $[45];
1522
+ }), $[44] = t12, $[45] = t14, $[46] = t15) : t15 = $[46];
1556
1523
  let t16;
1557
- return $[46] !== t11 || $[47] !== t15 ? (t16 = /* @__PURE__ */ jsxs(Fragment, { children: [t11, t15] }), $[46] = t11, $[47] = t15, $[48] = t16) : t16 = $[48], t16;
1524
+ return $[47] !== t11 || $[48] !== t15 ? (t16 = /* @__PURE__ */ jsxs(Fragment, { children: [t11, t15] }), $[47] = t11, $[48] = t15, $[49] = t16) : t16 = $[49], t16;
1558
1525
  }
1559
- function _temp$1(event_0) {
1526
+ function _temp$3(event_0) {
1560
1527
  return event_0.currentTarget.select();
1561
1528
  }
1562
1529
  /**
@@ -1568,7 +1535,7 @@ function _temp$1(event_0) {
1568
1535
  * active, in the split preview.
1569
1536
  */
1570
1537
  function SchemeCard(props) {
1571
- let $ = c(66), { active, onChange, options, palette, resolved, scheme, split } = props, name = SCHEME_TITLES[scheme], t0;
1538
+ let $ = c(66), { active, onChange, options, palette, resolved, scheme, split, splitHint } = props, name = SCHEME_TITLES[scheme], t0;
1572
1539
  $[0] === name ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Box, {
1573
1540
  flex: 1,
1574
1541
  children: /* @__PURE__ */ jsx(Text, {
@@ -1589,7 +1556,7 @@ function SchemeCard(props) {
1589
1556
  gap: 2,
1590
1557
  children: [t0, t1]
1591
1558
  }), $[4] = t0, $[5] = t1, $[6] = t2) : t2 = $[6];
1592
- let t3 = split ? SPLIT_HINTS[scheme] : active ? "Shown in the Studio right now" : `Shown once the Studio appearance is ${scheme}`, t4;
1559
+ let t3 = split ? splitHint : active ? "Shown in the Studio right now" : `Shown once the Studio appearance is ${scheme}`, t4;
1593
1560
  $[7] === t3 ? t4 = $[8] : (t4 = /* @__PURE__ */ jsx(Text, {
1594
1561
  muted: !0,
1595
1562
  size: 0,
@@ -1667,8 +1634,9 @@ function SchemeCard(props) {
1667
1634
  let t27 = `${name} contrast`, t28;
1668
1635
  $[50] === onChange ? t28 = $[51] : (t28 = (event) => onChange({ contrast: Number(event.currentTarget.value) }), $[50] = onChange, $[51] = t28);
1669
1636
  let t29;
1670
- $[52] !== resolved.contrast || $[53] !== t27 || $[54] !== t28 ? (t29 = /* @__PURE__ */ jsx(Range, {
1637
+ $[52] !== resolved.contrast || $[53] !== t27 || $[54] !== t28 ? (t29 = /* @__PURE__ */ jsx("input", {
1671
1638
  "aria-label": t27,
1639
+ className: range,
1672
1640
  max: 100,
1673
1641
  min: 15,
1674
1642
  onChange: t28,
@@ -1709,92 +1677,120 @@ function SchemeCard(props) {
1709
1677
  }
1710
1678
  /** One color of a scheme: a swatch with its value and an optional reset button */
1711
1679
  function ColorRow(props) {
1712
- let $ = c(24), { adjusted, auto, autoLabel: t0, label, onChange, onClear, title, value } = props, autoLabel = t0 === void 0 ? "auto" : t0, t1;
1680
+ let $ = c(23), { adjusted, auto, autoLabel: t0, label, onChange, onClear, title, value } = props, autoLabel = t0 === void 0 ? "auto" : t0, t1;
1713
1681
  $[0] === onChange ? t1 = $[1] : (t1 = (event) => onChange(event.currentTarget.value), $[0] = onChange, $[1] = t1);
1714
1682
  let t2;
1715
- $[2] !== label || $[3] !== t1 || $[4] !== value ? (t2 = /* @__PURE__ */ jsx(Swatch, {
1683
+ $[2] !== label || $[3] !== t1 || $[4] !== value ? (t2 = /* @__PURE__ */ jsx("input", {
1716
1684
  "aria-label": label,
1685
+ className: swatch,
1717
1686
  onChange: t1,
1718
1687
  type: "color",
1719
1688
  value
1720
1689
  }), $[2] = label, $[3] = t1, $[4] = value, $[5] = t2) : t2 = $[5];
1721
1690
  let t3;
1722
- $[6] === Symbol.for("react.memo_cache_sentinel") ? (t3 = { minWidth: 0 }, $[6] = t3) : t3 = $[6];
1723
- let t4;
1724
- $[7] === title ? t4 = $[8] : (t4 = /* @__PURE__ */ jsx(Text, {
1691
+ $[6] === title ? t3 = $[7] : (t3 = /* @__PURE__ */ jsx(Text, {
1725
1692
  size: 1,
1726
1693
  children: title
1727
- }), $[7] = title, $[8] = t4);
1728
- let t5 = adjusted !== void 0 && adjusted !== value ? ` → ${adjusted}` : "", t6 = auto ? ` · ${autoLabel}` : "", t7;
1729
- $[9] !== t5 || $[10] !== t6 || $[11] !== value ? (t7 = /* @__PURE__ */ jsxs(Text, {
1694
+ }), $[6] = title, $[7] = t3);
1695
+ let t4 = adjusted !== void 0 && adjusted !== value ? ` → ${adjusted}` : "", t5 = auto ? ` · ${autoLabel}` : "", t6;
1696
+ $[8] !== t4 || $[9] !== t5 || $[10] !== value ? (t6 = /* @__PURE__ */ jsxs(Text, {
1730
1697
  muted: !0,
1731
1698
  size: 0,
1732
1699
  textOverflow: "ellipsis",
1733
1700
  children: [
1734
1701
  value,
1735
- t5,
1736
- t6
1702
+ t4,
1703
+ t5
1737
1704
  ]
1738
- }), $[9] = t5, $[10] = t6, $[11] = value, $[12] = t7) : t7 = $[12];
1739
- let t8;
1740
- $[13] !== t4 || $[14] !== t7 ? (t8 = /* @__PURE__ */ jsxs(Stack, {
1705
+ }), $[8] = t4, $[9] = t5, $[10] = value, $[11] = t6) : t6 = $[11];
1706
+ let t7;
1707
+ $[12] !== t3 || $[13] !== t6 ? (t7 = /* @__PURE__ */ jsxs(Stack, {
1708
+ className: colorRowText,
1741
1709
  flex: 1,
1742
1710
  gap: 2,
1743
- style: t3,
1744
- children: [t4, t7]
1745
- }), $[13] = t4, $[14] = t7, $[15] = t8) : t8 = $[15];
1746
- let t9;
1747
- $[16] !== auto || $[17] !== autoLabel || $[18] !== onClear ? (t9 = onClear && !auto && /* @__PURE__ */ jsx(TooltipButton, {
1711
+ children: [t3, t6]
1712
+ }), $[12] = t3, $[13] = t6, $[14] = t7) : t7 = $[14];
1713
+ let t8;
1714
+ $[15] !== auto || $[16] !== autoLabel || $[17] !== onClear ? (t8 = onClear && !auto && /* @__PURE__ */ jsx(TooltipButton, {
1748
1715
  icon: ResetIcon,
1749
1716
  mode: "bleed",
1750
1717
  onClick: onClear,
1751
1718
  padding: 2,
1752
1719
  tooltip: `Reset to ${autoLabel}`
1753
- }), $[16] = auto, $[17] = autoLabel, $[18] = onClear, $[19] = t9) : t9 = $[19];
1754
- let t10;
1755
- return $[20] !== t2 || $[21] !== t8 || $[22] !== t9 ? (t10 = /* @__PURE__ */ jsxs(Flex, {
1720
+ }), $[15] = auto, $[16] = autoLabel, $[17] = onClear, $[18] = t8) : t8 = $[18];
1721
+ let t9;
1722
+ return $[19] !== t2 || $[20] !== t7 || $[21] !== t8 ? (t9 = /* @__PURE__ */ jsxs(Flex, {
1756
1723
  align: "center",
1757
1724
  gap: 2,
1758
1725
  children: [
1759
1726
  t2,
1760
- t8,
1761
- t9
1727
+ t7,
1728
+ t8
1762
1729
  ]
1763
- }), $[20] = t2, $[21] = t8, $[22] = t9, $[23] = t10) : t10 = $[23], t10;
1764
- }
1765
- const Root = styled.div.withConfig({
1766
- displayName: "Root",
1767
- componentId: "sc-krwbzw-0"
1768
- })`position:relative;`, PickButton = styled.button.withConfig({
1769
- displayName: "PickButton",
1770
- componentId: "sc-krwbzw-1"
1771
- })`appearance:none;display:block;box-sizing:border-box;width:100%;margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;text-align:center;cursor:pointer;&:focus{outline:none;}`, Frame$1 = styled.span.withConfig({
1772
- displayName: "Frame",
1773
- componentId: "sc-krwbzw-2"
1774
- })`display:block;padding:4px;border-radius:10px;transition:box-shadow 100ms;${PickButton}:hover &{box-shadow:inset 0 0 0 2px var(--card-border-color);}${PickButton}[aria-pressed='true'] &{box-shadow:inset 0 0 0 2px var(--card-focus-ring-color);}${PickButton}:focus-visible &{outline:2px solid var(--card-focus-ring-color);outline-offset:-2px;}`, MenuSlot = styled.div.withConfig({
1775
- displayName: "MenuSlot",
1776
- componentId: "sc-krwbzw-3"
1777
- })`position:absolute;top:10px;right:10px;opacity:0;transition:opacity 100ms;${Root}:hover &,${Root}:focus-within &,&[data-visible='true']{opacity:1;}`;
1730
+ }), $[19] = t2, $[20] = t7, $[21] = t8, $[22] = t9) : t9 = $[22], t9;
1731
+ }
1732
+ var frame$1 = "_1wsn7882", menuCard = "_1wsn7884", menuSlot = "_1wsn7883", pickButton = "_1wsn7881", root = "_1wsn7880";
1733
+ /**
1734
+ * Scrolls the applied theme's card into view when it is not already, as a
1735
+ * ref: the list scrolls to it as it mounts — coming back from the editor or
1736
+ * the removed themes — and when another theme gets applied
1737
+ */
1738
+ function scrollRefIntoViewIfNeeded(node) {
1739
+ node && scrollIntoView(node, {
1740
+ block: "nearest",
1741
+ scrollMode: "if-needed"
1742
+ });
1743
+ }
1778
1744
  /**
1779
1745
  * One theme in the list: the floating preview with the title below it, like
1780
1746
  * an appearance option in macOS System Settings. Clicking it applies the
1781
- * theme to the whole Studio; its menu holds the edit, duplicate and remove
1782
- * flows that apply to the theme.
1747
+ * theme to the whole Studio, dragging it moves the theme to another place in
1748
+ * the list; its menu holds the move, edit, duplicate and remove flows that
1749
+ * apply to the theme.
1783
1750
  *
1784
1751
  * @internal
1785
1752
  */
1786
1753
  function ThemeCard(props) {
1787
- let $ = c(52), { active, theme } = props, { send } = useThemer(), { scheme } = useRootTheme(), [menuOpen, setMenuOpen] = useState(!1), t0;
1754
+ let $ = c(81), { active, theme } = props, { themes, send } = useThemer(), { scheme } = useRootTheme(), [menuOpen, setMenuOpen] = useState(!1), dragControls = useDragControls(), dragged = useRef(!1), t0;
1788
1755
  $[0] === theme.title ? t0 = $[1] : (t0 = displayTitle(theme.title), $[0] = theme.title, $[1] = t0);
1789
1756
  let title = t0, t1;
1790
- $[2] !== send || $[3] !== theme.slug ? (t1 = () => send({
1791
- type: "theme.pick",
1792
- slug: theme.slug
1793
- }), $[2] = send, $[3] = theme.slug, $[4] = t1) : t1 = $[4];
1794
- let t2;
1795
- $[5] === theme.options ? t2 = $[6] : (t2 = /* @__PURE__ */ jsx(Frame$1, { children: /* @__PURE__ */ jsx(ThemeThumbnail, { options: theme.options }) }), $[5] = theme.options, $[6] = t2);
1796
- let t3 = active ? "medium" : "regular", t4;
1797
- $[7] !== t3 || $[8] !== title ? (t4 = /* @__PURE__ */ jsx(Box, {
1757
+ $[2] === theme.slug ? t1 = $[3] : (t1 = (candidate) => candidate.slug === theme.slug, $[2] = theme.slug, $[3] = t1);
1758
+ let index = themes.findIndex(t1), t2;
1759
+ $[4] !== index || $[5] !== send || $[6] !== themes ? (t2 = (to) => {
1760
+ let order = themes.map(_temp$2);
1761
+ order.splice(to, 0, ...order.splice(index, 1)), send({
1762
+ type: "theme.reorder",
1763
+ order
1764
+ });
1765
+ }, $[4] = index, $[5] = send, $[6] = themes, $[7] = t2) : t2 = $[7];
1766
+ let moveTo = t2, t3, t4;
1767
+ $[8] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => {
1768
+ requestAnimationFrame(() => {
1769
+ dragged.current = !1;
1770
+ });
1771
+ }, t4 = () => {
1772
+ dragged.current = !0;
1773
+ }, $[8] = t3, $[9] = t4) : (t3 = $[8], t4 = $[9]);
1774
+ let t5 = active ? scrollRefIntoViewIfNeeded : void 0, t6;
1775
+ $[10] === Symbol.for("react.memo_cache_sentinel") ? (t6 = { scale: 1.04 }, $[10] = t6) : t6 = $[10];
1776
+ let t7;
1777
+ $[11] !== send || $[12] !== theme.slug ? (t7 = () => {
1778
+ dragged.current || send({
1779
+ type: "theme.pick",
1780
+ slug: theme.slug
1781
+ });
1782
+ }, $[11] = send, $[12] = theme.slug, $[13] = t7) : t7 = $[13];
1783
+ let t8;
1784
+ $[14] === dragControls ? t8 = $[15] : (t8 = (event) => {
1785
+ event.pointerType !== "touch" && dragControls.start(event);
1786
+ }, $[14] = dragControls, $[15] = t8);
1787
+ let t9;
1788
+ $[16] === theme.options ? t9 = $[17] : (t9 = /* @__PURE__ */ jsx("span", {
1789
+ className: frame$1,
1790
+ children: /* @__PURE__ */ jsx(ThemeThumbnail, { options: theme.options })
1791
+ }), $[16] = theme.options, $[17] = t9);
1792
+ let t10 = active ? "medium" : "regular", t11;
1793
+ $[18] !== t10 || $[19] !== title ? (t11 = /* @__PURE__ */ jsx(Box, {
1798
1794
  as: "span",
1799
1795
  display: "block",
1800
1796
  paddingTop: 2,
@@ -1804,55 +1800,75 @@ function ThemeCard(props) {
1804
1800
  as: "span",
1805
1801
  size: 1,
1806
1802
  textOverflow: "ellipsis",
1807
- weight: t3,
1803
+ weight: t10,
1808
1804
  children: title
1809
1805
  })
1810
- }), $[7] = t3, $[8] = title, $[9] = t4) : t4 = $[9];
1811
- let t5;
1812
- $[10] !== active || $[11] !== t1 || $[12] !== t2 || $[13] !== t4 ? (t5 = /* @__PURE__ */ jsxs(PickButton, {
1806
+ }), $[18] = t10, $[19] = title, $[20] = t11) : t11 = $[20];
1807
+ let t12;
1808
+ $[21] !== active || $[22] !== t11 || $[23] !== t7 || $[24] !== t8 || $[25] !== t9 ? (t12 = /* @__PURE__ */ jsxs("button", {
1813
1809
  "aria-pressed": active,
1814
- onClick: t1,
1810
+ className: pickButton,
1811
+ onClick: t7,
1812
+ onPointerDown: t8,
1815
1813
  type: "button",
1816
- children: [t2, t4]
1817
- }), $[10] = active, $[11] = t1, $[12] = t2, $[13] = t4, $[14] = t5) : t5 = $[14];
1818
- let t6;
1819
- $[15] === Symbol.for("react.memo_cache_sentinel") ? (t6 = /* @__PURE__ */ jsx(Text, {
1814
+ children: [t9, t11]
1815
+ }), $[21] = active, $[22] = t11, $[23] = t7, $[24] = t8, $[25] = t9, $[26] = t12) : t12 = $[26];
1816
+ let t13;
1817
+ $[27] === Symbol.for("react.memo_cache_sentinel") ? (t13 = /* @__PURE__ */ jsx(Text, {
1820
1818
  size: 1,
1821
1819
  children: "Show more"
1822
- }), $[15] = t6) : t6 = $[15];
1823
- let t7;
1824
- $[16] === Symbol.for("react.memo_cache_sentinel") ? (t7 = { display: "inline-block" }, $[16] = t7) : t7 = $[16];
1825
- let t8 = `Show more for ${title}`, t9;
1826
- $[17] === t8 ? t9 = $[18] : (t9 = /* @__PURE__ */ jsx(Button, {
1827
- "aria-label": t8,
1820
+ }), $[27] = t13) : t13 = $[27];
1821
+ let t14 = `Show more for ${title}`, t15;
1822
+ $[28] === t14 ? t15 = $[29] : (t15 = /* @__PURE__ */ jsx(Button, {
1823
+ "aria-label": t14,
1828
1824
  fontSize: 1,
1829
1825
  icon: EllipsisHorizontalIcon,
1830
1826
  mode: "ghost",
1831
1827
  padding: 1,
1832
1828
  radius: 2
1833
- }), $[17] = t8, $[18] = t9);
1834
- let t10 = `themer-theme-${theme.slug}`, t11;
1835
- $[19] !== send || $[20] !== theme.slug || $[21] !== theme.source ? (t11 = theme.source === "custom" && /* @__PURE__ */ jsx(MenuItem, {
1829
+ }), $[28] = t14, $[29] = t15);
1830
+ let t16 = `themer-theme-${theme.slug}`, t17 = index <= 0, t18;
1831
+ $[30] !== index || $[31] !== moveTo ? (t18 = () => moveTo(index - 1), $[30] = index, $[31] = moveTo, $[32] = t18) : t18 = $[32];
1832
+ let t19;
1833
+ $[33] !== t17 || $[34] !== t18 ? (t19 = /* @__PURE__ */ jsx(MenuItem, {
1834
+ disabled: t17,
1835
+ icon: ArrowUpIcon,
1836
+ onClick: t18,
1837
+ text: "Move up"
1838
+ }), $[33] = t17, $[34] = t18, $[35] = t19) : t19 = $[35];
1839
+ let t20 = index >= themes.length - 1, t21;
1840
+ $[36] !== index || $[37] !== moveTo ? (t21 = () => moveTo(index + 1), $[36] = index, $[37] = moveTo, $[38] = t21) : t21 = $[38];
1841
+ let t22;
1842
+ $[39] !== t20 || $[40] !== t21 ? (t22 = /* @__PURE__ */ jsx(MenuItem, {
1843
+ disabled: t20,
1844
+ icon: ArrowDownIcon,
1845
+ onClick: t21,
1846
+ text: "Move down"
1847
+ }), $[39] = t20, $[40] = t21, $[41] = t22) : t22 = $[41];
1848
+ let t23;
1849
+ $[42] === Symbol.for("react.memo_cache_sentinel") ? (t23 = /* @__PURE__ */ jsx(MenuDivider, {}), $[42] = t23) : t23 = $[42];
1850
+ let t24;
1851
+ $[43] !== send || $[44] !== theme.slug || $[45] !== theme.source ? (t24 = theme.source === "custom" && /* @__PURE__ */ jsx(MenuItem, {
1836
1852
  icon: EditIcon,
1837
1853
  onClick: () => send({
1838
1854
  type: "theme.edit",
1839
1855
  slug: theme.slug
1840
1856
  }),
1841
1857
  text: "Edit"
1842
- }), $[19] = send, $[20] = theme.slug, $[21] = theme.source, $[22] = t11) : t11 = $[22];
1843
- let t12;
1844
- $[23] !== send || $[24] !== theme.slug ? (t12 = () => send({
1858
+ }), $[43] = send, $[44] = theme.slug, $[45] = theme.source, $[46] = t24) : t24 = $[46];
1859
+ let t25;
1860
+ $[47] !== send || $[48] !== theme.slug ? (t25 = () => send({
1845
1861
  type: "theme.duplicate",
1846
1862
  slug: theme.slug
1847
- }), $[23] = send, $[24] = theme.slug, $[25] = t12) : t12 = $[25];
1848
- let t13 = theme.source === "custom" ? "Duplicate" : "Duplicate to edit", t14;
1849
- $[26] !== t12 || $[27] !== t13 ? (t14 = /* @__PURE__ */ jsx(MenuItem, {
1863
+ }), $[47] = send, $[48] = theme.slug, $[49] = t25) : t25 = $[49];
1864
+ let t26 = theme.source === "custom" ? "Duplicate" : "Duplicate to edit", t27;
1865
+ $[50] !== t25 || $[51] !== t26 ? (t27 = /* @__PURE__ */ jsx(MenuItem, {
1850
1866
  icon: CopyIcon,
1851
- onClick: t12,
1852
- text: t13
1853
- }), $[26] = t12, $[27] = t13, $[28] = t14) : t14 = $[28];
1854
- let t15;
1855
- $[29] !== send || $[30] !== theme.slug || $[31] !== theme.source ? (t15 = theme.source !== "config" && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MenuDivider, {}), /* @__PURE__ */ jsx(MenuItem, {
1867
+ onClick: t25,
1868
+ text: t26
1869
+ }), $[50] = t25, $[51] = t26, $[52] = t27) : t27 = $[52];
1870
+ let t28;
1871
+ $[53] !== send || $[54] !== theme.slug || $[55] !== theme.source ? (t28 = theme.source !== "config" && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MenuDivider, {}), /* @__PURE__ */ jsx(MenuItem, {
1856
1872
  icon: TrashIcon,
1857
1873
  onClick: () => send({
1858
1874
  type: "theme.remove",
@@ -1860,59 +1876,82 @@ function ThemeCard(props) {
1860
1876
  }),
1861
1877
  text: "Remove",
1862
1878
  tone: "critical"
1863
- })] }), $[29] = send, $[30] = theme.slug, $[31] = theme.source, $[32] = t15) : t15 = $[32];
1864
- let t16;
1865
- $[33] !== t11 || $[34] !== t14 || $[35] !== t15 ? (t16 = /* @__PURE__ */ jsxs(Menu, { children: [
1866
- t11,
1867
- t14,
1868
- t15
1869
- ] }), $[33] = t11, $[34] = t14, $[35] = t15, $[36] = t16) : t16 = $[36];
1870
- let t17, t18;
1871
- $[37] === Symbol.for("react.memo_cache_sentinel") ? (t17 = () => setMenuOpen(!1), t18 = () => setMenuOpen(!0), $[37] = t17, $[38] = t18) : (t17 = $[37], t18 = $[38]);
1872
- let t19;
1873
- $[39] === scheme ? t19 = $[40] : (t19 = {
1879
+ })] }), $[53] = send, $[54] = theme.slug, $[55] = theme.source, $[56] = t28) : t28 = $[56];
1880
+ let t29;
1881
+ $[57] !== t19 || $[58] !== t22 || $[59] !== t24 || $[60] !== t27 || $[61] !== t28 ? (t29 = /* @__PURE__ */ jsxs(Menu, { children: [
1882
+ t19,
1883
+ t22,
1884
+ t23,
1885
+ t24,
1886
+ t27,
1887
+ t28
1888
+ ] }), $[57] = t19, $[58] = t22, $[59] = t24, $[60] = t27, $[61] = t28, $[62] = t29) : t29 = $[62];
1889
+ let t30, t31;
1890
+ $[63] === Symbol.for("react.memo_cache_sentinel") ? (t30 = () => setMenuOpen(!1), t31 = () => setMenuOpen(!0), $[63] = t30, $[64] = t31) : (t30 = $[63], t31 = $[64]);
1891
+ let t32;
1892
+ $[65] === scheme ? t32 = $[66] : (t32 = {
1874
1893
  animate: !0,
1875
1894
  placement: "bottom-end",
1876
1895
  portal: !0,
1877
1896
  scheme
1878
- }, $[39] = scheme, $[40] = t19);
1879
- let t20;
1880
- $[41] !== t10 || $[42] !== t16 || $[43] !== t19 || $[44] !== t9 ? (t20 = /* @__PURE__ */ jsx(Tooltip, {
1897
+ }, $[65] = scheme, $[66] = t32);
1898
+ let t33;
1899
+ $[67] !== t15 || $[68] !== t16 || $[69] !== t29 || $[70] !== t32 ? (t33 = /* @__PURE__ */ jsx(Tooltip, {
1881
1900
  animate: !0,
1882
- content: t6,
1901
+ content: t13,
1883
1902
  placement: "bottom",
1884
1903
  portal: !0,
1885
1904
  children: /* @__PURE__ */ jsx(Card, {
1905
+ className: menuCard,
1886
1906
  radius: 2,
1887
1907
  scheme: "dark",
1888
- style: t7,
1889
1908
  children: /* @__PURE__ */ jsx(MenuButton, {
1890
- button: t9,
1891
- id: t10,
1892
- menu: t16,
1893
- onClose: t17,
1894
- onOpen: t18,
1895
- popover: t19
1909
+ button: t15,
1910
+ id: t16,
1911
+ menu: t29,
1912
+ onClose: t30,
1913
+ onOpen: t31,
1914
+ popover: t32
1896
1915
  })
1897
1916
  })
1898
- }), $[41] = t10, $[42] = t16, $[43] = t19, $[44] = t9, $[45] = t20) : t20 = $[45];
1899
- let t21;
1900
- $[46] !== menuOpen || $[47] !== t20 ? (t21 = /* @__PURE__ */ jsx(MenuSlot, {
1917
+ }), $[67] = t15, $[68] = t16, $[69] = t29, $[70] = t32, $[71] = t33) : t33 = $[71];
1918
+ let t34;
1919
+ $[72] !== menuOpen || $[73] !== t33 ? (t34 = /* @__PURE__ */ jsx("div", {
1920
+ className: menuSlot,
1901
1921
  "data-visible": menuOpen,
1902
- children: t20
1903
- }), $[46] = menuOpen, $[47] = t20, $[48] = t21) : t21 = $[48];
1904
- let t22;
1905
- return $[49] !== t21 || $[50] !== t5 ? (t22 = /* @__PURE__ */ jsxs(Root, { children: [t5, t21] }), $[49] = t21, $[50] = t5, $[51] = t22) : t22 = $[51], t22;
1906
- }
1922
+ children: t33
1923
+ }), $[72] = menuOpen, $[73] = t33, $[74] = t34) : t34 = $[74];
1924
+ let t35;
1925
+ return $[75] !== dragControls || $[76] !== t12 || $[77] !== t34 || $[78] !== t5 || $[79] !== theme.slug ? (t35 = /* @__PURE__ */ jsxs(Reorder.Item, {
1926
+ as: "div",
1927
+ className: root,
1928
+ dragControls,
1929
+ dragListener: !1,
1930
+ onDragEnd: t3,
1931
+ onDragStart: t4,
1932
+ ref: t5,
1933
+ value: theme.slug,
1934
+ whileDrag: t6,
1935
+ children: [t12, t34]
1936
+ }), $[75] = dragControls, $[76] = t12, $[77] = t34, $[78] = t5, $[79] = theme.slug, $[80] = t35) : t35 = $[80], t35;
1937
+ }
1938
+ function _temp$2(candidate_0) {
1939
+ return candidate_0.slug;
1940
+ }
1941
+ var cardGrid = "twjqgh0";
1942
+ /**
1943
+ * One column at the sidebar's default width; wider sidebars — and the
1944
+ * overlay on small screens — fit more cards per row
1945
+ */
1907
1946
  /**
1908
- * The flow for picking a theme: one column of theme cards — the configured
1909
- * theme, the presets and the user's own themes — with the entry points to
1910
- * the add and restore flows below.
1947
+ * The flow for picking a theme: a grid of theme cards — the configured theme,
1948
+ * the presets and the user's own themes — that drag into the order the user
1949
+ * wants, with the entry points to the add and restore flows below.
1911
1950
  *
1912
1951
  * @internal
1913
1952
  */
1914
1953
  function ThemeList() {
1915
- let $ = c(24), { themes, removed, active, send } = useThemer(), t0;
1954
+ let $ = c(32), { themes, removed, active, send } = useThemer(), t0;
1916
1955
  $[0] === send ? t0 = $[1] : (t0 = (palette, file) => send({
1917
1956
  type: "theme.add",
1918
1957
  title: titleFromFileName(file.name),
@@ -1921,31 +1960,49 @@ function ThemeList() {
1921
1960
  imageUrl: URL.createObjectURL(file)
1922
1961
  }), $[0] = send, $[1] = t0);
1923
1962
  let { busy, pickImage } = useImagePalette(t0), t1;
1924
- if ($[2] !== active || $[3] !== themes) {
1925
- let t2;
1926
- $[5] === active ? t2 = $[6] : (t2 = (theme) => /* @__PURE__ */ jsx(ThemeCard, {
1927
- active: theme.slug === active.slug,
1928
- theme
1929
- }, theme.slug), $[5] = active, $[6] = t2), t1 = themes.map(t2), $[2] = active, $[3] = themes, $[4] = t1;
1930
- } else t1 = $[4];
1963
+ $[2] === send ? t1 = $[3] : (t1 = (order) => send({
1964
+ type: "theme.reorder",
1965
+ order
1966
+ }), $[2] = send, $[3] = t1);
1931
1967
  let t2;
1932
- $[7] !== removed.length || $[8] !== send ? (t2 = removed.length > 0 && /* @__PURE__ */ jsx(Button, {
1968
+ $[4] === themes ? t2 = $[5] : (t2 = themes.map(_temp$1), $[4] = themes, $[5] = t2);
1969
+ let t3;
1970
+ if ($[6] !== active || $[7] !== themes) {
1971
+ let t4;
1972
+ $[9] === active ? t4 = $[10] : (t4 = (theme_0) => /* @__PURE__ */ jsx(ThemeCard, {
1973
+ active: theme_0.slug === active.slug,
1974
+ theme: theme_0
1975
+ }, theme_0.slug), $[9] = active, $[10] = t4), t3 = themes.map(t4), $[6] = active, $[7] = themes, $[8] = t3;
1976
+ } else t3 = $[8];
1977
+ let t4;
1978
+ $[11] !== t1 || $[12] !== t2 || $[13] !== t3 ? (t4 = /* @__PURE__ */ jsx(MotionConfig, {
1979
+ reducedMotion: "user",
1980
+ children: /* @__PURE__ */ jsx(Reorder.Group, {
1981
+ as: "div",
1982
+ className: cardGrid,
1983
+ onReorder: t1,
1984
+ values: t2,
1985
+ children: t3
1986
+ })
1987
+ }), $[11] = t1, $[12] = t2, $[13] = t3, $[14] = t4) : t4 = $[14];
1988
+ let t5;
1989
+ $[15] !== removed.length || $[16] !== send ? (t5 = removed.length > 0 && /* @__PURE__ */ jsx(Button, {
1933
1990
  icon: RestoreIcon,
1934
1991
  mode: "bleed",
1935
1992
  onClick: () => send({ type: "flow.removed" }),
1936
1993
  text: `Show removed (${removed.length})`,
1937
1994
  width: "fill"
1938
- }), $[7] = removed.length, $[8] = send, $[9] = t2) : t2 = $[9];
1939
- let t3;
1940
- $[10] !== t1 || $[11] !== t2 ? (t3 = /* @__PURE__ */ jsx(ScrollArea, {
1995
+ }), $[15] = removed.length, $[16] = send, $[17] = t5) : t5 = $[17];
1996
+ let t6;
1997
+ $[18] !== t4 || $[19] !== t5 ? (t6 = /* @__PURE__ */ jsx(ScrollArea, {
1941
1998
  padding: 3,
1942
1999
  children: /* @__PURE__ */ jsxs(Stack, {
1943
2000
  gap: 4,
1944
- children: [t1, t2]
2001
+ children: [t4, t5]
1945
2002
  })
1946
- }), $[10] = t1, $[11] = t2, $[12] = t3) : t3 = $[12];
1947
- let t4;
1948
- $[13] === send ? t4 = $[14] : (t4 = /* @__PURE__ */ jsx(Box, {
2003
+ }), $[18] = t4, $[19] = t5, $[20] = t6) : t6 = $[20];
2004
+ let t7;
2005
+ $[21] === send ? t7 = $[22] : (t7 = /* @__PURE__ */ jsx(Box, {
1949
2006
  flex: 1,
1950
2007
  children: /* @__PURE__ */ jsx(TooltipButton, {
1951
2008
  icon: AddIcon,
@@ -1955,25 +2012,28 @@ function ThemeList() {
1955
2012
  tooltip: "Add a theme based on the applied one",
1956
2013
  width: "fill"
1957
2014
  })
1958
- }), $[13] = send, $[14] = t4);
1959
- let t5;
1960
- $[15] !== busy || $[16] !== pickImage ? (t5 = /* @__PURE__ */ jsx(ImageFileButton, {
2015
+ }), $[21] = send, $[22] = t7);
2016
+ let t8;
2017
+ $[23] !== busy || $[24] !== pickImage ? (t8 = /* @__PURE__ */ jsx(ImageFileButton, {
1961
2018
  loading: busy,
1962
2019
  mode: "ghost",
1963
2020
  onFile: pickImage,
1964
2021
  tooltip: "Add a theme from the colors of an image"
1965
- }), $[15] = busy, $[16] = pickImage, $[17] = t5) : t5 = $[17];
1966
- let t6;
1967
- $[18] !== t4 || $[19] !== t5 ? (t6 = /* @__PURE__ */ jsx(Card, {
2022
+ }), $[23] = busy, $[24] = pickImage, $[25] = t8) : t8 = $[25];
2023
+ let t9;
2024
+ $[26] !== t7 || $[27] !== t8 ? (t9 = /* @__PURE__ */ jsx(Card, {
1968
2025
  borderTop: !0,
1969
2026
  padding: 3,
1970
2027
  children: /* @__PURE__ */ jsxs(Flex, {
1971
2028
  gap: 2,
1972
- children: [t4, t5]
2029
+ children: [t7, t8]
1973
2030
  })
1974
- }), $[18] = t4, $[19] = t5, $[20] = t6) : t6 = $[20];
1975
- let t7;
1976
- return $[21] !== t3 || $[22] !== t6 ? (t7 = /* @__PURE__ */ jsxs(Fragment, { children: [t3, t6] }), $[21] = t3, $[22] = t6, $[23] = t7) : t7 = $[23], t7;
2031
+ }), $[26] = t7, $[27] = t8, $[28] = t9) : t9 = $[28];
2032
+ let t10;
2033
+ return $[29] !== t6 || $[30] !== t9 ? (t10 = /* @__PURE__ */ jsxs(Fragment, { children: [t6, t9] }), $[29] = t6, $[30] = t9, $[31] = t10) : t10 = $[31], t10;
2034
+ }
2035
+ function _temp$1(theme) {
2036
+ return theme.slug;
1977
2037
  }
1978
2038
  /**
1979
2039
  * Serializes theme options into the `buildTheme` call to paste into
@@ -2096,6 +2156,7 @@ function ThemeSnippetDialog(props) {
2096
2156
  children: t9
2097
2157
  }), $[19] = onClose, $[20] = t2, $[21] = t9, $[22] = t10) : t10 = $[22], t10;
2098
2158
  }
2159
+ var title = "c2pqej0";
2099
2160
  const VIEW_TITLES = {
2100
2161
  list: "Themer",
2101
2162
  edit: "Edit theme",
@@ -2110,32 +2171,29 @@ const VIEW_TITLES = {
2110
2171
  * @internal
2111
2172
  */
2112
2173
  function ThemerSidebar() {
2113
- let $ = c(41), { active, split, view, send } = useThemer(), [snippetOpen, setSnippetOpen] = useState(!1), inList = view.name === "list", t0;
2114
- $[0] !== inList || $[1] !== send ? (t0 = !inList && /* @__PURE__ */ jsx(TooltipButton, {
2174
+ let $ = c(42), { active, split, view, navbarHeight, send } = useThemer(), [snippetOpen, setSnippetOpen] = useState(!1), inList = view.name === "list", t0;
2175
+ $[0] === navbarHeight ? t0 = $[1] : (t0 = navbarHeight === null ? void 0 : { height: navbarHeight }, $[0] = navbarHeight, $[1] = t0);
2176
+ let t1;
2177
+ $[2] !== inList || $[3] !== send ? (t1 = !inList && /* @__PURE__ */ jsx(TooltipButton, {
2115
2178
  icon: ArrowLeftIcon,
2116
2179
  mode: "bleed",
2117
2180
  onClick: () => send({ type: "flow.list" }),
2118
2181
  padding: 2,
2119
2182
  tooltip: "Back to the themes"
2120
- }), $[0] = inList, $[1] = send, $[2] = t0) : t0 = $[2];
2121
- let t1 = +!!inList, t2;
2122
- $[3] === Symbol.for("react.memo_cache_sentinel") ? (t2 = { minWidth: 0 }, $[3] = t2) : t2 = $[3];
2123
- let t3 = VIEW_TITLES[view.name], t4;
2124
- $[4] === t3 ? t4 = $[5] : (t4 = /* @__PURE__ */ jsx(Text, {
2125
- size: 1,
2126
- textOverflow: "ellipsis",
2127
- weight: "semibold",
2128
- children: t3
2129
- }), $[4] = t3, $[5] = t4);
2130
- let t5;
2131
- $[6] !== t1 || $[7] !== t4 ? (t5 = /* @__PURE__ */ jsx(Box, {
2183
+ }), $[2] = inList, $[3] = send, $[4] = t1) : t1 = $[4];
2184
+ let t2 = VIEW_TITLES[view.name], t3;
2185
+ $[5] === t2 ? t3 = $[6] : (t3 = /* @__PURE__ */ jsx(Box, {
2186
+ className: title,
2132
2187
  flex: 1,
2133
- paddingLeft: t1,
2134
- style: t2,
2135
- children: t4
2136
- }), $[6] = t1, $[7] = t4, $[8] = t5) : t5 = $[8];
2137
- let t6;
2138
- $[9] !== send || $[10] !== split || $[11] !== view.name ? (t6 = view.name !== "removed" && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(TooltipButton, {
2188
+ children: /* @__PURE__ */ jsx(Text, {
2189
+ size: 1,
2190
+ textOverflow: "ellipsis",
2191
+ weight: "semibold",
2192
+ children: t2
2193
+ })
2194
+ }), $[5] = t2, $[6] = t3);
2195
+ let t4;
2196
+ $[7] !== send || $[8] !== split || $[9] !== view.name ? (t4 = view.name !== "removed" && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(TooltipButton, {
2139
2197
  "aria-pressed": split,
2140
2198
  icon: SplitVerticalIcon,
2141
2199
  mode: "bleed",
@@ -2149,66 +2207,69 @@ function ThemerSidebar() {
2149
2207
  onClick: () => setSnippetOpen(!0),
2150
2208
  padding: 2,
2151
2209
  tooltip: "Show the code for the applied theme"
2152
- })] }), $[9] = send, $[10] = split, $[11] = view.name, $[12] = t6) : t6 = $[12];
2153
- let t7;
2154
- $[13] === send ? t7 = $[14] : (t7 = /* @__PURE__ */ jsx(TooltipButton, {
2210
+ })] }), $[7] = send, $[8] = split, $[9] = view.name, $[10] = t4) : t4 = $[10];
2211
+ let t5;
2212
+ $[11] === send ? t5 = $[12] : (t5 = /* @__PURE__ */ jsx(TooltipButton, {
2155
2213
  icon: CloseIcon,
2156
2214
  mode: "bleed",
2157
2215
  onClick: () => send({ type: "sidebar.close" }),
2158
2216
  padding: 2,
2159
2217
  tooltip: "Close themer"
2160
- }), $[13] = send, $[14] = t7);
2218
+ }), $[11] = send, $[12] = t5);
2219
+ let t6;
2220
+ $[13] !== t4 || $[14] !== t5 ? (t6 = /* @__PURE__ */ jsxs(Flex, { children: [t4, t5] }), $[13] = t4, $[14] = t5, $[15] = t6) : t6 = $[15];
2221
+ let t7;
2222
+ $[16] !== t1 || $[17] !== t3 || $[18] !== t6 ? (t7 = /* @__PURE__ */ jsxs(Flex, {
2223
+ align: "center",
2224
+ gap: 1,
2225
+ height: "fill",
2226
+ children: [
2227
+ t1,
2228
+ t3,
2229
+ t6
2230
+ ]
2231
+ }), $[16] = t1, $[17] = t3, $[18] = t6, $[19] = t7) : t7 = $[19];
2161
2232
  let t8;
2162
- $[15] !== t6 || $[16] !== t7 ? (t8 = /* @__PURE__ */ jsxs(Flex, { children: [t6, t7] }), $[15] = t6, $[16] = t7, $[17] = t8) : t8 = $[17];
2233
+ $[20] !== t0 || $[21] !== t7 ? (t8 = /* @__PURE__ */ jsx(Card, {
2234
+ borderBottom: !0,
2235
+ padding: 3,
2236
+ sizing: "border",
2237
+ style: t0,
2238
+ children: t7
2239
+ }), $[20] = t0, $[21] = t7, $[22] = t8) : t8 = $[22];
2163
2240
  let t9;
2164
- $[18] !== t0 || $[19] !== t5 || $[20] !== t8 ? (t9 = /* @__PURE__ */ jsx(Card, {
2165
- padding: 2,
2166
- children: /* @__PURE__ */ jsxs(Flex, {
2167
- align: "center",
2168
- gap: 1,
2169
- children: [
2170
- t0,
2171
- t5,
2172
- t8
2173
- ]
2174
- })
2175
- }), $[18] = t0, $[19] = t5, $[20] = t8, $[21] = t9) : t9 = $[21];
2241
+ $[23] === view.name ? t9 = $[24] : (t9 = view.name === "list" && /* @__PURE__ */ jsx(ThemeList, {}), $[23] = view.name, $[24] = t9);
2176
2242
  let t10;
2177
- $[22] === view.name ? t10 = $[23] : (t10 = view.name === "list" && /* @__PURE__ */ jsx(ThemeList, {}), $[22] = view.name, $[23] = t10);
2178
- let t11;
2179
- $[24] !== view.focusTitle || $[25] !== view.name || $[26] !== view.slug ? (t11 = view.name === "edit" && /* @__PURE__ */ jsx(ThemeEditor, {
2243
+ $[25] !== view.focusTitle || $[26] !== view.name || $[27] !== view.slug ? (t10 = view.name === "edit" && /* @__PURE__ */ jsx(ThemeEditor, {
2180
2244
  focusTitle: view.focusTitle,
2181
2245
  slug: view.slug
2182
- }), $[24] = view.focusTitle, $[25] = view.name, $[26] = view.slug, $[27] = t11) : t11 = $[27];
2246
+ }), $[25] = view.focusTitle, $[26] = view.name, $[27] = view.slug, $[28] = t10) : t10 = $[28];
2247
+ let t11;
2248
+ $[29] === view.name ? t11 = $[30] : (t11 = view.name === "removed" && /* @__PURE__ */ jsx(RemovedThemes, {}), $[29] = view.name, $[30] = t11);
2183
2249
  let t12;
2184
- $[28] === view.name ? t12 = $[29] : (t12 = view.name === "removed" && /* @__PURE__ */ jsx(RemovedThemes, {}), $[28] = view.name, $[29] = t12);
2185
- let t13;
2186
- $[30] !== t10 || $[31] !== t11 || $[32] !== t12 || $[33] !== t9 ? (t13 = /* @__PURE__ */ jsxs(Flex, {
2250
+ $[31] !== t10 || $[32] !== t11 || $[33] !== t8 || $[34] !== t9 ? (t12 = /* @__PURE__ */ jsxs(Flex, {
2187
2251
  direction: "column",
2188
2252
  height: "fill",
2189
2253
  children: [
2254
+ t8,
2190
2255
  t9,
2191
2256
  t10,
2192
- t11,
2193
- t12
2257
+ t11
2194
2258
  ]
2195
- }), $[30] = t10, $[31] = t11, $[32] = t12, $[33] = t9, $[34] = t13) : t13 = $[34];
2196
- let t14;
2197
- $[35] !== active || $[36] !== snippetOpen ? (t14 = snippetOpen && /* @__PURE__ */ jsx(ThemeSnippetDialog, {
2259
+ }), $[31] = t10, $[32] = t11, $[33] = t8, $[34] = t9, $[35] = t12) : t12 = $[35];
2260
+ let t13;
2261
+ $[36] !== active || $[37] !== snippetOpen ? (t13 = snippetOpen && /* @__PURE__ */ jsx(ThemeSnippetDialog, {
2198
2262
  onClose: () => setSnippetOpen(!1),
2199
2263
  theme: active
2200
- }), $[35] = active, $[36] = snippetOpen, $[37] = t14) : t14 = $[37];
2201
- let t15;
2202
- return $[38] !== t13 || $[39] !== t14 ? (t15 = /* @__PURE__ */ jsxs(Card, {
2264
+ }), $[36] = active, $[37] = snippetOpen, $[38] = t13) : t13 = $[38];
2265
+ let t14;
2266
+ return $[39] !== t12 || $[40] !== t13 ? (t14 = /* @__PURE__ */ jsxs(Card, {
2203
2267
  height: "fill",
2204
- children: [t13, t14]
2205
- }), $[38] = t13, $[39] = t14, $[40] = t15) : t15 = $[40], t15;
2268
+ children: [t12, t13]
2269
+ }), $[39] = t12, $[40] = t13, $[41] = t14) : t14 = $[41], t14;
2206
2270
  }
2207
- /**
2208
- * The narrowest the sidebar goes — and its default: narrow enough to leave the
2209
- * studio preview as much room as possible, while the themes stack in a single
2210
- * column of preview cards and the editor fits a swatch next to its label.
2211
- */
2271
+ var content = "bgn4np4", frame = "bgn4np3", sidebar = "bgn4np2";
2272
+ /** How far one arrow key press resizes the sidebar */
2212
2273
  const WIDTH_STORAGE_KEY = "sanityStudio:themer:width";
2213
2274
  function clampWidth(width) {
2214
2275
  return Math.min(400, Math.max(200, Math.round(width)));
@@ -2226,25 +2287,16 @@ function writeStoredWidth(width) {
2226
2287
  width === 200 ? localStorage.removeItem(WIDTH_STORAGE_KEY) : localStorage.setItem(WIDTH_STORAGE_KEY, String(width));
2227
2288
  } catch {}
2228
2289
  }
2229
- const Sidebar = styled(Layer).withConfig({
2230
- displayName: "Sidebar",
2231
- componentId: "sc-ryrt6y-0"
2232
- })`flex:none;`, Frame = styled(Card).withConfig({
2233
- displayName: "Frame",
2234
- componentId: "sc-ryrt6y-1"
2235
- })`position:relative;`, ResizeHandle = styled.div.withConfig({
2236
- displayName: "ResizeHandle",
2237
- componentId: "sc-ryrt6y-2"
2238
- })`position:absolute;top:0;bottom:0;left:-3px;z-index:1;width:7px;cursor:col-resize;touch-action:none;&::after{content:'';position:absolute;top:0;bottom:0;left:2px;width:3px;background:var(--card-focus-ring-color);opacity:0;transition:opacity 100ms;}&:hover::after,&:focus-visible::after,&[data-dragging='true']::after{opacity:1;}&:focus{outline:none;}`;
2239
2290
  /**
2240
2291
  * The themer sidebar, in a layer along the right edge of the Studio. Its left
2241
2292
  * edge drags (or arrow-keys) it wider, up to twice its default width — the
2242
- * width sticks between sessions.
2293
+ * width sticks between sessions. As an overlay (small screens) it covers the
2294
+ * Studio edge to edge instead, with nothing to resize.
2243
2295
  *
2244
2296
  * @internal
2245
2297
  */
2246
- function ResizableSidebar() {
2247
- let $ = c(21), [width, setWidth] = useState(readStoredWidth), [dragging, setDragging] = useState(!1), drag = useRef(null), t0, t1;
2298
+ function ResizableSidebar(props) {
2299
+ let $ = c(24), { overlay } = props, [width, setWidth] = useState(readStoredWidth), [dragging, setDragging] = useState(!1), drag = useRef(null), t0, t1;
2248
2300
  $[0] === width ? (t0 = $[1], t1 = $[2]) : (t0 = () => writeStoredWidth(width), t1 = [width], $[0] = width, $[1] = t0, $[2] = t1), useEffect(t0, t1);
2249
2301
  let t2;
2250
2302
  $[3] === width ? t2 = $[4] : (t2 = (event) => {
@@ -2273,18 +2325,17 @@ function ResizableSidebar() {
2273
2325
  step !== void 0 && (event_2.preventDefault(), setWidth((current) => clampWidth(current + step)));
2274
2326
  }, $[7] = t5) : t5 = $[7];
2275
2327
  let handleKeyDown = t5, t6;
2276
- $[8] === width ? t6 = $[9] : (t6 = { width }, $[8] = width, $[9] = t6);
2277
- let t7;
2278
- $[10] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => setWidth(200), $[10] = t7) : t7 = $[10];
2279
- let t8;
2280
- $[11] !== dragging || $[12] !== handlePointerDown || $[13] !== width ? (t8 = /* @__PURE__ */ jsx(ResizeHandle, {
2328
+ $[8] !== overlay || $[9] !== width ? (t6 = overlay ? void 0 : { width }, $[8] = overlay, $[9] = width, $[10] = t6) : t6 = $[10];
2329
+ let t7 = !overlay, t8;
2330
+ $[11] !== dragging || $[12] !== handlePointerDown || $[13] !== overlay || $[14] !== width ? (t8 = !overlay && /* @__PURE__ */ jsx("div", {
2281
2331
  "aria-label": "Resize the themer",
2332
+ className: "bgn4np5",
2282
2333
  "aria-orientation": "vertical",
2283
2334
  "aria-valuemax": 400,
2284
2335
  "aria-valuemin": 200,
2285
2336
  "aria-valuenow": width,
2286
2337
  "data-dragging": dragging,
2287
- onDoubleClick: t7,
2338
+ onDoubleClick: () => setWidth(200),
2288
2339
  onKeyDown: handleKeyDown,
2289
2340
  onPointerCancel: handlePointerUp,
2290
2341
  onPointerDown: handlePointerDown,
@@ -2292,25 +2343,29 @@ function ResizableSidebar() {
2292
2343
  onPointerUp: handlePointerUp,
2293
2344
  role: "separator",
2294
2345
  tabIndex: 0
2295
- }), $[11] = dragging, $[12] = handlePointerDown, $[13] = width, $[14] = t8) : t8 = $[14];
2346
+ }), $[11] = dragging, $[12] = handlePointerDown, $[13] = overlay, $[14] = width, $[15] = t8) : t8 = $[15];
2296
2347
  let t9;
2297
- $[15] === Symbol.for("react.memo_cache_sentinel") ? (t9 = /* @__PURE__ */ jsx(Box, {
2348
+ $[16] === Symbol.for("react.memo_cache_sentinel") ? (t9 = /* @__PURE__ */ jsx(Box, {
2349
+ className: content,
2298
2350
  height: "fill",
2299
2351
  overflow: "hidden",
2300
2352
  children: /* @__PURE__ */ jsx(ThemerSidebar, {})
2301
- }), $[15] = t9) : t9 = $[15];
2353
+ }), $[16] = t9) : t9 = $[16];
2302
2354
  let t10;
2303
- $[16] === t8 ? t10 = $[17] : (t10 = /* @__PURE__ */ jsxs(Frame, {
2304
- borderLeft: !0,
2355
+ $[17] !== t7 || $[18] !== t8 ? (t10 = /* @__PURE__ */ jsxs(Card, {
2356
+ borderLeft: t7,
2357
+ className: frame,
2305
2358
  height: "fill",
2306
2359
  children: [t8, t9]
2307
- }), $[16] = t8, $[17] = t10);
2360
+ }), $[17] = t7, $[18] = t8, $[19] = t10) : t10 = $[19];
2308
2361
  let t11;
2309
- return $[18] !== t10 || $[19] !== t6 ? (t11 = /* @__PURE__ */ jsx(Sidebar, {
2362
+ return $[20] !== overlay || $[21] !== t10 || $[22] !== t6 ? (t11 = /* @__PURE__ */ jsx(Layer, {
2363
+ className: sidebar,
2364
+ "data-overlay": overlay,
2310
2365
  style: t6,
2311
2366
  zOffset: 100,
2312
2367
  children: t10
2313
- }), $[18] = t10, $[19] = t6, $[20] = t11) : t11 = $[20], t11;
2368
+ }), $[20] = overlay, $[21] = t10, $[22] = t6, $[23] = t11) : t11 = $[23], t11;
2314
2369
  }
2315
2370
  const STORAGE_KEY = "sanityStudio:themer:state", LEGACY_STORAGE_KEY = "sanityStudio:themer:options";
2316
2371
  function sanitizeColor(value) {
@@ -2390,11 +2445,14 @@ function sanitizeState(value) {
2390
2445
  }
2391
2446
  let removed = [], rawRemoved = Reflect.get(value, "removed");
2392
2447
  if (Array.isArray(rawRemoved)) for (let slug of rawRemoved) typeof slug == "string" && slug !== "config" && (presets.some((preset) => preset.slug === slug) || custom.some((theme) => theme.slug === slug)) && !removed.includes(slug) && removed.push(slug);
2448
+ let order = [], rawOrder = Reflect.get(value, "order");
2449
+ if (Array.isArray(rawOrder)) for (let slug of rawOrder) typeof slug == "string" && (slug === "config" || presets.some((preset) => preset.slug === slug) || custom.some((theme) => theme.slug === slug)) && !order.includes(slug) && order.push(slug);
2393
2450
  let rawActive = Reflect.get(value, "active");
2394
2451
  return {
2395
2452
  active: typeof rawActive == "string" ? rawActive : null,
2396
2453
  custom,
2397
- removed
2454
+ removed,
2455
+ order
2398
2456
  };
2399
2457
  }
2400
2458
  function readLegacyState() {
@@ -2406,7 +2464,8 @@ function readLegacyState() {
2406
2464
  return {
2407
2465
  active: theme.slug,
2408
2466
  custom: [theme],
2409
- removed: []
2467
+ removed: [],
2468
+ order: []
2410
2469
  };
2411
2470
  }
2412
2471
  /**
@@ -2432,8 +2491,49 @@ function writeStoredState(state) {
2432
2491
  localStorage.setItem(STORAGE_KEY, JSON.stringify(state)), localStorage.removeItem(LEGACY_STORAGE_KEY);
2433
2492
  } catch {}
2434
2493
  }
2494
+ /**
2495
+ * The height of the Studio navbar inside the given element, in pixels — kept
2496
+ * up to date as the navbar renders, remounts and resizes, and `null` until
2497
+ * there is one. The themer's header takes this height, so that its bottom
2498
+ * border lines up with the navbar's whatever height the Studio version, its
2499
+ * breakpoint or a custom navbar gives it.
2500
+ *
2501
+ * @internal
2502
+ */
2503
+ function useStudioNavbarHeight(ref) {
2504
+ let $ = c(3), [height, setHeight] = useState(null), t0, t1;
2505
+ return $[0] === ref ? (t0 = $[1], t1 = $[2]) : (t0 = () => {
2506
+ let root = ref.current;
2507
+ if (!root) return;
2508
+ let navbar = null, resizeObserver = new ResizeObserver(() => {
2509
+ navbar && setHeight(navbar.getBoundingClientRect().height);
2510
+ }), observeNavbar = () => {
2511
+ let next = root.querySelector("[data-testid=\"studio-navbar\"]");
2512
+ next !== navbar && (navbar && resizeObserver.unobserve(navbar), navbar = next, navbar ? (resizeObserver.observe(navbar), setHeight(navbar.getBoundingClientRect().height)) : setHeight(null));
2513
+ }, mutationObserver = new MutationObserver(observeNavbar);
2514
+ return mutationObserver.observe(root, {
2515
+ childList: !0,
2516
+ subtree: !0
2517
+ }), observeNavbar(), () => {
2518
+ mutationObserver.disconnect(), resizeObserver.disconnect();
2519
+ };
2520
+ }, t1 = [ref], $[0] = ref, $[1] = t0, $[2] = t1), useEffect(t0, t1), height;
2521
+ }
2522
+ var PANEL_TRANSITION = "_1yq4ar71", SPLIT_TRANSITION = "_1yq4ar70", layout = "_1yq4ar79", panelTransitionClasses = {
2523
+ slideIn: "_1yq4ar77",
2524
+ slideOut: "_1yq4ar78"
2525
+ }, splitTransitionClasses = {
2526
+ resize: "_1yq4ar72",
2527
+ slideIn: "_1yq4ar73",
2528
+ slideOut: "_1yq4ar74",
2529
+ dropIn: "_1yq4ar75",
2530
+ dropOut: "_1yq4ar76"
2531
+ }, studioScheme = {
2532
+ light: "_1yq4ar7a",
2533
+ dark: "_1yq4ar7b"
2534
+ };
2435
2535
  function sameStoredState(a, b) {
2436
- return a.active === b.active && a.custom === b.custom && a.removed === b.removed;
2536
+ return a.active === b.active && a.custom === b.custom && a.removed === b.removed && a.order === b.order;
2437
2537
  }
2438
2538
  function selectView(snapshot) {
2439
2539
  let { editing } = snapshot.context;
@@ -2455,13 +2555,16 @@ function sameView(a, b) {
2455
2555
  * `layout` level rather than in `activeToolLayout` because the split preview
2456
2556
  * renders the Studio twice, and the sidebar must not come along.
2457
2557
  *
2458
- * The single preview inherits the color scheme from the Studio, so it follows
2459
- * the appearance setting (light/dark/system) like any other theme.
2558
+ * The Studio next to the sidebar always follows the appearance setting
2559
+ * (light/dark/system) and the picked theme like any other theme would. The
2560
+ * split preview adds a second copy in the opposite scheme on the far side —
2561
+ * or on top, on small screens — through React's view transitions (React
2562
+ * 19.3), styled in `ThemerLayout.css.ts`.
2460
2563
  *
2461
2564
  * @internal
2462
2565
  */
2463
2566
  function ThemerLayout(props) {
2464
- let $ = c(55), { baseOptions, ...layoutProps } = props, t0;
2567
+ let $ = c(87), { baseOptions, ...layoutProps } = props, t0;
2465
2568
  $[0] === baseOptions ? t0 = $[1] : (t0 = () => ({
2466
2569
  baseOptions,
2467
2570
  stored: readStoredState()
@@ -2472,35 +2575,65 @@ function ThemerLayout(props) {
2472
2575
  $[4] === snapshot ? t2 = $[5] : (t2 = snapshot.matches({ sidebar: "open" }), $[4] = snapshot, $[5] = t2);
2473
2576
  let open = t2, t3;
2474
2577
  $[6] === snapshot ? t3 = $[7] : (t3 = snapshot.matches({ preview: "split" }), $[6] = snapshot, $[7] = t3);
2475
- let split = t3, { images } = snapshot.context, t4, t5;
2476
- $[8] === stored ? (t4 = $[9], t5 = $[10]) : (t4 = () => writeStoredState(stored), t5 = [stored], $[8] = stored, $[9] = t4, $[10] = t5), useEffect(t4, t5);
2477
- let previousImages = useRef(images), t6, t7;
2478
- $[11] === images ? (t6 = $[12], t7 = $[13]) : (t6 = () => {
2578
+ let split = t3, { images } = snapshot.context, mobile = useMediaIndex() <= 1, studioRef = useRef(null), navbarHeight = useStudioNavbarHeight(studioRef), t4;
2579
+ $[8] !== open || $[9] !== split ? (t4 = {
2580
+ open,
2581
+ split
2582
+ }, $[8] = open, $[9] = split, $[10] = t4) : t4 = $[10];
2583
+ let [shown, setShown] = useState(t4), [resizing, setResizing] = useState(!1), t5;
2584
+ $[11] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => setResizing(!1), $[11] = t5) : t5 = $[11];
2585
+ let stopResizing = t5, t6;
2586
+ $[12] !== open || $[13] !== shown.open || $[14] !== shown.split || $[15] !== split ? (t6 = () => {
2587
+ (shown.open !== open || shown.split !== split) && startTransition(() => {
2588
+ shown.open !== open && addTransitionType(PANEL_TRANSITION), shown.split !== split && addTransitionType(SPLIT_TRANSITION), setShown({
2589
+ open,
2590
+ split
2591
+ }), setResizing(!0);
2592
+ });
2593
+ }, $[12] = open, $[13] = shown.open, $[14] = shown.split, $[15] = split, $[16] = t6) : t6 = $[16];
2594
+ let t7;
2595
+ $[17] !== open || $[18] !== shown || $[19] !== split ? (t7 = [
2596
+ open,
2597
+ shown,
2598
+ split
2599
+ ], $[17] = open, $[18] = shown, $[19] = split, $[20] = t7) : t7 = $[20], useEffect(t6, t7);
2600
+ let t8;
2601
+ $[21] === resizing ? t8 = $[22] : (t8 = () => {
2602
+ if (!resizing) return;
2603
+ let timer = setTimeout(() => setResizing(!1), 500);
2604
+ return () => clearTimeout(timer);
2605
+ }, $[21] = resizing, $[22] = t8);
2606
+ let t9;
2607
+ $[23] !== resizing || $[24] !== shown ? (t9 = [resizing, shown], $[23] = resizing, $[24] = shown, $[25] = t9) : t9 = $[25], useEffect(t8, t9);
2608
+ let t10, t11;
2609
+ $[26] === stored ? (t10 = $[27], t11 = $[28]) : (t10 = () => writeStoredState(stored), t11 = [stored], $[26] = stored, $[27] = t10, $[28] = t11), useEffect(t10, t11);
2610
+ let previousImages = useRef(images), t12, t13;
2611
+ $[29] === images ? (t12 = $[30], t13 = $[31]) : (t12 = () => {
2479
2612
  let current = new Set(Object.values(images));
2480
2613
  for (let url of Object.values(previousImages.current)) current.has(url) || URL.revokeObjectURL(url);
2481
2614
  previousImages.current = images;
2482
- }, t7 = [images], $[11] = images, $[12] = t6, $[13] = t7), useEffect(t6, t7);
2483
- let t8, t9;
2484
- $[14] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => () => {
2615
+ }, t13 = [images], $[29] = images, $[30] = t12, $[31] = t13), useEffect(t12, t13);
2616
+ let t14, t15;
2617
+ $[32] === Symbol.for("react.memo_cache_sentinel") ? (t14 = () => () => {
2485
2618
  for (let url_0 of Object.values(previousImages.current)) URL.revokeObjectURL(url_0);
2486
- }, t9 = [], $[14] = t8, $[15] = t9) : (t8 = $[14], t9 = $[15]), useEffect(t8, t9);
2487
- let t10;
2488
- $[16] !== baseOptions || $[17] !== stored ? (t10 = resolveThemes(stored, baseOptions), $[16] = baseOptions, $[17] = stored, $[18] = t10) : t10 = $[18];
2489
- let { themes, removed, active } = t10, activeOptions = active.source === "config" ? null : active.options, t11;
2490
- $[19] === activeOptions ? t11 = $[20] : (t11 = activeOptions === null ? null : buildTheme(activeOptions), $[19] = activeOptions, $[20] = t11);
2491
- let theme = t11, scheme = useColorSchemeValue(), t12;
2492
- $[21] !== scheme || $[22] !== theme?.v2?.color ? (t12 = () => {
2619
+ }, t15 = [], $[32] = t14, $[33] = t15) : (t14 = $[32], t15 = $[33]), useEffect(t14, t15);
2620
+ let t16;
2621
+ $[34] !== baseOptions || $[35] !== stored ? (t16 = resolveThemes(stored, baseOptions), $[34] = baseOptions, $[35] = stored, $[36] = t16) : t16 = $[36];
2622
+ let { themes, removed, active } = t16, activeOptions = active.source === "config" ? null : active.options, t17;
2623
+ $[37] === activeOptions ? t17 = $[38] : (t17 = activeOptions === null ? null : buildTheme(activeOptions), $[37] = activeOptions, $[38] = t17);
2624
+ let theme = t17, scheme = useColorSchemeValue(), oppositeScheme = scheme === "dark" ? "light" : "dark", t18;
2625
+ $[39] !== scheme || $[40] !== theme?.v2?.color ? (t18 = () => {
2493
2626
  let background = theme?.v2?.color[scheme].default.bg;
2494
2627
  if (background === void 0) return;
2495
2628
  let { style } = document.body, previous = style.backgroundColor;
2496
2629
  return style.backgroundColor = background, () => {
2497
2630
  style.backgroundColor = previous;
2498
2631
  };
2499
- }, $[21] = scheme, $[22] = theme?.v2?.color, $[23] = t12) : t12 = $[23];
2500
- let t13;
2501
- $[24] !== scheme || $[25] !== theme ? (t13 = [scheme, theme], $[24] = scheme, $[25] = theme, $[26] = t13) : t13 = $[26], useEffect(t12, t13);
2502
- let t14;
2503
- $[27] !== active || $[28] !== baseOptions || $[29] !== images || $[30] !== open || $[31] !== removed || $[32] !== send || $[33] !== split || $[34] !== themes || $[35] !== view ? (t14 = {
2632
+ }, $[39] = scheme, $[40] = theme?.v2?.color, $[41] = t18) : t18 = $[41];
2633
+ let t19;
2634
+ $[42] !== scheme || $[43] !== theme ? (t19 = [scheme, theme], $[42] = scheme, $[43] = theme, $[44] = t19) : t19 = $[44], useEffect(t18, t19);
2635
+ let t20;
2636
+ $[45] !== active || $[46] !== baseOptions || $[47] !== images || $[48] !== mobile || $[49] !== navbarHeight || $[50] !== open || $[51] !== removed || $[52] !== send || $[53] !== split || $[54] !== themes || $[55] !== view ? (t20 = {
2504
2637
  baseOptions,
2505
2638
  themes,
2506
2639
  removed,
@@ -2509,41 +2642,72 @@ function ThemerLayout(props) {
2509
2642
  view,
2510
2643
  open,
2511
2644
  split,
2645
+ mobile,
2646
+ navbarHeight,
2512
2647
  send
2513
- }, $[27] = active, $[28] = baseOptions, $[29] = images, $[30] = open, $[31] = removed, $[32] = send, $[33] = split, $[34] = themes, $[35] = view, $[36] = t14) : t14 = $[36];
2514
- let context = t14, studio = layoutProps.renderDefault(layoutProps), t15 = split ? "light" : void 0, t16;
2515
- $[37] !== studio || $[38] !== t15 || $[39] !== theme ? (t16 = /* @__PURE__ */ jsx(StudioPreview, {
2516
- scheme: t15,
2517
- theme,
2518
- children: studio
2519
- }), $[37] = studio, $[38] = t15, $[39] = theme, $[40] = t16) : t16 = $[40];
2520
- let t17;
2521
- $[41] !== split || $[42] !== studio || $[43] !== theme ? (t17 = split && /* @__PURE__ */ jsx(StudioPreview, {
2522
- borderLeft: !0,
2523
- scheme: "dark",
2648
+ }, $[45] = active, $[46] = baseOptions, $[47] = images, $[48] = mobile, $[49] = navbarHeight, $[50] = open, $[51] = removed, $[52] = send, $[53] = split, $[54] = themes, $[55] = view, $[56] = t20) : t20 = $[56];
2649
+ let context = t20, studio = layoutProps.renderDefault(layoutProps), t21 = mobile ? "column" : "row", t22;
2650
+ $[57] !== mobile || $[58] !== oppositeScheme || $[59] !== shown.open || $[60] !== shown.split || $[61] !== studio || $[62] !== theme ? (t22 = shown.open && /* @__PURE__ */ jsx(Activity, {
2651
+ mode: shown.split ? "visible" : "hidden",
2652
+ children: /* @__PURE__ */ jsx(ViewTransition, {
2653
+ enter: mobile ? splitTransitionClasses.dropIn : splitTransitionClasses.slideIn,
2654
+ exit: mobile ? splitTransitionClasses.dropOut : splitTransitionClasses.slideOut,
2655
+ update: "none",
2656
+ children: /* @__PURE__ */ jsx(StudioPreview, {
2657
+ borderBottom: mobile,
2658
+ borderRight: !mobile,
2659
+ scheme: oppositeScheme,
2660
+ theme,
2661
+ children: studio
2662
+ })
2663
+ }, "opposite")
2664
+ }), $[57] = mobile, $[58] = oppositeScheme, $[59] = shown.open, $[60] = shown.split, $[61] = studio, $[62] = theme, $[63] = t22) : t22 = $[63];
2665
+ let t23 = resizing ? splitTransitionClasses.resize : "none", t24;
2666
+ $[64] !== studio || $[65] !== theme ? (t24 = /* @__PURE__ */ jsx(StudioPreview, {
2667
+ ref: studioRef,
2524
2668
  theme,
2525
2669
  children: studio
2526
- }), $[41] = split, $[42] = studio, $[43] = theme, $[44] = t17) : t17 = $[44];
2527
- let t18;
2528
- $[45] !== open || $[46] !== theme ? (t18 = open && /* @__PURE__ */ jsx(ThemeProvider, {
2529
- theme: theme ?? void 0,
2530
- children: /* @__PURE__ */ jsx(ResizableSidebar, {})
2531
- }), $[45] = open, $[46] = theme, $[47] = t18) : t18 = $[47];
2532
- let t19;
2533
- $[48] !== t16 || $[49] !== t17 || $[50] !== t18 ? (t19 = /* @__PURE__ */ jsxs(Flex, {
2670
+ }), $[64] = studio, $[65] = theme, $[66] = t24) : t24 = $[66];
2671
+ let t25;
2672
+ $[67] !== stopResizing || $[68] !== t23 || $[69] !== t24 ? (t25 = /* @__PURE__ */ jsx(ViewTransition, {
2673
+ onUpdate: stopResizing,
2674
+ update: t23,
2675
+ children: t24
2676
+ }, "primary"), $[67] = stopResizing, $[68] = t23, $[69] = t24, $[70] = t25) : t25 = $[70];
2677
+ let t26 = shown.open ? "visible" : "hidden", t27 = theme ?? void 0, t28;
2678
+ $[71] === mobile ? t28 = $[72] : (t28 = /* @__PURE__ */ jsx(ResizableSidebar, { overlay: mobile }), $[71] = mobile, $[72] = t28);
2679
+ let t29;
2680
+ $[73] !== t27 || $[74] !== t28 ? (t29 = /* @__PURE__ */ jsx(ViewTransition, {
2681
+ enter: panelTransitionClasses.slideIn,
2682
+ exit: panelTransitionClasses.slideOut,
2683
+ update: "none",
2684
+ children: /* @__PURE__ */ jsx(ThemeProvider, {
2685
+ theme: t27,
2686
+ children: t28
2687
+ })
2688
+ }, "panel"), $[73] = t27, $[74] = t28, $[75] = t29) : t29 = $[75];
2689
+ let t30;
2690
+ $[76] !== t26 || $[77] !== t29 ? (t30 = /* @__PURE__ */ jsx(Activity, {
2691
+ mode: t26,
2692
+ children: t29
2693
+ }), $[76] = t26, $[77] = t29, $[78] = t30) : t30 = $[78];
2694
+ let t31;
2695
+ $[79] !== t21 || $[80] !== t22 || $[81] !== t25 || $[82] !== t30 ? (t31 = /* @__PURE__ */ jsxs(Flex, {
2696
+ className: layout,
2697
+ direction: t21,
2534
2698
  height: "fill",
2535
2699
  sizing: "border",
2536
2700
  children: [
2537
- t16,
2538
- t17,
2539
- t18
2701
+ t22,
2702
+ t25,
2703
+ t30
2540
2704
  ]
2541
- }), $[48] = t16, $[49] = t17, $[50] = t18, $[51] = t19) : t19 = $[51];
2542
- let t20;
2543
- return $[52] !== context || $[53] !== t19 ? (t20 = /* @__PURE__ */ jsx(ThemerContext.Provider, {
2705
+ }), $[79] = t21, $[80] = t22, $[81] = t25, $[82] = t30, $[83] = t31) : t31 = $[83];
2706
+ let t32;
2707
+ return $[84] !== context || $[85] !== t31 ? (t32 = /* @__PURE__ */ jsx(ThemerContext.Provider, {
2544
2708
  value: context,
2545
- children: t19
2546
- }), $[52] = context, $[53] = t19, $[54] = t20) : t20 = $[54], t20;
2709
+ children: t31
2710
+ }), $[84] = context, $[85] = t31, $[86] = t32) : t32 = $[86], t32;
2547
2711
  }
2548
2712
  /**
2549
2713
  * One copy of the Studio, in the given color scheme — or, without one, in the
@@ -2557,17 +2721,17 @@ function ThemerLayout(props) {
2557
2721
  * keeps native form controls and scrollbars in step with it.
2558
2722
  */
2559
2723
  function StudioPreview(props) {
2560
- let $ = c(10), { borderLeft, children, scheme, theme } = props, t0 = theme ?? void 0, t1;
2561
- $[0] === scheme ? t1 = $[1] : (t1 = scheme ? { colorScheme: scheme } : void 0, $[0] = scheme, $[1] = t1);
2562
- let t2;
2563
- $[2] !== borderLeft || $[3] !== children || $[4] !== t1 ? (t2 = /* @__PURE__ */ jsx(Card, {
2564
- borderLeft,
2724
+ let $ = c(10), { borderBottom, borderRight, children, ref, scheme, theme } = props, t0 = theme ?? void 0, t1 = scheme ? studioScheme[scheme] : void 0, t2;
2725
+ $[0] !== borderBottom || $[1] !== borderRight || $[2] !== children || $[3] !== ref || $[4] !== t1 ? (t2 = /* @__PURE__ */ jsx(Card, {
2726
+ borderBottom,
2727
+ borderRight,
2728
+ className: t1,
2565
2729
  flex: 1,
2566
2730
  height: "fill",
2567
2731
  overflow: "hidden",
2568
- style: t1,
2732
+ ref,
2569
2733
  children
2570
- }), $[2] = borderLeft, $[3] = children, $[4] = t1, $[5] = t2) : t2 = $[5];
2734
+ }), $[0] = borderBottom, $[1] = borderRight, $[2] = children, $[3] = ref, $[4] = t1, $[5] = t2) : t2 = $[5];
2571
2735
  let t3;
2572
2736
  return $[6] !== scheme || $[7] !== t0 || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsx(ThemeProvider, {
2573
2737
  scheme,