storyloco 1.1.0 → 1.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/README.md CHANGED
@@ -11,6 +11,10 @@ A collection of slick Storyblok field plugins built with Svelte 5, TypeScript, a
11
11
  - **🎨 Theme** - Color theme selector with visual previews
12
12
  - **🔗 Link** - Link editor with support for internal, external, email, and asset links
13
13
 
14
+ ### Vite Plugins
15
+
16
+ - **📋 Storyblok Schema** - Automatically generate TypeScript types from your Storyblok components
17
+
14
18
  ### Shared Components
15
19
 
16
20
  A comprehensive UI component library built with:
@@ -47,6 +51,41 @@ import { Input, Label, Switch, Skeleton, Select, Separator } from 'storyloco/sha
47
51
  import { cn } from 'storyloco/shared/utils'
48
52
  ```
49
53
 
54
+ ### Vite Plugins
55
+
56
+ #### Storyblok Schema Plugin
57
+
58
+ Automatically generate TypeScript types from your Storyblok components during development:
59
+
60
+ ```typescript
61
+ // vite.config.ts
62
+ import { storyblok_schema } from 'storyloco/vite'
63
+
64
+ export default defineConfig({
65
+ plugins: [
66
+ storyblok_schema({
67
+ output_path: 'src/lib/storyblok',
68
+ interval_ms: 60000 // regenerate every minute
69
+ })
70
+ ]
71
+ })
72
+ ```
73
+
74
+ **Options:**
75
+
76
+ - `storyblok_personal_access_token` - Your Storyblok personal access token (defaults to `STORYBLOK_PERSONAL_ACCESS_TOKEN` env var)
77
+ - `storyblok_space_id` - Your Storyblok space ID (defaults to `STORYBLOK_SPACE_ID` env var)
78
+ - `output_path` - Where to output generated files (defaults to `src/lib`)
79
+ - `interval_ms` - How often to regenerate types (defaults to 60000ms)
80
+
81
+ The plugin will:
82
+
83
+ - Pull your component schema from Storyblok
84
+ - Generate TypeScript definitions
85
+ - Format the output with Prettier
86
+ - Lock the generated file to prevent manual edits
87
+ - Regenerate automatically when components change
88
+
50
89
  ## 🔧 Development
51
90
 
52
91
  ### Prerequisites
package/package.json CHANGED
@@ -1,75 +1,81 @@
1
1
  {
2
- "name": "storyloco",
3
- "version": "1.1.0",
4
- "description": "A collection of slick Storyblok field plugins built with Svelte 5, TypeScript, and Tailwind CSS",
5
- "keywords": [
6
- "storyblok",
7
- "field-plugin",
8
- "svelte",
9
- "typescript",
10
- "tailwind",
11
- "cms",
12
- "headless"
13
- ],
14
- "license": "MIT",
15
- "repository": {
16
- "type": "git",
17
- "url": "https://github.com/darbymanning/storyloco.git"
18
- },
19
- "main": "./src/index.ts",
20
- "types": "./src/index.ts",
21
- "files": [
22
- "src",
23
- "packages/mux/src/app.svelte",
24
- "packages/mux/types.ts",
25
- "packages/heading/src/app.svelte",
26
- "packages/heading/types.ts",
27
- "packages/theme/src/app.svelte",
28
- "packages/shared/dist"
29
- ],
30
- "exports": {
31
- ".": {
32
- "types": "./src/index.ts",
33
- "import": "./src/index.ts"
34
- },
35
- "./mux": {
36
- "types": "./packages/mux/types.ts",
37
- "import": "./packages/mux/src/app.svelte"
38
- },
39
- "./heading": {
40
- "types": "./packages/heading/types.ts",
41
- "import": "./packages/heading/src/app.svelte"
42
- },
43
- "./shared": {
44
- "types": "./packages/shared/dist/index.d.ts",
45
- "svelte": "./packages/shared/dist/index.js"
46
- },
47
- "./shared/utils": {
48
- "types": "./packages/shared/dist/utils.d.ts",
49
- "svelte": "./packages/shared/dist/utils.js"
50
- }
51
- },
52
- "devDependencies": {
53
- "@types/node": "24.0.0",
54
- "@typescript-eslint/eslint-plugin": "8.34.0",
55
- "@typescript-eslint/parser": "8.34.0",
56
- "eslint": "9.28.0",
57
- "eslint-plugin-prettier": "5.4.1",
58
- "kitto": "1.0.0-rc.12",
59
- "prettier": "3.5.3",
60
- "typescript": "5.8.3",
61
- "vite": "6.3.5"
62
- },
63
- "scripts": {
64
- "add-plugin": "npx @storyblok/field-plugin-cli@latest add --dir \"./packages\" --structure monorepo",
65
- "lint": "eslint --ext .js .",
66
- "format": "prettier . --write"
67
- },
68
- "type": "module",
69
- "workspaces": [
70
- "packages/*"
71
- ],
72
- "dependencies": {
73
- "color": "5.0.0"
74
- }
2
+ "name": "storyloco",
3
+ "version": "1.2.0",
4
+ "description": "A collection of slick Storyblok field plugins built with Svelte 5, TypeScript, and Tailwind CSS",
5
+ "keywords": [
6
+ "storyblok",
7
+ "field-plugin",
8
+ "svelte",
9
+ "typescript",
10
+ "tailwind",
11
+ "cms",
12
+ "headless"
13
+ ],
14
+ "license": "MIT",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/darbymanning/storyloco.git"
18
+ },
19
+ "main": "./src/index.ts",
20
+ "types": "./src/index.ts",
21
+ "files": [
22
+ "src",
23
+ "packages/mux/src/app.svelte",
24
+ "packages/mux/types.ts",
25
+ "packages/heading/src/app.svelte",
26
+ "packages/heading/types.ts",
27
+ "packages/theme/src/app.svelte",
28
+ "packages/shared/dist",
29
+ "packages/vite/dist"
30
+ ],
31
+ "exports": {
32
+ ".": {
33
+ "types": "./src/index.ts",
34
+ "import": "./src/index.ts"
35
+ },
36
+ "./mux": {
37
+ "types": "./packages/mux/types.ts",
38
+ "import": "./packages/mux/src/app.svelte"
39
+ },
40
+ "./heading": {
41
+ "types": "./packages/heading/types.ts",
42
+ "import": "./packages/heading/src/app.svelte"
43
+ },
44
+ "./shared": {
45
+ "types": "./packages/shared/dist/index.d.ts",
46
+ "svelte": "./packages/shared/dist/index.js"
47
+ },
48
+ "./shared/utils": {
49
+ "types": "./packages/shared/dist/utils.d.ts",
50
+ "svelte": "./packages/shared/dist/utils.js"
51
+ },
52
+ "./vite": {
53
+ "types": "./packages/vite/dist/index.d.ts",
54
+ "import": "./packages/vite/dist/index.js"
55
+ }
56
+ },
57
+ "devDependencies": {
58
+ "@types/node": "24.0.0",
59
+ "@typescript-eslint/eslint-plugin": "8.34.0",
60
+ "@typescript-eslint/parser": "8.34.0",
61
+ "eslint": "9.28.0",
62
+ "eslint-plugin-prettier": "5.4.1",
63
+ "kitto": "1.0.0-rc.12",
64
+ "prettier": "3.5.3",
65
+ "typescript": "5.8.3",
66
+ "vite": "6.3.5"
67
+ },
68
+ "scripts": {
69
+ "add-plugin": "npx @storyblok/field-plugin-cli@latest add --dir \"./packages\" --structure monorepo",
70
+ "build": "cd packages/vite && npm run build && cd ../../packages/shared && npm run build",
71
+ "lint": "eslint --ext .js .",
72
+ "format": "prettier . --write"
73
+ },
74
+ "type": "module",
75
+ "workspaces": [
76
+ "packages/*"
77
+ ],
78
+ "dependencies": {
79
+ "color": "5.0.0"
80
+ }
75
81
  }
@@ -0,0 +1,160 @@
1
+ /**
2
+ * AUTO-GENERATED FILE. DO NOT EDIT.
3
+ * Generated by the generate script on 2025-06-23T18:21:25.609Z.
4
+ * Any changes will be overwritten.
5
+ */
6
+ import type { SbBlokData } from "@storyblok/svelte";
7
+ export type Blok<T> = SbBlokData & T;
8
+ export type { StoryblokStory } from "storyblok-generate-ts";
9
+ export interface ActionsStoryblok {
10
+ title?: string;
11
+ items?: LinkStoryblok[];
12
+ anchor?: string;
13
+ _uid: string;
14
+ component: "actions";
15
+ }
16
+ export interface AssetStoryblok {
17
+ _uid?: string;
18
+ id: number | null;
19
+ alt: string | null;
20
+ name: string;
21
+ focus: string | null;
22
+ source: string | null;
23
+ title: string | null;
24
+ filename: string;
25
+ copyright: string | null;
26
+ fieldtype?: string;
27
+ meta_data?: null | {};
28
+ is_external_url?: boolean;
29
+ }
30
+ export interface CardStoryblok {
31
+ image?: AssetStoryblok;
32
+ title?: string;
33
+ subtitle?: string;
34
+ _uid: string;
35
+ component: "card";
36
+ }
37
+ export interface CardsStoryblok {
38
+ title?: string;
39
+ subtitle?: string;
40
+ items?: CardStoryblok[];
41
+ anchor?: string;
42
+ _uid: string;
43
+ component: "cards";
44
+ }
45
+ export interface RichtextStoryblok {
46
+ type: string;
47
+ content?: RichtextStoryblok[];
48
+ marks?: RichtextStoryblok[];
49
+ attrs?: unknown;
50
+ text?: string;
51
+ }
52
+ export interface HeroStoryblok {
53
+ anchor?: string;
54
+ title?: string;
55
+ subtitle?: string;
56
+ body?: RichtextStoryblok;
57
+ title_tag?: "" | "h1" | "h2" | "h3";
58
+ subtitle_tag?: number | string;
59
+ _uid: string;
60
+ component: "hero";
61
+ }
62
+ export type MultiassetStoryblok = {
63
+ alt?: string;
64
+ copyright?: string;
65
+ id: number;
66
+ filename: string;
67
+ name: string;
68
+ title?: string;
69
+ }[];
70
+ export interface LayoutStoryblok {
71
+ footer_title?: string;
72
+ footer_links?: LinkStoryblok[];
73
+ social_links?: SocialMediaStoryblok[];
74
+ contact_email?: string;
75
+ contact_tel?: string;
76
+ address?: string;
77
+ partners?: MultiassetStoryblok;
78
+ header_links?: LinkStoryblok[];
79
+ _uid: string;
80
+ component: "layout";
81
+ }
82
+ export interface LinkStoryblok {
83
+ _uid: string;
84
+ component: "link";
85
+ }
86
+ export interface NewsStoryblok {
87
+ anchor?: string;
88
+ _uid: string;
89
+ component: "news";
90
+ }
91
+ export interface PageStoryblok {
92
+ blocks?: unknown[];
93
+ _uid: string;
94
+ component: "page";
95
+ uuid?: string;
96
+ }
97
+ export interface QuoteStoryblok {
98
+ suptitle?: string;
99
+ title?: string;
100
+ subtitle?: string;
101
+ image?: AssetStoryblok;
102
+ _uid: string;
103
+ component: "quote";
104
+ }
105
+ export interface QuotesStoryblok {
106
+ items?: QuoteStoryblok[];
107
+ _uid: string;
108
+ component: "quotes";
109
+ }
110
+ export interface SocialMediaStoryblok {
111
+ platform: "" | "facebook" | "instagram" | "linkedin" | "whatsapp";
112
+ link: string;
113
+ _uid: string;
114
+ component: "social_media";
115
+ }
116
+ export type MultilinkStoryblok = {
117
+ id?: string;
118
+ cached_url?: string;
119
+ anchor?: string;
120
+ linktype?: "story";
121
+ target?: "_self" | "_blank";
122
+ } | {
123
+ url?: string;
124
+ cached_url?: string;
125
+ anchor?: string;
126
+ linktype?: "asset" | "url";
127
+ target?: "_self" | "_blank";
128
+ } | {
129
+ email?: string;
130
+ linktype?: "email";
131
+ target?: "_self" | "_blank";
132
+ };
133
+ export interface TabStoryblok {
134
+ image?: AssetStoryblok;
135
+ title?: string;
136
+ subtitle?: string;
137
+ body?: RichtextStoryblok;
138
+ cta?: string;
139
+ link?: Exclude<MultilinkStoryblok, {
140
+ linktype?: "email";
141
+ } | {
142
+ linktype?: "asset";
143
+ }>;
144
+ _uid: string;
145
+ component: "tab";
146
+ }
147
+ export interface TabsStoryblok {
148
+ items?: TabStoryblok[];
149
+ _uid: string;
150
+ component: "tabs";
151
+ }
152
+ export interface TextImageStoryblok {
153
+ anchor?: string;
154
+ image?: AssetStoryblok;
155
+ title?: string;
156
+ body?: RichtextStoryblok;
157
+ theme?: number | string;
158
+ _uid: string;
159
+ component: "text_image";
160
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * AUTO-GENERATED FILE. DO NOT EDIT.
3
+ * Generated by the generate script on 2025-06-23T18:21:25.609Z.
4
+ * Any changes will be overwritten.
5
+ */
6
+ export {};