rimelight-components 2.2.6 → 2.2.8

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rimelight-components",
3
- "version": "2.2.6",
3
+ "version": "2.2.8",
4
4
  "docs": "https://rimelight.com/tools/rimelight-components",
5
5
  "configKey": "rimelightComponents",
6
6
  "compatibility": {
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.2.6";
7
+ const version = "2.2.8";
8
8
  const homepage = "https://rimelight.com/tools/rimelight-components";
9
9
 
10
10
  const defaultOptions = {
@@ -35,7 +35,7 @@ const tooltip = computed(() => config.value.tooltip);
35
35
  </script>
36
36
 
37
37
  <template>
38
- <component :is="to ? 'NuxtLink' : 'div'" :to="to" :target="target">
38
+ <NuxtLink :to="to" :target="target">
39
39
  <UAlert
40
40
  :title="t(title)"
41
41
  :color="variant"
@@ -61,5 +61,5 @@ const tooltip = computed(() => config.value.tooltip);
61
61
  </UTooltip>
62
62
  </template>
63
63
  </UAlert>
64
- </component>
64
+ </NuxtLink>
65
65
  </template>
@@ -15,6 +15,7 @@ const isOpen = computed({
15
15
  v-model:open="isOpen"
16
16
  :title="state.options.title"
17
17
  :description="state.options.description"
18
+ class="z-9999"
18
19
  >
19
20
  <template #body>
20
21
  <div class="flex flex-row justify-between gap-sm">
@@ -3,7 +3,7 @@ import { ref, computed, useTemplateRef, provide } from "vue";
3
3
  import { navigateTo } from "#imports";
4
4
  import {} from "../../types";
5
5
  import { usePageEditor, usePageRegistry, useRC, useHeaderStack, useConfirm } from "../../composables";
6
- import { getLocalizedContent } from "../../utils";
6
+ import { getLocalizedContent, syncPageWithDefinition } from "../../utils";
7
7
  import { useI18n } from "vue-i18n";
8
8
  import { tv } from "../../internal/tv";
9
9
  const {
@@ -85,6 +85,13 @@ const { getTypeLabelKey } = usePageRegistry();
85
85
  const { t, locale } = useI18n();
86
86
  const { undo, redo, canUndo, canRedo, captureSnapshot, resetHistory, pauseHistory, resumeHistory } = usePageEditor(page);
87
87
  const { confirm } = useConfirm();
88
+ const currentDefinition = computed(() => pageDefinitions[page.value.type]);
89
+ watch([() => page.value.id, () => versionId.value, () => page.value.type], () => {
90
+ if (page.value && currentDefinition.value) {
91
+ console.log("[PageEditor] Syncing page with definition", page.value.id, versionId.value);
92
+ syncPageWithDefinition(page.value, currentDefinition.value);
93
+ }
94
+ }, { immediate: true });
88
95
  const handleViewPage = async () => {
89
96
  if (canUndo.value) {
90
97
  const confirmed = await confirm({
@@ -103,6 +110,9 @@ const handleViewPage = async () => {
103
110
  }
104
111
  };
105
112
  const handleSave = () => {
113
+ if (currentDefinition.value) {
114
+ syncPageWithDefinition(page.value, currentDefinition.value);
115
+ }
106
116
  const dataToPersist = JSON.parse(JSON.stringify(page.value));
107
117
  emit("save", dataToPersist);
108
118
  };
@@ -114,6 +124,9 @@ const handlePublish = async () => {
114
124
  cancelLabel: t("common.cancel", "Cancel")
115
125
  });
116
126
  if (confirmed) {
127
+ if (currentDefinition.value) {
128
+ syncPageWithDefinition(page.value, currentDefinition.value);
129
+ }
117
130
  const dataToPersist = JSON.parse(JSON.stringify(page.value));
118
131
  emit("publish", dataToPersist);
119
132
  }
@@ -41,7 +41,7 @@ const {
41
41
  links
42
42
  } = pagePropertiesEditorStyles();
43
43
  const { getTypeLabelKey } = usePageRegistry();
44
- const { isFieldVisible, shouldRenderGroup, getSortedFields, getSortedGroups } = useInfobox(page.value.properties);
44
+ const { isFieldVisible, shouldRenderGroup, getSortedFields, getSortedGroups } = useInfobox(() => page.value.properties);
45
45
  const { locale, t } = useI18n();
46
46
  const imageTabs = computed(() => {
47
47
  if (!page.value.images?.length) return [];
@@ -61,7 +61,7 @@ const {
61
61
  links
62
62
  } = pagePropertiesRendererStyles();
63
63
  const { getTypeLabelKey } = usePageRegistry();
64
- const { isFieldVisible, shouldRenderGroup, getSortedFields, getSortedGroups } = useInfobox(page.value.properties);
64
+ const { isFieldVisible, shouldRenderGroup, getSortedFields, getSortedGroups } = useInfobox(() => page.value.properties);
65
65
  const { t, locale } = useI18n();
66
66
  const { share } = useShare();
67
67
  const { copy } = useClipboard();
@@ -53,9 +53,12 @@ const handleConfirm = () => {
53
53
  }
54
54
  const properties = {};
55
55
  Object.entries(definition.properties).forEach(([groupKey, group]) => {
56
- properties[groupKey] = {};
56
+ properties[groupKey] = {
57
+ ...group,
58
+ fields: {}
59
+ };
57
60
  Object.entries(group.fields).forEach(([fieldKey, field2]) => {
58
- properties[groupKey][fieldKey] = field2.value;
61
+ properties[groupKey].fields[fieldKey] = { ...field2 };
59
62
  });
60
63
  });
61
64
  const newPage = {
@@ -63,7 +66,9 @@ const handleConfirm = () => {
63
66
  title: { en: title.value },
64
67
  slug: slug.value,
65
68
  properties,
66
- blocks: definition.initialBlocks ? definition.initialBlocks() : []
69
+ blocks: definition.initialBlocks ? definition.initialBlocks() : [],
70
+ createdAt: /* @__PURE__ */ new Date(),
71
+ updatedAt: /* @__PURE__ */ new Date()
67
72
  };
68
73
  emit("confirm", newPage);
69
74
  };
@@ -1,8 +1,9 @@
1
+ import { type MaybeRefOrGetter } from "vue";
1
2
  import type { Property, PropertyGroup, BasePageProperties } from "../../types/index.js";
2
- export declare const useInfobox: (properties: BasePageProperties) => {
3
+ export declare const useInfobox: (propertiesRef: MaybeRefOrGetter<BasePageProperties>) => {
3
4
  isFieldVisible: (schema: Property, isReadOnly: boolean) => boolean;
4
5
  shouldRenderGroup: (group: PropertyGroup, isReadOnly: boolean) => boolean;
5
6
  getSortedFields: (fields: Record<string, Property>) => [string, Property<any>][];
6
- getSortedGroups: (props: BasePageProperties) => [string, PropertyGroup][];
7
+ getSortedGroups: (props: MaybeRefOrGetter<BasePageProperties>) => [string, PropertyGroup][];
7
8
  locale: import("vue").WritableComputedRef<string, string>;
8
9
  };
@@ -1,7 +1,9 @@
1
1
  import { useI18n } from "vue-i18n";
2
- export const useInfobox = (properties) => {
2
+ import { toValue } from "vue";
3
+ export const useInfobox = (propertiesRef) => {
3
4
  const { locale } = useI18n();
4
5
  const isFieldVisible = (schema, isReadOnly) => {
6
+ const properties = toValue(propertiesRef);
5
7
  const passesLogic = !schema.visibleIf || schema.visibleIf(properties);
6
8
  if (!passesLogic) return false;
7
9
  if (isReadOnly) {
@@ -19,7 +21,8 @@ export const useInfobox = (properties) => {
19
21
  return Object.entries(fields).sort(([, a], [, b]) => (a.order ?? 0) - (b.order ?? 0));
20
22
  };
21
23
  const getSortedGroups = (props) => {
22
- return Object.entries(props).sort(
24
+ const p = toValue(props);
25
+ return Object.entries(p).sort(
23
26
  ([, a], [, b]) => (a.order ?? 0) - (b.order ?? 0)
24
27
  );
25
28
  };
@@ -1,7 +1,9 @@
1
1
  import { useI18n } from "vue-i18n";
2
- export const useInfobox = (properties) => {
2
+ import { toValue } from "vue";
3
+ export const useInfobox = (propertiesRef) => {
3
4
  const { locale } = useI18n();
4
5
  const isFieldVisible = (schema, isReadOnly) => {
6
+ const properties = toValue(propertiesRef);
5
7
  const passesLogic = !schema.visibleIf || schema.visibleIf(properties);
6
8
  if (!passesLogic) return false;
7
9
  if (isReadOnly) {
@@ -19,7 +21,8 @@ export const useInfobox = (properties) => {
19
21
  return Object.entries(fields).sort(([, a], [, b]) => (a.order ?? 0) - (b.order ?? 0));
20
22
  };
21
23
  const getSortedGroups = (props) => {
22
- return Object.entries(props).sort(
24
+ const p = toValue(props);
25
+ return Object.entries(p).sort(
23
26
  ([, a], [, b]) => (a.order ?? 0) - (b.order ?? 0)
24
27
  );
25
28
  };
@@ -2215,6 +2215,7 @@ export declare const userRelations: import("drizzle-orm").Relations<"user", {
2215
2215
  notes: import("drizzle-orm").Many<"note">;
2216
2216
  noteLabels: import("drizzle-orm").Many<"noteLabel">;
2217
2217
  todos: import("drizzle-orm").Many<"todo">;
2218
+ teamMembers: import("drizzle-orm").Many<"team_member">;
2218
2219
  }>;
2219
2220
  export declare const sessionRelations: import("drizzle-orm").Relations<"session", {
2220
2221
  user: import("drizzle-orm").One<"user", true>;
@@ -144,8 +144,8 @@ export const team = pgTable(
144
144
  );
145
145
  export const teamMember = pgTable("team_member", {
146
146
  id: id.primaryKey(),
147
- teamId: uuid("team_id").notNull(),
148
- userId: uuid("user_id").notNull(),
147
+ teamId: uuid("team_id").notNull().references(() => team.id, { onDelete: "cascade" }),
148
+ userId: uuid("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
149
149
  role: text("role").notNull(),
150
150
  ...timestamps
151
151
  });
@@ -191,7 +191,8 @@ export const userRelations = relations(user, ({ many }) => ({
191
191
  invitations: many(invitation),
192
192
  notes: many(note),
193
193
  noteLabels: many(noteLabel),
194
- todos: many(todo)
194
+ todos: many(todo),
195
+ teamMembers: many(teamMember)
195
196
  }));
196
197
  export const sessionRelations = relations(session, ({ one }) => ({
197
198
  user: one(user, {
@@ -144,8 +144,8 @@ export const team = pgTable(
144
144
  );
145
145
  export const teamMember = pgTable("team_member", {
146
146
  id: id.primaryKey(),
147
- teamId: uuid("team_id").notNull(),
148
- userId: uuid("user_id").notNull(),
147
+ teamId: uuid("team_id").notNull().references(() => team.id, { onDelete: "cascade" }),
148
+ userId: uuid("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
149
149
  role: text("role").notNull(),
150
150
  ...timestamps
151
151
  });
@@ -191,7 +191,8 @@ export const userRelations = relations(user, ({ many }) => ({
191
191
  invitations: many(invitation),
192
192
  notes: many(note),
193
193
  noteLabels: many(noteLabel),
194
- todos: many(todo)
194
+ todos: many(todo),
195
+ teamMembers: many(teamMember)
195
196
  }));
196
197
  export const sessionRelations = relations(session, ({ one }) => ({
197
198
  user: one(user, {
@@ -21,11 +21,11 @@ export function syncPageWithDefinition(page, definition) {
21
21
  const existingField = existingGroup?.fields ? existingGroup.fields[fieldId] : void 0;
22
22
  if (existingField !== void 0) {
23
23
  updatedGroupFields[fieldId] = {
24
- ...definitionField,
24
+ ...JSON.parse(JSON.stringify(definitionField)),
25
25
  value: existingField.value
26
26
  };
27
27
  } else {
28
- updatedGroupFields[fieldId] = { ...definitionField };
28
+ updatedGroupFields[fieldId] = JSON.parse(JSON.stringify(definitionField));
29
29
  hasChanged = true;
30
30
  }
31
31
  }
@@ -69,7 +69,7 @@ export function syncPageWithDefinition(page, definition) {
69
69
  if (existingIndex !== -1) {
70
70
  lastExistingIdealIndex = existingIndex;
71
71
  } else {
72
- filteredCurrent.splice(lastExistingIdealIndex + 1, 0, { ...idealBlock });
72
+ filteredCurrent.splice(lastExistingIdealIndex + 1, 0, JSON.parse(JSON.stringify(idealBlock)));
73
73
  lastExistingIdealIndex++;
74
74
  hasChanged = true;
75
75
  }
@@ -94,6 +94,17 @@ export function convertVersionToPage(version) {
94
94
  blocks: JSON.parse(JSON.stringify(blocks)),
95
95
  // Deep copy to avoid reference issues
96
96
  properties: properties ? JSON.parse(JSON.stringify(properties)) : {},
97
- authorsIds: version.authorsIds || []
97
+ authorsIds: version.authorsIds || [],
98
+ createdAt: version.createdAt ? new Date(version.createdAt) : /* @__PURE__ */ new Date(),
99
+ updatedAt: version.updatedAt ? new Date(version.updatedAt) : /* @__PURE__ */ new Date(),
100
+ postedAt: version.postedAt ? new Date(version.postedAt) : null,
101
+ banner: version.banner,
102
+ icon: version.icon,
103
+ images: version.images || [],
104
+ title: version.title || { en: "" },
105
+ slug: version.slug || "",
106
+ description: version.description || { en: "" },
107
+ tags: version.tags || [],
108
+ links: version.links || []
98
109
  };
99
110
  }
@@ -21,11 +21,11 @@ export function syncPageWithDefinition(page, definition) {
21
21
  const existingField = existingGroup?.fields ? existingGroup.fields[fieldId] : void 0;
22
22
  if (existingField !== void 0) {
23
23
  updatedGroupFields[fieldId] = {
24
- ...definitionField,
24
+ ...JSON.parse(JSON.stringify(definitionField)),
25
25
  value: existingField.value
26
26
  };
27
27
  } else {
28
- updatedGroupFields[fieldId] = { ...definitionField };
28
+ updatedGroupFields[fieldId] = JSON.parse(JSON.stringify(definitionField));
29
29
  hasChanged = true;
30
30
  }
31
31
  }
@@ -69,7 +69,7 @@ export function syncPageWithDefinition(page, definition) {
69
69
  if (existingIndex !== -1) {
70
70
  lastExistingIdealIndex = existingIndex;
71
71
  } else {
72
- filteredCurrent.splice(lastExistingIdealIndex + 1, 0, { ...idealBlock });
72
+ filteredCurrent.splice(lastExistingIdealIndex + 1, 0, JSON.parse(JSON.stringify(idealBlock)));
73
73
  lastExistingIdealIndex++;
74
74
  hasChanged = true;
75
75
  }
@@ -94,6 +94,17 @@ export function convertVersionToPage(version) {
94
94
  blocks: JSON.parse(JSON.stringify(blocks)),
95
95
  // Deep copy to avoid reference issues
96
96
  properties: properties ? JSON.parse(JSON.stringify(properties)) : {},
97
- authorsIds: version.authorsIds || []
97
+ authorsIds: version.authorsIds || [],
98
+ createdAt: version.createdAt ? new Date(version.createdAt) : /* @__PURE__ */ new Date(),
99
+ updatedAt: version.updatedAt ? new Date(version.updatedAt) : /* @__PURE__ */ new Date(),
100
+ postedAt: version.postedAt ? new Date(version.postedAt) : null,
101
+ banner: version.banner,
102
+ icon: version.icon,
103
+ images: version.images || [],
104
+ title: version.title || { en: "" },
105
+ slug: version.slug || "",
106
+ description: version.description || { en: "" },
107
+ tags: version.tags || [],
108
+ links: version.links || []
98
109
  };
99
110
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rimelight-components",
3
- "version": "2.2.6",
3
+ "version": "2.2.8",
4
4
  "description": "A component library by Rimelight Entertainment.",
5
5
  "keywords": [
6
6
  "nuxt",