@webmaster-droid/web 0.1.0-alpha.1 → 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.
Files changed (3) hide show
  1. package/dist/index.d.ts +13 -11
  2. package/dist/index.js +700 -442
  3. package/package.json +5 -3
package/dist/index.d.ts CHANGED
@@ -3,14 +3,15 @@ import React, { ImgHTMLAttributes, HTMLAttributes, ReactNode } from 'react';
3
3
  import { CmsDocument, SelectedElementKind, SelectedElementContext, PublishRequest, RollbackRequest } from '@webmaster-droid/contracts';
4
4
  import { Session, SupabaseClient } from '@supabase/supabase-js';
5
5
 
6
+ type AnyCmsDocument$1 = CmsDocument<object, object, string>;
6
7
  type EditableMode = "live" | "draft";
7
8
  interface EditableContextValue {
8
- document: CmsDocument;
9
+ document: AnyCmsDocument$1;
9
10
  mode: EditableMode;
10
11
  enabled: boolean;
11
12
  }
12
13
  declare function EditableProvider(props: {
13
- document: CmsDocument;
14
+ document: AnyCmsDocument$1;
14
15
  mode?: EditableMode;
15
16
  enabled?: boolean;
16
17
  children: ReactNode;
@@ -28,7 +29,7 @@ declare function parseSelectedEditableFromTarget(target: EventTarget | null, pag
28
29
  type TagName = keyof React.JSX.IntrinsicElements;
29
30
  interface EditableTextProps extends HTMLAttributes<HTMLElement> {
30
31
  path: string;
31
- fallback: string;
32
+ fallback?: string;
32
33
  as?: TagName;
33
34
  label?: string;
34
35
  relatedPaths?: string[];
@@ -317,7 +318,7 @@ declare function EditableText({ path, fallback, as, label, relatedPaths, ...rest
317
318
  }, Element>;
318
319
  interface EditableRichTextProps extends HTMLAttributes<HTMLElement> {
319
320
  path: string;
320
- fallback: string;
321
+ fallback?: string;
321
322
  as?: TagName;
322
323
  label?: string;
323
324
  }
@@ -605,7 +606,7 @@ declare function EditableRichText({ path, fallback, as, label, ...rest }: Editab
605
606
  }, Element>;
606
607
  interface EditableImageProps extends ImgHTMLAttributes<HTMLImageElement> {
607
608
  path: string;
608
- fallbackSrc: string;
609
+ fallbackSrc?: string;
609
610
  altPath?: string;
610
611
  fallbackAlt?: string;
611
612
  label?: string;
@@ -614,8 +615,8 @@ declare function EditableImage({ path, fallbackSrc, altPath, fallbackAlt, label,
614
615
  interface EditableLinkProps extends Omit<HTMLAttributes<HTMLAnchorElement>, "children"> {
615
616
  hrefPath: string;
616
617
  labelPath: string;
617
- fallbackHref: string;
618
- fallbackLabel: string;
618
+ fallbackHref?: string;
619
+ fallbackLabel?: string;
619
620
  label?: string;
620
621
  }
621
622
  declare function EditableLink({ hrefPath, labelPath, fallbackHref, fallbackLabel, label, ...rest }: EditableLinkProps): react_jsx_runtime.JSX.Element;
@@ -678,20 +679,21 @@ declare function useWebmasterDroid(): WebmasterDroidContextValue;
678
679
 
679
680
  declare function WebmasterDroidOverlay(): react_jsx_runtime.JSX.Element | null;
680
681
 
681
- type WebmasterDroidCmsContextValue<TDocument extends CmsDocument = CmsDocument> = {
682
+ type AnyCmsDocument = CmsDocument<object, object, string>;
683
+ type WebmasterDroidCmsContextValue<TDocument extends AnyCmsDocument = AnyCmsDocument> = {
682
684
  document: TDocument;
683
685
  stage: "live" | "draft";
684
686
  loading: boolean;
685
687
  error: string | null;
686
688
  };
687
- declare function WebmasterDroidRuntime<TDocument extends CmsDocument>(props: {
689
+ declare function WebmasterDroidRuntime<TDocument extends AnyCmsDocument = AnyCmsDocument>(props: {
688
690
  children: ReactNode;
689
- fallbackDocument: TDocument;
691
+ fallbackDocument?: TDocument;
690
692
  config?: WebmasterDroidConfig;
691
693
  includeOverlay?: boolean;
692
694
  applyThemeTokens?: boolean;
693
695
  }): react_jsx_runtime.JSX.Element;
694
- declare function useWebmasterDroidCmsDocument<TDocument extends CmsDocument = CmsDocument>(): WebmasterDroidCmsContextValue<TDocument>;
696
+ declare function useWebmasterDroidCmsDocument<TDocument extends AnyCmsDocument = AnyCmsDocument>(): WebmasterDroidCmsContextValue<TDocument>;
695
697
 
696
698
  declare function getSupabaseBrowserClient(config: ResolvedWebmasterDroidConfig): SupabaseClient | null;
697
699