@chakra-ui/vue-utils
Advanced tools
Comparing version 0.0.0-dev-20230217110635 to 0.0.0-dev-20230217135829
# @chakra-ui/vue-utils | ||
## 0.0.0-dev-20230217110635 | ||
## 0.0.0-dev-20230217135829 | ||
@@ -16,2 +16,3 @@ ### Major Changes | ||
- 8b97512b: Normalize build output. Fix Nuxt imports" | ||
- 1b6ddd39: Rename core to vue package directory | ||
@@ -18,0 +19,0 @@ - a3e70d0b: Create package |
export { canUseDOM } from '@chakra-ui/utils'; | ||
declare const defaultWindow: (Window & typeof globalThis) | null; | ||
export { defaultWindow }; |
import 'vue'; | ||
export { D as DebouncedRef, M as MaybeElementRef, T as TemplateRef, V as VueComponentInstance, c as contains, a as unrefElement, b as useDebouncedRef, u as useRef } from './dom-41924c5d.js'; | ||
export { d as ConfigurableDocument, e as ConfigurableDocumentOrShadowRoot, g as ConfigurableLocation, f as ConfigurableNavigator, C as ConfigurableWindow, D as DebouncedRef, M as MaybeElementRef, T as TemplateRef, V as VueComponentInstance, c as contains, i as defaultDocument, k as defaultLocation, j as defaultNavigator, h as defaultWindow, a as unrefElement, b as useDebouncedRef, u as useRef } from './dom-1613ee96.js'; |
export { StyleAndHTMLAttibutes, extractStyleAttrs } from './attrs.js'; | ||
export { defaultWindow } from './configurable.js'; | ||
export { canUseDOM } from '@chakra-ui/utils'; | ||
export { getSelector } from './dom-query.js'; | ||
export { D as DebouncedRef, F as Fn, e as MaybeBaseRef, M as MaybeElementRef, d as MaybeRef, f as MergedVNodeProps, T as TemplateRef, V as VueComponentInstance, c as contains, a as unrefElement, b as useDebouncedRef, u as useRef } from './dom-41924c5d.js'; | ||
export { A as AnyFn, s as Arrayable, d as ConfigurableDocument, e as ConfigurableDocumentOrShadowRoot, g as ConfigurableLocation, f as ConfigurableNavigator, C as ConfigurableWindow, D as DebouncedRef, r as DeepMaybeRef, F as Fn, m as MaybeBaseRef, p as MaybeComputedRef, M as MaybeElementRef, q as MaybeReadonlyRef, l as MaybeRef, n as MergedVNodeProps, R as RemovableRef, o as RemoveableRef, T as TemplateRef, V as VueComponentInstance, c as contains, i as defaultDocument, k as defaultLocation, j as defaultNavigator, h as defaultWindow, a as unrefElement, b as useDebouncedRef, u as useRef } from './dom-1613ee96.js'; | ||
export { Focus, FocusResult, focusElement, focusIn } from './focus.js'; | ||
@@ -9,2 +9,3 @@ export { genId } from './generate-id.js'; | ||
export { orient } from './layout.js'; | ||
export { tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnUnmounted } from './lifecycles.js'; | ||
export { match } from './match.js'; | ||
@@ -14,6 +15,6 @@ export { BaseThemedComponentProps, SAO, SNA, SNAO, useThemingProps, vueThemingProps } from './props.js'; | ||
export { camelCase } from './string.js'; | ||
export { useSupported } from './support.js'; | ||
export { debounce } from './timers.js'; | ||
export { CouldBeObjectComponent, CreateContextOptions, createContext, getValidChildren, isObjectComponent } from './vue-utils.js'; | ||
export { canUseDOM } from '@chakra-ui/utils'; | ||
export { CouldBeObjectComponent, CreateContextOptions, createContext, getValidChildren, isObjectComponent, resolveRef } from './vue-utils.js'; | ||
import '@chakra-ui/styled-system'; | ||
import 'vue'; |
@@ -11,5 +11,5 @@ import * as vue from 'vue'; | ||
}; | ||
declare const SNA: (StringConstructor | NumberConstructor | ArrayConstructor)[]; | ||
declare const SAO: (ObjectConstructor | StringConstructor | ArrayConstructor)[]; | ||
declare const SNAO: (ObjectConstructor | StringConstructor | NumberConstructor | ArrayConstructor)[]; | ||
declare const SNA: (ArrayConstructor | StringConstructor | NumberConstructor)[]; | ||
declare const SAO: (ArrayConstructor | ObjectConstructor | StringConstructor)[]; | ||
declare const SNAO: (ArrayConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[]; | ||
interface BaseThemedComponentProps extends Pick<ThemingProps, "colorScheme" | "variant" | "size" | "styleConfig"> { | ||
@@ -16,0 +16,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { F as Fn } from './dom-41924c5d.js'; | ||
import { F as Fn } from './dom-1613ee96.js'; | ||
import 'vue'; | ||
@@ -3,0 +3,0 @@ |
import 'vue'; | ||
export { F as Fn, e as MaybeBaseRef, d as MaybeRef, f as MergedVNodeProps } from './dom-41924c5d.js'; | ||
export { A as AnyFn, s as Arrayable, r as DeepMaybeRef, F as Fn, m as MaybeBaseRef, p as MaybeComputedRef, q as MaybeReadonlyRef, l as MaybeRef, n as MergedVNodeProps, R as RemovableRef, o as RemoveableRef } from './dom-1613ee96.js'; |
@@ -1,2 +0,3 @@ | ||
import { Slots, VNode } from 'vue'; | ||
import { Slots, VNode, ComputedRef, Ref } from 'vue'; | ||
import { p as MaybeComputedRef, l as MaybeRef } from './dom-1613ee96.js'; | ||
@@ -40,3 +41,10 @@ interface CreateContextOptions { | ||
declare function isObjectComponent<T extends CouldBeObjectComponent>(subject: T): boolean; | ||
/** | ||
* Normalize value/ref/getter to `ref` or `computed`. | ||
* Adapted from @vueuse/shared | ||
*/ | ||
declare function resolveRef<T>(r: MaybeComputedRef<T>): ComputedRef<T>; | ||
declare function resolveRef<T>(r: MaybeRef<T>): Ref<T>; | ||
declare function resolveRef<T>(r: T): Ref<T>; | ||
export { CouldBeObjectComponent, CreateContextOptions, createContext, getValidChildren, isObjectComponent }; | ||
export { CouldBeObjectComponent, CreateContextOptions, createContext, getValidChildren, isObjectComponent, resolveRef }; |
{ | ||
"name": "@chakra-ui/vue-utils", | ||
"version": "0.0.0-dev-20230217110635", | ||
"main": "dist/index.cjs.js", | ||
"module": "dist/index.esm.js", | ||
"version": "0.0.0-dev-20230217135829", | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"description": "Chakra UI Vue | Utils module", | ||
@@ -12,4 +12,4 @@ "repository": "https://github.com/chakra-ui/chakra-ui-vue-next/tree/master/packages/utils", | ||
".": { | ||
"require": "./dist/index.cjs.js", | ||
"default": "./dist/index.esm.js" | ||
"require": "./dist/index.js", | ||
"default": "./dist/index.mjs" | ||
} | ||
@@ -16,0 +16,0 @@ }, |
import { canUseDOM } from "@chakra-ui/utils" | ||
export const defaultWindow = canUseDOM() ? window : null | ||
export { canUseDOM } |
@@ -12,2 +12,3 @@ import { | ||
import { MaybeRef } from "./types" | ||
import { canUseDOM } from "@chakra-ui/utils" | ||
@@ -132,1 +133,47 @@ /** | ||
} | ||
export interface ConfigurableWindow { | ||
/* | ||
* Specify a custom `window` instance, e.g. working with iframes or in testing environments. | ||
*/ | ||
window?: Window | ||
} | ||
export interface ConfigurableDocument { | ||
/* | ||
* Specify a custom `document` instance, e.g. working with iframes or in testing environments. | ||
*/ | ||
document?: Document | ||
} | ||
export interface ConfigurableDocumentOrShadowRoot { | ||
/* | ||
* Specify a custom `document` instance or a shadow root, e.g. working with iframes or in testing environments. | ||
*/ | ||
document?: DocumentOrShadowRoot | ||
} | ||
export interface ConfigurableNavigator { | ||
/* | ||
* Specify a custom `navigator` instance, e.g. working with iframes or in testing environments. | ||
*/ | ||
navigator?: Navigator | ||
} | ||
export interface ConfigurableLocation { | ||
/* | ||
* Specify a custom `location` instance, e.g. working with iframes or in testing environments. | ||
*/ | ||
location?: Location | ||
} | ||
export const defaultWindow = /* #__PURE__ */ canUseDOM() ? window : undefined | ||
export const defaultDocument = /* #__PURE__ */ canUseDOM() | ||
? window.document | ||
: undefined | ||
export const defaultNavigator = /* #__PURE__ */ canUseDOM() | ||
? window.navigator | ||
: undefined | ||
export const defaultLocation = /* #__PURE__ */ canUseDOM() | ||
? window.location | ||
: undefined |
@@ -27,1 +27,54 @@ import { ComputedRef, Ref, VNodeProps } from "vue" | ||
export type Fn = () => void | ||
/** | ||
* Any function | ||
*/ | ||
export type AnyFn = (...args: any[]) => any | ||
/** | ||
* A ref that allow to set null or undefined | ||
*/ | ||
export type RemovableRef<T> = Omit<Ref<T>, "value"> & { | ||
get value(): T | ||
set value(value: T | null | undefined) | ||
} | ||
/** | ||
* @deprecated Use `RemovableRef` | ||
*/ | ||
export type RemoveableRef<T> = RemovableRef<T> | ||
/** | ||
* Maybe it's a ref, or a plain value, or a getter function | ||
* | ||
* ```ts | ||
* type MaybeComputedRef<T> = (() => T) | T | Ref<T> | ComputedRef<T> | ||
* ``` | ||
*/ | ||
export type MaybeComputedRef<T> = MaybeReadonlyRef<T> | MaybeRef<T> | ||
/** | ||
* Maybe it's a computed ref, or a getter function | ||
* | ||
* ```ts | ||
* type MaybeReadonlyRef<T> = (() => T) | ComputedRef<T> | ||
* ``` | ||
*/ | ||
export type MaybeReadonlyRef<T> = (() => T) | ComputedRef<T> | ||
/** | ||
* Make all the nested attributes of an object or array to MaybeRef<T> | ||
* | ||
* Good for accepting options that will be wrapped with `reactive` or `ref` | ||
* | ||
* ```ts | ||
* UnwrapRef<DeepMaybeRef<T>> === T | ||
* ``` | ||
*/ | ||
export type DeepMaybeRef<T> = T extends Ref<infer V> | ||
? MaybeRef<V> | ||
: T extends Array<any> | object | ||
? { [K in keyof T]: DeepMaybeRef<T[K]> } | ||
: MaybeRef<T> | ||
export type Arrayable<T> = T[] | T |
import { isObject } from "@chakra-ui/utils" | ||
import { inject, InjectionKey, provide, isVNode, Slots, VNode } from "vue" | ||
import { | ||
inject, | ||
InjectionKey, | ||
provide, | ||
isVNode, | ||
Slots, | ||
VNode, | ||
ComputedRef, | ||
Ref, | ||
computed, | ||
ref, | ||
} from "vue" | ||
import { MaybeComputedRef, MaybeRef } from "./types" | ||
@@ -98,1 +110,12 @@ export interface CreateContextOptions { | ||
} | ||
/** | ||
* Normalize value/ref/getter to `ref` or `computed`. | ||
* Adapted from @vueuse/shared | ||
*/ | ||
export function resolveRef<T>(r: MaybeComputedRef<T>): ComputedRef<T> | ||
export function resolveRef<T>(r: MaybeRef<T>): Ref<T> | ||
export function resolveRef<T>(r: T): Ref<T> | ||
export function resolveRef<T>(r: MaybeComputedRef<T>) { | ||
return typeof r === "function" ? computed<T>(r as any) : ref(r) | ||
} |
@@ -7,12 +7,6 @@ import { defineConfig } from "tsup" | ||
target: "es2019", | ||
outExtension({ format }) { | ||
return { | ||
js: `.${format}.js`, | ||
} | ||
}, | ||
esbuildPlugins: [ | ||
// @ts-expect-error `EsbuildPluginJSX` does not extend `tsup.Plugin` type. | ||
EsbuildPluginJSX({ | ||
include: [/.[jt]sx?$/], | ||
}), | ||
}) as any, | ||
], | ||
@@ -19,0 +13,0 @@ format: ["esm", "cjs"], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
120307
100
3386
1