rimecms 0.26.9 → 0.27.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.
Files changed (81) hide show
  1. package/README.md +26 -24
  2. package/dist/core/collections/auth/fields.d.ts +40 -40
  3. package/dist/core/fields/builders/select.js +1 -0
  4. package/dist/core/i18n/en/fields.d.ts +1 -0
  5. package/dist/core/i18n/en/fields.js +2 -1
  6. package/dist/core/i18n/fr/fields.d.ts +1 -0
  7. package/dist/core/i18n/fr/fields.js +2 -1
  8. package/dist/core/operations/hooks/before-read/set-document-thumbnail.server.js +2 -2
  9. package/dist/core/operations/hooks/before-read/sort-document-props.server.js +3 -1
  10. package/dist/fields/group/component/Group.svelte +1 -0
  11. package/dist/fields/group/index.d.ts +12 -8
  12. package/dist/fields/group/index.js +4 -0
  13. package/dist/fields/link/component/RessourceInput.svelte +2 -2
  14. package/dist/fields/relation/component/Cell.svelte +2 -2
  15. package/dist/fields/relation/component/Relation.svelte +18 -11
  16. package/dist/fields/relation/component/Relation.svelte.d.ts +2 -1
  17. package/dist/fields/relation/component/upload/Browse.svelte +2 -2
  18. package/dist/fields/relation/index.d.ts +1 -1
  19. package/dist/fields/rich-text/client.d.ts +9 -9
  20. package/dist/fields/rich-text/client.js +1 -1
  21. package/dist/fields/rich-text/component/RichText.svelte +1 -1
  22. package/dist/fields/rich-text/core/{config-builders.js → build-editor-config.js} +9 -2
  23. package/dist/fields/rich-text/core/features/fields/extension.d.ts +10 -3
  24. package/dist/fields/rich-text/core/features/fields/extension.js +3 -8
  25. package/dist/fields/rich-text/core/features/fields/fields.css +4 -0
  26. package/dist/fields/rich-text/core/features/fields/fields.svelte +13 -6
  27. package/dist/fields/rich-text/core/features/fields/fields.svelte.d.ts +4 -1
  28. package/dist/fields/rich-text/core/features/fields/index.d.ts +7 -5
  29. package/dist/fields/rich-text/core/features/fields/index.js +4 -3
  30. package/dist/fields/rich-text/core/features/link/component/link-selector.svelte +9 -13
  31. package/dist/fields/rich-text/core/features/link/index.d.ts +1 -4
  32. package/dist/fields/rich-text/core/features/resource/index.d.ts +2 -5
  33. package/dist/fields/rich-text/core/features/resource/index.js +17 -12
  34. package/dist/fields/rich-text/core/features/resource/resource-extension.d.ts +7 -2
  35. package/dist/fields/rich-text/core/features/resource/resource-extension.js +6 -10
  36. package/dist/fields/rich-text/core/features/resource/resource.svelte +19 -21
  37. package/dist/fields/rich-text/core/features/upload/index.d.ts +2 -5
  38. package/dist/fields/rich-text/core/features/upload/index.js +15 -12
  39. package/dist/fields/rich-text/core/features/upload/upload-extension.d.ts +13 -1
  40. package/dist/fields/rich-text/core/features/upload/upload-extension.js +6 -11
  41. package/dist/fields/rich-text/core/features/upload/upload.svelte +15 -10
  42. package/dist/fields/rich-text/core/svelte/node-view-renderer.svelte.js +10 -5
  43. package/dist/fields/rich-text/core/svelte/node-view-wrapper.svelte +1 -0
  44. package/dist/fields/rich-text/core/svelte/renderer.d.ts +1 -1
  45. package/dist/fields/types.d.ts +13 -0
  46. package/dist/panel/components/Root.svelte +4 -4
  47. package/dist/panel/components/fields/FieldsPreview.svelte +34 -27
  48. package/dist/panel/components/fields/FieldsPreview.svelte.d.ts +5 -6
  49. package/dist/panel/components/fields/FieldsPreviewTrigger.svelte +1 -1
  50. package/dist/panel/components/fields/index.d.ts +2 -2
  51. package/dist/panel/components/sections/collection/folder/FolderEdit.svelte +0 -2
  52. package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte +2 -2
  53. package/dist/panel/components/sections/collection/grid/create-directory-dialog/CreateDirectoryDialog.svelte +0 -2
  54. package/dist/panel/components/sections/collection/upload-thumb-cell/UploadThumbCell.svelte +3 -2
  55. package/dist/panel/components/sections/document/Header.svelte +1 -0
  56. package/dist/panel/components/sections/document/Settings.svelte +3 -2
  57. package/dist/panel/components/sections/document/Settings.svelte.d.ts +2 -1
  58. package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte +2 -7
  59. package/dist/panel/components/sections/live/SidePanel.svelte +7 -9
  60. package/dist/panel/components/ui/breadcrumb/BreadCrumb.svelte +12 -6
  61. package/dist/panel/components/ui/card-document/card-document.svelte +2 -2
  62. package/dist/panel/components/ui/command/command-dialog.svelte +3 -1
  63. package/dist/panel/components/ui/command/command-dialog.svelte.d.ts +1 -0
  64. package/dist/panel/context/api-proxy.svelte.d.ts +2 -1
  65. package/dist/panel/context/api-proxy.svelte.js +9 -3
  66. package/dist/panel/context/documentForm.svelte.d.ts +2 -2
  67. package/dist/panel/context/documentForm.svelte.js +7 -6
  68. package/dist/panel/context/form.svelte.js +0 -1
  69. package/dist/panel/context/locale.svelte.d.ts +1 -0
  70. package/dist/panel/context/locale.svelte.js +3 -3
  71. package/dist/panel/context/title.d.ts +7 -0
  72. package/dist/panel/context/title.js +9 -0
  73. package/dist/panel/pages/area/Area.svelte +1 -4
  74. package/dist/panel/pages/area/AreaVersionsDoc.svelte +0 -3
  75. package/dist/panel/pages/collection/Collection.svelte +2 -2
  76. package/dist/panel/pages/collection-document/CollectionDocVersions.svelte +0 -5
  77. package/dist/panel/pages/collection-document/CollectionDocument.svelte +0 -3
  78. package/dist/panel/pages/live/Live.svelte +3 -8
  79. package/dist/types.d.ts +1 -1
  80. package/package.json +4 -4
  81. /package/dist/fields/rich-text/core/{config-builders.d.ts → build-editor-config.d.ts} +0 -0
