@shwfed/nuxt 0.1.20 → 0.1.21

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 (41) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/app.vue +3 -3
  3. package/dist/runtime/components/table.vue +40 -82
  4. package/dist/runtime/components/ui/button/index.d.ts +1 -1
  5. package/dist/runtime/components/{dialog.d.vue.ts → ui/button-group/ButtonGroup.d.vue.ts} +7 -10
  6. package/dist/runtime/components/ui/button-group/ButtonGroup.vue +19 -0
  7. package/dist/runtime/components/{dialog.vue.d.ts → ui/button-group/ButtonGroup.vue.d.ts} +7 -10
  8. package/dist/runtime/components/ui/button-group/ButtonGroupSeparator.d.vue.ts +10 -0
  9. package/dist/runtime/components/ui/button-group/ButtonGroupSeparator.vue +25 -0
  10. package/dist/runtime/components/ui/button-group/ButtonGroupSeparator.vue.d.ts +10 -0
  11. package/dist/runtime/components/ui/button-group/ButtonGroupText.d.vue.ts +22 -0
  12. package/dist/runtime/components/ui/button-group/ButtonGroupText.vue +23 -0
  13. package/dist/runtime/components/ui/button-group/ButtonGroupText.vue.d.ts +22 -0
  14. package/dist/runtime/components/ui/button-group/index.d.ts +8 -0
  15. package/dist/runtime/components/ui/button-group/index.js +18 -0
  16. package/dist/runtime/components/ui/tooltip/Tooltip.d.vue.ts +20 -0
  17. package/dist/runtime/components/ui/tooltip/Tooltip.vue +24 -0
  18. package/dist/runtime/components/ui/tooltip/Tooltip.vue.d.ts +20 -0
  19. package/dist/runtime/components/{tooltip.d.vue.ts → ui/tooltip/TooltipContent.d.vue.ts} +11 -6
  20. package/dist/runtime/components/ui/tooltip/TooltipContent.vue +58 -0
  21. package/dist/runtime/components/{tooltip.vue.d.ts → ui/tooltip/TooltipContent.vue.d.ts} +11 -6
  22. package/dist/runtime/components/ui/tooltip/TooltipProvider.d.vue.ts +16 -0
  23. package/dist/runtime/components/ui/tooltip/TooltipProvider.vue +17 -0
  24. package/dist/runtime/components/ui/tooltip/TooltipProvider.vue.d.ts +16 -0
  25. package/dist/runtime/components/ui/tooltip/TooltipTrigger.d.vue.ts +14 -0
  26. package/dist/runtime/components/ui/tooltip/TooltipTrigger.vue +17 -0
  27. package/dist/runtime/components/ui/tooltip/TooltipTrigger.vue.d.ts +14 -0
  28. package/dist/runtime/components/ui/tooltip/index.d.ts +4 -0
  29. package/dist/runtime/components/ui/tooltip/index.js +4 -0
  30. package/dist/runtime/plugins/cel/env.d.ts +7 -0
  31. package/dist/runtime/plugins/cel/env.js +11 -0
  32. package/dist/runtime/plugins/cel/index.d.ts +12 -4
  33. package/dist/runtime/plugins/cel/index.js +4 -4
  34. package/dist/runtime/plugins/markdown/index.js +1 -1
  35. package/dist/runtime/table-renderers/builtins.js +1 -1
  36. package/package.json +1 -1
  37. package/dist/runtime/components/dialog.vue +0 -64
  38. package/dist/runtime/components/markdown.d.vue.ts +0 -19
  39. package/dist/runtime/components/markdown.vue +0 -52
  40. package/dist/runtime/components/markdown.vue.d.ts +0 -19
  41. package/dist/runtime/components/tooltip.vue +0 -48
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
3
  "configKey": "shwfed",
4
- "version": "0.1.20",
4
+ "version": "0.1.21",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { useHead } from "#app";
3
- import { Tooltip } from "reka-ui/namespaced";
3
+ import { TooltipProvider } from "./ui/tooltip";
4
4
  import { Toaster } from "vue-sonner";
