@youversion/platform-react-hooks 0.9.0 → 0.10.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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @youversion/platform-react-hooks@0.9.0 build /home/runner/work/platform-sdk-react/platform-sdk-react/packages/hooks
2
+ > @youversion/platform-react-hooks@0.10.1 build /home/runner/work/platform-sdk-react/platform-sdk-react/packages/hooks
3
3
  > tsc -p tsconfig.build.json
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # @youversion/platform-react-hooks
2
2
 
3
+ ## 0.10.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 8e3a672: fix(ui): fix the css build so that it removes our css from all layers
8
+ - this fixes the issue where our sdk css was getting overridden due to
9
+ the consuming app having css that is unlayered and unlayered css will
10
+ always take precedence over layered css.
11
+
12
+ - Updated dependencies [8e3a672]
13
+ - @youversion/platform-core@0.10.1
14
+
15
+ ## 0.10.0
16
+
17
+ ### Minor Changes
18
+
19
+ - df2082d: Added version picker functionality to BibleWidgetView component with enhanced UI theming and user experience improvements.
20
+
21
+ New Features
22
+ - BibleWidgetView Version Picker: Added showVersionPicker prop enabling dynamic Bible version switching within the widget
23
+ - Enhanced Version Display: Improved version abbreviation presentation (e.g., "KJV1984" displays as "KJV" over "1984" in stacked format)
24
+ - Auto-Scroll Navigation: Bible chapter picker now automatically scrolls to and expands the current book when opened
25
+ - Added the ability to customize the text on the YouVersionAuthButton
26
+ - Add theme to the YouVersionProvider to specify light or dark mode to the SDK
27
+
28
+ UI/UX Improvements
29
+ - Consistent Button Styling: Updated all picker buttons to use secondary variant with bold typography
30
+ - Better Theme Support: Added comprehensive dark/light mode theming with data-yv-theme attributes
31
+ - Improved Accessibility: Enhanced search functionality with proper ARIA labels
32
+ - Cleaner DOM Structure: Simplified component hierarchy by removing unnecessary wrapper elements
33
+ - Improve component theming to apply theme to the ui components and improve
34
+ isolating the sdk css.
35
+
36
+ ### Patch Changes
37
+
38
+ - Updated dependencies [df2082d]
39
+ - @youversion/platform-core@0.10.0
40
+
3
41
  ## 0.9.0
4
42
 
5
43
  ### Minor Changes
@@ -2,6 +2,7 @@ type YouVersionContextData = {
2
2
  appKey: string;
3
3
  apiHost?: string;
4
4
  installationId?: string;
5
+ theme?: 'light' | 'dark';
5
6
  };
6
7
  export declare const YouVersionContext: import("react").Context<YouVersionContextData | null>;
