@onderwijsin/nuxt-loops-renderer 0.2.0 → 0.2.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.
- package/README.md +16 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +3 -2
- package/dist/runtime/app/components/LoopsRenderer.vue +3 -4
- package/dist/runtime/app/components/nodes/LoopsAstIcons.vue +1 -1
- package/dist/runtime/app/components/nodes/LoopsAstInline.vue +1 -1
- package/dist/runtime/app/components/nodes/LoopsAstLayout.vue +1 -1
- package/dist/runtime/app/components/nodes/LoopsAstList.vue +1 -1
- package/dist/runtime/app/components/nodes/LoopsAstMedia.vue +1 -1
- package/dist/runtime/app/components/nodes/LoopsAstNode.vue +1 -1
- package/dist/runtime/app/components/nodes/LoopsAstSection.vue +1 -1
- package/dist/runtime/app/components/nodes/LoopsAstTextBlock.vue +1 -1
- package/dist/runtime/app/components/nodes/LoopsAstUnsupportedNodes.vue +1 -1
- package/dist/runtime/app/utils/renderer.d.ts +0 -9
- package/dist/runtime/app/utils/renderer.js +0 -5
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -27,6 +27,22 @@ export default defineNuxtConfig({
|
|
|
27
27
|
});
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
Import the module stylesheet in the consuming application's main CSS file after `@nuxt/ui`:
|
|
31
|
+
|
|
32
|
+
```css
|
|
33
|
+
@import "tailwindcss";
|
|
34
|
+
@import "@nuxt/ui";
|
|
35
|
+
@import "@onderwijsin/nuxt-loops-renderer";
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Agent skill
|
|
39
|
+
|
|
40
|
+
Install the consumer-facing skill for this module with:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
npx skills add onderwijsin/nuxt-modules --skill nuxt-loops-renderer
|
|
44
|
+
```
|
|
45
|
+
|
|
30
46
|
`@nuxt/ui` is registered as a Nuxt module dependency automatically. The
|
|
31
47
|
renderer uses its `UButton` and `UIcon` components.
|
|
32
48
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineNuxtModule, useLogger, createResolver, addComponentsDir } from '@nuxt/kit';
|
|
2
|
+
import 'zod';
|
|
2
3
|
|
|
3
4
|
var NUMBER_CHAR_RE = /\d/;
|
|
4
5
|
var STR_SPLITTERS = ["-", "_", "/", "."];
|
|
@@ -75,7 +76,7 @@ function moduleSetup(MODULE_NAME, options, log) {
|
|
|
75
76
|
};
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
const version = "0.2.
|
|
79
|
+
const version = "0.2.1";
|
|
79
80
|
|
|
80
81
|
const MODULE_KEY = "loopsRenderer";
|
|
81
82
|
const MODULE_NAME = resolveModuleName(MODULE_KEY);
|
|
@@ -89,7 +90,7 @@ const module$1 = defineNuxtModule({
|
|
|
89
90
|
}
|
|
90
91
|
},
|
|
91
92
|
defaults: {
|
|
92
|
-
applyInlineStyles: true
|
|
93
|
+
// applyInlineStyles: true
|
|
93
94
|
},
|
|
94
95
|
moduleDependencies: {
|
|
95
96
|
"@nuxt/ui": {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "
|
|
2
|
+
import { computed, useAppConfig } from "#imports";
|
|
3
3
|
import {
|
|
4
4
|
loopsLmxAstSchema,
|
|
5
5
|
getUnsupportedLoopsLmxNodes,
|
|
6
6
|
hasRenderableLoopsLmxNodes,
|
|
7
7
|
hasUnsupportedLoopsLmxNodes
|
|
8
8
|
} from "@onderwijsin/loops-core";
|
|
9
|
-
import {
|
|
10
|
-
import { createLoopsRendererConfig, hasRendererSpecificContent } from "../utils/renderer";
|
|
9
|
+
import { createLoopsRendererConfig } from "../utils/renderer";
|
|
11
10
|
const props = defineProps({
|
|
12
11
|
data: { type: Object, required: true },
|
|
13
12
|
variables: { type: Object, required: true },
|
|
@@ -20,7 +19,7 @@ const rendererConfig = computed(
|
|
|
20
19
|
const parsedContent = computed(() => loopsLmxAstSchema.safeParse(props.data));
|
|
21
20
|
const ast = computed(() => parsedContent.value.success ? parsedContent.value.data : null);
|
|
22
21
|
const hasRenderableContent = computed(
|
|
23
|
-
() => ast.value !== null &&
|
|
22
|
+
() => ast.value !== null && hasRenderableLoopsLmxNodes(ast.value.children)
|
|
24
23
|
);
|
|
25
24
|
const hasUnsupportedContent = computed(
|
|
26
25
|
() => ast.value !== null && hasUnsupportedLoopsLmxNodes(ast.value.children)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { LoopsLmxAst } from "@onderwijsin/loops-core";
|
|
2
1
|
import type { LoopsRendererConfig } from "../../types.js";
|
|
3
2
|
/**
|
|
4
3
|
* Combines per-renderer settings, Nuxt app config, and safe renderer defaults.
|
|
@@ -8,11 +7,3 @@ import type { LoopsRendererConfig } from "../../types.js";
|
|
|
8
7
|
* @returns The effective renderer settings.
|
|
9
8
|
*/
|
|
10
9
|
export declare function createLoopsRendererConfig(rendererConfig?: LoopsRendererConfig, appConfig?: LoopsRendererConfig): LoopsRendererConfig;
|
|
11
|
-
/**
|
|
12
|
-
* Detects visible nodes handled by this renderer but intentionally omitted from core's generic
|
|
13
|
-
* visibility helper. Quote and Br are renderer-specific LMX presentation nodes.
|
|
14
|
-
*
|
|
15
|
-
* @param nodes - Nodes in an LMX tree.
|
|
16
|
-
* @returns Whether the tree contains renderer-specific visible content.
|
|
17
|
-
*/
|
|
18
|
-
export declare function hasRendererSpecificContent(nodes: LoopsLmxAst["children"]): boolean;
|
|
@@ -9,8 +9,3 @@ export function createLoopsRendererConfig(rendererConfig, appConfig) {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
|
-
export function hasRendererSpecificContent(nodes) {
|
|
13
|
-
return nodes.some(
|
|
14
|
-
(node) => node.type === "element" && (["Quote", "Br"].includes(node.name) || node.name === "Component" && hasRendererSpecificContent(node.children))
|
|
15
|
-
);
|
|
16
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onderwijsin/nuxt-loops-renderer",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Nuxt module for rendering Loops LMX email content.",
|
|
5
5
|
"homepage": "https://github.com/onderwijsin/nuxt-modules#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"@tailwindcss/typography": "0.5.20",
|
|
38
38
|
"defu": "6.1.7",
|
|
39
39
|
"simple-icons": "16.28.0",
|
|
40
|
-
"tailwindcss": "4.3.3"
|
|
40
|
+
"tailwindcss": "4.3.3",
|
|
41
|
+
"zod": "4.4.3"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"@nuxt/module-builder": "1.0.3",
|
|
@@ -51,8 +52,9 @@
|
|
|
51
52
|
},
|
|
52
53
|
"scripts": {
|
|
53
54
|
"build": "nuxt-module-build build",
|
|
54
|
-
"predev:playground": "nuxt-module-build build --stub",
|
|
55
55
|
"typecheck": "tsc --noEmit --project tsconfig.json",
|
|
56
|
-
"dev:
|
|
56
|
+
"dev": "npm run dev:prepare && nuxt dev playground",
|
|
57
|
+
"dev:build": "nuxt build playground",
|
|
58
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare playground"
|
|
57
59
|
}
|
|
58
60
|
}
|