storyloco 1.5.3 → 1.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storyloco",
3
- "version": "1.5.3",
3
+ "version": "1.7.0",
4
4
  "description": "A collection of slick Storyblok field plugins built with Svelte 5, TypeScript, and Tailwind CSS",
5
5
  "keywords": [
6
6
  "storyblok",
@@ -1,48 +1,56 @@
1
1
  import type { Asset } from '@storyblok/field-plugin'
2
2
 
3
3
  interface BaseLink {
4
- url?: string
5
- text?: string
4
+ url?: string
5
+ text?: string
6
6
  }
7
7
 
8
- export const link_types = ["asset", "external", "email", "internal"] as const
9
- export const target_options = ["_self", "_blank", "_parent", "_top", "_new"] as const
10
- export const rel_options = ["noopener", "noreferrer", "nofollow", "noopener noreferrer", "noopener noreferrer nofollow"] as const
8
+ export const link_types = ['asset', 'external', 'email', 'internal'] as const
9
+ export const target_options = ['_self', '_blank', '_parent', '_top', '_new'] as const
10
+ export const rel_options = [
11
+ 'noopener',
12
+ 'noreferrer',
13
+ 'nofollow',
14
+ 'noopener noreferrer',
15
+ 'noopener noreferrer nofollow',
16
+ ] as const
11
17
 
12
- export type LinkType = typeof link_types[number]
13
- export type Target = typeof target_options[number]
14
- export type Rel = typeof rel_options[number]
18
+ export type LinkType = (typeof link_types)[number]
19
+ export type Target = (typeof target_options)[number]
20
+ export type Rel = (typeof rel_options)[number]
15
21
 
16
22
  export interface AssetLink extends BaseLink {
17
- type: "asset"
18
- asset?: Asset
19
- target?: Target
23
+ type: 'asset'
24
+ asset?: Asset
25
+ target?: Target
20
26
  }
21
27
 
22
28
  export interface ExternalLink extends BaseLink {
23
- type: "external"
24
- target?: Target
25
- rel?: Rel
29
+ type: 'external'
30
+ target?: Target
31
+ rel?: Rel
26
32
  }
27
33
 
28
34
  export interface EmailLink extends BaseLink {
29
- type: "email"
30
- target?: Target
31
- email?: string
32
- subject?: string
33
- body?: string
34
- cc?: string
35
- bcc?: string
35
+ type: 'email'
36
+ target?: Target
37
+ email?: string
38
+ subject?: string
39
+ body?: string
40
+ cc?: string
41
+ bcc?: string
36
42
  }
37
43
 
38
44
  export interface StoryLink extends BaseLink {
39
- type: "internal"
40
- target?: Target
41
- suffix?: string
42
- story?: {
43
- name: string
44
- published_at: string | null
45
- }
45
+ type: 'internal'
46
+ target?: Target
47
+ suffix?: string
48
+ story?: {
49
+ id: number
50
+ uuid: string
51
+ name: string
52
+ published_at: string | null
53
+ }
46
54
  }
47
55
 
48
56
  export type Link = AssetLink | ExternalLink | EmailLink | StoryLink
@@ -1,16 +1,555 @@
1
1
  import type Mux from '@mux/mux-node'
2
2
 
3
3
  export interface Video {
4
- mux_video?: Mux.Video.Assets.Asset
5
- playback_id?: string
6
- m3u8_url?: string
7
- title?: string
8
- autoplay?: boolean
9
- muted?: boolean
10
- loop?: boolean
11
- playsinline?: boolean
12
- controls?: boolean
13
- preload?: 'auto' | 'metadata' | 'none'
14
- poster?: string
4
+ mux_video?: Mux.Video.Assets.Asset
5
+ playback_id?: string
6
+ m3u8_url?: string
7
+ title?: string
8
+ autoplay?: boolean
9
+ muted?: boolean
10
+ loop?: boolean
11
+ playsinline?: boolean
12
+ controls?: boolean
13
+ preload?: 'auto' | 'metadata' | 'none'
14
+ poster?: string
15
15
  }
16
16
 
17
+ export type VimeoVideo = {
18
+ uri: string
19
+ name: string
20
+ description: string
21
+ type: string
22
+ link: string
23
+ player_embed_url: string
24
+ duration: number
25
+ width: number
26
+ language: string
27
+ height: number
28
+ embed: {
29
+ html: string
30
+ badges: {
31
+ hdr: boolean
32
+ live: {
33
+ streaming: boolean
34
+ archived: boolean
35
+ }
36
+ staff_pick: {
37
+ normal: boolean
38
+ best_of_the_month: boolean
39
+ best_of_the_year: boolean
40
+ premiere: boolean
41
+ }
42
+ vod: boolean
43
+ weekend_challenge: boolean
44
+ }
45
+ interactive: boolean
46
+ buttons: {
47
+ watchlater: boolean
48
+ share: boolean
49
+ embed: boolean
50
+ hd: boolean
51
+ fullscreen: boolean
52
+ scaling: boolean
53
+ like: boolean
54
+ }
55
+ logos: {
56
+ vimeo: boolean
57
+ custom: {
58
+ active: boolean
59
+ url: any
60
+ link: any
61
+ use_link: boolean
62
+ sticky: boolean
63
+ }
64
+ }
65
+ play_button: {
66
+ position: string
67
+ }
68
+ title: {
69
+ name: string
70
+ owner: string
71
+ portrait: string
72
+ }
73
+ end_screen: Array<any>
74
+ playbar: boolean
75
+ quality_selector: any
76
+ pip: boolean
77
+ autopip: boolean
78
+ volume: boolean
79
+ color: string
80
+ colors: {
81
+ color_one: string
82
+ color_two: string
83
+ color_three: string
84
+ color_four: string
85
+ }
86
+ event_schedule: boolean
87
+ has_cards: boolean
88
+ outro_type: string
89
+ show_timezone: boolean
90
+ cards: Array<any>
91
+ airplay: boolean
92
+ audio_tracks: boolean
93
+ chapters: boolean
94
+ chromecast: boolean
95
+ closed_captions: boolean
96
+ transcript: boolean
97
+ skipping_forward: boolean
98
+ ask_ai: boolean
99
+ uri: any
100
+ email_capture_form: Array<any>
101
+ speed: boolean
102
+ }
103
+ created_time: string
104
+ modified_time: string
105
+ release_time: string
106
+ content_rating: Array<string>
107
+ content_rating_class: string
108
+ rating_mod_locked: boolean
109
+ license: any
110
+ privacy: {
111
+ view: string
112
+ embed: string
113
+ download: boolean
114
+ add: boolean
115
+ comments: string
116
+ }
117
+ pictures: {
118
+ uri: string
119
+ active: boolean
120
+ type: string
121
+ base_link: string
122
+ sizes: Array<{
123
+ width: number
124
+ height: number
125
+ link: string
126
+ link_with_play_button: string
127
+ }>
128
+ resource_key: string
129
+ default_picture: boolean
130
+ }
131
+ tags: Array<any>
132
+ stats: {
133
+ plays: number
134
+ }
135
+ categories: Array<any>
136
+ uploader: {
137
+ pictures: {
138
+ uri: string
139
+ active: boolean
140
+ type: string
141
+ base_link: string
142
+ sizes: Array<{
143
+ width: number
144
+ height: number
145
+ link: string
146
+ }>
147
+ resource_key: string
148
+ default_picture: boolean
149
+ }
150
+ }
151
+ metadata: {
152
+ connections: {
153
+ comments: {
154
+ uri: string
155
+ options: Array<string>
156
+ total: number
157
+ }
158
+ credits: {
159
+ uri: string
160
+ options: Array<string>
161
+ total: number
162
+ }
163
+ likes: {
164
+ uri: string
165
+ options: Array<string>
166
+ total: number
167
+ }
168
+ pictures: {
169
+ uri: string
170
+ options: Array<string>
171
+ total: number
172
+ }
173
+ texttracks: {
174
+ uri: string
175
+ options: Array<string>
176
+ total: number
177
+ }
178
+ related: any
179
+ recommendations: {
180
+ uri: string
181
+ options: Array<string>
182
+ resource_signature: string
183
+ }
184
+ albums: {
185
+ uri: string
186
+ options: Array<string>
187
+ total: number
188
+ }
189
+ available_albums: {
190
+ uri: string
191
+ options: Array<string>
192
+ total: number
193
+ }
194
+ available_channels: {
195
+ uri: string
196
+ options: Array<string>
197
+ total: number
198
+ }
199
+ versions: {
200
+ uri: string
201
+ options: Array<string>
202
+ total: number
203
+ current_uri: string
204
+ resource_key: string
205
+ create_storyboard_id: string
206
+ latest_incomplete_version: any
207
+ }
208
+ }
209
+ interactions: {
210
+ watchlater: {
211
+ uri: string
212
+ options: Array<string>
213
+ added: boolean
214
+ added_time: any
215
+ }
216
+ report: {
217
+ uri: string
218
+ options: Array<string>
219
+ reason: Array<string>
220
+ }
221
+ view_team_members: {
222
+ uri: string
223
+ options: Array<string>
224
+ }
225
+ edit: {
226
+ uri: string
227
+ options: Array<string>
228
+ blocked_fields: Array<any>
229
+ }
230
+ edit_content_rating: {
231
+ uri: string
232
+ options: Array<string>
233
+ content_rating: Array<string>
234
+ }
235
+ edit_privacy: {
236
+ uri: string
237
+ options: Array<string>
238
+ content_type: string
239
+ properties: Array<{
240
+ name: string
241
+ required: boolean
242
+ options: Array<string>
243
+ }>
244
+ }
245
+ delete: {
246
+ uri: string
247
+ options: Array<string>
248
+ }
249
+ can_update_privacy_to_public: {
250
+ uri: string
251
+ options: Array<string>
252
+ }
253
+ invite: {
254
+ uri: string
255
+ options: Array<string>
256
+ }
257
+ trim: {
258
+ uri: string
259
+ options: Array<string>
260
+ }
261
+ validate: {
262
+ uri: string
263
+ options: Array<string>
264
+ }
265
+ }
266
+ is_vimeo_create: boolean
267
+ is_screen_record: boolean
268
+ }
269
+ manage_link: string
270
+ user: {
271
+ uri: string
272
+ name: string
273
+ link: string
274
+ capabilities: {
275
+ hasLiveSubscription: boolean
276
+ hasEnterpriseLihp: boolean
277
+ hasSvvTimecodedComments: boolean
278
+ hasSimplifiedEnterpriseAccount: boolean
279
+ hasManagementCapabilitiesForComments: boolean
280
+ hasDetailedVideoVersionHistory: boolean
281
+ canViewSimplifiedCommentMentions: boolean
282
+ }
283
+ location: string
284
+ gender: string
285
+ bio: string
286
+ short_bio: string
287
+ created_time: string
288
+ pictures: {
289
+ uri: string
290
+ active: boolean
291
+ type: string
292
+ base_link: string
293
+ sizes: Array<{
294
+ width: number
295
+ height: number
296
+ link: string
297
+ }>
298
+ resource_key: string
299
+ default_picture: boolean
300
+ }
301
+ websites: Array<{
302
+ uri: string
303
+ name: string
304
+ link: string
305
+ type: string
306
+ description: any
307
+ }>
308
+ metadata: {
309
+ connections: {
310
+ albums: {
311
+ uri: string
312
+ options: Array<string>
313
+ total: number
314
+ }
315
+ appearances: {
316
+ uri: string
317
+ options: Array<string>
318
+ total: number
319
+ }
320
+ categories: {
321
+ uri: string
322
+ options: Array<string>
323
+ total: number
324
+ }
325
+ channels: {
326
+ uri: string
327
+ options: Array<string>
328
+ total: number
329
+ }
330
+ feed: {
331
+ uri: string
332
+ options: Array<string>
333
+ }
334
+ followers: {
335
+ uri: string
336
+ options: Array<string>
337
+ total: number
338
+ }
339
+ following: {
340
+ uri: string
341
+ options: Array<string>
342
+ total: number
343
+ }
344
+ groups: {
345
+ uri: string
346
+ options: Array<string>
347
+ total: number
348
+ }
349
+ likes: {
350
+ uri: string
351
+ options: Array<string>
352
+ total: number
353
+ }
354
+ membership: {
355
+ uri: string
356
+ options: Array<string>
357
+ }
358
+ moderated_channels: {
359
+ uri: string
360
+ options: Array<string>
361
+ total: number
362
+ }
363
+ portfolios: {
364
+ uri: string
365
+ options: Array<string>
366
+ total: number
367
+ }
368
+ videos: {
369
+ uri: string
370
+ options: Array<string>
371
+ total: number
372
+ }
373
+ watchlater: {
374
+ uri: string
375
+ options: Array<string>
376
+ total: number
377
+ }
378
+ shared: {
379
+ uri: string
380
+ options: Array<string>
381
+ total: number
382
+ }
383
+ pictures: {
384
+ uri: string
385
+ options: Array<string>
386
+ total: number
387
+ }
388
+ watched_videos: {
389
+ uri: string
390
+ options: Array<string>
391
+ total: number
392
+ }
393
+ folders_root: {
394
+ uri: string
395
+ options: Array<string>
396
+ }
397
+ folders: {
398
+ uri: string
399
+ options: Array<string>
400
+ total: number
401
+ }
402
+ teams: {
403
+ uri: string
404
+ options: Array<string>
405
+ total: number
406
+ }
407
+ permission_policies: {
408
+ uri: string
409
+ options: Array<string>
410
+ total: number
411
+ }
412
+ block: {
413
+ uri: string
414
+ options: Array<string>
415
+ total: number
416
+ }
417
+ }
418
+ }
419
+ location_details: {
420
+ formatted_address: string
421
+ latitude: number
422
+ longitude: number
423
+ city: string
424
+ state: string
425
+ neighborhood: any
426
+ sub_locality: any
427
+ state_iso_code: any
428
+ country: string
429
+ country_iso_code: string
430
+ }
431
+ skills: Array<any>
432
+ available_for_hire: boolean
433
+ can_work_remotely: boolean
434
+ preferences: {
435
+ videos: {
436
+ rating: Array<string>
437
+ privacy: {
438
+ view: string
439
+ comments: string
440
+ embed: string
441
+ download: boolean
442
+ add: boolean
443
+ allow_share_link: boolean
444
+ }
445
+ }
446
+ webinar_registrant_lower_watermark_banner_dismissed: Array<any>
447
+ }
448
+ content_filter: Array<string>
449
+ upload_quota: {
450
+ space: {
451
+ free: number
452
+ max: number
453
+ used: number
454
+ showing: string
455
+ unit: string
456
+ }
457
+ periodic: {
458
+ period: any
459
+ unit: any
460
+ free: any
461
+ max: any
462
+ used: any
463
+ reset_date: any
464
+ }
465
+ lifetime: {
466
+ unit: string
467
+ free: number
468
+ max: number
469
+ used: number
470
+ }
471
+ }
472
+ resource_key: string
473
+ account: string
474
+ }
475
+ last_user_action_event_date: string
476
+ parent_folder: any
477
+ review_page: {
478
+ active: boolean
479
+ link: string
480
+ is_shareable: boolean
481
+ }
482
+ files: Array<{
483
+ quality: string
484
+ rendition: string
485
+ type: string
486
+ width?: number
487
+ height?: number
488
+ link: string
489
+ created_time: string
490
+ fps: number
491
+ size: number
492
+ md5: any
493
+ public_name: string
494
+ size_short: string
495
+ }>
496
+ download: Array<{
497
+ quality: string
498
+ rendition: string
499
+ type: string
500
+ width: number
501
+ height: number
502
+ expires: string
503
+ link: string
504
+ created_time: string
505
+ fps: number
506
+ size: number
507
+ md5: any
508
+ public_name: string
509
+ size_short: string
510
+ }>
511
+ app: {
512
+ name: string
513
+ uri: string
514
+ }
515
+ play: {
516
+ progressive: Array<{
517
+ type: string
518
+ codec: string
519
+ width: number
520
+ height: number
521
+ link_expiration_time: string
522
+ link: string
523
+ created_time: string
524
+ fps: number
525
+ size: number
526
+ md5: any
527
+ rendition: string
528
+ }>
529
+ hls: {
530
+ link_expiration_time: string
531
+ link: string
532
+ }
533
+ dash: {
534
+ link_expiration_time: string
535
+ link: string
536
+ }
537
+ status: string
538
+ }
539
+ status: string
540
+ resource_key: string
541
+ upload: {
542
+ status: string
543
+ link: any
544
+ upload_link: any
545
+ form: any
546
+ approach: any
547
+ size: any
548
+ redirect_url: any
549
+ }
550
+ transcode: {
551
+ status: string
552
+ }
553
+ is_playable: boolean
554
+ has_audio: boolean
555
+ }
@@ -76,7 +76,7 @@
76
76
  </button>
77
77
  {#if open}
78
78
  <fieldset
79
- class="bg-input-background border border-input rounded grid @[250px]:grid-cols-2 @sm:grid-cols-3 divide-y mt-1 overflow-hidden p-3 gap-3 max-h-54 @xl:max-h-58 overflow-y-auto"
79
+ class="bg-input-background border border-input rounded grid @[220px]:grid-cols-2 @sm:grid-cols-3 divide-y mt-1 overflow-hidden p-3 gap-3 max-h-120 overflow-y-auto"
80
80
  transition:slide
81
81
  >
82
82
  {#each themes as { value, name, primary, secondary, tertiary }, index}
@@ -109,7 +109,7 @@
109
109
  >
110
110
  <figure
111
111
  class={cn(
112
- 'flex justify-center [&>span]:size-10 @xl:[&>span]:size-12 [&>span]:border-white [&>span]:rounded-full [&>span]:border-2 [&>span:not(:first-child)]:-ml-[25%] [&>span]:relative isolate',
112
+ 'flex justify-center [&>span]:size-10 @xl:[&>span]:size-12 [&>span]:border-white [&>span]:rounded-full [&>span]:border-2 [&>span:not(:first-child)]:-ml-[25%] [&>span]:relative isolate m-auto',
113
113
  { '[&>span]:border-foreground': value === 'none' }
114
114
  )}
115
115
  >
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * AUTO-GENERATED FILE. DO NOT EDIT.
3
- * Generated by vite-storyblok-schema plugin on 2025-08-11T21:22:08.763Z.
3
+ * Generated by vite-storyblok-schema plugin on 2025-08-14T09:30:49.613Z.
4
4
  * Any changes will be overwritten.
5
5
  */
6
6
  import type { SbBlokData } from "@storyblok/svelte";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * AUTO-GENERATED FILE. DO NOT EDIT.
3
- * Generated by vite-storyblok-schema plugin on 2025-08-11T21:22:08.763Z.
3
+ * Generated by vite-storyblok-schema plugin on 2025-08-14T09:30:49.613Z.
4
4
  * Any changes will be overwritten.
5
5
  */
6
6
  export {};
@@ -4,6 +4,10 @@ interface Options {
4
4
  storyblok_space_id?: string;
5
5
  output_path?: string;
6
6
  interval_ms?: number;
7
+ filenames?: {
8
+ json?: string;
9
+ ts?: string;
10
+ };
7
11
  }
8
12
  /**
9
13
  * @remarks
@@ -14,6 +18,10 @@ interface Options {
14
18
  * @param [options.storyblok_space_id] - The space ID for the Storyblok space. Defaults to the `STORYBLOK_SPACE_ID` environment variable.
15
19
  * @param [options.output_path] - The path to output the generated files to. Defaults to 'src/lib'.
16
20
  * @param [options.interval_ms] - The interval in milliseconds to regenerate the component types. Defaults to 60000 (1 minute).
21
+ * @param [options.filenames] - Custom filenames for the generated files.
22
+ * @param [options.filenames.json] - The filename for the JSON schema file. Defaults to 'components.schema.json'.
23
+ * @param [options.filenames.ts] - The filename for the TypeScript definitions file. Defaults to 'components.schema.ts'.
24
+ *
17
25
  *
18
26
  * @example Default configuration
19
27
  * ```ts title=vite.config.ts
@@ -35,6 +43,20 @@ interface Options {
35
43
  * })]
36
44
  * })
37
45
  * ```
46
+ *
47
+ * @example Custom filenames
48
+ * ```ts title=vite.config.ts
49
+ * import { storyblok_schema } from 'kitto/vite'
50
+ *
51
+ * export default defineConfig({
52
+ * plugins: [storyblok_schema({
53
+ * filenames: {
54
+ * json: 'storyblok-components.json',
55
+ * ts: 'storyblok-types.ts'
56
+ * }
57
+ * })]
58
+ * })
59
+ * ```
38
60
  */
39
- export default function storyblok_schema({ output_path, interval_ms, storyblok_personal_access_token, storyblok_space_id, }?: Options): Plugin;
61
+ export default function storyblok_schema({ output_path, interval_ms, storyblok_personal_access_token, storyblok_space_id, filenames, }?: Options): Plugin;
40
62
  export {};
@@ -19,6 +19,10 @@ const logger = ora({
19
19
  * @param [options.storyblok_space_id] - The space ID for the Storyblok space. Defaults to the `STORYBLOK_SPACE_ID` environment variable.
20
20
  * @param [options.output_path] - The path to output the generated files to. Defaults to 'src/lib'.
21
21
  * @param [options.interval_ms] - The interval in milliseconds to regenerate the component types. Defaults to 60000 (1 minute).
22
+ * @param [options.filenames] - Custom filenames for the generated files.
23
+ * @param [options.filenames.json] - The filename for the JSON schema file. Defaults to 'components.schema.json'.
24
+ * @param [options.filenames.ts] - The filename for the TypeScript definitions file. Defaults to 'components.schema.ts'.
25
+ *
22
26
  *
23
27
  * @example Default configuration
24
28
  * ```ts title=vite.config.ts
@@ -40,8 +44,22 @@ const logger = ora({
40
44
  * })]
41
45
  * })
42
46
  * ```
47
+ *
48
+ * @example Custom filenames
49
+ * ```ts title=vite.config.ts
50
+ * import { storyblok_schema } from 'kitto/vite'
51
+ *
52
+ * export default defineConfig({
53
+ * plugins: [storyblok_schema({
54
+ * filenames: {
55
+ * json: 'storyblok-components.json',
56
+ * ts: 'storyblok-types.ts'
57
+ * }
58
+ * })]
59
+ * })
60
+ * ```
43
61
  */
44
- export default function storyblok_schema({ output_path, interval_ms, storyblok_personal_access_token, storyblok_space_id, } = {}) {
62
+ export default function storyblok_schema({ output_path, interval_ms, storyblok_personal_access_token, storyblok_space_id, filenames, } = {}) {
45
63
  let interval = null;
46
64
  return {
47
65
  name,
@@ -54,8 +72,8 @@ export default function storyblok_schema({ output_path, interval_ms, storyblok_p
54
72
  storyblok_personal_access_token =
55
73
  storyblok_personal_access_token ?? env.STORYBLOK_PERSONAL_ACCESS_TOKEN;
56
74
  storyblok_space_id = storyblok_space_id ?? env.STORYBLOK_SPACE_ID;
57
- const components_file = path.join(output_path, "components.schema.json");
58
- const schema_ts_file = path.join(output_path, "components.schema.ts");
75
+ const components_file = path.join(output_path, filenames?.json ?? "components.schema.json");
76
+ const schema_ts_file = path.join(output_path, filenames?.ts ?? "components.schema.ts");
59
77
  const seconds = interval_ms / 1000;
60
78
  logger.succeed(`Regenerating Storyblok component types every ${seconds} ${seconds === 1 ? "second" : "seconds"}`);
61
79
  generate();
@@ -83,7 +101,8 @@ export default function storyblok_schema({ output_path, interval_ms, storyblok_p
83
101
  // Make the file writable
84
102
  await $ `chmod u+w ${components_file}`.quiet().nothrow();
85
103
  // Compare existing and new components
86
- if (JSON.stringify(JSON.parse(existing_components)) === JSON.stringify(new_components))
104
+ if (existing_components &&
105
+ JSON.stringify(JSON.parse(existing_components)) === JSON.stringify(new_components))
87
106
  return;
88
107
  // Write the data to the components file
89
108
  await writeFile(components_file, JSON.stringify(new_components, null, 2));