rimecms 1.4.3 → 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 (63) 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/radio/component/Radio.svelte +19 -1
  12. package/dist/fields/radio/index.d.ts +23 -6
  13. package/dist/fields/radio/index.js +13 -1
  14. package/dist/fields/text/index.d.ts +11 -3
  15. package/dist/fields/text/index.js +11 -3
  16. package/dist/panel/components/fields/RenderFields.svelte +3 -2
  17. package/dist/panel/components/sections/collection/DropHint.svelte +41 -0
  18. package/dist/panel/components/sections/collection/DropHint.svelte.d.ts +7 -0
  19. package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte +23 -3
  20. package/dist/panel/components/sections/collection/header/ButtonCreate.svelte +3 -3
  21. package/dist/panel/components/sections/collection/header/ButtonCreate.svelte.d.ts +1 -1
  22. package/dist/panel/components/sections/collection/list/CollectionList.svelte +8 -0
  23. package/dist/panel/components/sections/document/AutoSaveBanner.svelte +1 -1
  24. package/dist/panel/components/sections/document/ButtonPublish.svelte +39 -0
  25. package/dist/panel/components/sections/document/ButtonPublish.svelte.d.ts +7 -0
  26. package/dist/panel/components/sections/document/ButtonSave.svelte +6 -3
  27. package/dist/panel/components/sections/document/ButtonSave.svelte.d.ts +3 -1
  28. package/dist/panel/components/sections/document/Document.svelte +4 -13
  29. package/dist/panel/components/sections/document/DocumentChildren.svelte +1 -1
  30. package/dist/panel/components/sections/document/Header.svelte +116 -65
  31. package/dist/panel/components/sections/document/Settings.svelte +42 -125
  32. package/dist/panel/components/sections/document/VersionMenu.svelte +383 -0
  33. package/dist/panel/components/sections/document/VersionMenu.svelte.d.ts +8 -0
  34. package/dist/panel/components/sections/document/Versions.svelte +1 -1
  35. package/dist/panel/components/sections/document/Versions.svelte.d.ts +1 -1
  36. package/dist/panel/components/sections/document/version-status.d.ts +12 -0
  37. package/dist/panel/components/sections/document/version-status.js +33 -0
  38. package/dist/panel/components/sections/document/versions-list.d.ts +1 -1
  39. package/dist/panel/components/sections/document/versions-list.js +1 -1
  40. package/dist/panel/components/ui/calendar/calendar.svelte.d.ts +1 -1
  41. package/dist/panel/components/ui/checkbox/checkbox.svelte.d.ts +1 -1
  42. package/dist/panel/components/ui/page-header/PageHeader.svelte +39 -13
  43. package/dist/panel/components/ui/page-header/PageHeader.svelte.d.ts +4 -0
  44. package/dist/panel/components/ui/radio-card-group/index.d.ts +3 -0
  45. package/dist/panel/components/ui/radio-card-group/index.js +3 -0
  46. package/dist/panel/components/ui/radio-card-group/radio-card-group-item.svelte +30 -0
  47. package/dist/panel/components/ui/radio-card-group/radio-card-group-item.svelte.d.ts +9 -0
  48. package/dist/panel/components/ui/radio-card-group/radio-card-group.css +80 -0
  49. package/dist/panel/components/ui/radio-card-group/radio-card-group.svelte +18 -0
  50. package/dist/panel/components/ui/radio-card-group/radio-card-group.svelte.d.ts +5 -0
  51. package/dist/panel/components/ui/radio-row-group/radio-row-group.css +5 -3
  52. package/dist/panel/components/ui/switch/switch.svelte.d.ts +1 -1
  53. package/dist/panel/context/collection.svelte.d.ts +2 -2
  54. package/dist/panel/context/documentForm.svelte.d.ts +2 -0
  55. package/dist/panel/context/documentForm.svelte.js +12 -0
  56. package/dist/panel/context/versions.svelte.js +1 -1
  57. package/dist/panel/pages/collection/CollectionPage.svelte +37 -27
  58. package/dist/panel/pages/collection/CollectionPage.svelte.d.ts +1 -1
  59. package/dist/panel/style/index.css +0 -12
  60. package/dist/panel/style/scheme.css +0 -12
  61. package/package.json +1 -1
  62. package/dist/panel/components/sections/document/ButtonStatus.svelte +0 -158
  63. package/dist/panel/components/sections/document/ButtonStatus.svelte.d.ts +0 -7
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { CollectionContext } from '../../../../context/collection.svelte.js';
3
+ import DropHint from '../DropHint.svelte';
3
4
  import Empty from '../Empty.svelte';
