@storyblok/astro 4.1.0-alpha.1 → 4.1.0-alpha.2
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/README.md +50 -0
- package/dist/storyblok-astro.js +18 -18
- package/dist/storyblok-astro.mjs +308 -306
- package/dist/types/index.d.ts +2 -7
- package/live-preview/handleStoryblokMessage.ts +1 -1
- package/package.json +2 -1
- package/utils/parseAstCode.ts +14 -10
package/dist/types/index.d.ts
CHANGED
|
@@ -3,12 +3,7 @@ import type { ISbConfig, ISbRichtext, ISbStoriesParams, ISbStoryData, SbRichText
|
|
|
3
3
|
export { handleStoryblokMessage } from "./live-preview/handleStoryblokMessage";
|
|
4
4
|
export { storyblokEditable, loadStoryblokBridge, RichTextResolver, RichTextSchema, } from "@storyblok/js";
|
|
5
5
|
export declare function useStoryblokApi(): StoryblokClient;
|
|
6
|
-
export declare function useStoryblok(
|
|
7
|
-
slug: string;
|
|
8
|
-
apiOptions: ISbStoriesParams;
|
|
9
|
-
bridgeOptions?: StoryblokBridgeConfigV2;
|
|
10
|
-
Astro: AstroGlobal;
|
|
11
|
-
}): Promise<ISbStoryData<import("@storyblok/js").StoryblokComponentType<string> & {
|
|
6
|
+
export declare function useStoryblok(slug: string, apiOptions: ISbStoriesParams, bridgeOptions: StoryblokBridgeConfigV2, Astro: AstroGlobal): Promise<ISbStoryData<import("@storyblok/js").StoryblokComponentType<string> & {
|
|
12
7
|
[index: string]: any;
|
|
13
8
|
}>>;
|
|
14
9
|
export declare function renderRichText(data?: ISbRichtext, options?: SbRichTextOptions): string;
|
|
@@ -58,7 +53,7 @@ export type IntegrationOptions = {
|
|
|
58
53
|
/**
|
|
59
54
|
* A boolean to enable/disable the Experimental Live Preview feature. Disabled by default.
|
|
60
55
|
*/
|
|
61
|
-
|
|
56
|
+
livePreview?: boolean;
|
|
62
57
|
};
|
|
63
58
|
export default function storyblokIntegration(options: IntegrationOptions): AstroIntegration;
|
|
64
59
|
export * from "./types";
|
|
@@ -23,7 +23,7 @@ export async function handleStoryblokMessage(event: {
|
|
|
23
23
|
const focusedElem = document.querySelector('[data-blok-focused="true"]');
|
|
24
24
|
updateDOMWithNewBody(currentBody, newBody, focusedElem);
|
|
25
25
|
};
|
|
26
|
-
const debounceDelay =
|
|
26
|
+
const debounceDelay = 500; // Adjust the delay as needed
|
|
27
27
|
clearTimeout(timeout);
|
|
28
28
|
timeout = setTimeout(debouncedGetNewHTMLBody, debounceDelay);
|
|
29
29
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storyblok/astro",
|
|
3
|
-
"version": "4.1.0-alpha.
|
|
3
|
+
"version": "4.1.0-alpha.2",
|
|
4
4
|
"description": "Official Astro integration for the Storyblok Headless CMS",
|
|
5
5
|
"main": "./dist/storyblok-astro.js",
|
|
6
6
|
"module": "./dist/storyblok-astro.mjs",
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@cypress/vite-dev-server": "^5.0.7",
|
|
65
65
|
"@rollup/plugin-dynamic-import-vars": "^2.1.2",
|
|
66
|
+
"@types/lodash.mergewith": "^4.6.9",
|
|
66
67
|
"@types/node": "20.12.11",
|
|
67
68
|
"astro": "^4.6.3",
|
|
68
69
|
"cypress": "^13.8.1",
|
package/utils/parseAstCode.ts
CHANGED
|
@@ -8,16 +8,20 @@ export function parseAstRawCode(astCode) {
|
|
|
8
8
|
srcValue?.argument?.callee?.name === "useStoryblok"
|
|
9
9
|
) {
|
|
10
10
|
const props = srcValue?.argument?.arguments;
|
|
11
|
-
props
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
if (props[1]?.type === "ObjectExpression") {
|
|
12
|
+
const apiOptions = getAstPropToObj(props[1]?.properties);
|
|
13
|
+
obj = {
|
|
14
|
+
...obj,
|
|
15
|
+
apiOptions,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
if (props[2]?.type === "ObjectExpression") {
|
|
19
|
+
const bridgeOptions = getAstPropToObj(props[2]?.properties);
|
|
20
|
+
obj = {
|
|
21
|
+
...obj,
|
|
22
|
+
bridgeOptions,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
21
25
|
}
|
|
22
26
|
}
|
|
23
27
|
|