@webiny/website-builder-react 6.0.0 → 6.1.0-beta.1

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.
@@ -28,6 +28,7 @@ export function createComponent(component, manifest) {
28
28
  component,
29
29
  manifest: {
30
30
  ...manifest,
31
+ tags: manifest.tags ?? [],
31
32
  inputs
32
33
  }
33
34
  };
@@ -1 +1 @@
1
- {"version":3,"names":["createSlotInput","createComponent","component","manifest","inputs","Array","isArray","push","inputsObject","Object","keys","forEach","name","acceptsChildren","hasChildren","some","input"],"sources":["createComponent.ts"],"sourcesContent":["import type {\n Component,\n ComponentInput,\n ComponentManifestInput,\n InputFactory\n} from \"@webiny/website-builder-sdk\";\nimport { createSlotInput } from \"@webiny/website-builder-sdk\";\nimport type { ExtractInputs } from \"~/types.js\";\n\nexport function createComponent<\n TComponent extends (props: any) => any,\n TInputs extends ExtractInputs<Parameters<TComponent>[0]>\n>(component: TComponent, manifest: ComponentManifestInput<TInputs>): Component {\n const inputs: ComponentInput[] = [];\n\n // Normalize inputs to always be an array of objects.\n\n if (Array.isArray(manifest.inputs)) {\n inputs.push(...manifest.inputs);\n } else {\n const inputsObject: Record<string, InputFactory<any>> = manifest.inputs ?? {};\n Object.keys(inputsObject).forEach((name: string) => {\n inputs.push({ ...inputsObject[name], name });\n });\n }\n\n const acceptsChildren = manifest.acceptsChildren;\n\n if (acceptsChildren) {\n const hasChildren = inputs.some(input => input.name === \"children\");\n if (!hasChildren) {\n inputs.push(createSlotInput({ name: \"children\" }));\n }\n }\n\n return { component, manifest: { ...manifest, inputs } };\n}\n"],"mappings":"AAMA,SAASA,eAAe,QAAQ,6BAA6B;AAG7D,OAAO,SAASC,eAAeA,CAG7BC,SAAqB,EAAEC,QAAyC,EAAa;EAC3E,MAAMC,MAAwB,GAAG,EAAE;;EAEnC;;EAEA,IAAIC,KAAK,CAACC,OAAO,CAACH,QAAQ,CAACC,MAAM,CAAC,EAAE;IAChCA,MAAM,CAACG,IAAI,CAAC,GAAGJ,QAAQ,CAACC,MAAM,CAAC;EACnC,CAAC,MAAM;IACH,MAAMI,YAA+C,GAAGL,QAAQ,CAACC,MAAM,IAAI,CAAC,CAAC;IAC7EK,MAAM,CAACC,IAAI,CAACF,YAAY,CAAC,CAACG,OAAO,CAAEC,IAAY,IAAK;MAChDR,MAAM,CAACG,IAAI,CAAC;QAAE,GAAGC,YAAY,CAACI,IAAI,CAAC;QAAEA;MAAK,CAAC,CAAC;IAChD,CAAC,CAAC;EACN;EAEA,MAAMC,eAAe,GAAGV,QAAQ,CAACU,eAAe;EAEhD,IAAIA,eAAe,EAAE;IACjB,MAAMC,WAAW,GAAGV,MAAM,CAACW,IAAI,CAACC,KAAK,IAAIA,KAAK,CAACJ,IAAI,KAAK,UAAU,CAAC;IACnE,IAAI,CAACE,WAAW,EAAE;MACdV,MAAM,CAACG,IAAI,CAACP,eAAe,CAAC;QAAEY,IAAI,EAAE;MAAW,CAAC,CAAC,CAAC;IACtD;EACJ;EAEA,OAAO;IAAEV,SAAS;IAAEC,QAAQ,EAAE;MAAE,GAAGA,QAAQ;MAAEC;IAAO;EAAE,CAAC;AAC3D","ignoreList":[]}
1
+ {"version":3,"names":["createSlotInput","createComponent","component","manifest","inputs","Array","isArray","push","inputsObject","Object","keys","forEach","name","acceptsChildren","hasChildren","some","input","tags"],"sources":["createComponent.ts"],"sourcesContent":["import type {\n Component,\n ComponentInput,\n ComponentManifest,\n ComponentManifestInput,\n InputFactory\n} from \"@webiny/website-builder-sdk\";\nimport { createSlotInput } from \"@webiny/website-builder-sdk\";\nimport type { ExtractInputs } from \"~/types.js\";\n\nexport function createComponent<\n TComponent extends (props: any) => any,\n TInputs extends ExtractInputs<Parameters<TComponent>[0]>\n>(component: TComponent, manifest: ComponentManifestInput<TInputs>): Component {\n const inputs: ComponentInput[] = [];\n\n // Normalize inputs to always be an array of objects.\n\n if (Array.isArray(manifest.inputs)) {\n inputs.push(...manifest.inputs);\n } else {\n const inputsObject: Record<string, InputFactory<any>> = manifest.inputs ?? {};\n Object.keys(inputsObject).forEach((name: string) => {\n inputs.push({ ...inputsObject[name], name });\n });\n }\n\n const acceptsChildren = manifest.acceptsChildren;\n\n if (acceptsChildren) {\n const hasChildren = inputs.some(input => input.name === \"children\");\n if (!hasChildren) {\n inputs.push(createSlotInput({ name: \"children\" }));\n }\n }\n\n return {\n component,\n manifest: { ...manifest, tags: manifest.tags ?? [], inputs } as ComponentManifest\n };\n}\n"],"mappings":"AAOA,SAASA,eAAe,QAAQ,6BAA6B;AAG7D,OAAO,SAASC,eAAeA,CAG7BC,SAAqB,EAAEC,QAAyC,EAAa;EAC3E,MAAMC,MAAwB,GAAG,EAAE;;EAEnC;;EAEA,IAAIC,KAAK,CAACC,OAAO,CAACH,QAAQ,CAACC,MAAM,CAAC,EAAE;IAChCA,MAAM,CAACG,IAAI,CAAC,GAAGJ,QAAQ,CAACC,MAAM,CAAC;EACnC,CAAC,MAAM;IACH,MAAMI,YAA+C,GAAGL,QAAQ,CAACC,MAAM,IAAI,CAAC,CAAC;IAC7EK,MAAM,CAACC,IAAI,CAACF,YAAY,CAAC,CAACG,OAAO,CAAEC,IAAY,IAAK;MAChDR,MAAM,CAACG,IAAI,CAAC;QAAE,GAAGC,YAAY,CAACI,IAAI,CAAC;QAAEA;MAAK,CAAC,CAAC;IAChD,CAAC,CAAC;EACN;EAEA,MAAMC,eAAe,GAAGV,QAAQ,CAACU,eAAe;EAEhD,IAAIA,eAAe,EAAE;IACjB,MAAMC,WAAW,GAAGV,MAAM,CAACW,IAAI,CAACC,KAAK,IAAIA,KAAK,CAACJ,IAAI,KAAK,UAAU,CAAC;IACnE,IAAI,CAACE,WAAW,EAAE;MACdV,MAAM,CAACG,IAAI,CAACP,eAAe,CAAC;QAAEY,IAAI,EAAE;MAAW,CAAC,CAAC,CAAC;IACtD;EACJ;EAEA,OAAO;IACHV,SAAS;IACTC,QAAQ,EAAE;MAAE,GAAGA,QAAQ;MAAEc,IAAI,EAAEd,QAAQ,CAACc,IAAI,IAAI,EAAE;MAAEb;IAAO;EAC/D,CAAC;AACL","ignoreList":[]}
@@ -38,6 +38,7 @@ describe("Component Manifest", () => {
38
38
  });