@@ -6,7 +6,7 @@
6
6
  import * as Command from '../../../../../panel/components/ui/command/index.js';
7
7
  import * as Dialog from '../../../../../panel/components/ui/dialog/index.js';
8
8
  import Input from '../../../../../panel/components/ui/input/input.svelte';
9
- import { API_PROXY, getAPIProxyContext } from '../../../../../panel/context/api-proxy.svelte.js';
9
+ import { getAPIProxyContext } from '../../../../../panel/context/api-proxy.svelte.js';
10
10
  import { X } from '@lucide/svelte';
11
11
  import type { NodeViewProps } from '@tiptap/core';
12
12
  import { onMount } from 'svelte';
@@ -20,11 +20,12 @@
20
20
  url: string | null;
21
21
  filename: string | null;
22
22
  legend: string;
23
+ _fresh: boolean;
23
24
  };
24
25
 
25
26
  let { node, updateAttributes, extension }: NodeViewProps = $props();
26
27
  let isDialogOpen = $state(false);
27
- let selected = $state<Omit<NodeAttributes, 'legend'> | null>();
28
+ let selected = $state<Omit<NodeAttributes, 'legend' | '_fresh'> | null>();
28
29
  let legendElement = $state<HTMLParagraphElement>();
29
30
  let legend = $state('');
30
31
  let dialogLegendOpen = $state(false);
@@ -52,14 +53,16 @@
52
53
  } else {
53
54
  selected = null;
54
55
  }
56
+ if (node.attrs._fresh) {
57
+ // If the resource is fresh, we want to open the dialog to select a resource
58
+ isDialogOpen = true;
59
+ }
55
60
  });
56
61
 
57
- const APIProxy = getAPIProxyContext(API_PROXY.DOCUMENT);
62
+ const APIProxy = getAPIProxyContext();
58
63
 
59
64
  // svelte-ignore state_referenced_locally
60
- const url = extension.options.query
61
- ? apiUrl(extension.options.slug, `?${extension.options.query}`)
62
- : apiUrl(extension.options.slug);
65
+ const url = apiUrl(extension.options.source);
63
66
 
64
67
  const ressource = APIProxy.getRessource<{ docs: UploadDoc[] }>(url);
65
68
  let docs = $state<UploadDoc[]>([]);
@@ -101,7 +104,8 @@
101
104
  sizes: null,
102
105
  mimeType: null,
103
106
  filename: null,
104
- legend: null
107
+ legend: null,
108
+ _fresh: false
105
109
  });
106
110
  }
107
111
 
@@ -116,7 +120,8 @@
116
120
  sizes: selected.sizes,
117
121
  mimeType: selected.mimeType,
118
122
  filename: selected.filename,
119
- legend
123
+ legend,
124
+ _fresh: false
120
125
  } as NodeAttributes);
