@opencode/ui 0.0.0-dev-248 → 0.0.0-dev-256

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.
@@ -9,6 +9,7 @@ export declare function createSimpleContext<T, Props extends Record<string, any>
9
9
  } : {
10
10
  gate?: boolean;
11
11
  })): {
12
+ context: import("solid-js").Context<T | undefined>;
12
13
  provider: (props: ParentProps<Props>) => import("solid-js").JSX.Element;
13
14
  use(): NonNullable<T>;
14
15
  };
@@ -1,6 +1,22 @@
1
1
  import type { DesktopTheme } from "./types";
2
2
  export type ColorScheme = "light" | "dark" | "system";
3
3
  export declare const { use: useTheme, provider: ThemeProvider }: {
4
+ context: import("solid-js").Context<{
5
+ themeId: () => string;
6
+ colorScheme: () => ColorScheme;
7
+ mode: () => "dark" | "light";
8
+ ids: () => string[];
9
+ name: (id: string) => string;
10
+ loadThemes: () => Promise<Record<string, DesktopTheme>>;
11
+ themes: () => Record<string, DesktopTheme>;
12
+ setTheme: (id: string) => void;
13
+ setColorScheme: (scheme: ColorScheme) => void;
14
+ registerTheme: (theme: DesktopTheme) => void;
15
+ previewTheme: (id: string) => void;
16
+ previewColorScheme: (scheme: ColorScheme) => void;
17
+ commitPreview: () => void;
18
+ cancelPreview: () => void;
19
+ } | undefined>;
4
20
  provider: (props: import("solid-js").ParentProps<{
5
21
  defaultTheme?: string;
6
22
  onThemeApplied?: (theme: DesktopTheme, mode: "light" | "dark", scheme: ColorScheme) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencode/ui",
3
- "version": "0.0.0-dev-248",
3
+ "version": "0.0.0-dev-256",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -288,7 +288,7 @@
288
288
  "dependencies": {
289
289
  "@kitlangton/solid-motion": "0.2.2",
290
290
  "@kobalte/core": "0.13.13",
291
- "@opencode/util": "0.0.0-dev-248",
291
+ "@opencode/util": "0.0.0-dev-256",
292
292
  "@pierre/diffs": "1.6.1",
293
293
  "@pierre/highlights": "0.2.0",
294
294
  "@solid-primitives/event-listener": "2.4.6",
@@ -9,6 +9,7 @@ export function createSimpleContext<T, Props extends Record<string, any>>(
9
9
  const ctx = createContext<T>()
10
10
 
11
11
  return {
12
+ context: ctx,
12
13
  provider: (props: ParentProps<Props>) => {
13
14
  const init = input.init(props)
14
15
  const gate = input.gate ?? true
@@ -19,10 +20,10 @@ export function createSimpleContext<T, Props extends Record<string, any>>(
19
20
 
20
21
  // Access init.ready inside the memo to make it reactive for getter properties
21
22
  const isReady = createMemo(() => {
22
- // @ts-expect-error
23
- const ready = init.ready as Accessor<boolean> | boolean | undefined
23
+ // SAFETY: contexts whose value has `ready` must pass `gate`, and their `ready` is a boolean or its accessor.
24
+ const ready = (init as { ready?: Accessor<boolean> | boolean }).ready
24
25
 
25
- return ready === undefined || (typeof ready === "function" ? ready() : ready)
26
+ return ready === undefined || (ready instanceof Function ? ready() : ready)
26
27
  })
27
28
 
28
29
  return (