@shwfed/nuxt 0.1.21 → 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 (87) 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 +55 -0
  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 +4 -0
  9. package/dist/runtime/components/table.vue.d.ts +12 -3
  10. package/dist/runtime/components/ui/button-group/ButtonGroupSeparator.d.vue.ts +1 -1
  11. package/dist/runtime/components/ui/button-group/ButtonGroupSeparator.vue.d.ts +1 -1
  12. package/dist/runtime/components/ui/button-group/index.d.ts +1 -1
  13. package/dist/runtime/components/ui/checkbox/Checkbox.d.vue.ts +25 -0
  14. package/dist/runtime/components/ui/checkbox/Checkbox.vue +47 -0
  15. package/dist/runtime/components/ui/checkbox/Checkbox.vue.d.ts +25 -0
  16. package/dist/runtime/components/ui/checkbox/index.d.ts +1 -0
  17. package/dist/runtime/components/ui/checkbox/index.js +1 -0
  18. package/dist/runtime/components/ui/command/Command.d.vue.ts +36 -0
  19. package/dist/runtime/components/ui/command/Command.vue +81 -0
  20. package/dist/runtime/components/ui/command/Command.vue.d.ts +36 -0
  21. package/dist/runtime/components/ui/command/CommandDialog.d.vue.ts +28 -0
  22. package/dist/runtime/components/ui/command/CommandDialog.vue +34 -0
  23. package/dist/runtime/components/ui/command/CommandDialog.vue.d.ts +28 -0
  24. package/dist/runtime/components/ui/command/CommandEmpty.d.vue.ts +18 -0
  25. package/dist/runtime/components/ui/command/CommandEmpty.vue +28 -0
  26. package/dist/runtime/components/ui/command/CommandEmpty.vue.d.ts +18 -0
  27. package/dist/runtime/components/ui/command/CommandGroup.d.vue.ts +19 -0
  28. package/dist/runtime/components/ui/command/CommandGroup.vue +44 -0
  29. package/dist/runtime/components/ui/command/CommandGroup.vue.d.ts +19 -0
  30. package/dist/runtime/components/ui/command/CommandInput.d.vue.ts +8 -0
  31. package/dist/runtime/components/ui/command/CommandInput.vue +40 -0
  32. package/dist/runtime/components/ui/command/CommandInput.vue.d.ts +8 -0
  33. package/dist/runtime/components/ui/command/CommandItem.d.vue.ts +22 -0
  34. package/dist/runtime/components/ui/command/CommandItem.vue +65 -0
  35. package/dist/runtime/components/ui/command/CommandItem.vue.d.ts +22 -0
  36. package/dist/runtime/components/ui/command/CommandList.d.vue.ts +18 -0
  37. package/dist/runtime/components/ui/command/CommandList.vue +24 -0
  38. package/dist/runtime/components/ui/command/CommandList.vue.d.ts +18 -0
  39. package/dist/runtime/components/ui/command/CommandSeparator.d.vue.ts +18 -0
  40. package/dist/runtime/components/ui/command/CommandSeparator.vue +23 -0
  41. package/dist/runtime/components/ui/command/CommandSeparator.vue.d.ts +18 -0
  42. package/dist/runtime/components/ui/command/CommandShortcut.d.vue.ts +17 -0
  43. package/dist/runtime/components/ui/command/CommandShortcut.vue +15 -0
  44. package/dist/runtime/components/ui/command/CommandShortcut.vue.d.ts +17 -0
  45. package/dist/runtime/components/ui/command/index.d.ts +90 -0
  46. package/dist/runtime/components/ui/command/index.js +12 -0
  47. package/dist/runtime/components/ui/dialog/Dialog.d.vue.ts +21 -0
  48. package/dist/runtime/components/ui/dialog/Dialog.vue +20 -0
  49. package/dist/runtime/components/ui/dialog/Dialog.vue.d.ts +21 -0
  50. package/dist/runtime/components/ui/dialog/DialogClose.d.vue.ts +14 -0
  51. package/dist/runtime/components/ui/dialog/DialogClose.vue +16 -0
  52. package/dist/runtime/components/ui/dialog/DialogClose.vue.d.ts +14 -0
  53. package/dist/runtime/components/ui/dialog/DialogContent.d.vue.ts +35 -0
  54. package/dist/runtime/components/ui/dialog/DialogContent.vue +53 -0
  55. package/dist/runtime/components/ui/dialog/DialogContent.vue.d.ts +35 -0
  56. package/dist/runtime/components/ui/dialog/DialogDescription.d.vue.ts +18 -0
  57. package/dist/runtime/components/ui/dialog/DialogDescription.vue +22 -0
  58. package/dist/runtime/components/ui/dialog/DialogDescription.vue.d.ts +18 -0
  59. package/dist/runtime/components/ui/dialog/DialogFooter.d.vue.ts +17 -0
  60. package/dist/runtime/components/ui/dialog/DialogFooter.vue +15 -0
  61. package/dist/runtime/components/ui/dialog/DialogFooter.vue.d.ts +17 -0
  62. package/dist/runtime/components/ui/dialog/DialogHeader.d.vue.ts +17 -0
  63. package/dist/runtime/components/ui/dialog/DialogHeader.vue +15 -0
  64. package/dist/runtime/components/ui/dialog/DialogHeader.vue.d.ts +17 -0
  65. package/dist/runtime/components/ui/dialog/DialogOverlay.d.vue.ts +18 -0
  66. package/dist/runtime/components/ui/dialog/DialogOverlay.vue +22 -0
  67. package/dist/runtime/components/ui/dialog/DialogOverlay.vue.d.ts +18 -0
  68. package/dist/runtime/components/ui/dialog/DialogScrollContent.d.vue.ts +32 -0
  69. package/dist/runtime/components/ui/dialog/DialogScrollContent.vue +58 -0
  70. package/dist/runtime/components/ui/dialog/DialogScrollContent.vue.d.ts +32 -0
  71. package/dist/runtime/components/ui/dialog/DialogTitle.d.vue.ts +18 -0
  72. package/dist/runtime/components/ui/dialog/DialogTitle.vue +22 -0
  73. package/dist/runtime/components/ui/dialog/DialogTitle.vue.d.ts +18 -0
  74. package/dist/runtime/components/ui/dialog/DialogTrigger.d.vue.ts +14 -0
  75. package/dist/runtime/components/ui/dialog/DialogTrigger.vue +16 -0
  76. package/dist/runtime/components/ui/dialog/DialogTrigger.vue.d.ts +14 -0
  77. package/dist/runtime/components/ui/dialog/index.d.ts +10 -0
  78. package/dist/runtime/components/ui/dialog/index.js +10 -0
  79. package/dist/runtime/components/ui/separator/Separator.d.vue.ts +1 -1
  80. package/dist/runtime/components/ui/separator/Separator.vue.d.ts +1 -1
  81. package/dist/runtime/plugins/cel/env.d.ts +5 -8
  82. package/dist/runtime/plugins/cel/env.js +3 -12
  83. package/dist/runtime/plugins/cel/index.js +4 -2
  84. package/dist/runtime/plugins/i18n/index.d.ts +2 -0
  85. package/dist/runtime/plugins/i18n/index.js +14 -0
  86. package/dist/runtime/table-renderers/builtins.js +12 -29
  87. package/package.json +3 -1