121
126
  }
122
127
  </script>
@@ -167,7 +172,7 @@
167
172
  </div>
168
173
  {/snippet}
169
174
 
170
- {#snippet media(attributes: Omit<NodeAttributes, 'legend'>)}
175
+ {#snippet media(attributes: Omit<NodeAttributes, 'legend' | '_fresh'>)}
171
176
  <div class="rz-richtext-media__media">
172
177
  {#if attributes.mimeType?.includes('image')}
173
178
  <img src={attributes.url} alt="rich text" />
@@ -177,7 +182,7 @@
177
182
  </div>
178
183
  {/snippet}
179
184
 
180
- <Command.Dialog bind:open={isDialogOpen}>
185
+ <Command.Dialog bind:open={isDialogOpen} preventScroll={false}>
181
186
  <Command.Input placeholder="Select an image" />
182
187
 
183
188
  <Command.List>
@@ -55,11 +55,16 @@ class SvelteNodeView extends NodeView {
55
55
  // Focus the editor
56
56
  this.editor.view.focus();
57
57
  });
58
- const svelteComponent = mount(Component, { target, props, context });
59
- this.renderer = new SvelteRenderer(svelteComponent, {
60
- element: target,
61
- props
62
- });
58
+ try {
59
+ this.renderer = new SvelteRenderer(mount(Component, { target, props, context }), {
60
+ element: target,
61
+ props
62
+ });
63
+ }
64
+ catch (e) {
65
+ console.error('Error mounting Svelte component in NodeView', e);
66
+ throw e;
67
+ }
63
68
  this.appendContendDom();
64
69
  this.updateElementAttributes();
65
70
  }
@@ -1,3 +1,4 @@
1
+ <!-- based on https://github.com/sibiraj-s/svelte-tiptap/blob/master/src/lib/NodeViewWrapper.svelte -->
1
2
  <script lang="ts" generics="T extends keyof SvelteHTMLElements = 'div'">
2
3
  import { getContext, onMount, tick } from 'svelte';
3
4
  import type { SvelteHTMLElements } from 'svelte/elements';
@@ -1,5 +1,5 @@
1
- import { mount } from 'svelte';
2
1
  import type { NodeViewProps } from '@tiptap/core';
2
+ import { mount } from 'svelte';
3
3
  interface RendererOptions {
4
4
  element: HTMLElement;
5
5
  props: NodeViewProps;
@@ -78,16 +78,19 @@ export type FieldHookContext<T extends FormField = FormField> = {
78
78
  /** The field config */
79
79
  config: T;
80
80
  };
81
+ /** Field hook for client/server operations */
81
82
  export type FieldHookShared<T extends FormField = any> = (value: any, context: {
82
83
  config: T;
83
84
  data: Dic;
84
85
  }) => any;
86
+ /** Field hook for client-side operations */
85
87
  export type FieldHookClient = (value: any, context: {
86
88
  siblings: Record<string, any>;
87
89
  useField: DocumentFormContext['useField'];
88
90
  useBlocks: DocumentFormContext['useBlocks'];
89
91
  useTree: DocumentFormContext['useTree'];
90
92
  }) => any;
93
+ /** Field hook for server-side operations */
91
94
  export type FieldHook<T extends FormField = any> = (value: any, context: FieldHookContext<T>) => any;
92
95
  type FieldHooks = {
93
96
  beforeRead?: FieldHook[];
@@ -110,3 +113,13 @@ export type RelationValue<T> = T[] | {
110
113
  documentId: string;
111
114
  }[] | string[] | string;
112
115
  export type SimplerField<T extends FormField> = WithRequired<Partial<T>, 'name' | 'isEmpty' | 'type'>;
116
+ export type BaseUseFieldReturn = {
117
+ path: string;
118
+ value: any;
119
+ readonly editable: boolean;
120
+ readonly visible: boolean;
121
+ readonly error: string | false;
122
+ };
123
+ export type FieldsPreviewProps = {
124
+ fields: Record<string, BaseUseFieldReturn>;
125
+ };
@@ -5,12 +5,12 @@
5
5
  import Nav from './ui/nav/Nav.svelte';
6
6
  import { Toaster } from './ui/sonner';
7
7
  import { setConfigContext } from '../context/config.svelte.js';
8
- import createContext from '../context/createContext.svelte.js';
9
8
  import { setLocaleContext } from '../context/locale.svelte.js';
10
9
  import { setUserContext } from '../context/user.svelte.js';
11
10
  import type { Route } from '../types.js';
12
11
  import { onMount, type Snippet } from 'svelte';
13
- import { API_PROXY, setAPIProxyContext } from '../context/api-proxy.svelte.js';
12
+ import { setAPIProxyContext } from '../context/api-proxy.svelte.js';
13
+ import { setTitleContext } from '../context/title.js';
14
14
 
15
15
  type Props = {
16
16
  routes: Record<string, Route[]>;
@@ -28,8 +28,8 @@
28
28
  setConfigContext(config);
29
29
  // svelte-ignore state_referenced_locally
30
30
  setUserContext(user);
31
- createContext('title', '[untitled]');
32
- setAPIProxyContext(API_PROXY.ROOT);
31
+ setTitleContext('[untitled]');
32
+ setAPIProxyContext();
33
33
 
34
34
  const locale = $derived(setLocaleContext(initialeLocale));
35
35
 
@@ -1,42 +1,49 @@
1
1
  <script lang="ts">
2
2
  import { FormFieldBuilder } from '../../../core/fields/builders';
3
- import type { FormField } from '../../../fields/types.js';
3
+ import type { BaseUseFieldReturn, FieldsPreviewProps, FormField } from '../../../fields/types.js';
4
4
  import { capitalize } from '../../../util/string.js';
5
+ import type { Component } from 'svelte';
5
6
 
6
7
  type Props = {
7
8
  fields: FormFieldBuilder<FormField>[];
8
- getField: (field: FormFieldBuilder<FormField>) => { visible: boolean; value: any | null };
9
+ getField: (field: FormFieldBuilder<FormField>) => BaseUseFieldReturn;
10
+ preview?: Component<FieldsPreviewProps>;
9
11
  };
10
12
 
11
- const { fields, getField }: Props = $props();
12
-
13
- //
13
+ const { fields, getField, preview }: Props = $props();
14
14
  </script>
15
15
 
16
16
  <div class="rz-render-fields-preview">
17
- {#each fields as builder, index (index)}
18
- {@const field = getField(builder)}
19
- {#if !builder.raw.hidden && field.visible}
20
- <div class="rz-render-fields-preview__row" data-visible={field.visible || null}>
21
- <div class="rz-render-fields-preview__name">
22
- <p>
23
- {builder.raw.label || capitalize(builder.name)}
24
- </p>
25
- </div>
26
- <div class="rz-render-fields-preview__value">
27
- {#if builder.raw.table?.cell}
28
- {@const ColumnTableCell = builder.raw.table.cell}
29
- <span><ColumnTableCell value={field.value} /></span>
30
- {:else if builder.cell}
31
- {@const Cell = builder.cell}
32
- <span><Cell value={field.value} /></span>
33
- {:else}
34
- <span>{field.value}</span>
35
- {/if}
17
+ {#if preview}
18
+ {@const Preview = preview}
19
+ <div class="rz-render-fields-preview__custom" data-visible>
20
+ <Preview fields={Object.fromEntries(fields.map((field) => [field.name, getField(field)]))} />
21
+ </div>
22
+ {:else}
23
+ {#each fields as builder, index (index)}
24
+ {@const field = getField(builder)}
25
+ {#if !builder.raw.hidden && field.visible}
26
+ <div class="rz-render-fields-preview__row" data-visible={field.visible || null}>
27
+ <div class="rz-render-fields-preview__name">
28
+ <p>
29
+ {builder.raw.label || capitalize(builder.name)}
30
+ </p>
31
+ </div>
32
+ <div class="rz-render-fields-preview__value">
33
+ {#if builder.raw.table?.cell}
34
+ {@const ColumnTableCell = builder.raw.table.cell}
35
+ <span><ColumnTableCell value={field.value} /></span>
36
+ {:else if builder.cell}
37
+ {@const Cell = builder.cell}
38
+ <span><Cell value={field.value} /></span>
39
+ {:else}
40
+ <span>{field.value}</span>
41
+ {/if}
42
+ </div>
36
43
  </div>
37
- </div>
38
- {/if}
39
- {/each}
44
+ {/if}
45
+ {/each}
46
+ {/if}
40
47
  </div>
41
48
 
42
49
  <style>
@@ -1,12 +1,11 @@
1
1
  import { FormFieldBuilder } from '../../../core/fields/builders';
2
- import type { FormField } from '../../../fields/types.js';
2
+ import type { BaseUseFieldReturn, FieldsPreviewProps, FormField } from '../../../fields/types.js';
3
+ import type { Component } from 'svelte';
3
4
  type Props = {
4
5
  fields: FormFieldBuilder<FormField>[];
5
- getField: (field: FormFieldBuilder<FormField>) => {
6
- visible: boolean;
7
- value: any | null;
8
- };
6
+ getField: (field: FormFieldBuilder<FormField>) => BaseUseFieldReturn;
7
+ preview?: Component<FieldsPreviewProps>;
9
8
  };
10
- declare const FieldsPreview: import("svelte").Component<Props, {}, "">;
9
+ declare const FieldsPreview: Component<Props, {}, "">;
11
10
  type FieldsPreview = ReturnType<typeof FieldsPreview>;
12
11
  export default FieldsPreview;
@@ -13,7 +13,7 @@
13
13
  <style>
14
14
  .rz-fields-preview__trigger {
15
15
  display: block;
16
- background-color: var(--rz-group-preview-bg);
16
+ background-color: light-dark(hsl(var(--rz-gray-16)), hsl(var(--rz-gray-3)));
17
17
  width: 100%;
18
18
  text-align: left;
19
19
  }
@@ -1,11 +1,11 @@
1
1
  export declare const Field: {
2
2
  Label: import("svelte").Component<{
3
- config?: import("../../../fields/types").SimplerField<import("../../../types").FormField>;
3
+ config?: import("../../../types").SimplerField<import("../../../types").FormField>;
4
4
  children?: import("svelte").Snippet;
5
5
  for?: string;
6
6
  }, {}, "">;
7
7
  Hint: import("svelte").Component<{
8
- config: import("../../../fields/types").SimplerField<import("../../../types").FormField>;
8
+ config: import("../../../types").SimplerField<import("../../../types").FormField>;
9
9
  }, {}, "">;
10
10
  LabelFor: import("svelte").Component<{
11
11
  config: import("../../../types").FormField;
@@ -6,7 +6,6 @@
6
6
  import RenderFields from '../../../fields/RenderFields.svelte';
7
7
  import Button from '../../../ui/button/button.svelte';
8
8
  import * as Dialog from '../../../ui/dialog/index.js';
9
- import { API_PROXY, setAPIProxyContext } from '../../../../context/api-proxy.svelte.js';
10
9
  import { getConfigContext } from '../../../../context/config.svelte.js';
11
10
  import { setDocumentFormContext } from '../../../../context/documentForm.svelte.js';
12
11
  import { getUserContext } from '../../../../context/user.svelte.js';
@@ -18,7 +17,6 @@
18
17
  };
19
18
  let { folder, collection, open = $bindable() }: Props = $props();
20
19
 
21
- setAPIProxyContext(API_PROXY.DOCUMENT);
22
20
  let formElement = $state<HTMLFormElement>();
23
21
  const user = getUserContext();
24
22
  const configCtx = getConfigContext();
@@ -10,7 +10,7 @@
10
10
  import ContextMenu from '../../../ui/context-menu/ContextMenu.svelte';
11
11
  import ContextMenuItem from '../../../ui/context-menu/ContextMenuItem.svelte';
12
12
  import * as Dialog from '../../../ui/dialog/index.js';
13
- import { API_PROXY, getAPIProxyContext } from '../../../../context/api-proxy.svelte.js';
13
+ import { getAPIProxyContext } from '../../../../context/api-proxy.svelte.js';
14
14
  import { panelUrl } from '../../../../util/url.js';
15
15
  import { trycatchFetch } from '../../../../../util/function.js';
16
16
  import { Pencil, Trash2 } from '@lucide/svelte';
@@ -42,7 +42,7 @@
42
42
  let rootElement = $state<HTMLButtonElement>();
43
43
  let isDragging = $state(false);
44
44
  const isFolderUpperPath = $derived(folder.name === '...');
45
- const APIProxy = getAPIProxyContext(API_PROXY.ROOT);
45
+ const APIProxy = getAPIProxyContext();
46
46
  const childFilesURL = $derived(
47
47
  `${apiUrl(collection.kebab)}?where[_path][equals]=${folder.id}&select=id`
48
48
  );
@@ -5,7 +5,6 @@
5
5
  import RenderFields from '../../../../fields/RenderFields.svelte';
6
6
  import Button from '../../../../ui/button/button.svelte';
7
7
  import * as Dialog from '../../../../ui/dialog/index.js';
8
- import { API_PROXY, setAPIProxyContext } from '../../../../../context/api-proxy.svelte.js';
9
8
  import type { CollectionContext } from '../../../../../context/collection.svelte.js';
10
9
  import { getConfigContext } from '../../../../../context/config.svelte.js';
11
10
  import {
@@ -16,7 +15,6 @@
16
15
  type Props = { collection: CollectionContext; open: boolean };
17
16
  let { collection, open = $bindable() }: Props = $props();
18
17
 
19
- setAPIProxyContext(API_PROXY.DOCUMENT);
20
18
  let formElement = $state<HTMLFormElement>();
21
19
  const configCtx = getConfigContext();
22
20
  // svelte-ignore state_referenced_locally
@@ -9,9 +9,10 @@
9
9
  class?: string;
10
10
  };
11
11
  const { url, class: className, mimeType }: Props = $props();
12
+
12
13
  const mimeTypeResolved = $derived.by(() => {
13
14
  if (mimeType) return mimeType;
14
- if (url) return getMimeTypeFromExtension(url) || '';
15
+ if (url) return getMimeTypeFromExtension(url.split('.').pop() || '') || '';
15
16
  return '';
16
17
  });
17
18
  </script>
@@ -35,7 +36,7 @@
35
36
 
36
37
  <style>
37
38
  :root {
38
- --rz-upload-preview-cell-bg: light-dark(hsl(var(--rz-gray-11)), hsl(var(--rz-gray-0)));
39
+ --rz-upload-preview-cell-bg: light-dark(hsl(var(--rz-gray-15)), hsl(var(--rz-gray-0)));
39
40
  --rz-upload-preview-cell-fit: contain;
40
41
  }
41
42
 
@@ -65,6 +65,7 @@
65
65
  {/if}
66
66
 
67
67
  {#if form.values.id}
68
+ {/* @ts-ignore form doc is GenericDoc as form.values.id is defined */ null}
68
69
  <Settings {form} />
69
70
  {/if}
70
71
 
@@ -8,13 +8,14 @@
8
8
  import type { DocumentFormContext } from '../../../context/documentForm.svelte.js';
9
9
  import { getLocaleContext } from '../../../context/locale.svelte.js';
10
10
  import { panelUrl } from '../../../util/url.js';
11
+ import type { GenericDoc } from '../../../../types.js';
11
12
  import { trycatchFetch } from '../../../../util/function.js';
12
13
  import { Copy, History, Import, Pickaxe, Settings, Trash2 } from '@lucide/svelte';
13
14
  import { toast } from 'svelte-sonner';
14
15
  import { t__ } from '../../../../core/i18n/index.js';
15
16
  import Button from '../../ui/button/button.svelte';
16
17
 
17
- type Props = { form: DocumentFormContext };
18
+ type Props = { form: DocumentFormContext<GenericDoc> };
18
19
 
19
20
  const { form }: Props = $props();
20
21
 
@@ -84,7 +85,7 @@
84
85
  }
85
86
  const { id } = await success.json();
86
87
  toast.success(t__('common.duplicate_success'));
87
- await goto(panelUrl(form.config.kebab, form.values.id));
88
+ await goto(panelUrl(form.config.kebab, id));
88
89
  }
89
90
 
90
91
  const shouldShowSettings = $derived.by(() => {
@@ -1,7 +1,8 @@
1
1
  import type { DocumentFormContext } from '../../../context/documentForm.svelte.js';
2
+ import type { GenericDoc } from '../../../../types.js';
2
3
  import { Settings } from '@lucide/svelte';
3
4
  type Props = {
4
- form: DocumentFormContext;
5
+ form: DocumentFormContext<GenericDoc>;
5
6
  };
6
7
  declare const Settings: import("svelte").Component<Props, {}, "">;
7
8
  type Settings = ReturnType<typeof Settings>;
@@ -26,6 +26,7 @@
26
26
  const deleteFile = () => {
27
27
  preview = null;
28
28
  file = null;
29
+ form.setValue('url', null);
29
30
  form.setValue('file', null);
30
31
  form.setValue('filename', null);
31
32
  form.setValue('mimeType', null);
@@ -62,12 +63,6 @@
62
63
  form.setValue('file', file);
63
64
  }
64
65
  });
65
-
66
- $effect(() => {
67
- if (preview && form.values._thumbnail !== preview) {
68
- form.setValue(`_thumbnail`, preview);
69
- }
70
- });
71
66
  </script>
72
67
 
73
68
  <div class="rz-doc-upload-header">
@@ -77,7 +72,7 @@
77
72
  {#if form.values.mimeType.includes('image')}
78
73
  <div class="rz-doc-upload-header__prewiew-grid">
79
74
  {#key form.values.title}
80
- <img src={form.values.url || form.values._thumbnail} alt="preview" />
75
+ <img src={form.values.url || form.values._thumbnail || preview} alt="preview" />
81
76
  {/key}
82
77
  </div>
83
78
  {:else}
@@ -3,10 +3,10 @@
3
3
  import type { User } from '../../../../core/collections/auth/types.js';
4
4
  import type { BuiltConfigClient } from '../../../../core/config/types.js';
5
5
  import { Toaster } from '../../ui/sonner';
6
- import { API_PROXY, setAPIProxyContext } from '../../../context/api-proxy.svelte.js';
6
+ import { setAPIProxyContext } from '../../../context/api-proxy.svelte.js';
7
7
  import { setConfigContext } from '../../../context/config.svelte.js';
8
- import createContext from '../../../context/createContext.svelte.js';
9
8
  import { setLocaleContext } from '../../../context/locale.svelte.js';
9
+ import { setTitleContext } from '../../../context/title';
10
10
  import { setUserContext } from '../../../context/user.svelte.js';
11
11
  import { toKebabCase } from '../../../../util/string';
12
12
  import ScrollArea from '../../ui/scroll-area/scroll-area.svelte';
@@ -22,7 +22,7 @@
22
22
  user: User;
23
23
  };
24
24
 
25
- const { doc, config, locale: initialeLocale, user, onDataChange, onFieldFocus }: Props = $props();
25
+ const { doc, config, locale: initialLocale, user, onDataChange, onFieldFocus }: Props = $props();
26
26
 
27
27
  function buildPanelURL() {
28
28
  // Start with the base URI for the panel
@@ -35,16 +35,14 @@
35
35
  return panelUri;
36
36
  }
37
37
 
38
- setAPIProxyContext(API_PROXY.DOCUMENT);
38
+ setAPIProxyContext();
39
39
  // svelte-ignore state_referenced_locally
40
40
  setConfigContext(config);
41
41
  // svelte-ignore state_referenced_locally
42
42
  setUserContext(user);
43
- createContext('title', '[untitled]');
44
-
45
- $effect(() => {
46
- setLocaleContext(initialeLocale);
47
- });
43
+ // svelte-ignore state_referenced_locally
44
+ setLocaleContext(initialLocale);
45
+ setTitleContext('[untitled]');
48
46
  </script>
49
47
 
50
48
  <Toaster />
@@ -1,18 +1,18 @@
1
1
  <script lang="ts">
2
2
  import { page } from '$app/state';
3
3
  import { getConfigContext } from '../../../context/config.svelte.js';
4
+ import { getTitleContext } from '../../../context/title';
4
5
  import type { Route } from '../../../../types';
5
- import { getContext } from 'svelte';
6
6
  import Button from '../button/button.svelte';
7
7
 
8
8
  const config = getConfigContext();
9
- const titleContext = getContext<{ value: string }>('title');
9
+ const titleContext = getTitleContext();
10
10
 
11
11
  const aria = $derived<Route[]>(page.data.aria);
12
12
  </script>
13
13
 
14
14
  <div class="rz-aria">
15
- {#each aria as route}
15
+ {#each aria as route, index (index)}
16
16
  {@const Icon = config.raw.icons[route.icon]}
17
17
  {#if route.url}
18
18
  <Button variant="text" icon={Icon} href={route.url}>
@@ -25,8 +25,13 @@
25
25
  {/each}
26
26
  </div>
27
27
 
28
- <style>
29
- .rz-aria {
28
+ <style>/**************************************/
29
+
30
+ /* Font */
31
+
32
+ /**************************************/
33
+
34
+ .rz-aria {
30
35
  display: flex;
31
36
  align-items: center;
32
37
  gap: var(--rz-size-3);
@@ -40,7 +45,8 @@
40
45
  opacity: 1;
41
46
  }
42
47
  }
43
- .rz-aria__last {
48
+
49
+ .rz-aria__last {
44
50
  overflow: hidden;
45
51
  display: -webkit-box;
46
52
  -webkit-box-orient: vertical;
@@ -34,8 +34,8 @@
34
34
  <style>
35
35
  /** */
36
36
  :root {
37
- --rz-card-hover-bg: light-dark(hsl(var(--rz-gray-14)), hsl(var(--rz-gray-4)));
38
- --rz-card-bg: light-dark(hsl(var(--rz-gray-16)), hsl(var(--rz-gray-3)));
37
+ --rz-card-hover-bg: light-dark(hsl(var(--rz-gray-18)), hsl(var(--rz-gray-4)));
38
+ --rz-card-bg: light-dark(hsl(var(--rz-gray-17)), hsl(var(--rz-gray-3)));
39
39
  }
40
40
 
41
41
  .rz-document-card {
@@ -13,16 +13,18 @@
13
13
  open = $bindable(false),
14
14
  ref = $bindable(null),
15
15
  value = $bindable(''),
16
+ preventScroll = true,
16
17
  children,
17
18
  ...restProps
18
19
  }: WithoutChildrenOrChild<DialogPrimitive.RootProps> &
19
20
  WithoutChildrenOrChild<CommandPrimitive.RootProps> & {
20
21
  children: Snippet;
22
+ preventScroll?: boolean;
21
23
  } = $props();
22
24
  </script>
23
25
 
24
26
  <Dialog.Root bind:open {...restProps}>
25
- <Dialog.Content class="rz-command-dialog-content">
27
+ <Dialog.Content class="rz-command-dialog-content" {preventScroll}>
26
28
  <Command
27
29
  class="rz-command-dialog-content__command"
28
30
  {...restProps}
@@ -3,6 +3,7 @@ import type { Snippet } from 'svelte';
3
3
  import './command-dialog.css';
4
4
  type $$ComponentProps = WithoutChildrenOrChild<DialogPrimitive.RootProps> & WithoutChildrenOrChild<CommandPrimitive.RootProps> & {
5
5
  children: Snippet;
6
+ preventScroll?: boolean;
6
7
  };
7
8
  declare const CommandDialog: import("svelte").Component<$$ComponentProps, {}, "value" | "ref" | "open">;
8
9
  type CommandDialog = ReturnType<typeof CommandDialog>;
@@ -1,15 +1,16 @@
1
1
  export declare function setAPIProxyContext(key?: symbol): {
2
2
  getRessource: <T>(url: string, options?: GetResourcesOptions<T>) => Resource<T>;
3
3
  invalidateAll: () => void;
4
+ invalidate: (pattern: string | RegExp) => void;
4
5
  readonly urls: string[];
5
6
  };
6
7
  export declare function getAPIProxyContext(key?: symbol): {
7
8
  getRessource: <T>(url: string, options?: GetResourcesOptions<T>) => Resource<T>;
8
9
  invalidateAll: () => void;
10
+ invalidate: (pattern: string | RegExp) => void;
9
11
  readonly urls: string[];
10
12
  };
11
13
  export declare const API_PROXY: {
12
- DOCUMENT: symbol;
13
14
  ROOT: symbol;
14
15
  };
15
16
  export type Resource<T = any> = {
@@ -63,11 +63,19 @@ function createAPIProxy() {
63
63
  resource.refresh();
64
64
  });
65
65
  }
66
+ function invalidate(pattern) {
67
+ resources.forEach((resource, url) => {
68
+ if (typeof pattern === 'string' ? url.includes(pattern) : pattern.test(url)) {
69
+ resource.refresh();
70
+ }
71
+ });
72
+ }
66
73
  return {
67
74
  getRessource,
68
75
  invalidateAll,
76
+ invalidate,
69
77
  get urls() {
70
- return Array.from(resources.entries()).map(([url, resource]) => url);
78
+ return Array.from(resources.entries()).map(([url]) => url);
71
79
  }
72
80
  };
73
81
  }
@@ -78,8 +86,6 @@ export function setAPIProxyContext(key = API_PROXY.ROOT) {
78
86
  export function getAPIProxyContext(key = API_PROXY.ROOT) {
79
87
  return getContext(key);
80
88
  }
81
- // @TODO why multiple APIProxy... ROOT everywhere should work
82
89
  export const API_PROXY = {
83
- DOCUMENT: Symbol('api-proxy.document'),
84
90
  ROOT: Symbol('api-proxy.root')
85
91
  };
@@ -71,7 +71,7 @@ export declare function setDocumentFormContext<T extends WithOptional<GenericDoc
71
71
  readonly isLive: boolean;
72
72
  setFocusedField(path: string): void;
73
73
  };
74
- export declare function getDocumentFormContext<T extends WithOptional<GenericDoc, 'id'> = GenericDoc>(key?: string): {
74
+ export declare function getDocumentFormContext<T extends WithOptional<GenericDoc, 'id'> = WithOptional<GenericDoc, 'id'>>(key?: string): {
75
75
  key: string;
76
76
  setValue: (path: string, value: any) => void;
77
77
  getRawValue: <T_1>(path: string) => NonNullable<T_1> | null;
@@ -140,7 +140,7 @@ export declare function getDocumentFormContext<T extends WithOptional<GenericDoc
140
140
  readonly isLive: boolean;
141
141
  setFocusedField(path: string): void;
142
142
  };
143
- export type DocumentFormContext<T extends WithOptional<GenericDoc, 'id'> = GenericDoc> = ReturnType<typeof setDocumentFormContext<T>>;
143
+ export type DocumentFormContext<T extends WithOptional<GenericDoc, 'id'> = WithOptional<GenericDoc, 'id'>> = ReturnType<typeof setDocumentFormContext<T>>;
144
144
  type AddBlock = (block: Omit<GenericBlock, 'id' | 'path'>) => void;
145
145
  type MoveBlock = (from: number, to: number) => void;
146
146
  export type FormSuccessData = {