@onderwijsin/nuxt-loops-renderer 0.2.1 → 0.2.2

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 CHANGED
@@ -2,14 +2,13 @@
2
2
 
3
3
  # @onderwijsin/nuxt-loops-renderer
4
4
 
5
- Render Loops LMX email content in a Nuxt 4 application. This module turns the
6
- renderer-neutral AST produced by `@onderwijsin/loops-core` into safe, styled
7
- Vue components that can be used in campaign archives, previews, and other
8
- presentation surfaces.
5
+ Render Loops LMX email content in a Nuxt 4 application. This module turns the renderer-neutral AST
6
+ produced by `@onderwijsin/loops-core` into safe, styled Vue components that can be used in campaign
7
+ archives, previews, and other presentation surfaces.
9
8
 
10
- The module is designed for content that has already been parsed on a trusted
11
- server. It validates the AST again at the browser boundary, resolves supported
12
- variables and URLs safely, and silently omits invalid or unsupported content.
9
+ The module is designed for content that has already been parsed on a trusted server. It validates
10
+ the AST again at the browser boundary, resolves supported variables and URLs safely, and silently
11
+ omits invalid or unsupported content.
13
12
 
14
13
  ## Getting started
15
14
 
@@ -43,11 +42,11 @@ Install the consumer-facing skill for this module with:
43
42
  npx skills add onderwijsin/nuxt-modules --skill nuxt-loops-renderer
44
43
  ```
45
44
 
46
- `@nuxt/ui` is registered as a Nuxt module dependency automatically. The
47
- renderer uses its `UButton` and `UIcon` components.
45
+ `@nuxt/ui` is registered as a Nuxt module dependency automatically. The renderer uses its `UButton`
46
+ and `UIcon` components.
48
47
 
49
- Parse LMX with `@onderwijsin/loops-core` on the server, then pass the resulting
50
- AST and variables to the auto-imported `LoopsRenderer` component:
48
+ Parse LMX with `@onderwijsin/loops-core` on the server, then pass the resulting AST and variables to
49
+ the auto-imported `LoopsRenderer` component:
51
50
 
52
51
  ```vue
53
52
  <script setup lang="ts">
@@ -89,8 +88,8 @@ The renderer supports the LMX presentation nodes used by Loops, including:
89
88
  - sections, columns, reusable components, and conditional sections;
90
89
  - safe URL handling, merge-tag resolution, and constrained inline styles.
91
90
 
92
- Set `debug: true` during development to show unsupported nodes in the Nuxt
93
- development overlay. Unsupported content is not rendered as raw HTML.
91
+ Set `debug: true` during development to show unsupported nodes in the Nuxt development overlay.
92
+ Unsupported content is not rendered as raw HTML.
94
93
 
