storyloco 2.10.0 → 2.11.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.
Files changed (31) hide show
  1. package/README.md +24 -3
  2. package/package.json +13 -9
  3. package/packages/shared/dist/components/ui/button/button.svelte.d.ts +33 -33
  4. package/packages/shared/dist/components/ui/select/select-group.svelte +1 -1
  5. package/packages/shared/dist/components/ui/textarea/textarea.svelte +1 -2
  6. package/packages/vite/dist/editor/block_bar.svelte +9 -9
  7. package/packages/vite/dist/editor/client.d.ts +6 -2
  8. package/packages/vite/dist/editor/client.js +9 -4
  9. package/packages/vite/dist/editor/comments.svelte +12 -11
  10. package/packages/vite/dist/editor/compare.svelte +7 -3
  11. package/packages/vite/dist/editor/content.js +2 -0
  12. package/packages/vite/dist/editor/edit_bar.svelte +25 -19
  13. package/packages/vite/dist/editor/edit_bar.svelte.d.ts +3 -3
  14. package/packages/vite/dist/editor/image_picker.svelte +9 -10
  15. package/packages/vite/dist/editor/inspector.svelte +18 -12
  16. package/packages/vite/dist/editor/overlay.js +35 -17
  17. package/packages/vite/dist/editor/richtext.js +25 -22
  18. package/packages/vite/dist/editor/server.d.ts +1 -1
  19. package/packages/vite/dist/editor/server.js +11 -11
  20. package/packages/vite/dist/editor/time_machine.svelte +52 -30
  21. package/packages/vite/dist/editor/tools.svelte +29 -21
  22. package/packages/vite/dist/hooks.d.ts +1 -1
  23. package/packages/vite/dist/hooks.js +1 -2
  24. package/packages/vite/dist/kit.d.ts +22 -0
  25. package/packages/vite/dist/kit.js +1 -0
  26. package/packages/vite/dist/middleware.d.ts +37 -0
  27. package/packages/vite/dist/middleware.js +43 -0
  28. package/packages/vite/dist/redirects/handle.d.ts +1 -1
  29. package/packages/vite/dist/server.d.ts +4 -4
  30. package/packages/vite/dist/storyblok.svelte.d.ts +6 -4
  31. package/packages/vite/dist/storyblok.svelte.js +22 -10
package/README.md CHANGED
@@ -115,6 +115,19 @@ API methods await it, so you never call it on the server. `components` takes the
115
115
  `import.meta.glob`: Vite has to see the literal pattern to rewrite it, so the glob has to stay
116
116
  at your call site rather than move into the client.
117
117
 
118
+ `api` goes to the SDK as its `apiOptions`. To keep the token off the browser, read through a
119
+ proxy of your own that adds it, and give the client a stand-in:
120
+
121
+ ```typescript
122
+ export const client = new StoryblokClient({
123
+ token: 'proxy',
124
+ // the SDK wants a whole URL
125
+ api: { endpoint: `${browser ? location.origin : 'http://localhost'}/api/storyblok` }
126
+ })
127
+ ```
128
+
129
+ The editor then takes the real token from `STORYBLOK_ACCESS_TOKEN`.
130
+
118
131
  `client.handle_error` is on the instance, so `.catch(client.handle_error)` works without
119
132
  wrapping anything.
120
133
 
@@ -366,9 +379,10 @@ any address to sign in; once signed in, the badge shows on every page, and ⌘
366
379
  edit mode on and off. In development the badge is always there.
367
380
 
368
381
  Links inside content don't navigate in edit mode; hold ⌘ or Ctrl to follow one. Match the
369
- editor to a site with `--storyloco-bar-bg`, `-ink`, `-muted`, `-line`, `-font` and
370
- `--storyloco-accent`, or build a bar of your own from `editor`, `set_editing`, `publish`,
371
- `signin` and `signout`.
382
+ editor to a site with `--editor-bg`, `-ink`, `-muted`, `-line`, `-shadow`, `-font`,
383
+ `--editor-accent` (and `-accent-ink`), `--editor-good`, `--editor-danger`, and `--editor-pill`
384
+ for the toast and the format bar, or build a bar of your own from `editor`, `set_editing`,
385
+ `publish`, `signin` and `signout`.
372
386
 
