@vuetify/v0 0.0.2-beta.4 → 0.0.2
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/README.md +252 -0
- package/dist/browser/index.js +3123 -0
- package/dist/components/{index.d.mts → index.d.ts} +7 -5
- package/dist/components/{index.mjs → index.js} +7 -5
- package/dist/{components-B5iiovK7.mjs → components-Cc48kKWf.js} +5 -33
- package/dist/composables/index.d.ts +7 -0
- package/dist/composables/index.js +8 -0
- package/dist/{composables-C6dl5kjP.mjs → composables-7Cbs2sdO.js} +395 -6
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.js +5 -0
- package/dist/constants-DiTCgvMU.js +1 -0
- package/dist/factories/index.d.ts +2 -0
- package/dist/factories/{index.mjs → index.js} +1 -2
- package/dist/globals--2b7sF4-.js +12 -0
- package/dist/htmlElements-SjqYu0am.js +78 -0
- package/dist/index-BnsMFYhs.d.ts +1407 -0
- package/dist/{index-D4Grk5x1.d.mts → index-BozA2pze.d.ts} +1 -1
- package/dist/{index-oCBJwhpG.d.mts → index-BqrLvboW.d.ts} +31 -13
- package/dist/index-z_zwVNP8.d.ts +79 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +11 -0
- package/dist/transformers/index.d.ts +2 -0
- package/dist/transformers/index.js +4 -0
- package/dist/{transformers-BTjuwbOV.mjs → transformers-BAeg3QJF.js} +1 -1
- package/dist/types/{index.d.mts → index.d.ts} +1 -1
- package/dist/types/index.js +1 -0
- package/dist/{useTheme-tY7MoBKr.mjs → useTheme-DSYiiz0R.js} +65 -19
- package/dist/utilities/{index.d.mts → index.d.ts} +2 -2
- package/dist/utilities/{index.mjs → index.js} +1 -1
- package/package.json +32 -21
- package/dist/composables/index.d.mts +0 -5
- package/dist/composables/index.mjs +0 -7
- package/dist/factories/index.d.mts +0 -3
- package/dist/factories-DOLmqhVS.mjs +0 -0
- package/dist/index-ChaaTPKp.d.mts +0 -421
- package/dist/index-Cya5Y9pB.d.mts +0 -412
- package/dist/index-DfahEz6s.d.mts +0 -18
- package/dist/index-jG0yrC1F.d.mts +0 -467
- package/dist/index.d.mts +0 -9
- package/dist/index.mjs +0 -9
- package/dist/transformers/index.d.mts +0 -2
- package/dist/transformers/index.mjs +0 -4
- package/dist/types/index.mjs +0 -0
- /package/dist/{createTrinity-CwGvQ2ng.mjs → factories-CPq2yMlr.js} +0 -0
- /package/dist/{index-BA3ZFBnL.d.mts → index-LBy5OPMu.d.ts} +0 -0
- /package/dist/{index-CZRh0I2w.d.mts → index-tUyghL98.d.ts} +0 -0
- /package/dist/{utilities-lZSfrXgw.mjs → utilities-D9rWEgQK.js} +0 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import "../index-
|
|
2
|
-
import { AtomExpose, AtomProps, AtomSlots, Breakpoints, Context, Group, GroupItemProps, GroupItemSlots, GroupRootProps, GroupRootSlots, Popover, PopoverAnchorProps, PopoverContentEmits, PopoverContentProps, PopoverContext, PopoverRootProps, Step, StepItemProps, StepItemSlots, StepRootProps, StepRootSlots, Theme, ThemeRootProps, ThemeRootSlots, ThemeSlots, _default as _default$2, _default$1
|
|
3
|
-
import "../index-
|
|
4
|
-
import "../index-
|
|
5
|
-
|
|
1
|
+
import "../index-LBy5OPMu.js";
|
|
2
|
+
import { AtomExpose, AtomProps, AtomSlots, Breakpoints, Context, Group, GroupItemProps, GroupItemSlots, GroupRootProps, GroupRootSlots, Popover, PopoverAnchorProps, PopoverContentEmits, PopoverContentProps, PopoverContext, PopoverRootProps, Step, StepItemProps, StepItemSlots, StepRootProps, StepRootSlots, Theme, ThemeRootProps, ThemeRootSlots, ThemeSlots, _default as _default$2, _default$1, _default$2 as _default, providePopoverContext, usePopoverContext } from "../index-BnsMFYhs.js";
|
|
3
|
+
import "../index-BqrLvboW.js";
|
|
4
|
+
import "../index-z_zwVNP8.js";
|
|
5
|
+
import "../index-tUyghL98.js";
|
|
6
|
+
import "../index-BozA2pze.js";
|
|
7
|
+
export { _default as Atom, AtomExpose, AtomProps, AtomSlots, Breakpoints, Context, Group, GroupItemProps, GroupItemSlots, GroupRootProps, GroupRootSlots, _default$1 as Hydration, _default$2 as HydrationRoot, Popover, PopoverAnchorProps, PopoverContentEmits, PopoverContentProps, PopoverContext, PopoverRootProps, Step, StepItemProps, StepItemSlots, StepRootProps, StepRootSlots, Theme, ThemeRootProps, ThemeRootSlots, ThemeSlots, providePopoverContext, usePopoverContext };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "../
|
|
3
|
-
import "../
|
|
4
|
-
import "../
|
|
5
|
-
import "../
|
|
1
|
+
import "../htmlElements-SjqYu0am.js";
|
|
2
|
+
import { Atom_default, Breakpoints, Context, Group, HydrationRoot_default, Hydration_default, Popover, Step, Theme, providePopoverContext, usePopoverContext } from "../components-Cc48kKWf.js";
|
|
3
|
+
import "../factories-CPq2yMlr.js";
|
|
4
|
+
import "../useTheme-DSYiiz0R.js";
|
|
5
|
+
import "../utilities-D9rWEgQK.js";
|
|
6
|
+
import "../globals--2b7sF4-.js";
|
|
7
|
+
import "../transformers-BAeg3QJF.js";
|
|
6
8
|
|
|
7
9
|
export { Atom_default as Atom, Breakpoints, Context, Group, Hydration_default as Hydration, HydrationRoot_default as HydrationRoot, Popover, Step, Theme, providePopoverContext, usePopoverContext };
|
|
@@ -1,36 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { isSelfClosingTag } from "./htmlElements-SjqYu0am.js";
|
|
2
|
+
import { createContext } from "./factories-CPq2yMlr.js";
|
|
3
|
+
import { createBreakpoints, createHydration, createTheme, provideBreakpointsContext, provideHydrationContext, useBreakpoints, useGroup, useHydration, useStep, useTheme } from "./useTheme-DSYiiz0R.js";
|
|
3
4
|
import { Fragment, createBlock, createCommentVNode, createElementBlock, createPropsRestProxy, defineComponent, guardReactiveProps, mergeModels, mergeProps, normalizeProps, normalizeStyle, onMounted, onUnmounted, openBlock, renderSlot, resolveDynamicComponent, toRef, unref, useAttrs, useId, useModel, useTemplateRef, withCtx } from "vue";
|
|
4
5
|
|
|
5
|
-
//#region src/constants/htmlElements.ts
|
|
6
|
-
const selfClosingTags = [
|
|
7
|
-
"area",
|
|
8
|
-
"base",
|
|
9
|
-
"br",
|
|
10
|
-
"col",
|
|
11
|
-
"embed",
|
|
12
|
-
"hr",
|
|
13
|
-
"img",
|
|
14
|
-
"input",
|
|
15
|
-
"link",
|
|
16
|
-
"meta",
|
|
17
|
-
"source",
|
|
18
|
-
"track",
|
|
19
|
-
"wbr"
|
|
20
|
-
];
|
|
21
|
-
/**
|
|
22
|
-
* Set of HTML elements that are self-closing (void elements)
|
|
23
|
-
* These elements cannot have children and don't need closing tags
|
|
24
|
-
*/
|
|
25
|
-
const SELF_CLOSING_TAGS = new Set(selfClosingTags);
|
|
26
|
-
/**
|
|
27
|
-
* Check if an element is self-closing
|
|
28
|
-
*/
|
|
29
|
-
function isSelfClosingTag(tag) {
|
|
30
|
-
return SELF_CLOSING_TAGS.has(tag.toLowerCase());
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
//#endregion
|
|
34
6
|
//#region src/components/Atom/Atom.vue?vue&type=script&setup=true&lang.ts
|
|
35
7
|
var Atom_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
36
8
|
name: "Atom",
|
|
@@ -554,9 +526,9 @@ var ThemeRoot_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
554
526
|
}),
|
|
555
527
|
emits: ["update:modelValue"],
|
|
556
528
|
setup(__props) {
|
|
557
|
-
|
|
529
|
+
useModel(__props, "modelValue");
|
|
558
530
|
const [provideThemeContext] = createTheme(__props.namespace);
|
|
559
|
-
const themeContext = provideThemeContext(
|
|
531
|
+
const themeContext = provideThemeContext();
|
|
560
532
|
for (const theme of __props.themes) themeContext.register(theme);
|
|
561
533
|
return (_ctx, _cache) => {
|
|
562
534
|
return renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(themeContext))));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "../index-LBy5OPMu.js";
|
|
2
|
+
import { BreakpointName, BreakpointsContext, BreakpointsOptions, CleanupFunction, Colors, ConsolaLoggerAdapter, EventHandler, FilterFunction, FilterItem, FilterMode, FilterQuery, FlatTokenCollection, FormContext, FormOptions, FormTicket, FormValidationResult, FormValidationRule, FormValue, GroupContext, GroupOptions, GroupTicket, HydrationContext, IntersectionObserverEntry, IntersectionObserverOptions, KeyHandler, LayoutContext, LayoutLocation, LayoutOptions, LayoutTicket, LocaleContext, LocaleOptions, LocalePluginOptions, LocaleTicket, LogLevel, LoggerAdapter, LoggerContext, LoggerOptions, MutationObserverRecord, PinoLoggerAdapter, Primitive, ProxyModelOptions, RegistryContext, RegistryOptions, RegistryTicket, ResizeObserverEntry, ResizeObserverOptions, SelectionContext, SelectionOptions, SelectionTicket, SingleContext, SingleOptions, SingleTicket, StepContext, StepOptions, StepTicket, StorageContext, StorageOptions, ThemeColors, ThemeContext, ThemeOptions, ThemePluginOptions, ThemeRecord, ThemeTicket, TokenAlias, TokenCollection, TokenContext, TokenPrimitive, TokenTicket, TokenValue, UseFilterOptions, UseFilterResult, UseMutationObserverOptions, Vuetify0LoggerAdapter, createBreakpoints, createBreakpointsPlugin, createHydration, createHydrationPlugin, createLocale, createLocalePlugin, createLogger, createLoggerPlugin, createRegistryContext, createStorage, createStoragePlugin, createTheme, createThemePlugin, createTokensContext, provideBreakpointsContext, provideHydrationContext, provideStorageContext, useBreakpoints, useBreakpointsContext, useDocumentEventListener, useElementIntersection, useElementSize, useEventListener, useFilter, useForm, useGroup, useHydration, useHydrationContext, useIntersectionObserver, useKeydown, useLayout, useLocale, useLogger, useMutationObserver, useProxyModel, useRegistry, useResizeObserver, useSelection, useSingle, useStep, useStorage, useStorageContext, useTheme, useTokens, useWindowEventListener } from "../index-BnsMFYhs.js";
|
|
3
|
+
import "../index-BqrLvboW.js";
|
|
4
|
+
import "../index-z_zwVNP8.js";
|
|
5
|
+
import "../index-tUyghL98.js";
|
|
6
|
+
import "../index-BozA2pze.js";
|
|
7
|
+
export { BreakpointName, BreakpointsContext, BreakpointsOptions, CleanupFunction, Colors, ConsolaLoggerAdapter, EventHandler, FilterFunction, FilterItem, FilterMode, FilterQuery, FlatTokenCollection, FormContext, FormOptions, FormTicket, FormValidationResult, FormValidationRule, FormValue, GroupContext, GroupOptions, GroupTicket, HydrationContext, IntersectionObserverEntry, IntersectionObserverOptions, KeyHandler, LayoutContext, LayoutLocation, LayoutOptions, LayoutTicket, LocaleContext, LocaleOptions, LocalePluginOptions, LocaleTicket, LogLevel, LoggerAdapter, LoggerContext, LoggerOptions, MutationObserverRecord, PinoLoggerAdapter, Primitive, ProxyModelOptions, RegistryContext, RegistryOptions, RegistryTicket, ResizeObserverEntry, ResizeObserverOptions, SelectionContext, SelectionOptions, SelectionTicket, SingleContext, SingleOptions, SingleTicket, StepContext, StepOptions, StepTicket, StorageContext, StorageOptions, ThemeColors, ThemeContext, ThemeOptions, ThemePluginOptions, ThemeRecord, ThemeTicket, TokenAlias, TokenCollection, TokenContext, TokenPrimitive, TokenTicket, TokenValue, UseFilterOptions, UseFilterResult, UseMutationObserverOptions, Vuetify0LoggerAdapter, createBreakpoints, createBreakpointsPlugin, createHydration, createHydrationPlugin, createLocale, createLocalePlugin, createLogger, createLoggerPlugin, createRegistryContext, createStorage, createStoragePlugin, createTheme, createThemePlugin, createTokensContext, provideBreakpointsContext, provideHydrationContext, provideStorageContext, useBreakpoints, useBreakpointsContext, useDocumentEventListener, useElementIntersection, useElementSize, useEventListener, useFilter, useForm, useGroup, useHydration, useHydrationContext, useIntersectionObserver, useKeydown, useLayout, useLocale, useLogger, useMutationObserver, useProxyModel, useRegistry, useResizeObserver, useSelection, useSingle, useStep, useStorage, useStorageContext, useTheme, useTokens, useWindowEventListener };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "../factories-CPq2yMlr.js";
|
|
2
|
+
import { ConsolaLoggerAdapter, PinoLoggerAdapter, Vuetify0LoggerAdapter, createBreakpoints, createBreakpointsPlugin, createHydration, createHydrationPlugin, createLogger, createLoggerPlugin, createRegistryContext, createTheme, createThemePlugin, createTokensContext, provideBreakpointsContext, provideHydrationContext, useBreakpoints, useBreakpointsContext, useGroup, useHydration, useHydrationContext, useLogger, useRegistry, useSelection, useSingle, useStep, useTheme, useTokens } from "../useTheme-DSYiiz0R.js";
|
|
3
|
+
import "../utilities-D9rWEgQK.js";
|
|
4
|
+
import "../globals--2b7sF4-.js";
|
|
5
|
+
import "../transformers-BAeg3QJF.js";
|
|
6
|
+
import { createLocale, createLocalePlugin, createStorage, createStoragePlugin, provideStorageContext, useDocumentEventListener, useElementIntersection, useElementSize, useEventListener, useFilter, useForm, useIntersectionObserver, useKeydown, useLayout, useLocale, useMutationObserver, useProxyModel, useResizeObserver, useStorage, useStorageContext, useWindowEventListener } from "../composables-7Cbs2sdO.js";
|
|
7
|
+
|
|
8
|
+
export { ConsolaLoggerAdapter, PinoLoggerAdapter, Vuetify0LoggerAdapter, createBreakpoints, createBreakpointsPlugin, createHydration, createHydrationPlugin, createLocale, createLocalePlugin, createLogger, createLoggerPlugin, createRegistryContext, createStorage, createStoragePlugin, createTheme, createThemePlugin, createTokensContext, provideBreakpointsContext, provideHydrationContext, provideStorageContext, useBreakpoints, useBreakpointsContext, useDocumentEventListener, useElementIntersection, useElementSize, useEventListener, useFilter, useForm, useGroup, useHydration, useHydrationContext, useIntersectionObserver, useKeydown, useLayout, useLocale, useLogger, useMutationObserver, useProxyModel, useRegistry, useResizeObserver, useSelection, useSingle, useStep, useStorage, useStorageContext, useTheme, useTokens, useWindowEventListener };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { createContext, createPlugin, createTrinity, useContext } from "./
|
|
2
|
-
import {
|
|
3
|
-
import { isArray, isFunction } from "./utilities-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { createContext, createPlugin, createTrinity, useContext } from "./factories-CPq2yMlr.js";
|
|
2
|
+
import { createTokensContext, useGroup, useHydration, useLogger, useRegistry, useSingle } from "./useTheme-DSYiiz0R.js";
|
|
3
|
+
import { isArray, isFunction } from "./utilities-D9rWEgQK.js";
|
|
4
|
+
import { IN_BROWSER, SUPPORTS_INTERSECTION_OBSERVER, SUPPORTS_MUTATION_OBSERVER, SUPPORTS_OBSERVER } from "./globals--2b7sF4-.js";
|
|
5
|
+
import { toArray } from "./transformers-BAeg3QJF.js";
|
|
6
|
+
import { computed, getCurrentInstance, getCurrentScope, isRef, onMounted, onScopeDispose, onUnmounted, readonly, ref, shallowReactive, shallowRef, toRaw, toRef, toValue, unref, watch } from "vue";
|
|
6
7
|
|
|
7
8
|
//#region src/composables/useEventListener/index.ts
|
|
8
9
|
function useEventListener(target, event, listener, options) {
|
|
@@ -220,6 +221,146 @@ function useForm(options) {
|
|
|
220
221
|
};
|
|
221
222
|
}
|
|
222
223
|
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/composables/useIntersectionObserver/index.ts
|
|
226
|
+
/**
|
|
227
|
+
* Composable for observing element intersection with viewport or ancestor
|
|
228
|
+
*
|
|
229
|
+
* @param target - Element ref to observe
|
|
230
|
+
* @param callback - Callback fired on intersection change
|
|
231
|
+
* @param options - Observer options
|
|
232
|
+
* @returns Observer controls and intersection state
|
|
233
|
+
*
|
|
234
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver
|
|
235
|
+
*/
|
|
236
|
+
function useIntersectionObserver(target, callback, options = {}) {
|
|
237
|
+
const { isHydrated } = useHydration();
|
|
238
|
+
const observer = shallowRef();
|
|
239
|
+
const isPaused = shallowRef(false);
|
|
240
|
+
const isIntersecting = shallowRef(false);
|
|
241
|
+
watch([isHydrated, target], ([hydrated, el]) => {
|
|
242
|
+
cleanup();
|
|
243
|
+
if (!hydrated || !SUPPORTS_INTERSECTION_OBSERVER || !el) return;
|
|
244
|
+
observer.value = new IntersectionObserver((entries) => {
|
|
245
|
+
const transformedEntries = entries.map((entry) => ({
|
|
246
|
+
boundingClientRect: entry.boundingClientRect,
|
|
247
|
+
intersectionRatio: entry.intersectionRatio,
|
|
248
|
+
intersectionRect: entry.intersectionRect,
|
|
249
|
+
isIntersecting: entry.isIntersecting,
|
|
250
|
+
rootBounds: entry.rootBounds,
|
|
251
|
+
target: entry.target,
|
|
252
|
+
time: entry.time
|
|
253
|
+
}));
|
|
254
|
+
const latestEntry = transformedEntries.at(-1);
|
|
255
|
+
if (latestEntry) isIntersecting.value = latestEntry.isIntersecting;
|
|
256
|
+
callback(transformedEntries);
|
|
257
|
+
}, {
|
|
258
|
+
root: options.root || null,
|
|
259
|
+
rootMargin: options.rootMargin || "0px",
|
|
260
|
+
threshold: options.threshold || 0
|
|
261
|
+
});
|
|
262
|
+
observer.value.observe(el);
|
|
263
|
+
if (options.immediate) {
|
|
264
|
+
const rect = el.getBoundingClientRect();
|
|
265
|
+
const syntheticEntry = {
|
|
266
|
+
boundingClientRect: rect,
|
|
267
|
+
intersectionRatio: 0,
|
|
268
|
+
intersectionRect: new DOMRect(0, 0, 0, 0),
|
|
269
|
+
isIntersecting: false,
|
|
270
|
+
rootBounds: null,
|
|
271
|
+
target: el,
|
|
272
|
+
time: performance.now()
|
|
273
|
+
};
|
|
274
|
+
callback([syntheticEntry]);
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
function setup() {
|
|
278
|
+
if (!isHydrated.value || !SUPPORTS_INTERSECTION_OBSERVER || !target.value || isPaused.value) return;
|
|
279
|
+
observer.value = new IntersectionObserver((entries) => {
|
|
280
|
+
const transformedEntries = entries.map((entry) => ({
|
|
281
|
+
boundingClientRect: entry.boundingClientRect,
|
|
282
|
+
intersectionRatio: entry.intersectionRatio,
|
|
283
|
+
intersectionRect: entry.intersectionRect,
|
|
284
|
+
isIntersecting: entry.isIntersecting,
|
|
285
|
+
rootBounds: entry.rootBounds,
|
|
286
|
+
target: entry.target,
|
|
287
|
+
time: entry.time
|
|
288
|
+
}));
|
|
289
|
+
const latestEntry = transformedEntries.at(-1);
|
|
290
|
+
if (latestEntry) isIntersecting.value = latestEntry.isIntersecting;
|
|
291
|
+
callback(transformedEntries);
|
|
292
|
+
}, {
|
|
293
|
+
root: options.root || null,
|
|
294
|
+
rootMargin: options.rootMargin || "0px",
|
|
295
|
+
threshold: options.threshold || 0
|
|
296
|
+
});
|
|
297
|
+
observer.value.observe(target.value);
|
|
298
|
+
if (options.immediate) {
|
|
299
|
+
const rect = target.value.getBoundingClientRect();
|
|
300
|
+
const syntheticEntry = {
|
|
301
|
+
boundingClientRect: rect,
|
|
302
|
+
intersectionRatio: 0,
|
|
303
|
+
intersectionRect: new DOMRect(0, 0, 0, 0),
|
|
304
|
+
isIntersecting: false,
|
|
305
|
+
rootBounds: null,
|
|
306
|
+
target: target.value,
|
|
307
|
+
time: performance.now()
|
|
308
|
+
};
|
|
309
|
+
callback([syntheticEntry]);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
function cleanup() {
|
|
313
|
+
if (observer.value) {
|
|
314
|
+
observer.value.disconnect();
|
|
315
|
+
observer.value = void 0;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
function pause() {
|
|
319
|
+
isPaused.value = true;
|
|
320
|
+
observer.value?.disconnect();
|
|
321
|
+
}
|
|
322
|
+
function resume() {
|
|
323
|
+
isPaused.value = false;
|
|
324
|
+
setup();
|
|
325
|
+
}
|
|
326
|
+
function stop() {
|
|
327
|
+
cleanup();
|
|
328
|
+
}
|
|
329
|
+
onUnmounted(stop);
|
|
330
|
+
return {
|
|
331
|
+
isIntersecting: readonly(isIntersecting),
|
|
332
|
+
isPaused: readonly(isPaused),
|
|
333
|
+
pause,
|
|
334
|
+
resume,
|
|
335
|
+
stop
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Convenience composable for simple intersection detection
|
|
340
|
+
*
|
|
341
|
+
* @param target - Element ref to observe
|
|
342
|
+
* @param options - Observer options
|
|
343
|
+
* @returns Reactive intersection state
|
|
344
|
+
*/
|
|
345
|
+
function useElementIntersection(target, options = {}) {
|
|
346
|
+
const isIntersecting = shallowRef(false);
|
|
347
|
+
const intersectionRatio = shallowRef(0);
|
|
348
|
+
useIntersectionObserver(target, (entries) => {
|
|
349
|
+
const entry = entries.at(-1);
|
|
350
|
+
if (entry) {
|
|
351
|
+
isIntersecting.value = entry.isIntersecting;
|
|
352
|
+
intersectionRatio.value = entry.intersectionRatio;
|
|
353
|
+
}
|
|
354
|
+
}, {
|
|
355
|
+
immediate: true,
|
|
356
|
+
...options
|
|
357
|
+
});
|
|
358
|
+
return {
|
|
359
|
+
isIntersecting: readonly(isIntersecting),
|
|
360
|
+
intersectionRatio: readonly(intersectionRatio)
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
|
|
223
364
|
//#endregion
|
|
224
365
|
//#region src/composables/useKeydown/index.ts
|
|
225
366
|
/**
|
|
@@ -441,6 +582,134 @@ function createLocalePlugin(options = {}) {
|
|
|
441
582
|
});
|
|
442
583
|
}
|
|
443
584
|
|
|
585
|
+
//#endregion
|
|
586
|
+
//#region src/composables/useMutationObserver/index.ts
|
|
587
|
+
/**
|
|
588
|
+
* Composable for observing DOM mutations
|
|
589
|
+
*
|
|
590
|
+
* @param target - Element ref to observe
|
|
591
|
+
* @param callback - Callback fired on mutation
|
|
592
|
+
* @param options - Observer options
|
|
593
|
+
* @returns Observer controls
|
|
594
|
+
*
|
|
595
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
|
|
596
|
+
*/
|
|
597
|
+
function useMutationObserver(target, callback, options = {}) {
|
|
598
|
+
const { isHydrated } = useHydration();
|
|
599
|
+
const observer = shallowRef();
|
|
600
|
+
const isPaused = shallowRef(false);
|
|
601
|
+
const observerOptions = {
|
|
602
|
+
childList: options.childList ?? true,
|
|
603
|
+
attributes: options.attributes ?? false,
|
|
604
|
+
characterData: options.characterData ?? false,
|
|
605
|
+
subtree: options.subtree ?? false,
|
|
606
|
+
attributeOldValue: options.attributeOldValue ?? false,
|
|
607
|
+
characterDataOldValue: options.characterDataOldValue ?? false,
|
|
608
|
+
attributeFilter: options.attributeFilter
|
|
609
|
+
};
|
|
610
|
+
watch([isHydrated, target], ([hydrated, el]) => {
|
|
611
|
+
cleanup();
|
|
612
|
+
if (!hydrated || !SUPPORTS_MUTATION_OBSERVER || !el) return;
|
|
613
|
+
observer.value = new MutationObserver((mutations) => {
|
|
614
|
+
const transformedEntries = mutations.map((mutation) => ({
|
|
615
|
+
type: mutation.type,
|
|
616
|
+
target: mutation.target,
|
|
617
|
+
addedNodes: mutation.addedNodes,
|
|
618
|
+
removedNodes: mutation.removedNodes,
|
|
619
|
+
previousSibling: mutation.previousSibling,
|
|
620
|
+
nextSibling: mutation.nextSibling,
|
|
621
|
+
attributeName: mutation.attributeName,
|
|
622
|
+
attributeNamespace: mutation.attributeNamespace,
|
|
623
|
+
oldValue: mutation.oldValue
|
|
624
|
+
}));
|
|
625
|
+
callback(transformedEntries);
|
|
626
|
+
});
|
|
627
|
+
observer.value.observe(el, observerOptions);
|
|
628
|
+
if (options.immediate) {
|
|
629
|
+
const emptyNodeList = {
|
|
630
|
+
length: 0,
|
|
631
|
+
item: () => null,
|
|
632
|
+
forEach: () => {},
|
|
633
|
+
*[Symbol.iterator]() {}
|
|
634
|
+
};
|
|
635
|
+
const syntheticEntry = {
|
|
636
|
+
type: "childList",
|
|
637
|
+
target: el,
|
|
638
|
+
addedNodes: emptyNodeList,
|
|
639
|
+
removedNodes: emptyNodeList,
|
|
640
|
+
previousSibling: null,
|
|
641
|
+
nextSibling: null,
|
|
642
|
+
attributeName: null,
|
|
643
|
+
attributeNamespace: null,
|
|
644
|
+
oldValue: null
|
|
645
|
+
};
|
|
646
|
+
callback([syntheticEntry]);
|
|
647
|
+
}
|
|
648
|
+
}, { immediate: true });
|
|
649
|
+
function setup() {
|
|
650
|
+
if (!isHydrated.value || !SUPPORTS_MUTATION_OBSERVER || !target.value || isPaused.value) return;
|
|
651
|
+
observer.value = new MutationObserver((mutations) => {
|
|
652
|
+
const transformedEntries = mutations.map((mutation) => ({
|
|
653
|
+
type: mutation.type,
|
|
654
|
+
target: mutation.target,
|
|
655
|
+
addedNodes: mutation.addedNodes,
|
|
656
|
+
removedNodes: mutation.removedNodes,
|
|
657
|
+
previousSibling: mutation.previousSibling,
|
|
658
|
+
nextSibling: mutation.nextSibling,
|
|
659
|
+
attributeName: mutation.attributeName,
|
|
660
|
+
attributeNamespace: mutation.attributeNamespace,
|
|
661
|
+
oldValue: mutation.oldValue
|
|
662
|
+
}));
|
|
663
|
+
callback(transformedEntries);
|
|
664
|
+
});
|
|
665
|
+
observer.value.observe(target.value, observerOptions);
|
|
666
|
+
if (options.immediate) {
|
|
667
|
+
const emptyNodeList = {
|
|
668
|
+
length: 0,
|
|
669
|
+
item: () => null,
|
|
670
|
+
forEach: () => {},
|
|
671
|
+
*[Symbol.iterator]() {}
|
|
672
|
+
};
|
|
673
|
+
const syntheticEntry = {
|
|
674
|
+
type: "childList",
|
|
675
|
+
target: target.value,
|
|
676
|
+
addedNodes: emptyNodeList,
|
|
677
|
+
removedNodes: emptyNodeList,
|
|
678
|
+
previousSibling: null,
|
|
679
|
+
nextSibling: null,
|
|
680
|
+
attributeName: null,
|
|
681
|
+
attributeNamespace: null,
|
|
682
|
+
oldValue: null
|
|
683
|
+
};
|
|
684
|
+
callback([syntheticEntry]);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
function cleanup() {
|
|
688
|
+
if (observer.value) {
|
|
689
|
+
observer.value.disconnect();
|
|
690
|
+
observer.value = void 0;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
function pause() {
|
|
694
|
+
isPaused.value = true;
|
|
695
|
+
observer.value?.disconnect();
|
|
696
|
+
}
|
|
697
|
+
function resume() {
|
|
698
|
+
isPaused.value = false;
|
|
699
|
+
setup();
|
|
700
|
+
}
|
|
701
|
+
function stop() {
|
|
702
|
+
cleanup();
|
|
703
|
+
}
|
|
704
|
+
onUnmounted(stop);
|
|
705
|
+
return {
|
|
706
|
+
isPaused: readonly(isPaused),
|
|
707
|
+
pause,
|
|
708
|
+
resume,
|
|
709
|
+
stop
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
|
|
444
713
|
//#endregion
|
|
445
714
|
//#region src/composables/useProxyModel/index.ts
|
|
446
715
|
/**
|
|
@@ -503,6 +772,126 @@ function useProxyModel(registry, initial, options, _transformIn, _transformOut)
|
|
|
503
772
|
return model;
|
|
504
773
|
}
|
|
505
774
|
|
|
775
|
+
//#endregion
|
|
776
|
+
//#region src/composables/useResizeObserver/index.ts
|
|
777
|
+
/**
|
|
778
|
+
* Composable for observing element resize events
|
|
779
|
+
*
|
|
780
|
+
* @param target - Element ref to observe
|
|
781
|
+
* @param callback - Callback fired on resize
|
|
782
|
+
* @param options - Observer options
|
|
783
|
+
* @returns Observer controls
|
|
784
|
+
*
|
|
785
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver
|
|
786
|
+
*/
|
|
787
|
+
function useResizeObserver(target, callback, options = {}) {
|
|
788
|
+
const { isHydrated } = useHydration();
|
|
789
|
+
const observer = shallowRef();
|
|
790
|
+
const isPaused = shallowRef(false);
|
|
791
|
+
watch([isHydrated, target], ([hydrated, el]) => {
|
|
792
|
+
cleanup();
|
|
793
|
+
if (!hydrated || !SUPPORTS_OBSERVER || !el) return;
|
|
794
|
+
observer.value = new ResizeObserver((entries) => {
|
|
795
|
+
const transformedEntries = entries.map((entry) => ({
|
|
796
|
+
contentRect: {
|
|
797
|
+
width: entry.contentRect.width,
|
|
798
|
+
height: entry.contentRect.height,
|
|
799
|
+
top: entry.contentRect.top,
|
|
800
|
+
left: entry.contentRect.left
|
|
801
|
+
},
|
|
802
|
+
target: entry.target
|
|
803
|
+
}));
|
|
804
|
+
callback(transformedEntries);
|
|
805
|
+
});
|
|
806
|
+
observer.value.observe(el, { box: options.box || "content-box" });
|
|
807
|
+
if (options.immediate) {
|
|
808
|
+
const rect = el.getBoundingClientRect();
|
|
809
|
+
callback([{
|
|
810
|
+
contentRect: {
|
|
811
|
+
width: rect.width,
|
|
812
|
+
height: rect.height,
|
|
813
|
+
top: rect.top,
|
|
814
|
+
left: rect.left
|
|
815
|
+
},
|
|
816
|
+
target: el
|
|
817
|
+
}]);
|
|
818
|
+
}
|
|
819
|
+
});
|
|
820
|
+
function setup() {
|
|
821
|
+
if (!isHydrated.value || !SUPPORTS_OBSERVER || !target.value || isPaused.value) return;
|
|
822
|
+
observer.value = new ResizeObserver((entries) => {
|
|
823
|
+
const transformedEntries = entries.map((entry) => ({
|
|
824
|
+
contentRect: {
|
|
825
|
+
width: entry.contentRect.width,
|
|
826
|
+
height: entry.contentRect.height,
|
|
827
|
+
top: entry.contentRect.top,
|
|
828
|
+
left: entry.contentRect.left
|
|
829
|
+
},
|
|
830
|
+
target: entry.target
|
|
831
|
+
}));
|
|
832
|
+
callback(transformedEntries);
|
|
833
|
+
});
|
|
834
|
+
observer.value.observe(target.value, { box: options.box || "content-box" });
|
|
835
|
+
if (options.immediate) {
|
|
836
|
+
const rect = target.value.getBoundingClientRect();
|
|
837
|
+
callback([{
|
|
838
|
+
contentRect: {
|
|
839
|
+
width: rect.width,
|
|
840
|
+
height: rect.height,
|
|
841
|
+
top: rect.top,
|
|
842
|
+
left: rect.left
|
|
843
|
+
},
|
|
844
|
+
target: target.value
|
|
845
|
+
}]);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
function cleanup() {
|
|
849
|
+
if (observer.value) {
|
|
850
|
+
observer.value.disconnect();
|
|
851
|
+
observer.value = void 0;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
function pause() {
|
|
855
|
+
isPaused.value = true;
|
|
856
|
+
observer.value?.disconnect();
|
|
857
|
+
}
|
|
858
|
+
function resume() {
|
|
859
|
+
isPaused.value = false;
|
|
860
|
+
setup();
|
|
861
|
+
}
|
|
862
|
+
function stop() {
|
|
863
|
+
cleanup();
|
|
864
|
+
}
|
|
865
|
+
onUnmounted(stop);
|
|
866
|
+
return {
|
|
867
|
+
isPaused: readonly(isPaused),
|
|
868
|
+
pause,
|
|
869
|
+
resume,
|
|
870
|
+
stop
|
|
871
|
+
};
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* Convenience composable for tracking element dimensions
|
|
875
|
+
*
|
|
876
|
+
* @param target - Element ref to observe
|
|
877
|
+
* @returns Reactive width and height
|
|
878
|
+
*/
|
|
879
|
+
function useElementSize(target) {
|
|
880
|
+
const width = shallowRef(0);
|
|
881
|
+
const height = shallowRef(0);
|
|
882
|
+
useResizeObserver(target, (entries) => {
|
|
883
|
+
const entry = entries[0];
|
|
884
|
+
if (entry) {
|
|
885
|
+
width.value = entry.contentRect.width;
|
|
886
|
+
height.value = entry.contentRect.height;
|
|
887
|
+
}
|
|
888
|
+
}, { immediate: true });
|
|
889
|
+
return {
|
|
890
|
+
width,
|
|
891
|
+
height
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
|
|
506
895
|
//#endregion
|
|
507
896
|
//#region src/composables/useStorage/adapters/memory.ts
|
|
508
897
|
/**
|
|
@@ -611,4 +1000,4 @@ function createStoragePlugin(options = {}) {
|
|
|
611
1000
|
}
|
|
612
1001
|
|
|
613
1002
|
//#endregion
|
|
614
|
-
export { createLocale, createLocalePlugin, createStorage, createStoragePlugin, provideStorageContext, useDocumentEventListener, useEventListener, useFilter, useForm, useKeydown, useLayout, useLocale, useProxyModel, useStorage, useStorageContext, useWindowEventListener };
|
|
1003
|
+
export { createLocale, createLocalePlugin, createStorage, createStoragePlugin, provideStorageContext, useDocumentEventListener, useElementIntersection, useElementSize, useEventListener, useFilter, useForm, useIntersectionObserver, useKeydown, useLayout, useLocale, useMutationObserver, useProxyModel, useResizeObserver, useStorage, useStorageContext, useWindowEventListener };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { COMMON_ELEMENTS, HTMLElementName, IN_BROWSER, SELF_CLOSING_TAGS, SUPPORTS_INTERSECTION_OBSERVER, SUPPORTS_MATCH_MEDIA, SUPPORTS_MUTATION_OBSERVER, SUPPORTS_OBSERVER, SUPPORTS_TOUCH, SelfClosingElement, __LOGGER_ENABLED__, isSelfClosingTag, version } from "../index-z_zwVNP8.js";
|
|
2
|
+
export { COMMON_ELEMENTS, HTMLElementName, IN_BROWSER, SELF_CLOSING_TAGS, SUPPORTS_INTERSECTION_OBSERVER, SUPPORTS_MATCH_MEDIA, SUPPORTS_MUTATION_OBSERVER, SUPPORTS_OBSERVER, SUPPORTS_TOUCH, SelfClosingElement, __LOGGER_ENABLED__, isSelfClosingTag, version };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { COMMON_ELEMENTS, SELF_CLOSING_TAGS, isSelfClosingTag } from "../htmlElements-SjqYu0am.js";
|
|
2
|
+
import { IN_BROWSER, SUPPORTS_INTERSECTION_OBSERVER, SUPPORTS_MATCH_MEDIA, SUPPORTS_MUTATION_OBSERVER, SUPPORTS_OBSERVER, SUPPORTS_TOUCH, __LOGGER_ENABLED__, version } from "../globals--2b7sF4-.js";
|
|
3
|
+
import "../constants-DiTCgvMU.js";
|
|
4
|
+
|
|
5
|
+
export { COMMON_ELEMENTS, IN_BROWSER, SELF_CLOSING_TAGS, SUPPORTS_INTERSECTION_OBSERVER, SUPPORTS_MATCH_MEDIA, SUPPORTS_MUTATION_OBSERVER, SUPPORTS_OBSERVER, SUPPORTS_TOUCH, __LOGGER_ENABLED__, isSelfClosingTag, version };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createContext, createPlugin, createTrinity, useContext } from "../
|
|
2
|
-
import "../factories-DOLmqhVS.mjs";
|
|
1
|
+
import { createContext, createPlugin, createTrinity, useContext } from "../factories-CPq2yMlr.js";
|
|
3
2
|
|
|
4
3
|
export { createContext, createPlugin, createTrinity, useContext };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/constants/globals.ts
|
|
2
|
+
const IN_BROWSER = typeof window !== "undefined";
|
|
3
|
+
const SUPPORTS_TOUCH = IN_BROWSER && ("ontouchstart" in window || window.navigator.maxTouchPoints > 0);
|
|
4
|
+
const SUPPORTS_MATCH_MEDIA = IN_BROWSER && "matchMedia" in window && typeof window.matchMedia === "function";
|
|
5
|
+
const SUPPORTS_OBSERVER = IN_BROWSER && "ResizeObserver" in window;
|
|
6
|
+
const SUPPORTS_INTERSECTION_OBSERVER = IN_BROWSER && "IntersectionObserver" in window;
|
|
7
|
+
const SUPPORTS_MUTATION_OBSERVER = IN_BROWSER && "MutationObserver" in window;
|
|
8
|
+
const version = "0.0.2";
|
|
9
|
+
const __LOGGER_ENABLED__ = process.env.NODE_ENV !== "production" || process.env.VITE_LOGGER_ENABLED === "true";
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { IN_BROWSER, SUPPORTS_INTERSECTION_OBSERVER, SUPPORTS_MATCH_MEDIA, SUPPORTS_MUTATION_OBSERVER, SUPPORTS_OBSERVER, SUPPORTS_TOUCH, __LOGGER_ENABLED__, version };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
//#region src/constants/htmlElements.ts
|
|
2
|
+
const selfClosingTags = [
|
|
3
|
+
"area",
|
|
4
|
+
"base",
|
|
5
|
+
"br",
|
|
6
|
+
"col",
|
|
7
|
+
"embed",
|
|
8
|
+
"hr",
|
|
9
|
+
"img",
|
|
10
|
+
"input",
|
|
11
|
+
"link",
|
|
12
|
+
"meta",
|
|
13
|
+
"source",
|
|
14
|
+
"track",
|
|
15
|
+
"wbr"
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* Set of HTML elements that are self-closing (void elements)
|
|
19
|
+
* These elements cannot have children and don't need closing tags
|
|
20
|
+
*/
|
|
21
|
+
const SELF_CLOSING_TAGS = new Set(selfClosingTags);
|
|
22
|
+
/**
|
|
23
|
+
* Common HTML element types for polymorphic components
|
|
24
|
+
*/
|
|
25
|
+
const COMMON_ELEMENTS = {
|
|
26
|
+
DIV: "div",
|
|
27
|
+
SPAN: "span",
|
|
28
|
+
SECTION: "section",
|
|
29
|
+
ARTICLE: "article",
|
|
30
|
+
ASIDE: "aside",
|
|
31
|
+
HEADER: "header",
|
|
32
|
+
FOOTER: "footer",
|
|
33
|
+
MAIN: "main",
|
|
34
|
+
NAV: "nav",
|
|
35
|
+
P: "p",
|
|
36
|
+
H1: "h1",
|
|
37
|
+
H2: "h2",
|
|
38
|
+
H3: "h3",
|
|
39
|
+
H4: "h4",
|
|
40
|
+
H5: "h5",
|
|
41
|
+
H6: "h6",
|
|
42
|
+
BUTTON: "button",
|
|
43
|
+
A: "a",
|
|
44
|
+
INPUT: "input",
|
|
45
|
+
TEXTAREA: "textarea",
|
|
46
|
+
SELECT: "select",
|
|
47
|
+
LABEL: "label",
|
|
48
|
+
UL: "ul",
|
|
49
|
+
OL: "ol",
|
|
50
|
+
LI: "li",
|
|
51
|
+
DL: "dl",
|
|
52
|
+
DT: "dt",
|
|
53
|
+
DD: "dd",
|
|
54
|
+
IMG: "img",
|
|
55
|
+
VIDEO: "video",
|
|
56
|
+
AUDIO: "audio",
|
|
57
|
+
CANVAS: "canvas",
|
|
58
|
+
SVG: "svg",
|
|
59
|
+
TABLE: "table",
|
|
60
|
+
THEAD: "thead",
|
|
61
|
+
TBODY: "tbody",
|
|
62
|
+
TFOOT: "tfoot",
|
|
63
|
+
TR: "tr",
|
|
64
|
+
TH: "th",
|
|
65
|
+
TD: "td",
|
|
66
|
+
FORM: "form",
|
|
67
|
+
FIELDSET: "fieldset",
|
|
68
|
+
LEGEND: "legend"
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Check if an element is self-closing
|
|
72
|
+
*/
|
|
73
|
+
function isSelfClosingTag(tag) {
|
|
74
|
+
return SELF_CLOSING_TAGS.has(tag.toLowerCase());
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
export { COMMON_ELEMENTS, SELF_CLOSING_TAGS, isSelfClosingTag };
|