@shwfed/nuxt 0.1.20 → 0.1.22

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 (117) hide show
  1. package/dist/module.d.mts +1 -1
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +9 -2
  4. package/dist/runtime/components/app.d.vue.ts +2 -2
  5. package/dist/runtime/components/app.vue +58 -3
  6. package/dist/runtime/components/app.vue.d.ts +2 -2
  7. package/dist/runtime/components/table.d.vue.ts +12 -3
  8. package/dist/runtime/components/table.vue +44 -82
  9. package/dist/runtime/components/table.vue.d.ts +12 -3
  10. package/dist/runtime/components/ui/button/index.d.ts +1 -1
  11. package/dist/runtime/components/ui/button-group/ButtonGroup.d.vue.ts +19 -0
  12. package/dist/runtime/components/ui/button-group/ButtonGroup.vue +19 -0
  13. package/dist/runtime/components/ui/button-group/ButtonGroup.vue.d.ts +19 -0
  14. package/dist/runtime/components/ui/button-group/ButtonGroupSeparator.d.vue.ts +10 -0
  15. package/dist/runtime/components/ui/button-group/ButtonGroupSeparator.vue +25 -0
  16. package/dist/runtime/components/ui/button-group/ButtonGroupSeparator.vue.d.ts +10 -0
  17. package/dist/runtime/components/ui/button-group/ButtonGroupText.d.vue.ts +22 -0
  18. package/dist/runtime/components/ui/button-group/ButtonGroupText.vue +23 -0
  19. package/dist/runtime/components/ui/button-group/ButtonGroupText.vue.d.ts +22 -0
  20. package/dist/runtime/components/ui/button-group/index.d.ts +8 -0
  21. package/dist/runtime/components/ui/button-group/index.js +18 -0
  22. package/dist/runtime/components/ui/checkbox/Checkbox.d.vue.ts +25 -0
  23. package/dist/runtime/components/ui/checkbox/Checkbox.vue +47 -0
  24. package/dist/runtime/components/ui/checkbox/Checkbox.vue.d.ts +25 -0
  25. package/dist/runtime/components/ui/checkbox/index.d.ts +1 -0
  26. package/dist/runtime/components/ui/checkbox/index.js +1 -0
  27. package/dist/runtime/components/ui/command/Command.d.vue.ts +36 -0
  28. package/dist/runtime/components/ui/command/Command.vue +81 -0
  29. package/dist/runtime/components/ui/command/Command.vue.d.ts +36 -0
  30. package/dist/runtime/components/{tooltip.d.vue.ts → ui/command/CommandDialog.d.vue.ts} +13 -6
  31. package/dist/runtime/components/ui/command/CommandDialog.vue +34 -0
  32. package/dist/runtime/components/{tooltip.vue.d.ts → ui/command/CommandDialog.vue.d.ts} +13 -6
  33. package/dist/runtime/components/ui/command/CommandEmpty.d.vue.ts +18 -0
  34. package/dist/runtime/components/ui/command/CommandEmpty.vue +28 -0
  35. package/dist/runtime/components/ui/command/CommandEmpty.vue.d.ts +18 -0
  36. package/dist/runtime/components/ui/command/CommandGroup.d.vue.ts +19 -0
  37. package/dist/runtime/components/ui/command/CommandGroup.vue +44 -0
  38. package/dist/runtime/components/ui/command/CommandGroup.vue.d.ts +19 -0
  39. package/dist/runtime/components/ui/command/CommandInput.d.vue.ts +8 -0
  40. package/dist/runtime/components/ui/command/CommandInput.vue +40 -0
  41. package/dist/runtime/components/ui/command/CommandInput.vue.d.ts +8 -0
  42. package/dist/runtime/components/ui/command/CommandItem.d.vue.ts +22 -0
  43. package/dist/runtime/components/ui/command/CommandItem.vue +65 -0
  44. package/dist/runtime/components/ui/command/CommandItem.vue.d.ts +22 -0
  45. package/dist/runtime/components/ui/command/CommandList.d.vue.ts +18 -0
  46. package/dist/runtime/components/ui/command/CommandList.vue +24 -0
  47. package/dist/runtime/components/ui/command/CommandList.vue.d.ts +18 -0
  48. package/dist/runtime/components/ui/command/CommandSeparator.d.vue.ts +18 -0
  49. package/dist/runtime/components/ui/command/CommandSeparator.vue +23 -0
  50. package/dist/runtime/components/ui/command/CommandSeparator.vue.d.ts +18 -0
  51. package/dist/runtime/components/{dialog.d.vue.ts → ui/command/CommandShortcut.d.vue.ts} +5 -10
  52. package/dist/runtime/components/ui/command/CommandShortcut.vue +15 -0
  53. package/dist/runtime/components/{dialog.vue.d.ts → ui/command/CommandShortcut.vue.d.ts} +5 -10
  54. package/dist/runtime/components/ui/command/index.d.ts +90 -0
  55. package/dist/runtime/components/ui/command/index.js +12 -0
  56. package/dist/runtime/components/ui/dialog/Dialog.d.vue.ts +21 -0
  57. package/dist/runtime/components/ui/dialog/Dialog.vue +20 -0
  58. package/dist/runtime/components/ui/dialog/Dialog.vue.d.ts +21 -0
  59. package/dist/runtime/components/ui/dialog/DialogClose.d.vue.ts +14 -0
  60. package/dist/runtime/components/ui/dialog/DialogClose.vue +16 -0
  61. package/dist/runtime/components/ui/dialog/DialogClose.vue.d.ts +14 -0
  62. package/dist/runtime/components/ui/dialog/DialogContent.d.vue.ts +35 -0
  63. package/dist/runtime/components/ui/dialog/DialogContent.vue +53 -0
  64. package/dist/runtime/components/ui/dialog/DialogContent.vue.d.ts +35 -0
  65. package/dist/runtime/components/ui/dialog/DialogDescription.d.vue.ts +18 -0
  66. package/dist/runtime/components/ui/dialog/DialogDescription.vue +22 -0
  67. package/dist/runtime/components/ui/dialog/DialogDescription.vue.d.ts +18 -0
  68. package/dist/runtime/components/ui/dialog/DialogFooter.d.vue.ts +17 -0
  69. package/dist/runtime/components/ui/dialog/DialogFooter.vue +15 -0
  70. package/dist/runtime/components/ui/dialog/DialogFooter.vue.d.ts +17 -0
  71. package/dist/runtime/components/ui/dialog/DialogHeader.d.vue.ts +17 -0
  72. package/dist/runtime/components/ui/dialog/DialogHeader.vue +15 -0
  73. package/dist/runtime/components/ui/dialog/DialogHeader.vue.d.ts +17 -0
  74. package/dist/runtime/components/ui/dialog/DialogOverlay.d.vue.ts +18 -0
  75. package/dist/runtime/components/ui/dialog/DialogOverlay.vue +22 -0
  76. package/dist/runtime/components/ui/dialog/DialogOverlay.vue.d.ts +18 -0
  77. package/dist/runtime/components/ui/dialog/DialogScrollContent.d.vue.ts +32 -0
  78. package/dist/runtime/components/ui/dialog/DialogScrollContent.vue +58 -0
  79. package/dist/runtime/components/ui/dialog/DialogScrollContent.vue.d.ts +32 -0
  80. package/dist/runtime/components/ui/dialog/DialogTitle.d.vue.ts +18 -0
  81. package/dist/runtime/components/ui/dialog/DialogTitle.vue +22 -0
  82. package/dist/runtime/components/ui/dialog/DialogTitle.vue.d.ts +18 -0
  83. package/dist/runtime/components/ui/dialog/DialogTrigger.d.vue.ts +14 -0
  84. package/dist/runtime/components/ui/dialog/DialogTrigger.vue +16 -0
  85. package/dist/runtime/components/ui/dialog/DialogTrigger.vue.d.ts +14 -0
  86. package/dist/runtime/components/ui/dialog/index.d.ts +10 -0
  87. package/dist/runtime/components/ui/dialog/index.js +10 -0
  88. package/dist/runtime/components/ui/separator/Separator.d.vue.ts +1 -1
  89. package/dist/runtime/components/ui/separator/Separator.vue.d.ts +1 -1
  90. package/dist/runtime/components/ui/tooltip/Tooltip.d.vue.ts +20 -0
  91. package/dist/runtime/components/ui/tooltip/Tooltip.vue +24 -0
  92. package/dist/runtime/components/ui/tooltip/Tooltip.vue.d.ts +20 -0
  93. package/dist/runtime/components/ui/tooltip/TooltipContent.d.vue.ts +26 -0
  94. package/dist/runtime/components/ui/tooltip/TooltipContent.vue +58 -0
  95. package/dist/runtime/components/ui/tooltip/TooltipContent.vue.d.ts +26 -0
  96. package/dist/runtime/components/ui/tooltip/TooltipProvider.d.vue.ts +16 -0
  97. package/dist/runtime/components/ui/tooltip/TooltipProvider.vue +17 -0
  98. package/dist/runtime/components/ui/tooltip/TooltipProvider.vue.d.ts +16 -0
  99. package/dist/runtime/components/ui/tooltip/TooltipTrigger.d.vue.ts +14 -0
  100. package/dist/runtime/components/ui/tooltip/TooltipTrigger.vue +17 -0
  101. package/dist/runtime/components/ui/tooltip/TooltipTrigger.vue.d.ts +14 -0
  102. package/dist/runtime/components/ui/tooltip/index.d.ts +4 -0
  103. package/dist/runtime/components/ui/tooltip/index.js +4 -0
  104. package/dist/runtime/plugins/cel/env.d.ts +5 -1
  105. package/dist/runtime/plugins/cel/env.js +3 -1
  106. package/dist/runtime/plugins/cel/index.d.ts +12 -4
  107. package/dist/runtime/plugins/cel/index.js +8 -6
  108. package/dist/runtime/plugins/i18n/index.d.ts +2 -0
  109. package/dist/runtime/plugins/i18n/index.js +14 -0
  110. package/dist/runtime/plugins/markdown/index.js +1 -1
  111. package/dist/runtime/table-renderers/builtins.js +13 -30
  112. package/package.json +3 -1
  113. package/dist/runtime/components/dialog.vue +0 -64
  114. package/dist/runtime/components/markdown.d.vue.ts +0 -19
  115. package/dist/runtime/components/markdown.vue +0 -52
  116. package/dist/runtime/components/markdown.vue.d.ts +0 -19
  117. package/dist/runtime/components/tooltip.vue +0 -48
