@gluhar/core 4.1.5 → 4.2.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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [4.2.0](https://github.com/gluharco/gluhar/compare/@gluhar/core@4.1.5...@gluhar/core@4.2.0) (2026-04-28)
7
+
8
+
9
+ ### 🚀 Enhancements
10
+
11
+ - Bump minor ([97ce7ec](https://github.com/gluharco/gluhar/commit/97ce7ece5e0d16846269319bdce425d497895ff1))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [4.1.5](https://github.com/gluharco/gluhar/compare/@gluhar/core@4.1.4...@gluhar/core@4.1.5) (2026-03-23)
7
18
 
8
19
  **📝 Note:** Version bump only for package @gluhar/core
@@ -0,0 +1,5 @@
1
+ module.exports = function(...args) {
2
+ return import('./module.mjs').then(m => m.default.call(this, ...args))
3
+ }
4
+ const _meta = module.exports.meta = require('./module.json')
5
+ module.exports.getMeta = () => Promise.resolve(_meta)
@@ -0,0 +1,7 @@
1
+ import * as _nuxt_schema from '@nuxt/schema';
2
+
3
+ interface GluharCoreOptions {
4
+ }
5
+ declare const _default: _nuxt_schema.NuxtModule<GluharCoreOptions, GluharCoreOptions, false>;
6
+
7
+ export { type GluharCoreOptions, _default as default };
@@ -0,0 +1,7 @@
1
+ import * as _nuxt_schema from '@nuxt/schema';
2
+
3
+ interface GluharCoreOptions {
4
+ }
5
+ declare const _default: _nuxt_schema.NuxtModule<GluharCoreOptions, GluharCoreOptions, false>;
6
+
7
+ export { type GluharCoreOptions, _default as default };
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "@gluhar/core",
3
+ "configKey": "gluharCore",
4
+ "version": "4.2.0",
5
+ "builder": {
6
+ "@nuxt/module-builder": "0.8.3",
7
+ "unbuild": "2.0.0"
8
+ }
9
+ }
@@ -0,0 +1,18 @@
1
+ import { defineNuxtModule, createResolver, installModule, addImportsDir } from '@nuxt/kit';
2
+
3
+ const module = defineNuxtModule({
4
+ meta: {
5
+ name: "@gluhar/core",
6
+ configKey: "gluharCore"
7
+ },
8
+ // Default configuration options of the Nuxt module
9
+ defaults: {},
10
+ setup(options, nuxt) {
11
+ const { resolve } = createResolver(import.meta.url);
12
+ installModule("@nuxtjs/device");
13
+ addImportsDir(resolve("runtime/composables"));
14
+ addImportsDir(resolve("runtime/utils"));
15
+ }
16
+ });
17
+
18
+ export { module as default };
@@ -0,0 +1,3 @@
1
+ export declare const useClientOnly: () => {
2
+ isClient: import("vue").Ref<boolean, boolean>;
3
+ };
@@ -0,0 +1,8 @@
1
+ import { onMounted, ref } from "vue";
2
+ export const useClientOnly = () => {
3
+ const mounted = ref(false);
4
+ onMounted(() => {
5
+ mounted.value = true;
6
+ });
7
+ return { isClient: mounted };
8
+ };
@@ -0,0 +1,9 @@
1
+ export declare const useResponsive: () => {
2
+ mobile: import("vue").ComputedRef<boolean>;
3
+ tablet: import("vue").Ref<boolean, boolean>;
4
+ tabletExact: import("vue").ComputedRef<boolean>;
5
+ desktop: import("vue").Ref<boolean, boolean>;
6
+ desktopExact: import("vue").ComputedRef<boolean>;
7
+ wide: import("vue").Ref<boolean, boolean>;
8
+ touch: import("vue").ComputedRef<boolean>;
9
+ };
@@ -0,0 +1,26 @@
1
+ import { computed } from "#imports";
2
+ import { useBreakpoints, breakpointsTailwind } from "@vueuse/core";
3
+ import { useDevice } from "#imports";
4
+ export const useResponsive = () => {
5
+ const breakpoints = useBreakpoints({
6
+ ...breakpointsTailwind,
7
+ tablet: 768,
8
+ desktop: 1200,
9
+ wide: 2e3
10
+ });
11
+ const { isMobile } = useDevice();
12
+ const mobile = computed(
13
+ () => breakpoints.smaller("tablet").value || isMobile
14
+ );
15
+ const tablet = breakpoints.greater("tablet");
16
+ const tabletExact = computed(
17
+ () => breakpoints.isInBetween("tablet", "desktop")
18
+ );
19
+ const desktop = breakpoints.greater("desktop");
20
+ const desktopExact = computed(
21
+ () => breakpoints.isInBetween("desktop", "wide")
22
+ );
23
+ const touch = computed(() => !desktop.value);
24
+ const wide = breakpoints.greater("wide");
25
+ return { mobile, tablet, tabletExact, desktop, desktopExact, wide, touch };
26
+ };
@@ -0,0 +1,3 @@
1
+ import { breakpointsTailwind } from "@vueuse/core";
2
+ export type NonNegativeInteger<T extends number> = number extends T ? never : `${T}` extends `-${string}` | `${string}.${string}` ? never : T;
3
+ export type Breakpoint = keyof typeof breakpointsTailwind;
File without changes
@@ -0,0 +1,10 @@
1
+ export declare const capitalize: (s: string) => string;
2
+ export declare const envMode: () => "dev" | "prod";
3
+ /**
4
+ * Returns the base URL based on the environment mode.
5
+ *
6
+ * @param {string} baseUrl - The base URL to be used.
7
+ * @returns {string | undefined} - The base URL if the environment mode is "prod", otherwise undefined.
8
+ */
9
+ export declare const useBaseUrl: (baseUrl: string) => string | undefined;
10
+ export declare const asyncTimeout: (ms: number) => Promise<unknown>;
@@ -0,0 +1,6 @@
1
+ export const capitalize = (s) => s && s[0].toUpperCase() + s.slice(1);
2
+ export const envMode = () => process.env.NODE_ENV === "development" ? "dev" : "prod";
3
+ export const useBaseUrl = (baseUrl) => {
4
+ return envMode() === "prod" ? baseUrl : void 0;
5
+ };
6
+ export const asyncTimeout = (ms) => new Promise((res) => setTimeout(res, ms));
@@ -0,0 +1,4 @@
1
+ export declare const readModule: <T extends Record<string, any>>(path: string | undefined, options?: {
2
+ cwd?: boolean;
3
+ default?: boolean;
4
+ }) => Promise<T>;
@@ -0,0 +1,13 @@
1
+ import { readFileSync } from "fs";
2
+ import { join } from "path";
3
+ import { evalModule } from "mlly";
4
+ export const readModule = async (path, options = { cwd: true }) => {
5
+ if (!path) throw new Error("[@gluhar/core] readModule | No path provided.");
6
+ const p = options?.cwd ? join(process.cwd(), path) : path;
7
+ const file = readFileSync(p)?.toString();
8
+ if (!file)
9
+ throw new Error("[@gluhar/core] readModule | File not found on path: " + p);
10
+ const sanitizedFile = file.replaceAll(" as const", "");
11
+ const module = await evalModule(sanitizedFile);
12
+ return options?.default ? module.default : module;
13
+ };
@@ -0,0 +1,6 @@
1
+ import type { NonNegativeInteger } from "../types.js";
2
+ export declare const getRandomInt: (max?: number) => number;
3
+ export declare const getRandomBetween: (min: number, max: number) => number;
4
+ export declare const getRandomDigits: <N extends number>(count: NonNegativeInteger<N>) => number;
5
+ export declare const getRandomHex: <N extends number>(count?: NonNegativeInteger<N>) => string;
6
+ export declare const getUuid: () => string;
@@ -0,0 +1,5 @@
1
+ export const getRandomInt = (max = 100) => Math.floor(Math.random() * max);
2
+ export const getRandomBetween = (min, max) => getRandomInt(max - min + 1) + min;
3
+ export const getRandomDigits = (count) => getRandomBetween(9 * 10 ** (count - 1), 10 ** (count - 1));
4
+ export const getRandomHex = (count) => [...Array(count || 6)].map(() => getRandomBetween(0, 15).toString(16)).join("");
5
+ export const getUuid = () => `huuid-${getRandomHex()}-${getRandomHex()}-${getRandomHex()}`;
@@ -0,0 +1,2 @@
1
+ export * from "./generators.js";
2
+ export * from "./common.js";
@@ -0,0 +1,2 @@
1
+ export * from "./generators.js";
2
+ export * from "./common.js";
@@ -0,0 +1,7 @@
1
+ import type { NuxtModule } from '@nuxt/schema'
2
+
3
+ import type { default as Module } from './module.js'
4
+
5
+ export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
6
+
7
+ export { type GluharCoreOptions, default } from './module.js'
@@ -0,0 +1,7 @@
1
+ import type { NuxtModule } from '@nuxt/schema'
2
+
3
+ import type { default as Module } from './module'
4
+
5
+ export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
6
+
7
+ export { type GluharCoreOptions, default } from './module'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gluhar/core",
3
- "version": "4.1.5",
3
+ "version": "4.2.0",
4
4
  "description": "Gluhar Core packages.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -26,7 +26,6 @@
26
26
  "scripts": {
27
27
  "gluhar": "npm run gluhar --prefix ../.. -- --cwd=$PWD",
28
28
  "build": "npm run gluhar build -- -t module",
29
- "prepack": "npm run build",
30
29
  "dev": "nuxi dev playground",
31
30
  "dev:build": "nuxi build playground",
32
31
  "dev:prepare": "nuxt-module-build build && nuxt-module-build prepare && nuxi prepare playground",
@@ -53,5 +52,5 @@
53
52
  "nuxt": "^3.13.1",
54
53
  "vitest": "^2.0.5"
55
54
  },
56
- "gitHead": "a60bf29f338bc3af3212a3a8ed647f75c69a2c4a"
55
+ "gitHead": "10ebf6500c71e1beeceece4de90467b26aa67a21"
57
56
  }