@sevenfold/setto-client 0.14.0 → 0.16.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.
package/dist/chrome.d.ts CHANGED
@@ -42,7 +42,7 @@ export interface SettoChromeHandshake {
42
42
  * keeps a chrome bundle that fails to load, or throws while rendering, from
43
43
  * taking the editor down with it.
44
44
  */
45
- mountSlot: (name: string, Component: React.ComponentType) => void;
45
+ mountSlot: (name: string, Component: React.ComponentType<any>) => void;
46
46
  /**
47
47
  * The host's own `useSetto`, callable from the chrome.
48
48
  *
@@ -71,6 +71,8 @@ export interface SettoChromeHandshake {
71
71
  } | null;
72
72
  sitesLoaded: boolean;
73
73
  editMode: boolean;
74
+ /** A signed-out visitor trying the editor on setto.no. */
75
+ guestEdit: boolean;
74
76
  authLoading: boolean;
75
77
  };
76
78
  /** Told whenever that state changes. Returns an unsubscribe. */
@@ -87,7 +89,7 @@ declare global {
87
89
  * offered nothing — including after it offered something that threw. Callers
88
90
  * render their own version when this is null; every one of them must have one.
89
91
  */
90
- export declare function useSettoChromeSlot(name: string): React.ComponentType | null;
92
+ export declare function useSettoChromeSlot<P extends object = Record<string, never>>(name: string): React.ComponentType<P> | null;
91
93
  /** @deprecated Use `useSettoChromeSlot('admin')`. */
92
- export declare function useSettoAdminChrome(): React.ComponentType | null;
94
+ export declare function useSettoAdminChrome(): React.ComponentType<Record<string, never>> | null;
93
95
  export declare function SettoChrome(): import("react/jsx-runtime").JSX.Element | null;
@@ -1,16 +1,22 @@
1
- import { type ReactNode } from 'react';
2
- interface GuestEditContextValue {
3
- active: boolean;
4
- start: () => void;
5
- stop: () => void;
6
- }
1
+ import type { ReactNode } from 'react';
7
2
  /**
8
3
  * Lets visitors inline-edit a marketing site (e.g. setto.no) without auth —
9
4
  * text, section/block colours, icons and list items. Changes are session-only
10
5
  * and never published. Real Setto edit mode always takes precedence.
6
+ *
7
+ * A provider in name only since 2026-09-09: the state moved into the main
8
+ * context so the chrome could see it, and what is left here is the one thing
9
+ * guest mode adds — the section toolbar, over a page nobody is signed in to.
10
+ * The component comes from Setto like the rest of the editing chrome, so there
11
+ * is nothing to draw until it arrives, and nothing to draw at all if it does
12
+ * not. That is the right failure for a demo.
11
13
  */
12
14
  export declare function GuestEditProvider({ children }: {
13
15
  children: ReactNode;
14
16
  }): import("react/jsx-runtime").JSX.Element;
17
+ export interface GuestEditContextValue {
18
+ active: boolean;
19
+ start: () => void;
20
+ stop: () => void;
21
+ }
15
22
  export declare function useGuestEdit(): GuestEditContextValue;
16
- export {};
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export { SettoProvider, useSetto } from './provider';
2
2
  export { GuestEditProvider, useGuestEdit } from './guest-edit';
3
- export { SettoPreviewBar, isPreviewHost, previewBarState } from './preview-bar';
4
3
  export { SettoChrome, useSettoChromeSlot } from './chrome';
5
4
  export type { SettoChromeHandshake } from './chrome';
6
5
  export { T } from './T';
@@ -12,7 +11,7 @@ export { SettoImage } from './SettoImage';
12
11
  export type { SettoImageProps } from './SettoImage';
13
12
  export { SettoRepeater } from './SettoRepeater';
14
13
  export type { SettoRepeaterProps } from './SettoRepeater';
15
- export { SettoForm, FORM_FIELD_TYPES, FORM_FIELD_TYPE_LABELS, formFieldsPrefix, isFormFieldType, readLocaleFields, settoSubmissionUrl, } from './modules/forms';
14
+ export { SettoForm, FORM_FIELD_TYPES, FORM_FIELD_TYPE_LABELS, fieldTypeHasOptions, fieldTypeHasPlaceholder, formFieldsPrefix, isFormFieldType, readLocaleFields, settoSubmissionUrl, } from './modules/forms';
16
15
  export type { SettoFormProps, SettoFormClassNames, FormFieldProp, FormSettings, FormSubmissionRow, FormValue, FormValues, ResolvedFormField, SubmissionEnvelope, } from './modules/forms';
17
16
  export { SETTO_MODULES } from './modules';
18
17
  export type { SettoModule } from './modules';
@@ -36,7 +35,10 @@ export { BLOCK_REGISTRY, BLOCK_TYPES, nodeChildren } from './block-tree/registry
36
35
  export type { BlockTypeMeta } from './block-tree/registry';
37
36
  export { SETTO_BASE, siteHomeUrl, isAdminRoute, isAdminDeploymentView, adminViewUrl, currentAdminView, isAdminPanelView, adminRedirectUrl, CHECKOUT_INTENT, checkoutIntentUrl, wantsCheckout, withoutCheckoutIntent, } from './lib/urls';
38
37
  export { SettoMark } from './edit-mode/setto-mark';
38
+ export { FloatingPopover } from './edit-mode/floating-popover';
39
+ export type { FieldPatch, FormFieldToolsProps, FormFieldToolsComponent, } from './modules/forms/field-tools';
40
+ export { isLinkContext } from './lib/link-context';
41
+ export { useCoarsePointer } from './lib/use-coarse-pointer';
39
42
  export { FAB_SIZE, FAB_INSET } from './edit-mode/constants';
40
43
  export { EMPTY_I18N_STORE_SNAPSHOT } from './lib/i18n-store';
41
44
  export type { I18nStoreSnapshot } from './lib/i18n-store';
42
- export { IN_PROGRESS_STATUSES, isDeploymentInProgress, isDeploymentStale, STALE_PENDING_MS, STALE_BUILDING_MS, fetchInProgressDeploymentId, waitForDeploymentByCommit, useDeploymentStatus, PublishProgressBar, PublishProgressSteps, } from './edit-mode/deployment-status';
@@ -0,0 +1,35 @@
1
+ import type { ComponentType } from 'react';
2
+ import type { FormFieldType, ResolvedFormField } from './fields';
3
+ /**
4
+ * The contract between a form on the customer's page and the editing tools
5
+ * Setto serves for it.
6
+ *
7
+ * The tools themselves — the popover, the type picker, the reordering — live
8
+ * in setto-server and arrive at runtime, so changing them is a deploy. What
9
+ * has to stay here is the shape of the conversation between the two, because
10
+ * `SettoForm` applies the patch and it is compiled into the customer's bundle.
11
+ *
12
+ * That makes this the pinned part, and it is deliberately data: adding a field
13
+ * kind means widening `FormFieldType`, but rearranging the panel that sets one
14
+ * costs nothing on this side.
15
+ */
16
+ export interface FieldPatch {
17
+ name?: string;
18
+ type?: FormFieldType;
19
+ required?: boolean;
20
+ label?: string;
21
+ placeholder?: string;
22
+ options?: string;
23
+ }
24
+ export interface FormFieldToolsProps {
25
+ field: ResolvedFormField;
26
+ index: number;
27
+ count: number;
28
+ /** Open the settings popover as soon as the tools mount (a field just added). */
29
+ autoOpen?: boolean;
30
+ onMove: (direction: -1 | 1) => void;
31
+ onRemove: () => void;
32
+ onChange: (patch: FieldPatch) => void;
33
+ }
34
+ /** What the chrome registers under `mountSlot('form-field-tools', …)`. */
35
+ export type FormFieldToolsComponent = ComponentType<FormFieldToolsProps>;
@@ -8,5 +8,5 @@ export declare const formsModule: SettoModule;
8
8
  export { SettoForm } from './SettoForm';
9
9
  export type { SettoFormProps, SettoFormClassNames } from './SettoForm';
10
10
  export type { FormSettings, FormSubmissionRow, FormsApi } from './api';
11
- export { FORM_FIELD_TYPES, FORM_FIELD_TYPE_LABELS, formFieldsPrefix, isFormFieldType, readLocaleFields, settoSubmissionUrl, } from './fields';
11
+ export { FORM_FIELD_TYPES, FORM_FIELD_TYPE_LABELS, fieldTypeHasOptions, fieldTypeHasPlaceholder, formFieldsPrefix, isFormFieldType, readLocaleFields, settoSubmissionUrl, } from './fields';
12
12
  export type { FormFieldProp, FormFieldType, FormValue, FormValues, ResolvedFormField, SubmissionEnvelope, } from './fields';
@@ -25,6 +25,18 @@ export interface SettoContextValue {
25
25
  store: I18nStore | null;
26
26
  themeStore: ThemeStore | null;
27
27
  assetStore: AssetStore | null;
28
+ /** The section the editor has selected, or null. */
29
+ selectedSectionId: string | null;
30
+ selectSection: (id: string | null) => void;
31
+ /**
32
+ * True while a signed-out visitor is trying the editor (setto.no).
33
+ *
34
+ * Here beside `editMode` rather than in `GuestEditProvider`'s own context
35
+ * for the same reason the selected section is: the chrome that draws the
36
+ * section toolbar sits above that provider and can call only `useSetto`.
37
+ */
38
+ guestEdit: boolean;
39
+ setGuestEdit: (on: boolean) => void;
28
40
  }
29
41
  /**
30
42
  * Exported for one caller: the chrome bundle.
@@ -1,10 +1,15 @@
1
- import { type ReactNode } from 'react';
2
- interface SectionEditContextValue {
1
+ /**
2
+ * Which section the editor has selected.
3
+ *
4
+ * A context of its own until 2026-09-09, when the section toolbar moved out to
5
+ * the chrome served by setto-server. That bundle can call exactly one hook of
6
+ * the host's — `useSetto` — so the state moved into the main context and this
7
+ * became an adapter. Kept because `SettoSection` and `SettoBlock` read it on
8
+ * every render of every page, and renaming that in thirteen pinned sites buys
9
+ * nothing.
10
+ */
11
+ export interface SectionEditContextValue {
3
12
  selectedId: string | null;
4
13
  selectSection: (id: string | null) => void;
5
14
  }
6
- export declare function SectionEditProvider({ children }: {
7
- children: ReactNode;
8
- }): import("react/jsx-runtime").JSX.Element;
9
15
  export declare function useSectionEdit(): SectionEditContextValue;
10
- export {};