rimecms 0.25.0 → 0.25.2

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 (61) hide show
  1. package/dist/core/config/shared/upload-directories.d.ts +0 -4
  2. package/dist/core/config/shared/upload-directories.js +0 -72
  3. package/dist/core/operations/hooks/before-read/set-document-title.server.js +1 -1
  4. package/dist/fields/blocks/component/Block.svelte +1 -1
  5. package/dist/fields/blocks/component/Block.svelte.d.ts +1 -1
  6. package/dist/fields/blocks/component/props.d.ts +1 -1
  7. package/dist/fields/combobox/component/props.d.ts +1 -1
  8. package/dist/fields/date/component/Date.svelte +8 -4
  9. package/dist/fields/date/component/Date.svelte.d.ts +1 -1
  10. package/dist/fields/email/component/props.d.ts +1 -1
  11. package/dist/fields/group/component/Group.svelte +1 -1
  12. package/dist/fields/link/component/RessourceInput.svelte +1 -1
  13. package/dist/fields/relation/component/Relation.svelte +1 -3
  14. package/dist/fields/relation/component/default/Default.svelte +3 -3
  15. package/dist/fields/relation/component/types.d.ts +0 -1
  16. package/dist/fields/relation/component/upload/Browse.svelte +1 -1
  17. package/dist/fields/relation/index.js +2 -1
  18. package/dist/fields/rich-text/component/props.d.ts +1 -1
  19. package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle-plugin.js +1 -2
  20. package/dist/fields/rich-text/core/features/link/component/link-selector.svelte +23 -5
  21. package/dist/fields/rich-text/core/features/resource/resource.svelte +1 -1
  22. package/dist/fields/rich-text/core/features/upload/upload.svelte +10 -3
  23. package/dist/fields/rich-text/core/render-rich-text.svelte +1 -1
  24. package/dist/fields/rich-text/core/render-rich-text.svelte.d.ts +1 -1
  25. package/dist/fields/rich-text/core/svelte/node-view-renderer.svelte.js +0 -1
  26. package/dist/fields/select/component/props.d.ts +1 -1
  27. package/dist/fields/text/component/props.d.ts +1 -1
  28. package/dist/fields/textarea/component/props.d.ts +2 -2
  29. package/dist/fields/time/component/props.d.ts +1 -1
  30. package/dist/panel/components/fields/RenderFields.svelte +2 -2
  31. package/dist/panel/components/fields/RenderFields.svelte.d.ts +1 -1
  32. package/dist/panel/components/sections/collection/grid/grid-item/Folder.svelte +6 -1
  33. package/dist/panel/components/sections/collection/grid/grid-item/FolderEdit.svelte +9 -21
  34. package/dist/panel/components/sections/collection/header/create-folder/CreateFolder.svelte +5 -5
  35. package/dist/panel/components/sections/collection/list/row/Row.svelte +1 -1
  36. package/dist/panel/components/sections/collection/tree/CollectionTree.svelte +0 -1
  37. package/dist/panel/components/sections/document/AuthFooter.svelte +2 -2
  38. package/dist/panel/components/sections/document/AuthFooter.svelte.d.ts +1 -1
  39. package/dist/panel/components/sections/document/ButtonStatus.svelte +1 -1
  40. package/dist/panel/components/sections/document/ButtonStatus.svelte.d.ts +1 -1
  41. package/dist/panel/components/sections/document/Document.svelte +4 -4
  42. package/dist/panel/components/sections/document/FloatingUI.svelte +4 -2
  43. package/dist/panel/components/sections/document/FloatingUI.svelte.d.ts +1 -1
  44. package/dist/panel/components/sections/document/Header.svelte +1 -1
  45. package/dist/panel/components/sections/document/Header.svelte.d.ts +1 -1
  46. package/dist/panel/components/sections/document/Settings.svelte +1 -1
  47. package/dist/panel/components/sections/document/Settings.svelte.d.ts +1 -1
  48. package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte +1 -1
  49. package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte.d.ts +1 -1
  50. package/dist/panel/components/ui/language-switcher/LanguageSwitcher.svelte +39 -34
  51. package/dist/panel/components/ui/nav/Nav.svelte +7 -2
  52. package/dist/panel/components/ui/nav/NavItem.svelte +3 -2
  53. package/dist/panel/components/ui/nav/UserButton.svelte +4 -4
  54. package/dist/panel/context/documentForm.svelte.d.ts +1 -0
  55. package/dist/panel/context/documentForm.svelte.js +4 -4
  56. package/dist/panel/context/locale.svelte.js +1 -1
  57. package/dist/panel/pages/collection/Collection.svelte +1 -1
  58. package/dist/panel/pages/collection-document/CollectionDocument.svelte +2 -2
  59. package/dist/panel/pages/dashboard/Dashboard.svelte +8 -8
  60. package/dist/panel/pages/dashboard/Dashboard.svelte.d.ts +1 -1
  61. package/package.json +1 -1
@@ -1,9 +1,5 @@
1
1
  import type { WithUpload } from '../../collections/upload/util/config.js';
2
2
  import type { BuiltCollection } from '../types.js';
