@vellira-ui/core 2.58.0 → 2.59.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.
@@ -0,0 +1,9 @@
1
+ import type { OverlayAutoFocusEvent } from '../utils/types.js';
2
+ export type RunOverlayCloseAutoFocusOptions = {
3
+ enabled: boolean;
4
+ event?: OverlayAutoFocusEvent;
5
+ onCloseAutoFocus?: (event: OverlayAutoFocusEvent) => void;
6
+ };
7
+ export declare function runOverlayCloseAutoFocus({ enabled, event, onCloseAutoFocus, }: RunOverlayCloseAutoFocusOptions): boolean;
8
+ export declare function deferOverlayFocusRestore(restoreFocus: () => void, schedule?: (callback: () => void) => void): void;
9
+ //# sourceMappingURL=focusRestore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focusRestore.d.ts","sourceRoot":"","sources":["../../../src/behavior/overlay/focusRestore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE/D,MAAM,MAAM,+BAA+B,GAAG;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,qBAAqB,CAAC;IAC9B,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;CAC3D,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,EACvC,OAAO,EACP,KAAK,EACL,gBAAgB,GACjB,EAAE,+BAA+B,WAQjC;AAED,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,MAAM,IAAI,EACxB,QAAQ,GAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAqB,QAG1D"}
@@ -0,0 +1,11 @@
1
+ import { createAutoFocusEvent } from '../utils/events.js';
2
+ export function runOverlayCloseAutoFocus({ enabled, event, onCloseAutoFocus, }) {
3
+ if (!enabled)
4
+ return false;
5
+ const closeEvent = event ?? createAutoFocusEvent();
6
+ onCloseAutoFocus?.(closeEvent);
7
+ return !closeEvent.defaultPrevented;
8
+ }
9
+ export function deferOverlayFocusRestore(restoreFocus, schedule = queueMicrotask) {
10
+ schedule(restoreFocus);
11
+ }
@@ -1,4 +1,10 @@
1
+ export type { RunOverlayCloseAutoFocusOptions } from './focusRestore.js';
2
+ export { deferOverlayFocusRestore, runOverlayCloseAutoFocus, } from './focusRestore.js';
1
3
  export type { OverlayDiagnostics, OverlayStackEntry, OverlayZIndexPolicy, } from './policy.js';
2
4
  export { createConsoleOverlayDiagnostics, createOverlayStack, createOverlayZIndexPolicy, getTopOverlay, OVERLAY_STACK_ORDER_STEP, resolveOverlayZIndex, } from './policy.js';
5
+ export type { ResolveOverlayPresentationOptions } from './presentation.js';
6
+ export { resolveOverlayPresentation } from './presentation.js';
7
+ export type { CreateOverlayManagerStoreOptions, OverlayManagerStore, OverlayManagerStoreEntry, OverlayManagerStoreRegistration, OverlayManagerStoreSnapshot, } from './store.js';
8
+ export { createOverlayManagerStore } from './store.js';
3
9
  export type { OverlayDismissOptions, ScrollLockOptions } from './types.js';
4
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/behavior/overlay/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,+BAA+B,EAC/B,kBAAkB,EAClB,yBAAyB,EACzB,aAAa,EACb,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/behavior/overlay/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACL,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,+BAA+B,EAC/B,kBAAkB,EAClB,yBAAyB,EACzB,aAAa,EACb,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,iCAAiC,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC/D,YAAY,EACV,gCAAgC,EAChC,mBAAmB,EACnB,wBAAwB,EACxB,+BAA+B,EAC/B,2BAA2B,GAC5B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACvD,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
@@ -1 +1,4 @@
1
+ export { deferOverlayFocusRestore, runOverlayCloseAutoFocus, } from './focusRestore.js';
1
2
  export { createConsoleOverlayDiagnostics, createOverlayStack, createOverlayZIndexPolicy, getTopOverlay, OVERLAY_STACK_ORDER_STEP, resolveOverlayZIndex, } from './policy.js';