@@ -0,0 +1,10 @@
1
+ export { default as Dialog } from "./Dialog.vue";
2
+ export { default as DialogClose } from "./DialogClose.vue";
3
+ export { default as DialogContent } from "./DialogContent.vue";
4
+ export { default as DialogDescription } from "./DialogDescription.vue";
5
+ export { default as DialogFooter } from "./DialogFooter.vue";
6
+ export { default as DialogHeader } from "./DialogHeader.vue";
7
+ export { default as DialogOverlay } from "./DialogOverlay.vue";
8
+ export { default as DialogScrollContent } from "./DialogScrollContent.vue";
9
+ export { default as DialogTitle } from "./DialogTitle.vue";
10
+ export { default as DialogTrigger } from "./DialogTrigger.vue";
@@ -4,7 +4,7 @@ type __VLS_Props = SeparatorProps & {
4
4
  class?: HTMLAttributes['class'];
5
5
  };
6
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";
7
+ orientation: "vertical" | "horizontal";
8
8
  decorative: boolean;
9
9
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
10
  declare const _default: typeof __VLS_export;
@@ -4,7 +4,7 @@ type __VLS_Props = SeparatorProps & {
4
4
  class?: HTMLAttributes['class'];
5
5
  };
6
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";
7
+ orientation: "vertical" | "horizontal";
8
8
  decorative: boolean;
9
9
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
10
  declare const _default: typeof __VLS_export;
@@ -1,9 +1,6 @@
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
- }
9
- 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,18 +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 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
- }
15
- export function createEnvironment() {
4
+ export function createEnvironment(options) {
16
5
  const env = new Environment({
17
6
  enableOptionalTypes: true,
18
7
  homogeneousAggregateLiterals: false,
@@ -88,6 +77,8 @@ export function createEnvironment() {
88
77
  }
89
78
  }).registerFunction("Date.format(string): string", (date, format) => {
90
79
  return formatDate(date, format);
80
+ }).registerFunction("feature(string): bool", (feature) => {
81
+ return (options?.features ?? []).includes(feature);
91
82
  });
92
83
  return env;
93
84
  }
@@ -3,8 +3,10 @@ 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: {
@@ -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
+ });
@@ -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",
@@ -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.21",
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
  },