rimecms 1.5.0 → 1.5.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 (47) hide show
  1. package/dist/core/auth/better-auth/config.server.d.ts +1 -1
  2. package/dist/core/auth/better-auth/instance.server.d.ts +2 -2
  3. package/dist/core/boot.server.d.ts +2 -2
  4. package/dist/core/i18n/en/common.d.ts +10 -4
  5. package/dist/core/i18n/en/common.js +12 -6
  6. package/dist/core/i18n/fr/common.d.ts +10 -4
  7. package/dist/core/i18n/fr/common.js +12 -7
  8. package/dist/core/prototype/shared/title/find-title.d.ts +9 -0
  9. package/dist/core/prototype/shared/title/find-title.js +20 -4
  10. package/dist/fields/group/component/Group.svelte +4 -3
  11. package/dist/fields/text/index.d.ts +11 -3
  12. package/dist/fields/text/index.js +11 -3
  13. package/dist/panel/components/fields/RenderFields.svelte +3 -2
  14. package/dist/panel/components/sections/collection/DropHint.svelte +41 -0
  15. package/dist/panel/components/sections/collection/DropHint.svelte.d.ts +7 -0
  16. package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte +23 -3
  17. package/dist/panel/components/sections/collection/header/ButtonCreate.svelte +3 -3
  18. package/dist/panel/components/sections/collection/header/ButtonCreate.svelte.d.ts +1 -1
  19. package/dist/panel/components/sections/collection/list/CollectionList.svelte +8 -0
  20. package/dist/panel/components/sections/document/ButtonPublish.svelte +39 -0
  21. package/dist/panel/components/sections/document/ButtonPublish.svelte.d.ts +7 -0
  22. package/dist/panel/components/sections/document/ButtonSave.svelte +6 -3
  23. package/dist/panel/components/sections/document/ButtonSave.svelte.d.ts +3 -1
  24. package/dist/panel/components/sections/document/Header.svelte +116 -65
  25. package/dist/panel/components/sections/document/Settings.svelte +42 -125
  26. package/dist/panel/components/sections/document/VersionMenu.svelte +383 -0
  27. package/dist/panel/components/sections/document/VersionMenu.svelte.d.ts +8 -0
  28. package/dist/panel/components/sections/document/Versions.svelte +1 -1
  29. package/dist/panel/components/sections/document/Versions.svelte.d.ts +1 -1
  30. package/dist/panel/components/sections/document/version-status.d.ts +12 -0
  31. package/dist/panel/components/sections/document/version-status.js +33 -0
  32. package/dist/panel/components/sections/document/versions-list.d.ts +1 -1
  33. package/dist/panel/components/sections/document/versions-list.js +1 -1
  34. package/dist/panel/components/ui/calendar/calendar.svelte.d.ts +1 -1
  35. package/dist/panel/components/ui/checkbox/checkbox.svelte.d.ts +1 -1
  36. package/dist/panel/components/ui/page-header/PageHeader.svelte +36 -4
  37. package/dist/panel/components/ui/page-header/PageHeader.svelte.d.ts +4 -0
  38. package/dist/panel/components/ui/switch/switch.svelte.d.ts +1 -1
  39. package/dist/panel/context/collection.svelte.d.ts +2 -2
  40. package/dist/panel/context/documentForm.svelte.d.ts +2 -0
  41. package/dist/panel/context/documentForm.svelte.js +12 -0
  42. package/dist/panel/context/versions.svelte.js +1 -1
  43. package/dist/panel/pages/collection/CollectionPage.svelte +37 -27
  44. package/dist/panel/pages/collection/CollectionPage.svelte.d.ts +1 -1
  45. package/package.json +1 -1
  46. package/dist/panel/components/sections/document/ButtonStatus.svelte +0 -158
  47. package/dist/panel/components/sections/document/ButtonStatus.svelte.d.ts +0 -7
@@ -7,6 +7,7 @@ import { page } from '$app/state';
7
7
  import { PARAMS } from '../../core/constants.js';
8
8
  import { getFieldAtPath } from '../../core/fields/util.js';
9
9
  import { buildConfigMap } from '../../core/pipeline/config-map/index.js';
