@dynect/base 0.5.0 → 0.7.1

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 (35) hide show
  1. package/package.json +1 -1
  2. package/src/module.ts +24 -5
  3. package/src/runtime/components/base/event-calendar/EventModal.vue +1 -0
  4. package/src/runtime/components/base/event-calendar/composables/useAdvancedValidation.ts +1 -0
  5. package/src/runtime/components/base/event-calendar/composables/useColorManager.ts +1 -0
  6. package/src/runtime/components/base/event-calendar/composables/useCompatibility.ts +1 -0
  7. package/src/runtime/components/base/event-calendar/composables/useDragAndDrop.ts +1 -0
  8. package/src/runtime/components/base/event-calendar/composables/useEventFiltering.ts +1 -0
  9. package/src/runtime/components/base/event-calendar/composables/useEventStatus.ts +1 -0
  10. package/src/runtime/components/base/event-calendar/composables/useEventStore.ts +1 -0
  11. package/src/runtime/components/base/event-calendar/composables/useExternalCalendar.ts +1 -0
  12. package/src/runtime/components/base/event-calendar/composables/useKeyboardNavigation.ts +1 -0
  13. package/src/runtime/components/base/event-calendar/composables/useMonitoring.ts +1 -0
  14. package/src/runtime/components/base/event-calendar/composables/useMultiDayLayout.ts +1 -0
  15. package/src/runtime/components/base/event-calendar/composables/usePerformanceCache.ts +1 -0
  16. package/src/runtime/components/base/event-calendar/composables/useRecurringEvents.ts +1 -0
  17. package/src/runtime/components/base/event-calendar/composables/useSecurity.ts +1 -0
  18. package/src/runtime/components/base/event-calendar/composables/useTimezone.ts +1 -0
  19. package/src/runtime/components/base/signature/index.vue +1 -0
  20. package/src/runtime/components/dynect/Autocomplete.vue +1 -0
  21. package/src/runtime/components/dynect/Checkbox.vue +1 -0
  22. package/src/runtime/components/dynect/DatePicker.vue +1 -0
  23. package/src/runtime/components/dynect/DateRange.vue +1 -0
  24. package/src/runtime/components/dynect/Dropzone.vue +1 -0
  25. package/src/runtime/components/dynect/Input.vue +1 -0
  26. package/src/runtime/components/dynect/OtpInput.vue +1 -0
  27. package/src/runtime/components/dynect/Radio.vue +1 -0
  28. package/src/runtime/components/dynect/Select.vue +1 -0
  29. package/src/runtime/components/dynect/SelectMultiple.vue +1 -0
  30. package/src/runtime/components/dynect/Signature.vue +1 -0
  31. package/src/runtime/components/dynect/TagsInput.vue +1 -0
  32. package/src/runtime/components/dynect/Textarea.vue +1 -0
  33. package/src/runtime/components/dynect/TimePicker.vue +1 -0
  34. package/src/runtime/components/dynect/Toggle.vue +1 -0
  35. package/src/runtime/utils/function.ts +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynect/base",
3
- "version": "0.5.0",
3
+ "version": "0.7.1",
4
4
  "description": "Reusable Nuxt base module — components, composables, utils, plugins and i18n from the Dynect design system.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/module.ts CHANGED
