@youversion/platform-react-ui 1.12.0 → 1.12.2
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/components/bible-reader.d.ts.map +1 -1
- package/dist/index.cjs +43 -48
- package/dist/index.js +58 -50
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bible-reader.d.ts","sourceRoot":"","sources":["../../src/components/bible-reader.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"bible-reader.d.ts","sourceRoot":"","sources":["../../src/components/bible-reader.tsx"],"names":[],"mappings":"AAEA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AA6Cf,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC9B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAMF,iBAAS,IAAI,CAAC,EACZ,IAAI,EAAE,cAAc,EACpB,WAAmB,EACnB,YAAY,EACZ,OAAO,EAAE,iBAAiB,EAC1B,cAAoB,EACpB,eAAe,EACf,SAAS,EAAE,mBAAmB,EAC9B,gBAAsB,EACtB,eAAe,EACf,UAAoB,EACpB,QAA4B,EAC5B,UAAU,EACV,gBAAuB,EACvB,UAAU,EACV,QAAQ,GACT,EAAE,SAAS,2CAgFX;AAED,iBAAS,OAAO,4CAoEf;AAuCD,iBAAS,OAAO,CAAC,EAAE,MAAc,EAAE,EAAE;IAAE,MAAM,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAA;CAAE,2CAmKjE;AAED,eAAO,MAAM,WAAW;;;;CAAgD,CAAC;AACzE,MAAM,MAAM,oBAAoB,GAAG,SAAS,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -15970,22 +15970,26 @@ function Root5({
|
|
|
15970
15970
|
defaultProp: defaultVersionId,
|
|
15971
15971
|
onChange: onVersionChange
|
|
15972
15972
|
});
|
|
15973
|
-
const
|
|
15974
|
-
|
|
15975
|
-
|
|
15976
|
-
|
|
15977
|
-
|
|
15978
|
-
|
|
15979
|
-
|
|
15980
|
-
|
|
15981
|
-
|
|
15982
|
-
|
|
15973
|
+
const validatedFontSize = fontSize > MAX_FONT_SIZE || fontSize < MIN_FONT_SIZE ? DEFAULT_FONT_SIZE : fontSize;
|
|
15974
|
+
const [currentFontSize, setCurrentFontSize] = (0, import_react4.useState)(validatedFontSize);
|
|
15975
|
+
const [currentFontFamily, setCurrentFontFamily] = (0, import_react4.useState)(fontFamily);
|
|
15976
|
+
(0, import_react4.useLayoutEffect)(() => {
|
|
15977
|
+
const savedFontSize = localStorage.getItem("youversion-platform:reader:font-size");
|
|
15978
|
+
if (savedFontSize) {
|
|
15979
|
+
const parsed = parseInt(savedFontSize);
|
|
15980
|
+
if (parsed >= MIN_FONT_SIZE && parsed <= MAX_FONT_SIZE) {
|
|
15981
|
+
setCurrentFontSize(parsed);
|
|
15982
|
+
}
|
|
15983
|
+
}
|
|
15984
|
+
const savedFontFamily = localStorage.getItem("youversion-platform:reader:font-family");
|
|
15985
|
+
if (savedFontFamily) {
|
|
15986
|
+
setCurrentFontFamily(savedFontFamily);
|
|
15987
|
+
}
|
|
15988
|
+
}, []);
|
|
15983
15989
|
(0, import_react4.useEffect)(() => {
|
|
15984
|
-
if (typeof window === "undefined") return;
|
|
15985
15990
|
localStorage.setItem("youversion-platform:reader:font-size", currentFontSize.toString());
|
|
15986
15991
|
}, [currentFontSize]);
|
|
15987
15992
|
(0, import_react4.useEffect)(() => {
|
|
15988
|
-
if (typeof window === "undefined") return;
|
|
15989
15993
|
localStorage.setItem("youversion-platform:reader:font-family", currentFontFamily);
|
|
15990
15994
|
}, [currentFontFamily]);
|
|
15991
15995
|
const providerTheme = (0, import_platform_react_hooks4.useTheme)();
|
|
@@ -16083,6 +16087,30 @@ function Content4() {
|
|
|
16083
16087
|
)
|
|
16084
16088
|
] });
|
|
16085
16089
|
}
|
|
16090
|
+
function UserMenu() {
|
|
16091
|
+
const { auth, signIn, signOut, userInfo } = (0, import_platform_react_hooks4.useYVAuth)();
|
|
16092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Popover, { children: [
|
|
16093
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
16094
|
+
PopoverTrigger,
|
|
16095
|
+
{
|
|
16096
|
+
"data-testid": "user-menu-trigger",
|
|
16097
|
+
className: cn(
|
|
16098
|
+
"yv:inline-flex yv:items-center yv:justify-center yv:justify-self-end yv:mr-4 yv:h-9 yv:rounded-md yv:bg-muted yv:text-foreground yv:hover:bg-muted/80 yv:hover:cursor-pointer yv:overflow-hidden",
|
|
16099
|
+
!(auth.isAuthenticated && userInfo?.avatarUrlFormat) && "yv:px-2"
|
|
16100
|
+
),
|
|
16101
|
+
children: auth.isAuthenticated && userInfo?.avatarUrlFormat ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
16102
|
+
"img",
|
|
16103
|
+
{
|
|
16104
|
+
src: userInfo.getAvatarUrl(32, 32)?.toString(),
|
|
16105
|
+
alt: userInfo.name || "User avatar",
|
|
16106
|
+
className: "yv:size-full yv:rounded-full yv:object-cover"
|
|
16107
|
+
}
|
|
16108
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PersonIcon, {})
|
|
16109
|
+
}
|
|
16110
|
+
),
|
|
16111
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PopoverContent, { className: "yv:rounded-[6px] yv:sm:w-min yv:px-4 yv:mb-6", showHeader: false, children: auth.isAuthenticated ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { className: "yv:text-black", onClick: () => signOut(), children: "Sign Out" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { className: "yv:text-black", onClick: () => void signIn({ scopes: ["profile"] }), children: "Sign In" }) })
|
|
16112
|
+
] });
|
|
16113
|
+
}
|
|
16086
16114
|
function Toolbar({ border = "top" }) {
|
|
16087
16115
|
const {
|
|
16088
16116
|
book,
|
|
@@ -16096,7 +16124,8 @@ function Toolbar({ border = "top" }) {
|
|
|
16096
16124
|
setCurrentFontSize,
|
|
16097
16125
|
background
|
|
16098
16126
|
} = useBibleReaderContext();
|
|
16099
|
-
const
|
|
16127
|
+
const yvContext = (0, import_react4.useContext)(import_platform_react_hooks4.YouVersionContext);
|
|
16128
|
+
const authEnabled = yvContext?.authEnabled || false;
|
|
16100
16129
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
16101
16130
|
"section",
|
|
16102
16131
|
{
|
|
@@ -16106,41 +16135,7 @@ function Toolbar({ border = "top" }) {
|
|
|
16106
16135
|
border === "bottom" && "yv:border-b"
|
|
16107
16136
|
),
|
|
16108
16137
|
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "yv:grid yv:w-full yv:grid-cols-7 yv:items-center yv:max-w-lg yv:gap-0.5", children: [
|
|
16109
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.
|
|
16110
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
16111
|
-
PopoverTrigger,
|
|
16112
|
-
{
|
|
16113
|
-
"data-testid": "user-menu-trigger",
|
|
16114
|
-
className: cn(
|
|
16115
|
-
"yv:inline-flex yv:items-center yv:justify-center yv:justify-self-end yv:mr-4 yv:h-9 yv:rounded-md yv:bg-muted yv:text-foreground yv:hover:bg-muted/80 yv:hover:cursor-pointer yv:overflow-hidden",
|
|
16116
|
-
!(auth.isAuthenticated && userInfo?.avatarUrlFormat) && "yv:px-2"
|
|
16117
|
-
),
|
|
16118
|
-
children: auth.isAuthenticated && userInfo?.avatarUrlFormat ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
16119
|
-
"img",
|
|
16120
|
-
{
|
|
16121
|
-
src: userInfo.getAvatarUrl(32, 32)?.toString(),
|
|
16122
|
-
alt: userInfo.name || "User avatar",
|
|
16123
|
-
className: "yv:size-full yv:rounded-full yv:object-cover"
|
|
16124
|
-
}
|
|
16125
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PersonIcon, {})
|
|
16126
|
-
}
|
|
16127
|
-
),
|
|
16128
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
16129
|
-
PopoverContent,
|
|
16130
|
-
{
|
|
16131
|
-
className: "yv:rounded-[6px] yv:sm:w-min yv:px-4 yv:mb-6",
|
|
16132
|
-
showHeader: false,
|
|
16133
|
-
children: auth.isAuthenticated ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { className: "yv:text-black", onClick: signOut, children: "Sign Out" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
16134
|
-
Button,
|
|
16135
|
-
{
|
|
16136
|
-
className: "yv:text-black",
|
|
16137
|
-
onClick: () => void signIn({ scopes: ["profile"] }),
|
|
16138
|
-
children: "Sign In"
|
|
16139
|
-
}
|
|
16140
|
-
)
|
|
16141
|
-
}
|
|
16142
|
-
)
|
|
16143
|
-
] }),
|
|
16138
|
+
authEnabled && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(UserMenu, {}),
|
|
16144
16139
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
16145
16140
|
BibleChapterPicker.Root,
|
|
16146
16141
|
{
|
package/dist/index.js
CHANGED
|
@@ -14705,9 +14705,22 @@ function Trigger3({ asChild = true, children, ...props }) {
|
|
|
14705
14705
|
var BibleChapterPicker = Object.assign({}, { Root: Root3, Trigger: Trigger3 });
|
|
14706
14706
|
|
|
14707
14707
|
// src/components/bible-reader.tsx
|
|
14708
|
-
import {
|
|
14708
|
+
import {
|
|
14709
|
+
createContext as createContext3,
|
|
14710
|
+
useContext as useContext3,
|
|
14711
|
+
useMemo as useMemo3,
|
|
14712
|
+
useState as useState4,
|
|
14713
|
+
useEffect as useEffect4,
|
|
14714
|
+
useLayoutEffect as useLayoutEffect2
|
|
14715
|
+
} from "react";
|
|
14709
14716
|
import { useControllableState as useControllableState3 } from "@radix-ui/react-use-controllable-state";
|
|
14710
|
-
import {
|
|
14717
|
+
import {
|
|
14718
|
+
useBooks as useBooks2,
|
|
14719
|
+
useVersion as useVersion2,
|
|
14720
|
+
useTheme as useTheme4,
|
|
14721
|
+
useYVAuth,
|
|
14722
|
+
YouVersionContext
|
|
14723
|
+
} from "@youversion/platform-react-hooks";
|
|
14711
14724
|
|
|
14712
14725
|
// src/components/bible-version-picker.tsx
|
|
14713
14726
|
import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
|
|
@@ -15946,22 +15959,26 @@ function Root5({
|
|
|
15946
15959
|
defaultProp: defaultVersionId,
|
|
15947
15960
|
onChange: onVersionChange
|
|
15948
15961
|
});
|
|
15949
|
-
const
|
|
15950
|
-
|
|
15951
|
-
|
|
15952
|
-
|
|
15953
|
-
|
|
15954
|
-
|
|
15955
|
-
|
|
15956
|
-
|
|
15957
|
-
|
|
15958
|
-
|
|
15962
|
+
const validatedFontSize = fontSize > MAX_FONT_SIZE || fontSize < MIN_FONT_SIZE ? DEFAULT_FONT_SIZE : fontSize;
|
|
15963
|
+
const [currentFontSize, setCurrentFontSize] = useState4(validatedFontSize);
|
|
15964
|
+
const [currentFontFamily, setCurrentFontFamily] = useState4(fontFamily);
|
|
15965
|
+
useLayoutEffect2(() => {
|
|
15966
|
+
const savedFontSize = localStorage.getItem("youversion-platform:reader:font-size");
|
|
15967
|
+
if (savedFontSize) {
|
|
15968
|
+
const parsed = parseInt(savedFontSize);
|
|
15969
|
+
if (parsed >= MIN_FONT_SIZE && parsed <= MAX_FONT_SIZE) {
|
|
15970
|
+
setCurrentFontSize(parsed);
|
|
15971
|
+
}
|
|
15972
|
+
}
|
|
15973
|
+
const savedFontFamily = localStorage.getItem("youversion-platform:reader:font-family");
|
|
15974
|
+
if (savedFontFamily) {
|
|
15975
|
+
setCurrentFontFamily(savedFontFamily);
|
|
15976
|
+
}
|
|
15977
|
+
}, []);
|
|
15959
15978
|
useEffect4(() => {
|
|
15960
|
-
if (typeof window === "undefined") return;
|
|
15961
15979
|
localStorage.setItem("youversion-platform:reader:font-size", currentFontSize.toString());
|
|
15962
15980
|
}, [currentFontSize]);
|
|
15963
15981
|
useEffect4(() => {
|
|
15964
|
-
if (typeof window === "undefined") return;
|
|
15965
15982
|
localStorage.setItem("youversion-platform:reader:font-family", currentFontFamily);
|
|
15966
15983
|
}, [currentFontFamily]);
|
|
15967
15984
|
const providerTheme = useTheme4();
|
|
@@ -16059,6 +16076,30 @@ function Content4() {
|
|
|
16059
16076
|
)
|
|
16060
16077
|
] });
|
|
16061
16078
|
}
|
|
16079
|
+
function UserMenu() {
|
|
16080
|
+
const { auth, signIn, signOut, userInfo } = useYVAuth();
|
|
16081
|
+
return /* @__PURE__ */ jsxs7(Popover, { children: [
|
|
16082
|
+
/* @__PURE__ */ jsx20(
|
|
16083
|
+
PopoverTrigger,
|
|
16084
|
+
{
|
|
16085
|
+
"data-testid": "user-menu-trigger",
|
|
16086
|
+
className: cn(
|
|
16087
|
+
"yv:inline-flex yv:items-center yv:justify-center yv:justify-self-end yv:mr-4 yv:h-9 yv:rounded-md yv:bg-muted yv:text-foreground yv:hover:bg-muted/80 yv:hover:cursor-pointer yv:overflow-hidden",
|
|
16088
|
+
!(auth.isAuthenticated && userInfo?.avatarUrlFormat) && "yv:px-2"
|
|
16089
|
+
),
|
|
16090
|
+
children: auth.isAuthenticated && userInfo?.avatarUrlFormat ? /* @__PURE__ */ jsx20(
|
|
16091
|
+
"img",
|
|
16092
|
+
{
|
|
16093
|
+
src: userInfo.getAvatarUrl(32, 32)?.toString(),
|
|
16094
|
+
alt: userInfo.name || "User avatar",
|
|
16095
|
+
className: "yv:size-full yv:rounded-full yv:object-cover"
|
|
16096
|
+
}
|
|
16097
|
+
) : /* @__PURE__ */ jsx20(PersonIcon, {})
|
|
16098
|
+
}
|
|
16099
|
+
),
|
|
16100
|
+
/* @__PURE__ */ jsx20(PopoverContent, { className: "yv:rounded-[6px] yv:sm:w-min yv:px-4 yv:mb-6", showHeader: false, children: auth.isAuthenticated ? /* @__PURE__ */ jsx20(Button, { className: "yv:text-black", onClick: () => signOut(), children: "Sign Out" }) : /* @__PURE__ */ jsx20(Button, { className: "yv:text-black", onClick: () => void signIn({ scopes: ["profile"] }), children: "Sign In" }) })
|
|
16101
|
+
] });
|
|
16102
|
+
}
|
|
16062
16103
|
function Toolbar({ border = "top" }) {
|
|
16063
16104
|
const {
|
|
16064
16105
|
book,
|
|
@@ -16072,7 +16113,8 @@ function Toolbar({ border = "top" }) {
|
|
|
16072
16113
|
setCurrentFontSize,
|
|
16073
16114
|
background
|
|
16074
16115
|
} = useBibleReaderContext();
|
|
16075
|
-
const
|
|
16116
|
+
const yvContext = useContext3(YouVersionContext);
|
|
16117
|
+
const authEnabled = yvContext?.authEnabled || false;
|
|
16076
16118
|
return /* @__PURE__ */ jsx20(
|
|
16077
16119
|
"section",
|
|
16078
16120
|
{
|
|
@@ -16082,41 +16124,7 @@ function Toolbar({ border = "top" }) {
|
|
|
16082
16124
|
border === "bottom" && "yv:border-b"
|
|
16083
16125
|
),
|
|
16084
16126
|
children: /* @__PURE__ */ jsxs7("div", { className: "yv:grid yv:w-full yv:grid-cols-7 yv:items-center yv:max-w-lg yv:gap-0.5", children: [
|
|
16085
|
-
/* @__PURE__ */
|
|
16086
|
-
/* @__PURE__ */ jsx20(
|
|
16087
|
-
PopoverTrigger,
|
|
16088
|
-
{
|
|
16089
|
-
"data-testid": "user-menu-trigger",
|
|
16090
|
-
className: cn(
|
|
16091
|
-
"yv:inline-flex yv:items-center yv:justify-center yv:justify-self-end yv:mr-4 yv:h-9 yv:rounded-md yv:bg-muted yv:text-foreground yv:hover:bg-muted/80 yv:hover:cursor-pointer yv:overflow-hidden",
|
|
16092
|
-
!(auth.isAuthenticated && userInfo?.avatarUrlFormat) && "yv:px-2"
|
|
16093
|
-
),
|
|
16094
|
-
children: auth.isAuthenticated && userInfo?.avatarUrlFormat ? /* @__PURE__ */ jsx20(
|
|
16095
|
-
"img",
|
|
16096
|
-
{
|
|
16097
|
-
src: userInfo.getAvatarUrl(32, 32)?.toString(),
|
|
16098
|
-
alt: userInfo.name || "User avatar",
|
|
16099
|
-
className: "yv:size-full yv:rounded-full yv:object-cover"
|
|
16100
|
-
}
|
|
16101
|
-
) : /* @__PURE__ */ jsx20(PersonIcon, {})
|
|
16102
|
-
}
|
|
16103
|
-
),
|
|
16104
|
-
/* @__PURE__ */ jsx20(
|
|
16105
|
-
PopoverContent,
|
|
16106
|
-
{
|
|
16107
|
-
className: "yv:rounded-[6px] yv:sm:w-min yv:px-4 yv:mb-6",
|
|
16108
|
-
showHeader: false,
|
|
16109
|
-
children: auth.isAuthenticated ? /* @__PURE__ */ jsx20(Button, { className: "yv:text-black", onClick: signOut, children: "Sign Out" }) : /* @__PURE__ */ jsx20(
|
|
16110
|
-
Button,
|
|
16111
|
-
{
|
|
16112
|
-
className: "yv:text-black",
|
|
16113
|
-
onClick: () => void signIn({ scopes: ["profile"] }),
|
|
16114
|
-
children: "Sign In"
|
|
16115
|
-
}
|
|
16116
|
-
)
|
|
16117
|
-
}
|
|
16118
|
-
)
|
|
16119
|
-
] }),
|
|
16127
|
+
authEnabled && /* @__PURE__ */ jsx20(UserMenu, {}),
|
|
16120
16128
|
/* @__PURE__ */ jsx20(
|
|
16121
16129
|
BibleChapterPicker.Root,
|
|
16122
16130
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@youversion/platform-react-ui",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.2",
|
|
4
4
|
"description": "React SDK for YouVersion Platform",
|
|
5
5
|
"license": "TBD",
|
|
6
6
|
"type": "module",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"isomorphic-dompurify": "2.23.0",
|
|
39
39
|
"tailwind-merge": "3.3.1",
|
|
40
40
|
"tw-animate-css": "1.4.0",
|
|
41
|
-
"@youversion/platform-core": "1.12.
|
|
42
|
-
"@youversion/platform-react-hooks": "1.12.
|
|
41
|
+
"@youversion/platform-core": "1.12.2",
|
|
42
|
+
"@youversion/platform-react-hooks": "1.12.2"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"react": ">=19.1.0 <20.0.0",
|