rimelight-components 2.0.77 → 2.0.79

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.0.77",
3
+ "version": "2.0.79",
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.0.77";
7
+ const version = "2.0.79";
8
8
  const homepage = "https://rimelight.com/tools/rimelight-components";
9
9
 
10
10
  const defaultOptions = {
@@ -55,9 +55,7 @@ function addBlockMapTemplates(blockNames) {
55
55
  getContents: () => {
56
56
  let content = "export const BLOCK_RENDERER_COMPONENT_MAP = {\n";
57
57
  blockNames.forEach((name) => {
58
- const fullComponentName = `${name}Renderer`;
59
- const componentPath = `rimelight-components/components/blocks/renderer/${fullComponentName}.vue`;
60
- content += ` '${name}': () => import('${componentPath}'),
58
+ content += ` '${name}': '${name}Renderer',
61
59
  `;
62
60
  });
63
61
  content += "}\n";
@@ -68,17 +66,10 @@ function addBlockMapTemplates(blockNames) {
68
66
  addTemplate({
69
67
  filename: "rimelight-block-renderer-map.d.ts",
70
68
  getContents: () => {
71
- const componentImporterType = '() => Promise<{ default: import("vue").Component }>';
72
- let content = `// Generated by rimelight-components Nuxt Module
69
+ let content = `// Generated by rimelight-components
73
70
  `;
74
- content += `import { Component } from 'vue'
71
+ content += `export declare const BLOCK_RENDERER_COMPONENT_MAP: Record<string, string>
75
72
  `;
76
- content += `export declare const BLOCK_RENDERER_COMPONENT_MAP: { [key: string]: ${componentImporterType} | undefined }
77
- `;
78
- blockNames.forEach((name) => {
79
- content += `export declare const ${name}: ${componentImporterType}
80
- `;
81
- });
82
73
  return content;
83
74
  },
84
75
  write: true
@@ -86,15 +77,12 @@ function addBlockMapTemplates(blockNames) {
86
77
  return template;
87
78
  }
88
79
  function addEditorBlockMapTemplates(blockNames) {
89
- const componentImporterType = '() => Promise<{ default: import("vue").Component }>';
90
80
  const template = addTemplate({
91
81
  filename: "rimelight-block-editor-map.mjs",
92
82
  getContents: () => {
93
83
  let content = "export const BLOCK_EDITOR_COMPONENT_MAP = {\n";
94
84
  blockNames.forEach((name) => {
95
- const fullComponentName = `${name}Editor`;
96
- const componentPath = `rimelight-components/components/blocks/editor/${fullComponentName}.vue`;
97
- content += ` '${name}': () => import('${componentPath}'),
85
+ content += ` '${name}': '${name}Editor',
98
86
  `;
99
87
  });
100
88
  content += "}\n";
@@ -105,16 +93,10 @@ function addEditorBlockMapTemplates(blockNames) {
105
93
  addTemplate({
106
94
  filename: "rimelight-block-editor-map.d.ts",
107
95
  getContents: () => {
108
- let content = `// Generated by rimelight-components Nuxt Module
96
+ let content = `// Generated by rimelight-components
109
97
  `;
110
- content += `import { Component } from 'vue'
98
+ content += `export declare const BLOCK_EDITOR_COMPONENT_MAP: Record<string, string>
111
99
  `;
112
- content += `export declare const BLOCK_EDITOR_COMPONENT_MAP: { [key: string]: ${componentImporterType} | undefined }
113
- `;
114
- blockNames.forEach((name) => {
115
- content += `export declare const ${name}: ${componentImporterType}
116
- `;
117
- });
118
100
  return content;
119
101
  },
120
102
  write: true
@@ -215,7 +197,7 @@ const module$1 = defineNuxtModule().with({
215
197
  return baseName.replace(/Renderer$/, "");
216
198
  });
217
199
  const blockRendererTemplate = addBlockMapTemplates(blockRendererNames);
218
- nuxt.options.alias["#rimelight-components/rimelight-block-renderer-map"] = blockRendererTemplate.dst;
200
+ nuxt.options.alias["#rimelight-internal/block-renderer-map"] = blockRendererTemplate.dst;
219
201
  const blockEditorFiles = readdirSync(
220
202
  resolve("./runtime/components/blocks/editor")
221
203
  ).filter((name2) => name2.endsWith(".vue"));
@@ -224,11 +206,11 @@ const module$1 = defineNuxtModule().with({
224
206
  return baseName.replace(/Editor$/, "");
225
207
  });
226
208
  const blockEditorTemplate = addEditorBlockMapTemplates(blockEditorNames);
227
- nuxt.options.alias["#rimelight-components/rimelight-block-editor-map"] = blockEditorTemplate.dst;
209
+ nuxt.options.alias["#rimelight-internal/block-editor-map"] = blockEditorTemplate.dst;
228
210
  nuxt.hook("nitro:config", (nitroConfig) => {
229
211
  nitroConfig.alias = nitroConfig.alias || {};
230
- nitroConfig.alias["#rimelight-components/rimelight-block-renderer-map"] = blockRendererTemplate.dst;
231
- nitroConfig.alias["#rimelight-components/rimelight-block-editor-map"] = blockEditorTemplate.dst;
212
+ nitroConfig.alias["#rimelight-internal/block-renderer-map"] = blockRendererTemplate.dst;
213
+ nitroConfig.alias["#rimelight-internal/block-editor-map"] = blockEditorTemplate.dst;
232
214
  });
233
215
  }
234
216
  });
@@ -1,17 +1,4 @@
1
1
  import { type Component } from "vue";
2
2
  import { type BlockType } from "../types";
3
- /**
4
- * Maps the block type string from the database to a dynamically imported Vue component.
5
- *
6
- * @param type The BlockType string from the content JSON (e.g., 'ParagraphBlock').
7
- * @returns A lazily loaded Vue component reference, or undefined if not found.
8
- */
9
3
  export declare const getBlockRendererComponent: (type: BlockType | string) => Component | undefined;
10
- /**
11
- * Maps the block type string from the database to a dynamically imported Vue component
12
- * specifically for the editor view.
13
- *
14
- * @param type The BlockType string from the content JSON.
15
- * @returns A lazily loaded Vue component reference, or undefined if not found.
16
- */
17
4
  export declare const getBlockEditorComponent: (type: BlockType | string) => Component | undefined;
@@ -1,29 +1,28 @@
1
- import { defineAsyncComponent } from "vue";
2
- import { BLOCK_RENDERER_COMPONENT_MAP } from "#rimelight-components/rimelight-block-renderer-map";
3
- import { BLOCK_EDITOR_COMPONENT_MAP } from "#rimelight-components/rimelight-block-editor-map";
1
+ import { defineAsyncComponent, resolveComponent } from "vue";
2
+ import { BLOCK_RENDERER_COMPONENT_MAP } from "#rimelight-internal/block-renderer-map";
3
+ import { BLOCK_EDITOR_COMPONENT_MAP } from "#rimelight-internal/block-editor-map";
4
+ const createLazyComponent = (componentName) => {
5
+ return defineAsyncComponent(async () => {
6
+ const component = resolveComponent(componentName);
7
+ if (typeof component === "string") {
8
+ throw new Error(`[BlockMapper] Could not resolve component: ${componentName}`);
9
+ }
10
+ return component;
11
+ });
12
+ };
4
13
  export const getBlockRendererComponent = (type) => {
5
- const componentImporter = BLOCK_RENDERER_COMPONENT_MAP[type];
6
- if (!componentImporter) {
7
- console.warn(
8
- `[BlockMapper] Block component not found for type: ${type}. Please check block name.`
9
- );
14
+ const componentName = BLOCK_RENDERER_COMPONENT_MAP[type];
15
+ if (!componentName) {
16
+ console.warn(`[BlockMapper] No renderer found for type: ${type}`);
10
17
  return void 0;
11
18
  }
12
- return defineAsyncComponent(async () => {
13
- const module = await componentImporter();
14
- return module.default;
15
- });
19
+ return createLazyComponent(componentName);
16
20
  };
17
21
  export const getBlockEditorComponent = (type) => {
18
- const componentImporter = BLOCK_EDITOR_COMPONENT_MAP[type];
19
- if (!componentImporter) {
20
- console.warn(
21
- `[EditorBlockMapper] Editor block component not found for type: ${type}. Please check block name.`
22
- );
22
+ const componentName = BLOCK_EDITOR_COMPONENT_MAP[type];
23
+ if (!componentName) {
24
+ console.warn(`[EditorBlockMapper] No editor found for type: ${type}`);
23
25
  return void 0;
24
26
  }
25
- return defineAsyncComponent(async () => {
26
- const module = await componentImporter();
27
- return module.default;
28
- });
27
+ return createLazyComponent(componentName);
29
28
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rimelight-components",
3
3
  "description": "A component library by Rimelight Entertainment.",
4
- "version": "2.0.77",
4
+ "version": "2.0.79",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",