@@ -71,21 +71,40 @@ export default defineNuxtModule<DynectBaseOptions>({
71
71
 
72
72
  // ── Path aliases for intra-package imports ───────────────────────────────
73
73
  // Dynect components use @/components/ui/* and @/lib/utils.
74
- // In standalone mode, @/ resolves to the consuming app's srcDir which won't
75
- // have those paths redirect them to the bundled runtime copies.
74
+ // nuxt.options.alias cannot intercept these because Vite first expands @→srcDir
75
+ // and stops alias processing. We must hook into vite:extendConfig and prepend
76
+ // regex aliases so they match *before* the @ alias fires.
76
77
 
77
78
  const srcDir = nuxt.options.srcDir;
78
79
 
79
80
  // @/lib/utils → runtime/lib/utils (when not present in consuming app)
81
+ // This one works via nuxt.options.alias because lib/utils is not prefixed with @
80
82
  if (!existsSync(join(srcDir, 'lib', 'utils.ts'))) {
81
83
  nuxt.options.alias[join(srcDir, 'lib', 'utils')] =
82
84
  resolver.resolve('./runtime/lib/utils');
83
85
  }
84
86
 
85
- // @/components/ui/* → runtime/components/ui/* (when not present in consuming app)
87
+ // @/components/ui/* → runtime/components/ui/*
88
+ // Must run BEFORE @ is resolved, so we use a regex alias in vite:extendConfig.
89
+ // Only applied when the consuming app has no own components/ui directory.
86
90
  if (isStandalone && !existsSync(join(srcDir, 'components', 'ui'))) {
87
- nuxt.options.alias[join(srcDir, 'components', 'ui')] =
88
- join(runtimeComponentsDir, 'ui');
91
+ const uiRuntimePath = join(runtimeComponentsDir, 'ui');
92
+
93
+ nuxt.hook('vite:extendConfig', (config) => {
94
+ config.resolve ??= {};
95
+
96
+ const entry = { find: /^[@~]\/components\/ui/, replacement: uiRuntimePath };
97
+
98
+ if (Array.isArray(config.resolve.alias)) {
99
+ (config.resolve.alias as any[]).unshift(entry);
100
+ } else {
101
+ const existing = config.resolve.alias ?? {};
102
+ config.resolve.alias = [
103
+ entry,
104
+ ...Object.entries(existing).map(([find, replacement]) => ({ find, replacement })),
105
+ ];
106
+ }
107
+ });
89
108
  }
90
109
 
91
110
  // ── Install required Nuxt modules ────────────────────────────────────────
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { useId } from 'nuxt/app';
2
3
  import { onKeyStroke } from '@vueuse/core';
3
4
  import { toDate } from 'reka-ui/date';
4
5
  import { fromDate, CalendarDate, type DateValue, today, getLocalTimeZone } from '@internationalized/date';
@@ -1,3 +1,4 @@
1
+ import { readonly, ref } from 'vue';
1
2
  import type { CalendarEvent, RecurringPattern } from '../types';
2
3
 
3
4
  interface ValidationRule<T = any> {
@@ -1,3 +1,4 @@
1
+ import { type Ref, computed, ref } from 'vue';
1
2
  import type { CalendarEvent, EventColor } from '../types';
2
3
 
3
4
  export interface ColorConfig {
@@ -1,3 +1,4 @@
1
+ import { readonly, ref } from 'vue';
1
2
  interface BrowserCapabilities {
2
3
  hasNativeUUID: boolean;
3
4
  hasResizeObserver: boolean;
@@ -1,3 +1,4 @@
1
+ import { computed, reactive, ref } from 'vue';
1
2
  import { makeDraggable, makeDroppable, type IDragEvent } from '@vue-dnd-kit/core';
2
3
  import type { CalendarEvent } from '../types';
3
4
  import { useCalendarUtils } from './useCalendarUtils';
@@ -1,3 +1,4 @@
1
+ import { type ComputedRef, computed } from 'vue';
1
2
  import type { CalendarEvent } from '../types';
2
3
 
3
4
  /**
@@ -1,3 +1,4 @@
1
+ import { type ComputedRef, computed } from 'vue';
1
2
  import type { CalendarEvent, EventStatus } from '../types';
2
3
 
3
4
  export function useEventStatus(events: ComputedRef<CalendarEvent[]>) {
@@ -1,3 +1,4 @@
1
+ import { computed, reactive, readonly, ref } from 'vue';
1
2
  import type { CalendarEvent } from '../types';
2
3
  import { usePerformanceCache } from './usePerformanceCache';
3
4
 
@@ -1,3 +1,4 @@
1
+ import { type ComputedRef, computed, readonly, ref } from 'vue';
1
2
  import type { CalendarEvent } from '../types';
2
3
 
3
4
  export interface ExternalCalendarProvider {
@@ -1,3 +1,4 @@
1
+ import { type Ref, ref } from 'vue';
1
2
  import { onKeyStroke } from '@vueuse/core';
2
3
  import type { ViewMode } from '../types';
3
4
 
@@ -1,3 +1,4 @@
1
+ import { onMounted, readonly, ref } from 'vue';
1
2
  interface PerformanceMetric {
2
3
  name: string;
3
4
  value: number;
@@ -1,3 +1,4 @@
1
+ import { type ComputedRef, computed } from 'vue';
1
2
  import type { CalendarEvent, MonthViewDay } from '../types';
2
3
 
3
4
  export interface LayoutEvent extends CalendarEvent {
@@ -1,3 +1,4 @@
1
+ import { computed, readonly, ref } from 'vue';
1
2
  interface CacheEntry<T> {
2
3
  value: T;
3
4
  timestamp: number;
@@ -1,3 +1,4 @@
1
+ import { type ComputedRef, computed } from 'vue';
1
2
  import type { CalendarEvent, RecurringPattern } from '../types';
2
3
 
3
4
  export function useRecurringEvents(events: ComputedRef<CalendarEvent[]>) {
@@ -1,3 +1,4 @@
1
+ import { readonly, ref } from 'vue';
1
2
  import type { CalendarEvent } from '../types';
2
3
 
3
4
  interface SecurityConfig {
@@ -1,3 +1,4 @@
1
+ import { type ComputedRef, computed, ref } from 'vue';
1
2
  import type { CalendarEvent } from '../types';
2
3
  import { getLocalTimeZone } from '@internationalized/date';
3
4
 
@@ -5,6 +5,7 @@
5
5
  </template>
6
6
 
7
7
  <script setup lang="ts">
8
+ import { useId } from 'nuxt/app';
8
9
  import SignaturePad from 'signature_pad';
9
10
 
10
11
  interface SigOption {
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { useId } from 'nuxt/app';
2
3
  import type { HTMLAttributes } from 'vue';
3
4
  import { cva } from 'class-variance-authority';
4
5
  import { cn } from '@/lib/utils';
@@ -41,6 +41,7 @@
41
41
  </template>
42
42
 
43
43
  <script setup lang="ts">
44
+ import { useId } from 'nuxt/app';
44
45
  import { cn } from '@/lib/utils';
45
46
 
46
47
  export interface AppCheckboxProps {
@@ -50,6 +50,7 @@
50
50
  </template>
51
51
 
52
52
  <script setup lang="ts">
53
+ import { useId } from 'nuxt/app';
53
54
  import type { DateValue } from '@internationalized/date';
54
55
  import { DateFormatter, getLocalTimeZone, parseDate, today } from '@internationalized/date';
55
56
  import { cn } from '@/lib/utils';
@@ -53,6 +53,7 @@
53
53
  </template>
54
54
 
55
55
  <script setup lang="ts">
56
+ import { useId } from 'nuxt/app';
56
57
  import type { DateValue } from '@internationalized/date';
57
58
  import { DateFormatter, getLocalTimeZone, today, parseDate } from '@internationalized/date';
58
59
  import { cn } from '@/lib/utils';
@@ -95,6 +95,7 @@
95
95
  </template>
96
96
 
97
97
  <script setup lang="ts">
98
+ import { useId } from 'nuxt/app';
98
99
  import type { HTMLAttributes } from 'vue';
99
100
 
100
101
  defineOptions({
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { useId } from 'nuxt/app';
2
3
  import type { HTMLAttributes } from 'vue';
3
4
  import { cva } from 'class-variance-authority';
4
5
  import { cn, inputSizeClasses } from '@/lib/utils';
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { useId } from 'nuxt/app';
2
3
  import type { HTMLAttributes } from 'vue';
3
4
  import type { OTPInputEmits, OTPInputProps } from 'vue-input-otp';
4
5
  import { useForwardPropsEmits } from 'reka-ui';
@@ -37,6 +37,7 @@
37
37
  </template>
38
38
 
39
39
  <script setup lang="ts">
40
+ import { useId } from 'nuxt/app';
40
41
  import { cn } from '@/lib/utils';
41
42
 
42
43
  defineOptions({
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { useId } from 'nuxt/app';
2
3
  import type { HTMLAttributes } from 'vue';
3
4
  import { cva } from 'class-variance-authority';
4
5
  import { cn, inputSizeClasses } from '@/lib/utils';
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { useId } from 'nuxt/app';
2
3
  import type { HTMLAttributes } from 'vue';
3
4
  import { cva } from 'class-variance-authority';
4
5
  import { cn, inputSizeClasses } from '@/lib/utils';
@@ -20,6 +20,7 @@
20
20
  </template>
21
21
 
22
22
  <script setup lang="ts">
23
+ import { useId } from 'nuxt/app';
23
24
  interface BaseSignatureInstance {
24
25
  save: (format?: string) => string;
25
26
  clear: () => void;
@@ -101,6 +101,7 @@
101
101
  </template>
102
102
 
103
103
  <script setup lang="ts">
104
+ import { useId } from 'nuxt/app';
104
105
  import { onClickOutside } from '@vueuse/core';
105
106
  import { cva } from 'class-variance-authority';
106
107
  import { cn, inputSizeClasses } from '@/lib/utils';
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { useId } from 'nuxt/app';
2
3
  import type { HTMLAttributes } from 'vue';
3
4
  import { cva } from 'class-variance-authority';
4
5
  import { cn, inputSizeClasses } from '@/lib/utils';
@@ -87,6 +87,7 @@
87
87
  </template>
88
88
 
89
89
  <script setup lang="ts">
90
+ import { useId } from 'nuxt/app';
90
91
  import { cn } from '@/lib/utils';
91
92
 
92
93
  defineOptions({
@@ -60,6 +60,7 @@
60
60
  </template>
61
61
 
62
62
  <script setup lang="ts">
63
+ import { useId } from 'nuxt/app';
63
64
  import { cn } from '@/lib/utils';
64
65
 
65
66
  export interface ToggleProps {
@@ -1,5 +1,6 @@
1
1
  import country from '@/assets/files/country.json';
2
2
  import { isValidPhoneNumber, parsePhoneNumberFromString, type CountryCode } from 'libphonenumber-js/max';
3
+ import { useState } from 'nuxt/app';
3
4
 
4
5
  interface CountryData {
5
6
  name: string;