3
+ export { resolveOverlayPresentation } from './presentation.js';
4
+ export { createOverlayManagerStore } from './store.js';
@@ -0,0 +1,7 @@
1
+ export type ResolveOverlayPresentationOptions<TPresentation extends string, TAuto extends TPresentation = TPresentation> = {
2
+ presentation?: TPresentation | 'auto';
3
+ defaultPresentation: TPresentation;
4
+ autoPresentation?: TAuto;
5
+ };
6
+ export declare function resolveOverlayPresentation<TPresentation extends string, TAuto extends TPresentation = TPresentation>({ autoPresentation, defaultPresentation, presentation, }: ResolveOverlayPresentationOptions<TPresentation, TAuto>): TPresentation;
7
+ //# sourceMappingURL=presentation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation.d.ts","sourceRoot":"","sources":["../../../src/behavior/overlay/presentation.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iCAAiC,CAC3C,aAAa,SAAS,MAAM,EAC5B,KAAK,SAAS,aAAa,GAAG,aAAa,IACzC;IACF,YAAY,CAAC,EAAE,aAAa,GAAG,MAAM,CAAC;IACtC,mBAAmB,EAAE,aAAa,CAAC;IACnC,gBAAgB,CAAC,EAAE,KAAK,CAAC;CAC1B,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,aAAa,SAAS,MAAM,EAC5B,KAAK,SAAS,aAAa,GAAG,aAAa,EAC3C,EACA,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,GACb,EAAE,iCAAiC,CAAC,aAAa,EAAE,KAAK,CAAC,GAAG,aAAa,CAMzE"}
@@ -0,0 +1,6 @@
1
+ export function resolveOverlayPresentation({ autoPresentation, defaultPresentation, presentation, }) {
2
+ if (presentation === 'auto') {
3
+ return autoPresentation ?? defaultPresentation;
4
+ }
5
+ return presentation ?? defaultPresentation;
6
+ }
@@ -0,0 +1,34 @@
1
+ import { type OverlayDiagnostics, type OverlayStackEntry, type OverlayZIndexPolicy } from './policy.js';
2
+ export type OverlayManagerStoreEntry<TLevel extends string = string> = OverlayStackEntry & {
3
+ zIndexLevel: TLevel;
4
+ zIndex?: number;
5
+ };
6
+ export type OverlayManagerStoreRegistration<TLevel extends string = string> = {
7
+ id: string;
8
+ zIndexLevel?: TLevel;
9
+ zIndex?: number;
10
+ };
11
+ export type OverlayManagerStoreSnapshot<TLevel extends string = string> = {
12
+ registry: ReadonlyMap<string, OverlayManagerStoreEntry<TLevel>>;
13
+ stack: readonly OverlayManagerStoreEntry<TLevel>[];
14
+ topmost: OverlayManagerStoreEntry<TLevel> | null;
15
+ };
16
+ export type OverlayManagerStore<TLevel extends string = string> = {
17
+ register: (registration: OverlayManagerStoreRegistration<TLevel>) => OverlayManagerStoreEntry<TLevel>;
18
+ unregister: (id: string) => void;
19
+ update: (registration: OverlayManagerStoreRegistration<TLevel>) => OverlayManagerStoreEntry<TLevel> | null;
20
+ getSnapshot: () => OverlayManagerStoreSnapshot<TLevel>;
21
+ getEntry: (id: string) => OverlayManagerStoreEntry<TLevel> | null;
22
+ getStack: () => readonly OverlayManagerStoreEntry<TLevel>[];
23
+ getTopmost: () => OverlayManagerStoreEntry<TLevel> | null;
24
+ isTopmost: (id: string) => boolean;
25
+ getZIndex: (id: string) => number | undefined;
26
+ subscribe: (listener: () => void) => () => void;
27
+ clear: () => void;
28
+ };
29
+ export type CreateOverlayManagerStoreOptions<TLevel extends string = string> = {
30
+ policy: OverlayZIndexPolicy<TLevel>;
31
+ diagnostics?: OverlayDiagnostics;
32
+ };
33
+ export declare function createOverlayManagerStore<TLevel extends string>({ diagnostics, policy, }: CreateOverlayManagerStoreOptions<TLevel>): OverlayManagerStore<TLevel>;
34
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/behavior/overlay/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EAEzB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,wBAAwB,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,IACjE,iBAAiB,GAAG;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEJ,MAAM,MAAM,+BAA+B,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,IAAI;IAC5E,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,2BAA2B,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,IAAI;IACxE,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,wBAAwB,CAAC,MAAM,CAAC,CAAC,CAAC;IAChE,KAAK,EAAE,SAAS,wBAAwB,CAAC,MAAM,CAAC,EAAE,CAAC;IACnD,OAAO,EAAE,wBAAwB,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,mBAAmB,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,IAAI;IAChE,QAAQ,EAAE,CACR,YAAY,EAAE,+BAA+B,CAAC,MAAM,CAAC,KAClD,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACtC,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,MAAM,EAAE,CACN,YAAY,EAAE,+BAA+B,CAAC,MAAM,CAAC,KAClD,wBAAwB,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAC7C,WAAW,EAAE,MAAM,2BAA2B,CAAC,MAAM,CAAC,CAAC;IACvD,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,wBAAwB,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAClE,QAAQ,EAAE,MAAM,SAAS,wBAAwB,CAAC,MAAM,CAAC,EAAE,CAAC;IAC5D,UAAU,EAAE,MAAM,wBAAwB,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAC1D,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IACnC,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC9C,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;IAChD,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,gCAAgC,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,IAAI;IAC7E,MAAM,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACpC,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC,CAAC;AAsBF,wBAAgB,yBAAyB,CAAC,MAAM,SAAS,MAAM,EAAE,EAC/D,WAAW,EACX,MAAM,GACP,EAAE,gCAAgC,CAAC,MAAM,CAAC,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAgHxE"}
@@ -0,0 +1,100 @@
1
+ import { createOverlayStack, getTopOverlay, resolveOverlayZIndex, } from './policy.js';
2
+ function cloneRegistry(registry) {
3
+ return new Map(Array.from(registry.entries()).map(([id, entry]) => [id, { ...entry }]));
4
+ }
5
+ function createSnapshot(registry) {
6
+ const stack = createOverlayStack(registry.values());
7
+ return {
8
+ registry: cloneRegistry(registry),
9
+ stack,
10
+ topmost: getTopOverlay(stack),
11
+ };
12
+ }
13
+ export function createOverlayManagerStore({ diagnostics, policy, }) {
14
+ const registry = new Map();
15
+ const listeners = new Set();
16
+ let orderSeed = 0;
17
+ let snapshot = createSnapshot(registry);
18
+ const emit = () => {
19
+ snapshot = createSnapshot(registry);
20
+ listeners.forEach((listener) => listener());
21
+ };
22
+ const resolveZIndex = (entry) => resolveOverlayZIndex({
23
+ explicitZIndex: entry.zIndex,
24
+ level: entry.zIndexLevel,
25
+ order: entry.order,
26
+ policy,
27
+ });
28
+ return {
29
+ register(registration) {
30
+ if (registry.has(registration.id)) {
31
+ diagnostics?.duplicateRegistration?.(registration.id);
32
+ }
33
+ registry.delete(registration.id);
34
+ const entry = {
35
+ id: registration.id,
36
+ zIndexLevel: registration.zIndexLevel ?? policy.defaultLevel,
37
+ order: orderSeed++,
38
+ zIndex: registration.zIndex,
39
+ };
40
+ registry.set(registration.id, entry);
41
+ emit();
42
+ return entry;
43
+ },
44
+ unregister(id) {
45
+ if (!registry.delete(id)) {
46
+ diagnostics?.unknownUnregister?.(id);
47
+ return;
48
+ }
49
+ if (registry.size === 0) {
50
+ orderSeed = 0;
51
+ }
52
+ emit();
53
+ },
54
+ update(registration) {
55
+ const current = registry.get(registration.id);
56
+ if (!current)
57
+ return null;
58
+ const next = {
59
+ ...current,
60
+ zIndexLevel: registration.zIndexLevel ?? current.zIndexLevel,
61
+ zIndex: registration.zIndex,
62
+ };
63
+ registry.set(registration.id, next);
64
+ emit();
65
+ return next;
66
+ },
67
+ getSnapshot() {
68
+ return snapshot;
69
+ },
70
+ getEntry(id) {
71
+ return registry.get(id) ?? null;
72
+ },
73
+ getStack() {
74
+ return snapshot.stack;
75
+ },
76
+ getTopmost() {
77
+ return snapshot.topmost;
78
+ },
79
+ isTopmost(id) {
80
+ return snapshot.topmost?.id === id;
81
+ },
82
+ getZIndex(id) {
83
+ const entry = registry.get(id);
84
+ return entry ? resolveZIndex(entry) : undefined;
85
+ },
86
+ subscribe(listener) {
87
+ listeners.add(listener);
88
+ return () => {
89
+ listeners.delete(listener);
90
+ };
91
+ },
92
+ clear() {
93
+ if (registry.size === 0)
94
+ return;
95
+ registry.clear();
96
+ orderSeed = 0;
97
+ emit();
98
+ },
99
+ };
100
+ }
@@ -1,3 +1,5 @@
1
1
  export { createAutoFocusEvent, createOutsideEvent } from './events.js';
