@r2digisolutions/components 0.23.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/components/atoms/Avatar/Avatar.stories.js +1 -1
  2. package/dist/components/atoms/BrandMark/BrandMark.svelte +47 -7
  3. package/dist/components/atoms/BrandMark/BrandMark.svelte.d.ts +4 -0
  4. package/dist/components/atoms/Input/Input.svelte +5 -4
  5. package/dist/components/atoms/Slider/Slider.svelte +19 -15
  6. package/dist/components/atoms/Slider/Slider.svelte.d.ts +2 -0
  7. package/dist/components/molecules/AuthCard/AuthCard.svelte +19 -4
  8. package/dist/components/molecules/AuthCard/AuthCard.svelte.d.ts +4 -0
  9. package/dist/components/molecules/CanvasElementsPanel/CanvasElementsPanel.svelte +90 -26
  10. package/dist/components/molecules/CanvasInspector/CanvasInspector.svelte +176 -5
  11. package/dist/components/molecules/ChipBar/ChipBar.svelte +18 -5
  12. package/dist/components/molecules/ChipBar/ChipBar.svelte.d.ts +1 -1
  13. package/dist/components/molecules/Combobox/Combobox.svelte +2 -2
  14. package/dist/components/molecules/DateTimePicker/DateTimePicker.svelte +121 -33
  15. package/dist/components/molecules/FormSection/FormSection.svelte +25 -28
  16. package/dist/components/molecules/ImageEditor/ImageEditor.svelte +183 -0
  17. package/dist/components/molecules/ImageEditor/ImageEditor.svelte.d.ts +19 -0
  18. package/dist/components/molecules/KnowledgeCard/KnowledgeCard.svelte +5 -5
  19. package/dist/components/molecules/LocaleSwitcher/LocaleSwitcher.svelte +58 -35
  20. package/dist/components/molecules/MediaLayerItem/MediaLayerItem.svelte +293 -39
  21. package/dist/components/molecules/MediaLayerItem/MediaLayerItem.svelte.d.ts +6 -1
  22. package/dist/components/molecules/MediaStage/MediaStage.svelte +302 -245
  23. package/dist/components/molecules/MentionInput/MentionInput.svelte +332 -120
  24. package/dist/components/molecules/MentionInput/MentionInput.svelte.d.ts +13 -2
  25. package/dist/components/molecules/SearchBar/SearchBar.svelte +7 -1
  26. package/dist/components/molecules/SearchInput/SearchInput.svelte +77 -18
  27. package/dist/components/molecules/SearchInput/SearchInput.svelte.d.ts +4 -0
  28. package/dist/components/molecules/SearchInput/SearchInputStory.svelte +1 -0
  29. package/dist/components/molecules/Select/Select.svelte +14 -1
  30. package/dist/components/molecules/Select/Select.svelte.d.ts +3 -0
  31. package/dist/components/molecules/UserMenu/UserMenu.svelte +30 -27
  32. package/dist/components/molecules/WidgetFrame/WidgetFrame.svelte +200 -17
  33. package/dist/components/molecules/WidgetFrame/WidgetFrame.svelte.d.ts +14 -0
  34. package/dist/components/organisms/AppShell/AppShell.svelte +7 -1
  35. package/dist/components/organisms/AppShell/AppShell.svelte.d.ts +2 -0
  36. package/dist/components/organisms/AuthShell/AuthShell.svelte +61 -29
  37. package/dist/components/organisms/AuthShell/AuthShell.svelte.d.ts +4 -0
  38. package/dist/components/organisms/CanvasEditor/CanvasEditor.svelte +156 -7
  39. package/dist/components/organisms/CanvasEditor/CanvasEditor.svelte.d.ts +5 -0
  40. package/dist/components/organisms/Navbar/Navbar.svelte +2 -2
  41. package/dist/components/organisms/ProfileHeaderUploader/ProfileHeaderUploader.svelte +314 -141
  42. package/dist/components/organisms/ProfileHeaderUploader/ProfileHeaderUploader.svelte.d.ts +20 -1
  43. package/dist/index.d.ts +3 -1
  44. package/dist/index.js +2 -1
  45. package/dist/styles.css +17 -0
  46. package/dist/utils/canvasDocument.d.ts +56 -4
  47. package/dist/utils/canvasDocument.js +91 -2
  48. package/dist/utils/canvasExport.d.ts +1 -1
  49. package/dist/utils/canvasExport.js +15 -25
  50. package/package.json +1 -1