373
387
  `bun run smoke <site url>…` (in `packages/vite`) checks each site loads and, signed in, that a
374
388
  click on a block opens its settings. Sign in once per site with `--signin`, which opens a
@@ -669,6 +683,13 @@ MIT License - feel free to use this however you want, you absolute legend! 🎯
669
683
  4. Push to the branch (`git push origin feature/amazing-feature`)
670
684
  5. Open a Pull Request
671
685
 
686
+ ### Releasing
687
+
688
+ A release is a merge. Label a PR `release:patch`, `release:minor` or `release:major` before merging
689
+ it, and the Release workflow bumps the version, checks and builds it, commits "Release X.Y.Z: <the
690
+ PR's title>" to main with its tag, and publishes it to npm through trusted publishing, with no
691
+ token or login. To release main as it stands, run Actions → Release → Run workflow.
692
+
672
693
  ---
673
694
 
674
695
  Built with ❤️ and a lot of swearing by the Storyloco team
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storyloco",
3
- "version": "2.10.0",
3
+ "version": "2.11.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",
@@ -89,6 +89,10 @@
89
89
  "svelte": "./packages/vite/dist/editor/index.js",
90
90
  "import": "./packages/vite/dist/editor/index.js"
91
91
  },
92
+ "./middleware": {
93
+ "types": "./packages/vite/dist/middleware.d.ts",
94
+ "import": "./packages/vite/dist/middleware.js"
95
+ },
92
96
  "./editor/server": {
93
97
  "types": "./packages/vite/dist/editor/server.d.ts",
94
98
  "import": "./packages/vite/dist/editor/server.js"
@@ -121,19 +125,19 @@
121
125
  }
122
126
  },
123
127
  "devDependencies": {
124
- "@types/node": "26.1.1",
125
- "@typescript-eslint/eslint-plugin": "8.65.0",
126
- "@typescript-eslint/parser": "8.65.0",
127
- "kitto": "1.6.0",
128
- "oxfmt": "0.59.0",
128
+ "@types/node": "26.6.5",
129
+ "@typescript-eslint/eslint-plugin": "8.72.0",
130
+ "@typescript-eslint/parser": "8.72.0",
131
+ "kitto": "1.16.1",
132
+ "oxfmt": "0.74.0",
129
133
  "typescript": "6.0.3",
130
- "vite": "7.2.2"
134
+ "vite": "8.3.5"
131
135
  },
132
136
  "peerDependencies": {
133
137
  "@storyblok/svelte": "7.2.2",
134
138
  "@storyblok/field-plugin": "^1.7.1",
135
139
  "svelte": "^5.0.0",
136
- "@sveltejs/kit": "^2.0.0",
140
+ "@sveltejs/kit": "^2.0.0 || ^3.0.0",
137
141
  "storyblok-js-client": "^7.0.0"
138
142
  },
139
143
  "scripts": {
@@ -173,7 +177,7 @@
173
177
  "@tiptap/pm": "^3.32.0",
174
178
  "@tiptap/y-tiptap": "^3.0.10",
175
179
  "ora": "9.4.1",
176
- "path-to-regexp": "8.4.2",
180
+ "path-to-regexp": "9.0.0",
177
181
  "y-protocols": "^1.0.7",
178
182
  "yjs": "^13.6.33"
179
183
  }
@@ -1,52 +1,52 @@
1
1
  import { type WithElementRef } from '../../../utils.js';
2
2
  import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
3
3
  import { type VariantProps } from 'tailwind-variants';
