@storyblok/js 3.1.9 → 3.2.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.
- package/LICENSE +21 -0
- package/README.md +35 -36
- package/dist/{types/modules/api.d.ts → api.d.ts} +1 -1
- package/dist/editable.d.ts +9 -0
- package/dist/index.d.ts +18 -0
- package/dist/storyblok-js.js +8 -2
- package/dist/storyblok-js.mjs +429 -378
- package/dist/types/index.d.ts +64 -13
- package/package.json +55 -63
- package/dist/types/modules/editable.d.ts +0 -9
- package/dist/types/types.d.ts +0 -63
- /package/dist/{types/modules/bridge.d.ts → bridge.d.ts} +0 -0
package/dist/types/index.d.ts
CHANGED
@@ -1,13 +1,64 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
export
|
12
|
-
|
13
|
-
|
1
|
+
import { ISbComponentType, ISbConfig, ISbStoryData, default as StoryblokJSClient } from 'storyblok-js-client';
|
2
|
+
export type StoryblokClient = StoryblokJSClient;
|
3
|
+
declare global {
|
4
|
+
interface Window {
|
5
|
+
storyblokRegisterEvent: (cb: () => void) => void;
|
6
|
+
StoryblokBridge: {
|
7
|
+
new (options?: StoryblokBridgeConfigV2): StoryblokBridgeV2;
|
8
|
+
};
|
9
|
+
}
|
10
|
+
}
|
11
|
+
export interface SbInitResult {
|
12
|
+
storyblokApi?: StoryblokClient;
|
13
|
+
}
|
14
|
+
export type SbPluginFactory = (options: SbSDKOptions) => any;
|
15
|
+
export type SbBlokKeyDataTypes = string | number | object | boolean | undefined;
|
16
|
+
export interface SbBlokData extends ISbComponentType<string> {
|
17
|
+
[index: string]: SbBlokKeyDataTypes;
|
18
|
+
}
|
19
|
+
export interface SbRichTextOptions {
|
20
|
+
schema?: ISbConfig['richTextSchema'];
|
21
|
+
resolver?: ISbConfig['componentResolver'];
|
22
|
+
}
|
23
|
+
export interface SbSDKOptions {
|
24
|
+
bridge?: boolean;
|
25
|
+
accessToken?: string;
|
26
|
+
use?: any[];
|
27
|
+
apiOptions?: ISbConfig;
|
28
|
+
richText?: SbRichTextOptions;
|
29
|
+
bridgeUrl?: string;
|
30
|
+
}
|
31
|
+
export interface ISbEventPayload<S extends ISbComponentType<string> = any> {
|
32
|
+
action: 'customEvent' | 'published' | 'input' | 'change' | 'unpublished' | 'enterEditmode';
|
33
|
+
event?: string;
|
34
|
+
story?: ISbStoryData<S>;
|
35
|
+
slug?: string;
|
36
|
+
slugChanged?: boolean;
|
37
|
+
storyId?: number;
|
38
|
+
reload?: boolean;
|
39
|
+
}
|
40
|
+
export interface StoryblokBridgeConfigV2 {
|
41
|
+
resolveRelations?: string | string[];
|
42
|
+
customParent?: string;
|
43
|
+
preventClicks?: boolean;
|
44
|
+
language?: string;
|
45
|
+
resolveLinks?: 'url' | 'story' | '0' | '1' | 'link';
|
46
|
+
}
|
47
|
+
export interface StoryblokBridgeV2 {
|
48
|
+
pingEditor: (event: any) => void;
|
49
|
+
isInEditor: () => boolean;
|
50
|
+
enterEditmode: () => void;
|
51
|
+
on: (event: 'customEvent' | 'published' | 'input' | 'change' | 'unpublished' | 'enterEditmode' | string[], callback: (payload?: ISbEventPayload) => void) => void;
|
52
|
+
}
|
53
|
+
export type { ArrayFn, AsyncFn, ISbAlternateObject, // previously AlternateObject
|
54
|
+
ISbCache, // previously StoryblokCache
|
55
|
+
ISbComponentType as StoryblokComponentType, ISbConfig, // previously StoryblokConfig
|
56
|
+
ISbContentMangmntAPI, ISbDimensions, ISbError, ISbManagmentApiResult, // previously StoryblokManagmentApiResult
|
57
|
+
ISbNode, ISbResponse, ISbResult, // previously StoryblokResult
|
58
|
+
ISbRichtext, // previously Richtext
|
59
|
+
ISbSchema, ISbStories, // previously Stories
|
60
|
+
ISbStoriesParams, // previously StoriesParams
|
61
|
+
ISbStory, // previously Story
|
62
|
+
ISbStoryData, // previously StoryData
|
63
|
+
ISbStoryParams, // previously StoryParams
|
64
|
+
ISbThrottle, ISbThrottledRequest, } from 'storyblok-js-client';
|
package/package.json
CHANGED
@@ -1,90 +1,82 @@
|
|
1
1
|
{
|
2
2
|
"name": "@storyblok/js",
|
3
|
-
"
|
3
|
+
"type": "module",
|
4
|
+
"version": "3.2.1",
|
5
|
+
"private": false,
|
6
|
+
"packageManager": "pnpm@9.15.1",
|
4
7
|
"description": "SDK to integrate Storyblok into your project using JavaScript.",
|
5
|
-
"
|
6
|
-
"
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
"license": "MIT",
|
9
|
+
"repository": {
|
10
|
+
"type": "git",
|
11
|
+
"url": "https://github.com/storyblok/storyblok-js"
|
12
|
+
},
|
13
|
+
"bugs": {
|
14
|
+
"url": "https://github.com/storyblok/storyblok-js/issues"
|
15
|
+
},
|
11
16
|
"exports": {
|
12
17
|
".": {
|
13
|
-
"types": "./dist/
|
18
|
+
"types": "./dist/index.d.ts",
|
14
19
|
"import": "./dist/storyblok-js.mjs",
|
15
20
|
"require": "./dist/storyblok-js.js"
|
16
21
|
}
|
17
22
|
},
|
23
|
+
"main": "./dist/storyblok-js.js",
|
24
|
+
"module": "./dist/storyblok-js.mjs",
|
25
|
+
"types": "./dist/index.d.ts",
|
26
|
+
"files": [
|
27
|
+
"dist"
|
28
|
+
],
|
18
29
|
"scripts": {
|
19
|
-
"dev": "vite
|
20
|
-
"build": "vite build
|
21
|
-
"test": "
|
22
|
-
"test:unit": "vitest
|
30
|
+
"dev": "vite",
|
31
|
+
"build": "vite build",
|
32
|
+
"test": "pnpm run test:unit:ci && pnpm run test:e2e",
|
33
|
+
"test:unit": "vitest",
|
34
|
+
"test:unit:ci": "vitest run",
|
35
|
+
"test:unit:ui": "vitest --ui",
|
23
36
|
"test:e2e": "start-server-and-test cy:playground http://localhost:5173/ cy:run",
|
24
37
|
"test:e2e-watch": "start-server-and-test cy:playground http://localhost:5173/ cy:open",
|
25
|
-
"cy:playground": "
|
38
|
+
"cy:playground": "pnpm --filter='./playground/vanilla' dev",
|
39
|
+
"lint": "eslint .",
|
40
|
+
"lint:fix": "eslint . --fix",
|
26
41
|
"cy:run": "cypress run",
|
27
|
-
"cy:open": "cypress open"
|
28
|
-
"prepublishOnly": "npm run build && cp ../README.md ./"
|
42
|
+
"cy:open": "cypress open"
|
29
43
|
},
|
30
44
|
"dependencies": {
|
31
|
-
"@storyblok/richtext": "
|
32
|
-
"storyblok-js-client": "
|
45
|
+
"@storyblok/richtext": "3.0.2",
|
46
|
+
"storyblok-js-client": "6.10.6"
|
33
47
|
},
|
34
48
|
"devDependencies": {
|
49
|
+
"@commitlint/cli": "^19.6.1",
|
50
|
+
"@commitlint/config-conventional": "^19.6.0",
|
51
|
+
"@storyblok/eslint-config": "^0.3.0",
|
35
52
|
"@tsconfig/recommended": "^1.0.8",
|
36
|
-
"
|
37
|
-
"
|
38
|
-
"eslint
|
39
|
-
"
|
40
|
-
"
|
41
|
-
"
|
42
|
-
"
|
53
|
+
"@types/node": "^22.10.2",
|
54
|
+
"cypress": "^13.17.0",
|
55
|
+
"eslint": "^9.17.0",
|
56
|
+
"eslint-plugin-cypress": "^4.1.0",
|
57
|
+
"kolorist": "^1.8.0",
|
58
|
+
"pathe": "^1.1.2",
|
59
|
+
"simple-git-hooks": "^2.11.1",
|
60
|
+
"start-server-and-test": "^2.0.9",
|
61
|
+
"typescript": "^5.7.2",
|
62
|
+
"vite": "^6.0.5",
|
63
|
+
"vite-plugin-banner": "^0.8.0",
|
64
|
+
"vite-plugin-dts": "^4.4.0",
|
65
|
+
"vite-plugin-qrcode": "^0.2.3",
|
66
|
+
"vitest": "^2.1.8"
|
43
67
|
},
|
44
|
-
"
|
45
|
-
"
|
46
|
-
|
47
|
-
"@babel/preset-env",
|
48
|
-
{
|
49
|
-
"targets": {
|
50
|
-
"node": "current"
|
51
|
-
}
|
52
|
-
}
|
53
|
-
]
|
68
|
+
"commitlint": {
|
69
|
+
"extends": [
|
70
|
+
"@commitlint/config-conventional"
|
54
71
|
]
|
55
72
|
},
|
56
|
-
"jest": {
|
57
|
-
"moduleFileExtensions": [
|
58
|
-
"js",
|
59
|
-
"json"
|
60
|
-
],
|
61
|
-
"transform": {
|
62
|
-
"^.+\\.js$": "babel-jest"
|
63
|
-
}
|
64
|
-
},
|
65
73
|
"release": {
|
66
74
|
"branches": [
|
67
|
-
"main"
|
68
|
-
{
|
69
|
-
"name": "next",
|
70
|
-
"prerelease": true
|
71
|
-
},
|
72
|
-
{
|
73
|
-
"name": "beta",
|
74
|
-
"prerelease": true
|
75
|
-
}
|
75
|
+
"main"
|
76
76
|
]
|
77
77
|
},
|
78
|
-
"
|
79
|
-
"
|
80
|
-
"
|
81
|
-
},
|
82
|
-
"author": "Storyblok",
|
83
|
-
"bugs": {
|
84
|
-
"url": "https://github.com/storyblok/storyblok-js/issues"
|
85
|
-
},
|
86
|
-
"homepage": "https://github.com/storyblok/storyblok-js",
|
87
|
-
"publishConfig": {
|
88
|
-
"access": "public"
|
78
|
+
"simple-git-hooks": {
|
79
|
+
"pre-commit": "pnpm lint",
|
80
|
+
"pre-push": "pnpm commitlint --last --verbose"
|
89
81
|
}
|
90
82
|
}
|
package/dist/types/types.d.ts
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
import StoryblokJSClient, { ISbConfig, ISbComponentType, ISbStoryData } from "storyblok-js-client";
|
2
|
-
export type StoryblokClient = StoryblokJSClient;
|
3
|
-
declare global {
|
4
|
-
interface Window {
|
5
|
-
storyblokRegisterEvent: (cb: Function) => void;
|
6
|
-
StoryblokBridge: {
|
7
|
-
new (options?: StoryblokBridgeConfigV2): StoryblokBridgeV2;
|
8
|
-
};
|
9
|
-
}
|
10
|
-
}
|
11
|
-
export interface SbInitResult {
|
12
|
-
storyblokApi?: StoryblokClient;
|
13
|
-
}
|
14
|
-
export type SbPluginFactory = (options: SbSDKOptions) => any;
|
15
|
-
export type SbBlokKeyDataTypes = string | number | object | boolean | undefined;
|
16
|
-
export interface SbBlokData extends ISbComponentType<string> {
|
17
|
-
[index: string]: SbBlokKeyDataTypes;
|
18
|
-
}
|
19
|
-
export interface SbRichTextOptions {
|
20
|
-
schema?: ISbConfig["richTextSchema"];
|
21
|
-
resolver?: ISbConfig["componentResolver"];
|
22
|
-
}
|
23
|
-
export interface SbSDKOptions {
|
24
|
-
bridge?: boolean;
|
25
|
-
accessToken?: string;
|
26
|
-
use?: any[];
|
27
|
-
apiOptions?: ISbConfig;
|
28
|
-
richText?: SbRichTextOptions;
|
29
|
-
bridgeUrl?: string;
|
30
|
-
}
|
31
|
-
export interface ISbEventPayload<S extends ISbComponentType<string> = any> {
|
32
|
-
action: "customEvent" | "published" | "input" | "change" | "unpublished" | "enterEditmode";
|
33
|
-
event?: string;
|
34
|
-
story?: ISbStoryData<S>;
|
35
|
-
slug?: string;
|
36
|
-
slugChanged?: boolean;
|
37
|
-
storyId?: number;
|
38
|
-
reload?: boolean;
|
39
|
-
}
|
40
|
-
export interface StoryblokBridgeConfigV2 {
|
41
|
-
resolveRelations?: string | string[];
|
42
|
-
customParent?: string;
|
43
|
-
preventClicks?: boolean;
|
44
|
-
language?: string;
|
45
|
-
resolveLinks?: "url" | "story" | "0" | "1" | "link";
|
46
|
-
}
|
47
|
-
export interface StoryblokBridgeV2 {
|
48
|
-
pingEditor: (event: any) => void;
|
49
|
-
isInEditor: () => boolean;
|
50
|
-
enterEditmode: () => void;
|
51
|
-
on: (event: "customEvent" | "published" | "input" | "change" | "unpublished" | "enterEditmode" | string[], callback: (payload?: ISbEventPayload) => void) => void;
|
52
|
-
}
|
53
|
-
export type { ISbConfig, // previously StoryblokConfig
|
54
|
-
ISbCache, // previously StoryblokCache
|
55
|
-
ISbResult, // previously StoryblokResult
|
56
|
-
ISbResponse, ISbError, ISbNode, ISbSchema, ISbThrottle, ISbThrottledRequest, AsyncFn, ArrayFn, ISbContentMangmntAPI, ISbManagmentApiResult, // previously StoryblokManagmentApiResult
|
57
|
-
ISbStories, // previously Stories
|
58
|
-
ISbStory, // previously Story
|
59
|
-
ISbDimensions, ISbComponentType as StoryblokComponentType, ISbStoryData, // previously StoryData
|
60
|
-
ISbAlternateObject, // previously AlternateObject
|
61
|
-
ISbStoriesParams, // previously StoriesParams
|
62
|
-
ISbStoryParams, // previously StoryParams
|
63
|
-
ISbRichtext, } from "storyblok-js-client";
|
File without changes
|