@@ -6,12 +6,13 @@
6
6
 
7
7
  <script lang="ts">
8
8
  import type { Snippet } from 'svelte';
9
- import { getContext } from 'svelte';
9
+ import { getContext, untrack } from 'svelte';
10
10
  import DragHandle from '../../atoms/DragHandle/DragHandle.svelte';
11
11
  import Skeleton from '../../atoms/Skeleton/Skeleton.svelte';
12
12
  import Spinner from '../../atoms/Spinner/Spinner.svelte';
13
13
  import ChevronDown from '@lucide/svelte/icons/chevron-down';
14
14
  import RefreshCw from '@lucide/svelte/icons/refresh-cw';
15
+ import RotateCw from '@lucide/svelte/icons/rotate-cw';
15
16
  import X from '@lucide/svelte/icons/x';
16
17
  import {
17
18
  WIDGET_CANVAS_CONTEXT,
@@ -67,6 +68,18 @@
67
68
  stackIndex?: number;
68
69
  /** CSS transform on the freeform root (e.g. rotate/flip) so chrome rotates too. */
69
70
  transform?: string;
71
+ /** Current rotation in degrees. With `onrotation`, Canva chrome shows a rotate handle. */
72
+ rotation?: number;
73
+ onrotation?: (degrees: number) => void;
74
+ /**
75
+ * Size the frame from its content (`width: max-content; height: auto`).
76
+ * Used by text so the box stays stuck to the glyphs.
77
+ */
78
+ hugContent?: boolean;
79
+ /** Wrap limit in px. The box stays as wide as the text until this cap. */
80
+ hugMaxWidth?: number;
81
+ /** Fired when hugged content changes size. Not a user resize. */
82
+ oncontentresize?: (rect: WidgetRect) => void;
70
83
  collapsible?: boolean;
71
84
  collapsed?: boolean;
72
85
  loading?: boolean;
@@ -87,6 +100,8 @@
87
100
  onreload?: () => void | Promise<void>;
88
101
  oncollapse?: (collapsed: boolean) => void;
89
102
  onchange?: (rect: WidgetRect) => void;
103
+ /** When false, content may paint outside the frame. Text uses this so glyphs are not cropped. */
104
+ clipContent?: boolean;
90
105
  /**
91
106
  * When false, `onchange` still fires but this frame does not write `rect`.
92
107
  * Use when a parent owns live position (rigid multi-select / group move).
@@ -116,6 +131,11 @@
116
131
  raiseOnSelect = true,
117
132
  stackIndex,
118
133
  transform: frameTransform,
134
+ rotation = 0,
135
+ onrotation,
136
+ hugContent = false,
137
+ hugMaxWidth = 0,
138
+ oncontentresize,
119
139
  collapsible = false,
120
140
  collapsed = $bindable(false),
121
141
  loading = false,
@@ -135,6 +155,7 @@
135
155
  onreload,
136
156
  oncollapse,
137
157
  onchange,
158
+ clipContent = true,
138
159
  applyRect = true,
139
160
  oninteract
140
161
  }: WidgetFrameProps = $props();
@@ -142,6 +163,8 @@
142
163
  const canvas = getContext<WidgetCanvasContext | undefined>(WIDGET_CANVAS_CONTEXT);
143
164
 
144
165
  let mode = $state<'move' | 'resize' | null>(null);
166
+ let rotating = $state(false);
167
+ let rotateStart: { angle: number; rotation: number; cx: number; cy: number } | null = null;
145
168
  let edge = $state<WidgetResizeEdge>('se');
146
169
  let start = $state({ px: 0, py: 0, x: 0, y: 0, w: 0, h: 0 });
147
170
  /** Pointer down awaiting movement threshold before starting freeform drag (preserves dblclick). */
@@ -159,7 +182,14 @@
159
182
  /** Tamaño local cuando resizable sin freeform (EditableChrome, etc.) */
160
183
  let localW = $state<number | null>(null);
161
184
  let localH = $state<number | null>(null);
162
- let rootEl: HTMLDivElement | null = null;
185
+ let rootEl = $state<HTMLDivElement | null>(null);
186
+ /** Último tamaño ya enviado. Evita que medir → guardar → medir no pare. */
187
+ let hugSentW = -1;
188
+ let hugSentH = -1;
189
+ let hugPrevW = -1;
190
+ let hugPrevH = -1;
191
+ /** Alto real del texto (el rect del drag solo manda en el ancho). */
192
+ let hugLiveH = $state(0);
163
193
 
164
194
  function attachRoot(node: HTMLElement) {
165
195
  rootEl = node as HTMLDivElement;
@@ -168,6 +198,40 @@
168
198
  };
169
199
  }