39
39
  const snapshot = {
40
40
  name: "Button",
41
+ tags: [],
41
42
  inputs: [{
42
43
  type: "text",
43
44
  label: "Title",
@@ -68,6 +69,7 @@ describe("Component Manifest", () => {
68
69
  expect(manifest).toEqual({
69
70
  name: "Button",
70
71
  acceptsChildren: true,
72
+ tags: [],
71
73
  inputs: [{
72
74
  type: "slot",
73
75
  list: true,
@@ -108,6 +110,7 @@ describe("Component Manifest", () => {
108
110
  const snapshot = {
109
111
  name: "Button",
110
112
  acceptsChildren: true,
113
+ tags: [],
111
114
  inputs: [{
112
115
  type: "text",
113
116
  renderer: "Webiny/Input",
@@ -1 +1 @@
1
- {"version":3,"names":["describe","expect","it","createComponent","createTextInput","createSlotInput","Button","_","button1","name","inputs","label","button2","title","children","snapshot","type","renderer","list","defaultValue","manifest","toEqual","acceptsChildren"],"sources":["createComponent.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport type { ComponentProps, ExtractInputNames } from \"~/types.js\";\nimport { createComponent } from \"~/createComponent.js\";\nimport { createTextInput } from \"~/index.js\";\nimport { createSlotInput } from \"@webiny/website-builder-sdk\";\n\n/**\n * These tests are aimed at testing TS types rather than functionality itself.\n * // TODO: figure out how to enable typechecking for a single test. Currently it only typechecks at build time.\n */\n\ndescribe(\"Component Manifest\", () => {\n it(\"should support input arrays and strict input objects\", () => {\n // eslint-disable-next-line\n const Button = (_: ComponentProps<{ title: string; children: React.ReactNode }>) => {\n return null;\n };\n\n type Inputs = ExtractInputNames<typeof Button>;\n\n const button1 = createComponent(Button, {\n name: \"Button\",\n inputs: [\n // Passing a generic narrows down the `name` property and provides autocomplete.\n createTextInput<Inputs>({\n name: \"title\",\n label: \"Title\"\n }),\n // Skipping the generic still performs typechecks, but doesn't provide autocomplete.\n createSlotInput({\n name: \"children\"\n })\n ]\n });\n\n const button2 = createComponent(Button, {\n name: \"Button\",\n inputs: {\n title: createTextInput({\n label: \"Title\"\n }),\n children: createSlotInput({})\n }\n });\n\n const snapshot = {\n name: \"Button\",\n inputs: [\n {\n type: \"text\",\n label: \"Title\",\n renderer: \"Webiny/Input\",\n name: \"title\"\n },\n {\n type: \"slot\",\n renderer: \"Webiny/Slot\",\n name: \"children\",\n list: true,\n defaultValue: []\n }\n ]\n };\n\n expect(button1.manifest).toEqual(snapshot);\n expect(button2.manifest).toEqual(snapshot);\n });\n\n it(\"acceptsChildren should satisfy the `children` input requirement\", () => {\n // eslint-disable-next-line\n const Button = (_: ComponentProps<{ children: React.ReactNode }>) => {\n return null;\n };\n\n const { manifest } = createComponent(Button, {\n name: \"Button\",\n acceptsChildren: true\n });\n\n expect(manifest).toEqual({\n name: \"Button\",\n acceptsChildren: true,\n inputs: [\n {\n type: \"slot\",\n list: true,\n renderer: \"Webiny/Slot\",\n name: \"children\",\n defaultValue: []\n }\n ]\n });\n });\n\n it(\"`acceptsChildren` should work alongside other inputs\", () => {\n // eslint-disable-next-line\n const Button = (_: ComponentProps<{ title: string; children: React.ReactNode }>) => {\n return null;\n };\n\n // Inputs as array\n const button1 = createComponent(Button, {\n name: \"Button\",\n acceptsChildren: true,\n inputs: [\n createTextInput({\n name: \"title\",\n label: \"Title\"\n })\n ]\n });\n\n // Inputs as object\n const button2 = createComponent(Button, {\n name: \"Button\",\n acceptsChildren: true,\n inputs: {\n title: createTextInput({\n label: \"Title\"\n })\n }\n });\n\n // Both must produce the same component manifest\n const snapshot = {\n name: \"Button\",\n acceptsChildren: true,\n inputs: [\n {\n type: \"text\",\n renderer: \"Webiny/Input\",\n name: \"title\",\n label: \"Title\"\n },\n {\n type: \"slot\",\n renderer: \"Webiny/Slot\",\n name: \"children\",\n list: true,\n defaultValue: []\n }\n ]\n };\n\n expect(button1.manifest).toEqual(snapshot);\n expect(button2.manifest).toEqual(snapshot);\n });\n});\n"],"mappings":"AA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AE,CACJ;QACIM,IAAI,EAAE,MAAM;QACZC,QAAQ,EAAE,cAAc;QACxBR,IAAI,EAAE,OAAO;QACbE,KAAK,EAAE;MACX,CAAC,EACD;QACIK,IAAI,EAAE,MAAM;QACZC,QAAQ,EAAE,aAAa;QACvBR,IAAI,EAAE,UAAU;QAChBS,IAAI,EAAE,IAAI;QACVC,YAAY,EAAE;MAClB,CAAC;IAET,CAAC;IAEDlB,MAAM,CAACO,OAAO,CAACY,QAAQ,CAAC,CAACC,OAAO,CAACN,QAAQ,CAAC;IAC1Cd,MAAM,CAACW,OAAO,CAACQ,QAAQ,CAAC,CAACC,OAAO,CAACN,QAAQ,CAAC;EAC9C,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["describe","expect","it","createComponent","createTextInput","createSlotInput","Button","_","button1","name","inputs","label","button2","title","children","snapshot","tags","type","renderer","list","defaultValue","manifest","toEqual","acceptsChildren"],"sources":["createComponent.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport type { ComponentProps, ExtractInputNames } from \"~/types.js\";\nimport { createComponent } from \"~/createComponent.js\";\nimport { createTextInput } from \"~/index.js\";\nimport { createSlotInput } from \"@webiny/website-builder-sdk\";\n\n/**\n * These tests are aimed at testing TS types rather than functionality itself.\n * // TODO: figure out how to enable typechecking for a single test. Currently it only typechecks at build time.\n */\n\ndescribe(\"Component Manifest\", () => {\n it(\"should support input arrays and strict input objects\", () => {\n // eslint-disable-next-line\n const Button = (_: ComponentProps<{ title: string; children: React.ReactNode }>) => {\n return null;\n };\n\n type Inputs = ExtractInputNames<typeof Button>;\n\n const button1 = createComponent(Button, {\n name: \"Button\",\n inputs: [\n // Passing a generic narrows down the `name` property and provides autocomplete.\n createTextInput<Inputs>({\n name: \"title\",\n label: \"Title\"\n }),\n // Skipping the generic still performs typechecks, but doesn't provide autocomplete.\n createSlotInput({\n name: \"children\"\n })\n ]\n });\n\n const button2 = createComponent(Button, {\n name: \"Button\",\n inputs: {\n title: createTextInput({\n label: \"Title\"\n }),\n children: createSlotInput({})\n }\n });\n\n const snapshot = {\n name: \"Button\",\n tags: [],\n inputs: [\n {\n type: \"text\",\n label: \"Title\",\n renderer: \"Webiny/Input\",\n name: \"title\"\n },\n {\n type: \"slot\",\n renderer: \"Webiny/Slot\",\n name: \"children\",\n list: true,\n defaultValue: []\n }\n ]\n };\n\n expect(button1.manifest).toEqual(snapshot);\n expect(button2.manifest).toEqual(snapshot);\n });\n\n it(\"acceptsChildren should satisfy the `children` input requirement\", () => {\n // eslint-disable-next-line\n const Button = (_: ComponentProps<{ children: React.ReactNode }>) => {\n return null;\n };\n\n const { manifest } = createComponent(Button, {\n name: \"Button\",\n acceptsChildren: true\n });\n\n expect(manifest).toEqual({\n name: \"Button\",\n acceptsChildren: true,\n tags: [],\n inputs: [\n {\n type: \"slot\",\n list: true,\n renderer: \"Webiny/Slot\",\n name: \"children\",\n defaultValue: []\n }\n ]\n });\n });\n\n it(\"`acceptsChildren` should work alongside other inputs\", () => {\n // eslint-disable-next-line\n const Button = (_: ComponentProps<{ title: string; children: React.ReactNode }>) => {\n return null;\n };\n\n // Inputs as array\n const button1 = createComponent(Button, {\n name: \"Button\",\n acceptsChildren: true,\n inputs: [\n createTextInput({\n name: \"title\",\n label: \"Title\"\n })\n ]\n });\n\n // Inputs as object\n const button2 = createComponent(Button, {\n name: \"Button\",\n acceptsChildren: true,\n inputs: {\n title: createTextInput({\n label: \"Title\"\n })\n }\n });\n\n // Both must produce the same component manifest\n const snapshot = {\n name: \"Button\",\n acceptsChildren: true,\n tags: [],\n inputs: [\n {\n type: \"text\",\n renderer: \"Webiny/Input\",\n name: \"title\",\n label: \"Title\"\n },\n {\n type: \"slot\",\n renderer: \"Webiny/Slot\",\n name: \"children\",\n list: true,\n defaultValue: []\n }\n ]\n };\n\n expect(button1.manifest).toEqual(snapshot);\n expect(button2.manifest).toEqual(snapshot);\n });\n});\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,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E,IAAI;MACrBP,IAAI,EAAE,EAAE;MACRN,MAAM,EAAE,CACJ;QACIO,IAAI,EAAE,MAAM;QACZC,QAAQ,EAAE,cAAc;QACxBT,IAAI,EAAE,OAAO;QACbE,KAAK,EAAE;MACX,CAAC,EACD;QACIM,IAAI,EAAE,MAAM;QACZC,QAAQ,EAAE,aAAa;QACvBT,IAAI,EAAE,UAAU;QAChBU,IAAI,EAAE,IAAI;QACVC,YAAY,EAAE;MAClB,CAAC;IAET,CAAC;IAEDnB,MAAM,CAACO,OAAO,CAACa,QAAQ,CAAC,CAACC,OAAO,CAACP,QAAQ,CAAC;IAC1Cd,MAAM,CAACW,OAAO,CAACS,QAAQ,CAAC,CAACC,OAAO,CAACP,QAAQ,CAAC;EAC9C,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from "./components/index.js";
2
2
  export * from "./createComponent.js";
3
- export { createTextInput, createLongTextInput, createNumberInput, createBooleanInput, createColorInput, createFileInput, createDateInput, createLexicalInput, createSelectInput, createRadioInput, createObjectInput, createTagsInput, createSlotInput, createInput, createElement, createTheme, contentSdk, environment, setHeadersProvider, getHeadersProvider, registerComponentGroup, type CssProperties, type Document, type DocumentElement, type Breakpoint, type CreateElementParams, type ContentSDKConfig, type ComponentManifest, type ComponentInput, type WebsiteBuilderThemeInput, StyleSettings } from "@webiny/website-builder-sdk";
4
- export type { ComponentProps, ComponentPropsWithChildren } from "./types.js";
3
+ export { createTextInput, createLongTextInput, createNumberInput, createBooleanInput, createColorInput, createFileInput, createDateInput, createLexicalInput, createSelectInput, createRadioInput, createObjectInput, createTagsInput, createSlotInput, createInput, createElement, createTheme, contentSdk, environment, setHeadersProvider, getHeadersProvider, registerComponentGroup, type CssProperties, type Document, type DocumentElement, type Breakpoint, type CreateElementParams, type ContentSDKConfig, type ComponentManifest, type ComponentInput, type ComponentConstraint, type WebsiteBuilderThemeInput, StyleSettings } from "@webiny/website-builder-sdk";
4
+ export type { ComponentProps, ComponentPropsWithChildren, InferManifest, InferComponentChange, InferDescendantChange } from "./types.js";
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["createTextInput","createLongTextInput","createNumberInput","createBooleanInput","createColorInput","createFileInput","createDateInput","createLexicalInput","createSelectInput","createRadioInput","createObjectInput","createTagsInput","createSlotInput","createInput","createElement","createTheme","contentSdk","environment","setHeadersProvider","getHeadersProvider","registerComponentGroup","StyleSettings"],"sources":["index.ts"],"sourcesContent":["export * from \"./components/index.js\";\nexport * from \"./createComponent.js\";\n\nexport {\n createTextInput,\n createLongTextInput,\n createNumberInput,\n createBooleanInput,\n createColorInput,\n createFileInput,\n createDateInput,\n createLexicalInput,\n createSelectInput,\n createRadioInput,\n createObjectInput,\n createTagsInput,\n createSlotInput,\n createInput,\n createElement,\n createTheme,\n contentSdk,\n environment,\n setHeadersProvider,\n getHeadersProvider,\n registerComponentGroup,\n type CssProperties,\n type Document,\n type DocumentElement,\n type Breakpoint,\n type CreateElementParams,\n type ContentSDKConfig,\n type ComponentManifest,\n type ComponentInput,\n type WebsiteBuilderThemeInput,\n StyleSettings\n} from \"@webiny/website-builder-sdk\";\n\nexport type { ComponentProps, ComponentPropsWithChildren } from \"./types.js\";\n"],"mappings":"AAAA;AACA;AAEA,SACIA,eAAe,EACfC,mBAAmB,EACnBC,iBAAiB,EACjBC,kBAAkB,EAClBC,gBAAgB,EAChBC,eAAe,EACfC,eAAe,EACfC,kBAAkB,EAClBC,iBAAiB,EACjBC,gBAAgB,EAChBC,iBAAiB,EACjBC,eAAe,EACfC,eAAe,EACfC,WAAW,EACXC,aAAa,EACbC,WAAW,EACXC,UAAU,EACVC,WAAW,EACXC,kBAAkB,EAClBC,kBAAkB,EAClBC,sBAAsB,EAUtBC,aAAa,QACV,6BAA6B","ignoreList":[]}
1
+ {"version":3,"names":["createTextInput","createLongTextInput","createNumberInput","createBooleanInput","createColorInput","createFileInput","createDateInput","createLexicalInput","createSelectInput","createRadioInput","createObjectInput","createTagsInput","createSlotInput","createInput","createElement","createTheme","contentSdk","environment","setHeadersProvider","getHeadersProvider","registerComponentGroup","StyleSettings"],"sources":["index.ts"],"sourcesContent":["export * from \"./components/index.js\";\nexport * from \"./createComponent.js\";\n\nexport {\n createTextInput,\n createLongTextInput,\n createNumberInput,\n createBooleanInput,\n createColorInput,\n createFileInput,\n createDateInput,\n createLexicalInput,\n createSelectInput,\n createRadioInput,\n createObjectInput,\n createTagsInput,\n createSlotInput,\n createInput,\n createElement,\n createTheme,\n contentSdk,\n environment,\n setHeadersProvider,\n getHeadersProvider,\n registerComponentGroup,\n type CssProperties,\n type Document,\n type DocumentElement,\n type Breakpoint,\n type CreateElementParams,\n type ContentSDKConfig,\n type ComponentManifest,\n type ComponentInput,\n type ComponentConstraint,\n type WebsiteBuilderThemeInput,\n StyleSettings\n} from \"@webiny/website-builder-sdk\";\n\nexport type {\n ComponentProps,\n ComponentPropsWithChildren,\n InferManifest,\n InferComponentChange,\n InferDescendantChange\n} from \"./types.js\";\n"],"mappings":"AAAA;AACA;AAEA,SACIA,eAAe,EACfC,mBAAmB,EACnBC,iBAAiB,EACjBC,kBAAkB,EAClBC,gBAAgB,EAChBC,eAAe,EACfC,eAAe,EACfC,kBAAkB,EAClBC,iBAAiB,EACjBC,gBAAgB,EAChBC,iBAAiB,EACjBC,eAAe,EACfC,eAAe,EACfC,WAAW,EACXC,aAAa,EACbC,WAAW,EACXC,UAAU,EACVC,WAAW,EACXC,kBAAkB,EAClBC,kBAAkB,EAClBC,sBAAsB,EAWtBC,aAAa,QACV,6BAA6B","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/website-builder-react",
3
- "version": "6.0.0",
3
+ "version": "6.1.0-beta.1",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -18,22 +18,22 @@
18
18
  ],
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@webiny/website-builder-sdk": "6.0.0",
21
+ "@webiny/website-builder-sdk": "6.1.0-beta.1",
22
22
  "deep-equal": "2.2.3",
23
23
  "mobx": "6.15.0",
24
- "mobx-react-lite": "3.4.3",
24
+ "mobx-react-lite": "4.1.1",
25
25
  "react": "18.2.0",
26
26
  "react-dom": "18.2.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/react": "18.2.79",
30
- "@webiny/build-tools": "6.0.0",
30
+ "@webiny/build-tools": "6.1.0-beta.1",
31
31
  "typescript": "5.9.3",
32
- "vitest": "4.0.18"
32
+ "vitest": "4.1.2"
33
33
  },
34
34
  "publishConfig": {
35
35
  "access": "public",
36
36
  "directory": "dist"
37
37
  },
38
- "gitHead": "9c6892640a45679ff521e25cd6587dff57393a2e"
38
+ "gitHead": "3c1293ba17a14f239fb1cbf5d80cd66846849309"
39
39
  }
package/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { CssProperties, DocumentElement } from "@webiny/website-builder-sdk";
1
+ import type { CssProperties, DocumentElement, ComponentManifestInput, ComponentChangeHandler, DescendantChangeHandler } from "@webiny/website-builder-sdk";
2
2
  export type ComponentProps<TInputs = unknown> = {
3
3
  inputs: TInputs;
4
4
  styles: CssProperties;
@@ -12,3 +12,38 @@ export type ExtractInputs<T> = T extends {
12
12
  inputs: infer I;
13
13
  } ? I : never;
14
14
  export type ExtractInputNames<T extends (props: any) => any> = keyof ExtractInputs<Parameters<T>[0]>;
15
+ /**
16
+ * Infer the full typed ComponentManifestInput from a React component.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * import type { InferManifest } from "@webiny/website-builder-nextjs";
21
+ * import type { Funnel } from "./Funnel.js";
22
+ *
23
+ * type FunnelManifest = InferManifest<typeof Funnel>;
24
+ *
25
+ * // Use indexed access for callback types:
26
+ * const handler: FunnelManifest["onDescendantChange"] = ctx => {
27
+ * ctx.inputs.registry; // fully typed
28
+ * };
29
+ * ```
30
+ */
31
+ export type InferManifest<T extends (props: any) => any> = ComponentManifestInput<ExtractInputs<Parameters<T>[0]>>;
32
+ /**
33
+ * Extract a single typed onChange handler from a component.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const handler: InferComponentChange<typeof Funnel> = ctx => { ... };
38
+ * ```
39
+ */
40
+ export type InferComponentChange<T extends (props: any) => any> = ComponentChangeHandler<ExtractInputs<Parameters<T>[0]>>;
41
+ /**
42
+ * Extract a single typed onDescendantChange handler from a component.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * const handler: InferDescendantChange<typeof Funnel> = ctx => { ... };
47
+ * ```
48
+ */
49
+ export type InferDescendantChange<T extends (props: any) => any> = DescendantChangeHandler<ExtractInputs<Parameters<T>[0]>>;
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { CssProperties, DocumentElement } from \"@webiny/website-builder-sdk\";\n\nexport type ComponentProps<TInputs = unknown> = {\n inputs: TInputs;\n styles: CssProperties;\n element: DocumentElement;\n breakpoint: string;\n};\n\nexport type ComponentPropsWithChildren<TInputs = unknown> = ComponentProps<\n TInputs & { children: React.ReactNode }\n>;\n\nexport type ExtractInputs<T> = T extends { inputs: infer I } ? I : never;\n\nexport type ExtractInputNames<T extends (props: any) => any> = keyof ExtractInputs<\n Parameters<T>[0]\n>;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\n CssProperties,\n DocumentElement,\n ComponentManifestInput,\n ComponentChangeHandler,\n DescendantChangeHandler\n} from \"@webiny/website-builder-sdk\";\n\nexport type ComponentProps<TInputs = unknown> = {\n inputs: TInputs;\n styles: CssProperties;\n element: DocumentElement;\n breakpoint: string;\n};\n\nexport type ComponentPropsWithChildren<TInputs = unknown> = ComponentProps<\n TInputs & { children: React.ReactNode }\n>;\n\nexport type ExtractInputs<T> = T extends { inputs: infer I } ? I : never;\n\nexport type ExtractInputNames<T extends (props: any) => any> = keyof ExtractInputs<\n Parameters<T>[0]\n>;\n\n/**\n * Infer the full typed ComponentManifestInput from a React component.\n *\n * @example\n * ```ts\n * import type { InferManifest } from \"@webiny/website-builder-nextjs\";\n * import type { Funnel } from \"./Funnel.js\";\n *\n * type FunnelManifest = InferManifest<typeof Funnel>;\n *\n * // Use indexed access for callback types:\n * const handler: FunnelManifest[\"onDescendantChange\"] = ctx => {\n * ctx.inputs.registry; // fully typed\n * };\n * ```\n */\nexport type InferManifest<T extends (props: any) => any> = ComponentManifestInput<\n ExtractInputs<Parameters<T>[0]>\n>;\n\n/**\n * Extract a single typed onChange handler from a component.\n *\n * @example\n * ```ts\n * const handler: InferComponentChange<typeof Funnel> = ctx => { ... };\n * ```\n */\nexport type InferComponentChange<T extends (props: any) => any> = ComponentChangeHandler<\n ExtractInputs<Parameters<T>[0]>\n>;\n\n/**\n * Extract a single typed onDescendantChange handler from a component.\n *\n * @example\n * ```ts\n * const handler: InferDescendantChange<typeof Funnel> = ctx => { ... };\n * ```\n */\nexport type InferDescendantChange<T extends (props: any) => any> = DescendantChangeHandler<\n ExtractInputs<Parameters<T>[0]>\n>;\n"],"mappings":"","ignoreList":[]}