@puckeditor/plugin-pages 0.9.0-canary.fb1abcf5 → 0.9.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/index.d.mts CHANGED
@@ -1,10 +1,26 @@
1
+ import * as _puckeditor_core_dist_actions_Dgllwd_W from '@puckeditor/core/dist/actions-Dgllwd-W';
1
2
  import * as react from 'react';
2
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
4
 
5
+ /** A request to the pages API, as `prepareRequest` receives and returns it. */
6
+ type RequestOptions = {
7
+ /** The JSON body. Only POST requests send one. */
8
+ body?: Record<string, any>;
9
+ headers?: HeadersInit;
10
+ credentials?: RequestCredentials;
11
+ };
4
12
  type PagePluginOptions = {
13
+ /** Where `puckHandler` serves the pages API. Defaults to `/api/puck/pages`. */
5
14
  host?: string;
6
- siteId?: string;
7
- parentOrigin?: string;
15
+ /** Where the site renders pages, without a trailing slash, for "View page" links. Defaults to this origin. */
16
+ siteUrl?: string;
17
+ /** The page to open first. Defaults to the `path` search param. */
18
+ initialPath?: string;
19
+ /**
20
+ * Customizes each request to the pages API, to add headers, add metadata to the body,
21
+ * or change credentials. The headers and body it returns are merged over the defaults.
22
+ */
23
+ prepareRequest?: (opts: RequestOptions) => RequestOptions | Promise<RequestOptions>;
8
24
  };
9
25
 
10
26
  declare function createPagesPlugin(opts?: PagePluginOptions): {
@@ -13,10 +29,21 @@ declare function createPagesPlugin(opts?: PagePluginOptions): {
13
29
  render: () => react_jsx_runtime.JSX.Element;
14
30
  icon: react_jsx_runtime.JSX.Element;
15
31
  overrides: {
16
- headerActions: () => react_jsx_runtime.JSX.Element;
32
+ headerActions: ({ children }: {
33
+ children: react.ReactNode;
34
+ }) => react_jsx_runtime.JSX.Element;
17
35
  preview: ({ children }: {
18
36
  children: react.ReactNode;
19
37
  }) => react_jsx_runtime.JSX.Element;
38
+ fields: ({ children }: {
39
+ children: react.ReactNode;
40
+ isLoading: boolean;
41
+ itemSelector?: _puckeditor_core_dist_actions_Dgllwd_W.W | null;
42
+ fields: Partial<Record<string, react.ReactNode>>;
43
+ }) => react_jsx_runtime.JSX.Element;
44
+ outline: ({ children }: {
45
+ children: react.ReactNode;
46
+ }) => react_jsx_runtime.JSX.Element;
20
47
  };
21
48
  };
22
49
 
package/dist/index.d.ts CHANGED
@@ -1,10 +1,26 @@
1
+ import * as _puckeditor_core_dist_actions_Dgllwd_W from '@puckeditor/core/dist/actions-Dgllwd-W';
1
2
  import * as react from 'react';
2
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
4
 
5
+ /** A request to the pages API, as `prepareRequest` receives and returns it. */
6
+ type RequestOptions = {
7
+ /** The JSON body. Only POST requests send one. */
8
+ body?: Record<string, any>;
9
+ headers?: HeadersInit;
10
+ credentials?: RequestCredentials;
11
+ };
4
12
  type PagePluginOptions = {
13
+ /** Where `puckHandler` serves the pages API. Defaults to `/api/puck/pages`. */
5
14
  host?: string;
6
- siteId?: string;
7
- parentOrigin?: string;
15
+ /** Where the site renders pages, without a trailing slash, for "View page" links. Defaults to this origin. */
16
+ siteUrl?: string;
17
+ /** The page to open first. Defaults to the `path` search param. */
18
+ initialPath?: string;
19
+ /**
20
+ * Customizes each request to the pages API, to add headers, add metadata to the body,
21
+ * or change credentials. The headers and body it returns are merged over the defaults.
22
+ */
23
+ prepareRequest?: (opts: RequestOptions) => RequestOptions | Promise<RequestOptions>;
8
24
  };
9
25
 
10
26
  declare function createPagesPlugin(opts?: PagePluginOptions): {
@@ -13,10 +29,21 @@ declare function createPagesPlugin(opts?: PagePluginOptions): {
13
29
  render: () => react_jsx_runtime.JSX.Element;
14
30
  icon: react_jsx_runtime.JSX.Element;
15
31
  overrides: {
16
- headerActions: () => react_jsx_runtime.JSX.Element;
32
+ headerActions: ({ children }: {
33
+ children: react.ReactNode;
34
+ }) => react_jsx_runtime.JSX.Element;
17
35
  preview: ({ children }: {
18
36
  children: react.ReactNode;
19
37
  }) => react_jsx_runtime.JSX.Element;
38
+ fields: ({ children }: {
39
+ children: react.ReactNode;
40
+ isLoading: boolean;
41
+ itemSelector?: _puckeditor_core_dist_actions_Dgllwd_W.W | null;
42
+ fields: Partial<Record<string, react.ReactNode>>;
43
+ }) => react_jsx_runtime.JSX.Element;
44
+ outline: ({ children }: {
45
+ children: react.ReactNode;
46
+ }) => react_jsx_runtime.JSX.Element;
20
47
  };
21
48
  };
22
49