10
+ import { findInlineTitle } from '../../core/prototype/shared/title/find-title.js';
10
11
  import { AUTO_SAVE_DELAY_MS } from '../../core/prototype/shared/versions/constant.js';
11
12
  import { apiUrl, panelUrl } from '../../core/routes/util.js';
12
13
  import { isJSONContent } from '../../fields/rich-text/json.js';
@@ -53,6 +54,13 @@ function createDocumentFormState({ initial, config, readOnly, key, onNestedDocum
53
54
  const nestedLevel = initLevel();
54
55
  /** onDataChange is only used to trigger action on live-edit so determine if this is a live-edit form */
55
56
  const isLiveEdit = !!onDataChange;
57
+ /**
58
+ * The path of the title the page's heading edits, `isTitle('inline')`, on a collection. Live edit
59
+ * has no heading: there the field stays in the form.
60
+ */
61
+ const inlineTitle = documentConfig.type === 'collection' && !isLiveEdit
62
+ ? findInlineTitle(documentConfig.fields)
63
+ : null;
56
64
  /**
57
65
  * Whether typing here lands in the user's own auto-saved row: a config that opts in, an
58
66
  * existing document, a writable form, and the root form — a relation's nested create is never
@@ -767,6 +775,10 @@ function createDocumentFormState({ initial, config, readOnly, key, onNestedDocum
767
775
  get isLive() {
768
776
  return isLiveEdit;
769
777
  },
778
+ /** The path of the title the page's heading edits, or `null`: the form leaves that field out. */
779
+ get inlineTitle() {
780
+ return inlineTitle;
781
+ },
770
782
  /** Puts the document back as it was loaded or last saved. The errors stay. */
771
783
  reset() {
772
784
  doc = initialDoc;
@@ -1,6 +1,6 @@
1
1
  import { getContext, setContext } from 'svelte';
2
2
  /**
3
- * The version history's state, shared between the document page that shows it, the settings
3
+ * The version history's state, shared between the document page that shows it, the version
4
4
  * menu that opens it, and the form that says which row it is on.
5
5
  *
6
6
  * The page sets it outside the block that remounts the document on every version, so picking a
@@ -1,10 +1,9 @@
1
1
  <script lang="ts">
2
- import { createPath } from '../../util/url.js';
3
- import type { UploadPath } from '../../../core/prototype/collection/upload/util/path.js';
4
- import { goto } from '$app/navigation';
5
2
  import { t__ } from '../../../core/i18n/index.js';
6
3
  import { UPLOAD_PATH } from '../../../core/prototype/collection/upload/constant.js';
4
+ import { withDirectoriesSuffix } from '../../../core/prototype/collection/upload/naming.js';
7
5
  import type { Directory } from '../../../core/prototype/collection/upload/types.js';
6
+ import type { UploadPath } from '../../../core/prototype/collection/upload/util/path.js';
8
7
  import { VERSIONS_STATUS } from '../../../core/prototype/shared/versions/constant.js';
9
8
  import type { GenericDoc } from '../../../core/prototype/types.js';
10
9
  import BulkUploadDialog from '../../components/sections/collection/bulk-upload/BulkUploadDialog.svelte';
@@ -16,22 +15,23 @@
16
15
  import FilterMenu from '../../components/sections/collection/header/FilterMenu.svelte';
17
16
  import SearchInput from '../../components/sections/collection/header/SearchInput.svelte';
18
17
  import SelectUI from '../../components/sections/collection/header/SelectUI.svelte';
19
- import type { KindFilter, StatusFilter } from '../../context/collection.svelte.js';
20
- import { counted, documentsCounted } from '../../util/count.js';
21
- import { fileSizeLabel, type UploadTarget } from '../../util/upload-file.js';
22
- import { switchLocale } from '../../util/locale-cookie.js';
23
18
  import CollectionList from '../../components/sections/collection/list/CollectionList.svelte';
24
19
  import CollectionTree from '../../components/sections/collection/tree/CollectionTree.svelte';
25
20
  import Page from '../../components/sections/page-layout/Page.svelte';
26
21
  import Button from '../../components/ui/button/button.svelte';
27
22
  import LanguageSwitcher from '../../components/ui/language-switcher/LanguageSwitcher.svelte';
28
23
  import PageHeader from '../../components/ui/page-header/PageHeader.svelte';
24
+ import type { KindFilter, StatusFilter } from '../../context/collection.svelte.js';
29
25
  import { DISPLAY_MODE, setCollectionContext } from '../../context/collection.svelte.js';
30
26
  import { useCommands } from '../../context/commands.svelte.js';
31
27
  import { getConfigContext } from '../../context/config.svelte.js';
32
- import { getUserContext } from '../../context/user.svelte.js';
33
- import { withDirectoriesSuffix } from '../../../core/prototype/collection/upload/naming.js';
34
28
  import { getTitleContext } from '../../context/title.js';
29
+ import { getUserContext } from '../../context/user.svelte.js';
30
+ import { counted, documentsCounted } from '../../util/count.js';
31
+ import { switchLocale } from '../../util/locale-cookie.js';
32
+ import { fileSizeLabel, type UploadTarget } from '../../util/upload-file.js';
33
+ import { createPath } from '../../util/url.js';
34
+ import { goto } from '$app/navigation';
35
35
  import CirclePlus from '@lucide/svelte/icons/circle-plus';
36
36
  import FolderPlus from '@lucide/svelte/icons/folder-plus';
37
37
  import LayoutGrid from '@lucide/svelte/icons/layout-grid';
@@ -95,7 +95,7 @@
95
95
  titleContext.value = collection.config.label.plural;
96
96
  });
97
97
 
98
- // 24 documents · 3 drafts, or 486 files · 1.2 GB · drop files anywhere to upload them
98
+ // 24 documents · 3 drafts, or 486 files · 1.2 GB
99
99
  const metaLine = $derived.by(() => {
100
100
  const parts = [documentsCounted(collection.total, collection.isUpload)];
101
101
  if (collection.draftsCount) {
@@ -104,9 +104,6 @@
104
104
  if (collection.isUpload && collection.totalSize) {
105
105
  parts.push(fileSizeLabel(collection.totalSize));
106
106
  }
107
- if (collection.isUpload && collection.canCreate) {
108
- parts.push(t__('common.drop_anywhere'));
109
- }
110
107
  return parts.join(' · ');
111
108
  });
112
109
 
@@ -214,8 +211,24 @@
214
211
  {/each}
215
212
 
216
213
  <LanguageSwitcher onLocalClick={switchLocale} />
214
+ {/snippet}
217
215
 
216
+ {#snippet title()}
217
+ {collection.title}
218
+ {/snippet}
219
+
220
+ {#snippet titleEnd()}
218
221
  {#if collection.isUpload}
222
+ {#if collection.canCreate}
223
+ <Button
224
+ variant="outline"
225
+ size="sm"
226
+ icon={Upload}
227
+ onclick={() => (bulkDialogOpen = true)}
228
+ >
229
+ {t__('common.collection_upload')}
230
+ </Button>
231
+ {/if}
219
232
  {#if canCreateFolder}
220
233
  <Button
221
234
  variant="ghost"
@@ -227,24 +240,11 @@
227
240
  <span class="rz-collection__folder-label">{t__('common.create_folder')}</span>
228
241
  </Button>
229
242
  {/if}
230
- {#if collection.canCreate}
231
- <Button size="sm" icon={Upload} onclick={() => (bulkDialogOpen = true)}>
232
- {t__('common.collection_upload')}
233
- </Button>
234
- {/if}
235
243
  {:else if collection.canCreate}
236
- <ButtonCreate config={collection.config} variant="default" />
244
+ <ButtonCreate config={collection.config} variant="outline" />
237
245
  {/if}
238
246
  {/snippet}
239
247
 
240
- {#snippet title()}
241
- {collection.title}
242
- {/snippet}
243
-
244
- {#snippet meta()}
245
- {metaLine}
246
- {/snippet}
247
-
248
248
  {#snippet bottomLeft()}
249
249
  <SearchInput />
250
250
  {#if !collection.isNested()}
@@ -270,6 +270,10 @@
270
270
  <SelectUI />
271
271
  {/if}
272
272
  {/snippet}
273
+
274
+ {#snippet bottomRight()}
275
+ <span class="rz-collection__meta">{metaLine}</span>
276
+ {/snippet}
273
277
  </PageHeader>
274
278
 
275
279
  <div class="rz-collection__docs">
@@ -307,6 +311,12 @@
307
311
  padding-inline: var(--rz-page-gutter);
308
312
  }
309
313
 
314
+ .rz-collection__meta {
315
+ color: var(--rz-fg-subtle);
316
+ font-variant-numeric: tabular-nums;
317
+ white-space: nowrap;
318
+ }
319
+
310
320
  /* On a narrow page, "New folder" keeps its icon alone. */
311
321
  @container main (max-width: 40rem) {
312
322
  .rz-collection__folder-label {
@@ -1,5 +1,5 @@
1
- import type { UploadPath } from '../../../core/prototype/collection/upload/util/path.js';
2
1
  import type { Directory } from '../../../core/prototype/collection/upload/types.js';
2
+ import type { UploadPath } from '../../../core/prototype/collection/upload/util/path.js';
3
3
  import type { GenericDoc } from '../../../core/prototype/types.js';
4
4
  type Props = {
5
5
  slug: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rimecms",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "homepage": "https://github.com/bienbiendev/rime",
5
5
  "packageManager": "bun@1.3.0",
6
6
  "scripts": {
@@ -1,158 +0,0 @@
1
- <script lang="ts">
2
- import { documentSegments } from '../../../util/url.js';
3
- import { invalidateAll } from '$app/navigation';
4
- import { PARAMS } from '../../../../core/constants.js';
5
- import { VERSIONS_STATUS } from '../../../../core/prototype/shared/versions/constant.js';
6
- import { apiUrl } from '../../../../core/routes/util.js';
7
- import * as Dialog from '../../ui/dialog/index.js';
8
- import * as Radio from '../../ui/radio-group/index.js';
9
- import { getAPIProxyContext } from '../../../context/api-proxy.svelte.js';
10
- import { useCommands } from '../../../context/commands.svelte.js';
11
- import type { DocumentFormContext } from '../../../context/documentForm.svelte.js';
12
- import { toast } from 'svelte-sonner';
13
- import { t__ } from '../../../../core/i18n/index.js';
14
- import Button from '../../ui/button/button.svelte';
15
- import Label from '../../ui/label/label.svelte';
16
- import StatusDot from '../collection/StatusDot.svelte';
17
- type Props = { form: DocumentFormContext };
18
- const { form }: Props = $props();
19
-
20
- const APIProxy = getAPIProxyContext();
21
- const statusList = Object.values(VERSIONS_STATUS);
22
-
23
- let dialogOpen = $state(false);
24
-
25
- /**
26
- * Sets the status of the row on screen (`?versionId=`), then takes it into the form without
27
- * dirtying it, reloads the page data and the version history.
28
- */
29
- async function handleValidateStatus(next: string = status) {
30
- const url = apiUrl(...documentSegments(form.config.kebab, form.values));
31
- await fetch(`${url}?${PARAMS.VERSION_ID}=${form.values.versionId}`, {
32
- method: 'PATCH',
33
- body: JSON.stringify({
34
- status: next
35
- })
36
- })
37
- .then((r) => {
38
- if (r.status === 200) {
39
- toast.success(t__('common.doc_updated'));
40
- // The server holds the new status already: the form takes it without getting dirty,
41
- // so no auto-save follows a publish.
42
- form.sync('status', next);
43
- dialogOpen = false;
44
- invalidateAll();
45
- // The write went around the form: the version history re-reads its statuses.
46
- // `apiUrl(kebab)` reaches `/api/<kebab>--versions` because `invalidate` matches by
47
- // substring (api-proxy.svelte.ts).
48
- APIProxy.invalidate(apiUrl(form.config.kebab));
49
- } else {
50
- toast.error(t__('common.generic_error'));
51
- }
52
- })
53
- .catch(() => {
54
- toast.error(t__('common.generic_error'));
55
- });
56
- }
57
-
58
- let status = $derived(form.values.status);
59
-
60
- /** Closes the dialog without Validate: the radio shows the document's status again. */
61
- function cancel() {
62
- status = form.values.status;
63
- dialogOpen = false;
64
- }
65
-
66
- /** The other statuses, one line each. */
67
- useCommands(() =>
68
- statusList
69
- .filter((candidate) => candidate !== form.values.status)
70
- .map((candidate) => ({
71
- id: `document.status.${candidate}`,
72
- label: t__('common.mark_as', t__(`common.${candidate}`)),
73
- group: t__('common.document'),
74
- run: () => handleValidateStatus(candidate)
75
- }))
76
- );
77
- </script>
78
-
79
- <Dialog.Root
80
- bind:open={dialogOpen}
81
- onOpenChange={(open) => {
82
- if (!open) cancel();
83
- }}
84
- >
85
- <Dialog.Trigger>
86
- {#snippet child({ props })}
87
- <Button size="sm" variant="ghost" class="rz-status__button" {...props}>
88
- <StatusDot status={form.values.status} />
89
- <span class="rz-status__text">{t__(`common.${form.values.status}`)}</span>
90
- </Button>
91
- {/snippet}
92
- </Dialog.Trigger>
93
- <Dialog.Content>
94
- <Radio.Root bind:value={status}>
95
- {#each statusList as status, index (index)}
96
- <div class="rz-radio__option">
97
- <Radio.Item id="document.{status}" value={status} />
98
- <Label for="document.{status}">
99
- {t__(`common.${status}`)}
100
- <p>{t__(`common.${status}_infos`)}</p>
101
- </Label>
102
- </div>
103
- {/each}
104
- </Radio.Root>
105
- <Dialog.Footer>
106
- <Button onclick={() => handleValidateStatus()} variant="outline" kbd="enter"
107
- >{t__('common.validate')}</Button
108
- >
109
- <Button onclick={cancel} variant="secondary" kbd="escape">
110
- {t__('common.cancel')}
111
- </Button>
112
- </Dialog.Footer>
113
- </Dialog.Content>
114
- </Dialog.Root>
115
-
116
- <style>/* A level: its fill, a hairline, and its shadow when it has one. raised has none, float does. */
117
-
118
- /* A well: an input, a track, a dropzone. Its edge shows on hover. */
119
-
120
- /* The hover tint, laid over the element's own fill. */
121
-
122
- /* The picked item of a segmented control. */
123
-
124
- /* The primary button's face: black on light, white on dark. */
125
-
126
- /* Keyboard focus on a button, a tab, a link. */
127
-
128
- /* A focused input: an accent edge and a soft halo. */
129
-
130
- /* An input with an error. */
131
- /* The status as a ghost button: a small dot, draft or published, then its name. */
132
- :global(.rz-status__button) {
133
- --rz-dot-size: var(--rz-size-1-5);
134
- }
135
-
136
- /* Each status a row: the radio, its name, a line on what it means. */
137
- .rz-radio__option {
138
- display: flex;
139
- align-items: flex-start;
140
- gap: var(--rz-size-3);
141
- padding: var(--rz-size-3) var(--rz-size-3-5);
142
- border-radius: var(--rz-radius-lg);
143
- box-shadow: 0 0 0 1px var(--rz-border);
144
-
145
- :global(.rz-label) {
146
- color: var(--rz-fg);
147
- font-size: var(--rz-text-md);
148
- }
149
-
150
- p {
151
- margin-top: var(--rz-size-0-5);
152
- color: var(--rz-fg-subtle);
153
- font-size: var(--rz-text-sm);
154
- font-variation-settings: 'wght' 400;
155
- font-weight: 400;
156
- }
157
- }
158
- </style>
@@ -1,7 +0,0 @@
1
- import type { DocumentFormContext } from '../../../context/documentForm.svelte.js';
2
- type Props = {
3
- form: DocumentFormContext;
4
- };
5
- declare const ButtonStatus: import("svelte").Component<Props, {}, "">;
6
- type ButtonStatus = ReturnType<typeof ButtonStatus>;
7
- export default ButtonStatus;