@shwfed/nuxt 0.1.18 → 0.1.19

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
3
  "configKey": "shwfed",
4
- "version": "0.1.18",
4
+ "version": "0.1.19",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
@@ -291,7 +291,7 @@ function getSortIcon(column) {
291
291
  <Tooltip
292
292
  v-if="!header.isPlaceholder && header.column.columnDef.meta?.tooltip"
293
293
  :delay-duration="180"
294
- :content="$md.inline`${header.column.columnDef.meta.tooltip}`"
294
+ :content="$md.inline`${header.column.columnDef.meta.tooltip}`()"
295
295
  >
296
296
  <Icon icon="fluent:info-20-regular" />
297
297
  </Tooltip>
@@ -1,23 +1,24 @@
1
1
  import { md } from './md.js';
2
+ import type { Context } from '@marcbachmann/cel-js';
2
3
  declare const _default: import("#app").Plugin<{
3
4
  md: {
4
5
  raw: typeof md;
5
6
  inline: (template: {
6
7
  raw: readonly string[] | ArrayLike<string>;
7
- }, ...substitutions: any[]) => string;
8
+ }, ...substitutions: any[]) => (context?: Context) => string;
8
9
  block: (template: {
9
10
  raw: readonly string[] | ArrayLike<string>;
10
- }, ...substitutions: any[]) => string;
11
+ }, ...substitutions: any[]) => (context?: Context) => string;
11
12
  };
12
13
  }> & import("#app").ObjectPlugin<{
13
14
  md: {
14
15
  raw: typeof md;
15
16
  inline: (template: {
16
17
  raw: readonly string[] | ArrayLike<string>;
17
- }, ...substitutions: any[]) => string;
18
+ }, ...substitutions: any[]) => (context?: Context) => string;
18
19
  block: (template: {
19
20
  raw: readonly string[] | ArrayLike<string>;
20
- }, ...substitutions: any[]) => string;
21
+ }, ...substitutions: any[]) => (context?: Context) => string;
21
22
  };
22
23
  }>;
23
24
  export default _default;
@@ -9,12 +9,12 @@ export default defineNuxtPlugin({
9
9
  html: true
10
10
  });
11
11
  const { $dsl } = useNuxtApp();
12
- function evaluateBlock(source) {
12
+ function evaluateBlock(source, context) {
13
13
  return source.replace(/\{\{([\s\S]+?)\}\}/g, (_, expression) => {
14
14
  if (!expression)
15
15
  return "";
16
16
  try {
17
- return $dsl.evaluate(expression);
17
+ return $dsl.evaluate(expression, context);
18
18
  } catch (e) {
19
19
  console.error(e);
20
20
  return "";
@@ -25,8 +25,8 @@ export default defineNuxtPlugin({
25
25
  provide: {
26
26
  md: {
27
27
  raw: md,
28
- inline: (...args) => engine.renderInline(evaluateBlock(md(...args))),
29
- block: (...args) => engine.render(evaluateBlock(md(...args)))
28
+ inline: (...args) => (context) => engine.renderInline(evaluateBlock(md(...args), context)),
29
+ block: (...args) => (context) => engine.render(evaluateBlock(md(...args), context))
30
30
  }
31
31
  }
32
32
  };
@@ -402,7 +402,17 @@ defineTableRenderer(
402
402
  cell: ({ ctx, options }) => {
403
403
  const { $md } = useNuxtApp();
404
404
  const source = options.source ?? String(ctx.cell.getValue());
405
- return /* @__PURE__ */ jsx("div", { class: "relative w-full py-2 px-1 flex items-center justify-center text-xs", children: /* @__PURE__ */ jsx("span", { class: "prose prose-zinc text-xs", innerHTML: $md.inline`${source}` }) });
405
+ return /* @__PURE__ */ jsx("div", { class: "relative w-full py-2 px-1 flex items-center justify-center text-xs", children: /* @__PURE__ */ jsx(
406
+ "span",
407
+ {
408
+ class: "prose prose-zinc text-xs",
409
+ innerHTML: $md.inline`${source}`({
410
+ row: ctx.row.original,
411
+ index: BigInt(ctx.row.index),
412
+ id: ctx.column.id
413
+ })
414
+ }
415
+ ) });
406
416
  },
407
417
  config: TableRendererMarkdownConfig
408
418
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "type": "module",