@webiny/website-builder-sdk 6.1.0 → 6.2.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/HashObject.js +14 -0
- package/HashObject.js.map +1 -1
- package/NullSdk.d.ts +3 -2
- package/NullSdk.js.map +1 -1
- package/constants.d.ts +1 -0
- package/constants.js +2 -1
- package/constants.js.map +1 -1
- package/dataProviders/GET_PAGE_BY_ID.d.ts +1 -1
- package/dataProviders/GET_PAGE_BY_ID.js +1 -0
- package/dataProviders/GET_PAGE_BY_ID.js.map +1 -1
- package/dataProviders/GET_PAGE_BY_PATH.d.ts +1 -1
- package/dataProviders/GET_PAGE_BY_PATH.js +1 -0
- package/dataProviders/GET_PAGE_BY_PATH.js.map +1 -1
- package/dataProviders/NullDataProvider.d.ts +4 -3
- package/dataProviders/NullDataProvider.js.map +1 -1
- package/package.json +5 -5
- package/types.d.ts +5 -1
- package/types.js.map +1 -1
package/HashObject.js
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import stringify from "fast-json-stable-stringify";
|
|
2
|
+
/*
|
|
3
|
+
// TODO @pavel consider using this library instead of fast-json-stable-stringify as it is a bit newer
|
|
4
|
+
import { configure } from 'safe-stable-stringify'
|
|
5
|
+
|
|
6
|
+
const stringify = configure({
|
|
7
|
+
bigint: true,
|
|
8
|
+
circularValue: '[Circular]',
|
|
9
|
+
deterministic: true,
|
|
10
|
+
maximumDepth: Infinity,
|
|
11
|
+
maximumBreadth: Infinity,
|
|
12
|
+
strict: false,
|
|
13
|
+
});
|
|
14
|
+
*/
|
|
15
|
+
|
|
2
16
|
class HashObject {
|
|
3
17
|
hash(object) {
|
|
4
18
|
return this.fastHash(object);
|
package/HashObject.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["stringify","HashObject","hash","object","fastHash","obj","str","i","length","charCodeAt","hashObject"],"sources":["HashObject.ts"],"sourcesContent":["import stringify from \"fast-json-stable-stringify\";\n\nclass HashObject {\n hash(object: object) {\n return this.fastHash(object);\n }\n\n private fastHash(obj: object): number {\n const str = stringify(obj); // stable key order\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n hash = ((hash << 5) - hash + str.charCodeAt(i)) | 0;\n }\n return hash >>> 0; // unsigned\n }\n}\n\nexport const hashObject = new HashObject();\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,4BAA4B;
|
|
1
|
+
{"version":3,"names":["stringify","HashObject","hash","object","fastHash","obj","str","i","length","charCodeAt","hashObject"],"sources":["HashObject.ts"],"sourcesContent":["import stringify from \"fast-json-stable-stringify\";\n/*\n// TODO @pavel consider using this library instead of fast-json-stable-stringify as it is a bit newer\nimport { configure } from 'safe-stable-stringify'\n\nconst stringify = configure({\n bigint: true,\n circularValue: '[Circular]',\n deterministic: true,\n maximumDepth: Infinity,\n maximumBreadth: Infinity,\n strict: false,\n});\n*/\n\nclass HashObject {\n hash(object: object) {\n return this.fastHash(object);\n }\n\n private fastHash(obj: object): number {\n const str = stringify(obj); // stable key order\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n hash = ((hash << 5) - hash + str.charCodeAt(i)) | 0;\n }\n return hash >>> 0; // unsigned\n }\n}\n\nexport const hashObject = new HashObject();\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,4BAA4B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMC,UAAU,CAAC;EACbC,IAAIA,CAACC,MAAc,EAAE;IACjB,OAAO,IAAI,CAACC,QAAQ,CAACD,MAAM,CAAC;EAChC;EAEQC,QAAQA,CAACC,GAAW,EAAU;IAClC,MAAMC,GAAG,GAAGN,SAAS,CAACK,GAAG,CAAC,CAAC,CAAC;IAC5B,IAAIH,IAAI,GAAG,CAAC;IACZ,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,GAAG,CAACE,MAAM,EAAED,CAAC,EAAE,EAAE;MACjCL,IAAI,GAAI,CAACA,IAAI,IAAI,CAAC,IAAIA,IAAI,GAAGI,GAAG,CAACG,UAAU,CAACF,CAAC,CAAC,GAAI,CAAC;IACvD;IACA,OAAOL,IAAI,KAAK,CAAC,CAAC,CAAC;EACvB;AACJ;AAEA,OAAO,MAAMQ,UAAU,GAAG,IAAIT,UAAU,CAAC,CAAC","ignoreList":[]}
|
package/NullSdk.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { IContentSdk, ListPagesResult,
|
|
1
|
+
import type { IContentSdk, ListPagesResult, PublicRedirect, ResolvedComponent } from "./types.js";
|
|
2
|
+
import type { PublicPage } from "./types.js";
|
|
2
3
|
export declare class NullSdk implements IContentSdk {
|
|
3
|
-
getPage(): Promise<
|
|
4
|
+
getPage(): Promise<PublicPage | null>;
|
|
4
5
|
listPages(): Promise<ListPagesResult>;
|
|
5
6
|
listRedirects(): Promise<PublicRedirect[]>;
|
|
6
7
|
registerComponent(): void;
|
package/NullSdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NullSdk","getPage","listPages","Promise","resolve","data","meta","hasMoreItems","totalCount","cursor","listRedirects","registerComponent","resolveElement"],"sources":["NullSdk.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"names":["NullSdk","getPage","listPages","Promise","resolve","data","meta","hasMoreItems","totalCount","cursor","listRedirects","registerComponent","resolveElement"],"sources":["NullSdk.ts"],"sourcesContent":["import type { IContentSdk, ListPagesResult, PublicRedirect, ResolvedComponent } from \"./types.js\";\nimport type { PublicPage } from \"./types.js\";\n\nexport class NullSdk implements IContentSdk {\n async getPage(): Promise<PublicPage | null> {\n return null;\n }\n\n listPages(): Promise<ListPagesResult> {\n return Promise.resolve({\n data: [],\n meta: { hasMoreItems: false, totalCount: 0, cursor: null }\n });\n }\n\n listRedirects(): Promise<PublicRedirect[]> {\n return Promise.resolve([]);\n }\n\n registerComponent(): void {}\n\n resolveElement(): ResolvedComponent[] | null {\n return null;\n }\n}\n"],"mappings":"AAGA,OAAO,MAAMA,OAAO,CAAwB;EACxC,MAAMC,OAAOA,CAAA,EAA+B;IACxC,OAAO,IAAI;EACf;EAEAC,SAASA,CAAA,EAA6B;IAClC,OAAOC,OAAO,CAACC,OAAO,CAAC;MACnBC,IAAI,EAAE,EAAE;MACRC,IAAI,EAAE;QAAEC,YAAY,EAAE,KAAK;QAAEC,UAAU,EAAE,CAAC;QAAEC,MAAM,EAAE;MAAK;IAC7D,CAAC,CAAC;EACN;EAEAC,aAAaA,CAAA,EAA8B;IACvC,OAAOP,OAAO,CAACC,OAAO,CAAC,EAAE,CAAC;EAC9B;EAEAO,iBAAiBA,CAAA,EAAS,CAAC;EAE3BC,cAAcA,CAAA,EAA+B;IACzC,OAAO,IAAI;EACf;AACJ","ignoreList":[]}
|
package/constants.d.ts
CHANGED
package/constants.js
CHANGED
package/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StyleSettings","Layout","Visibility","Background","MarginPadding"],"sources":["constants.ts"],"sourcesContent":["export const StyleSettings = {\n Layout: \"layout\",\n Visibility: \"visibility\",\n Background: \"background\",\n MarginPadding: \"marginPadding\"\n};\n"],"mappings":"AAAA,OAAO,MAAMA,aAAa,GAAG;EACzBC,MAAM,EAAE,QAAQ;EAChBC,UAAU,EAAE,YAAY;EACxBC,UAAU,EAAE,YAAY;EACxBC,aAAa,EAAE;
|
|
1
|
+
{"version":3,"names":["StyleSettings","Layout","Visibility","Background","MarginPadding","Border"],"sources":["constants.ts"],"sourcesContent":["export const StyleSettings = {\n Layout: \"layout\",\n Visibility: \"visibility\",\n Background: \"background\",\n MarginPadding: \"marginPadding\",\n Border: \"border\"\n};\n"],"mappings":"AAAA,OAAO,MAAMA,aAAa,GAAG;EACzBC,MAAM,EAAE,QAAQ;EAChBC,UAAU,EAAE,YAAY;EACxBC,UAAU,EAAE,YAAY;EACxBC,aAAa,EAAE,eAAe;EAC9BC,MAAM,EAAE;AACZ,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const GET_PAGE_BY_ID = "\n query GetPageById($id: ID!) {\n websiteBuilder {\n getPageById(id: $id) {\n data {\n id\n properties\n elements\n bindings\n extensions\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n";
|
|
1
|
+
export declare const GET_PAGE_BY_ID = "\n query GetPageById($id: ID!) {\n websiteBuilder {\n getPageById(id: $id) {\n data {\n id\n properties\n elements\n bindings\n extensions\n languagePaths\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["GET_PAGE_BY_ID"],"sources":["GET_PAGE_BY_ID.ts"],"sourcesContent":["export const GET_PAGE_BY_ID = /* GraphQL*/ `\n query GetPageById($id: ID!) {\n websiteBuilder {\n getPageById(id: $id) {\n data {\n id\n properties\n elements\n bindings\n extensions\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n"],"mappings":"AAAA,OAAO,MAAMA,cAAc,GAAG,YAAa;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["GET_PAGE_BY_ID"],"sources":["GET_PAGE_BY_ID.ts"],"sourcesContent":["export const GET_PAGE_BY_ID = /* GraphQL*/ `\n query GetPageById($id: ID!) {\n websiteBuilder {\n getPageById(id: $id) {\n data {\n id\n properties\n elements\n bindings\n extensions\n languagePaths\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n"],"mappings":"AAAA,OAAO,MAAMA,cAAc,GAAG,YAAa;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const GET_PAGE_BY_PATH = "\n query GetPageByPath($path: String!) {\n websiteBuilder {\n getPageByPath(path: $path) {\n data {\n id\n properties\n elements\n bindings\n extensions\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n";
|
|
1
|
+
export declare const GET_PAGE_BY_PATH = "\n query GetPageByPath($path: String!) {\n websiteBuilder {\n getPageByPath(path: $path) {\n data {\n id\n properties\n elements\n bindings\n extensions\n languagePaths\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["GET_PAGE_BY_PATH"],"sources":["GET_PAGE_BY_PATH.ts"],"sourcesContent":["export const GET_PAGE_BY_PATH = /* GraphQL*/ `\n query GetPageByPath($path: String!) {\n websiteBuilder {\n getPageByPath(path: $path) {\n data {\n id\n properties\n elements\n bindings\n extensions\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n"],"mappings":"AAAA,OAAO,MAAMA,gBAAgB,GAAG,YAAa;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["GET_PAGE_BY_PATH"],"sources":["GET_PAGE_BY_PATH.ts"],"sourcesContent":["export const GET_PAGE_BY_PATH = /* GraphQL*/ `\n query GetPageByPath($path: String!) {\n websiteBuilder {\n getPageByPath(path: $path) {\n data {\n id\n properties\n elements\n bindings\n extensions\n languagePaths\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n"],"mappings":"AAAA,OAAO,MAAMA,gBAAgB,GAAG,YAAa;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { IDataProvider,
|
|
1
|
+
import type { IDataProvider, PublicRedirect } from "../types.js";
|
|
2
|
+
import type { PublicPage } from "../types.js";
|
|
2
3
|
export declare class NullDataProvider implements IDataProvider {
|
|
3
|
-
getPageById(): Promise<
|
|
4
|
-
getPageByPath(): Promise<
|
|
4
|
+
getPageById(): Promise<PublicPage | null>;
|
|
5
|
+
getPageByPath(): Promise<PublicPage | null>;
|
|
5
6
|
listPages(): Promise<{
|
|
6
7
|
data: never[];
|
|
7
8
|
meta: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NullDataProvider","getPageById","Promise","resolve","getPageByPath","listPages","data","meta","hasMoreItems","totalCount","cursor","listRedirects"],"sources":["NullDataProvider.ts"],"sourcesContent":["import type { IDataProvider,
|
|
1
|
+
{"version":3,"names":["NullDataProvider","getPageById","Promise","resolve","getPageByPath","listPages","data","meta","hasMoreItems","totalCount","cursor","listRedirects"],"sources":["NullDataProvider.ts"],"sourcesContent":["import type { IDataProvider, PublicRedirect } from \"~/types.js\";\nimport type { PublicPage } from \"~/types.js\";\n\nexport class NullDataProvider implements IDataProvider {\n getPageById(): Promise<PublicPage | null> {\n return Promise.resolve(null);\n }\n\n getPageByPath(): Promise<PublicPage | null> {\n return Promise.resolve(null);\n }\n\n public async listPages() {\n return { data: [], meta: { hasMoreItems: false, totalCount: 0, cursor: null } };\n }\n\n listRedirects(): Promise<PublicRedirect[]> {\n return Promise.resolve([]);\n }\n}\n"],"mappings":"AAGA,OAAO,MAAMA,gBAAgB,CAA0B;EACnDC,WAAWA,CAAA,EAA+B;IACtC,OAAOC,OAAO,CAACC,OAAO,CAAC,IAAI,CAAC;EAChC;EAEAC,aAAaA,CAAA,EAA+B;IACxC,OAAOF,OAAO,CAACC,OAAO,CAAC,IAAI,CAAC;EAChC;EAEA,MAAaE,SAASA,CAAA,EAAG;IACrB,OAAO;MAAEC,IAAI,EAAE,EAAE;MAAEC,IAAI,EAAE;QAAEC,YAAY,EAAE,KAAK;QAAEC,UAAU,EAAE,CAAC;QAAEC,MAAM,EAAE;MAAK;IAAE,CAAC;EACnF;EAEAC,aAAaA,CAAA,EAA8B;IACvC,OAAOT,OAAO,CAACC,OAAO,CAAC,EAAE,CAAC;EAC9B;AACJ","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/website-builder-sdk",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"fast-json-patch": "3.1.1",
|
|
20
20
|
"fast-json-stable-stringify": "2.1.0",
|
|
21
21
|
"is-hotkey": "0.2.0",
|
|
22
|
-
"lodash": "4.
|
|
22
|
+
"lodash": "4.18.1",
|
|
23
23
|
"matcher": "6.0.0",
|
|
24
24
|
"mobx": "6.15.0",
|
|
25
25
|
"nanoid": "5.1.7",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/deep-equal": "1.0.4",
|
|
32
32
|
"@types/is-hotkey": "0.1.10",
|
|
33
|
-
"@webiny/build-tools": "6.
|
|
33
|
+
"@webiny/build-tools": "6.2.0",
|
|
34
34
|
"typescript": "5.9.3",
|
|
35
|
-
"vitest": "4.1.
|
|
35
|
+
"vitest": "4.1.4"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
]
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "3d3148358b6febbc857371930871743bec3b3939"
|
|
49
49
|
}
|
package/types.d.ts
CHANGED
|
@@ -238,7 +238,9 @@ export type Document = {
|
|
|
238
238
|
bindings: DocumentBindings;
|
|
239
239
|
elements: ElementMap;
|
|
240
240
|
};
|
|
241
|
-
export type PublicPage = Pick<Page, "id" | "version" | "properties" | "bindings" | "elements" | "extensions" | "metadata" | "state"
|
|
241
|
+
export type PublicPage = Pick<Page, "id" | "version" | "properties" | "bindings" | "elements" | "extensions" | "metadata" | "state"> & {
|
|
242
|
+
languagePaths: Record<string, string>;
|
|
243
|
+
};
|
|
242
244
|
export type PublicRedirect = {
|
|
243
245
|
id: string;
|
|
244
246
|
from: string;
|
|
@@ -258,6 +260,8 @@ export type Page = Document & {
|
|
|
258
260
|
title: string;
|
|
259
261
|
snippet: string;
|
|
260
262
|
path: string;
|
|
263
|
+
language?: string;
|
|
264
|
+
sourcePage?: string;
|
|
261
265
|
tags: string[];
|
|
262
266
|
seo: {
|
|
263
267
|
title: string;
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type * as CSS from \"csstype\";\nimport type { BindingsApi } from \"~/BindingsApi.js\";\nimport type { ShorthandCssProperties } from \"./types/ShorthandCssProperties.js\";\nimport type { InputFactory } from \"~/createInput.js\";\nimport type { Breakpoint } from \"~/types/WebsiteBuilderTheme.js\";\nexport type { WebsiteBuilderTheme, Breakpoint } from \"./types/WebsiteBuilderTheme.js\";\n\ntype CSSProperties = CSS.Properties<string | number>;\n\nexport type ElementMap = Record<string, DocumentElement>;\n\nexport type DocumentState = Record<string, any>;\n\nexport type DocumentMetadata = Record<string, any>;\n\nexport type InputValueBinding<T = any> = ValueBinding<T> & {\n id: string;\n type: string;\n translatable?: boolean;\n list?: boolean;\n};\n\nexport type StyleValueBinding<T = any> = ValueBinding<T>;\n\nexport type ValueBinding<T = any> = {\n static?: T;\n expression?: string;\n};\n\nexport type RepeatValueBinding = {\n expression: string;\n};\n\nexport type CssProperties = Omit<CSSProperties, ShorthandCssProperties>;\n\nexport type DocumentElementStyleBindings = Partial<{\n [K in keyof CssProperties]: StyleValueBinding<CssProperties[K]>;\n}>;\n\nexport type DocumentElementInputBindings = {\n [inputName: string]: InputValueBinding;\n};\n\nexport type DocumentElementBindings = {\n $repeat?: RepeatValueBinding;\n inputs?: DocumentElementInputBindings;\n styles?: DocumentElementStyleBindings;\n metadata?: Record<string, any>;\n overrides?: {\n [key: string]: {\n inputs?: DocumentElementInputBindings;\n styles?: DocumentElementStyleBindings;\n };\n };\n};\n\nexport type DocumentBindings = {\n [elementId: string]: DocumentElementBindings;\n};\n\nexport type ResolvedComponent<TComponent = any> = {\n component: TComponent;\n inputs: Record<string, any>;\n manifest: ComponentManifest;\n styles: SerializableCSSStyleDeclaration;\n};\n\nexport type ResolvedElement = {\n id: string;\n inputs: Record<string, any>;\n styles: SerializableCSSStyleDeclaration;\n};\n\nexport type Component = {\n component: any;\n manifest: ComponentManifest;\n};\n\nexport type ComponentBlueprint<TComponent = any, TManifest = any> = {\n component: TComponent;\n manifest: TManifest;\n};\n\nexport type ComponentGroupItem = {\n // Name of the component.\n name: string;\n // Optionally, define an exact element to insert.\n item?: DocumentElementTemplate;\n};\n\nexport type SerializedComponentGroup = ComponentGroup & {\n filter?: string;\n};\n\nexport type ComponentGroupFilterContext = {\n document: EditorDocument;\n};\n\nexport type ComponentGroup = {\n name: string;\n label: string;\n description?: string;\n filter?: (component: ComponentManifest, context: ComponentGroupFilterContext) => boolean;\n};\n\nexport type ResponsiveStyles = {\n [key: string]: SerializableCSSStyleDeclaration;\n};\n\nexport type ConstraintElementContext = {\n /** Component name (e.g., \"FunnelBuilder/Step\") */\n name: string;\n /** Component tags */\n tags: string[];\n\n /** Get the parent element context. undefined for root. */\n getParent(): ConstraintElementContext | undefined;\n\n /** Index of this element among siblings in the same parent slot. -1 if not in a list slot. */\n childIndex(): number;\n /** Total siblings in the same parent slot. -1 if not in a list slot. */\n childCount(): number;\n /** True if this element is the last among siblings in its parent slot. */\n isLastChild(): boolean;\n /** True if this element is the first among siblings in its parent slot. */\n isFirstChild(): boolean;\n};\n\nexport type ConstraintContext = {\n /** The component/element this constraint is about */\n component: ConstraintElementContext;\n /** The direct parent element at the drop target */\n parent: ConstraintElementContext;\n /** The target slot name (e.g., \"children\", \"leftColumn\", \"rightColumn\") */\n slot: string;\n /** True if the direct parent is the given component */\n isChildOf: (componentName: string) => boolean;\n /** True if any ancestor (including parent) is the given component */\n isDescendantOf: (componentName: string) => boolean;\n /** Find the nearest ancestor matching a component name */\n getAncestor: (componentName: string) => ConstraintElementContext | undefined;\n /** True if the component being placed has the given tag */\n hasTag: (tag: string) => boolean;\n /** Number of items currently in the target slot */\n slotChildCount: () => number;\n /** Count instances of a component type in the entire document */\n countInstances: (componentName: string) => number;\n /** True if the component has any descendant element carrying the given tag */\n hasDescendantWithTag: (tag: string) => boolean;\n /** Returns the resolved inputs of the nearest ancestor matching componentName, or undefined */\n getAncestorInputs: (componentName: string) => Record<string, any> | undefined;\n /** Returns the resolved inputs of the element this constraint is evaluating */\n getElementInputs: () => Record<string, any>;\n /** Debug logger — safe to call inside serialized constraints */\n log: (...args: any[]) => void;\n /** Block placement with an error message shown to the user */\n block: (message: string) => never;\n};\n\n/**\n * A constraint function. Call `ctx.block(\"message\")` to block placement.\n * Returning without blocking means the constraint passes.\n */\nexport type ComponentConstraint = (ctx: ConstraintContext) => void;\n\n// Flow-control symbols\nexport type Stop = symbol;\nexport type Continue = symbol;\nexport type HandlerResult = void | Stop | Continue;\n\nexport type OnChangeAction = \"create\" | \"update\" | \"delete\";\n\nexport type OnChangeElementContext = {\n id: string;\n component: ComponentManifest;\n inputs: Record<string, any>;\n};\n\nexport type ManifestAncestorContext = {\n id: string;\n component: ComponentManifest;\n inputs: Record<string, any>;\n updateInputs: (cb: (inputs: Record<string, any>) => void) => void;\n getElement: (id: string) => OnChangeElementContext | undefined;\n};\n\nexport type ComponentChangeContext<TInputs = Record<string, any>> = {\n action: OnChangeAction;\n id: string;\n component: ComponentManifest;\n inputs: TInputs;\n styles: Record<string, any>;\n getAncestor: (componentName: string) => ManifestAncestorContext | undefined;\n getElement: (id: string) => OnChangeElementContext | undefined;\n createElement: (params: any) => any;\n executeCommand: <T = unknown>(command: string, payload?: T) => void;\n breakpoint: string;\n log: (...args: any[]) => void;\n stop: () => Stop;\n continue: () => Continue;\n};\n\nexport type DescendantChangeContext<\n TInputs = Record<string, any>,\n TDescendantInputs = Record<string, any>\n> = {\n action: OnChangeAction;\n descendant: {\n component: ComponentManifest;\n id: string;\n inputs: TDescendantInputs;\n updateInputs: (cb: (inputs: TDescendantInputs) => void) => void;\n };\n inputs: TInputs;\n updateInputs: (cb: (inputs: TInputs) => void) => void;\n getElement: (id: string) => OnChangeElementContext | undefined;\n executeCommand: <T = unknown>(command: string, payload?: T) => void;\n breakpoint: string;\n log: (...args: any[]) => void;\n stop: () => Stop;\n continue: () => Continue;\n};\n\nexport type ComponentChangeHandler<TInputs = Record<string, any>> = (\n ctx: ComponentChangeContext<TInputs>\n) => HandlerResult;\n\nexport type DescendantChangeHandler<\n TInputs = Record<string, any>,\n TDescendantInputs = Record<string, any>\n> = (ctx: DescendantChangeContext<TInputs, TDescendantInputs>) => HandlerResult;\n\nexport type ComponentManifest = {\n name: string;\n group?: string;\n label?: string;\n image?: string;\n inputs: ComponentInput[];\n canDrag?: boolean;\n canDelete?: boolean | ComponentConstraint;\n acceptsChildren?: boolean;\n hideFromToolbar?: boolean;\n hideStyleSettings?: string[];\n autoApplyStyles?: boolean;\n tags: string[];\n constraints?: ComponentConstraint[];\n descendantConstraints?: ComponentConstraint[];\n onChange?: ComponentChangeHandler | ComponentChangeHandler[];\n onDescendantChange?: DescendantChangeHandler | DescendantChangeHandler[];\n defaults?: {\n inputs?: Record<string, any>;\n styles?: SerializableCSSStyleDeclaration;\n overrides?: {\n [breakpoint: string]: {\n inputs?: Record<string, any>;\n styles?: SerializableCSSStyleDeclaration;\n };\n };\n };\n};\n\nexport type DocumentElementTemplate = Omit<DocumentElement, \"id\">;\n\nexport type ElementComponent = {\n name: string;\n};\n\nexport type DocumentElement = {\n type: \"Webiny/Element\";\n id: string;\n component: ElementComponent;\n parent?: {\n id: string;\n slot: string;\n };\n styles?: ResponsiveStyles;\n};\n\nexport type SerializableCSSStyleDeclaration = {\n [K in keyof CssProperties]?: CssProperties[K];\n};\n\nexport type Document = {\n id: string;\n state: DocumentState;\n version: number;\n properties: Record<string, any>;\n extensions: Record<string, any>;\n metadata: DocumentMetadata;\n bindings: DocumentBindings;\n elements: ElementMap;\n};\n\nexport type PublicPage = Pick<\n Page,\n \"id\" | \"version\" | \"properties\" | \"bindings\" | \"elements\" | \"extensions\" | \"metadata\" | \"state\"\n>;\n\nexport type PublicRedirect = {\n id: string;\n from: string;\n to: string;\n permanent: boolean;\n};\n\nexport type EditorPage = EditorDocument & Pick<Page, \"properties\" | \"status\" | \"location\">;\n\nexport type EditorDocument = Document;\n\nexport type Page = Document & {\n id: string;\n status: string;\n version: number;\n location: {\n folderId: string;\n };\n properties: {\n title: string;\n snippet: string;\n /*image: {\n id: string;\n name: string;\n size: number;\n mimeType: string;\n src: string;\n };*/\n path: string;\n tags: string[];\n seo: {\n title: string;\n description: string;\n metaTags: Array<{ name: string; content: string }>;\n };\n social: {\n title: string;\n description: string;\n /*image: {\n id: string;\n name: string;\n size: number;\n mimeType: string;\n src: string;\n };*/\n metaTags: Array<{ property: string; content: string }>;\n };\n };\n extensions: Record<string, any>;\n metadata: DocumentMetadata;\n};\n\nexport type Box = {\n depth: number;\n parentId: string;\n parentSlot: string;\n parentIndex: number;\n width: number;\n height: number;\n top: number;\n left: number;\n};\n\nexport type ElementBoxData = Box & {\n type: \"element\";\n};\n\nexport type ElementSlotBoxData = Box & {\n type: \"element-slot\";\n};\n\nexport type BoxData = ElementBoxData | ElementSlotBoxData;\n\nexport type EditorViewportInfo = PreviewViewportInfo & {\n top: number;\n left: number;\n // Current breakpoint name\n breakpoint: string;\n breakpoints: Breakpoint[];\n};\n\nexport type PreviewViewportInfo = {\n // Viewport width (only the visible part)\n width: number;\n // Viewport height (only the visible part)\n height: number;\n // Full iframe width\n scrollWidth: number;\n // Full iframe height\n scrollHeight: number;\n // Iframe horizontal scroll offset\n scrollX: number;\n // Iframe vertical scroll offest\n scrollY: number;\n};\n\nexport type BoxesData = Record<string, BoxData>;\n\nexport type EditorViewportData = {\n boxes: BoxesData;\n viewport: EditorViewportInfo;\n};\n\nexport type PreviewViewportData = {\n boxes: BoxesData;\n viewport: PreviewViewportInfo;\n};\n\nexport type ApiOptions = Record<string, any>;\n\nexport type GetPageOptions = ApiOptions;\n\nexport interface ListPagesOptions {\n where?: Record<string, any>;\n limit?: number;\n after?: string;\n sort?: string[];\n search?: string;\n}\n\nexport interface ListPagesMeta {\n hasMoreItems: boolean;\n totalCount: number;\n cursor: string | null;\n}\n\nexport interface ListPagesResult {\n data: Array<Omit<PublicPage, \"elements\" | \"bindings\">>;\n meta: ListPagesMeta;\n}\n\nexport interface IDataProvider {\n getPageByPath(path: string, options?: GetPageOptions): Promise<PublicPage | null>;\n getPageById(id: string, options?: GetPageOptions): Promise<PublicPage | null>;\n listPages(options?: ListPagesOptions): Promise<ListPagesResult>;\n}\n\nexport interface IEnvironment {\n isClient(): boolean;\n isServer(): boolean;\n isPreview(): boolean;\n}\n\nexport interface IContentSdk {\n getPage(path: string): Promise<PublicPage | null>;\n listPages(options?: ListPagesOptions): Promise<ListPagesResult>;\n}\n\n// Input types\n\n// inputTypes.ts\nexport type BaseInput<T = any> = {\n name: string;\n type: string;\n onChange?: (\n bindings: ReturnType<BindingsApi[\"getPublicApi\"]>,\n context: { breakpoint: string }\n ) => void;\n label?: string;\n description?: string;\n helperText?: string;\n defaultValue?: T;\n responsive?: boolean;\n required?: boolean;\n hideFromUi?: boolean;\n renderer?: string;\n list?: boolean;\n translatable?: boolean;\n};\n\n// Discriminated union per input type\nexport type TextInput = BaseInput<string> & {\n type: \"text\";\n};\n\nexport type SlotInput = BaseInput<any> & {\n type: \"slot\";\n components?: string[];\n};\n\nexport type TagsInput = BaseInput<string[]> & {\n type: \"text\";\n};\n\nexport type LongTextInput = BaseInput<string> & {\n type: \"longText\";\n};\n\nexport type NumberInput = BaseInput<number> & {\n type: \"number\";\n minValue?: number;\n};\n\nexport type BooleanInput = BaseInput<boolean> & {\n type: \"boolean\";\n};\n\nexport type ColorInput = BaseInput<string> & {\n type: \"color\";\n};\n\nexport type FileInput = BaseInput<string> & {\n type: \"file\";\n allowedFileTypes: string[];\n};\n\nexport type DateTimeInput = BaseInput<string> & {\n type: \"datetime\";\n};\n\nexport type LexicalInput = BaseInput<string> & {\n type: \"lexical\";\n};\n\nexport type SelectInput = BaseInput<string> & {\n type: \"select\";\n options: { label: string; value: string }[];\n showResetAction?: boolean;\n};\n\nexport type RadioInput = BaseInput<string> & {\n type: \"radio\";\n options: { label: string; value: string }[];\n};\n\nexport type ObjectInput = BaseInput<Record<string, any>> & {\n type: \"object\";\n fields: ComponentInput[];\n};\n\nexport type CustomInput = BaseInput<any> & {\n type: string;\n fields: ComponentInput[];\n};\n\n// Union of all input types\nexport type ComponentInput =\n | TextInput\n | LongTextInput\n | NumberInput\n | BooleanInput\n | ColorInput\n | FileInput\n | DateTimeInput\n | LexicalInput\n | SelectInput\n | RadioInput\n | TagsInput\n | ObjectInput\n | SlotInput\n | CustomInput;\n\nexport type ManifestInputsArray<\n TInputs,\n TAllowChildren extends boolean\n> = TAllowChildren extends true\n ? {\n [K in Exclude<keyof TInputs, \"children\">]: InputFactory<K & string>;\n }[Exclude<keyof TInputs, \"children\">][]\n : {\n [K in keyof TInputs]: InputFactory<K & string>;\n }[keyof TInputs][];\n\nexport type ManifestInputsObject<\n TInputs,\n TAllowChildren extends boolean\n> = TAllowChildren extends true\n ? { [K in Exclude<keyof TInputs, \"children\">]: InputFactory<K & string> }\n : { [K in keyof TInputs]: InputFactory<K & string> };\n\nexport type ComponentManifestInput<TInputs> =\n | (Omit<\n ComponentManifest,\n \"inputs\" | \"acceptsChildren\" | \"tags\" | \"onChange\" | \"onDescendantChange\"\n > & {\n acceptsChildren: true;\n tags?: string[];\n inputs?: ManifestInputsArray<TInputs, true> | ManifestInputsObject<TInputs, true>;\n onChange?: ComponentChangeHandler<TInputs> | ComponentChangeHandler<TInputs>[];\n onDescendantChange?:\n | DescendantChangeHandler<TInputs>\n | DescendantChangeHandler<TInputs>[];\n })\n | (Omit<\n ComponentManifest,\n \"inputs\" | \"acceptsChildren\" | \"tags\" | \"onChange\" | \"onDescendantChange\"\n > & {\n acceptsChildren?: false;\n tags?: string[];\n inputs: ManifestInputsArray<TInputs, false> | ManifestInputsObject<TInputs, false>;\n onChange?: ComponentChangeHandler<TInputs> | ComponentChangeHandler<TInputs>[];\n onDescendantChange?:\n | DescendantChangeHandler<TInputs>\n | DescendantChangeHandler<TInputs>[];\n });\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type * as CSS from \"csstype\";\nimport type { BindingsApi } from \"~/BindingsApi.js\";\nimport type { ShorthandCssProperties } from \"./types/ShorthandCssProperties.js\";\nimport type { InputFactory } from \"~/createInput.js\";\nimport type { Breakpoint } from \"~/types/WebsiteBuilderTheme.js\";\nexport type { WebsiteBuilderTheme, Breakpoint } from \"./types/WebsiteBuilderTheme.js\";\n\ntype CSSProperties = CSS.Properties<string | number>;\n\nexport type ElementMap = Record<string, DocumentElement>;\n\nexport type DocumentState = Record<string, any>;\n\nexport type DocumentMetadata = Record<string, any>;\n\nexport type InputValueBinding<T = any> = ValueBinding<T> & {\n id: string;\n type: string;\n translatable?: boolean;\n list?: boolean;\n};\n\nexport type StyleValueBinding<T = any> = ValueBinding<T>;\n\nexport type ValueBinding<T = any> = {\n static?: T;\n expression?: string;\n};\n\nexport type RepeatValueBinding = {\n expression: string;\n};\n\nexport type CssProperties = Omit<CSSProperties, ShorthandCssProperties>;\n\nexport type DocumentElementStyleBindings = Partial<{\n [K in keyof CssProperties]: StyleValueBinding<CssProperties[K]>;\n}>;\n\nexport type DocumentElementInputBindings = {\n [inputName: string]: InputValueBinding;\n};\n\nexport type DocumentElementBindings = {\n $repeat?: RepeatValueBinding;\n inputs?: DocumentElementInputBindings;\n styles?: DocumentElementStyleBindings;\n metadata?: Record<string, any>;\n overrides?: {\n [key: string]: {\n inputs?: DocumentElementInputBindings;\n styles?: DocumentElementStyleBindings;\n };\n };\n};\n\nexport type DocumentBindings = {\n [elementId: string]: DocumentElementBindings;\n};\n\nexport type ResolvedComponent<TComponent = any> = {\n component: TComponent;\n inputs: Record<string, any>;\n manifest: ComponentManifest;\n styles: SerializableCSSStyleDeclaration;\n};\n\nexport type ResolvedElement = {\n id: string;\n inputs: Record<string, any>;\n styles: SerializableCSSStyleDeclaration;\n};\n\nexport type Component = {\n component: any;\n manifest: ComponentManifest;\n};\n\nexport type ComponentBlueprint<TComponent = any, TManifest = any> = {\n component: TComponent;\n manifest: TManifest;\n};\n\nexport type ComponentGroupItem = {\n // Name of the component.\n name: string;\n // Optionally, define an exact element to insert.\n item?: DocumentElementTemplate;\n};\n\nexport type SerializedComponentGroup = ComponentGroup & {\n filter?: string;\n};\n\nexport type ComponentGroupFilterContext = {\n document: EditorDocument;\n};\n\nexport type ComponentGroup = {\n name: string;\n label: string;\n description?: string;\n filter?: (component: ComponentManifest, context: ComponentGroupFilterContext) => boolean;\n};\n\nexport type ResponsiveStyles = {\n [key: string]: SerializableCSSStyleDeclaration;\n};\n\nexport type ConstraintElementContext = {\n /** Component name (e.g., \"FunnelBuilder/Step\") */\n name: string;\n /** Component tags */\n tags: string[];\n\n /** Get the parent element context. undefined for root. */\n getParent(): ConstraintElementContext | undefined;\n\n /** Index of this element among siblings in the same parent slot. -1 if not in a list slot. */\n childIndex(): number;\n /** Total siblings in the same parent slot. -1 if not in a list slot. */\n childCount(): number;\n /** True if this element is the last among siblings in its parent slot. */\n isLastChild(): boolean;\n /** True if this element is the first among siblings in its parent slot. */\n isFirstChild(): boolean;\n};\n\nexport type ConstraintContext = {\n /** The component/element this constraint is about */\n component: ConstraintElementContext;\n /** The direct parent element at the drop target */\n parent: ConstraintElementContext;\n /** The target slot name (e.g., \"children\", \"leftColumn\", \"rightColumn\") */\n slot: string;\n /** True if the direct parent is the given component */\n isChildOf: (componentName: string) => boolean;\n /** True if any ancestor (including parent) is the given component */\n isDescendantOf: (componentName: string) => boolean;\n /** Find the nearest ancestor matching a component name */\n getAncestor: (componentName: string) => ConstraintElementContext | undefined;\n /** True if the component being placed has the given tag */\n hasTag: (tag: string) => boolean;\n /** Number of items currently in the target slot */\n slotChildCount: () => number;\n /** Count instances of a component type in the entire document */\n countInstances: (componentName: string) => number;\n /** True if the component has any descendant element carrying the given tag */\n hasDescendantWithTag: (tag: string) => boolean;\n /** Returns the resolved inputs of the nearest ancestor matching componentName, or undefined */\n getAncestorInputs: (componentName: string) => Record<string, any> | undefined;\n /** Returns the resolved inputs of the element this constraint is evaluating */\n getElementInputs: () => Record<string, any>;\n /** Debug logger — safe to call inside serialized constraints */\n log: (...args: any[]) => void;\n /** Block placement with an error message shown to the user */\n block: (message: string) => never;\n};\n\n/**\n * A constraint function. Call `ctx.block(\"message\")` to block placement.\n * Returning without blocking means the constraint passes.\n */\nexport type ComponentConstraint = (ctx: ConstraintContext) => void;\n\n// Flow-control symbols\nexport type Stop = symbol;\nexport type Continue = symbol;\nexport type HandlerResult = void | Stop | Continue;\n\nexport type OnChangeAction = \"create\" | \"update\" | \"delete\";\n\nexport type OnChangeElementContext = {\n id: string;\n component: ComponentManifest;\n inputs: Record<string, any>;\n};\n\nexport type ManifestAncestorContext = {\n id: string;\n component: ComponentManifest;\n inputs: Record<string, any>;\n updateInputs: (cb: (inputs: Record<string, any>) => void) => void;\n getElement: (id: string) => OnChangeElementContext | undefined;\n};\n\nexport type ComponentChangeContext<TInputs = Record<string, any>> = {\n action: OnChangeAction;\n id: string;\n component: ComponentManifest;\n inputs: TInputs;\n styles: Record<string, any>;\n getAncestor: (componentName: string) => ManifestAncestorContext | undefined;\n getElement: (id: string) => OnChangeElementContext | undefined;\n createElement: (params: any) => any;\n executeCommand: <T = unknown>(command: string, payload?: T) => void;\n breakpoint: string;\n log: (...args: any[]) => void;\n stop: () => Stop;\n continue: () => Continue;\n};\n\nexport type DescendantChangeContext<\n TInputs = Record<string, any>,\n TDescendantInputs = Record<string, any>\n> = {\n action: OnChangeAction;\n descendant: {\n component: ComponentManifest;\n id: string;\n inputs: TDescendantInputs;\n updateInputs: (cb: (inputs: TDescendantInputs) => void) => void;\n };\n inputs: TInputs;\n updateInputs: (cb: (inputs: TInputs) => void) => void;\n getElement: (id: string) => OnChangeElementContext | undefined;\n executeCommand: <T = unknown>(command: string, payload?: T) => void;\n breakpoint: string;\n log: (...args: any[]) => void;\n stop: () => Stop;\n continue: () => Continue;\n};\n\nexport type ComponentChangeHandler<TInputs = Record<string, any>> = (\n ctx: ComponentChangeContext<TInputs>\n) => HandlerResult;\n\nexport type DescendantChangeHandler<\n TInputs = Record<string, any>,\n TDescendantInputs = Record<string, any>\n> = (ctx: DescendantChangeContext<TInputs, TDescendantInputs>) => HandlerResult;\n\nexport type ComponentManifest = {\n name: string;\n group?: string;\n label?: string;\n image?: string;\n inputs: ComponentInput[];\n canDrag?: boolean;\n canDelete?: boolean | ComponentConstraint;\n acceptsChildren?: boolean;\n hideFromToolbar?: boolean;\n hideStyleSettings?: string[];\n autoApplyStyles?: boolean;\n tags: string[];\n constraints?: ComponentConstraint[];\n descendantConstraints?: ComponentConstraint[];\n onChange?: ComponentChangeHandler | ComponentChangeHandler[];\n onDescendantChange?: DescendantChangeHandler | DescendantChangeHandler[];\n defaults?: {\n inputs?: Record<string, any>;\n styles?: SerializableCSSStyleDeclaration;\n overrides?: {\n [breakpoint: string]: {\n inputs?: Record<string, any>;\n styles?: SerializableCSSStyleDeclaration;\n };\n };\n };\n};\n\nexport type DocumentElementTemplate = Omit<DocumentElement, \"id\">;\n\nexport type ElementComponent = {\n name: string;\n};\n\nexport type DocumentElement = {\n type: \"Webiny/Element\";\n id: string;\n component: ElementComponent;\n parent?: {\n id: string;\n slot: string;\n };\n styles?: ResponsiveStyles;\n};\n\nexport type SerializableCSSStyleDeclaration = {\n [K in keyof CssProperties]?: CssProperties[K];\n};\n\nexport type Document = {\n id: string;\n state: DocumentState;\n version: number;\n properties: Record<string, any>;\n extensions: Record<string, any>;\n metadata: DocumentMetadata;\n bindings: DocumentBindings;\n elements: ElementMap;\n};\n\nexport type PublicPage = Pick<\n Page,\n \"id\" | \"version\" | \"properties\" | \"bindings\" | \"elements\" | \"extensions\" | \"metadata\" | \"state\"\n> & {\n languagePaths: Record<string, string>;\n};\n\nexport type PublicRedirect = {\n id: string;\n from: string;\n to: string;\n permanent: boolean;\n};\n\nexport type EditorPage = EditorDocument & Pick<Page, \"properties\" | \"status\" | \"location\">;\n\nexport type EditorDocument = Document;\n\nexport type Page = Document & {\n id: string;\n status: string;\n version: number;\n location: {\n folderId: string;\n };\n properties: {\n title: string;\n snippet: string;\n /*image: {\n id: string;\n name: string;\n size: number;\n mimeType: string;\n src: string;\n };*/\n path: string;\n language?: string;\n sourcePage?: string;\n tags: string[];\n seo: {\n title: string;\n description: string;\n metaTags: Array<{ name: string; content: string }>;\n };\n social: {\n title: string;\n description: string;\n /*image: {\n id: string;\n name: string;\n size: number;\n mimeType: string;\n src: string;\n };*/\n metaTags: Array<{ property: string; content: string }>;\n };\n };\n extensions: Record<string, any>;\n metadata: DocumentMetadata;\n};\n\nexport type Box = {\n depth: number;\n parentId: string;\n parentSlot: string;\n parentIndex: number;\n width: number;\n height: number;\n top: number;\n left: number;\n};\n\nexport type ElementBoxData = Box & {\n type: \"element\";\n};\n\nexport type ElementSlotBoxData = Box & {\n type: \"element-slot\";\n};\n\nexport type BoxData = ElementBoxData | ElementSlotBoxData;\n\nexport type EditorViewportInfo = PreviewViewportInfo & {\n top: number;\n left: number;\n // Current breakpoint name\n breakpoint: string;\n breakpoints: Breakpoint[];\n};\n\nexport type PreviewViewportInfo = {\n // Viewport width (only the visible part)\n width: number;\n // Viewport height (only the visible part)\n height: number;\n // Full iframe width\n scrollWidth: number;\n // Full iframe height\n scrollHeight: number;\n // Iframe horizontal scroll offset\n scrollX: number;\n // Iframe vertical scroll offest\n scrollY: number;\n};\n\nexport type BoxesData = Record<string, BoxData>;\n\nexport type EditorViewportData = {\n boxes: BoxesData;\n viewport: EditorViewportInfo;\n};\n\nexport type PreviewViewportData = {\n boxes: BoxesData;\n viewport: PreviewViewportInfo;\n};\n\nexport type ApiOptions = Record<string, any>;\n\nexport type GetPageOptions = ApiOptions;\n\nexport interface ListPagesOptions {\n where?: Record<string, any>;\n limit?: number;\n after?: string;\n sort?: string[];\n search?: string;\n}\n\nexport interface ListPagesMeta {\n hasMoreItems: boolean;\n totalCount: number;\n cursor: string | null;\n}\n\nexport interface ListPagesResult {\n data: Array<Omit<PublicPage, \"elements\" | \"bindings\">>;\n meta: ListPagesMeta;\n}\n\nexport interface IDataProvider {\n getPageByPath(path: string, options?: GetPageOptions): Promise<PublicPage | null>;\n getPageById(id: string, options?: GetPageOptions): Promise<PublicPage | null>;\n listPages(options?: ListPagesOptions): Promise<ListPagesResult>;\n}\n\nexport interface IEnvironment {\n isClient(): boolean;\n isServer(): boolean;\n isPreview(): boolean;\n}\n\nexport interface IContentSdk {\n getPage(path: string): Promise<PublicPage | null>;\n listPages(options?: ListPagesOptions): Promise<ListPagesResult>;\n}\n\n// Input types\n\n// inputTypes.ts\nexport type BaseInput<T = any> = {\n name: string;\n type: string;\n onChange?: (\n bindings: ReturnType<BindingsApi[\"getPublicApi\"]>,\n context: { breakpoint: string }\n ) => void;\n label?: string;\n description?: string;\n helperText?: string;\n defaultValue?: T;\n responsive?: boolean;\n required?: boolean;\n hideFromUi?: boolean;\n renderer?: string;\n list?: boolean;\n translatable?: boolean;\n};\n\n// Discriminated union per input type\nexport type TextInput = BaseInput<string> & {\n type: \"text\";\n};\n\nexport type SlotInput = BaseInput<any> & {\n type: \"slot\";\n components?: string[];\n};\n\nexport type TagsInput = BaseInput<string[]> & {\n type: \"text\";\n};\n\nexport type LongTextInput = BaseInput<string> & {\n type: \"longText\";\n};\n\nexport type NumberInput = BaseInput<number> & {\n type: \"number\";\n minValue?: number;\n};\n\nexport type BooleanInput = BaseInput<boolean> & {\n type: \"boolean\";\n};\n\nexport type ColorInput = BaseInput<string> & {\n type: \"color\";\n};\n\nexport type FileInput = BaseInput<string> & {\n type: \"file\";\n allowedFileTypes: string[];\n};\n\nexport type DateTimeInput = BaseInput<string> & {\n type: \"datetime\";\n};\n\nexport type LexicalInput = BaseInput<string> & {\n type: \"lexical\";\n};\n\nexport type SelectInput = BaseInput<string> & {\n type: \"select\";\n options: { label: string; value: string }[];\n showResetAction?: boolean;\n};\n\nexport type RadioInput = BaseInput<string> & {\n type: \"radio\";\n options: { label: string; value: string }[];\n};\n\nexport type ObjectInput = BaseInput<Record<string, any>> & {\n type: \"object\";\n fields: ComponentInput[];\n};\n\nexport type CustomInput = BaseInput<any> & {\n type: string;\n fields: ComponentInput[];\n};\n\n// Union of all input types\nexport type ComponentInput =\n | TextInput\n | LongTextInput\n | NumberInput\n | BooleanInput\n | ColorInput\n | FileInput\n | DateTimeInput\n | LexicalInput\n | SelectInput\n | RadioInput\n | TagsInput\n | ObjectInput\n | SlotInput\n | CustomInput;\n\nexport type ManifestInputsArray<\n TInputs,\n TAllowChildren extends boolean\n> = TAllowChildren extends true\n ? {\n [K in Exclude<keyof TInputs, \"children\">]: InputFactory<K & string>;\n }[Exclude<keyof TInputs, \"children\">][]\n : {\n [K in keyof TInputs]: InputFactory<K & string>;\n }[keyof TInputs][];\n\nexport type ManifestInputsObject<\n TInputs,\n TAllowChildren extends boolean\n> = TAllowChildren extends true\n ? { [K in Exclude<keyof TInputs, \"children\">]: InputFactory<K & string> }\n : { [K in keyof TInputs]: InputFactory<K & string> };\n\nexport type ComponentManifestInput<TInputs> =\n | (Omit<\n ComponentManifest,\n \"inputs\" | \"acceptsChildren\" | \"tags\" | \"onChange\" | \"onDescendantChange\"\n > & {\n acceptsChildren: true;\n tags?: string[];\n inputs?: ManifestInputsArray<TInputs, true> | ManifestInputsObject<TInputs, true>;\n onChange?: ComponentChangeHandler<TInputs> | ComponentChangeHandler<TInputs>[];\n onDescendantChange?:\n | DescendantChangeHandler<TInputs>\n | DescendantChangeHandler<TInputs>[];\n })\n | (Omit<\n ComponentManifest,\n \"inputs\" | \"acceptsChildren\" | \"tags\" | \"onChange\" | \"onDescendantChange\"\n > & {\n acceptsChildren?: false;\n tags?: string[];\n inputs: ManifestInputsArray<TInputs, false> | ManifestInputsObject<TInputs, false>;\n onChange?: ComponentChangeHandler<TInputs> | ComponentChangeHandler<TInputs>[];\n onDescendantChange?:\n | DescendantChangeHandler<TInputs>\n | DescendantChangeHandler<TInputs>[];\n });\n"],"mappings":"","ignoreList":[]}
|