rockin 0.0.37 → 0.0.39
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/chunk-6JS62NO4.js +276 -0
- package/dist/chunk-G3RYS466.js +68 -0
- package/dist/chunk-JPOAXESG.js +250 -0
- package/dist/{chunk-RT2YVQ2Y.js → chunk-WR27Y55B.js} +1 -1
- package/dist/chunk-X56ZEDOW.js +46 -0
- package/dist/hooks/index.js +20 -257
- package/dist/index.d.ts +87 -4
- package/dist/index.js +10 -9
- package/dist/layout.d.ts +11 -0
- package/dist/layout.js +22 -0
- package/dist/lib/index.d.ts +79 -1
- package/dist/lib/index.js +13 -1
- package/dist/provider.d.ts +6 -4
- package/dist/provider.js +119 -8
- package/dist/styles.css +284 -200
- package/dist/ui/bridge.js +9 -3
- package/dist/ui/code-block.js +7 -4
- package/dist/ui/filters.js +7 -7
- package/dist/ui/image.js +67 -9
- package/dist/ui/index.d.ts +34 -33
- package/dist/ui/index.js +2 -1
- package/dist/ui/jelly.js +214 -16
- package/dist/ui/sonner.js +4 -1
- package/dist/ui/tabs.js +13 -690
- package/dist/ui/theme-switcher.js +47 -0
- package/dist/ui/theme-toggle.js +4 -1
- package/package.json +8 -1
- package/dist/chunk-54ZJAEO5.js +0 -209
- package/dist/chunk-5GM3YR42.js +0 -228
- /package/dist/{chunk-ATPUW3SQ.js → chunk-2LD63YUK.js} +0 -0
package/dist/provider.js
CHANGED
|
@@ -1,13 +1,124 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import "./chunk-
|
|
3
|
+
TooltipProvider
|
|
4
|
+
} from "./chunk-GBVAFFZR.js";
|
|
5
|
+
import {
|
|
6
|
+
useFullscreen,
|
|
7
|
+
useNative
|
|
8
|
+
} from "./chunk-WR27Y55B.js";
|
|
9
|
+
import "./chunk-2LD63YUK.js";
|
|
10
|
+
import {
|
|
11
|
+
PreferencesProvider,
|
|
12
|
+
usePreferences,
|
|
13
|
+
useTheme
|
|
14
|
+
} from "./chunk-G3RYS466.js";
|
|
15
|
+
import {
|
|
16
|
+
TopLoader
|
|
17
|
+
} from "./chunk-3ZGQJTWY.js";
|
|
18
|
+
import "./chunk-X56ZEDOW.js";
|
|
19
|
+
|
|
20
|
+
// src/provider.tsx
|
|
21
|
+
import * as React from "react";
|
|
22
|
+
import { usePreference } from "@ui-sdk/react/preferences";
|
|
23
|
+
import { useShortcut } from "@ui-sdk/react/shortcuts";
|
|
24
|
+
import { GooeyToaster } from "goey-toast";
|
|
25
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
26
|
+
var browserThemeColors = {
|
|
27
|
+
light: "#ffffff",
|
|
28
|
+
dark: "#000000"
|
|
29
|
+
};
|
|
30
|
+
function BrowserChrome({ light, dark }) {
|
|
31
|
+
const { colorScheme } = usePreferences();
|
|
32
|
+
const { value, resolved } = usePreference(colorScheme);
|
|
33
|
+
React.useEffect(() => {
|
|
34
|
+
if (resolved === "unknown") return;
|
|
35
|
+
const style = resolved === "dark" ? "black-translucent" : "default";
|
|
36
|
+
for (const meta of document.head.querySelectorAll(
|
|
37
|
+
'meta[name="apple-mobile-web-app-status-bar-style"]'
|
|
38
|
+
))
|
|
39
|
+
meta.content = style;
|
|
40
|
+
window.dispatchEvent(
|
|
41
|
+
new CustomEvent("kdpower:theme-change", { detail: { theme: resolved } })
|
|
42
|
+
);
|
|
43
|
+
}, [resolved]);
|
|
44
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
45
|
+
value === "system" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
46
|
+
/* @__PURE__ */ jsx(
|
|
47
|
+
"meta",
|
|
48
|
+
{
|
|
49
|
+
name: "theme-color",
|
|
50
|
+
media: "(prefers-color-scheme: light)",
|
|
51
|
+
content: light
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
/* @__PURE__ */ jsx(
|
|
55
|
+
"meta",
|
|
56
|
+
{
|
|
57
|
+
name: "theme-color",
|
|
58
|
+
media: "(prefers-color-scheme: dark)",
|
|
59
|
+
content: dark
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
] }) : /* @__PURE__ */ jsx("meta", { name: "theme-color", content: value === "dark" ? dark : light }),
|
|
63
|
+
/* @__PURE__ */ jsx("style", { href: `rockin-chrome-${light}-${dark}`, precedence: "default", children: `:root{background-color:light-dark(${light},${dark})}` })
|
|
64
|
+
] });
|
|
65
|
+
}
|
|
66
|
+
function ClientProvider({
|
|
67
|
+
children,
|
|
68
|
+
light = browserThemeColors.light,
|
|
69
|
+
dark = browserThemeColors.dark,
|
|
70
|
+
fullscreen = true,
|
|
71
|
+
cookie
|
|
72
|
+
}) {
|
|
73
|
+
return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(PreferencesProvider, { cookie, children: /* @__PURE__ */ jsxs(TopLoader, { children: [
|
|
74
|
+
/* @__PURE__ */ jsx(AppToaster, {}),
|
|
75
|
+
/* @__PURE__ */ jsx(AppStatusBarBackground, {}),
|
|
76
|
+
/* @__PURE__ */ jsx(BrowserChrome, { light, dark }),
|
|
77
|
+
/* @__PURE__ */ jsx(ThemeHotkey, {}),
|
|
78
|
+
fullscreen ? /* @__PURE__ */ jsx(FullscreenHotkey, {}) : null,
|
|
79
|
+
children
|
|
80
|
+
] }) }) });
|
|
81
|
+
}
|
|
82
|
+
function AppToaster() {
|
|
83
|
+
const { resolvedTheme } = useTheme();
|
|
84
|
+
const toasterTheme = resolvedTheme === "dark" ? "dark" : "light";
|
|
85
|
+
return /* @__PURE__ */ jsx(
|
|
86
|
+
GooeyToaster,
|
|
87
|
+
{
|
|
88
|
+
theme: toasterTheme,
|
|
89
|
+
position: "bottom-right",
|
|
90
|
+
closeButton: "top-left"
|
|
91
|
+
},
|
|
92
|
+
toasterTheme
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
function AppStatusBarBackground() {
|
|
96
|
+
return /* @__PURE__ */ jsx(
|
|
97
|
+
"div",
|
|
98
|
+
{
|
|
99
|
+
"aria-hidden": true,
|
|
100
|
+
className: "fixed inset-x-0 top-0 z-50 hidden h-(--app-safe-top) bg-background/80 backdrop-blur-xl standalone:block native:block"
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
function ThemeHotkey() {
|
|
105
|
+
const { resolvedTheme, setTheme } = useTheme();
|
|
106
|
+
useShortcut(
|
|
107
|
+
"d",
|
|
108
|
+
() => setTheme(resolvedTheme === "dark" ? "light" : "dark"),
|
|
109
|
+
{ description: "Toggle dark mode" }
|
|
110
|
+
);
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
function FullscreenHotkey() {
|
|
114
|
+
const isNative = useNative();
|
|
115
|
+
const { toggleFullscreen } = useFullscreen();
|
|
116
|
+
useShortcut(isNative ? null : "f", () => void toggleFullscreen(), {
|
|
117
|
+
description: "Toggle full screen"
|
|
118
|
+
});
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
10
121
|
export {
|
|
11
|
-
|
|
122
|
+
ClientProvider,
|
|
12
123
|
browserThemeColors
|
|
13
124
|
};
|