rimecms 0.26.9 → 0.27.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 (81) hide show
  1. package/README.md +26 -24
  2. package/dist/core/collections/auth/fields.d.ts +40 -40
  3. package/dist/core/fields/builders/select.js +1 -0
  4. package/dist/core/i18n/en/fields.d.ts +1 -0
  5. package/dist/core/i18n/en/fields.js +2 -1
  6. package/dist/core/i18n/fr/fields.d.ts +1 -0
  7. package/dist/core/i18n/fr/fields.js +2 -1
  8. package/dist/core/operations/hooks/before-read/set-document-thumbnail.server.js +2 -2
  9. package/dist/core/operations/hooks/before-read/sort-document-props.server.js +3 -1
  10. package/dist/fields/group/component/Group.svelte +1 -0
  11. package/dist/fields/group/index.d.ts +12 -8
  12. package/dist/fields/group/index.js +4 -0
  13. package/dist/fields/link/component/RessourceInput.svelte +2 -2
  14. package/dist/fields/relation/component/Cell.svelte +2 -2
  15. package/dist/fields/relation/component/Relation.svelte +18 -11
  16. package/dist/fields/relation/component/Relation.svelte.d.ts +2 -1
  17. package/dist/fields/relation/component/upload/Browse.svelte +2 -2
  18. package/dist/fields/relation/index.d.ts +1 -1
  19. package/dist/fields/rich-text/client.d.ts +9 -9
  20. package/dist/fields/rich-text/client.js +1 -1
  21. package/dist/fields/rich-text/component/RichText.svelte +1 -1
  22. package/dist/fields/rich-text/core/{config-builders.js → build-editor-config.js} +9 -2
  23. package/dist/fields/rich-text/core/features/fields/extension.d.ts +10 -3
  24. package/dist/fields/rich-text/core/features/fields/extension.js +3 -8
  25. package/dist/fields/rich-text/core/features/fields/fields.css +4 -0
  26. package/dist/fields/rich-text/core/features/fields/fields.svelte +13 -6
  27. package/dist/fields/rich-text/core/features/fields/fields.svelte.d.ts +4 -1
  28. package/dist/fields/rich-text/core/features/fields/index.d.ts +7 -5
  29. package/dist/fields/rich-text/core/features/fields/index.js +4 -3
  30. package/dist/fields/rich-text/core/features/link/component/link-selector.svelte +9 -13
  31. package/dist/fields/rich-text/core/features/link/index.d.ts +1 -4
  32. package/dist/fields/rich-text/core/features/resource/index.d.ts +2 -5
  33. package/dist/fields/rich-text/core/features/resource/index.js +17 -12
  34. package/dist/fields/rich-text/core/features/resource/resource-extension.d.ts +7 -2
  35. package/dist/fields/rich-text/core/features/resource/resource-extension.js +6 -10
  36. package/dist/fields/rich-text/core/features/resource/resource.svelte +19 -21
  37. package/dist/fields/rich-text/core/features/upload/index.d.ts +2 -5
  38. package/dist/fields/rich-text/core/features/upload/index.js +15 -12
  39. package/dist/fields/rich-text/core/features/upload/upload-extension.d.ts +13 -1
  40. package/dist/fields/rich-text/core/features/upload/upload-extension.js +6 -11
  41. package/dist/fields/rich-text/core/features/upload/upload.svelte +15 -10
  42. package/dist/fields/rich-text/core/svelte/node-view-renderer.svelte.js +10 -5
  43. package/dist/fields/rich-text/core/svelte/node-view-wrapper.svelte +1 -0
  44. package/dist/fields/rich-text/core/svelte/renderer.d.ts +1 -1
  45. package/dist/fields/types.d.ts +13 -0
  46. package/dist/panel/components/Root.svelte +4 -4
  47. package/dist/panel/components/fields/FieldsPreview.svelte +34 -27
  48. package/dist/panel/components/fields/FieldsPreview.svelte.d.ts +5 -6
  49. package/dist/panel/components/fields/FieldsPreviewTrigger.svelte +1 -1
  50. package/dist/panel/components/fields/index.d.ts +2 -2
  51. package/dist/panel/components/sections/collection/folder/FolderEdit.svelte +0 -2
  52. package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte +2 -2
  53. package/dist/panel/components/sections/collection/grid/create-directory-dialog/CreateDirectoryDialog.svelte +0 -2
  54. package/dist/panel/components/sections/collection/upload-thumb-cell/UploadThumbCell.svelte +3 -2
  55. package/dist/panel/components/sections/document/Header.svelte +1 -0
  56. package/dist/panel/components/sections/document/Settings.svelte +3 -2
  57. package/dist/panel/components/sections/document/Settings.svelte.d.ts +2 -1
  58. package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte +2 -7
  59. package/dist/panel/components/sections/live/SidePanel.svelte +7 -9
  60. package/dist/panel/components/ui/breadcrumb/BreadCrumb.svelte +12 -6
  61. package/dist/panel/components/ui/card-document/card-document.svelte +2 -2
  62. package/dist/panel/components/ui/command/command-dialog.svelte +3 -1
  63. package/dist/panel/components/ui/command/command-dialog.svelte.d.ts +1 -0
  64. package/dist/panel/context/api-proxy.svelte.d.ts +2 -1
  65. package/dist/panel/context/api-proxy.svelte.js +9 -3
  66. package/dist/panel/context/documentForm.svelte.d.ts +2 -2
  67. package/dist/panel/context/documentForm.svelte.js +7 -6
  68. package/dist/panel/context/form.svelte.js +0 -1
  69. package/dist/panel/context/locale.svelte.d.ts +1 -0
  70. package/dist/panel/context/locale.svelte.js +3 -3
  71. package/dist/panel/context/title.d.ts +7 -0
  72. package/dist/panel/context/title.js +9 -0
  73. package/dist/panel/pages/area/Area.svelte +1 -4
  74. package/dist/panel/pages/area/AreaVersionsDoc.svelte +0 -3
  75. package/dist/panel/pages/collection/Collection.svelte +2 -2
  76. package/dist/panel/pages/collection-document/CollectionDocVersions.svelte +0 -5
  77. package/dist/panel/pages/collection-document/CollectionDocument.svelte +0 -3
  78. package/dist/panel/pages/live/Live.svelte +3 -8
  79. package/dist/types.d.ts +1 -1
  80. package/package.json +4 -4
  81. /package/dist/fields/rich-text/core/{config-builders.d.ts → build-editor-config.d.ts} +0 -0