4
- export declare const variants: import("tailwind-variants").TVReturnType<{
4
+ export declare const variants: import("tailwind-variants/dist/types.cjs").TVReturnType<{
5
5
  variant: {
6
- default: string;
7
- destructive: string;
8
- outline: string;
9
- secondary: string;
10
- ghost: string;
11
- link: string;
6
+ default: "bg-tertiary text-tertiary-foreground shadow-xs hover:bg-tertiary/90";
7
+ destructive: "bg-destructive shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 text-white";
8
+ outline: "bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 border";
9
+ secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80 border";
10
+ ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-secondary-foreground/10";
11
+ link: "text-primary underline-offset-4 hover:underline";
12
12
  };
13
13
  size: {
14
- default: string;
15
- sm: string;
16
- lg: string;
17
- icon: string;
14
+ default: "h-9 px-4 py-2 has-[>svg]:px-3";
15
+ sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5";
16
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4";
17
+ icon: "size-9";
18
18
  };
19
19
  }, undefined, "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium outline-none transition-all focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 relative cursor-pointer", {
20
20
  variant: {
21
- default: string;
22
- destructive: string;
23
- outline: string;
24
- secondary: string;
25
- ghost: string;
26
- link: string;
21
+ default: "bg-tertiary text-tertiary-foreground shadow-xs hover:bg-tertiary/90";
22
+ destructive: "bg-destructive shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 text-white";
23
+ outline: "bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 border";
24
+ secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80 border";
25
+ ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-secondary-foreground/10";
26
+ link: "text-primary underline-offset-4 hover:underline";
27
27
  };
28
28
  size: {
29
- default: string;
30
- sm: string;
31
- lg: string;
32
- icon: string;
29
+ default: "h-9 px-4 py-2 has-[>svg]:px-3";
30
+ sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5";
31
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4";
32
+ icon: "size-9";
33
33
  };
34
- }, undefined, import("tailwind-variants").TVReturnType<{
34
+ }, undefined, import("tailwind-variants/dist/types.cjs").TVReturnTypeLike<{
35
35
  variant: {
36
- default: string;
37
- destructive: string;
38
- outline: string;
39
- secondary: string;
40
- ghost: string;
41
- link: string;
36
+ default: "bg-tertiary text-tertiary-foreground shadow-xs hover:bg-tertiary/90";
37
+ destructive: "bg-destructive shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 text-white";
38
+ outline: "bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 border";
39
+ secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80 border";
40
+ ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-secondary-foreground/10";
41
+ link: "text-primary underline-offset-4 hover:underline";
42
42
  };
43
43
  size: {
44
- default: string;
45
- sm: string;
46
- lg: string;
47
- icon: string;
44
+ default: "h-9 px-4 py-2 has-[>svg]:px-3";
45
+ sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5";
46
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4";
47
+ icon: "size-9";
48
48
  };
49
- }, undefined, "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium outline-none transition-all focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 relative cursor-pointer", unknown, unknown, undefined>>;
49
+ }, undefined>>;
50
50
  export type ButtonVariant = VariantProps<typeof variants>['variant'];
51
51
  export type ButtonSize = VariantProps<typeof variants>['size'];
52
52
  export type ButtonProps = WithElementRef<HTMLButtonAttributes> & WithElementRef<HTMLAnchorAttributes> & {
@@ -4,4 +4,4 @@
4
4
  let { ref = $bindable(null), ...restProps }: SelectPrimitive.GroupProps = $props()
5
5
  </script>
6
6
 
7
- <SelectPrimitive.Group data-slot="select-group" {...restProps} />
7
+ <SelectPrimitive.Group bind:ref data-slot="select-group" {...restProps} />
@@ -18,5 +18,4 @@
18
18
  className
19
19
  )}
20
20
  bind:value
21
- {...restProps}
22
- ></textarea>
21
+ {...restProps}></textarea>
@@ -458,13 +458,13 @@
458
458
  /* light or dark as the person prefers, whatever scheme the site uses */
459
459
  color-scheme: light dark;
460
460
 