@@ -0,0 +1,14 @@
1
+ import type { TooltipTriggerProps } from 'reka-ui';
2
+ declare var __VLS_8: {};
3
+ type __VLS_Slots = {} & {
4
+ default?: (props: typeof __VLS_8) => any;
5
+ };
6
+ declare const __VLS_base: import("vue").DefineComponent<TooltipTriggerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TooltipTriggerProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
10
+ type __VLS_WithSlots<T, S> = T & {
11
+ new (): {
12
+ $slots: S;
13
+ };
14
+ };
@@ -0,0 +1,17 @@
1
+ <script setup>
2
+ import { TooltipTrigger } from "reka-ui";
3
+ const props = defineProps({
4
+ reference: { type: null, required: false },
5
+ asChild: { type: Boolean, required: false },
6
+ as: { type: null, required: false }
7
+ });
8
+ </script>
9
+
10
+ <template>
11
+ <TooltipTrigger
12
+ data-slot="tooltip-trigger"
13
+ v-bind="props"
14
+ >
15
+ <slot />
16
+ </TooltipTrigger>
17
+ </template>
@@ -0,0 +1,14 @@
1
+ import type { TooltipTriggerProps } from 'reka-ui';
2
+ declare var __VLS_8: {};
3
+ type __VLS_Slots = {} & {
4
+ default?: (props: typeof __VLS_8) => any;
5
+ };
6
+ declare const __VLS_base: import("vue").DefineComponent<TooltipTriggerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TooltipTriggerProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
10
+ type __VLS_WithSlots<T, S> = T & {
11
+ new (): {
12
+ $slots: S;
13
+ };
14
+ };
@@ -0,0 +1,4 @@
1
+ export { default as Tooltip } from './Tooltip.vue.js';
2
+ export { default as TooltipContent } from './TooltipContent.vue.js';
3
+ export { default as TooltipProvider } from './TooltipProvider.vue.js';
4
+ export { default as TooltipTrigger } from './TooltipTrigger.vue.js';
@@ -0,0 +1,4 @@
1
+ export { default as Tooltip } from "./Tooltip.vue";
2
+ export { default as TooltipContent } from "./TooltipContent.vue";
3
+ export { default as TooltipProvider } from "./TooltipProvider.vue";
4
+ export { default as TooltipTrigger } from "./TooltipTrigger.vue";
@@ -1,2 +1,6 @@
1
1
  import { Environment } from '@marcbachmann/cel-js';