3
- /**
4
- * Creates an upload directories collection for collections with upload enabled
5
- * Eg. for medias this will create a collection medias_directories
6
- */
7
3
  /**
8
4
  * Creates an upload directories collection for collections with upload enabled
9
5
  * Eg. for medias this will create a collection medias_directories
@@ -2,76 +2,6 @@ import { validatePath } from '../../collections/upload/util/path.js';
2
2
  import { withDirectoriesSuffix } from '../../naming.js';
3
3
  import { date } from '../../../fields/date/index.js';
4
4
  import { text } from '../../../fields/text/index.js';
5
- /**
6
- * Creates an upload directories collection for collections with upload enabled
7
- * Eg. for medias this will create a collection medias_directories
8
- */
9
- // export function makeUploadDirectoriesCollections<C extends Config>(config: C) {
10
- // for (const collection of config.collections || []) {
11
- // if (collection.upload) {
12
- // const slug = withDirectoriesSuffix(collection.slug);
13
- // // If already created skip to the next colleciton
14
- // // for exemple a versions collections of an upload
15
- // // collection should not have a directories related table
16
- // if ((config.collections || []).filter((c) => c.slug === slug).length) continue;
17
- // const directoriesConfig = collection.upload.directories;
18
- // // else create the directory collection
19
- // let directoriesCollection: BuiltCollection = {
20
- // slug: slug as CollectionSlug,
21
- // kebab: withDirectoriesSuffix(toKebabCase(collection.slug)),
22
- // versions: undefined,
23
- // access: {
24
- // read: directoriesConfig?.access?.read || collection.access.read,
25
- // create: directoriesConfig?.access?.create || collection.access.create,
26
- // update: directoriesConfig?.access?.update || collection.access.update,
27
- // delete: directoriesConfig?.access?.delete || collection.access.delete
28
- // },
29
- // fields: [
30
- // text('id').validate(validatePath).unique().required().hidden(),
31
- // text('name').validate((value) => {
32
- // const pattern = /^[a-zA-Z0-9-_ ]+$/;
33
- // if (typeof value !== 'string' || !pattern.test(value)) {
34
- // return 'Incorrect folder name';
35
- // }
36
- // return true;
37
- // }),
38
- // text('parent').hidden(),
39
- // ...(directoriesConfig?.fields || []),
40
- // date('createdAt').hidden(),
41
- // date('updatedAt').hidden()
42
- // ],
43
- // type: 'collection',
44
- // label: {
45
- // singular: `${collection.slug} directory`,
46
- // plural: `${collection.slug} directories`
47
- // },
48
- // icon: collection.icon,
49
- // $hooks: {
50
- // beforeOperation: directoriesConfig?.$hooks?.beforeOperation || [],
51
- // beforeCreate: [exctractPath, ...(directoriesConfig?.$hooks?.beforeCreate || [])],
52
- // beforeRead: directoriesConfig?.$hooks?.beforeRead || [],
53
- // beforeUpdate: [
54
- // exctractPath,
55
- // prepareDirectoryChildren,
56
- // ...(directoriesConfig?.$hooks?.beforeUpdate || [])
57
- // ],
58
- // beforeDelete: directoriesConfig?.$hooks?.beforeDelete || [],
59
- // afterCreate: directoriesConfig?.$hooks?.afterCreate || [],
60
- // afterUpdate: [updateDirectoryChildren, ...(directoriesConfig?.$hooks?.afterUpdate || [])],
61
- // afterDelete: directoriesConfig?.$hooks?.afterDelete || []
62
- // },
63
- // asTitle: 'path',
64
- // asThumbnail: collection.asThumbnail,
65
- // panel: false
66
- // // _generateTypes: false,
67
- // // _generateSchema: false
68
- // };
69
- // directoriesCollection = augmentHooks(directoriesCollection);
70
- // config.collections = [...(config.collections || []), directoriesCollection];
71
- // }
72
- // }
73
- // return config;
74
- // }
75
5
  /**
76
6
  * Creates an upload directories collection for collections with upload enabled
77
7
  * Eg. for medias this will create a collection medias_directories
@@ -79,8 +9,6 @@ import { text } from '../../../fields/text/index.js';
79
9
  export function makeUploadDirectoriesCollectionClient(collection) {
80
10
  const slug = withDirectoriesSuffix(collection.slug);
81
11
  const directoriesConfig = collection.upload.directories;
82
- console.log(collection.upload);
83
- console.log(directoriesConfig?.fields);
84
12
  // else create the directory collection
85
13
  let directoriesCollection = {
86
14
  slug: slug,
@@ -1,5 +1,5 @@
1
+ import { richTextJSONToText } from '../../../../fields/rich-text/index.js';
1
2
  import { getValueAtPath, isObjectLiteral } from '../../../../util/object.js';
2
- import { richTextJSONToText } from '../../../../fields/rich-text/client.js';
3
3
  import { Hooks } from '../index.server.js';
4
4
  export const setDocumentTitle = Hooks.beforeRead(async (args) => {
5
5
  const config = args.config;
@@ -2,7 +2,7 @@
2
2
  import type { GenericBlock } from '../../../core/types/doc.js';
3
3
  import type { BlocksFieldBlock } from '../../types';
4
4
  import RenderFields from '../../../panel/components/fields/RenderFields.svelte';
5
- import { type DocumentFormContext } from '../../../panel/context/documentForm.svelte';
5
+ import { type DocumentFormContext } from '../../../panel/context/documentForm.svelte.js';
6
6
  import { useOnce } from '../../../panel/util/once.svelte.js';
7
7
  import { capitalize } from '../../../util/string.js';
8
8
  import { GripVertical, ToyBrick } from '@lucide/svelte';
@@ -1,5 +1,5 @@
1
1
  import type { BlocksFieldBlock } from '../../types';
2
- import { type DocumentFormContext } from '../../../panel/context/documentForm.svelte';
2
+ import { type DocumentFormContext } from '../../../panel/context/documentForm.svelte.js';
3
3
  type Props = {
4
4
  config: BlocksFieldBlock;
5
5
  path: string;
@@ -1,4 +1,4 @@
1
- import type { DocumentFormContext } from '../../../panel/context/documentForm.svelte';
1
+ import type { DocumentFormContext } from '../../../panel/context/documentForm.svelte.js';
2
2
  import type { BlocksField } from '../index.js';
3
3
  export type BlocksProps = {
4
4
  path: string;
@@ -1,4 +1,4 @@
1
- import type { DocumentFormContext } from '../../../panel/context/documentForm.svelte';
1
+ import type { DocumentFormContext } from '../../../panel/context/documentForm.svelte.js';
2
2
  import type { ComboBoxField } from '../index.js';
3
3
  export type ComboBoxProps = {
4
4
  path: string;
@@ -4,7 +4,7 @@
4
4
  import { Button } from '../../../panel/components/ui/button/index.js';
5
5
  import { Calendar } from '../../../panel/components/ui/calendar/index.js';
6
6
  import * as Dialog from '../../../panel/components/ui/dialog/index.js';
7
- import { type DocumentFormContext } from '../../../panel/context/documentForm.svelte';
7
+ import { type DocumentFormContext } from '../../../panel/context/documentForm.svelte.js';
8
8
  import { getLocaleContext } from '../../../panel/context/locale.svelte';
9
9
  import { CalendarDate, getLocalTimeZone, type DateValue } from '@internationalized/date';
10
10
  import { Calendar as CalendarIcon } from '@lucide/svelte';
@@ -48,7 +48,7 @@
48
48
  </script>
49
49
 
50
50
  <fieldset class="rz-date-field {config.className || ''}" use:root={field}>
51
- <Field.Label {config} for={path || config.name} />
51
+ <Field.Label {config} for={path || config.name} />
52
52
 
53
53
  <Button
54
54
  id="foo"
@@ -65,7 +65,12 @@
65
65
 
66
66
  <Dialog.Root bind:open={dialogOpen}>
67
67
  <Dialog.Content size="sm" class="rz-date__dialog-content">
68
- <Calendar type="single" value={calendarDate} onValueChange={handleCalendarChange} initialFocus />
68
+ <Calendar
69
+ type="single"
70
+ value={calendarDate}
71
+ onValueChange={handleCalendarChange}
72
+ initialFocus
73
+ />
69
74
  </Dialog.Content>
70
75
  </Dialog.Root>
71
76
  <Field.Hint {config} />
@@ -77,7 +82,6 @@
77
82
  .rz-dialog-content.rz-date__dialog-content {
78
83
  width: 100px;
79
84
  padding: 12rem;
80
-
81
85
  }
82
86
  .rz-date__button.rz-button {
83
87
  width: 200px;
@@ -1,4 +1,4 @@
1
- import { type DocumentFormContext } from '../../../panel/context/documentForm.svelte';
1
+ import { type DocumentFormContext } from '../../../panel/context/documentForm.svelte.js';
2
2
  import type { DateField } from '../index.js';
3
3
  type Props = {
4
4
  path: string;
@@ -1,5 +1,5 @@
1
1
  import type { SimplerField } from '../../types.js';
2
- import type { DocumentFormContext } from '../../../panel/context/documentForm.svelte';
2
+ import type { DocumentFormContext } from '../../../panel/context/documentForm.svelte.js';
3
3
  import type { FormContext } from '../../../panel/context/form.svelte.js';
4
4
  import type { EmailField } from '../index.js';
5
5
  export interface EmailFieldProps {
@@ -8,7 +8,7 @@
8
8
  import FieldsPreviewTrigger from '../../../panel/components/fields/FieldsPreviewTrigger.svelte';
9
9
  import RenderFields from '../../../panel/components/fields/RenderFields.svelte';
10
10
  import type { DocumentFormContext } from '../../../panel/context/documentForm.svelte.js';
11
- import { getUserContext } from '../../../panel/context/user.svelte';
11
+ import { getUserContext } from '../../../panel/context/user.svelte.js';
12
12
  import { ChevronDown, FolderClosed, FolderOpen } from '@lucide/svelte';
13
13
  import { onMount } from 'svelte';
14
14
 
@@ -4,7 +4,7 @@
4
4
  import type { GenericDoc } from '../../../core/types/doc.js';
5
5
  import * as Command from '../../../panel/components/ui/command/index.js';
6
6
  import Tag from '../../../panel/components/ui/tag/tag.svelte';
7
- import { API_PROXY, getAPIProxyContext } from '../../../panel/context/api-proxy.svelte';
7
+ import { API_PROXY, getAPIProxyContext } from '../../../panel/context/api-proxy.svelte.js';
8
8
  import type { PrototypeSlug } from '../../../types';
9
9
  import { toKebabCase } from '../../../util/string';
10
10
 
@@ -5,12 +5,11 @@
5
5
  import { Field } from '../../../panel/components/fields/index.js';
6
6
  import { root } from '../../../panel/components/fields/root.svelte.js';
7
7
  import { getCollectionContext } from '../../../panel/context/collection.svelte.js';
8
- import { getConfigContext } from '../../../panel/context/config.svelte';
8
+ import { getConfigContext } from '../../../panel/context/config.svelte.js';
9
9
  import { type DocumentFormContext } from '../../../panel/context/documentForm.svelte.js';
10
10
  import { getLocaleContext } from '../../../panel/context/locale.svelte';
11
11
  import { panelUrl } from '../../../panel/util/url.js';
12
12
  import { moveItem } from '../../../util/array.js';
13
- import { getValueAtPath } from '../../../util/object.js';
14
13
  import { snapshot } from '../../../util/state.js';
15
14
  import { API_PROXY, getAPIProxyContext } from '../../../panel/context/api-proxy.svelte.js';
16
15
  import type { Relation, RelationField } from '../index.js';
@@ -58,7 +57,6 @@
58
57
  function documentToRelationFieldItem(doc: GenericDoc) {
59
58
  const itemInFieldValue = retreiveRelation(doc.id);
60
59
  const item: RelationFieldItem = {
61
- label: getValueAtPath(relationConfig.asTitle, doc) || '[untitled]',
62
60
  documentId: doc.id,
63
61
  title: doc.title,
64
62
  editUrl: panelUrl(relationConfig.kebab, doc.id),
@@ -83,7 +83,7 @@
83
83
  >
84
84
  {#each selectedItems as item (item.documentId)}
85
85
  <Tag onRemove={() => removeValue(item.documentId)} {readOnly}>
86
- <a href={item.editUrl}>{item.label}</a>
86
+ <a href={item.editUrl}>{item.title}</a>
87
87
  </Tag>
88
88
  {/each}
89
89
 
@@ -107,8 +107,8 @@
107
107
  {#if inputFocused}
108
108
  <Command.List>
109
109
  {#each availableItems as item (item.documentId)}
110
- <Command.Item value={item.label} onSelect={() => onSelect(item)}>
111
- <span>{item.label}</span>
110
+ <Command.Item value={item.title} onSelect={() => onSelect(item)}>
111
+ <span>{item.title}</span>
112
112
  </Command.Item>
113
113
  {/each}
114
114
  <Command.Empty>Nothing to select</Command.Empty>
@@ -3,7 +3,6 @@ import type { GenericDoc } from '../../../core/types/doc.js';
3
3
  export type RelationFieldItem = {
4
4
  id?: string;
5
5
  documentId: string;
6
- label: string;
7
6
  title: string;
8
7
  filename?: string;
9
8
  filesize?: string;
@@ -5,7 +5,7 @@
5
5
  import Folder from '../../../../panel/components/sections/collection/grid/grid-item/Folder.svelte';
6
6
  import CardDocument from '../../../../panel/components/ui/card-document/card-document.svelte';
7
7
  import * as Sheet from '../../../../panel/components/ui/sheet/index.js';
8
- import { API_PROXY, getAPIProxyContext } from '../../../../panel/context/api-proxy.svelte';
8
+ import { API_PROXY, getAPIProxyContext } from '../../../../panel/context/api-proxy.svelte.js';
9
9
  import type { BuiltCollection, UploadDoc } from '../../../../types';
10
10
 
11
11
  type Props = { open: boolean; addValue: (item: string) => void; config: BuiltCollection };
@@ -4,6 +4,7 @@ import { PARAMS } from '../../core/constant';
4
4
  import { FormFieldBuilder } from '../../core/fields/builders/form-field-builder.js';
5
5
  import { trycatchFetch } from '../../util/function';
6
6
  import { hasProps, isObjectLiteral } from '../../util/object.js';
7
+ import { toKebabCase } from '../../util/string.js';
7
8
  import Cell from './component/Cell.svelte';
8
9
  import RelationComponent from './component/Relation.svelte';
9
10
  export const ensureRelationExists = async (value, { config }) => {
@@ -13,7 +14,7 @@ export const ensureRelationExists = async (value, { config }) => {
13
14
  const getRequsetEvent = await import('$app/server').then((m) => m.getRequestEvent);
14
15
  const output = [];
15
16
  const retrieveRelation = async (id) => {
16
- const [err, response] = await trycatchFetch(`${env.PUBLIC_RIME_URL}/api/${config.relationTo}/${id}?${PARAMS.SELECT}=id`, {
17
+ const [err, response] = await trycatchFetch(`${env.PUBLIC_RIME_URL}/api/${toKebabCase(config.relationTo)}/${id}?${PARAMS.SELECT}=id`, {
17
18
  method: 'GET',
18
19
  headers: getRequsetEvent().request.headers
19
20
  });
@@ -1,4 +1,4 @@
1
- import type { DocumentFormContext } from '../../../panel/context/documentForm.svelte';
1
+ import type { DocumentFormContext } from '../../../panel/context/documentForm.svelte.js';
2
2
  import type { RichTextField } from '../index.js';
3
3
  export type RichTextFieldProps = {
4
4
  class?: string;
@@ -21,7 +21,7 @@ const getAbsolutePos = (state, relativePos) => {
21
21
  if (!ystate) {
22
22
  return -1;
23
23
  }
24
- return relativePositionToAbsolutePosition(ystate.doc, ystate.type, relativePos, ystate.binding.mapping) || 0;
24
+ return (relativePositionToAbsolutePosition(ystate.doc, ystate.type, relativePos, ystate.binding.mapping) || 0);
25
25
  };
26
26
  const getOuterDomNode = (view, domNode) => {
27
27
  let tmpDomNode = domNode;
@@ -144,7 +144,6 @@ export const DragHandlePlugin = ({ pluginKey = dragHandlePluginDefaultKey, eleme
144
144
  const newPos = tr.mapping.map(currentNodePos);
145
145
  if (newPos !== currentNodePos) {
146
146
  // TODO: Remove
147
- // console.log('Position has changed …', { old: currentNodePos, new: newPos }, tr);
148
147
  // Set the new position for our current node.
149
148
  currentNodePos = newPos;
150
149
  // Memorize relative position to retrieve absolute position in case of collaboration
@@ -6,7 +6,11 @@
6
6
  import Button from '../../../../../../panel/components/ui/button/button.svelte';
7
7
  import * as Command from '../../../../../../panel/components/ui/command/index.js';
8
8
  import Input from '../../../../../../panel/components/ui/input/input.svelte';
9
- import { API_PROXY, getAPIProxyContext, type Resource } from '../../../../../../panel/context/api-proxy.svelte';
9
+ import {
10
+ API_PROXY,
11
+ getAPIProxyContext,
12
+ type Resource
13
+ } from '../../../../../../panel/context/api-proxy.svelte.js';
10
14
  import { getLocaleContext } from '../../../../../../panel/context/locale.svelte';
11
15
  import validate from '../../../../../../util/validate.js';
12
16
  import { CornerDownLeft, ExternalLink, Link2, Newspaper, Trash } from '@lucide/svelte';
@@ -16,7 +20,12 @@
16
20
  import type { RichTextContext } from '../../../types';
17
21
  import './link-selector.css';
18
22
 
19
- type Props = { options?: LinkFeatureOptions; editor: Editor; context: RichTextContext; active: boolean };
23
+ type Props = {
24
+ options?: LinkFeatureOptions;
25
+ editor: Editor;
26
+ context: RichTextContext;
27
+ active: boolean;
28
+ };
20
29
  type LinkResource = { title: string; url: string };
21
30
  let { options, editor, context, active }: Props = $props();
22
31
 
@@ -36,7 +45,9 @@
36
45
  $effect(() => {
37
46
  if (Array.isArray(options?.resources) && !resources.length) {
38
47
  resources = options.resources.map((resourceOption) => {
39
- let params = resourceOption.query ? `?${resourceOption.query}&select=title,url` : '?select=title,url';
48
+ let params = resourceOption.query
49
+ ? `?${resourceOption.query}&select=title,url`
50
+ : '?select=title,url';
40
51
  params = locale.code ? `${params}&locale=${locale.code}` : params;
41
52
  const url = `${apiUrl(resourceOption.slug)}${params}`;
42
53
  return APIProxy.getRessource<LinkResource[]>(url, {
@@ -189,7 +200,9 @@
189
200
  <div class="rz-link-selector__button">
190
201
  {#if editor.getAttributes('link').href}
191
202
  <Button
192
- --rz-button-ghost-fg={isTargetBlank ? 'hsl(var(--rz-color-spot))' : 'hsl(var(--rz-color-fg))'}
203
+ --rz-button-ghost-fg={isTargetBlank
204
+ ? 'hsl(var(--rz-color-spot))'
205
+ : 'hsl(var(--rz-color-fg))'}
193
206
  onclick={() => (isTargetBlank = !isTargetBlank)}
194
207
  variant="ghost"
195
208
  size="icon-sm"
@@ -198,7 +211,12 @@
198
211
  <Button size="icon-sm" variant="ghost" icon={Trash} onclick={onDelete} />
199
212
  {:else}
200
213
  {#if options?.resources?.length}
201
- <Button onclick={() => (resourceDialogOpen = true)} size="icon-sm" icon={Newspaper} variant="ghost" />
214
+ <Button
215
+ onclick={() => (resourceDialogOpen = true)}
216
+ size="icon-sm"
217
+ icon={Newspaper}
218
+ variant="ghost"
219
+ />
202
220
  {/if}
203
221
  <Button type="submit" variant="ghost" size="icon-sm" icon={CornerDownLeft}></Button>
204
222
  {/if}
@@ -4,7 +4,7 @@
4
4
  import Button from '../../../../../panel/components/ui/button/button.svelte';
5
5
  import CardResource from '../../../../../panel/components/ui/card-resource/card-resource.svelte';
6
6
  import * as Command from '../../../../../panel/components/ui/command/index.js';
7
- import { API_PROXY, setAPIProxyContext } from '../../../../../panel/context/api-proxy.svelte';
7
+ import { API_PROXY, setAPIProxyContext } from '../../../../../panel/context/api-proxy.svelte.js';
8
8
  import type { NodeViewProps } from '@tiptap/core';
9
9
  import { onMount } from 'svelte';
10
10
  import NodeViewWrapper from '../../svelte/node-view-wrapper.svelte';
@@ -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, setAPIProxyContext } from '../../../../../panel/context/api-proxy.svelte';
9
+ import { API_PROXY, setAPIProxyContext } 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';
@@ -125,10 +125,17 @@
125
125
  <NodeViewWrapper>
126
126
  <div data-drag-handle class="rz-richtext-media" class:rz-richtext-media--selected={!!selected}>
127
127
  {#if !selected}
128
- <Button class="rz-richtext-media__add" variant="outline" onclick={handleClick}>Add a media</Button>
128
+ <Button class="rz-richtext-media__add" variant="outline" onclick={handleClick}
129
+ >Add a media</Button
130
+ >
129
131
  {:else}
130
132
  <div class="rz-richtext-media__actions">
131
- <Button size="xs" class="rz-richtext-media__button" type="button" onclick={() => (dialogLegendOpen = true)}>
133
+ <Button
134
+ size="xs"
135
+ class="rz-richtext-media__button"
136
+ type="button"
137
+ onclick={() => (dialogLegendOpen = true)}
138
+ >
132
139
  {legend || 'set legend'}
133
140
  </Button>
134
141
  <Button
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import type { JSONContent } from '@tiptap/core';
3
- import type { RichTextNodeRenderer } from '../client.js';
4
3
  import RenderRichText from './render-rich-text.svelte';
4
+ import type { RichTextNodeRenderer } from './types';
5
5
 
6
6
  type Props = {
7
7
  json?: JSONContent;
@@ -1,6 +1,6 @@
1
1
  import type { JSONContent } from '@tiptap/core';
2
- import type { RichTextNodeRenderer } from '../client.js';
3
2
  import RenderRichText from './render-rich-text.svelte';
3
+ import type { RichTextNodeRenderer } from './types';
4
4
  type Props = {
5
5
  json?: JSONContent;
6
6
  components?: {
@@ -42,7 +42,6 @@ class SvelteNodeView extends NodeView {
42
42
  context.set(key, ctx);
43
43
  }
44
44
  }
45
- console.log(context);
46
45
  const as = this.options.as ?? (this.node.isInline ? 'span' : 'div');
47
46
  const target = document.createElement(as);
48
47
  target.classList.add(`node-${this.node.type.name}`);
@@ -1,4 +1,4 @@
1
- import type { DocumentFormContext } from '../../../panel/context/documentForm.svelte';
1
+ import type { DocumentFormContext } from '../../../panel/context/documentForm.svelte.js';
2
2
  import type { SelectField } from '../index.js';
3
3
  export type SelectFieldProps = {
4
4
  path: string;
@@ -1,5 +1,5 @@
1
1
  import type { SimplerField } from '../../types.js';
2
- import type { DocumentFormContext } from '../../../panel/context/documentForm.svelte';
2
+ import type { DocumentFormContext } from '../../../panel/context/documentForm.svelte.js';
3
3
  import type { FormContext } from '../../../panel/context/form.svelte.js';
4
4
  import type { IconProps } from '@lucide/svelte';
5
5
  import type { Component } from 'svelte';
@@ -1,6 +1,6 @@
1
- import type { DocumentFormContext } from '../../../panel/context/documentForm.svelte';
2
- import type { TextAreaField } from '../index.js';
1
+ import type { DocumentFormContext } from '../../../panel/context/documentForm.svelte.js';
3
2
  import type { FormContext } from '../../../panel/context/form.svelte.js';
3
+ import type { TextAreaField } from '../index.js';
4
4
  export type TextAreaFieldProps = {
5
5
  path?: string;
6
6
  config: TextAreaField;
@@ -1,4 +1,4 @@
1
- import type { DocumentFormContext } from '../../../panel/context/documentForm.svelte';
1
+ import type { DocumentFormContext } from '../../../panel/context/documentForm.svelte.js';
2
2
  import type { TimeField } from '../index.js';
3
3
  export type TimeFieldProps = {
4
4
  path?: string;
@@ -4,8 +4,8 @@
4
4
  import { ComponentFieldBuilder } from '../../../fields/component';
5
5
  import { isTabsField } from '../../../fields/tabs';
6
6
  import type { FormField } from '../../../fields/types.js';
7
- import { type DocumentFormContext } from '../../context/documentForm.svelte';
8
- import { getUserContext } from '../../context/user.svelte';
7
+ import { type DocumentFormContext } from '../../context/documentForm.svelte.js';
8
+ import { getUserContext } from '../../context/user.svelte.js';
9
9
  import type { GenericDoc } from '../../../types';
10
10
  import type { WithOptional } from '../../../util/types';
11
11
 
@@ -1,5 +1,5 @@
1
1
  import type { FieldBuilder } from '../../../core/fields/builders';
2
- import { type DocumentFormContext } from '../../context/documentForm.svelte';
2
+ import { type DocumentFormContext } from '../../context/documentForm.svelte.js';
3
3
  import type { GenericDoc } from '../../../types';
4
4
  import type { WithOptional } from '../../../util/types';
5
5
  type Props = {
@@ -38,8 +38,13 @@
38
38
  h3 {
39
39
  font-variation-settings: 'wght' 600;
40
40
  font-weight: 600;
41
+ overflow: hidden;
42
+ display: -webkit-box;
43
+ -webkit-box-orient: vertical;
44
+ -webkit-line-clamp: 1;
45
+ font-size: var(--rz-text-sm);
41
46
  text-align: center;
42
- padding: var(--rz-size-3);
47
+ margin-block: var(--rz-size-3);
43
48
  }
44
49
  .rz-folder-svg {
45
50
  aspect-ratio: 5 / 4;
@@ -1,18 +1,15 @@
1
1
  <script lang="ts">
2
2
  import type { Directory } from '../../../../../../core/collections/upload/upload';
3
3
  import type { BuiltCollectionClient } from '../../../../../../core/config/types';
4
+ import { t__ } from '../../../../../../core/i18n/index.js';
4
5
  import { withDirectoriesSuffix } from '../../../../../../core/naming';
6
+ import RenderFields from '../../../../fields/RenderFields.svelte';
7
+ import Button from '../../../../ui/button/button.svelte';
5
8
  import * as Dialog from '../../../../ui/dialog/index.js';
6
- import { t__ } from '../../../../../../core/i18n';
7
- import RenderFields from '../../../../../index.server.js/components/fields/RenderFields.svelte';
8
- import Button from '../../../../../index.server.js/components/ui/button/button.svelte';
9
- import { API_PROXY, setAPIProxyContext } from '../../../../../index.server.js/context/api-proxy.svelte';
10
- import { getConfigContext } from '../../../../../index.server.js/context/config.svelte';
11
- import {
12
- setDocumentFormContext,
13
- type FormSuccessData
14
- } from '../../../../../index.server.js/context/documentForm.svelte';
15
- import { getUserContext } from '../../../../../index.server.js/context/user.svelte';
9
+ import { API_PROXY, setAPIProxyContext } from '../../../../../context/api-proxy.svelte.js';
10
+ import { getConfigContext } from '../../../../../context/config.svelte.js';
11
+ import { setDocumentFormContext } from '../../../../../context/documentForm.svelte.js';
12
+ import { getUserContext } from '../../../../../context/user.svelte.js';
16
13
 
17
14
  type Props = {
18
15
  open: boolean;
@@ -24,13 +21,8 @@
24
21
  const user = getUserContext();
25
22
  const configCtx = getConfigContext();
26
23
  const config = configCtx.getCollection(withDirectoriesSuffix(collection.slug));
27
- setAPIProxyContext(API_PROXY.DOCUMENT);
28
24
  let formElement = $state<HTMLFormElement>();
29
-
30
- async function beforeRedirect(data?: FormSuccessData) {
31
- open = false;
32
- return false;
33
- }
25
+ setAPIProxyContext(API_PROXY.DOCUMENT);
34
26
 
35
27
  const form = setDocumentFormContext({
36
28
  element: () => formElement,
@@ -38,7 +30,7 @@
38
30
  config,
39
31
  readOnly: !config.access.update(user.attributes, { id: folder.id }),
40
32
  key: folder._type,
41
- beforeRedirect: beforeRedirect
33
+ afterSuccess: () => (open = false)
42
34
  });
43
35
 
44
36
  function handleKeyDown(event: KeyboardEvent) {
@@ -64,11 +56,7 @@
64
56
  <Dialog.Content>
65
57
  {#snippet child({ props })}
66
58
  <form use:form.enhance action={form.buildPanelActionUrl()} bind:this={formElement} {...props}>
67
- <Dialog.Header>
68
- {t__('common.rename_dialog_title', folder.name)}
69
- </Dialog.Header>
70
59
  <RenderFields {form} fields={config.fields} />
71
-
72
60
  <Dialog.Footer --rz-justify-content="space-between">
73
61
  <Button data-submit disabled={!form.canSubmit} type="submit">{t__('common.save')}</Button>
74
62
  <Button onclick={() => (open = false)} variant="secondary">{t__('common.cancel')}</Button>
@@ -2,17 +2,17 @@
2
2
  import { invalidateAll } from '$app/navigation';
3
3
  import { t__ } from '../../../../../../core/i18n/index.js';
4
4
  import { withDirectoriesSuffix } from '../../../../../../core/naming';
5
+ import RenderFields from '../../../../fields/RenderFields.svelte';
5
6
  import Button from '../../../../ui/button/button.svelte';
6
7
  import * as Dialog from '../../../../ui/dialog/index.js';
8
+ import { API_PROXY, setAPIProxyContext } from '../../../../../context/api-proxy.svelte.js';
7
9
  import type { CollectionContext } from '../../../../../context/collection.svelte.js';
8
- import { FolderPlus } from '@lucide/svelte';
9
- import RenderFields from '../../../../../index.server.js/components/fields/RenderFields.svelte';
10
- import { API_PROXY, setAPIProxyContext } from '../../../../../index.server.js/context/api-proxy.svelte';
11
- import { getConfigContext } from '../../../../../index.server.js/context/config.svelte';
10
+ import { getConfigContext } from '../../../../../context/config.svelte.js';
12
11
  import {
13
12
  setDocumentFormContext,
14
13
  type FormSuccessData
15
- } from '../../../../../index.server.js/context/documentForm.svelte';
14
+ } from '../../../../../context/documentForm.svelte.js';
15
+ import { FolderPlus } from '@lucide/svelte';
16
16
 
17
17
  type Props = { collection: CollectionContext };
18
18
  const { collection }: Props = $props();
@@ -45,7 +45,7 @@
45
45
  {/if}
46
46
  <label for="checkbox-{doc.id}" class="rz-list-row__title">{doc.title || '[untitled]'}</label>
47
47
  {:else}
48
- <a class="rz-list-row__link" href="/panel/{collection.config.slug}/{doc.id}">
48
+ <a class="rz-list-row__link" href="/panel/{collection.config.kebab}/{doc.id}">
49
49
  {#if doc._thumbnail}
50
50
  <UploadThumbCell url={doc._thumbnail} mimeType={doc.mimeType} />
51
51
  {:else}
@@ -59,7 +59,6 @@
59
59
  };
60
60
 
61
61
  const initSortable = () => {
62
- console.log('initSortable');
63
62
  // Get all sortable containers including the root and nested ones
64
63
  const sortableContainers = document.querySelectorAll('.rz-collection-sortable');
65
64
 
@@ -4,8 +4,8 @@
4
4
  import type { BuiltCollection } from '../../../../core/config/types.js';
5
5
  import { t__ } from '../../../../core/i18n';
6
6
  import { text } from '../../../../fields';
7
- import type { DocumentFormContext } from '../../../context/documentForm.svelte';
8
- import { getUserContext } from '../../../context/user.svelte';
7
+ import type { DocumentFormContext } from '../../../context/documentForm.svelte.js';
8
+ import { getUserContext } from '../../../context/user.svelte.js';
9
9
  import { authClient } from '../../../util/auth';
10
10
  import validate from '../../../../util/validate';
11
11
  import { toast } from 'svelte-sonner';
@@ -1,5 +1,5 @@
1
1
  import type { BuiltCollection } from '../../../../core/config/types.js';
2
- import type { DocumentFormContext } from '../../../context/documentForm.svelte';
2
+ import type { DocumentFormContext } from '../../../context/documentForm.svelte.js';
3
3
  type Props = {
4
4
  operation: string;
5
5
  form: DocumentFormContext;
@@ -4,7 +4,7 @@
4
4
  import { PARAMS, VERSIONS_STATUS } from '../../../../core/constant.js';
5
5
  import * as Dialog from '../../ui/dialog/index.js';
6
6
  import * as Radio from '../../ui/radio-group/index.js';
7
- import type { DocumentFormContext } from '../../../context/documentForm.svelte';
7
+ import type { DocumentFormContext } from '../../../context/documentForm.svelte.js';
8
8
  import { toKebabCase } from '../../../../util/string';
9
9
  import { toast } from 'svelte-sonner';
10
10
  import { t__ } from '../../../../core/i18n/index.js';
@@ -1,4 +1,4 @@
1
- import type { DocumentFormContext } from '../../../context/documentForm.svelte';
1
+ import type { DocumentFormContext } from '../../../context/documentForm.svelte.js';
2
2
  type Props = {
3
3
  form: DocumentFormContext;
4
4
  };
@@ -5,13 +5,13 @@
5
5
  import { t__ } from '../../../../core/i18n/index.js';
6
6
  import type { GenericDoc } from '../../../../core/types/doc';
7
7
  import * as Dialog from '../../ui/dialog/index.js';
8
- import { getConfigContext } from '../../../context/config.svelte';
8
+ import { getConfigContext } from '../../../context/config.svelte.js';
9
9
  import {
10
10
  setDocumentFormContext,
11
11
  type FormSuccessData
12
- } from '../../../context/documentForm.svelte';
13
- import { getLocaleContext } from '../../../context/locale.svelte';
14
- import { getUserContext } from '../../../context/user.svelte';
12
+ } from '../../../context/documentForm.svelte.js';
13
+ import { getLocaleContext } from '../../../context/locale.svelte.js';
14
+ import { getUserContext } from '../../../context/user.svelte.js';
15
15
  import RenderFields from '../../fields/RenderFields.svelte';
16
16
  import Button from '../../ui/button/button.svelte';
17
17
  import AuthApiKeyDialog from './AuthAPIKeyDialog.svelte';
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { apiUrl } from '../../../../core/api/index.js';
3
3
  import type { GenericDoc } from '../../../../core/types/doc.js';
4
- import type { DocumentFormContext } from '../../../context/documentForm.svelte';
4
+ import type { DocumentFormContext } from '../../../context/documentForm.svelte.js';
5
5
  import { ChevronLeft } from '@lucide/svelte';
6
6
  import { toast } from 'svelte-sonner';
7
7
  import { t__ } from '../../../../core/i18n/index.js';
@@ -13,7 +13,9 @@
13
13
  const { form, onClose }: Props = $props();
14
14
 
15
15
  function onLocaleClick(code: string) {
16
- fetch(`${apiUrl(form.config.kebab)}?where[id][equals]=${form.values.id}&select=url&locale=${code}`)
16
+ fetch(
17
+ `${apiUrl(form.config.kebab)}?where[id][equals]=${form.values.id}&select=url&locale=${code}`
18
+ )
17
19
  .then((response) => response.json())
18
20
  .then((data: { docs: GenericDoc[] }) => {
19
21
  if (Array.isArray(data.docs) && data.docs.length) {
@@ -1,4 +1,4 @@
1
- import type { DocumentFormContext } from '../../../context/documentForm.svelte';
1
+ import type { DocumentFormContext } from '../../../context/documentForm.svelte.js';
2
2
  type Props = {
3
3
  form: DocumentFormContext;
4
4
  onClose: any;
@@ -3,7 +3,7 @@
3
3
  import type { BuiltArea, BuiltCollection } from '../../../../core/config/types';
4
4
  import { PARAMS } from '../../../../core/constant';
5
5
  import { t__ } from '../../../../core/i18n/index.js';
6
- import type { DocumentFormContext } from '../../../context/documentForm.svelte';
6
+ import type { DocumentFormContext } from '../../../context/documentForm.svelte.js';
7
7
  import { ExternalLink, PencilRuler, X } from '@lucide/svelte';
8
8
  import { Button } from '../../ui/button';
9
9
  import LanguageSwitcher from '../../ui/language-switcher/LanguageSwitcher.svelte';
@@ -1,5 +1,5 @@
1
1
  import type { BuiltArea, BuiltCollection } from '../../../../core/config/types';
2
- import type { DocumentFormContext } from '../../../context/documentForm.svelte';
2
+ import type { DocumentFormContext } from '../../../context/documentForm.svelte.js';
3
3
  type Props = {
4
4
  onClose?: any;
5
5
  form: DocumentFormContext;
@@ -5,7 +5,7 @@
5
5
  import { PARAMS, VERSIONS_STATUS } from '../../../../core/constant.js';
6
6
  import * as Dialog from '../../ui/dialog/index.js';
7
7
  import * as DropdownMenu from '../../ui/dropdown-menu/index.js';
8
- import type { DocumentFormContext } from '../../../context/documentForm.svelte';
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
11
  import { trycatchFetch } from '../../../../util/function.js';
@@ -1,4 +1,4 @@
1
- import type { DocumentFormContext } from '../../../context/documentForm.svelte';
1
+ import type { DocumentFormContext } from '../../../context/documentForm.svelte.js';
2
2
  import { Settings } from '@lucide/svelte';
3
3
  type Props = {
4
4
  form: DocumentFormContext;
@@ -2,7 +2,7 @@
2
2
  import type { WithUpload } from '../../../../../core/collections/upload/util/config';
3
3
  import type { BuiltCollection } from '../../../../../core/config/types';
4
4
  import Button from '../../../ui/button/button.svelte';
5
- import { type DocumentFormContext } from '../../../../context/documentForm.svelte';
5
+ import { type DocumentFormContext } from '../../../../context/documentForm.svelte.js';
6
6
  import { mimeTypeToIcon } from '../../../../util/upload.js';
7
7
  import * as util from '../../../../../util/file.js';
8
8
  import { capitalize } from '../../../../../util/string.js';
@@ -1,6 +1,6 @@
1
1
  import type { WithUpload } from '../../../../../core/collections/upload/util/config';
2
2
  import type { BuiltCollection } from '../../../../../core/config/types';
3
- import { type DocumentFormContext } from '../../../../context/documentForm.svelte';
3
+ import { type DocumentFormContext } from '../../../../context/documentForm.svelte.js';
4
4
  type Props = {
5
5
  form: DocumentFormContext;
6
6
  create: boolean;
@@ -1,11 +1,11 @@
1
1
  <script lang="ts">
2
+ import { dev } from '$app/environment';
2
3
  import Button from '../button/button.svelte';
3
- import { getLocaleContext } from '../../../context/locale.svelte';
4
- import { getConfigContext } from '../../../context/config.svelte';
5
- import Cookies from 'js-cookie';
6
4
  import * as DropdownMenu from '../dropdown-menu/index.js';
5
+ import { getConfigContext } from '../../../context/config.svelte.js';
6
+ import { getLocaleContext } from '../../../context/locale.svelte.js';
7
7
  import { Languages } from '@lucide/svelte';
8
- import { dev } from '$app/environment';
8
+ import Cookies from 'js-cookie';
9
9
 
10
10
  type Props = { onLocalClick: (code: string) => void };
11
11
  const { onLocalClick }: Props = $props();
@@ -13,40 +13,45 @@
13
13
  const locale = getLocaleContext();
14
14
  const config = getConfigContext();
15
15
  const locales = $state(config.raw.localization?.locales || []);
16
-
16
+
17
17
  function isActive(code: string) {
18
18
  return code === locale.code;
19
19
  }
20
20
  </script>
21
21
 
22
22
  {#if config.raw.localization?.locales.length}
23
- <DropdownMenu.Root>
24
- <DropdownMenu.Trigger>
25
- {#snippet child({ props })}
26
- <Button icon={Languages} size="sm" variant={ props['data-state'] === 'open' ? 'secondary' : 'ghost'} {...props}>
27
- {locale.label}
28
- </Button>
29
- {/snippet}
30
- </DropdownMenu.Trigger>
31
-
32
- <DropdownMenu.Portal>
33
- <DropdownMenu.Content align="end">
34
- {#each locales as item, index (index)}
35
- <DropdownMenu.Item
36
- disabled={isActive(item.code)}
37
- data-active={isActive(item.code) ? '' : null}
38
- onclick={() => {
39
- Cookies.set('Locale', item.code, {
40
- sameSite: 'strict',
41
- secure: !dev
42
- });
43
- onLocalClick(item.code);
44
- }}
23
+ <DropdownMenu.Root>
24
+ <DropdownMenu.Trigger>
25
+ {#snippet child({ props })}
26
+ <Button
27
+ icon={Languages}
28
+ size="sm"
29
+ variant={props['data-state'] === 'open' ? 'secondary' : 'ghost'}
30
+ {...props}
45
31
  >
46
- <span>{item.label}</span>
47
- </DropdownMenu.Item>
48
- {/each}
49
- </DropdownMenu.Content>
50
- </DropdownMenu.Portal>
51
- </DropdownMenu.Root>
52
- {/if}
32
+ {locale.label}
33
+ </Button>
34
+ {/snippet}
35
+ </DropdownMenu.Trigger>
36
+
37
+ <DropdownMenu.Portal>
38
+ <DropdownMenu.Content align="end">
39
+ {#each locales as item, index (index)}
40
+ <DropdownMenu.Item
41
+ disabled={isActive(item.code)}
42
+ data-active={isActive(item.code) ? '' : null}
43
+ onclick={() => {
44
+ Cookies.set('Locale', item.code, {
45
+ sameSite: 'strict',
46
+ secure: !dev
47
+ });
48
+ onLocalClick(item.code);
49
+ }}
50
+ >
51
+ <span>{item.label}</span>
52
+ </DropdownMenu.Item>
53
+ {/each}
54
+ </DropdownMenu.Content>
55
+ </DropdownMenu.Portal>
56
+ </DropdownMenu.Root>
57
+ {/if}
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { page } from '$app/state';
3
- import { getConfigContext } from '../../../context/config.svelte';
3
+ import { getConfigContext } from '../../../context/config.svelte.js';
4
4
  import type { Route } from '../../../types';
5
5
  import { panelUrl } from '../../../util/url.js';
6
6
  import { PanelsTopLeft } from '@lucide/svelte';
@@ -70,7 +70,12 @@
70
70
  </div>
71
71
  </div>
72
72
 
73
- <button class="rz-nav__toggle" onclick={() => setCollapsed(!isCollapsed)} aria-label="Toggle navigation"> </button>
73
+ <button
74
+ class="rz-nav__toggle"
75
+ onclick={() => setCollapsed(!isCollapsed)}
76
+ aria-label="Toggle navigation"
77
+ >
78
+ </button>
74
79
  </div>
75
80
 
76
81
  <style>
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { page } from '$app/state';
3
3
  import * as Tooltip from '../tooltip';
4
- import { getConfigContext } from '../../../context/config.svelte';
4
+ import { getConfigContext } from '../../../context/config.svelte.js';
5
5
  import type { Route } from '../../../types';
6
6
  import { File } from '@lucide/svelte';
7
7
  import NavItemButton from './NavItemButton.svelte';
@@ -15,7 +15,8 @@
15
15
 
16
16
  const config = getConfigContext();
17
17
 
18
- const RouteIcon = typeof route.icon === 'function' ? route.icon : config.raw.icons[route.icon] || File;
18
+ const RouteIcon =
19
+ typeof route.icon === 'function' ? route.icon : config.raw.icons[route.icon] || File;
19
20
 
20
21
  let pathname = page.url.pathname;
21
22
 
@@ -1,11 +1,11 @@
1
1
  <script lang="ts">
2
- import { getUserContext } from '../../../context/user.svelte';
3
- import Button from '../button/button.svelte';
4
- import { LogOut } from '@lucide/svelte';
2
+ import { env } from '$env/dynamic/public';
5
3
  import * as Tooltip from '../tooltip';
4
+ import { getUserContext } from '../../../context/user.svelte.js';
6
5
  import { authClient } from '../../../util/auth.js';
7
- import { env } from '$env/dynamic/public';
6
+ import { LogOut } from '@lucide/svelte';
8
7
  import { toast } from 'svelte-sonner';
8
+ import Button from '../button/button.svelte';
9
9
 
10
10
  type Props = { navCollapsed: boolean };
11
11
  const { navCollapsed }: Props = $props();
@@ -152,6 +152,7 @@ type Args<T> = {
152
152
  element: () => HTMLFormElement | undefined;
153
153
  beforeSubmit?: (data: Dic) => Promise<Dic>;
154
154
  beforeRedirect?: (data?: FormSuccessData) => Promise<boolean>;
155
+ afterSuccess?: (doc?: T) => void;
155
156
  initial: T;
156
157
  config: (AreaSlug extends never ? never : BuiltAreaClient) | BuiltCollectionClient;
157
158
  readOnly: boolean;
@@ -6,13 +6,13 @@ import { compileDocumentConfig } from '../../core/config/shared/compile.js';
6
6
  import { PARAMS, VERSIONS_STATUS } from '../../core/constant.js';
7
7
  import { getFieldConfigByPath } from '../../core/fields/util.js';
8
8
  import { buildConfigMap } from '../../core/operations/configMap/index.js';
9
+ import { richTextJSONToText } from '../../fields/rich-text/index.js';
9
10
  import { normalizeFieldPath } from '../../util/doc.js';
10
11
  import { random } from '../../util/index.js';
11
12
  import { isObjectLiteral, omit } from '../../util/object.js';
12
13
  import cloneDeep from 'clone-deep';
13
14
  import { diff } from 'deep-object-diff';
14
15
  import { flatten } from 'flat';
15
- import { richTextJSONToText } from '../../fields/rich-text/client.js';
16
16
  import { getContext, setContext } from 'svelte';
17
17
  import { toast } from 'svelte-sonner';
18
18
  import { t__ } from '../../core/i18n/index.js';
@@ -24,7 +24,7 @@ import { getCollectionContext } from './collection.svelte.js';
24
24
  import { setErrorsContext } from './errors.svelte.js';
25
25
  import { getLocaleContext } from './locale.svelte.js';
26
26
  import { getUserContext } from './user.svelte.js';
27
- function createDocumentFormState({ initial, element, config, readOnly, key, onNestedDocumentCreated, onDataChange, beforeSubmit, beforeRedirect, onFieldFocus }) {
27
+ function createDocumentFormState({ initial, element, config, readOnly, key, onNestedDocumentCreated, afterSuccess, onDataChange, beforeSubmit, beforeRedirect, onFieldFocus }) {
28
28
  //
29
29
  let initialDoc = $state(initial);
30
30
  let doc = $state(initial);
@@ -522,6 +522,8 @@ function createDocumentFormState({ initial, element, config, readOnly, key, onNe
522
522
  if (onNestedDocumentCreated)
523
523
  onNestedDocumentCreated(doc);
524
524
  }
525
+ if (afterSuccess)
526
+ afterSuccess(doc);
525
527
  }
526
528
  async function handleError(data) {
527
529
  // Handle error
@@ -578,8 +580,6 @@ function createDocumentFormState({ initial, element, config, readOnly, key, onNe
578
580
  };
579
581
  };
580
582
  const buildPanelActionUrl = () => {
581
- console.log('@buildPanelActionUrl----');
582
- console.log(operation);
583
583
  // Start with the base URI for the panel
584
584
  let panelUri = `/panel/${config.kebab}`;
585
585
  // Add the item ID to the URI if we're updating a collection doc
@@ -1,5 +1,5 @@
1
1
  import { getContext, setContext } from 'svelte';
2
- import { getConfigContext } from './config.svelte';
2
+ import { getConfigContext } from './config.svelte.js';
3
3
  const LOCALE_KEY = Symbol('rime.locale');
4
4
  function createStore(initial) {
5
5
  let code = $state();
@@ -16,7 +16,7 @@
16
16
  import LanguageSwitcher from '../../components/ui/language-switcher/LanguageSwitcher.svelte';
17
17
  import PageHeader from '../../components/ui/page-header/PageHeader.svelte';
18
18
  import { setCollectionContext } from '../../context/collection.svelte.js';
19
- import { getConfigContext } from '../../context/config.svelte';
19
+ import { getConfigContext } from '../../context/config.svelte.js';
20
20
  import { CopyPlus } from '@lucide/svelte';
21
21
  import { getContext, setContext } from 'svelte';
22
22
 
@@ -1,8 +1,8 @@
1
1
  <script lang="ts">
2
- import Unauthorized from '../../components/sections/unauthorized/Unauthorized.svelte';
3
2
  import Document from '../../components/sections/document/Document.svelte';
4
- import { API_PROXY, setAPIProxyContext } from '../../context/api-proxy.svelte';
5
3
  import Page from '../../components/sections/page-layout/Page.svelte';
4
+ import Unauthorized from '../../components/sections/unauthorized/Unauthorized.svelte';
5
+ import { API_PROXY, setAPIProxyContext } from '../../context/api-proxy.svelte.js';
6
6
  import type { CollectionDocData } from '../../index.js';
7
7
 
8
8
  const { data }: { data: CollectionDocData<false> } = $props();
@@ -1,14 +1,14 @@
1
1
  <script lang="ts">
2
- import { Eye } from '@lucide/svelte';
3
- import Button from '../../components/ui/button/button.svelte';
4
- import PageHeader from '../../components/ui/page-header/PageHeader.svelte';
5
- import { getConfigContext } from '../../context/config.svelte';
6
- import LanguageSwitcher from '../../components/ui/language-switcher/LanguageSwitcher.svelte';
7
- import { t__ } from '../../../core/i18n/index.js';
8
- import type { DashboardEntry } from './types.js';
9
2
  import { invalidateAll } from '$app/navigation';
10
3
  import type { User } from '../../../core/collections/auth/types.js';
4
+ import { t__ } from '../../../core/i18n/index.js';
11
5
  import Page from '../../components/sections/page-layout/Page.svelte';
6
+ import Button from '../../components/ui/button/button.svelte';
7
+ import LanguageSwitcher from '../../components/ui/language-switcher/LanguageSwitcher.svelte';
8
+ import PageHeader from '../../components/ui/page-header/PageHeader.svelte';
9
+ import { getConfigContext } from '../../context/config.svelte.js';
10
+ import { Eye } from '@lucide/svelte';
11
+ import type { DashboardEntry } from './types.js';
12
12
 
13
13
  type Props = { entries: DashboardEntry[]; user?: User };
14
14
  const { entries, user }: Props = $props();
@@ -87,7 +87,7 @@
87
87
  flex-direction: column;
88
88
  gap: var(--rz-size-4);
89
89
  transition: background-color 0.3s ease-out;
90
-
90
+
91
91
  &:hover {
92
92
  background-color: light-dark(hsl(var(--rz-gray-15)), hsl(var(--rz-gray-4)));
93
93
  }
@@ -1,5 +1,5 @@
1
- import type { DashboardEntry } from './types.js';
2
1
  import type { User } from '../../../core/collections/auth/types.js';
2
+ import type { DashboardEntry } from './types.js';
3
3
  type Props = {
4
4
  entries: DashboardEntry[];
5
5
  user?: User;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rimecms",
3
- "version": "0.25.0",
3
+ "version": "0.25.2",
4
4
  "homepage": "https://github.com/bienbiendev/rime",
5
5
  "scripts": {
6
6
  "dev": "vite dev",