rimelight-components 2.1.13 → 2.1.14
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/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/utils/page.d.ts +1 -1
- package/dist/runtime/utils/page.js +14 -8
- package/dist/runtime/utils/page.mjs +14 -8
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { readdirSync } from 'node:fs';
|
|
|
4
4
|
import { basename } from 'node:path';
|
|
5
5
|
|
|
6
6
|
const name = "rimelight-components";
|
|
7
|
-
const version = "2.1.
|
|
7
|
+
const version = "2.1.14";
|
|
8
8
|
const homepage = "https://rimelight.com/tools/rimelight-components";
|
|
9
9
|
|
|
10
10
|
const defaultOptions = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type MaybeRefOrGetter } from "vue";
|
|
2
|
-
import { type
|
|
2
|
+
import { type Localized, type Page, type PageDefinition, type Property } from "../types/index.js";
|
|
3
3
|
export declare const getLocalizedContent: <T = string>(field: Localized<T> | undefined, currentLocale: MaybeRefOrGetter<string>) => T | string;
|
|
4
4
|
type WidenProperty<T> = T extends string ? string : T extends number ? number : T extends never[] ? Localized[] : T extends object ? {
|
|
5
5
|
[K in keyof T]: WidenProperty<T[K]>;
|
|
@@ -12,14 +12,17 @@ export function syncPageWithDefinition(page, definition) {
|
|
|
12
12
|
let hasChanged = false;
|
|
13
13
|
const updatedProperties = {};
|
|
14
14
|
const definitionGroups = definition.properties;
|
|
15
|
+
const existingProperties = page.properties || {};
|
|
15
16
|
for (const [groupId, definitionGroup] of Object.entries(definitionGroups)) {
|
|
16
|
-
const existingGroup =
|
|
17
|
+
const existingGroup = existingProperties[groupId];
|
|
17
18
|
const updatedGroupFields = {};
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
const definitionFields = definitionGroup.fields || {};
|
|
20
|
+
for (const [fieldId, definitionField] of Object.entries(definitionFields)) {
|
|
21
|
+
const existingField = existingGroup?.fields ? existingGroup.fields[fieldId] : void 0;
|
|
22
|
+
if (existingField !== void 0) {
|
|
20
23
|
updatedGroupFields[fieldId] = {
|
|
21
24
|
...definitionField,
|
|
22
|
-
value:
|
|
25
|
+
value: existingField.value
|
|
23
26
|
};
|
|
24
27
|
} else {
|
|
25
28
|
updatedGroupFields[fieldId] = { ...definitionField };
|
|
@@ -34,12 +37,15 @@ export function syncPageWithDefinition(page, definition) {
|
|
|
34
37
|
hasChanged = true;
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
|
-
|
|
40
|
+
const existingGroupKeys = Object.keys(existingProperties);
|
|
41
|
+
const updatedGroupKeys = Object.keys(updatedProperties);
|
|
42
|
+
if (existingGroupKeys.length !== updatedGroupKeys.length) {
|
|
38
43
|
hasChanged = true;
|
|
39
44
|
} else {
|
|
40
|
-
for (const groupId
|
|
41
|
-
const
|
|
42
|
-
|
|
45
|
+
for (const groupId of updatedGroupKeys) {
|
|
46
|
+
const existingFields = existingProperties[groupId]?.fields || {};
|
|
47
|
+
const updatedFields = updatedProperties[groupId].fields;
|
|
48
|
+
if (Object.keys(existingFields).length !== Object.keys(updatedFields).length) {
|
|
43
49
|
hasChanged = true;
|
|
44
50
|
break;
|
|
45
51
|
}
|
|
@@ -12,14 +12,17 @@ export function syncPageWithDefinition(page, definition) {
|
|
|
12
12
|
let hasChanged = false;
|
|
13
13
|
const updatedProperties = {};
|
|
14
14
|
const definitionGroups = definition.properties;
|
|
15
|
+
const existingProperties = page.properties || {};
|
|
15
16
|
for (const [groupId, definitionGroup] of Object.entries(definitionGroups)) {
|
|
16
|
-
const existingGroup =
|
|
17
|
+
const existingGroup = existingProperties[groupId];
|
|
17
18
|
const updatedGroupFields = {};
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
const definitionFields = definitionGroup.fields || {};
|
|
20
|
+
for (const [fieldId, definitionField] of Object.entries(definitionFields)) {
|
|
21
|
+
const existingField = existingGroup?.fields ? existingGroup.fields[fieldId] : void 0;
|
|
22
|
+
if (existingField !== void 0) {
|
|
20
23
|
updatedGroupFields[fieldId] = {
|
|
21
24
|
...definitionField,
|
|
22
|
-
value:
|
|
25
|
+
value: existingField.value
|
|
23
26
|
};
|
|
24
27
|
} else {
|
|
25
28
|
updatedGroupFields[fieldId] = { ...definitionField };
|
|
@@ -34,12 +37,15 @@ export function syncPageWithDefinition(page, definition) {
|
|
|
34
37
|
hasChanged = true;
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
|
-
|
|
40
|
+
const existingGroupKeys = Object.keys(existingProperties);
|
|
41
|
+
const updatedGroupKeys = Object.keys(updatedProperties);
|
|
42
|
+
if (existingGroupKeys.length !== updatedGroupKeys.length) {
|
|
38
43
|
hasChanged = true;
|
|
39
44
|
} else {
|
|
40
|
-
for (const groupId
|
|
41
|
-
const
|
|
42
|
-
|
|
45
|
+
for (const groupId of updatedGroupKeys) {
|
|
46
|
+
const existingFields = existingProperties[groupId]?.fields || {};
|
|
47
|
+
const updatedFields = updatedProperties[groupId].fields;
|
|
48
|
+
if (Object.keys(existingFields).length !== Object.keys(updatedFields).length) {
|
|
43
49
|
hasChanged = true;
|
|
44
50
|
break;
|
|
45
51
|
}
|