@unsetsoft/ryunixjs 1.2.5-canary.11 → 1.2.5-canary.13
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/Ryunix.esm.js +1955 -2019
- package/dist/Ryunix.esm.js.map +1 -1
- package/dist/Ryunix.umd.js +1985 -2017
- package/dist/Ryunix.umd.js.map +1 -1
- package/dist/Ryunix.umd.min.js +1 -1
- package/dist/Ryunix.umd.min.js.map +1 -1
- package/package.json +13 -6
- package/styles/layout-footer.css +313 -0
- package/styles/layout-header.css +239 -0
- package/styles/layout.css +76 -0
- package/styles/ryunix-style.css +834 -0
- package/styles/theme-toggle.css +101 -0
- package/types/index.d.ts +138 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme segmented control (ThemeToggle) — import alongside app styles.
|
|
3
|
+
* Expects `html.dark` (or custom class via createThemeController) for dark mode.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
html:not(.dark) {
|
|
7
|
+
--ryx-theme-segment-bg: var(--ryx-surface-elevated, #f4f4f5);
|
|
8
|
+
--ryx-theme-segment-border: var(--ryx-border-strong, #d4d4d8);
|
|
9
|
+
--ryx-theme-chip-active: var(--ryx-surface, #ffffff);
|
|
10
|
+
--ryx-theme-chip-active-border: color-mix(
|
|
11
|
+
in srgb,
|
|
12
|
+
var(--ryx-text, #18181b) 8%,
|
|
13
|
+
transparent
|
|
14
|
+
);
|
|
15
|
+
--ryx-theme-chip-active-shadow: 0 1px 2px rgb(15 23 42 / 0.08);
|
|
16
|
+
--ryx-theme-icon: var(--ryx-text-subtle, #71717a);
|
|
17
|
+
--ryx-theme-icon-hover: var(--ryx-text, #18181b);
|
|
18
|
+
--ryx-theme-icon-active: var(--ryx-link, #2563eb);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
html.dark {
|
|
22
|
+
--ryx-theme-segment-bg: var(--ryx-surface-elevated, #1c1c1f);
|
|
23
|
+
--ryx-theme-segment-border: var(--ryx-border-strong, #3f3f46);
|
|
24
|
+
--ryx-theme-chip-active: var(--ryx-surface, #111113);
|
|
25
|
+
--ryx-theme-chip-active-border: color-mix(
|
|
26
|
+
in srgb,
|
|
27
|
+
var(--ryx-text, #fafafa) 12%,
|
|
28
|
+
transparent
|
|
29
|
+
);
|
|
30
|
+
--ryx-theme-chip-active-shadow:
|
|
31
|
+
0 0 0 1px rgb(255 255 255 / 0.08), inset 0 1px 0 rgb(255 255 255 / 0.04);
|
|
32
|
+
--ryx-theme-icon: var(--ryx-text-muted, #a1a1aa);
|
|
33
|
+
--ryx-theme-icon-hover: var(--ryx-text, #fafafa);
|
|
34
|
+
--ryx-theme-icon-active: var(--ryx-link, #60a5fa);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.ryx-theme-segment {
|
|
38
|
+
display: inline-flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: 0.125rem;
|
|
41
|
+
padding: 0.25rem;
|
|
42
|
+
border-radius: 9999px;
|
|
43
|
+
border: 1px solid var(--ryx-theme-segment-border);
|
|
44
|
+
background: var(--ryx-theme-segment-bg);
|
|
45
|
+
box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.04);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.ryx-theme-segment-btn {
|
|
49
|
+
all: unset;
|
|
50
|
+
box-sizing: border-box;
|
|
51
|
+
display: inline-flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
width: 2.25rem;
|
|
55
|
+
height: 2.25rem;
|
|
56
|
+
border-radius: 9999px;
|
|
57
|
+
background: transparent;
|
|
58
|
+
color: var(--ryx-theme-icon);
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
transition:
|
|
61
|
+
color 150ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
62
|
+
background-color 150ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
63
|
+
box-shadow 150ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
64
|
+
border-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.ryx-theme-segment-btn:hover {
|
|
68
|
+
color: var(--ryx-theme-icon-hover);
|
|
69
|
+
background: color-mix(in srgb, var(--ryx-theme-icon-hover) 6%, transparent);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.ryx-theme-segment-btn:focus-visible {
|
|
73
|
+
outline: 2px solid var(--ryx-focus-ring, #60a5fa);
|
|
74
|
+
outline-offset: 2px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.ryx-theme-segment-btn--active {
|
|
78
|
+
color: var(--ryx-theme-icon-active);
|
|
79
|
+
background-color: var(--ryx-theme-chip-active);
|
|
80
|
+
box-shadow: var(--ryx-theme-chip-active-shadow);
|
|
81
|
+
border: 1px solid var(--ryx-theme-chip-active-border);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.ryx-theme-segment-icon {
|
|
85
|
+
width: 1.05rem;
|
|
86
|
+
height: 1.05rem;
|
|
87
|
+
display: block;
|
|
88
|
+
pointer-events: none;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.ryx-theme-segment-sr-only {
|
|
92
|
+
position: absolute;
|
|
93
|
+
width: 1px;
|
|
94
|
+
height: 1px;
|
|
95
|
+
padding: 0;
|
|
96
|
+
margin: -1px;
|
|
97
|
+
overflow: hidden;
|
|
98
|
+
clip: rect(0, 0, 0, 0);
|
|
99
|
+
white-space: nowrap;
|
|
100
|
+
border: 0;
|
|
101
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Runtime remains JavaScript (Rollup bundles in `dist/`). These declarations
|
|
5
5
|
* cover the package entry, hooks, components, and SSR helpers exported from
|
|
6
|
-
* `src/main.js
|
|
6
|
+
* `src/main.ts` → emitido como `.generated/main.js` antes de Rollup.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
// ---------------------------------------------------------------------------
|
|
@@ -234,6 +234,16 @@ export function useMetadata(
|
|
|
234
234
|
options?: RyunixMetadataOptions,
|
|
235
235
|
): void
|
|
236
236
|
|
|
237
|
+
export function resolvePageMetadata(
|
|
238
|
+
meta?: Record<string, unknown>,
|
|
239
|
+
options?: RyunixMetadataOptions,
|
|
240
|
+
): { title: string; tags: Record<string, string | string[]> }
|
|
241
|
+
|
|
242
|
+
export function mergeRouteMetadata(
|
|
243
|
+
base?: Record<string, unknown>,
|
|
244
|
+
next?: Record<string, unknown>,
|
|
245
|
+
): Record<string, unknown>
|
|
246
|
+
|
|
237
247
|
// ---------------------------------------------------------------------------
|
|
238
248
|
// Router
|
|
239
249
|
// ---------------------------------------------------------------------------
|
|
@@ -376,6 +386,11 @@ export function getMDXComponents(
|
|
|
376
386
|
|
|
377
387
|
export const defaultComponents: RyunixMDXComponents
|
|
378
388
|
|
|
389
|
+
/** Maps `unstyled` to `data-ryx-unstyled` for global style opt-out. */
|
|
390
|
+
export function ryxProps(
|
|
391
|
+
props: Record<string, unknown> & { unstyled?: boolean },
|
|
392
|
+
): Record<string, unknown>
|
|
393
|
+
|
|
379
394
|
export function RyunixDevOverlay(propsOrError?: unknown): RyunixNode
|
|
380
395
|
|
|
381
396
|
// ---------------------------------------------------------------------------
|
|
@@ -475,6 +490,117 @@ export namespace Hooks {
|
|
|
475
490
|
export const useSearchParams: typeof useSearchParams
|
|
476
491
|
}
|
|
477
492
|
|
|
493
|
+
// ---------------------------------------------------------------------------
|
|
494
|
+
// Theme toggle & cookie persistence
|
|
495
|
+
// ---------------------------------------------------------------------------
|
|
496
|
+
|
|
497
|
+
export interface ThemeToggleLabels {
|
|
498
|
+
title: string
|
|
499
|
+
light: string
|
|
500
|
+
system: string
|
|
501
|
+
dark: string
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
export type ThemePreference = 'light' | 'system' | 'dark'
|
|
505
|
+
|
|
506
|
+
export interface ThemeControllerOptions {
|
|
507
|
+
cookieName?: string
|
|
508
|
+
defaultTheme?: ThemePreference
|
|
509
|
+
darkClass?: string
|
|
510
|
+
maxAgeSeconds?: number
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
export interface ThemeController {
|
|
514
|
+
cookieName: string
|
|
515
|
+
defaultTheme: ThemePreference
|
|
516
|
+
themes: readonly ThemePreference[]
|
|
517
|
+
getThemeCookie: () => ThemePreference | null
|
|
518
|
+
setThemeCookie: (theme: ThemePreference) => void
|
|
519
|
+
resolveThemeFromCookie: () => ThemePreference
|
|
520
|
+
getSystemColorScheme: () => 'light' | 'dark'
|
|
521
|
+
resolveEffectiveTheme: (
|
|
522
|
+
theme: ThemePreference | string | null | undefined,
|
|
523
|
+
) => 'light' | 'dark'
|
|
524
|
+
applyTheme: (theme: ThemePreference | string | null | undefined) => void
|
|
525
|
+
getInitScript: () => string
|
|
526
|
+
watchSystemTheme: (onChange: (scheme: 'light' | 'dark') => void) => () => void
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
export const DEFAULT_THEME_COOKIE_NAME: string
|
|
530
|
+
export const THEME_PREFERENCES: readonly ThemePreference[]
|
|
531
|
+
export const themeController: ThemeController
|
|
532
|
+
export const THEME_COOKIE_NAME: string
|
|
533
|
+
export const defaultTheme: ThemePreference
|
|
534
|
+
export const themes: readonly ThemePreference[]
|
|
535
|
+
export const themeInitScript: string
|
|
536
|
+
|
|
537
|
+
export function createThemeController(
|
|
538
|
+
options?: ThemeControllerOptions,
|
|
539
|
+
): ThemeController
|
|
540
|
+
|
|
541
|
+
export function getThemeCookie(): ThemePreference | null
|
|
542
|
+
export function setThemeCookie(theme: ThemePreference): void
|
|
543
|
+
export function resolveThemeFromCookie(): ThemePreference
|
|
544
|
+
export function getSystemColorScheme(): 'light' | 'dark'
|
|
545
|
+
export function resolveEffectiveTheme(
|
|
546
|
+
theme: ThemePreference | string | null | undefined,
|
|
547
|
+
): 'light' | 'dark'
|
|
548
|
+
export function applyTheme(
|
|
549
|
+
theme: ThemePreference | string | null | undefined,
|
|
550
|
+
): void
|
|
551
|
+
export function watchSystemTheme(
|
|
552
|
+
onChange: (scheme: 'light' | 'dark') => void,
|
|
553
|
+
): () => void
|
|
554
|
+
|
|
555
|
+
export interface ThemeToggleProps {
|
|
556
|
+
labels: ThemeToggleLabels
|
|
557
|
+
className?: string
|
|
558
|
+
controller?: ThemeController
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
export function ThemeToggle(props: ThemeToggleProps): RyunixElement
|
|
562
|
+
|
|
563
|
+
export interface ThemeInitScriptProps {
|
|
564
|
+
controller?: ThemeController
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
export function ThemeInitScript(props?: ThemeInitScriptProps): RyunixElement
|
|
568
|
+
|
|
569
|
+
export interface HeaderProps {
|
|
570
|
+
image?: string
|
|
571
|
+
title: string
|
|
572
|
+
href?: string
|
|
573
|
+
imageAlt?: string
|
|
574
|
+
sticky?: boolean
|
|
575
|
+
className?: string
|
|
576
|
+
children?: RyunixNode
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
export interface FooterProps {
|
|
580
|
+
image?: string
|
|
581
|
+
title?: string
|
|
582
|
+
description?: string
|
|
583
|
+
href?: string
|
|
584
|
+
imageAlt?: string
|
|
585
|
+
className?: string
|
|
586
|
+
children?: RyunixNode
|
|
587
|
+
bottomStart?: RyunixNode
|
|
588
|
+
bottomEnd?: RyunixNode
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
export function Header(props: HeaderProps): RyunixElement
|
|
592
|
+
|
|
593
|
+
export function Footer(props: FooterProps): RyunixElement
|
|
594
|
+
|
|
595
|
+
export interface MainProps {
|
|
596
|
+
maxWidth?: string
|
|
597
|
+
className?: string
|
|
598
|
+
innerClassName?: string
|
|
599
|
+
children?: RyunixNode
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
export function Main(props: MainProps): RyunixElement
|
|
603
|
+
|
|
478
604
|
declare const Ryunix: {
|
|
479
605
|
createElement: typeof createElement
|
|
480
606
|
Fragment: typeof Fragment
|
|
@@ -499,6 +625,8 @@ declare const Ryunix: {
|
|
|
499
625
|
useQuery: typeof useQuery
|
|
500
626
|
useHash: typeof useHash
|
|
501
627
|
useMetadata: typeof useMetadata
|
|
628
|
+
resolvePageMetadata: typeof resolvePageMetadata
|
|
629
|
+
mergeRouteMetadata: typeof mergeRouteMetadata
|
|
502
630
|
useId: typeof useId
|
|
503
631
|
resetIdCounter: typeof resetIdCounter
|
|
504
632
|
useDebounce: typeof useDebounce
|
|
@@ -535,6 +663,15 @@ declare const Ryunix: {
|
|
|
535
663
|
getState: typeof getState
|
|
536
664
|
createActionProxy: typeof createActionProxy
|
|
537
665
|
RyunixDevOverlay: typeof RyunixDevOverlay
|
|
666
|
+
ThemeToggle: typeof ThemeToggle
|
|
667
|
+
ThemeInitScript: typeof ThemeInitScript
|
|
668
|
+
Header: typeof Header
|
|
669
|
+
Footer: typeof Footer
|
|
670
|
+
Main: typeof Main
|
|
671
|
+
createThemeController: typeof createThemeController
|
|
672
|
+
themeController: typeof themeController
|
|
673
|
+
applyTheme: typeof applyTheme
|
|
674
|
+
themeInitScript: typeof themeInitScript
|
|
538
675
|
}
|
|
539
676
|
|
|
540
677
|
export default Ryunix
|