@onderwijsin/nuxt-loops-renderer 0.2.0

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.
Files changed (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +144 -0
  3. package/dist/module.d.mts +18 -0
  4. package/dist/module.json +12 -0
  5. package/dist/module.mjs +123 -0
  6. package/dist/runtime/app/components/LoopsRenderer.d.vue.ts +11 -0
  7. package/dist/runtime/app/components/LoopsRenderer.vue +60 -0
  8. package/dist/runtime/app/components/LoopsRenderer.vue.d.ts +11 -0
  9. package/dist/runtime/app/components/nodes/LoopsAstCodeBlock.d.vue.ts +11 -0
  10. package/dist/runtime/app/components/nodes/LoopsAstCodeBlock.vue +23 -0
  11. package/dist/runtime/app/components/nodes/LoopsAstCodeBlock.vue.d.ts +11 -0
  12. package/dist/runtime/app/components/nodes/LoopsAstComponent.d.vue.ts +11 -0
  13. package/dist/runtime/app/components/nodes/LoopsAstComponent.vue +22 -0
  14. package/dist/runtime/app/components/nodes/LoopsAstComponent.vue.d.ts +11 -0
  15. package/dist/runtime/app/components/nodes/LoopsAstIcons.d.vue.ts +10 -0
  16. package/dist/runtime/app/components/nodes/LoopsAstIcons.vue +53 -0
  17. package/dist/runtime/app/components/nodes/LoopsAstIcons.vue.d.ts +10 -0
  18. package/dist/runtime/app/components/nodes/LoopsAstInline.d.vue.ts +12 -0
  19. package/dist/runtime/app/components/nodes/LoopsAstInline.vue +62 -0
  20. package/dist/runtime/app/components/nodes/LoopsAstInline.vue.d.ts +12 -0
  21. package/dist/runtime/app/components/nodes/LoopsAstLayout.d.vue.ts +10 -0
  22. package/dist/runtime/app/components/nodes/LoopsAstLayout.vue +60 -0
  23. package/dist/runtime/app/components/nodes/LoopsAstLayout.vue.d.ts +10 -0
  24. package/dist/runtime/app/components/nodes/LoopsAstList.d.vue.ts +12 -0
  25. package/dist/runtime/app/components/nodes/LoopsAstList.vue +39 -0
  26. package/dist/runtime/app/components/nodes/LoopsAstList.vue.d.ts +12 -0
  27. package/dist/runtime/app/components/nodes/LoopsAstMedia.d.vue.ts +10 -0
  28. package/dist/runtime/app/components/nodes/LoopsAstMedia.vue +52 -0
  29. package/dist/runtime/app/components/nodes/LoopsAstMedia.vue.d.ts +10 -0
  30. package/dist/runtime/app/components/nodes/LoopsAstNode.d.vue.ts +11 -0
  31. package/dist/runtime/app/components/nodes/LoopsAstNode.vue +113 -0
  32. package/dist/runtime/app/components/nodes/LoopsAstNode.vue.d.ts +11 -0
  33. package/dist/runtime/app/components/nodes/LoopsAstSection.d.vue.ts +11 -0
  34. package/dist/runtime/app/components/nodes/LoopsAstSection.vue +40 -0
  35. package/dist/runtime/app/components/nodes/LoopsAstSection.vue.d.ts +11 -0
  36. package/dist/runtime/app/components/nodes/LoopsAstTextBlock.d.vue.ts +10 -0
  37. package/dist/runtime/app/components/nodes/LoopsAstTextBlock.vue +44 -0
  38. package/dist/runtime/app/components/nodes/LoopsAstTextBlock.vue.d.ts +10 -0
  39. package/dist/runtime/app/components/nodes/LoopsAstUnsupportedNodes.d.vue.ts +10 -0
  40. package/dist/runtime/app/components/nodes/LoopsAstUnsupportedNodes.vue +12 -0
  41. package/dist/runtime/app/components/nodes/LoopsAstUnsupportedNodes.vue.d.ts +10 -0
  42. package/dist/runtime/app/utils/renderer.d.ts +18 -0
  43. package/dist/runtime/app/utils/renderer.js +16 -0
  44. package/dist/runtime/index.css +1 -0
  45. package/dist/runtime/types.d.ts +10 -0
  46. package/dist/runtime/types.js +0 -0
  47. package/dist/types.d.mts +7 -0
  48. package/package.json +58 -0
@@ -0,0 +1,12 @@
1
+ import { type LoopsLmxNode, type LoopsLmxVariables } from "@onderwijsin/loops-core";
2
+ import type { LoopsRendererConfig } from "../../../types.js";
3
+ type __VLS_Props = {
4
+ node: LoopsLmxNode;
5
+ variables: LoopsLmxVariables;
6
+ config: LoopsRendererConfig;
7
+ /** Code blocks treat merge tags literally, as required by the LMX specification. */
8
+ resolveVariables?: boolean;
9
+ };
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const _default: typeof __VLS_export;
12
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import { type LoopsLmxElement, type LoopsLmxVariables } from "@onderwijsin/loops-core";
2
+ import type { LoopsRendererConfig } from "../../../types.js";
3
+ type __VLS_Props = {
4
+ node: LoopsLmxElement;
5
+ variables: LoopsLmxVariables;
6
+ config: LoopsRendererConfig;
7
+ };
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,60 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import {
4
+ getLoopsLmxColumnsLayout,
5
+ applyInlineStyles
6
+ } from "@onderwijsin/loops-core";
7
+ const props = defineProps({
8
+ node: { type: Object, required: true },
9
+ variables: { type: Object, required: true },
10
+ config: { type: Object, required: true }
11
+ });
12
+ const columns = computed(
13
+ () => props.node.children.filter(
14
+ (node) => node.type === "element" && node.name === "ColumnItem"
15
+ )
16
+ );
17
+ const columnsStyle = computed(
18
+ () => getLoopsLmxColumnsLayout(
19
+ props.node.attributes.widths,
20
+ props.node.attributes.gap,
21
+ columns.value.length
22
+ )
23
+ );
24
+ </script>
25
+
26
+ <template>
27
+ <LoopsAstSection
28
+ v-if="node.name === 'Section'"
29
+ :node="node"
30
+ :variables="variables"
31
+ :config="config"
32
+ />
33
+ <div
34
+ v-else-if="node.name === 'Columns' && columns.length"
35
+ :style="{
36
+ ...columnsStyle,
37
+ ...applyInlineStyles(node.attributes, config.applyInlineStyles !== false)
38
+ }"
39
+ >
40
+ <LoopsAstNode
41
+ v-for="(column, index) in columns"
42
+ :key="index"
43
+ :node="column"
44
+ :variables="variables"
45
+ :config="config"
46
+ />
47
+ </div>
48
+ <div
49
+ v-else-if="node.name === 'ColumnItem'"
50
+ :style="applyInlineStyles(node.attributes, config.applyInlineStyles !== false)"
51
+ >
52
+ <LoopsAstNode
53
+ v-for="(child, index) in node.children"
54
+ :key="index"
55
+ :node="child"
56
+ :variables="variables"
57
+ :config="config"
58
+ />
59
+ </div>
60
+ </template>
@@ -0,0 +1,10 @@
1
+ import { type LoopsLmxElement, type LoopsLmxVariables } from "@onderwijsin/loops-core";
2
+ import type { LoopsRendererConfig } from "../../../types.js";
3
+ type __VLS_Props = {
4
+ node: LoopsLmxElement;
5
+ variables: LoopsLmxVariables;
6
+ config: LoopsRendererConfig;
7
+ };
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,12 @@
1
+ import { type LoopsLmxElement, type LoopsLmxVariables } from "@onderwijsin/loops-core";
2
+ import type { LoopsRendererConfig } from "../../../types.js";
3
+ type __VLS_Props = {
4
+ /** The ordered or unordered LMX list to render. */
5
+ node: LoopsLmxElement;
6
+ /** Contact fields available to child nodes that contain Loops merge tags. */
7
+ variables: LoopsLmxVariables;
8
+ config: LoopsRendererConfig;
9
+ };
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const _default: typeof __VLS_export;
12
+ export default _default;
@@ -0,0 +1,39 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import {
4
+ applyInlineStyles
5
+ } from "@onderwijsin/loops-core";
6
+ const props = defineProps({
7
+ node: { type: Object, required: true },
8
+ variables: { type: Object, required: true },
9
+ config: { type: Object, required: true }
10
+ });
11
+ const items = computed(
12
+ () => props.node.children.filter(
13
+ (node) => node.type === "element" && node.name === "ListItem"
14
+ )
15
+ );
16
+ const tag = computed(() => props.node.name === "OrderedList" ? "ol" : "ul");
17
+ </script>
18
+
19
+ <template>
20
+ <component
21
+ :is="tag"
22
+ :style="applyInlineStyles(node.attributes, config.applyInlineStyles !== false)"
23
+ >
24
+ <li
25
+ v-for="(item, index) in items"
26
+ :key="index"
27
+ :style="applyInlineStyles(item.attributes, config.applyInlineStyles !== false)"
28
+ >
29
+ <LoopsAstNode
30
+ v-for="(child, childIndex) in item.children"
31
+ :key="childIndex"
32
+ :node="child"
33
+ :variables="variables"
34
+ :config="config"
35
+ :resolve-variables="true"
36
+ />
37
+ </li>
38
+ </component>
39
+ </template>
@@ -0,0 +1,12 @@
1
+ import { type LoopsLmxElement, type LoopsLmxVariables } from "@onderwijsin/loops-core";
2
+ import type { LoopsRendererConfig } from "../../../types.js";
3
+ type __VLS_Props = {
4
+ /** The ordered or unordered LMX list to render. */
5
+ node: LoopsLmxElement;
6
+ /** Contact fields available to child nodes that contain Loops merge tags. */
7
+ variables: LoopsLmxVariables;
8
+ config: LoopsRendererConfig;
9
+ };
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const _default: typeof __VLS_export;
12
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import { type LoopsLmxElement, type LoopsLmxVariables } from "@onderwijsin/loops-core";
2
+ import type { LoopsRendererConfig } from "../../../types.js";
3
+ type __VLS_Props = {
4
+ node: LoopsLmxElement;
5
+ variables: LoopsLmxVariables;
6
+ config: LoopsRendererConfig;
7
+ };
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,52 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import {
4
+ getLoopsLmxImageWidth,
5
+ resolveSafeLoopsLmxUrl,
6
+ resolveLoopsLmxVariables,
7
+ applyInlineStyles
8
+ } from "@onderwijsin/loops-core";
9
+ const props = defineProps({
10
+ node: { type: Object, required: true },
11
+ variables: { type: Object, required: true },
12
+ config: { type: Object, required: true }
13
+ });
14
+ const source = computed(
15
+ () => resolveSafeLoopsLmxUrl(
16
+ props.node.attributes.dynamicSrc ?? props.node.attributes.src,
17
+ props.variables,
18
+ "image"
19
+ )
20
+ );
21
+ const imageLink = computed(
22
+ () => resolveSafeLoopsLmxUrl(props.node.attributes.href, props.variables, "link")
23
+ );
24
+ const alt = computed(
25
+ () => resolveLoopsLmxVariables(props.node.attributes.alt ?? "", props.variables)
26
+ );
27
+ const width = computed(() => getLoopsLmxImageWidth(props.node.attributes.width));
28
+ </script>
29
+
30
+ <template>
31
+ <hr
32
+ v-if="node.name === 'Divider'"
33
+ :style="applyInlineStyles(node.attributes, config.applyInlineStyles !== false)"
34
+ />
35
+ <a v-else-if="source && imageLink" :href="imageLink" rel="noopener noreferrer">
36
+ <img
37
+ :src="source"
38
+ :alt="alt"
39
+ :width="width"
40
+ loading="lazy"
41
+ :style="applyInlineStyles(node.attributes, config.applyInlineStyles !== false)"
42
+ />
43
+ </a>
44
+ <img
45
+ v-else-if="source"
46
+ :src="source"
47
+ :alt="alt"
48
+ :width="width"
49
+ loading="lazy"
50
+ :style="applyInlineStyles(node.attributes, config.applyInlineStyles !== false)"
51
+ />
52
+ </template>
@@ -0,0 +1,10 @@
1
+ import { type LoopsLmxElement, type LoopsLmxVariables } from "@onderwijsin/loops-core";
2
+ import type { LoopsRendererConfig } from "../../../types.js";
3
+ type __VLS_Props = {
4
+ node: LoopsLmxElement;
5
+ variables: LoopsLmxVariables;
6
+ config: LoopsRendererConfig;
7
+ };
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import { type LoopsLmxNode, type LoopsLmxVariables } from "@onderwijsin/loops-core";
2
+ import type { LoopsRendererConfig } from "../../../types.js";
3
+ type __VLS_Props = {
4
+ node: LoopsLmxNode;
5
+ variables: LoopsLmxVariables;
6
+ config: LoopsRendererConfig;
7
+ resolveVariables?: boolean;
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
@@ -0,0 +1,113 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import {
4
+ isRenderableLoopsLmxElement,
5
+ resolveSafeLoopsLmxUrl,
6
+ applyInlineStyles
7
+ } from "@onderwijsin/loops-core";
8
+ const props = defineProps({
9
+ node: { type: Object, required: true },
10
+ variables: { type: Object, required: true },
11
+ config: { type: Object, required: true },
12
+ resolveVariables: { type: Boolean, required: false }
13
+ });
14
+ const isRenderable = computed(
15
+ () => props.node.type === "text" || isRenderableLoopsLmxElement(props.node) || props.node.type === "element" && ["Quote", "Br"].includes(props.node.name)
16
+ );
17
+ const isInline = computed(
18
+ () => props.node.type === "text" || ["Strong", "Em", "Underline", "Strike", "Code", "Text", "Link", "Br"].includes(props.node.name)
19
+ );
20
+ const isTextBlock = computed(
21
+ () => props.node.type === "element" && ["H1", "H2", "H3", "Paragraph", "Quote"].includes(props.node.name)
22
+ );
23
+ const isMedia = computed(
24
+ () => props.node.type === "element" && ["Image", "Divider"].includes(props.node.name)
25
+ );
26
+ const isList = computed(
27
+ () => props.node.type === "element" && ["UnorderedList", "OrderedList"].includes(props.node.name)
28
+ );
29
+ const buttonLink = computed(
30
+ () => props.node.type === "element" ? resolveSafeLoopsLmxUrl(props.node.attributes.href, props.variables, "link") : null
31
+ );
32
+ </script>
33
+
34
+ <template>
35
+ <LoopsAstInline
36
+ v-if="isRenderable && isInline"
37
+ :node="node"
38
+ :variables="variables"
39
+ :config="config"
40
+ :resolve-variables="resolveVariables"
41
+ />
42
+ <LoopsAstTextBlock
43
+ v-else-if="isRenderable && isTextBlock && node.type === 'element'"
44
+ :node="node"
45
+ :variables="variables"
46
+ :config="config"
47
+ />
48
+ <LoopsAstMedia
49
+ v-else-if="isRenderable && isMedia && node.type === 'element'"
50
+ :node="node"
51
+ :variables="variables"
52
+ :config="config"
53
+ />
54
+ <LoopsAstList
55
+ v-else-if="isRenderable && isList && node.type === 'element'"
56
+ :node="node"
57
+ :variables="variables"
58
+ :config="config"
59
+ />
60
+ <LoopsAstComponent
61
+ v-else-if="isRenderable && node.type === 'element' && node.name === 'Component'"
62
+ :node="node"
63
+ :variables="variables"
64
+ :config="config"
65
+ />
66
+ <LoopsAstCodeBlock
67
+ v-else-if="isRenderable && node.type === 'element' && node.name === 'CodeBlock'"
68
+ :node="node"
69
+ :variables="variables"
70
+ :config="config"
71
+ />
72
+ <LoopsAstIcons
73
+ v-else-if="isRenderable && node.type === 'element' && ['Icons', 'Icon'].includes(node.name)"
74
+ :node="node"
75
+ :variables="variables"
76
+ :config="config"
77
+ />
78
+ <LoopsAstLayout
79
+ v-else-if="
80
+ isRenderable && node.type === 'element' && ['Section', 'Columns', 'ColumnItem'].includes(node.name)
81
+ "
82
+ :node="node"
83
+ :variables="variables"
84
+ :config="config"
85
+ />
86
+ <UButton
87
+ v-else-if="isRenderable && node.type === 'element' && node.name === 'Button' && buttonLink"
88
+ :href="buttonLink"
89
+ rel="noopener noreferrer"
90
+ class="no-underline text-inverted"
91
+ :style="applyInlineStyles(node.attributes, config.applyInlineStyles !== false)"
92
+ >
93
+ <LoopsAstInline
94
+ v-for="(child, index) in node.children"
95
+ :key="index"
96
+ :node="child"
97
+ :variables="variables"
98
+ :config="config"
99
+ />
100
+ </UButton>
101
+ <span
102
+ v-else-if="isRenderable && node.type === 'element' && node.name === 'Button'"
103
+ :style="applyInlineStyles(node.attributes, config.applyInlineStyles !== false)"
104
+ >
105
+ <LoopsAstInline
106
+ v-for="(child, index) in node.children"
107
+ :key="index"
108
+ :node="child"
109
+ :variables="variables"
110
+ :config="config"
111
+ />
112
+ </span>
113
+ </template>
@@ -0,0 +1,11 @@
1
+ import { type LoopsLmxNode, type LoopsLmxVariables } from "@onderwijsin/loops-core";
2
+ import type { LoopsRendererConfig } from "../../../types.js";
3
+ type __VLS_Props = {
4
+ node: LoopsLmxNode;
5
+ variables: LoopsLmxVariables;
6
+ config: LoopsRendererConfig;
7
+ resolveVariables?: boolean;
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import { type LoopsLmxElement, type LoopsLmxVariables } from "@onderwijsin/loops-core";
2
+ import type { LoopsRendererConfig } from "../../../types.js";
3
+ type __VLS_Props = {
4
+ /** Section node whose optional conditional attributes control visibility. */
5
+ node: LoopsLmxElement;
6
+ variables: LoopsLmxVariables;
7
+ config: LoopsRendererConfig;
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
@@ -0,0 +1,40 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import {
4
+ evaluate,
5
+ applyInlineStyles
6
+ } from "@onderwijsin/loops-core";
7
+ const props = defineProps({
8
+ node: { type: Object, required: true },
9
+ variables: { type: Object, required: true },
10
+ config: { type: Object, required: true }
11
+ });
12
+ const condition = computed(() => {
13
+ const variable = props.node.attributes.if;
14
+ if (!variable) return null;
15
+ const { ifOperation: operation, ifValue: value } = props.node.attributes;
16
+ return {
17
+ variable,
18
+ ...operation ? { operation } : {},
19
+ ...value !== void 0 ? { value } : {}
20
+ };
21
+ });
22
+ const isVisible = computed(
23
+ () => condition.value === null || evaluate(condition.value, props.variables, props.config.evaluate)
24
+ );
25
+ </script>
26
+
27
+ <template>
28
+ <section
29
+ v-if="isVisible"
30
+ :style="applyInlineStyles(node.attributes, config.applyInlineStyles !== false)"
31
+ >
32
+ <LoopsAstNode
33
+ v-for="(child, index) in node.children"
34
+ :key="index"
35
+ :node="child"
36
+ :variables="variables"
37
+ :config="config"
38
+ />
39
+ </section>
40
+ </template>
@@ -0,0 +1,11 @@
1
+ import { type LoopsLmxElement, type LoopsLmxVariables } from "@onderwijsin/loops-core";
2
+ import type { LoopsRendererConfig } from "../../../types.js";
3
+ type __VLS_Props = {
4
+ /** Section node whose optional conditional attributes control visibility. */
5
+ node: LoopsLmxElement;
6
+ variables: LoopsLmxVariables;
7
+ config: LoopsRendererConfig;
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import { type LoopsLmxElement, type LoopsLmxVariables } from "@onderwijsin/loops-core";
2
+ import type { LoopsRendererConfig } from "../../../types.js";
3
+ type __VLS_Props = {
4
+ node: LoopsLmxElement;
5
+ variables: LoopsLmxVariables;
6
+ config: LoopsRendererConfig;
7
+ };
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,44 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import {
4
+ applyInlineStyles
5
+ } from "@onderwijsin/loops-core";
6
+ const props = defineProps({
7
+ node: { type: Object, required: true },
8
+ variables: { type: Object, required: true },
9
+ config: { type: Object, required: true }
10
+ });
11
+ const tag = computed(() => {
12
+ const tags = {
13
+ H1: "h1",
14
+ H2: "h2",
15
+ H3: "h3",
16
+ Paragraph: "p",
17
+ Quote: "blockquote"
18
+ };
19
+ return tags[props.node.name];
20
+ });
21
+ const alignmentClass = computed(() => {
22
+ if (props.node.attributes.align === "center") return "text-center";
23
+ if (props.node.attributes.align === "right") return "text-right";
24
+ return void 0;
25
+ });
26
+ </script>
27
+
28
+ <template>
29
+ <component
30
+ v-if="tag"
31
+ :is="tag"
32
+ :class="alignmentClass"
33
+ :style="applyInlineStyles(node.attributes, config.applyInlineStyles !== false)"
34
+ >
35
+ <LoopsAstNode
36
+ v-for="(child, index) in node.children"
37
+ :key="index"
38
+ :node="child"
39
+ :variables="variables"
40
+ :config="config"
41
+ :resolve-variables="true"
42
+ />
43
+ </component>
44
+ </template>
@@ -0,0 +1,10 @@
1
+ import { type LoopsLmxElement, type LoopsLmxVariables } from "@onderwijsin/loops-core";
2
+ import type { LoopsRendererConfig } from "../../../types.js";
3
+ type __VLS_Props = {
4
+ node: LoopsLmxElement;
5
+ variables: LoopsLmxVariables;
6
+ config: LoopsRendererConfig;
7
+ };
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import type { LoopsLmxElement } from "@onderwijsin/loops-core";
2
+ import type { LoopsRendererConfig } from "../../../types.js";
3
+ type __VLS_Props = {
4
+ /** Elements deliberately omitted by the safe public renderer. */
5
+ nodes: LoopsLmxElement[];
6
+ config: LoopsRendererConfig;
7
+ };
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,12 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ const props = defineProps({
4
+ nodes: { type: Array, required: true },
5
+ config: { type: Object, required: true }
6
+ });
7
+ const serializedNodes = computed(() => JSON.stringify(props.nodes, null, 2));
8
+ </script>
9
+
10
+ <template>
11
+ <pre v-if="nodes.length">{{ serializedNodes }}</pre>
12
+ </template>
@@ -0,0 +1,10 @@
1
+ import type { LoopsLmxElement } from "@onderwijsin/loops-core";
2
+ import type { LoopsRendererConfig } from "../../../types.js";
3
+ type __VLS_Props = {
4
+ /** Elements deliberately omitted by the safe public renderer. */
5
+ nodes: LoopsLmxElement[];
6
+ config: LoopsRendererConfig;
7
+ };
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,18 @@
1
+ import type { LoopsLmxAst } from "@onderwijsin/loops-core";
2
+ import type { LoopsRendererConfig } from "../../types.js";
3
+ /**
4
+ * Combines per-renderer settings, Nuxt app config, and safe renderer defaults.
5
+ *
6
+ * @param rendererConfig - Optional settings supplied to `LoopsRenderer`.
7
+ * @param appConfig - Optional module settings from Nuxt app config.
8
+ * @returns The effective renderer settings.
9
+ */
10
+ 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;
@@ -0,0 +1,16 @@
1
+ import { defu } from "defu";
2
+ export function createLoopsRendererConfig(rendererConfig, appConfig) {
3
+ return defu(rendererConfig, appConfig, {
4
+ applyInlineStyles: true,
5
+ evaluate: {
6
+ onMissingVariable: false,
7
+ onInvalidCondition: false,
8
+ onInvalidComparison: false
9
+ }
10
+ });
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
+ }
@@ -0,0 +1 @@
1
+ @source "./app";
@@ -0,0 +1,10 @@
1
+ import type { EvaluateLoopsLmxOptions } from "@onderwijsin/loops-core";
2
+ /** Options shared by the root renderer and every recursive LMX node renderer. */
3
+ export interface LoopsRendererConfig {
4
+ /** Render unsupported nodes in the Nuxt development overlay. */
5
+ debug?: boolean;
6
+ /** Overrides the module default for applying LMX node styles inline. */
7
+ applyInlineStyles?: boolean;
8
+ /** Overrides the module defaults for conditional Section evaluation. */
9
+ evaluate?: EvaluateLoopsLmxOptions;
10
+ }
File without changes
@@ -0,0 +1,7 @@
1
+ import type { NuxtModule } from '@nuxt/schema'
2
+
3
+ import type { default as Module } from './module.mjs'
4
+
5
+ export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
6
+
7
+ export { default } from './module.mjs'