170
200
 
201
+ $effect(() => {
202
+ const el = rootEl;
203
+ if (!hugContent || !el || !oncontentresize) return;
204
+ let frame = 0;
205
+ const publish = () => {
206
+ const w = el.offsetWidth;
207
+ const h = el.offsetHeight;
208
+ if (w < 1 || h < 1) return;
209
+ hugLiveH = h;
210
+ if (untrack(() => mode) === 'resize') return;
211
+ const same =
212
+ (Math.abs(w - hugSentW) <= 1 && Math.abs(h - hugSentH) <= 1) ||
213
+ (Math.abs(w - hugPrevW) <= 1 && Math.abs(h - hugPrevH) <= 1);
214
+ if (same) return;
215
+ const current = untrack(() => rect);
216
+ hugPrevW = hugSentW;
217
+ hugPrevH = hugSentH;
218
+ hugSentW = w;
219
+ hugSentH = h;
220
+ if (Math.abs(w - current.w) <= 1 && Math.abs(h - current.h) <= 1) return;
221
+ oncontentresize({ x: current.x, y: current.y, w, h });
222
+ };
223
+ const observer = new ResizeObserver(() => {
224
+ cancelAnimationFrame(frame);
225
+ frame = requestAnimationFrame(publish);
226
+ });
227
+ observer.observe(el);
228
+ frame = requestAnimationFrame(publish);
229
+ return () => {
230
+ cancelAnimationFrame(frame);
231
+ observer.disconnect();
232
+ };
233
+ });
234
+
171
235
  const showDragHandle = $derived(showChrome && (editable || freeform) && draggable);
172
236
  const showResizeHandle = $derived((editable || freeform) && resizable && !collapsed);
173
237
  const showReload = $derived(!!onreload);
@@ -207,13 +271,24 @@
207
271
  w: Math.max(minW, next.w),
208
272
  h: Math.max(minH, next.h)
209
273
  };
210
- if (canvas) {
211
- if (shouldSnapNow) r = canvas.snapRect(r, minW, minH);
212
- r = canvas.clampRect(r, minW, minH);
213
- } else {
214
- r = { ...r, x: Math.max(0, r.x), y: Math.max(0, r.y) };
274
+ if (!canvas) {
275
+ return { ...r, x: Math.max(0, r.x), y: Math.max(0, r.y) };
215
276
  }
216
- return r;
277
+ if (hugContent) {
278
+ // El tamaño es el del texto: la rejilla y el borde solo mueven x / y.
279
+ const el = rootEl;
280
+ const measured = {
281
+ ...r,
282
+ w: el && el.offsetWidth > 0 ? el.offsetWidth : r.w,
283
+ h: el && el.offsetHeight > 0 ? el.offsetHeight : r.h
284
+ };
285
+ let pos = measured;
286
+ if (shouldSnapNow) pos = canvas.snapRect(pos, minW, minH);
287
+ pos = canvas.clampRect({ ...measured, x: pos.x, y: pos.y }, minW, minH);
288
+ return { ...r, x: pos.x, y: pos.y };
289
+ }
290
+ if (shouldSnapNow) r = canvas.snapRect(r, minW, minH);
291
+ return canvas.clampRect(r, minW, minH);
217
292
  }
218
293
 
219
294
  function emitRect(next: WidgetRect) {
@@ -222,6 +297,49 @@
222
297
  onchange?.(r);
223
298
  }
224
299
 