@@ -18,10 +18,11 @@ 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 { API_PROXY, getAPIProxyContext } from './api-proxy.svelte.js';
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';
25
+ import { getTitleContext } from './title.js';
25
26
  import { getUserContext } from './user.svelte.js';
26
27
  function createDocumentFormState({ initial, config, readOnly, key, onNestedDocumentCreated, afterSuccess, onDataChange, beforeSubmit, beforeRedirect, onFieldFocus }) {
27
28
  //
@@ -42,10 +43,10 @@ function createDocumentFormState({ initial, config, readOnly, key, onNestedDocum
42
43
  const nestedLevel = initLevel();
43
44
  const isLiveEdit = !!onDataChange;
44
45
  const locale = getLocaleContext();
45
- const titleContext = getContext('title');
46
+ const titleContext = getTitleContext();
46
47
  const initialTitle = initTitle();
47
48
  let title = $state(initialTitle);
48
- const apiProxy = getAPIProxyContext(API_PROXY.DOCUMENT);
49
+ const apiProxy = getAPIProxyContext();
49
50
  function initLevel() {
50
51
  const last = key.split('_').pop();
51
52
  const isDigit = /[\d]+/.test(last);
@@ -497,6 +498,8 @@ function createDocumentFormState({ initial, config, readOnly, key, onNestedDocum
497
498
  async function handleSuccess(data) {
498
499
  const redirect = data?.redirectUrl || false;
499
500
  const message = data?.message || t__('common.generic_success');
501
+ // Invalidate all queries to ensure data consistency across the app
502
+ apiProxy.invalidate(documentConfig.slug);
500
503
  if (redirect) {
501
504
  if (beforeRedirect) {
502
505
  const shouldRedirect = await beforeRedirect(data);
@@ -509,8 +512,6 @@ function createDocumentFormState({ initial, config, readOnly, key, onNestedDocum
509
512
  // Assign documents returned from the server to the form state
510
513
  doc = (data?.document || doc);
511
514
  initialDoc = doc;
512
- // Invalidate all queries to ensure data consistency across the app
513
- apiProxy.invalidateAll();
514
515
  toast.success(message);
515
516
  // Callbacks
516
517
  if (nestedLevel !== 0) {
@@ -594,7 +595,7 @@ function createDocumentFormState({ initial, config, readOnly, key, onNestedDocum
594
595
  actionSuffix = '?/update';
595
596
  }
596
597
  // Add a redirect parameter if we're in a nested form ex: relation creation
597
- // to prevent reidrect after creation
598
+ // to prevent redirect after creation
598
599
  const redirectParam = nestedLevel > 0 ? `&${PARAMS.REDIRECT}=false` : '';
599
600
  // Combine all parts to form the final action URL
600
601
  return `${panelUri}${actionSuffix}${redirectParam}`;
@@ -30,7 +30,6 @@ function createFormStore(initial, key) {
30
30
  * // value will not update if doc.blocks.0.title update
31
31
  */
32
32
  function getRawValue(path) {
33
- console.log(path);
34
33
  return snapshot(getValueAtPath(path, form)) || null;
35
34
  }
36
35
  function setValue(path, value) {
@@ -1,3 +1,4 @@
1
+ export declare const LOCALE_CTX: unique symbol;
1
2
  export declare function setLocaleContext(initial?: string): {
2
3
  dateFormat: (date: Date | string, args?: {
3
4
  short?: boolean;
@@ -1,6 +1,6 @@
1
1
  import { getContext, setContext } from 'svelte';
2
2
  import { getConfigContext } from './config.svelte.js';
3
- const LOCALE_KEY = Symbol('rime.locale');
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(LOCALE_KEY, store);
59
+ return setContext(LOCALE_CTX, store);
60
60
  }
61
61
  export function getLocaleContext() {
62
- return getContext(LOCALE_KEY);
62
+ return getContext(LOCALE_CTX);
63
63
  }
@@ -0,0 +1,7 @@
1
+ export declare const TITLE_CTX = "rime.document.title";
2
+ export declare function getTitleContext(): {
3
+ value: string;
4
+ };
5
+ export declare function setTitleContext(title: string): {
6
+ value: string;
7
+ };
@@ -0,0 +1,9 @@
1
+ import { getContext } from 'svelte';
2
+ import createContext from './createContext.svelte';
3
+ export const TITLE_CTX = 'rime.document.title';
4
+ export function getTitleContext() {
5
+ return getContext(TITLE_CTX);
6
+ }
7
+ export function setTitleContext(title) {
8
+ return createContext(TITLE_CTX, title);
9
+ }
@@ -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}
@@ -17,8 +17,8 @@
17
17
  import PageHeader from '../../components/ui/page-header/PageHeader.svelte';
18
18
  import { setCollectionContext } from '../../context/collection.svelte.js';
19
19
  import { getConfigContext } from '../../context/config.svelte.js';
20
+ import { getTitleContext } from '../../context/title';
20
21
  import { CopyPlus } from '@lucide/svelte';
21
- import { getContext } from 'svelte';
22
22
 
23
23
  type Props = {
24
24
  slug: string;
@@ -60,7 +60,7 @@
60
60
  collection.docs = data.docs;
61
61
  });
62
62
 
63
- const titleContext = getContext<{ value: string }>('title');
63
+ const titleContext = getTitleContext();
64
64
 
65
65
  $effect(() => {
66
66
  titleContext.value = collection.config.label.plural;
@@ -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
- iframe.contentWindow.postMessage(args);
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
  }
package/dist/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export type { User } from './core/collections/auth/types.js';
2
2
  export type { AdditionalStaffConfig, Area, AreaHooks, BuiltArea, BuiltCollection, BuiltConfig, BuiltConfigClient, Collection, CollectionHooks, Config, CustomPanelRoute, ImageSizesConfig, LocaleConfig, LocalizationConfig, RouteConfig } from './core/config/types.js';
3
3
  export type { AreaSlug, BaseDoc, CollectionSlug, GenericBlock, GenericDoc, Prototype, PrototypeSlug, UploadDoc } from './core/types/doc.js';
4
- export type { Field, FormField, Option, RelationValue } from './fields/types.js';
4
+ export type * from './fields/types.js';
5
5
  export type { CollectionProps, FieldPanelTableConfig, FormErrors, Navigation, Route } from './panel/types.js';
6
6
  export type { DocumentFormContext } from './panel/context/documentForm.svelte.js';
7
7
  export type { JsonFile } from './core/collections/upload/upload.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rimecms",
3
- "version": "0.26.9",
3
+ "version": "0.27.1",
4
4
  "homepage": "https://github.com/bienbiendev/rime",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -161,16 +161,16 @@
161
161
  "globals": "^15.15.0",
162
162
  "postcss": "^8.5.3",
163
163
  "postcss-cli": "^11.0.1",
164
- "postcss-mixins": "^11.0.3",
164
+ "postcss-mixins": "^12.1.2",
165
165
  "prettier": "^3.5.3",
166
166
  "prettier-plugin-svelte": "^3.3.3",
167
167
  "publint": "^0.2.12",
168
168
  "svelte": "^5.55.2",
169
169
  "svelte-check": "^4.4.6",
170
170
  "typescript": "^5.8.3",
171
- "typescript-eslint": "^8.20.0",
171
+ "typescript-eslint": "^8.59.0",
172
172
  "vite": "^8.0.8",
173
- "vitest": "^4.0.5"
173
+ "vitest": "^4.1.4"
174
174
  },
175
175
  "dependencies": {
176
176
  "@babel/generator": "^7.28.3",