@dynect/base 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynect/base",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
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
@@ -69,15 +69,25 @@ export default defineNuxtModule<DynectBaseOptions>({
69
69
  const isStandalone = existsSync(join(runtimeComponentsDir, 'dynect'));
70
70
  const componentsBase = isStandalone ? runtimeComponentsDir : monorepoComponentsDir;
71
71
 
72
- // ── Ensure ~/lib/utils is available in the consuming app ─────────────────
73
- // Components import { cn } from '~/lib/utils'. If the consuming app does
74
- // not have that file we point the resolver at the bundled copy.
75
- const consumingLibUtils = join(nuxt.options.srcDir, 'lib', 'utils.ts');
76
- if (!existsSync(consumingLibUtils)) {
77
- nuxt.options.alias[join(nuxt.options.srcDir, 'lib', 'utils')] =
72
+ // ── Path aliases for intra-package imports ───────────────────────────────
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.
76
+
77
+ const srcDir = nuxt.options.srcDir;
78
+
79
+ // @/lib/utils → runtime/lib/utils (when not present in consuming app)
80
+ if (!existsSync(join(srcDir, 'lib', 'utils.ts'))) {
81
+ nuxt.options.alias[join(srcDir, 'lib', 'utils')] =
78
82
  resolver.resolve('./runtime/lib/utils');
79
83
  }
80
84
 
85
+ // @/components/ui/* → runtime/components/ui/* (when not present in consuming app)
86
+ if (isStandalone && !existsSync(join(srcDir, 'components', 'ui'))) {
87
+ nuxt.options.alias[join(srcDir, 'components', 'ui')] =
88
+ join(runtimeComponentsDir, 'ui');
89
+ }
90
+
81
91
  // ── Install required Nuxt modules ────────────────────────────────────────
82
92
  if (options.shadcn !== false) {
83
93
  await installModule('shadcn-nuxt', {
@@ -1,3 +1,6 @@
1
+ import { onMounted, onUnmounted, readonly, ref } from 'vue';
2
+ import { useNuxtApp } from 'nuxt/app';
3
+
1
4
  interface ErrorContext {
2
5
  component: string;
3
6
  operation: string;
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { useColorMode } from '#imports';
2
3
  const colorMode: any = useColorMode();
3
4
  const isDark = computed(() => colorMode.value === 'dark');
4
5
  const toggleTheme = () => {
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { useI18n } from 'vue-i18n';
2
3
  import { cn } from '@/lib/utils';
3
4
  const { locale, setLocale } = useI18n();
4
5
  const props = withDefaults(
@@ -109,6 +109,7 @@
109
109
  <script setup lang="ts">
110
110
  import { parsePhoneNumberFromString, type CountryCode, type NumberFormat } from 'libphonenumber-js/max';
111
111
  import { cva } from 'class-variance-authority';
112
+ import { useState, useId } from 'nuxt/app';
112
113
  import { cn, inputSizeClasses } from '@/lib/utils';
113
114
 
114
115
  type InputSize = 'sm' | 'base' | 'lg' | 'xl';
@@ -3,6 +3,7 @@ import type { HTMLAttributes, Ref } from 'vue';
3
3
  import { useEventListener, useMediaQuery, useVModel } from '@vueuse/core';
4
4
  import { TooltipProvider } from 'reka-ui';
5
5
  import { computed, ref } from 'vue';
6
+ import { useCookie } from 'nuxt/app';
6
7
  import { cn } from '@/lib/utils';
7
8
  import { provideSidebarContext, SIDEBAR_COOKIE_MAX_AGE, SIDEBAR_COOKIE_NAME, SIDEBAR_KEYBOARD_SHORTCUT, SIDEBAR_WIDTH, SIDEBAR_WIDTH_ICON } from './utils';
8
9