@webiny/website-builder-react 0.0.0-unstable.3c5210ad37 → 0.0.0-unstable.3fddf667ea
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/components/ConnectToEditor.d.ts +3 -1
- package/components/ConnectToEditor.js +20 -20
- package/components/ConnectToEditor.js.map +1 -1
- package/components/ContentClientContext.d.ts +3 -0
- package/components/ContentClientContext.js +6 -0
- package/components/ContentClientContext.js.map +1 -0
- package/components/ContentClientProvider.d.ts +12 -0
- package/components/ContentClientProvider.js +9 -0
- package/components/ContentClientProvider.js.map +1 -0
- package/components/ContentClientProvider.test.d.ts +1 -0
- package/components/ContentClientProvider.test.js +143 -0
- package/components/ContentClientProvider.test.js.map +1 -0
- package/components/DocumentFragment.js +5 -7
- package/components/DocumentFragment.js.map +1 -1
- package/components/DocumentRenderer.d.ts +8 -3
- package/components/DocumentRenderer.js +51 -48
- package/components/DocumentRenderer.js.map +1 -1
- package/components/DocumentStoreProvider.d.ts +7 -0
- package/components/DocumentStoreProvider.js +35 -22
- package/components/DocumentStoreProvider.js.map +1 -1
- package/components/DocumentStoreProvider.test.d.ts +1 -0
- package/components/DocumentStoreProvider.test.js +66 -0
- package/components/DocumentStoreProvider.test.js.map +1 -0
- package/components/EditingElementRenderer/EditingElementRenderer.d.ts +7 -2
- package/components/EditingElementRenderer/EditingElementRenderer.js +43 -35
- package/components/EditingElementRenderer/EditingElementRenderer.js.map +1 -1
- package/components/EditingElementRenderer/EditingElementRenderer.presenter.d.ts +2 -2
- package/components/EditingElementRenderer/EditingElementRenderer.presenter.js +31 -36
- package/components/EditingElementRenderer/EditingElementRenderer.presenter.js.map +1 -1
- package/components/EditingElementRenderer/index.js +0 -2
- package/components/ElementIndexProvider.js +9 -14
- package/components/ElementIndexProvider.js.map +1 -1
- package/components/ElementRenderer.d.ts +2 -2
- package/components/ElementRenderer.js +25 -17
- package/components/ElementRenderer.js.map +1 -1
- package/components/ElementSlot.js +9 -9
- package/components/ElementSlot.js.map +1 -1
- package/components/ElementSlotDepthProvider.js +9 -14
- package/components/ElementSlotDepthProvider.js.map +1 -1
- package/components/FragmentsProvider.js +32 -37
- package/components/FragmentsProvider.js.map +1 -1
- package/components/GlobalComponent.d.ts +10 -0
- package/components/GlobalComponent.js +17 -0
- package/components/GlobalComponent.js.map +1 -0
- package/components/GlobalPlacement.d.ts +11 -0
- package/components/GlobalPlacement.js +27 -0
- package/components/GlobalPlacement.js.map +1 -0
- package/components/LayoutAreas.d.ts +19 -0
- package/components/LayoutAreas.js +15 -0
- package/components/LayoutAreas.js.map +1 -0
- package/components/LayoutRenderer.d.ts +14 -0
- package/components/LayoutRenderer.js +60 -0
- package/components/LayoutRenderer.js.map +1 -0
- package/components/LayoutRenderer.test.d.ts +1 -0
- package/components/LayoutRenderer.test.js +138 -0
- package/components/LayoutRenderer.test.js.map +1 -0
- package/components/LiveElementRenderer.d.ts +2 -2
- package/components/LiveElementRenderer.js +60 -69
- package/components/LiveElementRenderer.js.map +1 -1
- package/components/LiveElementSlot.js +12 -14
- package/components/LiveElementSlot.js.map +1 -1
- package/components/PageLayout.d.ts +40 -0
- package/components/PageLayout.js +71 -0
- package/components/PageLayout.js.map +1 -0
- package/components/PreviewElementSlot.js +27 -23
- package/components/PreviewElementSlot.js.map +1 -1
- package/components/SlotLabel.d.ts +15 -0
- package/components/SlotLabel.js +13 -0
- package/components/SlotLabel.js.map +1 -0
- package/components/index.d.ts +7 -0
- package/components/index.js +6 -2
- package/components/renderWithLayout.d.ts +5 -0
- package/components/renderWithLayout.js +7 -0
- package/components/renderWithLayout.js.map +1 -0
- package/components/useBindingsForElement.js +13 -11
- package/components/useBindingsForElement.js.map +1 -1
- package/components/useContentClient.d.ts +6 -0
- package/components/useContentClient.js +11 -0
- package/components/useContentClient.js.map +1 -0
- package/components/useDocumentState.js +4 -3
- package/components/useDocumentState.js.map +1 -1
- package/components/useIsElementSelected.d.ts +8 -0
- package/components/useIsElementSelected.js +22 -0
- package/components/useIsElementSelected.js.map +1 -0
- package/components/useSeededDocumentStore.d.ts +10 -0
- package/components/useSeededDocumentStore.js +22 -0
- package/components/useSeededDocumentStore.js.map +1 -0
- package/components/useSelectFromState.js +29 -35
- package/components/useSelectFromState.js.map +1 -1
- package/components/useViewportInfo.js +5 -6
- package/components/useViewportInfo.js.map +1 -1
- package/contentEntry/useContentEntryList.d.ts +22 -0
- package/contentEntry/useContentEntryList.js +51 -0
- package/contentEntry/useContentEntryList.js.map +1 -0
- package/createComponent.d.ts +1 -3
- package/createComponent.js +1 -36
- package/createComponent.test.js +108 -119
- package/createComponent.test.js.map +1 -1
- package/editorComponents/Box.js +3 -6
- package/editorComponents/Box.js.map +1 -1
- package/editorComponents/Box.manifest.js +15 -14
- package/editorComponents/Box.manifest.js.map +1 -1
- package/editorComponents/Fragment.js +23 -32
- package/editorComponents/Fragment.js.map +1 -1
- package/editorComponents/Fragment.manifest.js +14 -11
- package/editorComponents/Fragment.manifest.js.map +1 -1
- package/editorComponents/Grid.d.ts +1 -1
- package/editorComponents/Grid.js +34 -61
- package/editorComponents/Grid.js.map +1 -1
- package/editorComponents/Grid.manifest.js +163 -166
- package/editorComponents/Grid.manifest.js.map +1 -1
- package/editorComponents/GridColumn.js +3 -6
- package/editorComponents/GridColumn.js.map +1 -1
- package/editorComponents/GridColumn.manifest.js +20 -17
- package/editorComponents/GridColumn.manifest.js.map +1 -1
- package/editorComponents/Image.js +99 -119
- package/editorComponents/Image.js.map +1 -1
- package/editorComponents/Image.manifest.js +33 -32
- package/editorComponents/Image.manifest.js.map +1 -1
- package/editorComponents/LayoutContent.d.ts +6 -0
- package/editorComponents/LayoutContent.js +121 -0
- package/editorComponents/LayoutContent.js.map +1 -0
- package/editorComponents/LayoutContent.manifest.d.ts +10 -0
- package/editorComponents/LayoutContent.manifest.js +32 -0
- package/editorComponents/LayoutContent.manifest.js.map +1 -0
- package/editorComponents/LayoutContentLabel.d.ts +2 -0
- package/editorComponents/LayoutContentLabel.js +7 -0
- package/editorComponents/LayoutContentLabel.js.map +1 -0
- package/editorComponents/LayoutContentLabel.test.d.ts +1 -0
- package/editorComponents/LayoutContentLabel.test.js +23 -0
- package/editorComponents/LayoutContentLabel.test.js.map +1 -0
- package/editorComponents/Lexical.js +13 -21
- package/editorComponents/Lexical.js.map +1 -1
- package/editorComponents/Lexical.manifest.js +17 -14
- package/editorComponents/Lexical.manifest.js.map +1 -1
- package/editorComponents/Root.js +3 -6
- package/editorComponents/Root.js.map +1 -1
- package/editorComponents/Root.manifest.js +7 -6
- package/editorComponents/Root.manifest.js.map +1 -1
- package/editorComponents/index.js +13 -1
- package/editorComponents/index.js.map +1 -1
- package/image/BackgroundImage.d.ts +33 -0
- package/image/BackgroundImage.js +61 -0
- package/image/BackgroundImage.js.map +1 -0
- package/image/Image.d.ts +29 -0
- package/image/Image.js +43 -0
- package/image/Image.js.map +1 -0
- package/image/getImageProps.d.ts +42 -0
- package/image/getImageProps.js +18 -0
- package/image/getImageProps.js.map +1 -0
- package/image/getImageProps.test.d.ts +1 -0
- package/image/getImageProps.test.js +70 -0
- package/image/getImageProps.test.js.map +1 -0
- package/image/index.d.ts +3 -0
- package/image/index.js +3 -0
- package/index.d.ts +4 -3
- package/index.js +2 -4
- package/package.json +16 -14
- package/types.d.ts +39 -4
- package/types.js +0 -3
- package/components/EditingElementRenderer/index.js.map +0 -1
- package/components/index.js.map +0 -1
- package/createComponent.js.map +0 -1
- package/index.js.map +0 -1
- package/types.js.map +0 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ResolvedContentEntryQuery } from "@webiny/website-builder-sdk";
|
|
2
|
+
export type { ResolvedContentEntryQuery, ContentEntryQuerySpec } from "@webiny/website-builder-sdk";
|
|
3
|
+
export interface ContentEntryList<T = unknown> {
|
|
4
|
+
/** The loaded entries (first page + any loaded via loadMore). */
|
|
5
|
+
items: T[];
|
|
6
|
+
/** Whether more pages are available (and pagination is enabled). */
|
|
7
|
+
hasMore: boolean;
|
|
8
|
+
/** True while a loadMore fetch is in flight. */
|
|
9
|
+
loading: boolean;
|
|
10
|
+
/** Fetch and append the next page. No-op when nothing more to load. */
|
|
11
|
+
loadMore: () => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Client hook for a query-mode `contentEntry` input. Seeds from the server-resolved
|
|
15
|
+
* first page (SSR-safe — no fetch on mount) and loads further pages on demand from
|
|
16
|
+
* the embedded query + cursor. Re-seeds when the underlying query changes (e.g. the
|
|
17
|
+
* editor tweaks sort/limit/search in preview).
|
|
18
|
+
*
|
|
19
|
+
* Pagination is active only when the input enables it (the resolved value then
|
|
20
|
+
* carries a `query`); otherwise `hasMore` is always false and `loadMore` is a no-op.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useContentEntryList<T = unknown>(value: ResolvedContentEntryQuery<T> | null | undefined): ContentEntryList<T>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
|
+
import { contentSdk } from "@webiny/cms-sdk";
|
|
4
|
+
function useContentEntryList(value) {
|
|
5
|
+
const query = value?.query;
|
|
6
|
+
const signature = JSON.stringify({
|
|
7
|
+
query,
|
|
8
|
+
cursor: value?.pageInfo?.cursor ?? null
|
|
9
|
+
});
|
|
10
|
+
const seed = ()=>({
|
|
11
|
+
signature,
|
|
12
|
+
items: value?.items ?? [],
|
|
13
|
+
cursor: value?.pageInfo?.cursor ?? null,
|
|
14
|
+
apiHasMore: value?.pageInfo?.hasMore ?? false
|
|
15
|
+
});
|
|
16
|
+
const [state, setState] = useState(seed);
|
|
17
|
+
const [loading, setLoading] = useState(false);
|
|
18
|
+
if (state.signature !== signature) setState(seed());
|
|
19
|
+
const loadMore = useCallback(()=>{
|
|
20
|
+
if (!query || loading || !state.apiHasMore || !state.cursor) return;
|
|
21
|
+
setLoading(true);
|
|
22
|
+
contentSdk.listEntries({
|
|
23
|
+
...query,
|
|
24
|
+
after: state.cursor
|
|
25
|
+
}).then((result)=>{
|
|
26
|
+
setState((prev)=>({
|
|
27
|
+
...prev,
|
|
28
|
+
items: [
|
|
29
|
+
...prev.items,
|
|
30
|
+
...result.data
|
|
31
|
+
],
|
|
32
|
+
cursor: result.meta.cursor,
|
|
33
|
+
apiHasMore: result.meta.hasMoreItems
|
|
34
|
+
}));
|
|
35
|
+
}).finally(()=>setLoading(false));
|
|
36
|
+
}, [
|
|
37
|
+
query,
|
|
38
|
+
loading,
|
|
39
|
+
state.apiHasMore,
|
|
40
|
+
state.cursor
|
|
41
|
+
]);
|
|
42
|
+
return {
|
|
43
|
+
items: state.items,
|
|
44
|
+
hasMore: Boolean(query) && state.apiHasMore,
|
|
45
|
+
loading,
|
|
46
|
+
loadMore
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export { useContentEntryList };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=useContentEntryList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentEntry/useContentEntryList.js","sources":["../../src/contentEntry/useContentEntryList.ts"],"sourcesContent":["\"use client\";\nimport { useCallback, useState } from \"react\";\nimport { contentSdk } from \"@webiny/cms-sdk\";\nimport type { ResolvedContentEntryQuery } from \"@webiny/website-builder-sdk\";\n\nexport type { ResolvedContentEntryQuery, ContentEntryQuerySpec } from \"@webiny/website-builder-sdk\";\n\nexport interface ContentEntryList<T = unknown> {\n /** The loaded entries (first page + any loaded via loadMore). */\n items: T[];\n /** Whether more pages are available (and pagination is enabled). */\n hasMore: boolean;\n /** True while a loadMore fetch is in flight. */\n loading: boolean;\n /** Fetch and append the next page. No-op when nothing more to load. */\n loadMore: () => void;\n}\n\ninterface PageState<T> {\n signature: string;\n items: T[];\n cursor: string | null;\n apiHasMore: boolean;\n}\n\n/**\n * Client hook for a query-mode `contentEntry` input. Seeds from the server-resolved\n * first page (SSR-safe — no fetch on mount) and loads further pages on demand from\n * the embedded query + cursor. Re-seeds when the underlying query changes (e.g. the\n * editor tweaks sort/limit/search in preview).\n *\n * Pagination is active only when the input enables it (the resolved value then\n * carries a `query`); otherwise `hasMore` is always false and `loadMore` is a no-op.\n */\nexport function useContentEntryList<T = unknown>(\n value: ResolvedContentEntryQuery<T> | null | undefined\n): ContentEntryList<T> {\n const query = value?.query;\n const signature = JSON.stringify({ query, cursor: value?.pageInfo?.cursor ?? null });\n\n const seed = (): PageState<T> => ({\n signature,\n items: value?.items ?? [],\n cursor: value?.pageInfo?.cursor ?? null,\n apiHasMore: value?.pageInfo?.hasMore ?? false\n });\n\n const [state, setState] = useState<PageState<T>>(seed);\n const [loading, setLoading] = useState(false);\n\n // Re-seed (on the client) when the resolved page changes — e.g. the editor edits\n // the query. The first/SSR render already has the right data via useState.\n if (state.signature !== signature) {\n setState(seed());\n }\n\n const loadMore = useCallback(() => {\n if (!query || loading || !state.apiHasMore || !state.cursor) {\n return;\n }\n setLoading(true);\n contentSdk\n .listEntries({ ...query, after: state.cursor })\n .then(result => {\n setState(prev => ({\n ...prev,\n items: [...prev.items, ...(result.data as T[])],\n cursor: result.meta.cursor,\n apiHasMore: result.meta.hasMoreItems\n }));\n })\n .finally(() => setLoading(false));\n }, [query, loading, state.apiHasMore, state.cursor]);\n\n return {\n items: state.items,\n hasMore: Boolean(query) && state.apiHasMore,\n loading,\n loadMore\n };\n}\n"],"names":["useContentEntryList","value","query","signature","JSON","seed","state","setState","useState","loading","setLoading","loadMore","useCallback","contentSdk","result","prev","Boolean"],"mappings":";;;AAkCO,SAASA,oBACZC,KAAsD;IAEtD,MAAMC,QAAQD,OAAO;IACrB,MAAME,YAAYC,KAAK,SAAS,CAAC;QAAEF;QAAO,QAAQD,OAAO,UAAU,UAAU;IAAK;IAElF,MAAMI,OAAO,IAAqB;YAC9BF;YACA,OAAOF,OAAO,SAAS,EAAE;YACzB,QAAQA,OAAO,UAAU,UAAU;YACnC,YAAYA,OAAO,UAAU,WAAW;QAC5C;IAEA,MAAM,CAACK,OAAOC,SAAS,GAAGC,SAAuBH;IACjD,MAAM,CAACI,SAASC,WAAW,GAAGF,SAAS;IAIvC,IAAIF,MAAM,SAAS,KAAKH,WACpBI,SAASF;IAGb,MAAMM,WAAWC,YAAY;QACzB,IAAI,CAACV,SAASO,WAAW,CAACH,MAAM,UAAU,IAAI,CAACA,MAAM,MAAM,EACvD;QAEJI,WAAW;QACXG,WAAAA,WACgB,CAAC;YAAE,GAAGX,KAAK;YAAE,OAAOI,MAAM,MAAM;QAAC,GAC5C,IAAI,CAACQ,CAAAA;YACFP,SAASQ,CAAAA,OAAS;oBACd,GAAGA,IAAI;oBACP,OAAO;2BAAIA,KAAK,KAAK;2BAAMD,OAAO,IAAI;qBAAS;oBAC/C,QAAQA,OAAO,IAAI,CAAC,MAAM;oBAC1B,YAAYA,OAAO,IAAI,CAAC,YAAY;gBACxC;QACJ,GACC,OAAO,CAAC,IAAMJ,WAAW;IAClC,GAAG;QAACR;QAAOO;QAASH,MAAM,UAAU;QAAEA,MAAM,MAAM;KAAC;IAEnD,OAAO;QACH,OAAOA,MAAM,KAAK;QAClB,SAASU,QAAQd,UAAUI,MAAM,UAAU;QAC3CG;QACAE;IACJ;AACJ"}
|
package/createComponent.d.ts
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { ExtractInputs } from "./types.js";
|
|
3
|
-
export declare function createComponent<TComponent extends (props: any) => any, TInputs extends ExtractInputs<Parameters<TComponent>[0]>>(component: TComponent, manifest: ComponentManifestInput<TInputs>): Component;
|
|
1
|
+
export { createComponent } from "@webiny/website-builder-sdk";
|
package/createComponent.js
CHANGED
|
@@ -1,36 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export function createComponent(component, manifest) {
|
|
3
|
-
const inputs = [];
|
|
4
|
-
|
|
5
|
-
// Normalize inputs to always be an array of objects.
|
|
6
|
-
|
|
7
|
-
if (Array.isArray(manifest.inputs)) {
|
|
8
|
-
inputs.push(...manifest.inputs);
|
|
9
|
-
} else {
|
|
10
|
-
const inputsObject = manifest.inputs ?? {};
|
|
11
|
-
Object.keys(inputsObject).forEach(name => {
|
|
12
|
-
inputs.push({
|
|
13
|
-
...inputsObject[name],
|
|
14
|
-
name
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
const acceptsChildren = manifest.acceptsChildren;
|
|
19
|
-
if (acceptsChildren) {
|
|
20
|
-
const hasChildren = inputs.some(input => input.name === "children");
|
|
21
|
-
if (!hasChildren) {
|
|
22
|
-
inputs.push(createSlotInput({
|
|
23
|
-
name: "children"
|
|
24
|
-
}));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
component,
|
|
29
|
-
manifest: {
|
|
30
|
-
...manifest,
|
|
31
|
-
inputs
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
//# sourceMappingURL=createComponent.js.map
|
|
1
|
+
export { createComponent } from "@webiny/website-builder-sdk";
|
package/createComponent.test.js
CHANGED
|
@@ -2,128 +2,117 @@ import { describe, expect, it } from "vitest";
|
|
|
2
2
|
import { createComponent } from "./createComponent.js";
|
|
3
3
|
import { createTextInput } from "./index.js";
|
|
4
4
|
import { createSlotInput } from "@webiny/website-builder-sdk";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
list: true,
|
|
51
|
-
defaultValue: []
|
|
52
|
-
}]
|
|
53
|
-
};
|
|
54
|
-
expect(button1.manifest).toEqual(snapshot);
|
|
55
|
-
expect(button2.manifest).toEqual(snapshot);
|
|
56
|
-
});
|
|
57
|
-
it("acceptsChildren should satisfy the `children` input requirement", () => {
|
|
58
|
-
// eslint-disable-next-line
|
|
59
|
-
const Button = _ => {
|
|
60
|
-
return null;
|
|
61
|
-
};
|
|
62
|
-
const {
|
|
63
|
-
manifest
|
|
64
|
-
} = createComponent(Button, {
|
|
65
|
-
name: "Button",
|
|
66
|
-
acceptsChildren: true
|
|
5
|
+
describe("Component Manifest", ()=>{
|
|
6
|
+
it("should support input arrays and strict input objects", ()=>{
|
|
7
|
+
const Button = ({})=>null;
|
|
8
|
+
const button1 = createComponent(Button, {
|
|
9
|
+
name: "Button",
|
|
10
|
+
inputs: [
|
|
11
|
+
createTextInput({
|
|
12
|
+
name: "title",
|
|
13
|
+
label: "Title"
|
|
14
|
+
}),
|
|
15
|
+
createSlotInput({
|
|
16
|
+
name: "children"
|
|
17
|
+
})
|
|
18
|
+
]
|
|
19
|
+
});
|
|
20
|
+
const button2 = createComponent(Button, {
|
|
21
|
+
name: "Button",
|
|
22
|
+
inputs: {
|
|
23
|
+
title: createTextInput({
|
|
24
|
+
label: "Title"
|
|
25
|
+
}),
|
|
26
|
+
children: createSlotInput({})
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const snapshot = {
|
|
30
|
+
name: "Button",
|
|
31
|
+
tags: [],
|
|
32
|
+
inputs: [
|
|
33
|
+
{
|
|
34
|
+
type: "text",
|
|
35
|
+
label: "Title",
|
|
36
|
+
renderer: "Webiny/Input",
|
|
37
|
+
name: "title"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: "slot",
|
|
41
|
+
renderer: "Webiny/Slot",
|
|
42
|
+
name: "children",
|
|
43
|
+
list: true,
|
|
44
|
+
defaultValue: []
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
};
|
|
48
|
+
expect(button1.manifest).toEqual(snapshot);
|
|
49
|
+
expect(button2.manifest).toEqual(snapshot);
|
|
67
50
|
});
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
51
|
+
it("acceptsChildren should satisfy the `children` input requirement", ()=>{
|
|
52
|
+
const Button = ({})=>null;
|
|
53
|
+
const { manifest } = createComponent(Button, {
|
|
54
|
+
name: "Button",
|
|
55
|
+
acceptsChildren: true
|
|
56
|
+
});
|
|
57
|
+
expect(manifest).toEqual({
|
|
58
|
+
name: "Button",
|
|
59
|
+
acceptsChildren: true,
|
|
60
|
+
tags: [],
|
|
61
|
+
inputs: [
|
|
62
|
+
{
|
|
63
|
+
type: "slot",
|
|
64
|
+
list: true,
|
|
65
|
+
renderer: "Webiny/Slot",
|
|
66
|
+
name: "children",
|
|
67
|
+
defaultValue: []
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
});
|
|
78
71
|
});
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
72
|
+
it("`acceptsChildren` should work alongside other inputs", ()=>{
|
|
73
|
+
const Button = ({})=>null;
|
|
74
|
+
const button1 = createComponent(Button, {
|
|
75
|
+
name: "Button",
|
|
76
|
+
acceptsChildren: true,
|
|
77
|
+
inputs: [
|
|
78
|
+
createTextInput({
|
|
79
|
+
name: "title",
|
|
80
|
+
label: "Title"
|
|
81
|
+
})
|
|
82
|
+
]
|
|
83
|
+
});
|
|
84
|
+
const button2 = createComponent(Button, {
|
|
85
|
+
name: "Button",
|
|
86
|
+
acceptsChildren: true,
|
|
87
|
+
inputs: {
|
|
88
|
+
title: createTextInput({
|
|
89
|
+
label: "Title"
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
const snapshot = {
|
|
94
|
+
name: "Button",
|
|
95
|
+
acceptsChildren: true,
|
|
96
|
+
tags: [],
|
|
97
|
+
inputs: [
|
|
98
|
+
{
|
|
99
|
+
type: "text",
|
|
100
|
+
renderer: "Webiny/Input",
|
|
101
|
+
name: "title",
|
|
102
|
+
label: "Title"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
type: "slot",
|
|
106
|
+
renderer: "Webiny/Slot",
|
|
107
|
+
name: "children",
|
|
108
|
+
list: true,
|
|
109
|
+
defaultValue: []
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
};
|
|
113
|
+
expect(button1.manifest).toEqual(snapshot);
|
|
114
|
+
expect(button2.manifest).toEqual(snapshot);
|
|
105
115
|
});
|
|
106
|
-
|
|
107
|
-
// Both must produce the same component manifest
|
|
108
|
-
const snapshot = {
|
|
109
|
-
name: "Button",
|
|
110
|
-
acceptsChildren: true,
|
|
111
|
-
inputs: [{
|
|
112
|
-
type: "text",
|
|
113
|
-
renderer: "Webiny/Input",
|
|
114
|
-
name: "title",
|
|
115
|
-
label: "Title"
|
|
116
|
-
}, {
|
|
117
|
-
type: "slot",
|
|
118
|
-
renderer: "Webiny/Slot",
|
|
119
|
-
name: "children",
|
|
120
|
-
list: true,
|
|
121
|
-
defaultValue: []
|
|
122
|
-
}]
|
|
123
|
-
};
|
|
124
|
-
expect(button1.manifest).toEqual(snapshot);
|
|
125
|
-
expect(button2.manifest).toEqual(snapshot);
|
|
126
|
-
});
|
|
127
116
|
});
|
|
128
117
|
|
|
129
118
|
//# sourceMappingURL=createComponent.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"createComponent.test.js","sources":["../src/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 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 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 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"],"names":["describe","it","Button","button1","createComponent","createTextInput","createSlotInput","button2","snapshot","expect","manifest"],"mappings":";;;;AAWAA,SAAS,sBAAsB;IAC3BC,GAAG,wDAAwD;QACvD,MAAMC,SAAS,CAAC,EAAgE,GACrE;QAKX,MAAMC,UAAUC,gBAAgBF,QAAQ;YACpC,MAAM;YACN,QAAQ;gBAEJG,gBAAwB;oBACpB,MAAM;oBACN,OAAO;gBACX;gBAEAC,gBAAgB;oBACZ,MAAM;gBACV;aACH;QACL;QAEA,MAAMC,UAAUH,gBAAgBF,QAAQ;YACpC,MAAM;YACN,QAAQ;gBACJ,OAAOG,gBAAgB;oBACnB,OAAO;gBACX;gBACA,UAAUC,gBAAgB,CAAC;YAC/B;QACJ;QAEA,MAAME,WAAW;YACb,MAAM;YACN,MAAM,EAAE;YACR,QAAQ;gBACJ;oBACI,MAAM;oBACN,OAAO;oBACP,UAAU;oBACV,MAAM;gBACV;gBACA;oBACI,MAAM;oBACN,UAAU;oBACV,MAAM;oBACN,MAAM;oBACN,cAAc,EAAE;gBACpB;aACH;QACL;QAEAC,OAAON,QAAQ,QAAQ,EAAE,OAAO,CAACK;QACjCC,OAAOF,QAAQ,QAAQ,EAAE,OAAO,CAACC;IACrC;IAEAP,GAAG,mEAAmE;QAClE,MAAMC,SAAS,CAAC,EAAiD,GACtD;QAGX,MAAM,EAAEQ,QAAQ,EAAE,GAAGN,gBAAgBF,QAAQ;YACzC,MAAM;YACN,iBAAiB;QACrB;QAEAO,OAAOC,UAAU,OAAO,CAAC;YACrB,MAAM;YACN,iBAAiB;YACjB,MAAM,EAAE;YACR,QAAQ;gBACJ;oBACI,MAAM;oBACN,MAAM;oBACN,UAAU;oBACV,MAAM;oBACN,cAAc,EAAE;gBACpB;aACH;QACL;IACJ;IAEAT,GAAG,wDAAwD;QACvD,MAAMC,SAAS,CAAC,EAAgE,GACrE;QAIX,MAAMC,UAAUC,gBAAgBF,QAAQ;YACpC,MAAM;YACN,iBAAiB;YACjB,QAAQ;gBACJG,gBAAgB;oBACZ,MAAM;oBACN,OAAO;gBACX;aACH;QACL;QAGA,MAAME,UAAUH,gBAAgBF,QAAQ;YACpC,MAAM;YACN,iBAAiB;YACjB,QAAQ;gBACJ,OAAOG,gBAAgB;oBACnB,OAAO;gBACX;YACJ;QACJ;QAGA,MAAMG,WAAW;YACb,MAAM;YACN,iBAAiB;YACjB,MAAM,EAAE;YACR,QAAQ;gBACJ;oBACI,MAAM;oBACN,UAAU;oBACV,MAAM;oBACN,OAAO;gBACX;gBACA;oBACI,MAAM;oBACN,UAAU;oBACV,MAAM;oBACN,MAAM;oBACN,cAAc,EAAE;gBACpB;aACH;QACL;QAEAC,OAAON,QAAQ,QAAQ,EAAE,OAAO,CAACK;QACjCC,OAAOF,QAAQ,QAAQ,EAAE,OAAO,CAACC;IACrC;AACJ"}
|
package/editorComponents/Box.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}) => {
|
|
5
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, inputs.children);
|
|
6
|
-
};
|
|
1
|
+
import react from "react";
|
|
2
|
+
const BoxComponent = ({ inputs })=>/*#__PURE__*/ react.createElement(react.Fragment, null, inputs.children);
|
|
3
|
+
export { BoxComponent };
|
|
7
4
|
|
|
8
5
|
//# sourceMappingURL=Box.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"editorComponents/Box.js","sources":["../../src/editorComponents/Box.tsx"],"sourcesContent":["import React from \"react\";\nimport type { ComponentPropsWithChildren } from \"~/types.js\";\n\nexport const BoxComponent = ({ inputs }: ComponentPropsWithChildren) => {\n return <>{inputs.children}</>;\n};\n"],"names":["BoxComponent","inputs"],"mappings":";AAGO,MAAMA,eAAe,CAAC,EAAEC,MAAM,EAA8B,GACxD,WAAP,GAAO,0CAAGA,OAAO,QAAQ"}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
2
|
import { createComponent } from "../createComponent.js";
|
|
4
3
|
import { BoxComponent } from "./Box.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
const Box = createComponent(BoxComponent, {
|
|
5
|
+
name: "Webiny/Box",
|
|
6
|
+
label: "Box",
|
|
7
|
+
aiContext: "Generic container with no visual output of its own. Use it to group child elements and apply shared padding, margin, background, or other styles.",
|
|
8
|
+
group: "basic",
|
|
9
|
+
image: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M3 3v18h18V3H3zm16 16H5V5h14v14z"/></svg>',
|
|
10
|
+
acceptsChildren: true,
|
|
11
|
+
defaults: {
|
|
12
|
+
styles: {
|
|
13
|
+
paddingTop: "5px",
|
|
14
|
+
paddingRight: "5px",
|
|
15
|
+
paddingBottom: "5px",
|
|
16
|
+
paddingLeft: "5px"
|
|
17
|
+
}
|
|
17
18
|
}
|
|
18
|
-
}
|
|
19
19
|
});
|
|
20
|
+
export { Box };
|
|
20
21
|
|
|
21
22
|
//# sourceMappingURL=Box.manifest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"editorComponents/Box.manifest.js","sources":["../../src/editorComponents/Box.manifest.ts"],"sourcesContent":["\"use client\";\nimport { createComponent } from \"~/createComponent.js\";\nimport { BoxComponent } from \"./Box.js\";\n\nexport const Box = createComponent(BoxComponent, {\n name: \"Webiny/Box\",\n label: \"Box\",\n aiContext:\n \"Generic container with no visual output of its own. Use it to group child elements and apply shared padding, margin, background, or other styles.\",\n group: \"basic\",\n image: `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M3 3v18h18V3H3zm16 16H5V5h14v14z\"/></svg>`,\n acceptsChildren: true,\n defaults: {\n styles: {\n paddingTop: \"5px\",\n paddingRight: \"5px\",\n paddingBottom: \"5px\",\n paddingLeft: \"5px\"\n }\n }\n});\n"],"names":["Box","createComponent","BoxComponent"],"mappings":";;;AAIO,MAAMA,MAAMC,gBAAgBC,cAAc;IAC7C,MAAM;IACN,OAAO;IACP,WACI;IACJ,OAAO;IACP,OAAO;IACP,iBAAiB;IACjB,UAAU;QACN,QAAQ;YACJ,YAAY;YACZ,cAAc;YACd,eAAe;YACf,aAAa;QACjB;IACJ;AACJ"}
|
|
@@ -1,39 +1,30 @@
|
|
|
1
|
-
import
|
|
1
|
+
import react from "react";
|
|
2
2
|
import { contentSdk } from "@webiny/website-builder-sdk";
|
|
3
3
|
import { useDocumentFragments } from "../components/FragmentsProvider.js";
|
|
4
|
-
const findFixedFragmentByName = (fragments, name) =>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const fragments = useDocumentFragments();
|
|
12
|
-
const fragment = findFixedFragmentByName(fragments, inputs.name);
|
|
13
|
-
if (!fragment && isEditing) {
|
|
14
|
-
return /*#__PURE__*/React.createElement(FragmentPlaceholder, {
|
|
15
|
-
name: inputs.name
|
|
4
|
+
const findFixedFragmentByName = (fragments, name)=>fragments.filter((fragment)=>"fixed" === fragment.type).find((fragment)=>fragment.name === name);
|
|
5
|
+
const FragmentComponent = ({ inputs })=>{
|
|
6
|
+
const isEditing = contentSdk.isEditing();
|
|
7
|
+
const fragments = useDocumentFragments();
|
|
8
|
+
const fragment = findFixedFragmentByName(fragments, inputs.name);
|
|
9
|
+
if (!fragment && isEditing) return /*#__PURE__*/ react.createElement(FragmentPlaceholder, {
|
|
10
|
+
name: inputs.name
|
|
16
11
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, fragment.element);
|
|
20
|
-
}
|
|
21
|
-
return null;
|
|
12
|
+
if (fragment) return /*#__PURE__*/ react.createElement(react.Fragment, null, fragment.element);
|
|
13
|
+
return null;
|
|
22
14
|
};
|
|
23
|
-
const FragmentPlaceholder = ({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
}, "This is a placeholder for", fragmentName, "content coming from your frontend app.");
|
|
15
|
+
const FragmentPlaceholder = ({ name })=>{
|
|
16
|
+
const fragmentName = name ? /*#__PURE__*/ react.createElement(react.Fragment, null, "\xa0", /*#__PURE__*/ react.createElement("strong", null, name), "\xa0") : /*#__PURE__*/ react.createElement(react.Fragment, null, "\xa0");
|
|
17
|
+
return /*#__PURE__*/ react.createElement("div", {
|
|
18
|
+
style: {
|
|
19
|
+
display: "flex",
|
|
20
|
+
height: "100px",
|
|
21
|
+
backgroundColor: "#f4f4f4",
|
|
22
|
+
justifyContent: "center",
|
|
23
|
+
alignItems: "center",
|
|
24
|
+
fill: "#ffffff"
|
|
25
|
+
}
|
|
26
|
+
}, "This is a placeholder for", fragmentName, "content coming from your frontend app.");
|
|
37
27
|
};
|
|
28
|
+
export { FragmentComponent };
|
|
38
29
|
|
|
39
30
|
//# sourceMappingURL=Fragment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"editorComponents/Fragment.js","sources":["../../src/editorComponents/Fragment.tsx"],"sourcesContent":["import React from \"react\";\nimport { contentSdk } from \"@webiny/website-builder-sdk\";\nimport { useDocumentFragments } from \"~/components/FragmentsProvider.js\";\nimport type { ComponentProps } from \"~/types.js\";\nimport type { DocumentFragments } from \"~/components/FragmentsProvider.js\";\n\ntype FragmentComponentProps = ComponentProps<{\n name: string;\n}>;\n\nconst findFixedFragmentByName = (fragments: DocumentFragments, name: string) => {\n return fragments\n .filter(fragment => fragment.type === \"fixed\")\n .find(fragment => fragment.name === name);\n};\n\nexport const FragmentComponent = ({ inputs }: FragmentComponentProps) => {\n const isEditing = contentSdk.isEditing();\n const fragments = useDocumentFragments();\n const fragment = findFixedFragmentByName(fragments, inputs.name);\n\n if (!fragment && isEditing) {\n return <FragmentPlaceholder name={inputs.name} />;\n }\n\n if (fragment) {\n return <>{fragment.element}</>;\n }\n\n return null;\n};\n\nconst FragmentPlaceholder = ({ name }: { name: string }) => {\n const fragmentName = name ? (\n <>\n <strong>{name}</strong> \n </>\n ) : (\n <> </>\n );\n return (\n <div\n style={{\n display: \"flex\",\n height: \"100px\",\n backgroundColor: \"#f4f4f4\",\n justifyContent: \"center\",\n alignItems: \"center\",\n fill: \"#ffffff\"\n }}\n >\n This is a placeholder for{fragmentName}content coming from your frontend app.\n </div>\n );\n};\n"],"names":["findFixedFragmentByName","fragments","name","fragment","FragmentComponent","inputs","isEditing","contentSdk","useDocumentFragments","FragmentPlaceholder","fragmentName"],"mappings":";;;AAUA,MAAMA,0BAA0B,CAACC,WAA8BC,OACpDD,UACF,MAAM,CAACE,CAAAA,WAAYA,AAAkB,YAAlBA,SAAS,IAAI,EAChC,IAAI,CAACA,CAAAA,WAAYA,SAAS,IAAI,KAAKD;AAGrC,MAAME,oBAAoB,CAAC,EAAEC,MAAM,EAA0B;IAChE,MAAMC,YAAYC,WAAW,SAAS;IACtC,MAAMN,YAAYO;IAClB,MAAML,WAAWH,wBAAwBC,WAAWI,OAAO,IAAI;IAE/D,IAAI,CAACF,YAAYG,WACb,OAAO,WAAP,GAAO,oBAACG,qBAAmBA;QAAC,MAAMJ,OAAO,IAAI;;IAGjD,IAAIF,UACA,OAAO,WAAP,GAAO,0CAAGA,SAAS,OAAO;IAG9B,OAAO;AACX;AAEA,MAAMM,sBAAsB,CAAC,EAAEP,IAAI,EAAoB;IACnD,MAAMQ,eAAeR,OAAO,WAAPA,GACjB,0CAAE,sBACQ,oBAAC,gBAAQA,OAAc,wBAGjC,0CAAE;IAEN,OAAO,WAAP,GACI,oBAAC;QACG,OAAO;YACH,SAAS;YACT,QAAQ;YACR,iBAAiB;YACjB,gBAAgB;YAChB,YAAY;YACZ,MAAM;QACV;OACH,6BAC6BQ,cAAa;AAGnD"}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
2
|
import { createTextInput } from "@webiny/website-builder-sdk";
|
|
4
3
|
import { createComponent } from "../createComponent.js";
|
|
5
4
|
import { FragmentComponent } from "./Fragment.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
label: "Fragment",
|
|
9
|
-
group: "basic",
|
|
10
|
-
image: `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed"><path d="M120-120v-720h720v720H120Zm80-80h560v-560H200v560Zm0 0v-560 560Z"/></svg>`,
|
|
11
|
-
inputs: [createTextInput({
|
|
12
|
-
name: "name",
|
|
5
|
+
const Fragment = createComponent(FragmentComponent, {
|
|
6
|
+
name: "Webiny/Fragment",
|
|
13
7
|
label: "Fragment",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
useInAiContentGeneration: false,
|
|
9
|
+
group: "basic",
|
|
10
|
+
image: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M3 3v18h18V3H3zm16 16H5V5h14v14z"/></svg>',
|
|
11
|
+
inputs: [
|
|
12
|
+
createTextInput({
|
|
13
|
+
name: "name",
|
|
14
|
+
label: "Fragment",
|
|
15
|
+
description: "Select fragment to display.",
|
|
16
|
+
renderer: "Webiny/FragmentSelector"
|
|
17
|
+
})
|
|
18
|
+
]
|
|
17
19
|
});
|
|
20
|
+
export { Fragment };
|
|
18
21
|
|
|
19
22
|
//# sourceMappingURL=Fragment.manifest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"editorComponents/Fragment.manifest.js","sources":["../../src/editorComponents/Fragment.manifest.ts"],"sourcesContent":["\"use client\";\nimport { createTextInput } from \"@webiny/website-builder-sdk\";\nimport { createComponent } from \"~/createComponent.js\";\nimport { FragmentComponent } from \"./Fragment.js\";\n\nexport const Fragment = createComponent(FragmentComponent, {\n name: \"Webiny/Fragment\",\n label: \"Fragment\",\n useInAiContentGeneration: false,\n group: \"basic\",\n image: `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M3 3v18h18V3H3zm16 16H5V5h14v14z\"/></svg>`,\n inputs: [\n createTextInput({\n name: \"name\",\n label: \"Fragment\",\n description: \"Select fragment to display.\",\n renderer: \"Webiny/FragmentSelector\"\n })\n ]\n});\n"],"names":["Fragment","createComponent","FragmentComponent","createTextInput"],"mappings":";;;;AAKO,MAAMA,WAAWC,gBAAgBC,mBAAmB;IACvD,MAAM;IACN,OAAO;IACP,0BAA0B;IAC1B,OAAO;IACP,OAAO;IACP,QAAQ;QACJC,gBAAgB;YACZ,MAAM;YACN,OAAO;YACP,aAAa;YACb,UAAU;QACd;KACH;AACL"}
|
|
@@ -15,5 +15,5 @@ type GridProps = ComponentProps<{
|
|
|
15
15
|
stackAtBreakpoint?: string;
|
|
16
16
|
reverseWhenStacked?: boolean;
|
|
17
17
|
}>;
|
|
18
|
-
export declare const GridComponent: ({ inputs, styles, breakpoint }: GridProps) => React.JSX.Element;
|
|
18
|
+
export declare const GridComponent: ({ inputs, styles, breakpoint, breakpoints }: GridProps) => React.JSX.Element;
|
|
19
19
|
export {};
|