5
5
  useHead({
6
6
  bodyAttrs: {
@@ -12,10 +12,10 @@ useHead({
12
12
  </script>
13
13
 
14
14
  <template>
15
- <Tooltip.Provider>
15
+ <TooltipProvider>
16
16
  <ClientOnly>
17
17
  <Toaster />
18
18
  </ClientOnly>
19
19
  <slot />
20
- </Tooltip.Provider>
20
+ </TooltipProvider>
21
21
  </template>
@@ -7,10 +7,8 @@ import { Pagination } from "reka-ui/namespaced";
7
7
  import { computed, ref } from "vue";
8
8
  import { useNuxtApp } from "#app";
9
9
  import { Button } from "./ui/button";
10
+ import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip";
10
11
  import { useTableRenderers } from "../composables/useTableRenderers";
11
- import Tooltip from "./tooltip.vue";
12
- import Dialog from "./dialog.vue";
13
- import MarkdownEditor from "./markdown.vue";
14
12
  import { useCheating } from "#imports";
15
13
  </script>
16
14
 
@@ -70,7 +68,7 @@ function translate(column) {
70
68
  return getProperty(row, key);
71
69
  } else if (key !== void 0) {
72
70
  try {
73
- return $dsl.evaluate(key.read, {
71
+ return $dsl.evaluate`${key.read}`({
74
72
  row,
75
73
  index: BigInt(index)
76
74
  });
@@ -108,8 +106,7 @@ const table = useVueTable({
108
106
  getPaginationRowModel: getPaginationRowModel(),
109
107
  getRowId: props.getRowId ? (originalRow, index, parent) => {
110
108
  try {
111
- const key = $dsl.evaluate(
112
- props.getRowId,
109
+ const key = $dsl.evaluate`${props.getRowId}`(
113
110
  {
114
111
  row: originalRow,
115
112
  index,
@@ -132,7 +129,7 @@ const table = useVueTable({
132
129
  if (!props.getSubRows)
133
130
  return void 0;
134
131
  try {
135
- const value = $dsl.evaluate(props.getSubRows, {
132
+ const value = $dsl.evaluate`${props.getSubRows}`({
136
133
  row,
137
134
  index
138
135
  });
@@ -146,7 +143,7 @@ const table = useVueTable({
146
143
  if (!props.enableRowSelection)
147
144
  return true;
148
145
  try {
149
- return Boolean($dsl.evaluate(props.enableRowSelection, {
146
+ return Boolean($dsl.evaluate`${props.enableRowSelection}`({
150
147
  row: row.original,
151
148
  index: BigInt(row.index),
152
149
  id: row.id
@@ -158,7 +155,7 @@ const table = useVueTable({
158
155
  },
159
156
  enableMultiRowSelection: props.enableMultiRowSelection ? (row) => {
160
157
  try {
161
- return Boolean($dsl.evaluate(props.enableMultiRowSelection, {
158
+ return Boolean($dsl.evaluate`${props.enableMultiRowSelection}`({
162
159
  row: row.original,
163
160
  index: BigInt(row.index),
164
161
  id: row.id
@@ -195,7 +192,7 @@ function getCellStyles(ctx) {
195
192
  if (!props.cellStyles)
196
193
  return {};
197
194
  try {
198
- const result = $dsl.evaluate(props.cellStyles, {
195
+ const result = $dsl.evaluate`${props.cellStyles}`({
199
196
  row: ctx.row.original,
200
197
  index: BigInt(ctx.row.index),
201
198
  id: ctx.column.id,
@@ -296,9 +293,16 @@ function getSortIcon(column) {
296
293
  <Tooltip
297
294
  v-if="!header.isPlaceholder && header.column.columnDef.meta?.tooltip"
298
295
  :delay-duration="180"
299
- :content="$md.inline`${header.column.columnDef.meta.tooltip}`()"
300
296
  >
301
- <Icon icon="fluent:info-20-regular" />
297
+ <TooltipTrigger as-child>
298
+ <Icon icon="fluent:info-20-regular" />
299
+ </TooltipTrigger>
300
+ <TooltipContent
301
+ align="center"
302
+ side="top"
303
+ >
304
+ <span v-html="$md.inline`${header.column.columnDef.meta.tooltip}`()" />
305
+ </TooltipContent>
302
306
  </Tooltip>
303
307
 
304
308
  <Button
@@ -410,47 +414,24 @@ function getSortIcon(column) {
410
414
  </div>
411
415
 
412
416
  <div class="flex items-center justify-between w-full py-2 gap-2 text-sm text-zinc-600">
413
- <Dialog
414
- title="编辑分页左侧文字"
415
- width="50%"
416
- :disabled="!isCheating"
417
- >
418
- <template #trigger>
419
- <div
420
- :class="[
417
+ <div
418
+ :class="[
421
419
  'relative p-1 flex-1 prose prose-zinc text-xs border border-dashed',
422
420
  isCheating ? 'border-(--primary)/20 rounded hover:border-(--primary)/40 transition-colors duration-150 group cursor-pointer' : 'border-transparent'
423
421
  ]"
424
- >
425
- <span
426
- v-html="$md.inline`${props.paginationLeft}`({
422
+ >
423
+ <span
424
+ v-html="$md.inline`${props.paginationLeft}`({
427
425
  selected: table.getSelectedRowModel().rows.map((row) => row.original)
428
426
  })"
429
- />
430
- <Icon
431
- v-if="isCheating"
432
- icon="fluent:edit-20-regular"
433
- class="w-4 h-4 text-(--primary) absolute right-1 top-1/2 -translate-y-1/2 transform-3d group-hover:opacity-100 opacity-50 transition-opacity duration-150"
434
- />
427
+ />
428
+ <Icon
429
+ v-if="isCheating"
430
+ icon="fluent:edit-20-regular"
431
+ class="w-4 h-4 text-(--primary) absolute right-1 top-1/2 -translate-y-1/2 transform-3d group-hover:opacity-100 opacity-50 transition-opacity duration-150"
432
+ />
435
433
  &nbsp;
436
- </div>
437
- </template>
438
- <template #default>
439
- <MarkdownEditor
440
- :model-value="props.paginationLeft ?? ''"
441
- class="w-full h-64"
442
- :variables="[
443
- {
444
- identity: 'selected',
445
- type: 'list<dyn>',
446
- description: $md.raw`
447
- 表格被选中的行:如果没有被选中的行,那么这个变量将始终为空列表。
448
- `
449
- }
450
- ]"
451
- />
452
- </template>
453
- </Dialog>
434
+ </div>
454
435
  <div class="flex items-center gap-4">
455
436
  <span class="text-xs">{{ `\u5171 ${props.data.length} \u6761` }}</span>
456
437
  <Pagination.Root
@@ -535,47 +516,24 @@ function getSortIcon(column) {
535
516
  </Pagination.Root>
536
517
  <span class="text-xs">前往</span>
537
518
  </div>
538
- <Dialog
539
- title="编辑分页右侧文字"
540
- width="50%"
541
- :disabled="!isCheating"
542
- >
543
- <template #trigger>
544
- <div
545
- :class="[
519
+ <div
520
+ :class="[
546
521
  'relative p-1 flex-1 prose prose-zinc text-xs border border-dashed',
547
522
  isCheating ? 'border-(--primary)/20 rounded hover:border-(--primary)/40 transition-colors duration-150 group cursor-pointer' : 'border-transparent'
548
523
  ]"
549
- >
550
- <span
551
- v-html="$md.inline`${props.paginationRight}`({
524
+ >
525
+ <span
526
+ v-html="$md.inline`${props.paginationRight}`({
552
527
  selected: table.getSelectedRowModel().rows.map((row) => row.original)
553
528
  })"
554
- />
555
- <Icon
556
- v-if="isCheating"
557
- icon="fluent:edit-20-regular"
558
- class="w-4 h-4 text-(--primary) absolute right-1 top-1/2 -translate-y-1/2 transform-3d group-hover:opacity-100 opacity-50 transition-opacity duration-150"
559
- />
529
+ />
530
+ <Icon
531
+ v-if="isCheating"
532
+ icon="fluent:edit-20-regular"
533
+ class="w-4 h-4 text-(--primary) absolute right-1 top-1/2 -translate-y-1/2 transform-3d group-hover:opacity-100 opacity-50 transition-opacity duration-150"
534
+ />
560
535
  &nbsp;
561
- </div>
562
- </template>
563
- <template #default>
564
- <MarkdownEditor
565
- :model-value="props.paginationRight ?? ''"
566
- class="w-full h-64"
567
- :variables="[
568
- {
569
- identity: 'selected',
570
- type: 'list<dyn>',
571
- description: $md.raw`
572
- 表格被选中的行:如果没有被选中的行,那么这个变量将始终为空列表。
573
- `
574
- }
575
- ]"
576
- />
577
- </template>
578
- </Dialog>
536
+ </div>
579
537
  </div>
580
538
  </div>
581
539
  </template>
@@ -1,7 +1,7 @@
1
1
  import type { VariantProps } from 'class-variance-authority';
2
2
  export { default as Button } from './Button.vue.js';
3
3
  export declare const buttonVariants: (props?: ({
4
- variant?: "primary" | "default" | "destructive" | "ghost" | null | undefined;
4
+ variant?: "default" | "primary" | "destructive" | "ghost" | null | undefined;
5
5
  size?: "default" | "sm" | "xs" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  export type ButtonVariants = VariantProps<typeof buttonVariants>;
@@ -1,15 +1,12 @@
1
+ import type { HTMLAttributes } from 'vue';
2
+ import type { ButtonGroupVariants } from '.';
1
3
  type __VLS_Props = {
2
- /**
3
- * MD
4
- */
5
- title?: string;
6
- width?: string;
7
- description?: string;
8
- disabled?: boolean;
4
+ class?: HTMLAttributes['class'];
5
+ orientation?: ButtonGroupVariants['orientation'];
9
6
  };
10
- type __VLS_Slots = {
11
- trigger: () => void;
12
- default: () => void;
7
+ declare var __VLS_1: {};
8
+ type __VLS_Slots = {} & {
9
+ default?: (props: typeof __VLS_1) => any;
13
10
  };
14
11
  declare const __VLS_base: 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>;
15
12
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -0,0 +1,19 @@
1
+ <script setup>
2
+ import { cn } from "../../../utils/cn";
3
+ import { buttonGroupVariants } from ".";
4
+ const props = defineProps({
5
+ class: { type: null, required: false },
6
+ orientation: { type: null, required: false }
7
+ });
8
+ </script>
9
+
10
+ <template>
11
+ <div
12
+ role="group"
13
+ data-slot="button-group"
14
+ :data-orientation="props.orientation"
15
+ :class="cn(buttonGroupVariants({ orientation: props.orientation }), props.class)"
16
+ >
17
+ <slot />
18
+ </div>
19
+ </template>
@@ -1,15 +1,12 @@
1
+ import type { HTMLAttributes } from 'vue';
2
+ import type { ButtonGroupVariants } from '.';
1
3
  type __VLS_Props = {
2
- /**
3
- * MD
4
- */
5
- title?: string;
6
- width?: string;
7
- description?: string;
8
- disabled?: boolean;
4
+ class?: HTMLAttributes['class'];
5
+ orientation?: ButtonGroupVariants['orientation'];
9
6
  };
10
- type __VLS_Slots = {
11
- trigger: () => void;
12
- default: () => void;
7
+ declare var __VLS_1: {};
8
+ type __VLS_Slots = {} & {
9
+ default?: (props: typeof __VLS_1) => any;
13
10
  };
14
11
  declare const __VLS_base: 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>;
15
12
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -0,0 +1,10 @@
1
+ import type { SeparatorProps } from 'reka-ui';
2
+ import type { HTMLAttributes } from 'vue';
3
+ type __VLS_Props = SeparatorProps & {
4
+ class?: HTMLAttributes['class'];
5
+ };
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
7
+ orientation: "horizontal" | "vertical";
8
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,25 @@
1
+ <script setup>
2
+ import { reactiveOmit } from "@vueuse/core";
3
+ import { cn } from "../../../utils/cn";
4
+ import { Separator } from "../separator";
5
+ const props = defineProps({
6
+ orientation: { type: String, required: false, default: "vertical" },
7
+ decorative: { type: Boolean, required: false },
8
+ asChild: { type: Boolean, required: false },
9
+ as: { type: null, required: false },
10
+ class: { type: null, required: false }
11
+ });
12
+ const delegatedProps = reactiveOmit(props, "class");
13
+ </script>
14
+
15
+ <template>
16
+ <Separator
17
+ data-slot="button-group-separator"
18
+ v-bind="delegatedProps"
19
+ :orientation="props.orientation"
20
+ :class="cn(
21
+ 'bg-input relative m-0! self-stretch data-[orientation=vertical]:h-auto',
22
+ props.class
23
+ )"
24
+ />
25
+ </template>
@@ -0,0 +1,10 @@
1
+ import type { SeparatorProps } from 'reka-ui';
2
+ import type { HTMLAttributes } from 'vue';
3
+ type __VLS_Props = SeparatorProps & {
4
+ class?: HTMLAttributes['class'];
5
+ };
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
7
+ orientation: "horizontal" | "vertical";
8
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,22 @@
1
+ import type { PrimitiveProps } from 'reka-ui';
2
+ import type { HTMLAttributes } from 'vue';
3
+ import type { ButtonGroupVariants } from '.';
4
+ interface Props extends PrimitiveProps {
5
+ class?: HTMLAttributes['class'];
6
+ orientation?: ButtonGroupVariants['orientation'];
7
+ }
8
+ declare var __VLS_8: {};
9
+ type __VLS_Slots = {} & {
10
+ default?: (props: typeof __VLS_8) => any;
11
+ };
12
+ declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
13
+ as: import("reka-ui").AsTag | import("vue").Component;
14
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
16
+ declare const _default: typeof __VLS_export;
17
+ export default _default;
18
+ type __VLS_WithSlots<T, S> = T & {
19
+ new (): {
20
+ $slots: S;
21
+ };
22
+ };
@@ -0,0 +1,23 @@
1
+ <script setup>
2
+ import { Primitive } from "reka-ui";
3
+ import { cn } from "../../../utils/cn";
4
+ const props = defineProps({
5
+ class: { type: null, required: false },
6
+ orientation: { type: null, required: false },
7
+ asChild: { type: Boolean, required: false },
8
+ as: { type: null, required: false, default: "div" }
9
+ });
10
+ </script>
11
+
12
+ <template>
13
+ <Primitive
14
+ role="group"
15
+ data-slot="button-group"
16
+ :data-orientation="props.orientation"
17
+ :as="as"
18
+ :as-child="asChild"
19
+ :class="cn('bg-muted flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*=\'size-\'])]:size-4', props.class)"
20
+ >
21
+ <slot />
22
+ </Primitive>
23
+ </template>
@@ -0,0 +1,22 @@
1
+ import type { PrimitiveProps } from 'reka-ui';
2
+ import type { HTMLAttributes } from 'vue';
3
+ import type { ButtonGroupVariants } from '.';
4
+ interface Props extends PrimitiveProps {
5
+ class?: HTMLAttributes['class'];
6
+ orientation?: ButtonGroupVariants['orientation'];
7
+ }
8
+ declare var __VLS_8: {};
9
+ type __VLS_Slots = {} & {
10
+ default?: (props: typeof __VLS_8) => any;
11
+ };
12
+ declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
13
+ as: import("reka-ui").AsTag | import("vue").Component;
14
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
16
+ declare const _default: typeof __VLS_export;
17
+ export default _default;
18
+ type __VLS_WithSlots<T, S> = T & {
19
+ new (): {
20
+ $slots: S;
21
+ };
22
+ };
@@ -0,0 +1,8 @@
1
+ import type { VariantProps } from 'class-variance-authority';
2
+ export { default as ButtonGroup } from './ButtonGroup.vue.js';
3
+ export { default as ButtonGroupSeparator } from './ButtonGroupSeparator.vue.js';
4
+ export { default as ButtonGroupText } from './ButtonGroupText.vue.js';
5
+ export declare const buttonGroupVariants: (props?: ({
6
+ orientation?: "horizontal" | "vertical" | null | undefined;
7
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
+ export type ButtonGroupVariants = VariantProps<typeof buttonGroupVariants>;
@@ -0,0 +1,18 @@
1
+ import { cva } from "class-variance-authority";
2
+ export { default as ButtonGroup } from "./ButtonGroup.vue";
3
+ export { default as ButtonGroupSeparator } from "./ButtonGroupSeparator.vue";
4
+ export { default as ButtonGroupText } from "./ButtonGroupText.vue";
5
+ export const buttonGroupVariants = cva(
6
+ "flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",
7
+ {
8
+ variants: {
9
+ orientation: {
10
+ horizontal: "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
11
+ vertical: "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"
12
+ }
13
+ },
14
+ defaultVariants: {
15
+ orientation: "horizontal"
16
+ }
17
+ }
18
+ );
@@ -0,0 +1,20 @@
1
+ import type { TooltipRootProps } from 'reka-ui';
2
+ declare var __VLS_8: {
3
+ open: boolean;
4
+ };
5
+ type __VLS_Slots = {} & {
6
+ default?: (props: typeof __VLS_8) => any;
7
+ };
8
+ declare const __VLS_base: import("vue").DefineComponent<TooltipRootProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
+ "update:open": (value: boolean) => any;
10
+ }, string, import("vue").PublicProps, Readonly<TooltipRootProps> & Readonly<{
11
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
12
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
16
+ type __VLS_WithSlots<T, S> = T & {
17
+ new (): {
18
+ $slots: S;
19
+ };
20
+ };
@@ -0,0 +1,24 @@
1
+ <script setup>
2
+ import { TooltipRoot, useForwardPropsEmits } from "reka-ui";
3
+ const props = defineProps({
4
+ defaultOpen: { type: Boolean, required: false },
5
+ open: { type: Boolean, required: false },
6
+ delayDuration: { type: Number, required: false },
7
+ disableHoverableContent: { type: Boolean, required: false },
8
+ disableClosingTrigger: { type: Boolean, required: false },
9
+ disabled: { type: Boolean, required: false },
10
+ ignoreNonKeyboardFocus: { type: Boolean, required: false }
11
+ });
12
+ const emits = defineEmits(["update:open"]);
13
+ const forwarded = useForwardPropsEmits(props, emits);
14
+ </script>
15
+
16
+ <template>
17
+ <TooltipRoot
18
+ v-slot="slotProps"
19
+ data-slot="tooltip"
20
+ v-bind="forwarded"
21
+ >
22
+ <slot v-bind="slotProps" />
23
+ </TooltipRoot>
24
+ </template>
@@ -0,0 +1,20 @@
1
+ import type { TooltipRootProps } from 'reka-ui';
2
+ declare var __VLS_8: {
3
+ open: boolean;
4
+ };
5
+ type __VLS_Slots = {} & {
6
+ default?: (props: typeof __VLS_8) => any;
7
+ };
8
+ declare const __VLS_base: import("vue").DefineComponent<TooltipRootProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
+ "update:open": (value: boolean) => any;
10
+ }, string, import("vue").PublicProps, Readonly<TooltipRootProps> & Readonly<{
11
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
12
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
16
+ type __VLS_WithSlots<T, S> = T & {
17
+ new (): {
18
+ $slots: S;
19
+ };
20
+ };
@@ -1,16 +1,21 @@
1
- import { type TooltipRootProps } from 'reka-ui';
2
- type __VLS_Props = TooltipRootProps & {
3
- content?: string;
1
+ import type { TooltipContentProps } from 'reka-ui';
2
+ import type { HTMLAttributes } from 'vue';
3
+ type __VLS_Props = TooltipContentProps & {
4
+ class?: HTMLAttributes['class'];
4
5
  };
5
6
  declare var __VLS_14: {};
6
7
  type __VLS_Slots = {} & {
7
8
  default?: (props: typeof __VLS_14) => any;
8
9
  };
9
10
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
- "update:open": (value: boolean) => any;
11
+ escapeKeyDown: (event: KeyboardEvent) => any;
12
+ pointerDownOutside: (event: Event) => any;
11
13
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
- "onUpdate:open"?: ((value: boolean) => any) | undefined;
13
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ onEscapeKeyDown?: ((event: KeyboardEvent) => any) | undefined;
15
+ onPointerDownOutside?: ((event: Event) => any) | undefined;
16
+ }>, {
17
+ sideOffset: number;
18
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
19
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
15
20
  declare const _default: typeof __VLS_export;
16
21
  export default _default;
@@ -0,0 +1,58 @@
1
+ <script setup>
2
+ import { reactiveOmit } from "@vueuse/core";
3
+ import { TooltipArrow, TooltipContent, TooltipPortal, useForwardPropsEmits } from "reka-ui";
4
+ import { cn } from "../../../utils/cn";
5
+ defineOptions({
6
+ inheritAttrs: false
7
+ });
8
+ const props = defineProps({
9
+ forceMount: { type: Boolean, required: false },
10
+ ariaLabel: { type: String, required: false },
11
+ asChild: { type: Boolean, required: false },
12
+ as: { type: null, required: false },
13
+ side: { type: null, required: false },
14
+ sideOffset: { type: Number, required: false, default: 4 },
15
+ align: { type: null, required: false },
16
+ alignOffset: { type: Number, required: false },
17
+ avoidCollisions: { type: Boolean, required: false },
18
+ collisionBoundary: { type: null, required: false },
19
+ collisionPadding: { type: [Number, Object], required: false },
20
+ arrowPadding: { type: Number, required: false },
21
+ sticky: { type: String, required: false },
22
+ hideWhenDetached: { type: Boolean, required: false },
23
+ positionStrategy: { type: String, required: false },
24
+ updatePositionStrategy: { type: String, required: false },
25
+ class: { type: null, required: false }
26
+ });
27
+ const emits = defineEmits(["escapeKeyDown", "pointerDownOutside"]);
28
+ const delegatedProps = reactiveOmit(props, "class");
29
+ const forwarded = useForwardPropsEmits(delegatedProps, emits);
30
+ </script>
31
+
32
+ <template>
33
+ <TooltipPortal>
34
+ <TooltipContent
35
+ data-slot="tooltip-content"
36
+ v-bind="{ ...forwarded, ...$attrs }"
37
+ :class="cn(
38
+ 'bg-white text-zinc-700 animate-in fade-in-0 zoom-in-95',
39
+ 'data-[state=closed]:animate-out data-[state=closed]:fade-out-0',
40
+ 'data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2',
41
+ 'data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2',
42
+ 'data-[side=top]:slide-in-from-bottom-2',
43
+ 'z-1024 w-fit rounded border border-zinc-200 px-6 py-2 text-xs',
44
+ 'text-balance shadow-md',
45
+ props.class
46
+ )"
47
+ >
48
+ <slot />
49
+
50
+ <TooltipArrow
51
+ :class="[
52
+ 'bg-white fill-white size-2.5 translate-y-[calc(-50%)] rotate-45 rounded-xs',
53
+ 'border-b border-r border-zinc-200'
54
+ ]"
55
+ />
56
+ </TooltipContent>
57
+ </TooltipPortal>
58
+ </template>
@@ -1,16 +1,21 @@
1
- import { type TooltipRootProps } from 'reka-ui';
2
- type __VLS_Props = TooltipRootProps & {
3
- content?: string;
1
+ import type { TooltipContentProps } from 'reka-ui';
2
+ import type { HTMLAttributes } from 'vue';
3
+ type __VLS_Props = TooltipContentProps & {
4
+ class?: HTMLAttributes['class'];
4
5
  };
5
6
  declare var __VLS_14: {};
6
7
  type __VLS_Slots = {} & {
7
8
  default?: (props: typeof __VLS_14) => any;
8
9
  };
9
10
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
- "update:open": (value: boolean) => any;
11
+ escapeKeyDown: (event: KeyboardEvent) => any;
12
+ pointerDownOutside: (event: Event) => any;
11
13
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
- "onUpdate:open"?: ((value: boolean) => any) | undefined;
13
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ onEscapeKeyDown?: ((event: KeyboardEvent) => any) | undefined;
15
+ onPointerDownOutside?: ((event: Event) => any) | undefined;
16
+ }>, {
17
+ sideOffset: number;
18
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
19
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
15
20
  declare const _default: typeof __VLS_export;
16
21
  export default _default;
@@ -0,0 +1,16 @@
1
+ import type { TooltipProviderProps } 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<TooltipProviderProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TooltipProviderProps> & Readonly<{}>, {
7
+ delayDuration: number;
8
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
12
+ type __VLS_WithSlots<T, S> = T & {
13
+ new (): {
14
+ $slots: S;
15
+ };
16
+ };
@@ -0,0 +1,17 @@
1
+ <script setup>
2
+ import { TooltipProvider } from "reka-ui";
3
+ const props = defineProps({
4
+ delayDuration: { type: Number, required: false, default: 0 },
5
+ skipDelayDuration: { type: Number, required: false },
6
+ disableHoverableContent: { type: Boolean, required: false },
7
+ disableClosingTrigger: { type: Boolean, required: false },
8
+ disabled: { type: Boolean, required: false },
9
+ ignoreNonKeyboardFocus: { type: Boolean, required: false }
10
+ });
11
+ </script>
12
+
13
+ <template>
14
+ <TooltipProvider v-bind="props">
15
+ <slot />
16
+ </TooltipProvider>
17
+ </template>
@@ -0,0 +1,16 @@
1
+ import type { TooltipProviderProps } 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<TooltipProviderProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TooltipProviderProps> & Readonly<{}>, {
7
+ delayDuration: number;
8
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
12
+ type __VLS_WithSlots<T, S> = T & {
13
+ new (): {
14
+ $slots: S;
15
+ };
16
+ };
@@ -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,9 @@
1
1
  import { Environment } from '@marcbachmann/cel-js';
2
+ import type { Table } from '@tanstack/vue-table';
3
+ export declare class TableWrapper {
4
+ private readonly table;
5
+ constructor(table: Table<unknown>);
6
+ get size(): number;
7
+ get selected(): ReadonlyArray<unknown>;
8
+ }
2
9
  export declare function createEnvironment(): Environment;
@@ -1,6 +1,17 @@
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 class TableWrapper {
5
+ constructor(table) {
6
+ this.table = table;
7
+ }
8
+ get size() {
9
+ return this.table.getRowCount();
10
+ }
11
+ get selected() {
12
+ return this.table.getSelectedRowModel().rows.map((row) => row.original);
13
+ }
14
+ }
4
15
  export function createEnvironment() {
5
16
  const env = new Environment({
6
17
  enableOptionalTypes: true,
@@ -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;
@@ -8,16 +8,16 @@ export default defineNuxtPlugin({
8
8
  return {
9
9
  provide: {
10
10
  dsl: {
11
- check: (source) => {
12
- return env.check(source);
11
+ check: (...args) => {
12
+ return env.check(String.raw(...args));
13
13
  },
14
14
  /**
15
15
  * Synchronous evaluation for render-time usage (e.g. table accessors).
16
16
  *
17
17
  * Will throw `TypeError` / `EvaluationError` on failure.
18
18
  */
19
- evaluate: (source, context) => {
20
- return env.evaluate(source, defu(context, {
19
+ evaluate: (...args) => (context) => {
20
+ return env.evaluate(String.raw(...args), defu(context, {
21
21
  now: /* @__PURE__ */ new Date()
22
22
  }));
23
23
  }
@@ -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 "";
@@ -197,7 +197,7 @@ defineTableRenderer(
197
197
  try {
198
198
  let text = String(ctx.cell.getValue());
199
199
  if (options.copyExpression) {
200
- text = String($dsl.evaluate(options.copyExpression, {
200
+ text = String($dsl.evaluate`${options.copyExpression}`({
201
201
  row: ctx.row.original,
202
202
  index: BigInt(ctx.row.index)
203
203
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -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>