4
5
  import Folders from '../folder/Folders.svelte';
5
6
  import { listColumns } from './columns.js';
@@ -25,6 +26,9 @@
25
26
  !!(collection.upload.directories.length || collection.upload.parentDirectory)
26
27
  );
27
28
 
29
+ // A strip under the rows says files dropped on the page upload; a search hides it.
30
+ const dropHint = $derived(collection.isUpload && collection.canCreate && !collection.isFiltered);
31
+
28
32
  // The tracks, wide; then without the author; then the title and the date alone.
29
33
  const columns = $derived(collection.columns.length);
30
34
  const status = $derived(!!collection.hasDraft);
@@ -60,6 +64,10 @@
60
64
  {:else if !hasFolders}
61
65
  <Empty config={collection.config} />
62
66
  {/if}
67
+
68
+ {#if dropHint}
69
+ <DropHint shape="row" />
70
+ {/if}
63
71
  </div>
64
72
 
65
73
  <style>/* A level: its fill, a hairline, and its shadow when it has one. raised has none, float does. */
@@ -106,7 +106,7 @@
106
106
  display: grid;
107
107
  gap: var(--rz-size-2);
108
108
  padding-block: var(--rz-size-3);
109
- padding-inline: max(var(--rz-page-gutter), calc((100% - var(--rz-page-width, 40rem)) / 2));
109
+ padding-inline: var(--rz-page-gutter);
110
110
  background-color: var(--rz-bg-page);
111
111
  }
