rimecms 1.0.1 → 1.1.0
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/i18n/en/fields.d.ts +1 -1
- package/dist/core/i18n/en/fields.js +1 -1
- package/dist/core/i18n/fr/fields.d.ts +1 -1
- package/dist/core/i18n/fr/fields.js +1 -1
- package/dist/fields/blocks/component/AddBlockButton.svelte +1 -1
- package/dist/fields/blocks/component/Block.svelte +4 -5
- package/dist/fields/blocks/component/Blocks.svelte +17 -13
- package/dist/fields/blocks/component/focus/BlocksFocus.svelte +52 -64
- package/dist/fields/blocks/component/focus/DefaultRender.svelte +108 -0
- package/dist/fields/blocks/component/focus/{RenderPlaceholder.svelte.d.ts → DefaultRender.svelte.d.ts} +3 -3
- package/dist/fields/blocks/component/focus/Inspector.svelte +160 -0
- package/dist/fields/blocks/component/focus/Inspector.svelte.d.ts +7 -0
- package/dist/fields/blocks/component/focus/Layers.svelte +16 -3
- package/dist/fields/blocks/component/focus/LayersList.svelte +28 -11
- package/dist/fields/blocks/component/focus/LayersList.svelte.d.ts +2 -0
- package/dist/fields/blocks/component/focus/Palette.svelte +3 -3
- package/dist/fields/blocks/component/focus/Renders.svelte +66 -15
- package/dist/fields/blocks/component/focus/Renders.svelte.d.ts +5 -1
- package/dist/fields/blocks/component/focus/StagePlaceholder.svelte +1 -4
- package/dist/fields/blocks/component/focus/focus.svelte.d.ts +26 -12
- package/dist/fields/blocks/component/focus/focus.svelte.js +114 -57
- package/dist/fields/blocks/component/picker/BlockTile.svelte +3 -5
- package/dist/fields/combobox/component/ComboBox.svelte +1 -1
- package/dist/fields/combobox/component/combobox.css +1 -1
- package/dist/fields/date/component/Date.svelte +1 -1
- package/dist/fields/group/component/Group.svelte +4 -4
- package/dist/fields/link/component/Link.svelte +1 -1
- package/dist/fields/link/component/RessourceInput.svelte +2 -2
- package/dist/fields/number/component/Number.svelte +1 -1
- package/dist/fields/relation/component/Cell.svelte +3 -1
- package/dist/fields/relation/component/RelationInline.svelte +50 -19
- package/dist/fields/relation/component/default/Default.svelte +3 -3
- package/dist/fields/relation/component/upload/Browse.svelte +2 -2
- package/dist/fields/relation/component/upload/Upload.svelte +2 -2
- package/dist/fields/rich-text/component/bubble-menu/bubble-menu.css +1 -1
- package/dist/fields/rich-text/component/bubble-menu/node-selector/node-selector.css +1 -1
- package/dist/fields/rich-text/core/features/link/component/link-selector.svelte +2 -2
- package/dist/fields/rich-text/core/features/resource/resource.svelte +1 -1
- package/dist/fields/rich-text/core/features/upload/upload.svelte +1 -1
- package/dist/fields/select/component/Select.svelte +2 -2
- package/dist/fields/text/component/TextInline.svelte +113 -0
- package/dist/fields/text/component/TextInline.svelte.d.ts +14 -0
- package/dist/fields/textarea/component/TextArea.svelte +1 -1
- package/dist/fields/tree/component/TreeBlock.svelte +4 -4
- package/dist/panel/components/fields/Error.svelte +1 -1
- package/dist/panel/components/fields/FieldsPreview.svelte +1 -1
- package/dist/panel/components/fields/FieldsPreviewTrigger.svelte +1 -1
- package/dist/panel/components/fields/Hint.svelte +1 -1
- package/dist/panel/components/fields/setting.css +6 -6
- package/dist/panel/components/sections/auth/AuthForm.svelte +2 -2
- package/dist/panel/components/sections/collection/Avatar.svelte +1 -1
- package/dist/panel/components/sections/collection/bulk-upload/FileDrop.svelte +1 -1
- package/dist/panel/components/sections/collection/bulk-upload/PageDrop.svelte +3 -3
- package/dist/panel/components/sections/collection/bulk-upload/UploadProgress.svelte +1 -1
- package/dist/panel/components/sections/collection/folder/Folder.svelte +1 -1
- package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte +2 -2
- package/dist/panel/components/sections/collection/grid/grid-item/GridItem.svelte +1 -1
- package/dist/panel/components/sections/collection/header/DisplayMode.svelte +1 -2
- package/dist/panel/components/sections/collection/list/CollectionList.svelte +2 -2
- package/dist/panel/components/sections/collection/list/header/Header.svelte +1 -1
- package/dist/panel/components/sections/collection/list/row/Row.svelte +1 -1
- package/dist/panel/components/sections/collection/tree/CollectionTree.svelte +1 -1
- package/dist/panel/components/sections/collection/tree/CollectionTreeNode.svelte +1 -1
- package/dist/panel/components/sections/collection/upload-thumb-cell/UploadThumbCell.svelte +1 -1
- package/dist/panel/components/sections/commands/CommandButton.svelte +1 -1
- package/dist/panel/components/sections/document/AuthAPIKeyDialog.svelte +1 -1
- package/dist/panel/components/sections/document/AuthFooter.svelte +2 -2
- package/dist/panel/components/sections/document/AutoSaveBanner.svelte +2 -2
- package/dist/panel/components/sections/document/ButtonStatus.svelte +1 -1
- package/dist/panel/components/sections/document/ChangeSlugDialog.svelte +1 -1
- package/dist/panel/components/sections/document/DocumentChildren.svelte +2 -2
- package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte +2 -2
- package/dist/panel/components/sections/document/upload-header/drop-zone/DropZone.svelte +1 -1
- package/dist/panel/components/sections/live/LiveFloatingUI.svelte +2 -2
- package/dist/panel/components/ui/breadcrumb/BreadCrumb.svelte +1 -1
- package/dist/panel/components/ui/button/button.svelte +3 -4
- package/dist/panel/components/ui/card/card.svelte +2 -2
- package/dist/panel/components/ui/card-document/card-document.svelte +2 -2
- package/dist/panel/components/ui/card-resource/card-resource.svelte +2 -2
- package/dist/panel/components/ui/command/command-input.svelte +1 -1
- package/dist/panel/components/ui/context-menu/context-menu.css +1 -1
- package/dist/panel/components/ui/dialog/dialog-content.css +1 -1
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +1 -1
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-content.css +1 -1
- package/dist/panel/components/ui/input/input.svelte +1 -1
- package/dist/panel/components/ui/nav/Nav.svelte +2 -3
- package/dist/panel/components/ui/nav/NavGroup.svelte +1 -1
- package/dist/panel/components/ui/nav/NavItemButton.svelte +1 -1
- package/dist/panel/components/ui/nav/UserButton.svelte +1 -1
- package/dist/panel/components/ui/page-header/PageHeader.svelte +1 -1
- package/dist/panel/components/ui/popover/popover-content.css +1 -1
- package/dist/panel/components/ui/radio-row-group/radio-row-group.css +0 -1
- package/dist/panel/components/ui/sheet/sheet.css +1 -1
- package/dist/panel/components/ui/sonner/sonner.css +1 -1
- package/dist/panel/components/ui/switch/switch.css +0 -2
- package/dist/panel/components/ui/tabs/tabs.css +2 -1
- package/dist/panel/components/ui/tag/tag.svelte +1 -1
- package/dist/panel/components/ui/tree/tree-rows.css +3 -3
- package/dist/panel/index.d.ts +2 -1
- package/dist/panel/index.js +2 -1
- package/dist/panel/pages/auth/forgot-password/ForgotPassword.svelte +1 -1
- package/dist/panel/pages/dashboard/Dashboard.svelte +1 -1
- package/dist/panel/pages/dashboard/DashboardCard.svelte +2 -2
- package/dist/panel/pages/dashboard/DashboardCollection.svelte +1 -1
- package/dist/panel/pages/dashboard/DashboardRow.svelte +1 -1
- package/dist/panel/style/index.css +13 -37
- package/dist/panel/style/mixins/index.css +1 -1
- package/dist/panel/style/palette.css +3 -3
- package/dist/panel/style/scheme.css +10 -34
- package/package.json +1 -1
- package/dist/fields/blocks/component/focus/RenderPlaceholder.svelte +0 -77
- package/dist/fields/blocks/component/focus/Stage.svelte +0 -190
- package/dist/fields/blocks/component/focus/Stage.svelte.d.ts +0 -8
|
@@ -27,7 +27,6 @@ declare namespace _default {
|
|
|
27
27
|
let picker_add: string;
|
|
28
28
|
let blocks_count: string;
|
|
29
29
|
let no_blocks_yet: string;
|
|
30
|
-
let no_blocks_yet_render: string;
|
|
31
30
|
let render_failed: string;
|
|
32
31
|
let go_to: string;
|
|
33
32
|
let move_up: string;
|
|
@@ -62,6 +61,7 @@ declare namespace _default {
|
|
|
62
61
|
let remove_item: string;
|
|
63
62
|
let open_editor: string;
|
|
64
63
|
let open_in_editor: string;
|
|
64
|
+
let focus_block: string;
|
|
65
65
|
let add_a_block: string;
|
|
66
66
|
let block_actions: string;
|
|
67
67
|
let fold: string;
|
|
@@ -27,7 +27,6 @@ export default {
|
|
|
27
27
|
picker_add: 'to add',
|
|
28
28
|
blocks_count: '$1 {block|block|blocks|blocks}',
|
|
29
29
|
no_blocks_yet: 'No block yet. Add one from the right, or with ⌘K.',
|
|
30
|
-
no_blocks_yet_render: 'No block yet. Add one with ⌘K.',
|
|
31
30
|
render_failed: 'The render of this block failed.',
|
|
32
31
|
go_to: 'Go to',
|
|
33
32
|
move_up: 'Move up',
|
|
@@ -62,6 +61,7 @@ export default {
|
|
|
62
61
|
remove_item: 'Remove $1',
|
|
63
62
|
open_editor: 'Open the editor',
|
|
64
63
|
open_in_editor: 'Open in the editor',
|
|
64
|
+
focus_block: 'Focus on this block',
|
|
65
65
|
add_a_block: 'Add a block',
|
|
66
66
|
block_actions: 'Block actions',
|
|
67
67
|
fold: 'Collapse',
|
|
@@ -27,7 +27,6 @@ declare namespace _default {
|
|
|
27
27
|
let picker_add: string;
|
|
28
28
|
let blocks_count: string;
|
|
29
29
|
let no_blocks_yet: string;
|
|
30
|
-
let no_blocks_yet_render: string;
|
|
31
30
|
let render_failed: string;
|
|
32
31
|
let go_to: string;
|
|
33
32
|
let move_up: string;
|
|
@@ -62,6 +61,7 @@ declare namespace _default {
|
|
|
62
61
|
let remove_item: string;
|
|
63
62
|
let open_editor: string;
|
|
64
63
|
let open_in_editor: string;
|
|
64
|
+
let focus_block: string;
|
|
65
65
|
let add_a_block: string;
|
|
66
66
|
let block_actions: string;
|
|
67
67
|
let fold: string;
|
|
@@ -27,7 +27,6 @@ export default {
|
|
|
27
27
|
picker_add: 'pour ajouter',
|
|
28
28
|
blocks_count: '$1 {bloc|bloc|blocs|blocs}',
|
|
29
29
|
no_blocks_yet: 'Aucun bloc pour l’instant. Ajoutez-en un à droite, ou avec ⌘K.',
|
|
30
|
-
no_blocks_yet_render: 'Aucun bloc pour l’instant. Ajoutez-en un avec ⌘K.',
|
|
31
30
|
render_failed: 'Le rendu de ce bloc a échoué.',
|
|
32
31
|
go_to: 'Aller à',
|
|
33
32
|
move_up: 'Monter',
|
|
@@ -62,6 +61,7 @@ export default {
|
|
|
62
61
|
remove_item: 'Retirer $1',
|
|
63
62
|
open_editor: 'Ouvrir l’éditeur',
|
|
64
63
|
open_in_editor: 'Ouvrir dans l’éditeur',
|
|
64
|
+
focus_block: 'Se concentrer sur ce bloc',
|
|
65
65
|
add_a_block: 'Ajouter un bloc',
|
|
66
66
|
block_actions: 'Actions du bloc',
|
|
67
67
|
fold: 'Replier',
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
<BlockPicker bind:open types={config.get.blocks} onpick={add} />
|
|
44
44
|
{/if}
|
|
45
45
|
|
|
46
|
-
<style>/* A level: its fill, a hairline, its shadow. raised, float. */
|
|
46
|
+
<style>/* A level: its fill, a hairline, and its shadow when it has one. raised has none, float does. */
|
|
47
47
|
|
|
48
48
|
/* A well: an input, a track, a dropzone. Its edge shows on hover. */
|
|
49
49
|
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
</div>
|
|
85
85
|
</div>
|
|
86
86
|
|
|
87
|
-
<style>/* A level: its fill, a hairline, its shadow. raised, float. */
|
|
87
|
+
<style>/* A level: its fill, a hairline, and its shadow when it has one. raised has none, float does. */
|
|
88
88
|
|
|
89
89
|
/* A well: an input, a track, a dropzone. Its edge shows on hover. */
|
|
90
90
|
|
|
@@ -121,9 +121,6 @@
|
|
|
121
121
|
|
|
122
122
|
/* Open, the row and its fields read as one: a hairline around both, another between them. */
|
|
123
123
|
.rz-block[data-open] {
|
|
124
|
-
outline: 1px solid var(--rz-border-strong);
|
|
125
|
-
outline-offset: -1px;
|
|
126
|
-
|
|
127
124
|
> .rz-block__header {
|
|
128
125
|
border-bottom: 1px solid var(--rz-border);
|
|
129
126
|
}
|
|
@@ -139,10 +136,12 @@
|
|
|
139
136
|
display: flex;
|
|
140
137
|
align-items: center;
|
|
141
138
|
gap: var(--rz-size-2);
|
|
139
|
+
height: var(--rz-size-11);
|
|
142
140
|
min-height: var(--rz-size-11);
|
|
143
141
|
padding: 0 var(--rz-size-1-5) 0 var(--rz-size-1);
|
|
144
142
|
transition: background-color 0.15s;
|
|
145
|
-
|
|
143
|
+
border-top: 1px solid transparent;
|
|
144
|
+
border-bottom: 1px solid transparent;
|
|
146
145
|
&:hover {
|
|
147
146
|
background-color: var(--rz-bg-hover);
|
|
148
147
|
}
|
|
@@ -21,6 +21,16 @@
|
|
|
21
21
|
/** The document's focus mode, absent in a nested form. */
|
|
22
22
|
const focus = getBlocksFocusContext();
|
|
23
23
|
const list = $derived(normalizeFieldPath(path));
|
|
24
|
+
/**
|
|
25
|
+
* Where focus opens: a list inside a block on that block, `sections.1.items` on `sections.1`;
|
|
26
|
+
* any other on itself.
|
|
27
|
+
*/
|
|
28
|
+
const focusTarget = $derived.by(() => {
|
|
29
|
+
const parts = list.split('.');
|
|
30
|
+
const last = parts.findLastIndex((part) => /^\d+$/.test(part));
|
|
31
|
+
if (last === -1 || !form.blocks.builder(parts.slice(0, last).join('.'))) return list;
|
|
32
|
+
return parts.slice(0, last + 1).join('.');
|
|
33
|
+
});
|
|
24
34
|
const summary = $derived(config.get.layout === 'summary' && !!focus);
|
|
25
35
|
|
|
26
36
|
const field = $derived(form.useField(path, config));
|
|
@@ -119,7 +129,7 @@
|
|
|
119
129
|
variant="ghost"
|
|
120
130
|
size="sm"
|
|
121
131
|
icon={Maximize2}
|
|
122
|
-
onclick={() => focus.open(
|
|
132
|
+
onclick={() => focus.open(focusTarget)}
|
|
123
133
|
data-focus-open={list}
|
|
124
134
|
>
|
|
125
135
|
{t__('fields.open_editor')}
|
|
@@ -138,7 +148,7 @@
|
|
|
138
148
|
: t__('fields.blocks_count|m|p', String(count))}
|
|
139
149
|
</span>
|
|
140
150
|
<Button
|
|
141
|
-
onclick={() => focus.open(
|
|
151
|
+
onclick={() => focus.open(focusTarget)}
|
|
142
152
|
size="sm"
|
|
143
153
|
variant="ghost"
|
|
144
154
|
icon={Maximize2}
|
|
@@ -182,7 +192,7 @@
|
|
|
182
192
|
<Field.Error error={field.error} />
|
|
183
193
|
</fieldset>
|
|
184
194
|
|
|
185
|
-
<style>/* A level: its fill, a hairline, its shadow. raised, float. */
|
|
195
|
+
<style>/* A level: its fill, a hairline, and its shadow when it has one. raised has none, float does. */
|
|
186
196
|
|
|
187
197
|
/* A well: an input, a track, a dropzone. Its edge shows on hover. */
|
|
188
198
|
|
|
@@ -257,7 +267,7 @@
|
|
|
257
267
|
background-color: var(--rz-bg-raised);
|
|
258
268
|
box-shadow:
|
|
259
269
|
0 0 0 1px var(--rz-border),
|
|
260
|
-
var(--rz-shadow-raised);
|
|
270
|
+
var(--rz-shadow-raised, 0 0 transparent);
|
|
261
271
|
border-radius: var(--rz-radius-xl);
|
|
262
272
|
|
|
263
273
|
:global(.rz-button) {
|
|
@@ -286,24 +296,18 @@
|
|
|
286
296
|
background-color: var(--rz-bg-raised);
|
|
287
297
|
box-shadow:
|
|
288
298
|
0 0 0 1px var(--rz-border),
|
|
289
|
-
var(--rz-shadow-raised);
|
|
299
|
+
var(--rz-shadow-raised, 0 0 transparent);
|
|
290
300
|
}
|
|
291
301
|
|
|
292
302
|
> :global(.rz-block + .rz-block) {
|
|
293
303
|
border-top: 1px solid var(--rz-border);
|
|
294
304
|
}
|
|
295
|
-
|
|
296
|
-
/* An open block draws its own edge. */
|
|
297
|
-
> :global(.rz-block[data-open] + .rz-block) {
|
|
298
|
-
border-top-color: transparent;
|
|
299
|
-
}
|
|
300
305
|
}
|
|
301
306
|
|
|
302
|
-
/* Inside a group, a block
|
|
307
|
+
/* Inside a group, a block or a tree item: a hairline, no second fill. */
|
|
303
308
|
:global(.rz-group-field__content) :is(.rz-blocks__list:not([data-empty]), .rz-blocks__summary),
|
|
304
309
|
:global(.rz-block__fields) :is(.rz-blocks__list:not([data-empty]), .rz-blocks__summary),
|
|
305
|
-
:global(.rz-tree-item__fields) :is(.rz-blocks__list:not([data-empty]), .rz-blocks__summary)
|
|
306
|
-
:global(.rz-stage__fields) :is(.rz-blocks__list:not([data-empty]), .rz-blocks__summary) {
|
|
310
|
+
:global(.rz-tree-item__fields) :is(.rz-blocks__list:not([data-empty]), .rz-blocks__summary) {
|
|
307
311
|
background-color: transparent;
|
|
308
312
|
box-shadow: 0 0 0 1px var(--rz-border);
|
|
309
313
|
}
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
import { getBlocksFocusContext, type SidebarTab } from './focus.svelte.js';
|
|
20
20
|
import Layers from './Layers.svelte';
|
|
21
21
|
import Palette from './Palette.svelte';
|
|
22
|
+
import Inspector from './Inspector.svelte';
|
|
22
23
|
import Renders from './Renders.svelte';
|
|
23
|
-
import Stage from './Stage.svelte';
|
|
24
24
|
import StagePlaceholder from './StagePlaceholder.svelte';
|
|
25
25
|
|
|
26
26
|
const { form }: { form: DocumentFormContext } = $props();
|
|
@@ -30,14 +30,26 @@
|
|
|
30
30
|
/** The overlay starts where the navigation ends, folded or not. */
|
|
31
31
|
const nav = getNavContext();
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
/** The list on screen: the open one, or the one the narrowed block sits in. */
|
|
34
|
+
const stageList = $derived(focus.narrowedRow?.list ?? focus.path ?? '');
|
|
35
|
+
const builder = $derived(stageList ? form.blocks.builder(stageList) : undefined);
|
|
36
|
+
/** The types of the list the next insert goes to. */
|
|
35
37
|
const addable = $derived.by(() => {
|
|
36
|
-
const list = focus.
|
|
38
|
+
const list = focus.insertList();
|
|
37
39
|
return list ? (form.blocks.builder(list)?.get.blocks ?? []) : [];
|
|
38
40
|
});
|
|
39
41
|
const crumbs = $derived(focus.breadcrumb());
|
|
40
|
-
|
|
42
|
+
/** The open list's blocks, or those the narrowed block holds. */
|
|
43
|
+
const count = $derived(
|
|
44
|
+
focus.narrowedRow
|
|
45
|
+
? focus.narrowedRow.children.reduce(
|
|
46
|
+
(sum, child) => sum + form.blocks.list(child.list).length,
|
|
47
|
+
0
|
|
48
|
+
)
|
|
49
|
+
: focus.path
|
|
50
|
+
? form.blocks.list(focus.path).length
|
|
51
|
+
: 0
|
|
52
|
+
);
|
|
41
53
|
const countLabel = $derived(
|
|
42
54
|
count === 1 ? t__('fields.blocks_count', '1') : t__('fields.blocks_count|m|p', String(count))
|
|
43
55
|
);
|
|
@@ -57,24 +69,21 @@
|
|
|
57
69
|
return parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;
|
|
58
70
|
}
|
|
59
71
|
|
|
60
|
-
/** Fields to show: a render with nothing but fields of its own, beside the stack of renders. */
|
|
61
|
-
const inspectable = $derived(focus.hasRenders);
|
|
62
|
-
|
|
63
72
|
// The selection moved. Nothing left to inspect: the types to add. Picked from the layers in the
|
|
64
73
|
// sheet: put it away, to see the block.
|
|
65
74
|
$effect(() => {
|
|
66
75
|
const picked = !!focus.current;
|
|
67
76
|
untrack(() => {
|
|
68
|
-
if (focus.tab === 'inspector' &&
|
|
77
|
+
if (focus.tab === 'inspector' && !picked) focus.tab = 'add';
|
|
69
78
|
if (focus.tab === 'layers') panelOpen = false;
|
|
70
79
|
});
|
|
71
80
|
});
|
|
72
81
|
|
|
73
82
|
// Arriving on an empty list: the types to add.
|
|
74
83
|
$effect(() => {
|
|
75
|
-
const
|
|
84
|
+
const opened = focus.path;
|
|
76
85
|
untrack(() => {
|
|
77
|
-
if (
|
|
86
|
+
if (opened && !focus.locked && !count) focus.tab = 'add';
|
|
78
87
|
});
|
|
79
88
|
});
|
|
80
89
|
|
|
@@ -82,7 +91,7 @@
|
|
|
82
91
|
$effect(() => {
|
|
83
92
|
if (!focus.inspected) return;
|
|
84
93
|
untrack(() => {
|
|
85
|
-
if (narrow
|
|
94
|
+
if (narrow) panelOpen = true;
|
|
86
95
|
});
|
|
87
96
|
});
|
|
88
97
|
|
|
@@ -109,10 +118,10 @@
|
|
|
109
118
|
else focus.removeSelection();
|
|
110
119
|
}
|
|
111
120
|
|
|
112
|
-
/** Escape goes back one step: the selection, then
|
|
121
|
+
/** Escape goes back one step: the selection, then one level up. The sheet closes itself. */
|
|
113
122
|
function back() {
|
|
114
123
|
if (!focus.rootSelected) focus.selectRoot();
|
|
115
|
-
else focus.
|
|
124
|
+
else focus.up();
|
|
116
125
|
}
|
|
117
126
|
|
|
118
127
|
async function paste() {
|
|
@@ -130,8 +139,7 @@
|
|
|
130
139
|
*/
|
|
131
140
|
useCommands(() => {
|
|
132
141
|
if (!focus.path) return [];
|
|
133
|
-
const
|
|
134
|
-
const types = form.blocks.builder(list)?.get.blocks ?? [];
|
|
142
|
+
const types = addable;
|
|
135
143
|
const row = focus.currentRow;
|
|
136
144
|
const editing = !focus.locked;
|
|
137
145
|
const free = () => !dialogOpen();
|
|
@@ -145,7 +153,7 @@
|
|
|
145
153
|
run: () => focus.insertType(builder.name)
|
|
146
154
|
}))
|
|
147
155
|
: []),
|
|
148
|
-
...(editing && row
|
|
156
|
+
...(editing && row && !focus.isNarrowedBlock(row.path)
|
|
149
157
|
? [
|
|
150
158
|
{
|
|
151
159
|
id: 'blocks.duplicate',
|
|
@@ -302,7 +310,6 @@
|
|
|
302
310
|
<div
|
|
303
311
|
class="rz-blocks-focus"
|
|
304
312
|
data-focus={focus.path}
|
|
305
|
-
data-layout={focus.hasRenders ? 'renders' : 'fields'}
|
|
306
313
|
style:left={nav?.width ?? '0'}
|
|
307
314
|
bind:clientWidth={width}
|
|
308
315
|
>
|
|
@@ -370,11 +377,9 @@
|
|
|
370
377
|
<Tabs.Trigger value="layers" data-label={t__('fields.layers')}>
|
|
371
378
|
{t__('fields.layers')}
|
|
372
379
|
</Tabs.Trigger>
|
|
373
|
-
{
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
</Tabs.Trigger>
|
|
377
|
-
{/if}
|
|
380
|
+
<Tabs.Trigger value="inspector" data-label={t__('fields.inspector')}>
|
|
381
|
+
{t__('fields.inspector')}
|
|
382
|
+
</Tabs.Trigger>
|
|
378
383
|
{#if !focus.locked}
|
|
379
384
|
<Tabs.Trigger value="add" data-label={t__('fields.blocks')}>
|
|
380
385
|
{t__('fields.blocks')}
|
|
@@ -386,15 +391,13 @@
|
|
|
386
391
|
<Layers {form} heading={false} />
|
|
387
392
|
</div>
|
|
388
393
|
</Tabs.Content>
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
{
|
|
392
|
-
|
|
393
|
-
{
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
</Tabs.Content>
|
|
397
|
-
{/if}
|
|
394
|
+
<Tabs.Content value="inspector" class="rz-blocks-focus__panel-content">
|
|
395
|
+
{#if focus.current}
|
|
396
|
+
<Inspector {form} />
|
|
397
|
+
{:else}
|
|
398
|
+
<p class="rz-blocks-focus__panel-hint">{t__('fields.pick_a_block')}</p>
|
|
399
|
+
{/if}
|
|
400
|
+
</Tabs.Content>
|
|
398
401
|
{#if !focus.locked}
|
|
399
402
|
<Tabs.Content value="add" class="rz-blocks-focus__panel-content">
|
|
400
403
|
<div class="rz-blocks-focus__panel-pad"><Palette {form} heading={false} /></div>
|
|
@@ -404,19 +407,18 @@
|
|
|
404
407
|
{/snippet}
|
|
405
408
|
|
|
406
409
|
<div class="rz-blocks-focus__body">
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
{
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
{/if}
|
|
410
|
+
<!--
|
|
411
|
+
The stage: the open list, or the narrowed block alone with what it holds. A click beside the
|
|
412
|
+
blocks selects the root; the blocks stop their own clicks.
|
|
413
|
+
-->
|
|
414
|
+
<section class="rz-blocks-focus__renders" role="presentation" onclick={focus.selectRoot}>
|
|
415
|
+
{#key focus.path}
|
|
416
|
+
<Renders {form} list={stageList} only={focus.narrowedRow?.index} onRemove={requestRemove} />
|
|
417
|
+
{/key}
|
|
418
|
+
{#if count && !focus.locked}
|
|
419
|
+
<StagePlaceholder />
|
|
420
|
+
{/if}
|
|
421
|
+
</section>
|
|
420
422
|
|
|
421
423
|
{#if narrow}
|
|
422
424
|
<Sheet.Root bind:open={panelOpen}>
|
|
@@ -462,7 +464,7 @@
|
|
|
462
464
|
</Dialog.Root>
|
|
463
465
|
</div>
|
|
464
466
|
|
|
465
|
-
<style>/* A level: its fill, a hairline, its shadow. raised, float. */
|
|
467
|
+
<style>/* A level: its fill, a hairline, and its shadow when it has one. raised has none, float does. */
|
|
466
468
|
|
|
467
469
|
/* A well: an input, a track, a dropzone. Its edge shows on hover. */
|
|
468
470
|
|
|
@@ -562,12 +564,11 @@
|
|
|
562
564
|
* The stage, a canvas with the blocks centred on it as wide as the document's column at most,
|
|
563
565
|
* and the panel on the right.
|
|
564
566
|
*
|
|
565
|
-
* --rz-focus-side: the panel, growing with the room
|
|
566
|
-
* block's fields
|
|
567
|
+
* --rz-focus-side: the panel, growing with the room, where a block's fields want some
|
|
567
568
|
* --rz-document-width: the blocks' column, 60rem
|
|
568
569
|
*/
|
|
569
570
|
.rz-blocks-focus__body {
|
|
570
|
-
--rz-focus-side: clamp(
|
|
571
|
+
--rz-focus-side: clamp(26rem, 32cqi, 40rem);
|
|
571
572
|
position: relative;
|
|
572
573
|
display: grid;
|
|
573
574
|
grid-template-columns: minmax(0, 1fr) var(--rz-focus-side);
|
|
@@ -575,8 +576,7 @@
|
|
|
575
576
|
}
|
|
576
577
|
|
|
577
578
|
.rz-blocks-focus__renders > :global(.rz-renders),
|
|
578
|
-
.rz-blocks-focus__renders > :global(.rz-stage-placeholder)
|
|
579
|
-
.rz-blocks-focus__stage > :global(.rz-stage) {
|
|
579
|
+
.rz-blocks-focus__renders > :global(.rz-stage-placeholder) {
|
|
580
580
|
max-width: var(--rz-document-width, 60rem);
|
|
581
581
|
margin-inline: auto;
|
|
582
582
|
}
|
|
@@ -587,13 +587,7 @@
|
|
|
587
587
|
margin-top: var(--rz-size-3);
|
|
588
588
|
}
|
|
589
589
|
|
|
590
|
-
/* With renders the panel holds a block's fields, which want room. */
|
|
591
|
-
.rz-blocks-focus[data-layout='renders'] .rz-blocks-focus__body {
|
|
592
|
-
--rz-focus-side: clamp(24rem, 30cqi, 36rem);
|
|
593
|
-
}
|
|
594
|
-
|
|
595
590
|
.rz-blocks-focus__panel,
|
|
596
|
-
.rz-blocks-focus__stage,
|
|
597
591
|
.rz-blocks-focus__renders {
|
|
598
592
|
min-width: 0;
|
|
599
593
|
min-height: 0;
|
|
@@ -605,7 +599,6 @@
|
|
|
605
599
|
border-left: 1px solid var(--rz-border);
|
|
606
600
|
}
|
|
607
601
|
|
|
608
|
-
.rz-blocks-focus__stage,
|
|
609
602
|
.rz-blocks-focus__renders {
|
|
610
603
|
background-color: var(--rz-bg-well);
|
|
611
604
|
}
|
|
@@ -618,10 +611,6 @@
|
|
|
618
611
|
padding: var(--rz-size-14) var(--rz-size-8) var(--rz-size-32);
|
|
619
612
|
}
|
|
620
613
|
|
|
621
|
-
.rz-blocks-focus__stage {
|
|
622
|
-
padding-bottom: var(--rz-size-16);
|
|
623
|
-
}
|
|
624
|
-
|
|
625
614
|
/* The tabs on the panel's top edge, the content scrolling under them; in a column or a sheet. */
|
|
626
615
|
/* In a column or in a sheet, which sits outside the overlay: the padding its fields read. */
|
|
627
616
|
:global(.rz-blocks-focus__panel-tabs.rz-tabs[data-tabs-root]) {
|
|
@@ -672,8 +661,7 @@
|
|
|
672
661
|
|
|
673
662
|
/* Narrow: the stage alone, the panel in a sheet from the right, behind the header's button. */
|
|
674
663
|
@container rz-focus (max-width: 52rem) {
|
|
675
|
-
.rz-blocks-focus__body
|
|
676
|
-
.rz-blocks-focus[data-layout='renders'] .rz-blocks-focus__body {
|
|
664
|
+
.rz-blocks-focus__body {
|
|
677
665
|
grid-template-columns: minmax(0, 1fr);
|
|
678
666
|
}
|
|
679
667
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { t__ } from '../../../../core/i18n/index.js';
|
|
3
|
+
import { capitalize } from '../../../../util/string.js';
|
|
4
|
+
import { ToyBrick } from '@lucide/svelte';
|
|
5
|
+
import type { Snippet } from 'svelte';
|
|
6
|
+
import type { LayerRow } from './focus.svelte.js';
|
|
7
|
+
|
|
8
|
+
type Props = { row: LayerRow; error?: unknown; children?: Snippet<[name?: string]> };
|
|
9
|
+
const { row, error, children }: Props = $props();
|
|
10
|
+
|
|
11
|
+
const Icon = $derived(row.config?.icon ?? ToyBrick);
|
|
12
|
+
const label = $derived(row.config?.label || capitalize(row.block.type));
|
|
13
|
+
|
|
14
|
+
$effect(() => {
|
|
15
|
+
if (error) console.error(`Render of block ${row.path} failed`, error);
|
|
16
|
+
});
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<!--
|
|
20
|
+
A block without a render, or one whose render threw: a row with its icon, its title and its
|
|
21
|
+
type, then its lists of blocks under it. Its fields are in the inspector.
|
|
22
|
+
-->
|
|
23
|
+
<div class="rz-default-render" data-error={error ? '' : undefined}>
|
|
24
|
+
<p class="rz-default-render__row">
|
|
25
|
+
<span class="rz-default-render__icon"><Icon size={14} /></span>
|
|
26
|
+
<span class="rz-default-render__title">{row.title}</span>
|
|
27
|
+
{#if row.title !== label}
|
|
28
|
+
<span class="rz-default-render__type">{label}</span>
|
|
29
|
+
{/if}
|
|
30
|
+
{#if error}
|
|
31
|
+
<span class="rz-default-render__error">{t__('fields.render_failed')}</span>
|
|
32
|
+
{/if}
|
|
33
|
+
</p>
|
|
34
|
+
{#if row.children.length}
|
|
35
|
+
<div class="rz-default-render__children">{@render children?.()}</div>
|
|
36
|
+
{/if}
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<style>/* A level: its fill, a hairline, and its shadow when it has one. raised has none, float does. */
|
|
40
|
+
|
|
41
|
+
/* A well: an input, a track, a dropzone. Its edge shows on hover. */
|
|
42
|
+
|
|
43
|
+
/* The hover tint, laid over the element's own fill. */
|
|
44
|
+
|
|
45
|
+
/* The picked item of a segmented control. */
|
|
46
|
+
|
|
47
|
+
/* The primary button's face: black on light, white on dark. */
|
|
48
|
+
|
|
49
|
+
/* Keyboard focus on a button, a tab, a link. */
|
|
50
|
+
|
|
51
|
+
/* A focused input: an accent edge and a soft halo. */
|
|
52
|
+
|
|
53
|
+
/* An input with an error. */
|
|
54
|
+
.rz-default-render {
|
|
55
|
+
background-color: var(--rz-bg-raised);
|
|
56
|
+
box-shadow:
|
|
57
|
+
0 0 0 1px var(--rz-border),
|
|
58
|
+
var(--rz-shadow-raised, 0 0 transparent);
|
|
59
|
+
border-radius: var(--rz-radius-md);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.rz-default-render__row {
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
gap: var(--rz-size-2);
|
|
66
|
+
min-width: 0;
|
|
67
|
+
height: calc(11 * var(--rz-unit));
|
|
68
|
+
padding-inline: var(--rz-size-3);
|
|
69
|
+
font-size: var(--rz-text-sm);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.rz-default-render__icon {
|
|
73
|
+
display: grid;
|
|
74
|
+
place-items: center;
|
|
75
|
+
width: var(--rz-size-6);
|
|
76
|
+
height: var(--rz-size-6);
|
|
77
|
+
flex-shrink: 0;
|
|
78
|
+
border-radius: var(--rz-radius-sm);
|
|
79
|
+
background-color: var(--rz-bg-well);
|
|
80
|
+
color: var(--rz-fg-muted);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.rz-default-render__title {
|
|
84
|
+
font-variation-settings: 'wght' 500;
|
|
85
|
+
font-weight: 500;
|
|
86
|
+
min-width: 0;
|
|
87
|
+
overflow: hidden;
|
|
88
|
+
text-overflow: ellipsis;
|
|
89
|
+
white-space: nowrap;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.rz-default-render__type {
|
|
93
|
+
flex-shrink: 0;
|
|
94
|
+
font-size: var(--rz-text-xs);
|
|
95
|
+
color: var(--rz-fg-subtle);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.rz-default-render__error {
|
|
99
|
+
color: var(--rz-danger);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* The block's lists, indented under its row. */
|
|
103
|
+
.rz-default-render__children {
|
|
104
|
+
display: grid;
|
|
105
|
+
gap: var(--rz-size-3);
|
|
106
|
+
padding: 0 var(--rz-size-3) var(--rz-size-3) var(--rz-size-10);
|
|
107
|
+
}
|
|
108
|
+
</style>
|
|
@@ -5,6 +5,6 @@ type Props = {
|
|
|
5
5
|
error?: unknown;
|
|
6
6
|
children?: Snippet<[name?: string]>;
|
|
7
7
|
};
|
|
8
|
-
declare const
|
|
9
|
-
type
|
|
10
|
-
export default
|
|
8
|
+
declare const DefaultRender: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type DefaultRender = ReturnType<typeof DefaultRender>;
|
|
10
|
+
export default DefaultRender;
|