@sevenfold/setto-client 0.1.0

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.
@@ -0,0 +1,40 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { SupabaseClient, Session } from '@supabase/supabase-js';
3
+ import { type SettoApi } from './lib/api';
4
+ import { I18nStore } from './lib/i18n-store';
5
+ import { ThemeStore } from './lib/theme-store';
6
+ import type { SettoConfig } from './types';
7
+ interface SettoContextValue {
8
+ config: SettoConfig;
9
+ supabase: SupabaseClient;
10
+ api: SettoApi;
11
+ session: Session | null;
12
+ /** True while the initial auth state is being read from local storage. */
13
+ authLoading: boolean;
14
+ /** True when inline edit mode is active (`?setto=edit` + session). */
15
+ editMode: boolean;
16
+ /**
17
+ * Lazily created when i18next is initialised. Components that need it
18
+ * should `if (!store) return null;` until then.
19
+ */
20
+ store: I18nStore | null;
21
+ themeStore: ThemeStore | null;
22
+ }
23
+ export interface SettoProviderProps {
24
+ config: SettoConfig;
25
+ children: ReactNode;
26
+ }
27
+ /**
28
+ * Wraps the host app. Initialises Supabase, the API client, and listens for
29
+ * auth changes. Mounts the edit toolbar and enables inline editing when active.
30
+ *
31
+ * Edit mode is on when ALL of:
32
+ * 1. There is an authenticated Supabase session.
33
+ * 2. The URL contains `?setto=edit`.
34
+ *
35
+ * The /admin dashboard does not activate edit mode — use "Begynn å redigere"
36
+ * which navigates to `/?setto=edit`.
37
+ */
38
+ export declare function SettoProvider({ config, children }: SettoProviderProps): import("react/jsx-runtime").JSX.Element;
39
+ export declare function useSetto(): SettoContextValue;
40
+ export {};
@@ -0,0 +1,10 @@
1
+ import { type ReactNode } from 'react';
2
+ interface SectionEditContextValue {
3
+ selectedId: string | null;
4
+ selectSection: (id: string | null) => void;
5
+ }
6
+ export declare function SectionEditProvider({ children }: {
7
+ children: ReactNode;
8
+ }): import("react/jsx-runtime").JSX.Element;
9
+ export declare function useSectionEdit(): SectionEditContextValue;
10
+ export {};
@@ -0,0 +1,10 @@
1
+ /** Colour fields exposed in the section toolbar. */
2
+ export interface SectionColorField {
3
+ key: string;
4
+ label: string;
5
+ }
6
+ export interface SectionSchema {
7
+ /** Display name in the toolbar. */
8
+ label: string;
9
+ fields: SectionColorField[];
10
+ }