2
- export declare function createEnvironment(): Environment;
2
+ type Options = Readonly<Partial<{
3
+ features: ReadonlyArray<string>;
4
+ }>>;
5
+ export declare function createEnvironment(options?: Options): Environment;
6
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { Environment, EvaluationError } from "@marcbachmann/cel-js";
2
2
  import { startOfDay, startOfWeek, startOfYear, startOfMonth, endOfDay, endOfWeek, endOfYear, endOfMonth, addYears, addMonths, addDays, addWeeks, setDate, setMonth, setYear, formatDate, isBefore, isAfter, isEqual } from "date-fns";
3
3
  import { TZDate } from "@date-fns/tz";
4
- export function createEnvironment() {
4
+ export function createEnvironment(options) {
5
5
  const env = new Environment({
6
6
  enableOptionalTypes: true,
7
7
  homogeneousAggregateLiterals: false,
@@ -77,6 +77,8 @@ export function createEnvironment() {
77
77
  }
78
78
  }).registerFunction("Date.format(string): string", (date, format) => {
79
79
  return formatDate(date, format);
80
+ }).registerFunction("feature(string): bool", (feature) => {
81
+ return (options?.features ?? []).includes(feature);
80
82
  });
81
83
  return env;
82
84
  }
@@ -1,23 +1,31 @@
1
1
  import type { Context } from '@marcbachmann/cel-js';
2
2
  declare const _default: import("#app").Plugin<{
3
3
  dsl: {
4
- check: (source: string) => import("@marcbachmann/cel-js").TypeCheckResult;
4
+ check: (template: {
5
+ raw: readonly string[] | ArrayLike<string>;
6
+ }, ...substitutions: any[]) => import("@marcbachmann/cel-js").TypeCheckResult;
5
7
  /**
6
8
  * Synchronous evaluation for render-time usage (e.g. table accessors).
7
9
  *
8
10
  * Will throw `TypeError` / `EvaluationError` on failure.
9
11
  */
10
- evaluate: <T>(source: string, context?: Context) => T;
12
+ evaluate: <T>(template: {
13
+ raw: readonly string[] | ArrayLike<string>;
14
+ }, ...substitutions: any[]) => (context?: Context) => T;
11
15
  };
12
16
  }> & import("#app").ObjectPlugin<{
13
17
  dsl: {
14
- check: (source: string) => import("@marcbachmann/cel-js").TypeCheckResult;
18
+ check: (template: {
19
+ raw: readonly string[] | ArrayLike<string>;
20
+ }, ...substitutions: any[]) => import("@marcbachmann/cel-js").TypeCheckResult;
15
21
  /**
16
22
  * Synchronous evaluation for render-time usage (e.g. table accessors).
17
23
  *
18
24
  * Will throw `TypeError` / `EvaluationError` on failure.
19
25
  */
20
- evaluate: <T>(source: string, context?: Context) => T;
26
+ evaluate: <T>(template: {
27
+ raw: readonly string[] | ArrayLike<string>;
28
+ }, ...substitutions: any[]) => (context?: Context) => T;
21
29
  };
22
30
  }>;
23
31
  export default _default;
@@ -3,21 +3,23 @@ import defu from "defu";
3
3
  import { createEnvironment } from "./env.js";
4
4
  export default defineNuxtPlugin({
5
5
  name: "shwfed-nuxt:cel",
6
- setup: () => {
7
- const env = createEnvironment();
6
+ setup: (nuxt) => {
7
+ const env = createEnvironment({
8
+ features: nuxt.$config.public.shwfed.features
9
+ });
8
10
  return {
9
11
  provide: {
10
12
  dsl: {
11
- check: (source) => {
12
- return env.check(source);
13
+ check: (...args) => {
14
+ return env.check(String.raw(...args));
13
15
  },
14
16
  /**
15
17
  * Synchronous evaluation for render-time usage (e.g. table accessors).
16
18
  *
17
19
  * Will throw `TypeError` / `EvaluationError` on failure.
18
20
  */
19
- evaluate: (source, context) => {
20
- return env.evaluate(source, defu(context, {
21
+ evaluate: (...args) => (context) => {
22
+ return env.evaluate(String.raw(...args), defu(context, {
21
23
  now: /* @__PURE__ */ new Date()
22
24
  }));
23
25
  }
@@ -0,0 +1,2 @@
1
+ declare const _default: import("#app").Plugin<Record<string, unknown>> & import("#app").ObjectPlugin<Record<string, unknown>>;
2
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import { defineNuxtPlugin } from "#app";
2
+ import { createI18n } from "vue-i18n";
3
+ export default defineNuxtPlugin({
4
+ name: "shwfed-nuxt:i18n",
5
+ setup: (nuxt) => {
6
+ nuxt.vueApp.use(createI18n({
7
+ locale: navigator?.language,
8
+ legacy: false,
9
+ fallbackWarn: false,
10
+ fallbackLocale: "zh",
11
+ globalInjection: false
12
+ }));
13
+ }
14
+ });
@@ -14,7 +14,7 @@ export default defineNuxtPlugin({
14
14
  if (!expression)
15
15
  return "";
16
16
  try {
17
- const result = $dsl.evaluate(expression, context);
17
+ const result = $dsl.evaluate`${expression}`(context);
18
18
  if (result !== null)
19
19
  return String(result);
20
20
  return "";
@@ -1,4 +1,4 @@
1
- import { Fragment, jsx, jsxs } from "vue/jsx-runtime";
1
+ import { jsx, jsxs } from "vue/jsx-runtime";
2
2
  import { Icon } from "@iconify/vue";
3
3
  import { format as formatDate, isValid, toDate } from "date-fns";
4
4
  import { defineComponent } from "vue";
@@ -6,6 +6,7 @@ import { z } from "zod";
6
6
  import { defineTableRenderer } from "./registry.js";
7
7
  import { useNuxtApp } from "#app";
8
8
  import { Button } from "../components/ui/button/index.js";
9
+ import { Checkbox } from "../components/ui/checkbox/index.js";
9
10
  const JUSTIFY_CLASS = {
10
11
  left: "justify-start",
11
12
  center: "justify-center",
@@ -197,7 +198,7 @@ defineTableRenderer(
197
198
  try {
198
199
  let text = String(ctx.cell.getValue());
199
200
  if (options.copyExpression) {
200
- text = String($dsl.evaluate(options.copyExpression, {
201
+ text = String($dsl.evaluate`${options.copyExpression}`({
201
202
  row: ctx.row.original,
202
203
  index: BigInt(ctx.row.index)
203
204
  }));
@@ -241,34 +242,16 @@ defineTableRenderer(
241
242
  },
242
243
  {
243
244
  cell: ({ ctx }) => {
244
- const isSingle = ctx.table.options.enableMultiRowSelection === false;
245
- return /* @__PURE__ */ jsx("div", { class: "group w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsxs("label", { class: "flex items-center has-enabled:cursor-pointer has-disabled:cursor-not-allowed relative", children: [
246
- /* @__PURE__ */ jsx(
247
- "input",
248
- {
249
- id: `${ctx.column.id}-${ctx.row.id}`,
250
- type: "checkbox",
251
- disabled: !ctx.row.getCanSelect(),
252
- checked: ctx.row.getIsSelected(),
253
- class: [
254
- "peer h-4 w-4 disabled:opacity-50 transition-colors duration-180 appearance-none",
255
- "border border-zinc-200 not-checked-enabled-group-hover:border-zinc-300 not-checked-enabled-group-hover:bg-zinc-100 checked:border-(--primary)",
256
- isSingle ? "rounded-full" : "rounded"
257
- ],
258
- onInput: (e) => ctx.row.getToggleSelectedHandler()(e)
259
- }
260
- ),
261
- isSingle ? /* @__PURE__ */ jsx("div", { class: "absolute inset-1 bg-(--primary) pointer-events-none rounded-full peer-checked:opacity-100 opacity-0 transition-opacity duration-180" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
262
- /* @__PURE__ */ jsx(
263
- Icon,
264
- {
265
- icon: "fluent:checkmark-20-filled",
266
- class: "peer-checked:opacity-100 opacity-0 text-white text-xs absolute z-1 -translate-x-1/2 -translate-y-1/2 top-1/2 left-1/2"
267
- }
268
- ),
269
- /* @__PURE__ */ jsx("div", { class: "absolute inset-0 bg-(--primary) rounded pointer-events-none peer-checked:opacity-100 opacity-0 transition-opacity duration-180" })
270
- ] })
271
- ] }) });
245
+ return /* @__PURE__ */ jsx("div", { class: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsx(
246
+ Checkbox,
247
+ {
248
+ id: `${ctx.column.id}-${ctx.row.id}`,
249
+ disabled: !ctx.row.getCanSelect(),
250
+ modelValue: ctx.row.getIsSelected(),
251
+ "onUpdate:modelValue": ctx.row.getToggleSelectedHandler(),
252
+ class: "w-4 h-4"
253
+ }
254
+ ) });
272
255
  },
273
256
  header: ({ ctx, options }) => {
274
257
  if (ctx.table.options.enableMultiRowSelection === false)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -39,6 +39,7 @@
39
39
  "dependencies": {
40
40
  "@date-fns/tz": "^1.4.1",
41
41
  "@iconify/vue": "^5.0.0",
42
+ "@intlify/unplugin-vue-i18n": "^11.0.3",
42
43
  "@marcbachmann/cel-js": "^7.2.1",
43
44
  "@nuxt/kit": "^4.3.0",
44
45
  "@tanstack/vue-table": "^8.21.3",
@@ -53,6 +54,7 @@
53
54
  "reka-ui": "^2.7.0",
54
55
  "tailwind-merge": "^3.4.0",
55
56
  "vue": "^3.5.27",
57
+ "vue-i18n": "^11.2.8",
56
58
  "vue-sonner": "^2.0.9",
57
59
  "zod": "^4.3.6"
58
60
  },
@@ -1,64 +0,0 @@
1
- <script setup>
2
- import { Icon } from "@iconify/vue";
3
- import { Dialog } from "reka-ui/namespaced";
4
- defineProps({
5
- title: { type: String, required: false },
6
- width: { type: String, required: false },
7
- description: { type: String, required: false },
8
- disabled: { type: Boolean, required: false }
9
- });
10
- defineSlots();
11
- </script>
12
-
13
- <template>
14
- <template v-if="disabled">
15
- <slot name="trigger" />
16
- </template>
17
- <Dialog.Root v-else>
18
- <Dialog.Trigger as-child>
19
- <slot name="trigger" />
20
- </Dialog.Trigger>
21
- <Dialog.Portal>
22
- <Dialog.Overlay
23
- class="fixed inset-0 z-50 grid place-items-center overflow-y-auto bg-zinc-900/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
24
- >
25
- <Dialog.Content
26
- class="absolute z-50 grid my-8 gap-4 border border-slate-200 bg-white p-4 shadow-lg duration-200 rounded-sm outline-none -translate-y-32 translate-3d"
27
- :style="{
28
- minWidth: width
29
- }"
30
- @pointer-down-outside="(event) => {
31
- const originalEvent = event.detail.originalEvent;
32
- const target = originalEvent.target;
33
- if (originalEvent.offsetX > target.clientWidth || originalEvent.offsetY > target.clientHeight) {
34
- event.preventDefault();
35
- }
36
- }"
37
- >
38
- <Dialog.Title
39
- class="flex items-center justify-between"
40
- >
41
- <span
42
- class="prose prose-zinc prose-base"
43
- v-html="$md.inline`${title}`({})"
44
- />
45
-
46
- <Dialog.Close
47
- class="outline-none rounded-md p-1 text-zinc-500 hover:text-zinc-800 transition-colors duration-150 bg-transparent"
48
- >
49
- <Icon
50
- icon="fluent:dismiss-20-regular"
51
- />
52
- <span class="sr-only">Close</span>
53
- </Dialog.Close>
54
- </Dialog.Title>
55
- <Dialog.Description class="sr-only">
56
- {{ description }}
57
- </Dialog.Description>
58
-
59
- <slot name="default" />
60
- </Dialog.Content>
61
- </Dialog.Overlay>
62
- </Dialog.Portal>
63
- </Dialog.Root>
64
- </template>
@@ -1,19 +0,0 @@
1
- type MarkdownEditorVariable = Readonly<{
2
- identity: string;
3
- type: string;
4
- description: string;
5
- }>;
6
- type __VLS_Props = {
7
- variables?: ReadonlyArray<MarkdownEditorVariable>;
8
- };
9
- type __VLS_ModelProps = {
10
- 'modelValue': string;
11
- };
12
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
13
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
- "update:modelValue": (value: string) => any;
15
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
16
- "onUpdate:modelValue"?: ((value: string) => any) | undefined;
17
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
- declare const _default: typeof __VLS_export;
19
- export default _default;
@@ -1,52 +0,0 @@
1
- <script setup>
2
- import { computed, useAttrs } from "vue";
3
- const model = defineModel("modelValue", { type: String, ...{ required: true } });
4
- defineOptions({
5
- inheritAttrs: false
6
- });
7
- const props = defineProps({
8
- variables: { type: Array, required: false }
9
- });
10
- const attrs = useAttrs();
11
- const textareaAttrs = computed(() => {
12
- const { class: _class, ...rest } = attrs;
13
- return rest;
14
- });
15
- </script>
16
-
17
- <template>
18
- <div class="space-y-2">
19
- <textarea
20
- v-bind="textareaAttrs"
21
- v-model="model"
22
- :class="[
23
- 'w-full border text-sync-200 hover:text-sync-300 transition-colors duration-150 rounded-sm outline-none',
24
- 'text-zinc-700 text-xs font-mono placeholder:text-zinc-400 hover:border-zinc-300 focus:border-zinc-300',
25
- 'p-2 resize-none',
26
- attrs.class
27
- ]"
28
- placeholder="输入 Markdown 使用 {{ }} 嵌入表达式"
29
- />
30
-
31
- <h3 class="text-sm text-zinc-700">
32
- 可使用的变量
33
- </h3>
34
-
35
- <ul
36
- v-if="props.variables?.length"
37
- class="space-y-1"
38
- >
39
- <li
40
- v-for="variable in props.variables"
41
- :key="variable.identity"
42
- class="text-xs text-zinc-700 space-x-2 list-circle list-inside"
43
- >
44
- <span class="font-mono text-xs">{{ variable.identity }}: {{ variable.type }}</span>
45
- <span
46
- class="prose prose-zinc text-xs opacity-80"
47
- v-html="$md.inline`${variable.description}`({})"
48
- />
49
- </li>
50
- </ul>
51
- </div>
52
- </template>
@@ -1,19 +0,0 @@
1
- type MarkdownEditorVariable = Readonly<{
2
- identity: string;
3
- type: string;
4
- description: string;
5
- }>;
6
- type __VLS_Props = {
7
- variables?: ReadonlyArray<MarkdownEditorVariable>;
8
- };
9
- type __VLS_ModelProps = {
10
- 'modelValue': string;
11
- };
12
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
13
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
- "update:modelValue": (value: string) => any;
15
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
16
- "onUpdate:modelValue"?: ((value: string) => any) | undefined;
17
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
- declare const _default: typeof __VLS_export;
19
- export default _default;
@@ -1,48 +0,0 @@
1
- <script setup>
2
- import { useForwardPropsEmits } from "reka-ui";
3
- import { Tooltip } from "reka-ui/namespaced";
4
- const props = defineProps({
5
- defaultOpen: { type: Boolean, required: false },
6
- open: { type: Boolean, required: false },
7
- delayDuration: { type: Number, required: false },
8
- disableHoverableContent: { type: Boolean, required: false },
9
- disableClosingTrigger: { type: Boolean, required: false },
10
- disabled: { type: Boolean, required: false },
11
- ignoreNonKeyboardFocus: { type: Boolean, required: false },
12
- content: { type: String, required: false }
13
- });
14
- const emits = defineEmits(["update:open"]);
15
- const forwarded = useForwardPropsEmits(props, emits);
16
- </script>
17
-
18
- <template>
19
- <Tooltip.Root v-bind="forwarded">
20
- <Tooltip.Trigger as-child>
21
- <slot />
22
- </Tooltip.Trigger>
23
- <Tooltip.Content
24
- side="top"
25
- align="center"
26
- :class="[
27
- 'bg-white text-zinc-700 animate-in fade-in-0 zoom-in-95',
28
- 'data-[state=closed]:animate-out data-[state=closed]:fade-out-0',
29
- 'data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2',
30
- 'data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2',
31
- 'data-[side=top]:slide-in-from-bottom-2',
32
- 'z-1024 w-fit rounded border border-zinc-200 px-6 py-2 text-xs',
33
- 'text-balance shadow-md'
34
- ]"
35
- >
36
- <span
37
- v-if="content"
38
- v-html="content"
39
- />
40
- <Tooltip.Arrow
41
- :class="[
42
- 'bg-white fill-white size-2.5 translate-y-[calc(-50%)] rotate-45 rounded-xs',
43
- 'border-b border-r border-zinc-200'
44
- ]"
45
- />
46
- </Tooltip.Content>
47
- </Tooltip.Root>
48
- </template>