rimecms 0.26.8 → 0.27.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/fields/group/component/Group.svelte +1 -0
- package/dist/fields/group/index.d.ts +12 -8
- package/dist/fields/group/index.js +4 -0
- package/dist/fields/link/component/RessourceInput.svelte +2 -2
- package/dist/fields/relation/component/Cell.svelte +2 -2
- package/dist/fields/relation/component/Relation.svelte +2 -2
- package/dist/fields/relation/component/upload/Browse.svelte +2 -2
- package/dist/fields/rich-text/client.d.ts +9 -2
- package/dist/fields/rich-text/core/config-builders.js +5 -2
- package/dist/fields/rich-text/core/features/fields/extension.d.ts +10 -3
- package/dist/fields/rich-text/core/features/fields/extension.js +1 -6
- package/dist/fields/rich-text/core/features/fields/fields.css +4 -0
- package/dist/fields/rich-text/core/features/fields/fields.svelte +13 -6
- package/dist/fields/rich-text/core/features/fields/fields.svelte.d.ts +4 -1
- package/dist/fields/rich-text/core/features/fields/index.d.ts +6 -4
- package/dist/fields/rich-text/core/features/fields/index.js +1 -2
- package/dist/fields/rich-text/core/features/link/component/link-selector.svelte +2 -6
- package/dist/fields/rich-text/core/features/resource/index.d.ts +2 -5
- package/dist/fields/rich-text/core/features/resource/index.js +0 -1
- package/dist/fields/rich-text/core/features/resource/resource-extension.d.ts +7 -2
- package/dist/fields/rich-text/core/features/resource/resource-extension.js +1 -7
- package/dist/fields/rich-text/core/features/resource/resource.svelte +2 -2
- package/dist/fields/rich-text/core/features/upload/index.js +1 -2
- package/dist/fields/rich-text/core/features/upload/upload-extension.d.ts +14 -1
- package/dist/fields/rich-text/core/features/upload/upload-extension.js +2 -10
- package/dist/fields/rich-text/core/features/upload/upload.svelte +2 -2
- package/dist/fields/rich-text/core/svelte/node-view-renderer.svelte.js +10 -5
- package/dist/fields/rich-text/core/svelte/node-view-wrapper.svelte +1 -0
- package/dist/fields/rich-text/core/svelte/renderer.d.ts +1 -1
- package/dist/fields/types.d.ts +10 -0
- package/dist/panel/components/Root.svelte +2 -2
- package/dist/panel/components/fields/FieldsPreview.svelte +34 -27
- package/dist/panel/components/fields/FieldsPreview.svelte.d.ts +5 -6
- package/dist/panel/components/sections/collection/folder/FolderEdit.svelte +0 -2
- package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte +2 -2
- package/dist/panel/components/sections/collection/grid/create-directory-dialog/CreateDirectoryDialog.svelte +0 -2
- package/dist/panel/components/sections/document/Header.svelte +1 -0
- package/dist/panel/components/sections/document/Settings.svelte +3 -2
- package/dist/panel/components/sections/document/Settings.svelte.d.ts +2 -1
- package/dist/panel/components/sections/live/SidePanel.svelte +5 -7
- package/dist/panel/context/api-proxy.svelte.d.ts +0 -1
- package/dist/panel/context/api-proxy.svelte.js +0 -2
- package/dist/panel/context/documentForm.svelte.d.ts +2 -2
- package/dist/panel/context/documentForm.svelte.js +2 -2
- package/dist/panel/context/form.svelte.js +0 -1
- package/dist/panel/context/locale.svelte.d.ts +1 -0
- package/dist/panel/context/locale.svelte.js +3 -3
- package/dist/panel/pages/area/Area.svelte +1 -4
- package/dist/panel/pages/area/AreaVersionsDoc.svelte +0 -3
- package/dist/panel/pages/collection-document/CollectionDocVersions.svelte +0 -5
- package/dist/panel/pages/collection-document/CollectionDocument.svelte +0 -3
- package/dist/panel/pages/live/Live.svelte +3 -8
- package/package.json +233 -233
|
@@ -1,42 +1,49 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { FormFieldBuilder } from '../../../core/fields/builders';
|
|
3
|
-
import type { FormField } from '../../../fields/types.js';
|
|
3
|
+
import type { BaseUseFieldReturn, FieldsPreviewProps, FormField } from '../../../fields/types.js';
|
|
4
4
|
import { capitalize } from '../../../util/string.js';
|
|
5
|
+
import type { Component } from 'svelte';
|
|
5
6
|
|
|
6
7
|
type Props = {
|
|
7
8
|
fields: FormFieldBuilder<FormField>[];
|
|
8
|
-
getField: (field: FormFieldBuilder<FormField>) =>
|
|
9
|
+
getField: (field: FormFieldBuilder<FormField>) => BaseUseFieldReturn;
|
|
10
|
+
preview?: Component<FieldsPreviewProps>;
|
|
9
11
|
};
|
|
10
12
|
|
|
11
|
-
const { fields, getField }: Props = $props();
|
|
12
|
-
|
|
13
|
-
//
|
|
13
|
+
const { fields, getField, preview }: Props = $props();
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
16
|
<div class="rz-render-fields-preview">
|
|
17
|
-
{#
|
|
18
|
-
{@const
|
|
19
|
-
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<div class="rz-render-fields-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
17
|
+
{#if preview}
|
|
18
|
+
{@const Preview = preview}
|
|
19
|
+
<div class="rz-render-fields-preview__custom" data-visible>
|
|
20
|
+
<Preview fields={Object.fromEntries(fields.map((field) => [field.name, getField(field)]))} />
|
|
21
|
+
</div>
|
|
22
|
+
{:else}
|
|
23
|
+
{#each fields as builder, index (index)}
|
|
24
|
+
{@const field = getField(builder)}
|
|
25
|
+
{#if !builder.raw.hidden && field.visible}
|
|
26
|
+
<div class="rz-render-fields-preview__row" data-visible={field.visible || null}>
|
|
27
|
+
<div class="rz-render-fields-preview__name">
|
|
28
|
+
<p>
|
|
29
|
+
{builder.raw.label || capitalize(builder.name)}
|
|
30
|
+
</p>
|
|
31
|
+
</div>
|
|
32
|
+
<div class="rz-render-fields-preview__value">
|
|
33
|
+
{#if builder.raw.table?.cell}
|
|
34
|
+
{@const ColumnTableCell = builder.raw.table.cell}
|
|
35
|
+
<span><ColumnTableCell value={field.value} /></span>
|
|
36
|
+
{:else if builder.cell}
|
|
37
|
+
{@const Cell = builder.cell}
|
|
38
|
+
<span><Cell value={field.value} /></span>
|
|
39
|
+
{:else}
|
|
40
|
+
<span>{field.value}</span>
|
|
41
|
+
{/if}
|
|
42
|
+
</div>
|
|
36
43
|
</div>
|
|
37
|
-
|
|
38
|
-
{/
|
|
39
|
-
{/
|
|
44
|
+
{/if}
|
|
45
|
+
{/each}
|
|
46
|
+
{/if}
|
|
40
47
|
</div>
|
|
41
48
|
|
|
42
49
|
<style>
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { FormFieldBuilder } from '../../../core/fields/builders';
|
|
2
|
-
import type { FormField } from '../../../fields/types.js';
|
|
2
|
+
import type { BaseUseFieldReturn, FieldsPreviewProps, FormField } from '../../../fields/types.js';
|
|
3
|
+
import type { Component } from 'svelte';
|
|
3
4
|
type Props = {
|
|
4
5
|
fields: FormFieldBuilder<FormField>[];
|
|
5
|
-
getField: (field: FormFieldBuilder<FormField>) =>
|
|
6
|
-
|
|
7
|
-
value: any | null;
|
|
8
|
-
};
|
|
6
|
+
getField: (field: FormFieldBuilder<FormField>) => BaseUseFieldReturn;
|
|
7
|
+
preview?: Component<FieldsPreviewProps>;
|
|
9
8
|
};
|
|
10
|
-
declare const FieldsPreview:
|
|
9
|
+
declare const FieldsPreview: Component<Props, {}, "">;
|
|
11
10
|
type FieldsPreview = ReturnType<typeof FieldsPreview>;
|
|
12
11
|
export default FieldsPreview;
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
import RenderFields from '../../../fields/RenderFields.svelte';
|
|
7
7
|
import Button from '../../../ui/button/button.svelte';
|
|
8
8
|
import * as Dialog from '../../../ui/dialog/index.js';
|
|
9
|
-
import { API_PROXY, setAPIProxyContext } from '../../../../context/api-proxy.svelte.js';
|
|
10
9
|
import { getConfigContext } from '../../../../context/config.svelte.js';
|
|
11
10
|
import { setDocumentFormContext } from '../../../../context/documentForm.svelte.js';
|
|
12
11
|
import { getUserContext } from '../../../../context/user.svelte.js';
|
|
@@ -18,7 +17,6 @@
|
|
|
18
17
|
};
|
|
19
18
|
let { folder, collection, open = $bindable() }: Props = $props();
|
|
20
19
|
|
|
21
|
-
setAPIProxyContext(API_PROXY.DOCUMENT);
|
|
22
20
|
let formElement = $state<HTMLFormElement>();
|
|
23
21
|
const user = getUserContext();
|
|
24
22
|
const configCtx = getConfigContext();
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import ContextMenu from '../../../ui/context-menu/ContextMenu.svelte';
|
|
11
11
|
import ContextMenuItem from '../../../ui/context-menu/ContextMenuItem.svelte';
|
|
12
12
|
import * as Dialog from '../../../ui/dialog/index.js';
|
|
13
|
-
import {
|
|
13
|
+
import { getAPIProxyContext } from '../../../../context/api-proxy.svelte.js';
|
|
14
14
|
import { panelUrl } from '../../../../util/url.js';
|
|
15
15
|
import { trycatchFetch } from '../../../../../util/function.js';
|
|
16
16
|
import { Pencil, Trash2 } from '@lucide/svelte';
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
let rootElement = $state<HTMLButtonElement>();
|
|
43
43
|
let isDragging = $state(false);
|
|
44
44
|
const isFolderUpperPath = $derived(folder.name === '...');
|
|
45
|
-
const APIProxy = getAPIProxyContext(
|
|
45
|
+
const APIProxy = getAPIProxyContext();
|
|
46
46
|
const childFilesURL = $derived(
|
|
47
47
|
`${apiUrl(collection.kebab)}?where[_path][equals]=${folder.id}&select=id`
|
|
48
48
|
);
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import RenderFields from '../../../../fields/RenderFields.svelte';
|
|
6
6
|
import Button from '../../../../ui/button/button.svelte';
|
|
7
7
|
import * as Dialog from '../../../../ui/dialog/index.js';
|
|
8
|
-
import { API_PROXY, setAPIProxyContext } from '../../../../../context/api-proxy.svelte.js';
|
|
9
8
|
import type { CollectionContext } from '../../../../../context/collection.svelte.js';
|
|
10
9
|
import { getConfigContext } from '../../../../../context/config.svelte.js';
|
|
11
10
|
import {
|
|
@@ -16,7 +15,6 @@
|
|
|
16
15
|
type Props = { collection: CollectionContext; open: boolean };
|
|
17
16
|
let { collection, open = $bindable() }: Props = $props();
|
|
18
17
|
|
|
19
|
-
setAPIProxyContext(API_PROXY.DOCUMENT);
|
|
20
18
|
let formElement = $state<HTMLFormElement>();
|
|
21
19
|
const configCtx = getConfigContext();
|
|
22
20
|
// svelte-ignore state_referenced_locally
|
|
@@ -8,13 +8,14 @@
|
|
|
8
8
|
import type { DocumentFormContext } from '../../../context/documentForm.svelte.js';
|
|
9
9
|
import { getLocaleContext } from '../../../context/locale.svelte.js';
|
|
10
10
|
import { panelUrl } from '../../../util/url.js';
|
|
11
|
+
import type { GenericDoc } from '../../../../types.js';
|
|
11
12
|
import { trycatchFetch } from '../../../../util/function.js';
|
|
12
13
|
import { Copy, History, Import, Pickaxe, Settings, Trash2 } from '@lucide/svelte';
|
|
13
14
|
import { toast } from 'svelte-sonner';
|
|
14
15
|
import { t__ } from '../../../../core/i18n/index.js';
|
|
15
16
|
import Button from '../../ui/button/button.svelte';
|
|
16
17
|
|
|
17
|
-
type Props = { form: DocumentFormContext };
|
|
18
|
+
type Props = { form: DocumentFormContext<GenericDoc> };
|
|
18
19
|
|
|
19
20
|
const { form }: Props = $props();
|
|
20
21
|
|
|
@@ -84,7 +85,7 @@
|
|
|
84
85
|
}
|
|
85
86
|
const { id } = await success.json();
|
|
86
87
|
toast.success(t__('common.duplicate_success'));
|
|
87
|
-
await goto(panelUrl(form.config.kebab,
|
|
88
|
+
await goto(panelUrl(form.config.kebab, id));
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
const shouldShowSettings = $derived.by(() => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { DocumentFormContext } from '../../../context/documentForm.svelte.js';
|
|
2
|
+
import type { GenericDoc } from '../../../../types.js';
|
|
2
3
|
import { Settings } from '@lucide/svelte';
|
|
3
4
|
type Props = {
|
|
4
|
-
form: DocumentFormContext
|
|
5
|
+
form: DocumentFormContext<GenericDoc>;
|
|
5
6
|
};
|
|
6
7
|
declare const Settings: import("svelte").Component<Props, {}, "">;
|
|
7
8
|
type Settings = ReturnType<typeof Settings>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import type { User } from '../../../../core/collections/auth/types.js';
|
|
4
4
|
import type { BuiltConfigClient } from '../../../../core/config/types.js';
|
|
5
5
|
import { Toaster } from '../../ui/sonner';
|
|
6
|
-
import {
|
|
6
|
+
import { setAPIProxyContext } from '../../../context/api-proxy.svelte.js';
|
|
7
7
|
import { setConfigContext } from '../../../context/config.svelte.js';
|
|
8
8
|
import createContext from '../../../context/createContext.svelte.js';
|
|
9
9
|
import { setLocaleContext } from '../../../context/locale.svelte.js';
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
user: User;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
const { doc, config, locale:
|
|
25
|
+
const { doc, config, locale: initialLocale, user, onDataChange, onFieldFocus }: Props = $props();
|
|
26
26
|
|
|
27
27
|
function buildPanelURL() {
|
|
28
28
|
// Start with the base URI for the panel
|
|
@@ -35,16 +35,14 @@
|
|
|
35
35
|
return panelUri;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
setAPIProxyContext(
|
|
38
|
+
setAPIProxyContext();
|
|
39
39
|
// svelte-ignore state_referenced_locally
|
|
40
40
|
setConfigContext(config);
|
|
41
41
|
// svelte-ignore state_referenced_locally
|
|
42
42
|
setUserContext(user);
|
|
43
|
+
// svelte-ignore state_referenced_locally
|
|
44
|
+
setLocaleContext(initialLocale);
|
|
43
45
|
createContext('title', '[untitled]');
|
|
44
|
-
|
|
45
|
-
$effect(() => {
|
|
46
|
-
setLocaleContext(initialeLocale);
|
|
47
|
-
});
|
|
48
46
|
</script>
|
|
49
47
|
|
|
50
48
|
<Toaster />
|
|
@@ -78,8 +78,6 @@ export function setAPIProxyContext(key = API_PROXY.ROOT) {
|
|
|
78
78
|
export function getAPIProxyContext(key = API_PROXY.ROOT) {
|
|
79
79
|
return getContext(key);
|
|
80
80
|
}
|
|
81
|
-
// @TODO why multiple APIProxy... ROOT everywhere should work
|
|
82
81
|
export const API_PROXY = {
|
|
83
|
-
DOCUMENT: Symbol('api-proxy.document'),
|
|
84
82
|
ROOT: Symbol('api-proxy.root')
|
|
85
83
|
};
|
|
@@ -71,7 +71,7 @@ export declare function setDocumentFormContext<T extends WithOptional<GenericDoc
|
|
|
71
71
|
readonly isLive: boolean;
|
|
72
72
|
setFocusedField(path: string): void;
|
|
73
73
|
};
|
|
74
|
-
export declare function getDocumentFormContext<T extends WithOptional<GenericDoc, 'id'> = GenericDoc
|
|
74
|
+
export declare function getDocumentFormContext<T extends WithOptional<GenericDoc, 'id'> = WithOptional<GenericDoc, 'id'>>(key?: string): {
|
|
75
75
|
key: string;
|
|
76
76
|
setValue: (path: string, value: any) => void;
|
|
77
77
|
getRawValue: <T_1>(path: string) => NonNullable<T_1> | null;
|
|
@@ -140,7 +140,7 @@ export declare function getDocumentFormContext<T extends WithOptional<GenericDoc
|
|
|
140
140
|
readonly isLive: boolean;
|
|
141
141
|
setFocusedField(path: string): void;
|
|
142
142
|
};
|
|
143
|
-
export type DocumentFormContext<T extends WithOptional<GenericDoc, 'id'> = GenericDoc
|
|
143
|
+
export type DocumentFormContext<T extends WithOptional<GenericDoc, 'id'> = WithOptional<GenericDoc, 'id'>> = ReturnType<typeof setDocumentFormContext<T>>;
|
|
144
144
|
type AddBlock = (block: Omit<GenericBlock, 'id' | 'path'>) => void;
|
|
145
145
|
type MoveBlock = (from: number, to: number) => void;
|
|
146
146
|
export type FormSuccessData = {
|
|
@@ -18,7 +18,7 @@ import { t__ } from '../../core/i18n/index.js';
|
|
|
18
18
|
import { moveItem } from '../../util/array.js';
|
|
19
19
|
import { getValueAtPath, setValueAtPath } from '../../util/object.js';
|
|
20
20
|
import { snapshot } from '../../util/state.js';
|
|
21
|
-
import {
|
|
21
|
+
import { getAPIProxyContext } from './api-proxy.svelte.js';
|
|
22
22
|
import { getCollectionContext } from './collection.svelte.js';
|
|
23
23
|
import { setErrorsContext } from './errors.svelte.js';
|
|
24
24
|
import { getLocaleContext } from './locale.svelte.js';
|
|
@@ -45,7 +45,7 @@ function createDocumentFormState({ initial, config, readOnly, key, onNestedDocum
|
|
|
45
45
|
const titleContext = getContext('title');
|
|
46
46
|
const initialTitle = initTitle();
|
|
47
47
|
let title = $state(initialTitle);
|
|
48
|
-
const apiProxy = getAPIProxyContext(
|
|
48
|
+
const apiProxy = getAPIProxyContext();
|
|
49
49
|
function initLevel() {
|
|
50
50
|
const last = key.split('_').pop();
|
|
51
51
|
const isDigit = /[\d]+/.test(last);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getContext, setContext } from 'svelte';
|
|
2
2
|
import { getConfigContext } from './config.svelte.js';
|
|
3
|
-
const
|
|
3
|
+
export const LOCALE_CTX = Symbol('rime.locale');
|
|
4
4
|
function createStore(initial) {
|
|
5
5
|
let code = $state();
|
|
6
6
|
let label = $state();
|
|
@@ -56,8 +56,8 @@ function createStore(initial) {
|
|
|
56
56
|
}
|
|
57
57
|
export function setLocaleContext(initial) {
|
|
58
58
|
const store = createStore(initial);
|
|
59
|
-
return setContext(
|
|
59
|
+
return setContext(LOCALE_CTX, store);
|
|
60
60
|
}
|
|
61
61
|
export function getLocaleContext() {
|
|
62
|
-
return getContext(
|
|
62
|
+
return getContext(LOCALE_CTX);
|
|
63
63
|
}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import Document from '../../components/sections/document/Document.svelte';
|
|
3
|
-
import Unauthorized from '../../components/sections/unauthorized/Unauthorized.svelte';
|
|
4
|
-
import { API_PROXY, setAPIProxyContext } from '../../context/api-proxy.svelte.js';
|
|
5
3
|
import Page from '../../components/sections/page-layout/Page.svelte';
|
|
4
|
+
import Unauthorized from '../../components/sections/unauthorized/Unauthorized.svelte';
|
|
6
5
|
import type { AreaDocData } from '../../index.js';
|
|
7
6
|
|
|
8
7
|
const { data }: { data: AreaDocData<false> } = $props();
|
|
9
|
-
|
|
10
|
-
setAPIProxyContext(API_PROXY.DOCUMENT);
|
|
11
8
|
</script>
|
|
12
9
|
|
|
13
10
|
{#if data.status === 200}
|
|
@@ -3,12 +3,9 @@
|
|
|
3
3
|
import Versions from '../../components/sections/document/Versions.svelte';
|
|
4
4
|
import Page from '../../components/sections/page-layout/Page.svelte';
|
|
5
5
|
import Unauthorized from '../../components/sections/unauthorized/Unauthorized.svelte';
|
|
6
|
-
import { API_PROXY, setAPIProxyContext } from '../../context/api-proxy.svelte.js';
|
|
7
6
|
import type { AreaDocData } from '../../index.js';
|
|
8
7
|
|
|
9
8
|
const { data }: { data: AreaDocData<true> } = $props();
|
|
10
|
-
|
|
11
|
-
setAPIProxyContext(API_PROXY.DOCUMENT);
|
|
12
9
|
</script>
|
|
13
10
|
|
|
14
11
|
{#if data.status === 200}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { VersionsStatus } from '../../../core/constant.js';
|
|
3
|
-
import type { VersionDoc } from '../../../core/types/doc.js';
|
|
4
2
|
import Document from '../../components/sections/document/Document.svelte';
|
|
5
3
|
import Versions from '../../components/sections/document/Versions.svelte';
|
|
6
4
|
import Page from '../../components/sections/page-layout/Page.svelte';
|
|
7
5
|
import Unauthorized from '../../components/sections/unauthorized/Unauthorized.svelte';
|
|
8
|
-
import { API_PROXY, setAPIProxyContext } from '../../context/api-proxy.svelte.js';
|
|
9
6
|
import type { CollectionDocData } from '../../index.js';
|
|
10
7
|
|
|
11
8
|
const { data }: { data: CollectionDocData<true> } = $props();
|
|
12
|
-
|
|
13
|
-
setAPIProxyContext(API_PROXY.DOCUMENT);
|
|
14
9
|
</script>
|
|
15
10
|
|
|
16
11
|
{#if data.status === 200}
|
|
@@ -2,12 +2,9 @@
|
|
|
2
2
|
import Document from '../../components/sections/document/Document.svelte';
|
|
3
3
|
import Page from '../../components/sections/page-layout/Page.svelte';
|
|
4
4
|
import Unauthorized from '../../components/sections/unauthorized/Unauthorized.svelte';
|
|
5
|
-
import { API_PROXY, setAPIProxyContext } from '../../context/api-proxy.svelte.js';
|
|
6
5
|
import type { CollectionDocData } from '../../index.js';
|
|
7
6
|
|
|
8
7
|
const { data }: { data: CollectionDocData<false> } = $props();
|
|
9
|
-
|
|
10
|
-
setAPIProxyContext(API_PROXY.DOCUMENT);
|
|
11
8
|
</script>
|
|
12
9
|
|
|
13
10
|
{#if data.status === 200}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import Button from '../../components/ui/button/button.svelte';
|
|
8
8
|
import { Pane, PaneGroup, PaneResizer } from '../../components/ui/pane/index.js';
|
|
9
9
|
import SpinLoader from '../../components/ui/spin-loader/SpinLoader.svelte';
|
|
10
|
+
import { snapshot } from '../../../util/state';
|
|
10
11
|
import { Laptop, Smartphone } from '@lucide/svelte';
|
|
11
12
|
import { onMount } from 'svelte';
|
|
12
13
|
import { fade } from 'svelte/transition';
|
|
@@ -30,7 +31,8 @@
|
|
|
30
31
|
const onDataChange = (args: Partial<GenericDoc>) => {
|
|
31
32
|
/** Send message to iframe */
|
|
32
33
|
if (iframe?.contentWindow) {
|
|
33
|
-
|
|
34
|
+
// Use snapshot to ensure we're sending a plain object without reactive proxies
|
|
35
|
+
iframe.contentWindow.postMessage(snapshot(args));
|
|
34
36
|
}
|
|
35
37
|
};
|
|
36
38
|
|
|
@@ -89,12 +91,7 @@
|
|
|
89
91
|
}
|
|
90
92
|
});
|
|
91
93
|
|
|
92
|
-
const ZOOMS = [0.5, 0.66, 1] as const;
|
|
93
|
-
|
|
94
|
-
let currentZoom = $state(1);
|
|
95
94
|
let currentDevice = $state<'mobile' | 'desktop'>('mobile');
|
|
96
|
-
|
|
97
|
-
const iframeScale = $derived(ZOOMS[currentZoom]);
|
|
98
95
|
</script>
|
|
99
96
|
|
|
100
97
|
<div class="rz-live-container">
|
|
@@ -169,8 +166,6 @@
|
|
|
169
166
|
|
|
170
167
|
.rz-live-container iframe.mobile {
|
|
171
168
|
width: 320px;
|
|
172
|
-
/*transform: translateX(-50%);
|
|
173
|
-
margin-left: 50%;*/
|
|
174
169
|
aspect-ratio: 2 / 3.3;
|
|
175
170
|
scale: 1.25;
|
|
176
171
|
}
|