rimelight-components 2.0.88 → 2.0.90

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.88",
3
+ "version": "2.0.90",
4
4
  "docs": "https://rimelight.com/tools/rimelight-components",
5
5
  "configKey": "rimelightComponents",
6
6
  "compatibility": {
package/dist/module.mjs CHANGED
@@ -1,10 +1,10 @@
1
- import { addTemplate, defineNuxtModule, createResolver, addComponentsDir, addImportsDir } from '@nuxt/kit';
1
+ import { addTemplate, defineNuxtModule, createResolver, addComponentsDir, addImportsDir, addServerImportsDir } from '@nuxt/kit';
2
2
  import { defu } from 'defu';
3
3
  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.88";
7
+ const version = "2.0.90";
8
8
  const homepage = "https://rimelight.com/tools/rimelight-components";
9
9
 
10
10
  const defaultOptions = {
@@ -49,14 +49,15 @@ const defaultOptions = {
49
49
  }
50
50
  };
51
51
 
52
- function addBlockMapTemplates(blockNames, resolve) {
53
- return addTemplate({
52
+ function addBlockMapTemplates(blockNames) {
53
+ const template = addTemplate({
54
54
  filename: "rimelight-block-renderer-map.mjs",
55
55
  getContents: () => {
56
56
  let content = "export const BLOCK_RENDERER_COMPONENT_MAP = {\n";
57
57
  blockNames.forEach((name) => {
58
- const path = resolve(`./runtime/components/blocks/renderer/${name}Renderer.vue`);
59
- content += ` '${name}': () => import('${path}'),
58
+ const fullComponentName = `${name}Renderer`;
59
+ const componentPath = `rimelight-components/components/blocks/renderer/${fullComponentName}.vue`;
60
+ content += ` '${name}': () => import('${componentPath}'),
60
61
  `;
61
62
  });
62
63
  content += "}\n";
@@ -64,15 +65,36 @@ function addBlockMapTemplates(blockNames, resolve) {
64
65
  },
65
66
  write: true
66
67
  });
68
+ addTemplate({
69
+ filename: "rimelight-block-renderer-map.d.ts",
70
+ getContents: () => {
71
+ const componentImporterType = '() => Promise<{ default: import("vue").Component }>';
72
+ let content = `// Generated by rimelight-components Nuxt Module
73
+ `;
74
+ content += `import { Component } from 'vue'
75
+ `;
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
+ return content;
83
+ },
84
+ write: true
85
+ });
86
+ return template;
67
87
  }
68
- function addEditorBlockMapTemplates(blockNames, resolve) {
69
- return addTemplate({
88
+ function addEditorBlockMapTemplates(blockNames) {
89
+ const componentImporterType = '() => Promise<{ default: import("vue").Component }>';
90
+ const template = addTemplate({
70
91
  filename: "rimelight-block-editor-map.mjs",
71
92
  getContents: () => {
72
93
  let content = "export const BLOCK_EDITOR_COMPONENT_MAP = {\n";
73
94
  blockNames.forEach((name) => {
74
- const path = resolve(`./runtime/components/blocks/editor/${name}Editor.vue`);
75
- content += ` '${name}': () => import('${path}'),
95
+ const fullComponentName = `${name}Editor`;
96
+ const componentPath = `rimelight-components/components/blocks/editor/${fullComponentName}.vue`;
97
+ content += ` '${name}': () => import('${componentPath}'),
76
98
  `;
77
99
  });
78
100
  content += "}\n";
@@ -80,6 +102,24 @@ function addEditorBlockMapTemplates(blockNames, resolve) {
80
102
  },
81
103
  write: true
82
104
  });
105
+ addTemplate({
106
+ filename: "rimelight-block-editor-map.d.ts",
107
+ getContents: () => {
108
+ let content = `// Generated by rimelight-components Nuxt Module
109
+ `;
110
+ content += `import { Component } from 'vue'
111
+ `;
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
+ return content;
119
+ },
120
+ write: true
121
+ });
122
+ return template;
83
123
  }
84
124
 
85
125
  const module$1 = defineNuxtModule().with({
@@ -157,13 +197,7 @@ const module$1 = defineNuxtModule().with({
157
197
  nuxt.options.appConfig.rimelightComponents || {},
158
198
  options
159
199
  );
160
- nuxt.options.alias["#rimelight-components"] = resolve("./runtime");
161
- nuxt.options.alias["#rimelight-components/utils"] = resolve("./runtime/utils/index");
162
- nuxt.hook("nitro:config", (nitroConfig) => {
163
- nitroConfig.alias = nitroConfig.alias || {};
164
- nitroConfig.alias["#rimelight-components/utils"] = resolve("./runtime/utils/index");
165
- });
166
- nuxt.options.alias["rimelight-components/utils"] = resolve("./runtime/utils/index");
200
+ nuxt.options.build.transpile.push("@nuxt/ui");
167
201
  addComponentsDir({
168
202
  path: resolve("./runtime/components/"),
169
203
  pathPrefix: false,
@@ -173,16 +207,25 @@ const module$1 = defineNuxtModule().with({
173
207
  });
174
208
  addImportsDir(resolve("./runtime/composables"));
175
209
  addImportsDir(resolve("./runtime/utils"));
176
- const rendererPath = resolve("./runtime/components/blocks/renderer");
177
- const blockRendererFiles = readdirSync(rendererPath).filter((f) => f.endsWith(".vue"));
178
- const blockRendererNames = blockRendererFiles.map((f) => basename(f, ".vue").replace(/Renderer$/, ""));
179
- const blockRendererTemplate = addBlockMapTemplates(blockRendererNames, resolve);
180
- nuxt.options.alias["#rimelight-internal/block-renderer-map"] = blockRendererTemplate.dst;
181
- const editorPath = resolve("./runtime/components/blocks/editor");
182
- const blockEditorFiles = readdirSync(editorPath).filter((f) => f.endsWith(".vue"));
183
- const blockEditorNames = blockEditorFiles.map((f) => basename(f, ".vue").replace(/Editor$/, ""));
184
- const blockEditorTemplate = addEditorBlockMapTemplates(blockEditorNames, resolve);
185
- nuxt.options.alias["#rimelight-internal/block-editor-map"] = blockEditorTemplate.dst;
210
+ addServerImportsDir(resolve("./runtime/utils"));
211
+ const blockRendererFiles = readdirSync(
212
+ resolve("./runtime/components/blocks/renderer")
213
+ ).filter((name2) => name2.endsWith(".vue"));
214
+ const blockRendererNames = blockRendererFiles.map((file) => {
215
+ const baseName = basename(file, ".vue");
216
+ return baseName.replace(/Renderer$/, "");
217
+ });
218
+ const blockRendererTemplate = addBlockMapTemplates(blockRendererNames);
219
+ nuxt.options.alias["#build/rimelight-block-renderer-map"] = blockRendererTemplate.dst;
220
+ const blockEditorFiles = readdirSync(
221
+ resolve("./runtime/components/blocks/editor")
222
+ ).filter((name2) => name2.endsWith(".vue"));
223
+ const blockEditorNames = blockEditorFiles.map((file) => {
224
+ const baseName = basename(file, ".vue");
225
+ return baseName.replace(/Editor$/, "");
226
+ });
227
+ const blockEditorTemplate = addEditorBlockMapTemplates(blockEditorNames);
228
+ nuxt.options.alias["#build/rimelight-block-editor-map"] = blockEditorTemplate.dst;
186
229
  }
187
230
  });
188
231
 
@@ -1,4 +1,17 @@
1
1
  import { type Component } from "vue";
2
- import { type BlockType } from "../types";
2
+ import { type BlockType } from "../types/blocks";
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
+ */
3
9
  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
+ */
4
17
  export declare const getBlockEditorComponent: (type: BlockType | string) => Component | undefined;
@@ -1,19 +1,29 @@
1
1
  import { defineAsyncComponent } 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";
2
+ import { BLOCK_RENDERER_COMPONENT_MAP } from "#build/rimelight-block-renderer-map";
3
+ import { BLOCK_EDITOR_COMPONENT_MAP } from "#build/rimelight-block-editor-map";
4
4
  export const getBlockRendererComponent = (type) => {
5
- const loader = BLOCK_RENDERER_COMPONENT_MAP[type];
6
- if (!loader) {
7
- console.warn(`[BlockMapper] No renderer found for type: ${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
+ );
8
10
  return void 0;
9
11
  }
10
- return defineAsyncComponent(loader);
12
+ return defineAsyncComponent(async () => {
13
+ const module = await componentImporter();
14
+ return module.default;
15
+ });
11
16
  };
12
17
  export const getBlockEditorComponent = (type) => {
13
- const loader = BLOCK_EDITOR_COMPONENT_MAP[type];
14
- if (!loader) {
15
- console.warn(`[EditorBlockMapper] No editor found for type: ${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
+ );
16
23
  return void 0;
17
24
  }
18
- return defineAsyncComponent(loader);
25
+ return defineAsyncComponent(async () => {
26
+ const module = await componentImporter();
27
+ return module.default;
28
+ });
19
29
  };
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.88",
4
+ "version": "2.0.90",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",
@@ -27,22 +27,10 @@
27
27
  },
28
28
  "./runtime/*": "./dist/runtime/*",
29
29
  "./components/*": "./dist/runtime/components/*",
30
- "./composables": {
31
- "types": "./dist/runtime/composables/index.d.ts",
32
- "import": "./dist/runtime/composables/index.js"
33
- },
34
- "./composables/*": {
35
- "types": "./dist/runtime/composables/*.d.ts",
36
- "import": "./dist/runtime/composables/*.js"
37
- },
38
- "./utils": {
39
- "types": "./dist/runtime/utils/index.d.ts",
40
- "import": "./dist/runtime/utils/index.js"
41
- },
30
+ "./composables/*": "./dist/runtime/composables/*",
42
31
  "./utils/*": {
43
- "types": "./dist/runtime/utils/*.d.ts",
44
- "import": "./dist/runtime/utils/*.js",
45
- "default": "./dist/runtime/utils/*.js"
32
+ "types": "./dist/runtime/utils/*.d.mts",
33
+ "import": "./dist/runtime/utils/*.js"
46
34
  }
47
35
  },
48
36
  "typesVersions": {
@@ -50,17 +38,17 @@
50
38
  ".": [
51
39
  "./dist/module.d.mts"
52
40
  ],
53
- "runtime/*": [
54
- "./dist/runtime/*"
41
+ "vite": [
42
+ "./dist/vite.d.mts"
43
+ ],
44
+ "./runtime/*": [
45
+ "./dist/runtime/index.d.ts"
55
46
  ],
56
47
  "components/*": [
57
48
  "./dist/runtime/components/*"
58
49
  ],
59
- "composables": [
60
- "./dist/runtime/composables/index.d.ts"
61
- ],
62
50
  "composables/*": [
63
- "./dist/runtime/composables/*.d.ts"
51
+ "./dist/runtime/composables/*"
64
52
  ],
65
53
  "utils": [
66
54
  "./dist/runtime/utils/index.d.ts"