112
112
  .rz-auto-save-banner {
@@ -0,0 +1,39 @@
1
+ <script lang="ts">
2
+ import { t__ } from '../../../../core/i18n/index.js';
3
+ import { VERSIONS_STATUS } from '../../../../core/prototype/shared/versions/constant.js';
4
+ import { getAPIProxyContext } from '../../../context/api-proxy.svelte.js';
5
+ import type { DocumentFormContext } from '../../../context/documentForm.svelte.js';
6
+ import Button from '../../ui/button/button.svelte';
7
+ import { setVersionStatus } from './version-status.js';
8
+
9
+ type Props = { form: DocumentFormContext };
10
+ const { form }: Props = $props();
11
+
12
+ const APIProxy = getAPIProxyContext();
13
+
14
+ /** Unsaved changes, or an auto-saved row: Publish saves them. */
15
+ const pending = $derived(Object.keys(form.changes).length > 0 || !!form.values.isAutoSave);
16
+ </script>
17
+
18
+ <!--
19
+ Publishes the draft on screen. With something to save, it submits the form as the published
20
+ version; with nothing, it sets the status of the row on screen.
21
+ -->
22
+ {#if pending}
23
+ <Button
24
+ size="sm"
25
+ type="submit"
26
+ disabled={!form.canSubmit}
27
+ data-status={VERSIONS_STATUS.PUBLISHED}
28
+ >
29
+ {t__('common.publish')}
30
+ </Button>
31
+ {:else}
32
+ <Button
33
+ size="sm"
34
+ disabled={form.readOnly}
35
+ onclick={() => setVersionStatus(form, APIProxy, VERSIONS_STATUS.PUBLISHED)}
36
+ >
37
+ {t__('common.publish')}
38
+ </Button>
39
+ {/if}
@@ -0,0 +1,7 @@
1
+ import type { DocumentFormContext } from '../../../context/documentForm.svelte.js';
2
+ type Props = {
3
+ form: DocumentFormContext;
4
+ };
5
+ declare const ButtonPublish: import("svelte").Component<Props, {}, "">;
6
+ type ButtonPublish = ReturnType<typeof ButtonPublish>;
7
+ export default ButtonPublish;
@@ -2,24 +2,27 @@
2
2
  import { t__ } from '../../../../core/i18n/index.js';
3
3
  import type { DocumentFormContext } from '../../../context/documentForm.svelte.js';
4
4
  import Button from '../../ui/button/button.svelte';
5
- import type { ButtonSize } from '../../ui/button/index.js';
5
+ import type { ButtonSize, ButtonVariant } from '../../ui/button/index.js';
6
6
  import SpinLoader from '../../ui/spin-loader/SpinLoader.svelte';
7
7
 
8
8
  type Props = {
9
9
  form: DocumentFormContext;
10
10
  size?: ButtonSize;
11
+ /** `secondary` beside a Publish button, which is then the primary one. */
12
+ variant?: ButtonVariant;
11
13
  };
12
- const { form, size = 'default' }: Props = $props();
14
+ const { form, size = 'default', variant = 'default' }: Props = $props();
13
15
 
14
16
  const label = $derived(form.values.id ? t__('common.save') : t__('common.create'));
15
17
 
16
- // The form's plain save, written on the button. `data-submit` is how ⌘S and the settings menu
18
+ // The form's plain save, written on the button. `data-submit` is how ⌘S and the version menu
17
19
  // find the button.
18
20
  const intent = $derived(form.saveIntent);
19
21
  </script>
20
22
 
21
23
  <Button
22
24
  {size}
25
+ {variant}
23
26
  type="submit"
24
27
  disabled={!form.canSubmit}
25
28
  data-submit
@@ -1,8 +1,10 @@
1
1
  import type { DocumentFormContext } from '../../../context/documentForm.svelte.js';
2
- import type { ButtonSize } from '../../ui/button/index.js';
2
+ import type { ButtonSize, ButtonVariant } from '../../ui/button/index.js';
3
3
  type Props = {
4
4
  form: DocumentFormContext;
5
5
  size?: ButtonSize;
6
+ /** `secondary` beside a Publish button, which is then the primary one. */
7
+ variant?: ButtonVariant;
6
8
  };
7
9
  declare const ButtonSave: import("svelte").Component<Props, {}, "">;
8
10
  type ButtonSave = ReturnType<typeof ButtonSave>;
@@ -413,32 +413,23 @@
413
413
  </form>
414
414
 
415
415
  <style>
416
- /**
417
- * The document: a centred column, its heading lined up with its fields.
418
- *
419
- * --rz-document-width: the column, 40rem
420
- */
416
+ /* The document: its heading lined up with its fields. */
421
417
  .rz-document {
422
- --rz-page-width: var(--rz-document-width, 40rem);
423
418
  container: rz-document / inline-size;
424
419
  position: relative;
425
420
  display: flex;
426
421
  flex-direction: column;
427
422
  }
428
423
 
429
- /* A page of its own is at least the window's height, so the metas sit at its bottom. Its top
430
- edge glows, as tall as the window whatever the page's length. */
424
+ /* A page of its own is at least the window's height, so the metas sit at its bottom. */
431
425
  .rz-document:not([data-nested]) {
432
426
  min-height: 100svh;
433
- background-image: var(--rz-glow);
434
- background-repeat: no-repeat;
435
- background-size: 100% 100svh;
436
427
  }
437
428
 
438
- /* The column stops growing and centres itself; the gutter is the floor. */
429
+ /* The full width inside the page's gutter, where the dashboard and the collection list start. */
439
430
  .rz-document__fields,
440
431
  .rz-document__infos {
441
- padding-inline: max(var(--rz-page-gutter), calc((100% - var(--rz-page-width)) / 2));
432
+ padding-inline: var(--rz-page-gutter);
442
433
  }
443
434
 
444
435
  .rz-document__fields {
@@ -103,7 +103,7 @@
103
103
  display: grid;
104
104
  gap: var(--rz-size-3);
105
105
  padding-block: var(--rz-size-6) var(--rz-size-10);
106
- padding-inline: max(var(--rz-page-gutter), calc((100% - var(--rz-page-width)) / 2));
106
+ padding-inline: var(--rz-page-gutter);
107
107
  border-top: 1px solid var(--rz-border);
108
108
  }
109
109
 
@@ -1,24 +1,25 @@
1
1
  <script lang="ts">
2
2
  import type { BuiltArea, BuiltCollection } from '../../../../core/config/types.js';
3
- import { PARAMS } from '../../../../core/constants.js';
3
+ import { getFieldAtPath } from '../../../../core/fields/util.js';
4
4
  import { t__ } from '../../../../core/i18n/index.js';
5
+ import { VERSIONS_STATUS } from '../../../../core/prototype/shared/versions/constant.js';
5
6
  import { titleOrUntitled } from '../../../util/title.js';
6
7
  import { getConfigContext } from '../../../context/config.svelte.js';
7
8
  import type { DocumentFormContext } from '../../../context/documentForm.svelte.js';
8
9
  import { getLocaleContext } from '../../../context/locale.svelte.js';
10
+ import { errorText } from '../../../util/error-text.js';
9
11
  import { formatWhen, isRelative } from '../../../util/time.js';
10
12
  import { capitalize } from '../../../../util/string.js';
11
- import ExternalLink from '@lucide/svelte/icons/external-link';
12
- import PencilRuler from '@lucide/svelte/icons/pencil-ruler';
13
13
  import X from '@lucide/svelte/icons/x';
14
14
  import { Button } from '../../ui/button';
15
15
  import LanguageSwitcher from '../../ui/language-switcher/LanguageSwitcher.svelte';
16
16
  import PageHeader from '../../ui/page-header/PageHeader.svelte';
17
17
  import SpinLoader from '../../ui/spin-loader/SpinLoader.svelte';
18
+ import ButtonPublish from './ButtonPublish.svelte';
18
19
  import ButtonSave from './ButtonSave.svelte';
19
- import ButtonStatus from './ButtonStatus.svelte';
20
20
  import DocumentUrl from './DocumentUrl.svelte';
21
21
  import Settings from './Settings.svelte';
22
+ import VersionMenu from './VersionMenu.svelte';
22
23
 
23
24
  // Props
24
25
  type Props = {
@@ -49,6 +50,12 @@
49
50
  const untitled = $derived(!form.title);
50
51
  const heading = $derived(titleOrUntitled(form.title));
51
52
 
53
+ /** The title field the heading edits, `isTitle('inline')`; its label names the input. */
54
+ const titleField = $derived(form.inlineTitle ? form.useField<string>(form.inlineTitle) : null);
55
+ const titleLabel = $derived(
56
+ form.inlineTitle ? getFieldAtPath(form.inlineTitle, config.fields)?.get.label : undefined
57
+ );
58
+
52
59
  /**
53
60
  * The line under the heading: what the document is, then who edited it last, and when.
54
61
  *
@@ -75,14 +82,10 @@
75
82
  return capitalize(parts.join(' · '));
76
83
  });
77
84
 
78
- /** The page's url with `?versionId=`, so "View page" previews the row on screen. */
79
- function buildDocumentURL() {
80
- const url = form.values.url;
81
- if (!url || !form.values.versionId) return url;
82
- const preview = new URL(url);
83
- preview.searchParams.set(PARAMS.VERSION_ID, String(form.values.versionId));
84
- return preview.href;
85
- }
85
+ /** A saved draft gets Publish, the primary button, and Save steps back beside it. */
86
+ const canPublish = $derived(
87
+ !!config.versions?.draft && !!form.values.id && form.values.status !== VERSIONS_STATUS.PUBLISHED
88
+ );
86
89
  </script>
87
90
 
88
91
  {#snippet topLeft()}
@@ -90,26 +93,57 @@
90
93
  {/snippet}
91
94
 
92
95
  {#snippet title()}
93
- <span class="rz-document-title" data-empty={untitled ? '' : null}>{heading}</span>
96
+ {#if titleField}
97
+ <input
98
+ class="rz-document-title-input"
99
+ id={form.inlineTitle}
100
+ name={form.inlineTitle}
101
+ aria-label={titleLabel}
102
+ aria-invalid={titleField.error ? 'true' : undefined}
103
+ aria-describedby={titleField.error ? 'rz-document-title-error' : undefined}
104
+ placeholder={t__('common.untitled')}
105
+ autocomplete="off"
106
+ size={Math.max((titleField.value || t__('common.untitled')).length, 1)}
107
+ value={titleField.value ?? ''}
108
+ readonly={!titleField.editable}
109
+ oninput={(event) => (titleField.value = event.currentTarget.value)}
110
+ />
111
+ {:else}
112
+ <span class="rz-document-title" data-empty={untitled ? '' : null}>{heading}</span>
113
+ {/if}
114
+ {/snippet}
115
+
116
+ {#snippet titleEnd()}
117
+ {/* @ts-ignore form doc is GenericDoc as form.values.id is defined */ null}
118
+ <Settings {form} />
94
119
  {/snippet}
95
120
 
96
121
  {#snippet metaLine()}
97
- <span class="rz-document-meta">{meta}</span>
122
+ {#if titleField?.error}
123
+ <span id="rz-document-title-error" class="rz-document-title-error">
124
+ {errorText(titleField.error)}
125
+ </span>
126
+ {:else}
127
+ <span class="rz-document-meta">{meta}</span>
128
+ {/if}
98
129
  {/snippet}
99
130
 
100
131
  {#snippet urlLine()}
101
132
  <DocumentUrl {form} {config} />
102
133
  {/snippet}
103
134
 
104
- <!-- The bar: the breadcrumb, then the actions. Under it, the heading and the meta line. -->
135
+ <!--
136
+ The bar: the breadcrumb, then the language, the version menu and the save buttons. Under it, the
137
+ heading with the document's menu, the meta line and the url.
138
+ -->
105
139
  <PageHeader
106
140
  topLeft={onCloseIsDefined ? topLeft : undefined}
107
141
  {title}
108
- meta={meta ? metaLine : undefined}
142
+ titleEnd={form.values.id ? titleEnd : undefined}
143
+ meta={meta || titleField?.error ? metaLine : undefined}
109
144
  aside={form.values.url ? urlLine : undefined}
110
145
  >
111
146
  {#snippet topRight()}
112
- <!-- Ghost buttons, then the primary one: open, language, status, menu, save. -->
113
147
  <div class="rz-document-actions">
114
148
  {#if showAutoSave}
115
149
  <span class="rz-auto-save-state" data-auto-save-state={form.autoSaveState}>
@@ -126,45 +160,20 @@
126
160
  </span>
127
161
  {/if}
128
162
 
129
- {#if form.values.url}
130
- <Button
131
- icon={ExternalLink}
132
- target="_blank"
133
- href={buildDocumentURL()}
134
- size="icon-sm"
135
- variant="ghost"
136
- class="rz-document-actions__open"
137
- aria-label={t__('common.view_page')}
138
- />
139
- {/if}
140
-
141
- {#if config.live && form.values._live}
142
- <Button
143
- size="icon-sm"
144
- variant="ghost"
145
- disabled={form.readOnly}
146
- class="rz-button-live"
147
- icon={PencilRuler}
148
- href={form.values._live}
149
- aria-label={t__('common.live_edit')}
150
- title={t__('common.live_edit')}
151
- ></Button>
152
- {/if}
153
-
154
163
  {#if form.nestedLevel === 0}
155
164
  <LanguageSwitcher onLocalClick={onLocaleSwitch} />
156
165
  {/if}
157
166
 
158
- {#if form.config.versions?.draft && form.values.id}
159
- <ButtonStatus {form} />
160
- {/if}
161
-
162
- {#if form.values.id}
167
+ {#if config.versions && form.values.id}
163
168
  {/* @ts-ignore form doc is GenericDoc as form.values.id is defined */ null}
164
- <Settings {form} />
169
+ <VersionMenu {form} />
165
170
  {/if}
166
171
 
167
- <ButtonSave {form} size="sm" />
172
+ <ButtonSave {form} size="sm" variant={canPublish ? 'secondary' : 'default'} />
173
+
174
+ {#if canPublish}
175
+ <ButtonPublish {form} />
176
+ {/if}
168
177
  </div>
169
178
  {/snippet}
170
179
  </PageHeader>
@@ -172,7 +181,7 @@
172
181
  <style>
173
182
  /*
174
183
  * The bar's buttons, 28px high: ghost ones in the muted ink, their icons subtler, both
175
- * darkening on hover or while their menu is open; the primary one last, a little apart.
184
+ * darkening on hover or while their menu is open; the save buttons last, a little apart.
176
185
  */
177
186
  .rz-document-actions {
178
187
  --rz-button-ghost-fg: var(--rz-fg-muted);
@@ -186,16 +195,6 @@
186
195
  padding-inline: var(--rz-size-2-5);
187
196
  }
188
197
 
189
- :global(.rz-button--size-icon-sm) {
190
- width: var(--rz-size-7);
191
- padding: 0;
192
- }
193
-
194
- :global(.rz-button__icon) {
195
- width: auto;
196
- height: auto;
197
- }
198
-
199
198
  :global(.rz-button--ghost svg) {
200
199
  color: var(--rz-fg-subtle);
201
200
  transition: color 0.15s;
@@ -213,10 +212,13 @@
213
212
  color: var(--rz-fg);
214
213
  }
215
214
 
216
- :global(.rz-button--default) {
217
- margin-left: var(--rz-size-1-5);
215
+ :global(:is(.rz-button--default, .rz-button--secondary)) {
218
216
  padding-inline: var(--rz-size-3);
219
217
  }
218
+
219
+ :global([data-submit]) {
220
+ margin-left: var(--rz-size-1-5);
221
+ }
220
222
  }
221
223
 
222
224
  .rz-auto-save-state {
@@ -231,10 +233,9 @@
231
233
  color: var(--rz-warn);
232
234
  }
233
235
 
234
- /* On a narrow page the auto-save note and the open button go. */
236
+ /* On a narrow page the auto-save note goes. */
235
237
  @container main (max-width: 30rem) {
236
- .rz-auto-save-state,
237
- .rz-document-actions :global(.rz-document-actions__open) {
238
+ .rz-auto-save-state {
238
239
  display: none;
239
240
  }
240
241
  }
@@ -243,6 +244,56 @@
243
244
  color: var(--rz-fg-subtle);
244
245
  }
245
246
 
247
+ /*
248
+ * The title field as the heading: the heading's type and no box, as wide as its text. A line
249
+ * under it on hover, the accent's while typing, the danger's on an error.
250
+ */
251
+ .rz-document-title-input {
252
+ /* One line of the heading, empty with its placeholder or filled. */
253
+ display: block;
254
+ height: 1lh;
255
+ field-sizing: content;
256
+ max-width: 100%;
257
+ padding: 0;
258
+ border: 0;
259
+ background: transparent;
260
+ color: inherit;
261
+ font: inherit;
262
+ letter-spacing: inherit;
263
+ line-height: inherit;
264
+ outline: none;
265
+ transition: box-shadow 0.15s;
266
+
267
+ &::-moz-placeholder {
268
+ color: var(--rz-fg-subtle);
269
+ }
270
+
271
+ &::placeholder {
272
+ color: var(--rz-fg-subtle);
273
+ }
274
+
275
+ &:hover:not(:-moz-read-only) {
276
+ box-shadow: inset 0 -1px 0 var(--rz-border-strong);
277
+ }
278
+
279
+ &:hover:not(:read-only) {
280
+ box-shadow: inset 0 -1px 0 var(--rz-border-strong);
281
+ }
282
+
283
+ &:focus-visible {
284
+ box-shadow: inset 0 -2px 0 var(--rz-accent);
285
+ }
286
+
287
+ &[aria-invalid] {
288
+ box-shadow: inset 0 -2px 0 var(--rz-danger);
289
+ }
290
+ }
291
+
292
+ .rz-document-title-error {
293
+ color: var(--rz-danger);
294
+ font-size: var(--rz-text-sm);
295
+ }
296
+
246
297
  .rz-document-meta {
247
298
  font-size: var(--rz-text-sm);
248
299
  }