95
94
  ```vue
96
95
  <LoopsRenderer :data="parsedAst" :variables="variables" :config="{ debug: import.meta.dev }" />
@@ -122,19 +121,18 @@ Available module options are:
122
121
  | `applyInlineStyles` | `true` | Apply validated LMX presentation attributes as inline styles. |
123
122
  | `evaluate` | See above | Fallbacks for missing variables and invalid conditional rules. |
124
123
 
125
- The same `applyInlineStyles` and `evaluate` options can be overridden for an
126
- individual `LoopsRenderer` with its `config` prop. `debug` is a per-renderer
127
- option and is intended for development diagnostics.
124
+ The same `applyInlineStyles` and `evaluate` options can be overridden for an individual
125
+ `LoopsRenderer` with its `config` prop. `debug` is a per-renderer option and is intended for
126
+ development diagnostics.
128
127
 
129
- Conditional sections use LMX attributes such as `if`, `ifOperation`, and
130
- `ifValue`. Evaluation never throws; missing variables and invalid conditions
131
- use the configured fallbacks, which default to `false`.
128
+ Conditional sections use LMX attributes such as `if`, `ifOperation`, and `ifValue`. Evaluation never
129
+ throws; missing variables and invalid conditions use the configured fallbacks, which default to
130
+ `false`.
132
131
 
133
132
  ## Relationship with `@onderwijsin/loops-core`
134
133
 
135
- `@onderwijsin/loops-core` is the framework-agnostic foundation. It parses LMX
136
- into a JSON-serializable AST and provides the shared safety and interpretation
137
- helpers for:
134
+ `@onderwijsin/loops-core` is the framework-agnostic foundation. It parses LMX into a
135
+ JSON-serializable AST and provides the shared safety and interpretation helpers for:
138
136
 
139
137
  - parsing and component expansion;
140
138
  - AST validation;
@@ -142,13 +140,13 @@ helpers for:
142
140
  - conditional evaluation;
143
141
  - supported-node detection and constrained style values.
144
142
 
145
- `@onderwijsin/nuxt-loops-renderer` is the presentation layer. It does not
146
- parse raw LMX, call the Loops API, or provide a general-purpose HTML renderer.
147
- Instead, it maps a validated core AST to Nuxt/Vue components, applies the
148
- application’s UI system, and chooses how supported LMX nodes appear on screen.
143
+ `@onderwijsin/nuxt-loops-renderer` is the presentation layer. It does not parse raw LMX, call the
144
+ Loops API, or provide a general-purpose HTML renderer. Instead, it maps a validated core AST to
145
+ Nuxt/Vue components, applies the application’s UI system, and chooses how supported LMX nodes appear
146
+ on screen.
149
147
 
150
- Keep API keys and raw-LMX parsing on a trusted server. Pass only the parsed AST
151
- and the variables needed by the current presentation to the client renderer.
148
+ Keep API keys and raw-LMX parsing on a trusted server. Pass only the parsed AST and the variables
149
+ needed by the current presentation to the client renderer.
152
150
 
153
151
  ## Compatibility
154
152
 
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@onderwijsin/nuxt-loops-renderer",
3
3
  "configKey": "loopsRenderer",
4
- "version": "0.2.1",
4
+ "version": "0.2.2",
5
5
  "compatibility": {
6
6
  "nuxt": "^4.0.0"
7
7
  },
package/dist/module.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineNuxtModule, useLogger, createResolver, addComponentsDir } from '@nuxt/kit';
2
- import 'zod';
2
+ import { z } from 'zod';
3
3
 
4
4
  var NUMBER_CHAR_RE = /\d/;
5
5
  var STR_SPLITTERS = ["-", "_", "/", "."];
@@ -49,19 +49,19 @@ function splitByCase(str, separators) {
49
49
  function kebabCase(str, joiner) {
50
50
  return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join("-") : "";
51
51
  }
52
+ z.boolean().default(true);
52
53
  function resolveModuleName(moduleKey) {
53
54
  return `@onderwijsin/nuxt-${kebabCase(moduleKey)}`;
54
55
  }
55
56
  function resolveLoggerScope(moduleKey) {
56
57
  return kebabCase(moduleKey);
57
58
  }
59
+ function transpileRuntime(nuxt, runtimeDir) {
60
+ nuxt.options.build.transpile.push(runtimeDir);
61
+ }
58
62
  function moduleSetup(MODULE_NAME, options, log) {
59
- const start = () => {
60
- log.start(`Loading module ${MODULE_NAME}`);
61
- };
62
- const end = () => {
63
- log.success(`Module ${MODULE_NAME} Loaded`);
64
- };
63
+ const start = () => log.start(`Loading module ${MODULE_NAME}`);
64
+ const end = () => log.success(`Module ${MODULE_NAME} Loaded`);
65
65
  const isEnabled = () => {
66
66
  if ("enabled" in options && options.enabled === false) {
67
67
  log.info(`Module ${MODULE_NAME} is disabled. Skipping setup...`);
@@ -69,14 +69,10 @@ function moduleSetup(MODULE_NAME, options, log) {
69
69
  }
70
70
  return true;
71
71
  };
72
- return {
73
- start,
74
- end,
75
- isEnabled
76
- };
72
+ return { start, end, isEnabled };
77
73
  }
78
74
 
79
- const version = "0.2.1";
75
+ const version = "0.2.2";
80
76
 
81
77
  const MODULE_KEY = "loopsRenderer";
82
78
  const MODULE_NAME = resolveModuleName(MODULE_KEY);
@@ -112,7 +108,7 @@ const module$1 = defineNuxtModule({
112
108
  });
113
109
  const resolver = createResolver(import.meta.url);
114
110
  const runtimeDir = resolver.resolve("./runtime");
115
- nuxt.options.build.transpile.push(runtimeDir);
111
+ transpileRuntime(nuxt, runtimeDir);
116
112
  addComponentsDir({
117
113
  path: resolver.resolve(runtimeDir, "app", "components"),
118
114
  pathPrefix: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onderwijsin/nuxt-loops-renderer",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Nuxt module for rendering Loops LMX email content.",
5
5
  "homepage": "https://github.com/onderwijsin/nuxt-modules#readme",
6
6
  "bugs": {
@@ -30,10 +30,10 @@
30
30
  "access": "public"
31
31
  },
32
32
  "dependencies": {
33
- "@nuxt/kit": "4.5.1",
34
- "@nuxt/schema": "4.5.1",
33
+ "@nuxt/kit": "4.5.2",
34
+ "@nuxt/schema": "4.5.2",
35
35
  "@nuxt/ui": "4.10.0",
36
- "@onderwijsin/loops-core": "1.2.0",
36
+ "@onderwijsin/loops-core": "1.3.0",
37
37
  "@tailwindcss/typography": "0.5.20",
38
38
  "defu": "6.1.7",
39
39
  "simple-icons": "16.28.0",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "devDependencies": {
44
44
  "@nuxt/module-builder": "1.0.3",
45
- "nuxt": "4.5.1",
45
+ "nuxt": "4.5.2",
46
46
  "typescript": "5.9.3",
47
47
  "unbuild": "3.6.1",
48
48
  "module-utils": "0.0.0"