2
+ export type { RetainedResourceDetach, RetainedResourceRegistry, } from './retainedResource.js';
3
+ export { createRetainedResourceRegistry } from './retainedResource.js';
2
4
  export type { OverlayAutoFocusEvent, OverlayOutsideEvent } from './types.js';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/behavior/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACvE,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/behavior/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACvE,YAAY,EACV,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AACvE,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
@@ -1 +1,2 @@
1
1
  export { createAutoFocusEvent, createOutsideEvent } from './events.js';
2
+ export { createRetainedResourceRegistry } from './retainedResource.js';
@@ -0,0 +1,8 @@
1
+ export type RetainedResourceDetach = () => void;
2
+ export type RetainedResourceRegistry<TTarget extends object> = {
3
+ retain: (target: TTarget) => RetainedResourceDetach;
4
+ release: (target: TTarget) => void;
5
+ clear: () => void;
6
+ };
7
+ export declare function createRetainedResourceRegistry<TTarget extends object>(attach: (target: TTarget) => RetainedResourceDetach | undefined): RetainedResourceRegistry<TTarget>;
8
+ //# sourceMappingURL=retainedResource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retainedResource.d.ts","sourceRoot":"","sources":["../../../src/behavior/utils/retainedResource.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAAG,MAAM,IAAI,CAAC;AAEhD,MAAM,MAAM,wBAAwB,CAAC,OAAO,SAAS,MAAM,IAAI;IAC7D,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,sBAAsB,CAAC;IACpD,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AASF,wBAAgB,8BAA8B,CAAC,OAAO,SAAS,MAAM,EACnE,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,sBAAsB,GAAG,SAAS,GAC9D,wBAAwB,CAAC,OAAO,CAAC,CA8CnC"}
@@ -0,0 +1,39 @@
1
+ const noop = () => undefined;
2
+ export function createRetainedResourceRegistry(attach) {
3
+ const resources = new Map();
4
+ return {
5
+ retain(target) {
6
+ let resource = resources.get(target);
7
+ if (!resource) {
8
+ const detach = attach(target);
9
+ if (!detach)
10
+ return noop;
11
+ resource = {
12
+ count: 0,
13
+ detach,
14
+ };
15
+ resources.set(target, resource);
16
+ }
17
+ resource.count += 1;
18
+ return () => {
19
+ this.release(target);
20
+ };
21
+ },
22
+ release(target) {
23
+ const resource = resources.get(target);
24
+ if (!resource)
25
+ return;
26
+ resource.count = Math.max(0, resource.count - 1);
27
+ if (resource.count > 0)
28
+ return;
29
+ resource.detach();
30
+ resources.delete(target);
31
+ },
32
+ clear() {
33
+ resources.forEach((resource) => {
34
+ resource.detach();
35
+ });
36
+ resources.clear();
37
+ },
38
+ };
39
+ }
@@ -0,0 +1,9 @@
1
+ export declare const compoundSlotSymbol: unique symbol;
2
+ export type CompoundSlotKey = string | symbol;
3
+ export type CompoundSlotComponent<TComponent, TSlot extends CompoundSlotKey = CompoundSlotKey> = TComponent & {
4
+ [compoundSlotSymbol]?: TSlot;
5
+ };
6
+ export declare const markCompoundSlot: <TComponent, TSlot extends CompoundSlotKey>(component: TComponent, slot: TSlot) => CompoundSlotComponent<TComponent, TSlot>;
7
+ export declare const getCompoundSlot: <TSlot extends CompoundSlotKey = CompoundSlotKey>(component: unknown) => TSlot | undefined;
8
+ export declare const copyCompoundSlotMetadata: <TSource, TTarget, TSlot extends CompoundSlotKey = CompoundSlotKey>(source: TSource, target: TTarget) => TTarget;
9
+ //# sourceMappingURL=compoundSlot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compoundSlot.d.ts","sourceRoot":"","sources":["../../src/compound/compoundSlot.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,eAA0C,CAAC;AAE1E,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,CAAC;AAE9C,MAAM,MAAM,qBAAqB,CAC/B,UAAU,EACV,KAAK,SAAS,eAAe,GAAG,eAAe,IAC7C,UAAU,GAAG;IACf,CAAC,kBAAkB,CAAC,CAAC,EAAE,KAAK,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,UAAU,EAAE,KAAK,SAAS,eAAe,EACxE,WAAW,UAAU,EACrB,MAAM,KAAK,KACV,qBAAqB,CAAC,UAAU,EAAE,KAAK,CAMzC,CAAC;AASF,eAAO,MAAM,eAAe,GAC1B,KAAK,SAAS,eAAe,GAAG,eAAe,EAE/C,WAAW,OAAO,KACjB,KAAK,GAAG,SAQV,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,OAAO,EACP,OAAO,EACP,KAAK,SAAS,eAAe,GAAG,eAAe,EAE/C,QAAQ,OAAO,EACf,QAAQ,OAAO,KACd,OASF,CAAC"}
@@ -0,0 +1,20 @@
1
+ export const compoundSlotSymbol = Symbol.for('@vellira-ui/compound-slot');
2
+ export const markCompoundSlot = (component, slot) => {
3
+ const marked = component;
4
+ marked[compoundSlotSymbol] = slot;
5
+ return marked;
6
+ };
7
+ export const getCompoundSlot = (component) => {
8
+ const slotComponent = component;
9
+ return (slotComponent?.[compoundSlotSymbol] ??
10
+ slotComponent?.type?.[compoundSlotSymbol] ??
11
+ slotComponent?.render?.[compoundSlotSymbol]);
12
+ };
13
+ export const copyCompoundSlotMetadata = (source, target) => {
14
+ const slot = getCompoundSlot(source);
15
+ if (slot !== undefined) {
16
+ target[compoundSlotSymbol] =
17
+ slot;
18
+ }
19
+ return target;
20
+ };
@@ -0,0 +1,3 @@
1
+ export type { CompoundSlotComponent, CompoundSlotKey } from './compoundSlot.js';
2
+ export { compoundSlotSymbol, copyCompoundSlotMetadata, getCompoundSlot, markCompoundSlot, } from './compoundSlot.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/compound/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,eAAe,EACf,gBAAgB,GACjB,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1 @@
1
+ export { compoundSlotSymbol, copyCompoundSlotMetadata, getCompoundSlot, markCompoundSlot, } from './compoundSlot.js';
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './behavior/index.js';
2
+ export * from './compound/index.js';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -1 +1,2 @@
1
1
  export * from './behavior/index.js';
2
+ export * from './compound/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellira-ui/core",
3
- "version": "2.58.0",
3
+ "version": "2.59.1",
4
4
  "description": "Shared logic and hooks for Vellira Design System",
5
5
  "keywords": [
6
6
  "vellira",
@@ -41,7 +41,11 @@
41
41
  "scripts": {
42
42
  "clean": "node --input-type=module -e \"import fs from 'node:fs'; fs.rmSync('dist', { recursive: true, force: true })\"",
43
43
  "build": "pnpm run clean && tsc -p tsconfig.build.json",
44
- "typecheck": "tsc -p tsconfig.json --noEmit"
44
+ "typecheck": "tsc -p tsconfig.json --noEmit",
45
+ "test": "vitest run"
46
+ },
47
+ "devDependencies": {
48
+ "vitest": "^4.1.10"
45
49
  },
46
50
  "publishConfig": {
47
51
  "access": "public"