7
8
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"YouVersionContext.d.ts","sourceRoot":"","sources":["../../src/context/YouVersionContext.tsx"],"names":[],"mappings":"AAIA,KAAK,qBAAqB,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,iBAAiB,uDAAoD,CAAC"}
1
+ {"version":3,"file":"YouVersionContext.d.ts","sourceRoot":"","sources":["../../src/context/YouVersionContext.tsx"],"names":[],"mappings":"AAIA,KAAK,qBAAqB,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,iBAAiB,uDAAoD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"YouVersionContext.js","sourceRoot":"","sources":["../../src/context/YouVersionContext.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAQtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAA+B,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"YouVersionContext.js","sourceRoot":"","sources":["../../src/context/YouVersionContext.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAStC,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAA+B,IAAI,CAAC,CAAC"}
@@ -3,6 +3,7 @@ interface YouVersionProviderPropsBase {
3
3
  children: ReactNode;
4
4
  appKey: string;
5
5
  apiHost?: string;
6
+ theme?: 'light' | 'dark';
6
7
  }
7
8
  interface YouVersionProviderPropsWithAuth extends YouVersionProviderPropsBase {
8
9
  authRedirectUrl: string;
@@ -1 +1 @@
1
- {"version":3,"file":"YouVersionProvider.d.ts","sourceRoot":"","sources":["../../src/context/YouVersionProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAK1D,UAAU,2BAA2B;IACnC,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,+BAAgC,SAAQ,2BAA2B;IAC3E,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,IAAI,CAAC;CACnB;AAED,UAAU,kCAAmC,SAAQ,2BAA2B;IAC9E,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,eAAe,CAAC,EAAE,KAAK,CAAC;CACzB;AAID,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,iBAAiB,CAAC,+BAA+B,GAAG,kCAAkC,CAAC,GAC7F,KAAK,CAAC,YAAY,CAqCpB"}
1
+ {"version":3,"file":"YouVersionProvider.d.ts","sourceRoot":"","sources":["../../src/context/YouVersionProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAK1D,UAAU,2BAA2B;IACnC,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC1B;AAED,UAAU,+BAAgC,SAAQ,2BAA2B;IAC3E,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,IAAI,CAAC;CACnB;AAED,UAAU,kCAAmC,SAAQ,2BAA2B;IAC9E,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,eAAe,CAAC,EAAE,KAAK,CAAC;CACzB;AAID,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,iBAAiB,CAAC,+BAA+B,GAAG,kCAAkC,CAAC,GAC7F,KAAK,CAAC,YAAY,CA0CpB"}
@@ -5,7 +5,7 @@ import { YouVersionContext } from './YouVersionContext';
5
5
  import { YouVersionPlatformConfiguration } from '@youversion/platform-core';
6
6
  const AuthProvider = lazy(() => import('./YouVersionAuthProvider'));
7
7
  export function YouVersionProvider(props) {
8
- const { appKey, apiHost = 'api.youversion.com', includeAuth, children } = props;
8
+ const { appKey, apiHost = 'api.youversion.com', includeAuth, theme = 'light', children } = props;
9
9
  // Syncing appKey and apiHost to YouVersionPlatformConfiguration
10
10
  // so that this can be in sync with any other code that uses
11
11
  // the YouVersionPlatformConfiguration, of which a lot of our
@@ -17,7 +17,12 @@ export function YouVersionProvider(props) {
17
17
  if (includeAuth) {
18
18
  const { authRedirectUrl } = props;
19
19
  // Installation ID gets set automatically by YouVersionPlatformConfiguration
20
- return (_jsx(YouVersionContext.Provider, { value: { appKey, apiHost, installationId: YouVersionPlatformConfiguration.installationId }, children: _jsx(Suspense, { children: _jsx(AuthProvider, { config: { appKey, apiHost, redirectUri: authRedirectUrl }, children: _jsx("div", { "data-yv-sdk": true, children: children }) }) }) }));
20
+ return (_jsx(YouVersionContext.Provider, { value: {
21
+ appKey,
22
+ apiHost,
23
+ installationId: YouVersionPlatformConfiguration.installationId,
24
+ theme,
25
+ }, children: _jsx(Suspense, { children: _jsx(AuthProvider, { config: { appKey, apiHost, redirectUri: authRedirectUrl }, children: children }) }) }));
21
26
  }
22
27
  // Installation ID gets set automatically by YouVersionPlatformConfiguration
23
28
  return (_jsx(YouVersionContext.Provider, { value: { appKey, apiHost, installationId: YouVersionPlatformConfiguration.installationId }, children: children }));
@@ -1 +1 @@
1
- {"version":3,"file":"YouVersionProvider.js","sourceRoot":"","sources":["../../src/context/YouVersionProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAkB5E,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC,CAAC;AAEpE,MAAM,UAAU,kBAAkB,CAChC,KAA8F;IAE9F,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,oBAAoB,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEhF,gEAAgE;IAChE,4DAA4D;IAC5D,6DAA6D;IAC7D,wCAAwC;IACxC,SAAS,CAAC,GAAG,EAAE;QACb,+BAA+B,CAAC,MAAM,GAAG,MAAM,CAAC;QAChD,+BAA+B,CAAC,OAAO,GAAG,OAAO,CAAC;IACpD,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAEtB,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC;QAElC,4EAA4E;QAC5E,OAAO,CACL,KAAC,iBAAiB,CAAC,QAAQ,IACzB,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,+BAA+B,CAAC,cAAc,EAAE,YAE1F,KAAC,QAAQ,cACP,KAAC,YAAY,IAAC,MAAM,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,YACrE,6CAAkB,QAAQ,GAAO,GACpB,GACN,GACgB,CAC9B,CAAC;IACJ,CAAC;IAED,4EAA4E;IAC5E,OAAO,CACL,KAAC,iBAAiB,CAAC,QAAQ,IACzB,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,+BAA+B,CAAC,cAAc,EAAE,YAEzF,QAAQ,GACkB,CAC9B,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"YouVersionProvider.js","sourceRoot":"","sources":["../../src/context/YouVersionProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAmB5E,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC,CAAC;AAEpE,MAAM,UAAU,kBAAkB,CAChC,KAA8F;IAE9F,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,oBAAoB,EAAE,WAAW,EAAE,KAAK,GAAG,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEjG,gEAAgE;IAChE,4DAA4D;IAC5D,6DAA6D;IAC7D,wCAAwC;IACxC,SAAS,CAAC,GAAG,EAAE;QACb,+BAA+B,CAAC,MAAM,GAAG,MAAM,CAAC;QAChD,+BAA+B,CAAC,OAAO,GAAG,OAAO,CAAC;IACpD,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAEtB,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC;QAElC,4EAA4E;QAC5E,OAAO,CACL,KAAC,iBAAiB,CAAC,QAAQ,IACzB,KAAK,EAAE;gBACL,MAAM;gBACN,OAAO;gBACP,cAAc,EAAE,+BAA+B,CAAC,cAAc;gBAC9D,KAAK;aACN,YAED,KAAC,QAAQ,cACP,KAAC,YAAY,IAAC,MAAM,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,YACpE,QAAQ,GACI,GACN,GACgB,CAC9B,CAAC;IACJ,CAAC;IAED,4EAA4E;IAC5E,OAAO,CACL,KAAC,iBAAiB,CAAC,QAAQ,IACzB,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,+BAA+B,CAAC,cAAc,EAAE,YAEzF,QAAQ,GACkB,CAC9B,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ export * from './usePassage';
18
18
  export * from './useVOTD';
19
19
  export * from './useHighlights';
20
20
  export * from './useLanguages';
21
+ export * from './useTheme';
21
22
  export * from './useYVAuth';
22
23
  export * from './types/auth';
23
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAG/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAG3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@ export * from './usePassage';
18
18
  export * from './useVOTD';
19
19
  export * from './useHighlights';
20
20
  export * from './useLanguages';
21
+ export * from './useTheme';
21
22
  // Auth hooks
22
23
  export * from './useYVAuth';
23
24
  export * from './types/auth';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAE/B,aAAa;AACb,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAE3B,aAAa;AACb,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Hook to access the current theme from YouVersionContext
3
+ *
4
+ * @returns The current theme ('light' or 'dark'), defaults to 'light' if provider is missing
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * function MyComponent() {
9
+ * const theme = useTheme();
10
+ * }
11
+ * ```
12
+ */
13
+ export declare function useTheme(): 'light' | 'dark';
14
+ //# sourceMappingURL=useTheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../src/useTheme.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,IAAI,OAAO,GAAG,MAAM,CAK3C"}
@@ -0,0 +1,21 @@
1
+ 'use client';
2
+ import { useContext } from 'react';
3
+ import { YouVersionContext } from './context';
4
+ /**
5
+ * Hook to access the current theme from YouVersionContext
6
+ *
7
+ * @returns The current theme ('light' or 'dark'), defaults to 'light' if provider is missing
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * function MyComponent() {
12
+ * const theme = useTheme();
13
+ * }
14
+ * ```
15
+ */
16
+ export function useTheme() {
17
+ const context = useContext(YouVersionContext);
18
+ // Default to 'light' to match YouVersionProvider's default
19
+ return context?.theme || 'light';
20
+ }
21
+ //# sourceMappingURL=useTheme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTheme.js","sourceRoot":"","sources":["../src/useTheme.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,QAAQ;IACtB,MAAM,OAAO,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAE9C,2DAA2D;IAC3D,OAAO,OAAO,EAAE,KAAK,IAAI,OAAO,CAAC;AACnC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@youversion/platform-react-hooks",
3
- "version": "0.9.0",
3
+ "version": "0.10.1",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -22,7 +22,7 @@
22
22
  }
23
23
  },
24
24
  "dependencies": {
25
- "@youversion/platform-core": "0.9.0"
25
+ "@youversion/platform-core": "0.10.1"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react": ">=19.1.0 <20.0.0"
@@ -6,6 +6,7 @@ type YouVersionContextData = {
6
6
  appKey: string;
7
7
  apiHost?: string;
8
8
  installationId?: string;
9
+ theme?: 'light' | 'dark';
9
10
  };
10
11
 
11
12
  export const YouVersionContext = createContext<YouVersionContextData | null>(null);
@@ -9,6 +9,7 @@ interface YouVersionProviderPropsBase {
9
9
  children: ReactNode;
10
10
  appKey: string;
11
11
  apiHost?: string;
12
+ theme?: 'light' | 'dark';
12
13
  }
13
14
 
14
15
  interface YouVersionProviderPropsWithAuth extends YouVersionProviderPropsBase {
@@ -26,7 +27,7 @@ const AuthProvider = lazy(() => import('./YouVersionAuthProvider'));
26
27
  export function YouVersionProvider(
27
28
  props: PropsWithChildren<YouVersionProviderPropsWithAuth | YouVersionProviderPropsWithoutAuth>,
28
29
  ): React.ReactElement {
29
- const { appKey, apiHost = 'api.youversion.com', includeAuth, children } = props;
30
+ const { appKey, apiHost = 'api.youversion.com', includeAuth, theme = 'light', children } = props;
30
31
 
31
32
  // Syncing appKey and apiHost to YouVersionPlatformConfiguration
32
33
  // so that this can be in sync with any other code that uses
@@ -43,11 +44,16 @@ export function YouVersionProvider(
43
44
  // Installation ID gets set automatically by YouVersionPlatformConfiguration
44
45
  return (
45
46
  <YouVersionContext.Provider
46
- value={{ appKey, apiHost, installationId: YouVersionPlatformConfiguration.installationId }}
47
+ value={{
48
+ appKey,
49
+ apiHost,
50
+ installationId: YouVersionPlatformConfiguration.installationId,
51
+ theme,
52
+ }}
47
53
  >
48
54
  <Suspense>
49
55
  <AuthProvider config={{ appKey, apiHost, redirectUri: authRedirectUrl }}>
50
- <div data-yv-sdk>{children}</div>
56
+ {children}
51
57
  </AuthProvider>
52
58
  </Suspense>
53
59
  </YouVersionContext.Provider>
package/src/index.ts CHANGED
@@ -18,6 +18,7 @@ export * from './usePassage';
18
18
  export * from './useVOTD';
19
19
  export * from './useHighlights';
20
20
  export * from './useLanguages';
21
+ export * from './useTheme';
21
22
 
22
23
  // Auth hooks
23
24
  export * from './useYVAuth';
@@ -0,0 +1,23 @@
1
+ 'use client';
2
+
3
+ import { useContext } from 'react';
4
+ import { YouVersionContext } from './context';
5
+
6
+ /**
7
+ * Hook to access the current theme from YouVersionContext
8
+ *
9
+ * @returns The current theme ('light' or 'dark'), defaults to 'light' if provider is missing
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * function MyComponent() {
14
+ * const theme = useTheme();
15
+ * }
16
+ * ```
17
+ */
18
+ export function useTheme(): 'light' | 'dark' {
19
+ const context = useContext(YouVersionContext);
20
+
21
+ // Default to 'light' to match YouVersionProvider's default
22
+ return context?.theme || 'light';
23
+ }