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.
- package/dist/core/auth/better-auth/config.server.d.ts +1 -1
- package/dist/core/auth/better-auth/instance.server.d.ts +2 -2
- package/dist/core/boot.server.d.ts +2 -2
- package/dist/core/i18n/en/common.d.ts +10 -4
- package/dist/core/i18n/en/common.js +12 -6
- package/dist/core/i18n/fr/common.d.ts +10 -4
- package/dist/core/i18n/fr/common.js +12 -7
- package/dist/core/prototype/shared/title/find-title.d.ts +9 -0
- package/dist/core/prototype/shared/title/find-title.js +20 -4
- package/dist/fields/group/component/Group.svelte +4 -3
- package/dist/fields/radio/component/Radio.svelte +19 -1
- package/dist/fields/radio/index.d.ts +23 -6
- package/dist/fields/radio/index.js +13 -1
- package/dist/fields/text/index.d.ts +11 -3
- package/dist/fields/text/index.js +11 -3
- package/dist/panel/components/fields/RenderFields.svelte +3 -2
- package/dist/panel/components/sections/collection/DropHint.svelte +41 -0
- package/dist/panel/components/sections/collection/DropHint.svelte.d.ts +7 -0
- package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte +23 -3
- package/dist/panel/components/sections/collection/header/ButtonCreate.svelte +3 -3
- package/dist/panel/components/sections/collection/header/ButtonCreate.svelte.d.ts +1 -1
- package/dist/panel/components/sections/collection/list/CollectionList.svelte +8 -0
- package/dist/panel/components/sections/document/AutoSaveBanner.svelte +1 -1
- package/dist/panel/components/sections/document/ButtonPublish.svelte +39 -0
- package/dist/panel/components/sections/document/ButtonPublish.svelte.d.ts +7 -0
- package/dist/panel/components/sections/document/ButtonSave.svelte +6 -3
- package/dist/panel/components/sections/document/ButtonSave.svelte.d.ts +3 -1
- package/dist/panel/components/sections/document/Document.svelte +4 -13
- package/dist/panel/components/sections/document/DocumentChildren.svelte +1 -1
- package/dist/panel/components/sections/document/Header.svelte +116 -65
- package/dist/panel/components/sections/document/Settings.svelte +42 -125
- package/dist/panel/components/sections/document/VersionMenu.svelte +383 -0
- package/dist/panel/components/sections/document/VersionMenu.svelte.d.ts +8 -0
- package/dist/panel/components/sections/document/Versions.svelte +1 -1
- package/dist/panel/components/sections/document/Versions.svelte.d.ts +1 -1
- package/dist/panel/components/sections/document/version-status.d.ts +12 -0
- package/dist/panel/components/sections/document/version-status.js +33 -0
- package/dist/panel/components/sections/document/versions-list.d.ts +1 -1
- package/dist/panel/components/sections/document/versions-list.js +1 -1
- package/dist/panel/components/ui/calendar/calendar.svelte.d.ts +1 -1
- package/dist/panel/components/ui/checkbox/checkbox.svelte.d.ts +1 -1
- package/dist/panel/components/ui/page-header/PageHeader.svelte +39 -13
- package/dist/panel/components/ui/page-header/PageHeader.svelte.d.ts +4 -0
- package/dist/panel/components/ui/radio-card-group/index.d.ts +3 -0
- package/dist/panel/components/ui/radio-card-group/index.js +3 -0
- package/dist/panel/components/ui/radio-card-group/radio-card-group-item.svelte +30 -0
- package/dist/panel/components/ui/radio-card-group/radio-card-group-item.svelte.d.ts +9 -0
- package/dist/panel/components/ui/radio-card-group/radio-card-group.css +80 -0
- package/dist/panel/components/ui/radio-card-group/radio-card-group.svelte +18 -0
- package/dist/panel/components/ui/radio-card-group/radio-card-group.svelte.d.ts +5 -0
- package/dist/panel/components/ui/radio-row-group/radio-row-group.css +5 -3
- package/dist/panel/components/ui/switch/switch.svelte.d.ts +1 -1
- package/dist/panel/context/collection.svelte.d.ts +2 -2
- package/dist/panel/context/documentForm.svelte.d.ts +2 -0
- package/dist/panel/context/documentForm.svelte.js +12 -0
- package/dist/panel/context/versions.svelte.js +1 -1
- package/dist/panel/pages/collection/CollectionPage.svelte +37 -27
- package/dist/panel/pages/collection/CollectionPage.svelte.d.ts +1 -1
- package/dist/panel/style/index.css +0 -12
- package/dist/panel/style/scheme.css +0 -12
- package/package.json +1 -1
- package/dist/panel/components/sections/document/ButtonStatus.svelte +0 -158
- package/dist/panel/components/sections/document/ButtonStatus.svelte.d.ts +0 -7
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { invalidateAll } from '$app/navigation';
|
|
2
|
+
import { PARAMS } from '../../../../core/constants.js';
|
|
3
|
+
import { t__ } from '../../../../core/i18n/index.js';
|
|
4
|
+
import { apiUrl } from '../../../../core/routes/util.js';
|
|
5
|
+
import { documentSegments } from '../../../util/url.js';
|
|
6
|
+
import { toast } from 'svelte-sonner';
|
|
7
|
+
/**
|
|
8
|
+
* Sets the status of the row on screen, without a save, then takes it into the form without
|
|
9
|
+
* dirtying it and reloads the page data and the version history.
|
|
10
|
+
*
|
|
11
|
+
* ```
|
|
12
|
+
* PATCH /api/news/n1?versionId=v2 { status: 'published' }
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export async function setVersionStatus(form, APIProxy, next) {
|
|
16
|
+
const url = apiUrl(...documentSegments(form.config.kebab, form.values));
|
|
17
|
+
const response = await fetch(`${url}?${PARAMS.VERSION_ID}=${form.values.versionId}`, {
|
|
18
|
+
method: 'PATCH',
|
|
19
|
+
body: JSON.stringify({ status: next })
|
|
20
|
+
}).catch(() => null);
|
|
21
|
+
if (response?.status !== 200) {
|
|
22
|
+
toast.error(t__('common.generic_error'));
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
toast.success(t__('common.doc_updated'));
|
|
26
|
+
// The server holds the new status already: the form takes it without getting dirty, so no
|
|
27
|
+
// auto-save follows a publish.
|
|
28
|
+
form.sync('status', next);
|
|
29
|
+
invalidateAll();
|
|
30
|
+
// The write went around the form: the version history re-reads its statuses. `apiUrl(kebab)`
|
|
31
|
+
// reaches `/api/<kebab>--versions` because `invalidate` matches by substring (api-proxy.svelte.ts).
|
|
32
|
+
APIProxy.invalidate(apiUrl(form.config.kebab));
|
|
33
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** The versions collection's endpoint behind a document type: `/api/news--versions`. */
|
|
2
2
|
export declare const versionsApiUrl: (type: string) => string;
|
|
3
3
|
/**
|
|
4
|
-
* One document's history, as the version history (Versions.svelte) and the
|
|
4
|
+
* One document's history, as the version history (Versions.svelte) and the version menu read
|
|
5
5
|
* it. One URL, so the API proxy serves both from the same cache and one invalidation refreshes
|
|
6
6
|
* both.
|
|
7
7
|
*/
|
|
@@ -4,7 +4,7 @@ import { apiUrl } from '../../../../core/routes/util.js';
|
|
|
4
4
|
/** The versions collection's endpoint behind a document type: `/api/news--versions`. */
|
|
5
5
|
export const versionsApiUrl = (type) => apiUrl(prototypeKebab(withVersionsSuffix(type)));
|
|
6
6
|
/**
|
|
7
|
-
* One document's history, as the version history (Versions.svelte) and the
|
|
7
|
+
* One document's history, as the version history (Versions.svelte) and the version menu read
|
|
8
8
|
* it. One URL, so the API proxy serves both from the same cache and one invalidation refreshes
|
|
9
9
|
* both.
|
|
10
10
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Calendar as CalendarPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
|
|
2
2
|
import * as Calendar from './index.js';
|
|
3
3
|
import './calendar.css';
|
|
4
|
-
declare const Calendar: import("svelte").Component<WithoutChildrenOrChild<CalendarPrimitive.RootProps>, {}, "value" | "
|
|
4
|
+
declare const Calendar: import("svelte").Component<WithoutChildrenOrChild<CalendarPrimitive.RootProps>, {}, "value" | "ref" | "placeholder">;
|
|
5
5
|
type Calendar = ReturnType<typeof Calendar>;
|
|
6
6
|
export default Calendar;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Checkbox as CheckboxPrimitive } from 'bits-ui';
|
|
2
2
|
import './checkbox.css';
|
|
3
|
-
declare const Checkbox: import("svelte").Component<Omit<Omit<CheckboxPrimitive.RootProps, "child">, "children">, {}, "
|
|
3
|
+
declare const Checkbox: import("svelte").Component<Omit<Omit<CheckboxPrimitive.RootProps, "child">, "children">, {}, "ref" | "checked">;
|
|
4
4
|
type Checkbox = ReturnType<typeof Checkbox>;
|
|
5
5
|
export default Checkbox;
|
|
@@ -4,17 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
type Props = {
|
|
6
6
|
title?: Snippet;
|
|
7
|
+
/** Right after the title, on its line: a collection's create buttons. */
|
|
8
|
+
titleEnd?: Snippet;
|
|
7
9
|
/** A line under the title: a count, a date. */
|
|
8
10
|
meta?: Snippet;
|
|
9
11
|
/** Under the meta line: a document's url. */
|
|
10
12
|
aside?: Snippet;
|
|
11
13
|
/** The toolbar under the title, its left side. */
|
|
12
14
|
bottomLeft?: Snippet;
|
|
15
|
+
/** The toolbar's right end: a collection's count. */
|
|
16
|
+
bottomRight?: Snippet;
|
|
13
17
|
/** Replaces the breadcrumb, top left: a nested document's Close. */
|
|
14
18
|
topLeft?: Snippet;
|
|
15
19
|
topRight?: Snippet;
|
|
16
20
|
};
|
|
17
|
-
const { bottomLeft, topRight, topLeft, title, meta, aside }: Props =
|
|
21
|
+
const { bottomLeft, bottomRight, topRight, topLeft, title, titleEnd, meta, aside }: Props =
|
|
22
|
+
$props();
|
|
18
23
|
</script>
|
|
19
24
|
|
|
20
25
|
<div class="rz-page-header__row rz-page-header__row-top">
|
|
@@ -33,7 +38,12 @@
|
|
|
33
38
|
|
|
34
39
|
{#if title || meta || aside}
|
|
35
40
|
<div class="rz-page-header__head">
|
|
36
|
-
{#if title}
|
|
41
|
+
{#if title && titleEnd}
|
|
42
|
+
<div class="rz-page-header__title-row">
|
|
43
|
+
<h1 class="rz-page-header__title">{@render title()}</h1>
|
|
44
|
+
<div class="rz-page-header__title-end">{@render titleEnd()}</div>
|
|
45
|
+
</div>
|
|
46
|
+
{:else if title}
|
|
37
47
|
<h1 class="rz-page-header__title">{@render title()}</h1>
|
|
38
48
|
{/if}
|
|
39
49
|
{#if meta}
|
|
@@ -43,11 +53,16 @@
|
|
|
43
53
|
</div>
|
|
44
54
|
{/if}
|
|
45
55
|
|
|
46
|
-
{#if bottomLeft}
|
|
56
|
+
{#if bottomLeft || bottomRight}
|
|
47
57
|
<div class="rz-page-header__toolbar">
|
|
48
58
|
<div class="rz-page-header__bottom-left">
|
|
49
59
|
{@render bottomLeft?.()}
|
|
50
60
|
</div>
|
|
61
|
+
{#if bottomRight}
|
|
62
|
+
<div class="rz-page-header__bottom-right">
|
|
63
|
+
{@render bottomRight()}
|
|
64
|
+
</div>
|
|
65
|
+
{/if}
|
|
51
66
|
</div>
|
|
52
67
|
{/if}
|
|
53
68
|
|
|
@@ -80,7 +95,7 @@
|
|
|
80
95
|
height: var(--rz-size-11);
|
|
81
96
|
margin-bottom: var(--rz-size-6);
|
|
82
97
|
padding-inline: var(--rz-size-5) var(--rz-size-3);
|
|
83
|
-
/* See-through
|
|
98
|
+
/* See-through: what scrolls under it blurs. */
|
|
84
99
|
background: oklch(from var(--rz-bg-page) l c h / 0.8);
|
|
85
100
|
backdrop-filter: blur(12px);
|
|
86
101
|
box-shadow: inset 0 -1px 0 var(--rz-border);
|
|
@@ -92,7 +107,8 @@
|
|
|
92
107
|
}
|
|
93
108
|
|
|
94
109
|
.rz-page-header__row-top > div,
|
|
95
|
-
.rz-page-header__bottom-left
|
|
110
|
+
.rz-page-header__bottom-left,
|
|
111
|
+
.rz-page-header__bottom-right {
|
|
96
112
|
display: flex;
|
|
97
113
|
align-items: center;
|
|
98
114
|
gap: var(--rz-size-2);
|
|
@@ -103,16 +119,10 @@
|
|
|
103
119
|
justify-content: flex-end;
|
|
104
120
|
}
|
|
105
121
|
|
|
106
|
-
/*
|
|
107
|
-
* The title and the toolbar line up with a page's content. A page narrows it with
|
|
108
|
-
* `--rz-page-width`; else it runs the full width, inside the gutter.
|
|
109
|
-
*/
|
|
122
|
+
/* The title and the toolbar line up with a page's content: the full width, inside the gutter. */
|
|
110
123
|
.rz-page-header__head,
|
|
111
124
|
.rz-page-header__toolbar {
|
|
112
|
-
padding-inline:
|
|
113
|
-
var(--rz-page-gutter, var(--rz-size-6)),
|
|
114
|
-
calc((100% - var(--rz-page-width, 100%)) / 2)
|
|
115
|
-
);
|
|
125
|
+
padding-inline: var(--rz-page-gutter, var(--rz-size-6));
|
|
116
126
|
}
|
|
117
127
|
|
|
118
128
|
.rz-page-header__head {
|
|
@@ -121,11 +131,27 @@
|
|
|
121
131
|
gap: var(--rz-size-1-5);
|
|
122
132
|
}
|
|
123
133
|
|
|
134
|
+
/* The title takes the room it needs, the buttons follow it. */
|
|
135
|
+
.rz-page-header__title-row {
|
|
136
|
+
display: flex;
|
|
137
|
+
align-items: center;
|
|
138
|
+
gap: var(--rz-size-4);
|
|
139
|
+
min-width: 0;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.rz-page-header__title-end {
|
|
143
|
+
display: flex;
|
|
144
|
+
flex-shrink: 0;
|
|
145
|
+
align-items: center;
|
|
146
|
+
gap: var(--rz-size-1);
|
|
147
|
+
}
|
|
148
|
+
|
|
124
149
|
.rz-page-header__title {
|
|
125
150
|
overflow: hidden;
|
|
126
151
|
display: -webkit-box;
|
|
127
152
|
-webkit-box-orient: vertical;
|
|
128
153
|
-webkit-line-clamp: 1;
|
|
154
|
+
min-width: 0;
|
|
129
155
|
font-variation-settings: 'wght' 600;
|
|
130
156
|
font-weight: 600;
|
|
131
157
|
font-size: var(--rz-text-4xl);
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { type Snippet } from 'svelte';
|
|
2
2
|
type Props = {
|
|
3
3
|
title?: Snippet;
|
|
4
|
+
/** Right after the title, on its line: a collection's create buttons. */
|
|
5
|
+
titleEnd?: Snippet;
|
|
4
6
|
/** A line under the title: a count, a date. */
|
|
5
7
|
meta?: Snippet;
|
|
6
8
|
/** Under the meta line: a document's url. */
|
|
7
9
|
aside?: Snippet;
|
|
8
10
|
/** The toolbar under the title, its left side. */
|
|
9
11
|
bottomLeft?: Snippet;
|
|
12
|
+
/** The toolbar's right end: a collection's count. */
|
|
13
|
+
bottomRight?: Snippet;
|
|
10
14
|
/** Replaces the breadcrumb, top left: a nested document's Close. */
|
|
11
15
|
topLeft?: Snippet;
|
|
12
16
|
topRight?: Snippet;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { RadioGroup as RadioGroupPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
|
|
3
|
+
import type { Component, Snippet } from 'svelte';
|
|
4
|
+
|
|
5
|
+
/** A card: its thumbnail, when it has one, above its label. */
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
thumbnail: Thumbnail,
|
|
10
|
+
children,
|
|
11
|
+
...restProps
|
|
12
|
+
}: WithoutChildrenOrChild<RadioGroupPrimitive.ItemProps> & {
|
|
13
|
+
thumbnail?: Component;
|
|
14
|
+
children: Snippet;
|
|
15
|
+
} = $props();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<RadioGroupPrimitive.Item
|
|
19
|
+
bind:ref
|
|
20
|
+
class="rz-radio-card-group-item {className}"
|
|
21
|
+
data-thumbnail={Thumbnail ? '' : null}
|
|
22
|
+
{...restProps}
|
|
23
|
+
>
|
|
24
|
+
{#if Thumbnail}
|
|
25
|
+
<span class="rz-radio-card-group-item__frame">
|
|
26
|
+
<Thumbnail />
|
|
27
|
+
</span>
|
|
28
|
+
{/if}
|
|
29
|
+
<span class="rz-radio-card-group-item__label">{@render children()}</span>
|
|
30
|
+
</RadioGroupPrimitive.Item>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RadioGroup as RadioGroupPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
|
|
2
|
+
import type { Component, Snippet } from 'svelte';
|
|
3
|
+
type $$ComponentProps = WithoutChildrenOrChild<RadioGroupPrimitive.ItemProps> & {
|
|
4
|
+
thumbnail?: Component;
|
|
5
|
+
children: Snippet;
|
|
6
|
+
};
|
|
7
|
+
declare const RadioCardGroupItem: Component<$$ComponentProps, {}, "ref">;
|
|
8
|
+
type RadioCardGroupItem = ReturnType<typeof RadioCardGroupItem>;
|
|
9
|
+
export default RadioCardGroupItem;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/* As many cards per line as fit, each at least --rz-size-40 wide. */
|
|
2
|
+
.rz-radio-card-group {
|
|
3
|
+
display: grid;
|
|
4
|
+
grid-template-columns: repeat(auto-fill, minmax(var(--rz-size-40), 1fr));
|
|
5
|
+
gap: var(--rz-size-2-5);
|
|
6
|
+
|
|
7
|
+
&[data-disabled] {
|
|
8
|
+
opacity: 0.4;
|
|
9
|
+
cursor: not-allowed;
|
|
10
|
+
button {
|
|
11
|
+
cursor: not-allowed;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* A raised card, muted until hovered or checked. */
|
|
17
|
+
.rz-radio-card-group-item {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
gap: var(--rz-size-1-5);
|
|
21
|
+
min-width: 0;
|
|
22
|
+
padding: var(--rz-size-1-5) var(--rz-size-1-5) var(--rz-size-2);
|
|
23
|
+
background-color: var(--rz-bg-raised);
|
|
24
|
+
box-shadow:
|
|
25
|
+
0 0 0 1px var(--rz-border),
|
|
26
|
+
var(--rz-shadow-raised, 0 0 transparent);
|
|
27
|
+
border-radius: var(--rz-radius-xl);
|
|
28
|
+
color: var(--rz-fg-muted);
|
|
29
|
+
font-size: var(--rz-text-sm);
|
|
30
|
+
text-align: left;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
outline: none;
|
|
33
|
+
|
|
34
|
+
&:hover,
|
|
35
|
+
&[data-state='checked'] {
|
|
36
|
+
background-image: linear-gradient(var(--rz-bg-hover) 0 0);
|
|
37
|
+
color: var(--rz-fg);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&[data-state='checked'] {
|
|
41
|
+
box-shadow: 0 0 0 1px var(--rz-accent-border);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&:focus-visible {
|
|
45
|
+
outline: 2px solid var(--rz-accent-border);
|
|
46
|
+
outline-offset: 2px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* Without a thumbnail, the label spans the card's width, its text in the middle. */
|
|
50
|
+
&:not([data-thumbnail]) {
|
|
51
|
+
justify-content: center;
|
|
52
|
+
text-align: center;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* 16:10, the thumbnail filling it. */
|
|
57
|
+
.rz-radio-card-group-item__frame {
|
|
58
|
+
display: block;
|
|
59
|
+
aspect-ratio: 16 / 10;
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
border-radius: var(--rz-radius-lg);
|
|
62
|
+
background-color: var(--rz-bg-well);
|
|
63
|
+
color: var(--rz-fg-subtle);
|
|
64
|
+
|
|
65
|
+
> svg {
|
|
66
|
+
display: block;
|
|
67
|
+
width: 100%;
|
|
68
|
+
height: 100%;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.rz-radio-card-group-item:is(:hover, [data-state='checked']) .rz-radio-card-group-item__frame {
|
|
73
|
+
color: var(--rz-fg-muted);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.rz-radio-card-group-item__label {
|
|
77
|
+
padding-inline: var(--rz-size-1);
|
|
78
|
+
font-variation-settings: 'wght' 500;
|
|
79
|
+
font-weight: 500;
|
|
80
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { RadioGroup as RadioGroupPrimitive } from 'bits-ui';
|
|
3
|
+
import './radio-card-group.css';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
value = $bindable(''),
|
|
9
|
+
...restProps
|
|
10
|
+
}: RadioGroupPrimitive.RootProps = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<RadioGroupPrimitive.Root
|
|
14
|
+
bind:ref
|
|
15
|
+
bind:value
|
|
16
|
+
class="rz-radio-card-group {className}"
|
|
17
|
+
{...restProps}
|
|
18
|
+
/>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RadioGroup as RadioGroupPrimitive } from 'bits-ui';
|
|
2
|
+
import './radio-card-group.css';
|
|
3
|
+
declare const RadioCardGroup: import("svelte").Component<RadioGroupPrimitive.RootProps, {}, "value" | "ref">;
|
|
4
|
+
type RadioCardGroup = ReturnType<typeof RadioCardGroup>;
|
|
5
|
+
export default RadioCardGroup;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
.rz-radio-row-group {
|
|
2
2
|
display: flex;
|
|
3
|
+
flex-wrap: wrap;
|
|
3
4
|
justify-content: space-between;
|
|
4
5
|
align-self: flex-start;
|
|
5
6
|
width: auto;
|
|
@@ -9,8 +10,7 @@
|
|
|
9
10
|
border-color: var(--rz-border-strong);
|
|
10
11
|
}
|
|
11
12
|
border-radius: var(--rz-radius-lg);
|
|
12
|
-
|
|
13
|
-
height: var(--rz-input-height);
|
|
13
|
+
min-height: var(--rz-input-height);
|
|
14
14
|
padding: var(--rz-size-0-5);
|
|
15
15
|
|
|
16
16
|
&[data-disabled] {
|
|
@@ -33,7 +33,9 @@
|
|
|
33
33
|
padding: 0 var(--rz-size-4);
|
|
34
34
|
background-color: transparent;
|
|
35
35
|
border-radius: var(--rz-radius-md);
|
|
36
|
-
|
|
36
|
+
/* One line of the row: the input height less the well's padding. */
|
|
37
|
+
height: var(--rz-size-8);
|
|
38
|
+
white-space: nowrap;
|
|
37
39
|
color: var(--rz-fg-muted);
|
|
38
40
|
font-variation-settings: 'wght' 500;
|
|
39
41
|
font-weight: 500;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Switch as SwitchPrimitive } from 'bits-ui';
|
|
2
2
|
import './switch.css';
|
|
3
|
-
declare const Switch: import("svelte").Component<Omit<Omit<SwitchPrimitive.RootProps, "child">, "children">, {}, "
|
|
3
|
+
declare const Switch: import("svelte").Component<Omit<Omit<SwitchPrimitive.RootProps, "child">, "children">, {}, "ref" | "checked">;
|
|
4
4
|
type Switch = ReturnType<typeof Switch>;
|
|
5
5
|
export default Switch;
|
|
@@ -45,7 +45,7 @@ export declare function setCollectionContext(args: Args): {
|
|
|
45
45
|
/** A filter change drops the selection, so no hidden document stays picked. */
|
|
46
46
|
statusFilter: StatusFilter;
|
|
47
47
|
kindFilter: KindFilter;
|
|
48
|
-
readonly kinds: ("
|
|
48
|
+
readonly kinds: ("audio" | "video" | "image" | "document" | "other")[];
|
|
49
49
|
readonly draftsCount: number;
|
|
50
50
|
readonly totalSize: number;
|
|
51
51
|
/** Every document of the collection, whatever the search. */
|
|
@@ -95,7 +95,7 @@ export declare function getCollectionContext(): {
|
|
|
95
95
|
/** A filter change drops the selection, so no hidden document stays picked. */
|
|
96
96
|
statusFilter: StatusFilter;
|
|
97
97
|
kindFilter: KindFilter;
|
|
98
|
-
readonly kinds: ("
|
|
98
|
+
readonly kinds: ("audio" | "video" | "image" | "document" | "other")[];
|
|
99
99
|
readonly draftsCount: number;
|
|
100
100
|
readonly totalSize: number;
|
|
101
101
|
/** Every document of the collection, whatever the search. */
|
|
@@ -89,6 +89,8 @@ export declare function setDocumentFormContext<T extends WithOptional<GenericDoc
|
|
|
89
89
|
readonly config: import("../../types.js").BuiltCollection;
|
|
90
90
|
readonly title: string | import("../../core/prototype/collection/types.js").CollectionLabel;
|
|
91
91
|
readonly isLive: boolean;
|
|
92
|
+
/** The path of the title the page's heading edits, or `null`: the form leaves that field out. */
|
|
93
|
+
readonly inlineTitle: string | null;
|
|
92
94
|
/** Puts the document back as it was loaded or last saved. The errors stay. */
|
|
93
95
|
reset(): void;
|
|
94
96
|
};
|
|
@@ -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
|
|
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
|
|
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="
|
|
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;
|
|
@@ -602,13 +602,6 @@ video {
|
|
|
602
602
|
|
|
603
603
|
/* shadows: only what floats over the page casts one */
|
|
604
604
|
--rz-shadow-float: 0 16px 36px -12px oklch(from var(--rz-gray-0) l c h / 0.16);
|
|
605
|
-
|
|
606
|
-
/* gradients */
|
|
607
|
-
--rz-glow: radial-gradient(
|
|
608
|
-
70% 38% at 50% 0%,
|
|
609
|
-
oklch(from var(--rz-accent-solid) l c h / 0.035),
|
|
610
|
-
transparent
|
|
611
|
-
);
|
|
612
605
|
}
|
|
613
606
|
|
|
614
607
|
@media (prefers-color-scheme: dark) {
|
|
@@ -639,11 +632,6 @@ video {
|
|
|
639
632
|
--rz-ring: oklch(from var(--rz-accent-soft) l c h / 0.2);
|
|
640
633
|
|
|
641
634
|
--rz-shadow-float: 0 16px 40px -12px oklch(from var(--rz-gray-0) l c h / 0.6);
|
|
642
|
-
--rz-glow: radial-gradient(
|
|
643
|
-
70% 38% at 50% 0%,
|
|
644
|
-
oklch(from var(--rz-accent-solid) l c h / 0.07),
|
|
645
|
-
transparent
|
|
646
|
-
);
|
|
647
635
|
}
|
|
648
636
|
}
|
|
649
637
|
|