461
- --bg: var(--storyloco-bar-bg, #fff);
462
- --ink: var(--storyloco-bar-ink, #1b243f);
463
- --muted: var(--storyloco-bar-muted, #6b7280);
464
- --line: var(--storyloco-bar-line, rgb(27 36 63 / 0.12));
465
- --accent: var(--storyloco-accent, #05807f);
466
- --danger: var(--storyloco-danger, #e5484d);
467
- --shadow: var(--storyloco-bar-shadow, 0 0 0 1px var(--line), 0 2px 8px rgb(27 36 63 / 0.08));
461
+ --bg: var(--editor-bg, #fff);
462
+ --ink: var(--editor-ink, #1b243f);
463
+ --muted: var(--editor-muted, #6b7280);
464
+ --line: var(--editor-line, rgb(27 36 63 / 0.12));
465
+ --accent: var(--editor-accent, #05807f);
466
+ --danger: var(--editor-danger, #e5484d);
467
+ --shadow: var(--editor-shadow, 0 0 0 1px var(--line), 0 2px 8px rgb(27 36 63 / 0.08));
468
468
 
469
469
  background: var(--bg);
470
470
  border-radius: 0.75rem;
@@ -472,7 +472,7 @@
472
472
  var(--shadow),
473
473
  0 4px 16px rgb(0 0 0 / 0.12);
474
474
  color: var(--ink);
475
- font: var(--storyloco-bar-font, 500 0.8125rem/1.25 system-ui, sans-serif);
475
+ font: var(--editor-font, 500 0.8125rem/1.25 system-ui, sans-serif);
476
476
  max-inline-size: min(20rem, 100vw - 1rem);
477
477
  padding: 0.25rem;
478
478
  position: fixed;
@@ -494,7 +494,7 @@
494
494
  }
495
495
 
496
496
  .drop {
497
- background: var(--storyloco-accent, #05807f);
497
+ background: var(--editor-accent, #05807f);
498
498
  border-radius: 1px;
499
499
  box-shadow: 0 0 0 2px rgb(255 255 255 / 0.8);
500
500
  pointer-events: none;
@@ -69,7 +69,7 @@ export declare function follow(id: string | null): void;
69
69
  /** Run `listener` whenever following starts or stops */
70
70
  export declare function on_follow(listener: () => void): () => boolean;
71
71
  /** Whether a page connected its story, so the overlay knows to work it out itself */
72
- export declare const connected_story: () => ISbStoryData<import("storyblok-js-client").ISbComponentType<string> & {
72
+ export declare const connected_story: () => ISbStoryData<import("@storyblok/svelte").StoryblokComponentType<string> & {
73
73
  [index: string]: any;
74
74
  }> | null;
75
75
  /** Run `listener` after each client-side navigation, which the edit bar reports */
@@ -153,7 +153,11 @@ export declare function on_sent(listener: (change: Change) => void): () => boole
153
153
  * Send a change to the `editor` hook, then reload the page's data so it shows; null if it didn't
154
154
  * save. A `shared` change, typed by several people at once, isn't any one of theirs to undo.
155
155
  */
156
- export declare function send(change: Change, as?: "change" | "undo" | "redo" | "shared"): Promise<Record<string, unknown> | null>;
156
+ export declare function send(change: Change, as?: "change" | "undo" | "redo" | "shared",
157
+ /** `false` while the change is being typed where it shows: the page already shows it, and reloading everything for each pause is what drags */
158
+ { again }?: {
159
+ again?: boolean;
160
+ }): Promise<Record<string, unknown> | null>;
157
161
  /** Why the last change didn't save, for the overlay's own messages */
158
162
  export declare const last_problem: () => string | null;
159
163
  /** Undo the last change made from this page; what it undid, or null with nothing to undo or if it failed */
@@ -318,8 +318,10 @@ const touched = new Set();
318
318
  /** The page's data again, as after a save, for a change made somewhere else */
319
319
  export async function refresh() {
320
320
  // only the browser ever saves, so the server and tests never load this
321
- const { invalidateAll } = await import("$app/navigation");
322
- await invalidateAll();
321
+ // refreshAll on SvelteKit 3, which deprecates invalidateAll; it keeps page.state too
322
+ const navigation = await import("$app/navigation");
323
+ const all = navigation;
324
+ await (all.refreshAll ?? all.invalidateAll)();
323
325
  for (const listener of saved_listeners)
324
326
  listener();
325
327
  }
@@ -333,7 +335,9 @@ export function on_sent(listener) {
333
335
  * Send a change to the `editor` hook, then reload the page's data so it shows; null if it didn't
334
336
  * save. A `shared` change, typed by several people at once, isn't any one of theirs to undo.
335
337
  */
336
- export async function send(change, as = "change") {
338
+ export async function send(change, as = "change",
339
+ /** `false` while the change is being typed where it shows: the page already shows it, and reloading everything for each pause is what drags */
340
+ { again = true } = {}) {
337
341
  pending++;
338
342
  changed();
339
343
  try {
@@ -356,7 +360,8 @@ export async function send(change, as = "change") {
356
360
  touched.add(change.story);
357
361
  for (const listener of sent_listeners)
358
362
  listener(change);
359
- await refresh();
363
+ if (again)
364
+ await refresh();
360
365
  return reply;
361
366
  }
362
367
  catch (e) {
@@ -602,8 +602,7 @@
602
602
  oninput={typed}
603
603
  onkeydown={(event) => keys(event, () => post(thread))}
604
604
  onblur={() => ((suggest = null), (menu = null))}
605
- aria-label={thread ? "Reply" : "Comment"}
606
- ></textarea>
605
+ aria-label={thread ? "Reply" : "Comment"}></textarea>
607
606
  <div class="row">
608
607
  {#if key && !subscribed && "Notification" in globalThis}
609
608
  <button type="button" class="quiet" onclick={notify_me}>Notify me of replies</button>
@@ -826,12 +825,12 @@
826
825
  /* light or dark as the person prefers, whatever scheme the site uses */
827
826
  color-scheme: light dark;
828
827
 
829
- --bg: var(--storyloco-bar-bg, #fff);
830
- --ink: var(--storyloco-bar-ink, #1b243f);
831
- --muted: var(--storyloco-bar-muted, #6b7280);
832
- --line: var(--storyloco-bar-line, rgb(27 36 63 / 0.12));
833
- --accent: var(--storyloco-accent, #05807f);
834
- --danger: var(--storyloco-danger, #e5484d);
828
+ --bg: var(--editor-bg, #fff);
829
+ --ink: var(--editor-ink, #1b243f);
830
+ --muted: var(--editor-muted, #6b7280);
831
+ --line: var(--editor-line, rgb(27 36 63 / 0.12));
832
+ --accent: var(--editor-accent, #05807f);
833
+ --danger: var(--editor-danger, #e5484d);
835
834
 
836
835
  color: var(--ink);
837
836
  font:
@@ -916,7 +915,7 @@
916
915
 
917
916
  .count {
918
917
  /* the edit bar's own dark, in a light theme or a dark one, so white reads on it */
919
- background: var(--storyloco-pill-bg, #1b243f);
918
+ background: var(--editor-pill, #1b243f);
920
919
  color: #fff;
921
920
  border-radius: 999px;
922
921
  font-size: 0.5625rem;
@@ -1093,7 +1092,9 @@
1093
1092
 
1094
1093
  .who {
1095
1094
  flex: 1;
1095
+ margin-block: -0.15em;
1096
1096
  overflow: hidden;
1097
+ padding-block: 0.15em;
1097
1098
  text-overflow: ellipsis;
1098
1099
  white-space: nowrap;
1099
1100
  }
@@ -1121,7 +1122,7 @@
1121
1122
  background: var(--accent);
1122
1123
  border: 0;
1123
1124
  border-radius: 999px;
1124
- color: var(--storyloco-accent-ink, #fff);
1125
+ color: var(--editor-accent-ink, #fff);
1125
1126
  cursor: pointer;
1126
1127
  font: inherit;
1127
1128
  padding: 0.3125rem 0.875rem;
@@ -1370,7 +1371,7 @@
1370
1371
  }
1371
1372
 
1372
1373
  .hint {
1373
- background: var(--storyloco-pill-bg, #1b243f);
1374
+ background: var(--editor-pill, #1b243f);
1374
1375
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.25);
1375
1376
  border-radius: 999px;
1376
1377
  bottom: 1rem;
@@ -271,13 +271,13 @@
271
271
  --glass: rgb(16 22 42 / 0.84);
272
272
  --ink: #f4f6fb;
273
273
  --muted: rgb(244 246 251 / 0.62);
274
- --accent: var(--storyloco-accent, #05807f);
275
- --accent-ink: var(--storyloco-accent-ink, #fff);
274
+ --accent: var(--editor-accent, #05807f);
275
+ --accent-ink: var(--editor-accent-ink, #fff);
276
276
  --live: #ffb224;
277
277
  --spring: cubic-bezier(0.2, 0.9, 0.25, 1.15);
278
278
 
279
279
  color: var(--ink);
280
- font: var(--storyloco-bar-font, 500 0.8125rem/1.4 system-ui, sans-serif);
280
+ font: var(--editor-font, 500 0.8125rem/1.4 system-ui, sans-serif);
281
281
 
282
282
  & * {
283
283
  box-sizing: border-box;
@@ -610,7 +610,9 @@
610
610
  & .said {
611
611
  color: var(--muted);
612
612
  grid-column: 2;
613
+ margin-block: -0.15em;
613
614
  overflow: hidden;
615
+ padding-block: 0.15em;
614
616
  text-overflow: ellipsis;
615
617
  white-space: nowrap;
616
618
  }
@@ -705,7 +707,9 @@
705
707
  inset-block-end: 1rem;
706
708
  }
707
709
  .count {
710
+ margin-block: -0.15em;
708
711
  overflow: hidden;
712
+ padding-block: 0.15em;
709
713
  text-overflow: ellipsis;
710
714
  }
711
715
  }
@@ -204,7 +204,9 @@ function meaningful(value, key = "") {
204
204
  }
205
205
  if (!value || typeof value !== "object")
206
206
  return value;
207
+ // in key order, since Storyblok hands back a node's keys in an order of its own
207
208
  const kept = Object.entries(value)
209
+ .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
208
210
  .filter(([k]) => k !== "_editable")
209
211
  .map(([k, v]) => [k, meaningful(v, k)])
210
212
  .filter(([, v]) => v !== null &&
@@ -5,8 +5,8 @@
5
5
  nothing for visitors, or inside Storyblok's own editor, and keeps clear of Next.js's dev badge.
6
6
  On the live site ⌘⇧E (Ctrl+Shift+E) signs in, and turns edit mode on and off once signed in.
7
7
 
8
- Mount it once in the root layout. Match it to a site with `--storyloco-bar-bg`, `-ink`, `-muted`,
9
- `-line`, `-shadow`, `-font` and `-offset`, `--storyloco-badge`, and `--storyloco-accent`, `-good`
8
+ Mount it once in the root layout. Match it to a site with `--editor-bg`, `-ink`, `-muted`,
9
+ `-line`, `-shadow`, `-font` and `-offset`, `--editor-badge`, and `--editor-accent`, `-good`
10
10
  and `-danger`; or pass `accent`, which can follow a site's theme as it changes. For a different
11
11
  bar altogether, build one from `editor`.
12
12
 
@@ -43,7 +43,7 @@
43
43
  /**
44
44
  * The editor's accent, any CSS colour: outlines, toolbars and buttons, wherever they're
45
45
  * drawn on the page. It can change, say with a site's location theme. Storyblok's teal
46
- * otherwise, or `--storyloco-accent` set in CSS.
46
+ * otherwise, or `--editor-accent` set in CSS.
47
47
  */
48
48
  accent?: string
49
49
  /** Text on the accent, where white won't read, like on a light yellow */
@@ -97,8 +97,8 @@
97
97
  const tag = document.createElement("style")
98
98
  tag.dataset.storyloco = "accent"
99
99
  const rules = [
100
- resolved.accent && `--storyloco-accent:${resolved.accent};`,
101
- resolved.ink && `--storyloco-accent-ink:${resolved.ink};`,
100
+ resolved.accent && `--editor-accent:${resolved.accent};`,
101
+ resolved.ink && `--editor-accent-ink:${resolved.ink};`,
102
102
  ].filter(Boolean)
103
103
  tag.textContent = `:root{${rules.join("")}}`
104
104
  document.head.append(tag)
@@ -192,7 +192,7 @@
192
192
  if (document.querySelector("style[data-storyloco=theme]")) return
193
193
  const tag = document.createElement("style")
194
194
  tag.dataset.storyloco = "theme"
195
- tag.textContent = `@media (prefers-color-scheme: dark){:where(:root){--storyloco-bar-bg:#171c2c;--storyloco-bar-ink:#e8ecf5;--storyloco-bar-muted:#98a1b6;--storyloco-bar-line:rgb(255 255 255/.13);--storyloco-bar-shadow:0 0 0 1px rgb(255 255 255/.1),0 4px 14px rgb(0 0 0/.45);--storyloco-pill-bg:#2c3453;--storyloco-accent:#1fa79e}}`
195
+ tag.textContent = `@media (prefers-color-scheme: dark){:where(:root){--editor-bg:#171c2c;--editor-ink:#e8ecf5;--editor-muted:#98a1b6;--editor-line:rgb(255 255 255/.13);--editor-shadow:0 0 0 1px rgb(255 255 255/.1),0 4px 14px rgb(0 0 0/.45);--editor-pill:#2c3453;--editor-accent:#1fa79e}}`
196
196
  document.head.append(tag)
197
197
  }
198
198
 
@@ -869,16 +869,16 @@
869
869
  /* light or dark as the person prefers, whatever scheme the site uses */
870
870
  color-scheme: light dark;
871
871
 
872
- --bg: var(--storyloco-bar-bg, #fff);
873
- --ink: var(--storyloco-bar-ink, #1b243f);
874
- --muted: var(--storyloco-bar-muted, #6b7280);
875
- --line: var(--storyloco-bar-line, rgb(27 36 63 / 0.12));
876
- --accent: var(--storyloco-accent, #05807f);
877
- --good: var(--storyloco-good, #14b8a6);
878
- --danger: var(--storyloco-danger, #e5484d);
879
- --font: var(--storyloco-bar-font, 500 0.8125rem/1.25 system-ui, sans-serif);
880
- --shadow: var(--storyloco-bar-shadow, 0 0 0 1px var(--line), 0 2px 8px rgb(27 36 63 / 0.08));
881
- --o: var(--storyloco-bar-offset, 1rem);
872
+ --bg: var(--editor-bg, #fff);
873
+ --ink: var(--editor-ink, #1b243f);
874
+ --muted: var(--editor-muted, #6b7280);
875
+ --line: var(--editor-line, rgb(27 36 63 / 0.12));
876
+ --accent: var(--editor-accent, #05807f);
877
+ --good: var(--editor-good, #14b8a6);
878
+ --danger: var(--editor-danger, #e5484d);
879
+ --font: var(--editor-font, 500 0.8125rem/1.25 system-ui, sans-serif);
880
+ --shadow: var(--editor-shadow, 0 0 0 1px var(--line), 0 2px 8px rgb(27 36 63 / 0.08));
881
+ --o: var(--editor-offset, 1rem);
882
882
 
883
883
  align-items: center;
884
884
  border-radius: 999px;
@@ -936,13 +936,13 @@
936
936
  }
937
937
 
938
938
  .badge {
939
- background: var(--storyloco-badge, var(--accent));
939
+ background: var(--editor-badge, var(--accent));
940
940
  block-size: 2.25rem;
941
941
  border: 0;
942
942
  /* round, like the pill it opens into */
943
943
  border-radius: 50%;
944
944
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 30%, transparent);
945
- color: var(--storyloco-accent-ink, #fff);
945
+ color: var(--editor-accent-ink, #fff);
946
946
  cursor: grab;
947
947
  display: grid;
948
948
  flex: none;
@@ -1154,7 +1154,7 @@
1154
1154
  background: var(--accent);
1155
1155
  border: 0;
1156
1156
  border-radius: 999px;
1157
- color: var(--storyloco-accent-ink, #fff);
1157
+ color: var(--editor-accent-ink, #fff);
1158
1158
  cursor: pointer;
1159
1159
  font: inherit;
1160
1160
  padding: 0.3125rem 0.75rem;
@@ -1262,7 +1262,9 @@
1262
1262
 
1263
1263
  .name {
1264
1264
  max-inline-size: 8rem;
1265
+ margin-block: -0.15em;
1265
1266
  overflow: hidden;
1267
+ padding-block: 0.15em;
1266
1268
  text-overflow: ellipsis;
1267
1269
  }
1268
1270
 
@@ -1600,7 +1602,9 @@
1600
1602
  flex: 1;
1601
1603
  font-weight: 600;
1602
1604
  min-inline-size: 0;
1605
+ margin-block: -0.15em;
1603
1606
  overflow: hidden;
1607
+ padding-block: 0.15em;
1604
1608
  text-overflow: ellipsis;
1605
1609
  white-space: nowrap;
1606
1610
  }
@@ -1642,7 +1646,9 @@
1642
1646
 
1643
1647
  .what {
1644
1648
  min-inline-size: 0;
1649
+ margin-block: -0.15em;
1645
1650
  overflow: hidden;
1651
+ padding-block: 0.15em;
1646
1652
  text-overflow: ellipsis;
1647
1653
  white-space: nowrap;
1648
1654
  }
@@ -2,7 +2,7 @@ type $$ComponentProps = {
2
2
  /**
3
3
  * The editor's accent, any CSS colour: outlines, toolbars and buttons, wherever they're
4
4
  * drawn on the page. It can change, say with a site's location theme. Storyblok's teal
5
- * otherwise, or `--storyloco-accent` set in CSS.
5
+ * otherwise, or `--editor-accent` set in CSS.
6
6
  */
7
7
  accent?: string;
8
8
  /** Text on the accent, where white won't read, like on a light yellow */
@@ -14,8 +14,8 @@ type $$ComponentProps = {
14
14
  * nothing for visitors, or inside Storyblok's own editor, and keeps clear of Next.js's dev badge.
15
15
  * On the live site ⌘⇧E (Ctrl+Shift+E) signs in, and turns edit mode on and off once signed in.
16
16
  *
17
- * Mount it once in the root layout. Match it to a site with `--storyloco-bar-bg`, `-ink`, `-muted`,
18
- * `-line`, `-shadow`, `-font` and `-offset`, `--storyloco-badge`, and `--storyloco-accent`, `-good`
17
+ * Mount it once in the root layout. Match it to a site with `--editor-bg`, `-ink`, `-muted`,
18
+ * `-line`, `-shadow`, `-font` and `-offset`, `--editor-badge`, and `--editor-accent`, `-good`
19
19
  * and `-danger`; or pass `accent`, which can follow a site's theme as it changes. For a different
20
20
  * bar altogether, build one from `editor`.
21
21
  *
@@ -250,8 +250,7 @@
250
250
  <textarea
251
251
  rows="3"
252
252
  bind:value={alt}
253
- placeholder="What the image shows, for people who can’t see it"
254
- ></textarea>
253
+ placeholder="What the image shows, for people who can’t see it"></textarea>
255
254
  </label>
256
255
  {#if suggest && IMAGE.test(chosen.filename) && !/\.svg$/i.test(chosen.filename)}
257
256
  <p class="hint">
@@ -345,13 +344,13 @@
345
344
  /* light or dark as the person prefers, whatever scheme the site uses */
346
345
  color-scheme: light dark;
347
346
 
348
- --bg: var(--storyloco-bar-bg, #fff);
349
- --ink: var(--storyloco-bar-ink, #1b243f);
350
- --muted: var(--storyloco-bar-muted, #6b7280);
351
- --line: var(--storyloco-bar-line, rgb(27 36 63 / 0.12));
352
- --accent: var(--storyloco-accent, #05807f);
353
- --danger: var(--storyloco-danger, #e5484d);
354
- --font: var(--storyloco-bar-font, 500 0.8125rem/1.25 system-ui, sans-serif);
347
+ --bg: var(--editor-bg, #fff);
348
+ --ink: var(--editor-ink, #1b243f);
349
+ --muted: var(--editor-muted, #6b7280);
350
+ --line: var(--editor-line, rgb(27 36 63 / 0.12));
351
+ --accent: var(--editor-accent, #05807f);
352
+ --danger: var(--editor-danger, #e5484d);
353
+ --font: var(--editor-font, 500 0.8125rem/1.25 system-ui, sans-serif);
355
354
 
356
355
  background: var(--bg);
357
356
  border: 0;
@@ -602,7 +601,7 @@
602
601
  &.primary {
603
602
  background: var(--accent);
604
603
  border-color: transparent;
605
- color: var(--storyloco-accent-ink, #fff);
604
+ color: var(--editor-accent-ink, #fff);
606
605
  }
607
606
 
608
607
  &:disabled {