300
+ function beginRotate(e: PointerEvent) {
301
+ if (!onrotation || !rootEl) return;
302
+ if (e.button !== 0 && e.pointerType === 'mouse') return;
303
+ e.preventDefault();
304
+ e.stopPropagation();
305
+ const box = rootEl.getBoundingClientRect();
306
+ rotateStart = {
307
+ angle: Math.atan2(
308
+ e.clientY - (box.top + box.height / 2),
309
+ e.clientX - (box.left + box.width / 2)
310
+ ),
311
+ rotation,
312
+ cx: box.left + box.width / 2,
313
+ cy: box.top + box.height / 2
314
+ };
315
+ rotating = true;
316
+ (e.currentTarget as HTMLElement).setPointerCapture(e.pointerId);
317
+ oninteract?.(true);
318
+ }
319
+
320
+ function moveRotate(e: PointerEvent) {
321
+ if (!rotating || !rotateStart || !onrotation) return;
322
+ const angle = Math.atan2(e.clientY - rotateStart.cy, e.clientX - rotateStart.cx);
323
+ let deg = rotateStart.rotation + ((angle - rotateStart.angle) * 180) / Math.PI;
324
+ deg = Math.round(deg);
325
+ if (e.shiftKey) deg = Math.round(deg / 15) * 15;
326
+ const norm = ((deg % 360) + 360) % 360;
327
+ for (const axis of [0, 90, 180, 270, 360]) {
328
+ if (!e.shiftKey && Math.abs(norm - axis) <= 4) {
329
+ deg = axis === 360 ? 0 : axis;
330
+ break;
331
+ }
332
+ }
333
+ onrotation(deg);
334
+ }
335
+
336
+ function endRotate() {
337
+ if (!rotating) return;
338
+ rotating = false;
339
+ rotateStart = null;
340
+ oninteract?.(false);
341
+ }
342
+
225
343
  function beginMove(e: PointerEvent) {
226
344
  if (e.button !== 0 && e.pointerType === 'mouse') return;
227
345
  bringToFront();
@@ -238,6 +356,10 @@
238
356
  e.stopPropagation();
239
357
  bringToFront();
240
358
  pendingMove = null;
359
+ hugSentW = -1;
360
+ hugSentH = -1;
361
+ hugPrevW = -1;
362
+ hugPrevH = -1;
241
363
  onresizestart?.(e, nextEdge);
242
364
  if (delegateResize || !builtinResize) return;
243
365
 
@@ -245,6 +367,10 @@
245
367
  edge = nextEdge;
246
368
  oninteract?.(true);
247
369
  if (freeform) {
370
+ if (hugContent && rootEl && rootEl.offsetWidth > 0) {
371
+ // Arrancar desde el tamaño real del texto, no del rect guardado: sin salto al pulsar.
372
+ rect = { ...rect, w: rootEl.offsetWidth, h: rootEl.offsetHeight };
373
+ }
248
374
  start = { px: e.clientX, py: e.clientY, ...rect };
249
375
  } else {
250
376
  const box = rootEl?.getBoundingClientRect();
@@ -352,8 +478,13 @@
352
478
  const wasInteracting = mode === 'move' || mode === 'resize' || !!pendingMove;
353
479
  pendingMove = null;
354
480
  if (mode === 'resize' && freeform) {
481
+ // Con hug el alto lo pone el texto: el rect del drag solo aporta x / y / ancho.
482
+ emitRect(hugContent && hugLiveH > 0 ? { ...rect, h: hugLiveH } : { ...rect });
483
+ hugSentW = -1;
484
+ hugSentH = -1;
485
+ hugPrevW = -1;
486
+ hugPrevH = -1;
355
487
  mode = null;
356
- emitRect({ ...rect });
357
488
  if (wasInteracting) oninteract?.(false);
358
489
  return;
359
490
  }
@@ -438,6 +569,11 @@
438
569
  const rootStyle = $derived.by(() => {
439
570
  if (freeform) {
440
571
  const xf = frameTransform ? `transform:${frameTransform};transform-origin:0 0;` : '';
572
+ if (hugContent) {
573
+ const liveWidth =
574
+ mode === 'resize' ? `${rect.w}px` : hugMaxWidth > 0 ? `${hugMaxWidth}px` : 'max-content';
575
+ return `left:${rect.x}px;top:${rect.y}px;width:${liveWidth};height:auto;z-index:${paintZ};${xf}`;
576
+ }
441
577
  return `left:${rect.x}px;top:${rect.y}px;width:${rect.w}px;height:${collapsed ? 'auto' : `${rect.h}px`};z-index:${paintZ};${xf}`;
442
578
  }
443
579
  if (localW != null) {
@@ -485,8 +621,7 @@
485
621
  ? String(className)
486
622
  .split(/\s+/)
487
623
  .filter(
488
- (token) =>
489
- token && token !== 'h-full' && token !== 'min-h-0' && token !== 'flex-1'
624
+ (token) => token && token !== 'h-full' && token !== 'min-h-0' && token !== 'flex-1'
490
625
  )
491
626
  : [];
492
627
  return [...base, 'h-auto', 'max-h-fit', 'w-full', 'shrink-0'].join(' ');
@@ -496,12 +631,10 @@
496
631
  const contentFit = $derived(
497
632
  collapsed ||
498
633
  (typeof className === 'string' &&
499
- className
500
- .split(/\s+/)
501
- .some((token) => token === 'h-auto' || token === 'max-h-fit'))
634
+ className.split(/\s+/).some((token) => token === 'h-auto' || token === 'max-h-fit'))
502
635
  );
503
636
  const bodyOverflowClass = $derived(
504
- contentFit ? 'overflow-visible' : flush ? 'overflow-hidden' : 'overflow-auto'
637
+ contentFit || !clipContent ? 'overflow-visible' : flush ? 'overflow-hidden' : 'overflow-auto'
505
638
  );
506
639
  </script>
507
640
 
@@ -509,7 +642,8 @@
509
642
  <div
510
643
  {@attach attachRoot}
511
644
  class={[
512
- 'group/widget min-h-0 min-w-0 flex flex-col overflow-visible',
645
+ 'group/widget flex flex-col overflow-visible',
646
+ hugContent ? 'min-h-min min-w-min' : 'min-h-0 min-w-0',
513
647
  !isCanva && showChrome && 'rounded-xl border-border bg-surface-elevated overflow-hidden border',
514
648
  !isCanva && !showChrome && 'bg-transparent',
515
649
  isCanva && 'bg-transparent',
@@ -628,7 +762,7 @@
628
762
  <div
629
763
  class={[
630
764
  'relative',
631
- contentFit ? 'flex-none' : 'min-h-0 flex-1',
765
+ contentFit || hugContent ? 'flex-none' : 'min-h-0 flex-1',
632
766
  flush ? 'p-0' : 'p-3',
633
767
  bodyOverflowClass
634
768
  ]}
@@ -678,6 +812,21 @@
678
812
  </div>
679
813
  {/if}
680
814
 
815
+ {#if isCanva && mode === 'resize'}
816
+ <div
817
+ class="rounded-md bg-neutral-900 px-2 py-1 font-medium text-white top-0 shadow-md pointer-events-none absolute left-1/2 z-30 -translate-x-1/2 -translate-y-[calc(100%+8px)] text-[11px] whitespace-nowrap"
818
+ >
819
+ {Math.round(rect.w)} × {Math.round(hugContent && hugLiveH > 0 ? hugLiveH : rect.h)}
820
+ </div>
821
+ {/if}
822
+ {#if isCanva && rotating}
823
+ <div
824
+ class="rounded-md bg-neutral-900 px-2 py-1 font-medium text-white mt-8 shadow-md pointer-events-none absolute top-full left-1/2 z-30 -translate-x-1/2 text-[11px] whitespace-nowrap"
825
+ >
826
+ {Math.round(rotation)}°
827
+ </div>
828
+ {/if}
829
+
681
830
  {#if showResizeHandle}
682
831
  {#each visibleResizeEdges as h (h.edge)}
683
832
  <div
@@ -690,6 +839,40 @@
690
839
  ></div>
691
840
  {/each}
692
841
 
842
+ {#if isCanva && onrotation}
843
+ <div
844
+ class="h-3 pointer-events-none absolute top-full left-1/2 z-20 w-px -translate-x-1/2 bg-[#3b82f6]"
845
+ ></div>
846
+ <div
847
+ class={[
848
+ edgeAccent,
849
+ 'mt-3 h-6 w-6 top-full left-1/2 z-20 flex -translate-x-1/2 cursor-grab items-center justify-center active:cursor-grabbing'
850
+ ]}
851
+ role="slider"
852
+ tabindex="0"
853
+ aria-label="Rotar"
854
+ aria-valuemin={-180}
855
+ aria-valuemax={180}
856
+ aria-valuenow={Math.round(rotation)}
857
+ onpointerdown={beginRotate}
858
+ onpointermove={moveRotate}
859
+ onpointerup={endRotate}
860
+ onpointercancel={endRotate}
861
+ onkeydown={(e) => {
862
+ if (!onrotation) return;
863
+ const step = e.shiftKey ? 15 : 1;
864
+ if (e.key === 'ArrowLeft' || e.key === 'ArrowDown') {
865
+ e.preventDefault();
866
+ onrotation(rotation - step);
867
+ } else if (e.key === 'ArrowRight' || e.key === 'ArrowUp') {
868
+ e.preventDefault();
869
+ onrotation(rotation + step);
870
+ }
871
+ }}
872
+ >
873
+ <RotateCw class="h-3 w-3 text-[#3b82f6]" />
874
+ </div>
875
+ {/if}
693
876
  {#if !isCanva}
694
877
  <!-- SE grip (visual only, small) -->
695
878
  <div
@@ -51,6 +51,18 @@ interface WidgetFrameProps {
51
51
  stackIndex?: number;
52
52
  /** CSS transform on the freeform root (e.g. rotate/flip) so chrome rotates too. */
53
53
  transform?: string;
54
+ /** Current rotation in degrees. With `onrotation`, Canva chrome shows a rotate handle. */
55
+ rotation?: number;
56
+ onrotation?: (degrees: number) => void;
57
+ /**
58
+ * Size the frame from its content (`width: max-content; height: auto`).
59
+ * Used by text so the box stays stuck to the glyphs.
60
+ */
61
+ hugContent?: boolean;
62
+ /** Wrap limit in px. The box stays as wide as the text until this cap. */
63
+ hugMaxWidth?: number;
64
+ /** Fired when hugged content changes size. Not a user resize. */
65
+ oncontentresize?: (rect: WidgetRect) => void;
54
66
  collapsible?: boolean;
55
67
  collapsed?: boolean;
56
68
  loading?: boolean;
@@ -71,6 +83,8 @@ interface WidgetFrameProps {
71
83
  onreload?: () => void | Promise<void>;
72
84
  oncollapse?: (collapsed: boolean) => void;
73
85
  onchange?: (rect: WidgetRect) => void;
86
+ /** When false, content may paint outside the frame. Text uses this so glyphs are not cropped. */
87
+ clipContent?: boolean;
74
88
  /**
75
89
  * When false, `onchange` still fires but this frame does not write `rect`.
76
90
  * Use when a parent owns live position (rigid multi-select / group move).
@@ -45,6 +45,8 @@
45
45
  /** Extra classes for the main content region (e.g. `p-0` for flush panels). */
46
46
  mainClass?: string;
47
47
  class?: string;
48
+ /** Left side of the navbar, after the mobile menu button. */
49
+ leading?: Snippet;
48
50
  actions?: Snippet;
49
51
  children?: Snippet;
50
52
  }
@@ -74,6 +76,7 @@
74
76
  framed = false,
75
77
  mainClass = '',
76
78
  class: className = '',
79
+ leading: leadingSlot,
77
80
  actions: actionsSlot,
78
81
  children
79
82
  }: AppShellProps = $props();
@@ -240,11 +243,12 @@
240
243
  bind:value={navValue}
241
244
  showBrand={!showSidebar && !showRail}
242
245
  variant="pills"
243
- size="sm"
246
+ size="md"
244
247
  bordered
245
248
  maxWidth="full"
246
249
  >
247
250
  {#snippet leading()}
251
+ <div class="gap-2 flex min-w-0 items-center">
248
252
  <div class="md:hidden">
249
253
  <IconButton
250
254
  label={mobileOpen ? 'Cerrar menú' : 'Abrir menú'}
@@ -271,6 +275,8 @@
271
275
  </svg>
272
276
  </IconButton>
273
277
  </div>
278
+ {#if leadingSlot}{@render leadingSlot()}{/if}
279
+ </div>
274
280
  {/snippet}
275
281
  {#snippet actions()}
276
282
  {#if actionsSlot}{@render actionsSlot()}{/if}
@@ -34,6 +34,8 @@ interface AppShellProps {
34
34
  /** Extra classes for the main content region (e.g. `p-0` for flush panels). */
35
35
  mainClass?: string;
36
36
  class?: string;
37
+ /** Left side of the navbar, after the mobile menu button. */
38
+ leading?: Snippet;
37
39
  actions?: Snippet;
38
40
  children?: Snippet;
39
41
  }
@@ -9,6 +9,10 @@
9
9
  brand?: string;
10
10
  /** Official brand logo URL (SVG/PNG) for BrandMark */
11
11
  logoSrc?: string;
12
+ /** Single-color logo, painted with currentColor */
13
+ monochrome?: boolean;
14
+ /** Brand / logo link target (e.g. `/`) */
15
+ brandHref?: string;
12
16
  tagline?: string;
13
17
  footer?: string;
14
18
  headline?: string;
@@ -29,6 +33,8 @@
29
33
  const {
30
34
  brand = 'R2DigiSolutions',
31
35
  logoSrc,
36
+ monochrome = false,
37
+ brandHref,
32
38
  tagline = 'Build faster with a cohesive design system.',
33
39
  footer = '© R2DigiSolutions. All rights reserved.',
34
40
  headline = 'Sign in to continue',
@@ -55,30 +61,48 @@
55
61
  {:else}
56
62
  <div
57
63
  class={[
58
- 'flex flex-col justify-between overflow-hidden bg-gradient-to-br from-brand-600 via-brand-700 to-brand-950 text-white',
59
- compact
60
- ? 'relative gap-4 px-5 py-5'
61
- : 'absolute inset-0 gap-6 p-8 sm:p-10'
64
+ 'from-brand-600 via-brand-700 to-brand-950 text-white flex flex-col justify-between overflow-hidden bg-gradient-to-br',
65
+ compact ? 'gap-4 px-5 py-5 relative' : 'inset-0 gap-6 p-8 sm:p-10 absolute'
62
66
  ]}
63
67
  >
64
68
  <div
65
- class="pointer-events-none absolute -right-16 -top-16 h-64 w-64 rounded-full bg-white/10 blur-2xl"
69
+ class="-right-16 -top-16 h-64 w-64 bg-white/10 blur-2xl pointer-events-none absolute rounded-full"
66
70
  aria-hidden="true"
67
71
  ></div>
68
72
  <div
69
- class="pointer-events-none absolute -bottom-20 -left-10 h-72 w-72 rounded-full bg-brand-400/20 blur-3xl"
73
+ class="-bottom-20 -left-10 h-72 w-72 bg-brand-400/20 blur-3xl pointer-events-none absolute rounded-full"
70
74
  aria-hidden="true"
71
75
  ></div>
72
76
 
73
77
  <div class={['relative z-10', compact ? 'space-y-3' : 'space-y-6']}>
74
- <div class="flex items-center gap-2.5">
75
- <BrandMark name={brand} {logoSrc} size={compact ? 'sm' : 'md'} />
76
- <span class={['font-semibold tracking-tight text-white', compact ? 'text-sm' : 'text-base']}>
77
- {brand}
78
- </span>
78
+ <div class="gap-2.5 flex items-center">
79
+ {#if brandHref}
80
+ <a
81
+ href={brandHref}
82
+ class="gap-2.5 inline-flex items-center text-inherit no-underline"
83
+ aria-label={brand}
84
+ >
85
+ <BrandMark name={brand} {logoSrc} {monochrome} size={compact ? 'sm' : 'md'} />
86
+ <span
87
+ class={[
88
+ 'font-semibold tracking-tight text-white',
89
+ compact ? 'text-sm' : 'text-base'
90
+ ]}
91
+ >
92
+ {brand}
93
+ </span>
94
+ </a>
95
+ {:else}
96
+ <BrandMark name={brand} {logoSrc} {monochrome} size={compact ? 'sm' : 'md'} />
97
+ <span
98
+ class={['font-semibold tracking-tight text-white', compact ? 'text-sm' : 'text-base']}
99
+ >
100
+ {brand}
101
+ </span>
102
+ {/if}
79
103
  </div>
80
104
  <div class="space-y-2">
81
- <p class="text-[10px] font-semibold uppercase tracking-[0.2em] text-white/70 sm:text-xs">
105
+ <p class="font-semibold text-white/70 sm:text-xs text-[10px] tracking-[0.2em] uppercase">
82
106
  Welcome
83
107
  </p>
84
108
  <h1
@@ -94,10 +118,10 @@
94
118
  </p>
95
119
  </div>
96
120
  {#if !compact && highlights.length}
97
- <ul class="hidden space-y-2.5 pt-1 text-sm text-white/75 sm:block">
121
+ <ul class="space-y-2.5 pt-1 text-sm text-white/75 sm:block hidden">
98
122
  {#each highlights as item (item)}
99
- <li class="flex items-start gap-2">
100
- <span class="mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full bg-white/80"></span>
123
+ <li class="gap-2 flex items-start">
124
+ <span class="mt-1.5 h-1.5 w-1.5 bg-white/80 shrink-0 rounded-full"></span>
101
125
  {item}
102
126
  </li>
103
127
  {/each}
@@ -106,7 +130,7 @@
106
130
  </div>
107
131
 
108
132
  {#if !compact}
109
- <p class="relative z-10 text-xs text-white/50">{footer}</p>
133
+ <p class="text-xs text-white/50 relative z-10">{footer}</p>
110
134
  {/if}
111
135
  </div>
112
136
  {/if}
@@ -114,9 +138,9 @@
114
138
 
115
139
  <div
116
140
  class={[
117
- 'flex w-full flex-col overflow-hidden bg-surface',
141
+ 'bg-surface flex w-full flex-col overflow-hidden',
118
142
  // h-dvh (not height:100%): % collapses when html/body have no explicit height
119
- fillParent && 'h-full min-h-0',
143
+ fillParent && 'min-h-0 h-full',
120
144
  !fillParent && fullHeight && 'h-dvh min-h-dvh',
121
145
  !fillParent && !fullHeight && 'min-h-[32rem]',
122
146
  className
@@ -126,49 +150,57 @@
126
150
  >
127
151
  <div
128
152
  class={[
129
- 'flex h-full min-h-0 w-full flex-1 flex-col',
153
+ 'min-h-0 flex h-full w-full flex-1 flex-col',
130
154
  showAside && 'lg:flex-row lg:items-stretch',
131
155
  asideSide === 'right' && 'lg:flex-row-reverse'
132
156
  ]}
133
157
  >
134
158
  {#if showAside}
135
159
  <aside
136
- class="relative hidden min-h-0 w-full overflow-hidden lg:block lg:h-auto lg:w-1/2 lg:self-stretch"
160
+ class="min-h-0 lg:block lg:h-auto lg:w-1/2 lg:self-stretch relative hidden w-full overflow-hidden"
137
161
  >
138
162
  {@render marketingPanel(false)}
139
163
  </aside>
140
164
  {/if}
141
165
 
142
- <section class="relative flex h-full min-h-0 w-full flex-1 flex-col bg-surface">
166
+ <section class="min-h-0 bg-surface relative flex h-full w-full flex-1 flex-col">
143
167
  <div
144
- class="pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_top,_var(--tw-gradient-stops))] from-brand-500/5 via-transparent to-transparent"
168
+ class="inset-0 from-brand-500/5 pointer-events-none absolute bg-[radial-gradient(ellipse_at_top,_var(--tw-gradient-stops))] via-transparent to-transparent"
145
169
  aria-hidden="true"
146
170
  ></div>
147
171
 
148
- <SafeArea top bottom class="relative z-10 flex h-full min-h-0 flex-1 flex-col">
172
+ <SafeArea top bottom class="min-h-0 relative z-10 flex h-full flex-1 flex-col">
149
173
  {#if mobileHero && showAside}
150
- <div class="shrink-0 lg:hidden">
174
+ <div class="lg:hidden shrink-0">
151
175
  {@render marketingPanel(true)}
152
176
  </div>
153
177
  {:else}
154
- <div class="shrink-0 px-5 pt-6 text-center lg:hidden">
155
- <BrandMark name={brand} {logoSrc} showName size="md" class="justify-center" />
178
+ <div class="px-5 pt-6 lg:hidden shrink-0 text-center">
179
+ <BrandMark
180
+ name={brand}
181
+ {logoSrc}
182
+ {monochrome}
183
+ href={brandHref}
184
+ showName
185
+ size="md"
186
+ class="justify-center"
187
+ />
156
188
  <p class="mt-2 text-sm text-muted">{tagline}</p>
157
189
  </div>
158
190
  {/if}
159
191
 
160
192
  <!-- Form column: true center in remaining space -->
161
193
  <div
162
- class="flex h-full min-h-0 flex-1 flex-col items-center justify-center overflow-y-auto px-5 py-8 sm:px-8 sm:py-10"
194
+ class="min-h-0 px-5 py-8 sm:px-8 sm:py-10 flex h-full flex-1 flex-col items-center justify-center overflow-y-auto"
163
195
  >
164
- <div class="mx-auto w-full max-w-md shrink-0">
196
+ <div class="max-w-md mx-auto w-full shrink-0">
165
197
  {#if children}
166
198
  {@render children()}
167
199
  {/if}
168
200
  </div>
169
201
  </div>
170
202
 
171
- <p class="shrink-0 px-5 pb-4 text-center text-[11px] text-muted lg:hidden">{footer}</p>
203
+ <p class="px-5 pb-4 text-muted lg:hidden shrink-0 text-center text-[11px]">{footer}</p>
172
204
  </SafeArea>
173
205
  </section>
174
206
  </div>
@@ -4,6 +4,10 @@ interface AuthShellProps {
4
4
  brand?: string;
5
5
  /** Official brand logo URL (SVG/PNG) for BrandMark */
6
6
  logoSrc?: string;
7
+ /** Single-color logo, painted with currentColor */
8
+ monochrome?: boolean;
9
+ /** Brand / logo link target (e.g. `/`) */
10
+ brandHref?: string;
7
11
  tagline?: string;
8
12
  footer?: string;
9
13
  headline?: string;