base-ui-vue 0.1.0 → 0.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/README.md +41 -1
- package/dist/button/Button.cjs +53 -12
- package/dist/button/Button.cjs.map +1 -1
- package/dist/button/Button.js +26 -15
- package/dist/button/Button.js.map +1 -1
- package/dist/button/ToolbarButton.cjs +367 -0
- package/dist/button/ToolbarButton.cjs.map +1 -0
- package/dist/button/ToolbarButton.js +320 -0
- package/dist/button/ToolbarButton.js.map +1 -0
- package/dist/button/ToolbarButtonDataAttributes.cjs +27 -0
- package/dist/button/ToolbarButtonDataAttributes.cjs.map +1 -0
- package/dist/button/ToolbarButtonDataAttributes.js +21 -0
- package/dist/button/ToolbarButtonDataAttributes.js.map +1 -0
- package/dist/checkbox/index.cjs +1173 -0
- package/dist/checkbox/index.cjs.map +1 -0
- package/dist/checkbox/index.js +1048 -0
- package/dist/checkbox/index.js.map +1 -0
- package/dist/checkbox-group/CheckboxGroup.cjs +629 -0
- package/dist/checkbox-group/CheckboxGroup.cjs.map +1 -0
- package/dist/checkbox-group/CheckboxGroup.js +540 -0
- package/dist/checkbox-group/CheckboxGroup.js.map +1 -0
- package/dist/checkbox-group/CheckboxGroupDataAttributes.cjs +18 -0
- package/dist/checkbox-group/CheckboxGroupDataAttributes.cjs.map +1 -0
- package/dist/checkbox-group/CheckboxGroupDataAttributes.js +12 -0
- package/dist/checkbox-group/CheckboxGroupDataAttributes.js.map +1 -0
- package/dist/composite/composite.cjs +167 -0
- package/dist/composite/composite.cjs.map +1 -1
- package/dist/composite/composite.js +96 -1
- package/dist/composite/composite.js.map +1 -1
- package/dist/composite/constants.cjs +12 -0
- package/dist/composite/constants.cjs.map +1 -0
- package/dist/composite/constants.js +6 -0
- package/dist/composite/constants.js.map +1 -0
- package/dist/control/FieldControl.cjs +18 -343
- package/dist/control/FieldControl.cjs.map +1 -1
- package/dist/control/FieldControl.js +14 -285
- package/dist/control/FieldControl.js.map +1 -1
- package/dist/control/SliderControl.cjs +636 -0
- package/dist/control/SliderControl.cjs.map +1 -0
- package/dist/control/SliderControl.js +553 -0
- package/dist/control/SliderControl.js.map +1 -0
- package/dist/control/SliderControlDataAttributes.cjs +47 -0
- package/dist/control/SliderControlDataAttributes.cjs.map +1 -0
- package/dist/control/SliderControlDataAttributes.js +41 -0
- package/dist/control/SliderControlDataAttributes.js.map +1 -0
- package/dist/csp-provider/CSPContext.cjs +32 -0
- package/dist/csp-provider/CSPContext.cjs.map +1 -0
- package/dist/csp-provider/CSPContext.js +21 -0
- package/dist/csp-provider/CSPContext.js.map +1 -0
- package/dist/csp-provider/CSPProvider.cjs +46 -0
- package/dist/csp-provider/CSPProvider.cjs.map +1 -0
- package/dist/csp-provider/CSPProvider.js +41 -0
- package/dist/csp-provider/CSPProvider.js.map +1 -0
- package/dist/description/FieldDescription.cjs +5 -5
- package/dist/description/FieldDescription.cjs.map +1 -1
- package/dist/description/FieldDescription.js +1 -1
- package/dist/direction-provider/DirectionProvider.cjs +2 -2
- package/dist/direction-provider/DirectionProvider.cjs.map +1 -1
- package/dist/direction-provider/DirectionProvider.js +1 -1
- package/dist/error/FieldError.cjs +10 -288
- package/dist/error/FieldError.cjs.map +1 -1
- package/dist/error/FieldError.js +4 -246
- package/dist/error/FieldError.js.map +1 -1
- package/dist/form/Form.cjs +5 -4
- package/dist/form/Form.cjs.map +1 -1
- package/dist/form/Form.js +5 -4
- package/dist/form/Form.js.map +1 -1
- package/dist/group/ToolbarGroup.cjs +92 -0
- package/dist/group/ToolbarGroup.cjs.map +1 -0
- package/dist/group/ToolbarGroup.js +87 -0
- package/dist/group/ToolbarGroup.js.map +1 -0
- package/dist/group/ToolbarGroupDataAttributes.cjs +23 -0
- package/dist/group/ToolbarGroupDataAttributes.cjs.map +1 -0
- package/dist/group/ToolbarGroupDataAttributes.js +17 -0
- package/dist/group/ToolbarGroupDataAttributes.js.map +1 -0
- package/dist/header/AccordionHeader.cjs +2 -2
- package/dist/header/AccordionHeader.js +1 -1
- package/dist/image/AvatarImage.cjs +4 -4
- package/dist/image/AvatarImage.cjs.map +1 -1
- package/dist/image/AvatarImage.js +1 -1
- package/dist/index.cjs +80 -10
- package/dist/index.d.cts +2751 -612
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +2751 -612
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -5
- package/dist/index2.cjs +3651 -370
- package/dist/index2.cjs.map +1 -1
- package/dist/index2.js +3365 -270
- package/dist/index2.js.map +1 -1
- package/package.json +8 -4
- package/src/accordion/root/AccordionRoot.vue +2 -1
- package/src/checkbox/index.ts +23 -0
- package/src/checkbox/indicator/CheckboxIndicator.vue +102 -0
- package/src/checkbox/indicator/CheckboxIndicatorDataAttributes.ts +61 -0
- package/src/checkbox/root/CheckboxRoot.vue +632 -0
- package/src/checkbox/root/CheckboxRootContext.ts +22 -0
- package/src/checkbox/root/CheckboxRootDataAttributes.ts +54 -0
- package/src/checkbox/utils/useStateAttributesMapping.ts +30 -0
- package/src/checkbox-group/CheckboxGroup.vue +241 -0
- package/src/checkbox-group/CheckboxGroupContext.ts +39 -0
- package/src/checkbox-group/CheckboxGroupDataAttributes.ts +6 -0
- package/src/checkbox-group/index.ts +11 -0
- package/src/checkbox-group/useCheckboxGroupParent.ts +173 -0
- package/src/collapsible/panel/useCollapsiblePanel.ts +2 -1
- package/src/collapsible/root/useCollapsibleRoot.ts +3 -1
- package/src/composite/composite.ts +2 -0
- package/src/composite/item/CompositeItem.vue +7 -8
- package/src/composite/root/CompositeRoot.vue +12 -1
- package/src/csp-provider/CSPContext.ts +26 -0
- package/src/csp-provider/CSPProvider.vue +40 -0
- package/src/csp-provider/index.ts +5 -0
- package/src/field/item/FieldItem.vue +6 -1
- package/src/field/label/FieldLabel.vue +10 -51
- package/src/field/root/FieldRoot.vue +16 -3
- package/src/floating-ui-vue/types.ts +1 -4
- package/src/floating-ui-vue/utils/element.ts +12 -0
- package/src/floating-ui-vue/utils/shadowDom.ts +44 -0
- package/src/floating-ui-vue/utils.ts +3 -0
- package/src/form/Form.vue +5 -3
- package/src/index.ts +9 -0
- package/src/labelable-provider/LabelableContext.ts +2 -2
- package/src/labelable-provider/LabelableProvider.vue +21 -4
- package/src/labelable-provider/index.ts +2 -0
- package/src/labelable-provider/useAriaLabelledBy.ts +9 -9
- package/src/labelable-provider/useLabel.ts +115 -0
- package/src/labelable-provider/useLabelableId.ts +12 -10
- package/src/separator/Separator.vue +65 -0
- package/src/separator/SeparatorDataAttributes.ts +7 -0
- package/src/separator/index.ts +3 -0
- package/src/slider/control/SliderControl.vue +497 -0
- package/src/slider/control/SliderControlDataAttributes.ts +35 -0
- package/src/slider/index.ts +35 -0
- package/src/slider/indicator/SliderIndicator.vue +144 -0
- package/src/slider/indicator/SliderIndicatorDataAttributes.ts +35 -0
- package/src/slider/label/SliderLabel.vue +75 -0
- package/src/slider/root/SliderRoot.vue +557 -0
- package/src/slider/root/SliderRootContext.ts +126 -0
- package/src/slider/root/SliderRootDataAttributes.ts +35 -0
- package/src/slider/root/stateAttributesMapping.ts +13 -0
- package/src/slider/thumb/SliderThumb.vue +601 -0
- package/src/slider/thumb/SliderThumbDataAttributes.ts +39 -0
- package/src/slider/thumb/prehydrationScript.min.ts +5 -0
- package/src/slider/thumb/prehydrationScript.template.js +69 -0
- package/src/slider/track/SliderTrack.vue +48 -0
- package/src/slider/track/SliderTrackDataAttributes.ts +10 -0
- package/src/slider/utils/asc.ts +3 -0
- package/src/slider/utils/getMidpoint.ts +9 -0
- package/src/slider/utils/getPushedThumbValues.ts +68 -0
- package/src/slider/utils/getSliderValue.ts +25 -0
- package/src/slider/utils/replaceArrayItemAtIndex.ts +15 -0
- package/src/slider/utils/resolveThumbCollision.ts +177 -0
- package/src/slider/utils/roundValueToStep.ts +19 -0
- package/src/slider/utils/test-utils.ts +25 -0
- package/src/slider/utils/validateMinimumDistance.ts +20 -0
- package/src/slider/utils/valueArrayToPercentages.ts +10 -0
- package/src/slider/value/SliderValue.vue +90 -0
- package/src/slider/value/SliderValueDataAttributes.ts +35 -0
- package/src/switch/index.ts +14 -0
- package/src/switch/root/SwitchRoot.vue +448 -0
- package/src/switch/root/SwitchRootContext.ts +22 -0
- package/src/switch/root/SwitchRootDataAttributes.ts +46 -0
- package/src/switch/stateAttributesMapping.ts +23 -0
- package/src/switch/thumb/SwitchThumb.vue +59 -0
- package/src/switch/thumb/SwitchThumbDataAttributes.ts +46 -0
- package/src/toggle/Toggle.vue +211 -0
- package/src/toggle/ToggleDataAttributes.ts +6 -0
- package/src/toggle/index.ts +3 -0
- package/src/toggle-group/ToggleGroup.vue +224 -0
- package/src/toggle-group/ToggleGroupContext.ts +45 -0
- package/src/toggle-group/ToggleGroupDataAttributes.ts +15 -0
- package/src/toggle-group/index.ts +5 -0
- package/src/toolbar/button/ToolbarButton.vue +99 -0
- package/src/toolbar/button/ToolbarButtonDataAttributes.ts +15 -0
- package/src/toolbar/group/ToolbarGroup.vue +70 -0
- package/src/toolbar/group/ToolbarGroupContext.ts +23 -0
- package/src/toolbar/group/ToolbarGroupDataAttributes.ts +11 -0
- package/src/toolbar/index.ts +27 -0
- package/src/toolbar/input/ToolbarInput.vue +114 -0
- package/src/toolbar/input/ToolbarInputDataAttributes.ts +15 -0
- package/src/toolbar/link/ToolbarLink.vue +54 -0
- package/src/toolbar/link/ToolbarLinkDataAttributes.ts +7 -0
- package/src/toolbar/root/ToolbarRoot.vue +144 -0
- package/src/toolbar/root/ToolbarRootContext.ts +29 -0
- package/src/toolbar/root/ToolbarRootDataAttributes.ts +11 -0
- package/src/toolbar/separator/ToolbarSeparator.vue +41 -0
- package/src/toolbar/separator/ToolbarSeparatorDataAttributes.ts +7 -0
- package/src/use-button/useButton.ts +2 -1
- package/src/utils/areArraysEqual.ts +12 -0
- package/src/utils/clamp.ts +7 -0
- package/src/utils/createBaseUIEventDetails.ts +9 -0
- package/src/utils/formatNumber.ts +7 -0
- package/src/utils/owner.ts +5 -0
- package/src/utils/resolveAriaLabelledBy.ts +10 -0
- package/src/utils/useControllableState.ts +78 -14
- package/src/utils/useFocusableWhenDisabled.ts +6 -1
- package/src/utils/useMergedRefs.ts +26 -2
- package/src/utils/useRegisteredLabelId.ts +21 -0
- package/src/utils/valueToPercent.ts +7 -0
- package/src/utils/visuallyHidden.ts +24 -0
- package/dist/direction-provider/DirectionContext.cjs +0 -26
- package/dist/direction-provider/DirectionContext.cjs.map +0 -1
- package/dist/direction-provider/DirectionContext.js +0 -15
- package/dist/direction-provider/DirectionContext.js.map +0 -1
|
@@ -1,5 +1,17 @@
|
|
|
1
|
+
/* eslint-disable node/prefer-global/process */
|
|
1
2
|
import type { Ref } from 'vue'
|
|
2
|
-
import { computed, ref } from 'vue'
|
|
3
|
+
import { computed, ref, watch } from 'vue'
|
|
4
|
+
import { error } from './error'
|
|
5
|
+
|
|
6
|
+
type AnyFunction = (...args: any[]) => any
|
|
7
|
+
type NonFunction<T> = T extends AnyFunction ? never : T
|
|
8
|
+
type Getter<T> = () => T
|
|
9
|
+
type Updater<T> = (prevValue: T) => T
|
|
10
|
+
type MaybeGetter<T> = T | Getter<T>
|
|
11
|
+
|
|
12
|
+
function resolveValue<T>(value: MaybeGetter<T>): T {
|
|
13
|
+
return typeof value === 'function' ? (value as Getter<T>)() : value
|
|
14
|
+
}
|
|
3
15
|
|
|
4
16
|
export interface UseControllableStateParameters<T> {
|
|
5
17
|
/**
|
|
@@ -9,35 +21,87 @@ export interface UseControllableStateParameters<T> {
|
|
|
9
21
|
/**
|
|
10
22
|
* The default value used when uncontrolled.
|
|
11
23
|
*/
|
|
12
|
-
default: T
|
|
24
|
+
default: MaybeGetter<T>
|
|
25
|
+
/**
|
|
26
|
+
* The component name displayed in warnings.
|
|
27
|
+
*/
|
|
28
|
+
name?: string
|
|
29
|
+
/**
|
|
30
|
+
* The name of the state variable displayed in warnings.
|
|
31
|
+
* @default 'value'
|
|
32
|
+
*/
|
|
33
|
+
state?: string
|
|
13
34
|
}
|
|
14
35
|
|
|
15
36
|
export interface UseControllableStateReturnValue<T> {
|
|
16
37
|
value: Readonly<Ref<T>>
|
|
17
|
-
setValue: (next: T) => void
|
|
38
|
+
setValue: (next: T | Updater<T>) => void
|
|
18
39
|
}
|
|
19
40
|
|
|
20
41
|
/**
|
|
21
|
-
* Manages controlled / uncontrolled state
|
|
22
|
-
* React's `useControlled` hook.
|
|
23
|
-
*
|
|
42
|
+
* Manages controlled / uncontrolled state
|
|
24
43
|
* - When `controlled()` returns a non-`undefined` value the component is
|
|
25
44
|
* considered **controlled** and the internal state is ignored.
|
|
26
45
|
* - When `controlled()` returns `undefined` the component is **uncontrolled**
|
|
27
46
|
* and the internal ref drives the value.
|
|
28
47
|
*/
|
|
29
48
|
export function useControllableState<T>(
|
|
30
|
-
params: UseControllableStateParameters<T
|
|
31
|
-
): UseControllableStateReturnValue<T
|
|
32
|
-
|
|
49
|
+
params: UseControllableStateParameters<NonFunction<T>>,
|
|
50
|
+
): UseControllableStateReturnValue<NonFunction<T>> {
|
|
51
|
+
type State = NonFunction<T>
|
|
52
|
+
|
|
53
|
+
const stateName = params.state ?? 'value'
|
|
54
|
+
const componentName = params.name ?? 'component'
|
|
33
55
|
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
56
|
+
const controlledValue = computed<State | undefined>(() => params.controlled())
|
|
57
|
+
const defaultValue = computed<State>(() => resolveValue(params.default))
|
|
58
|
+
const isControlled = ref(controlledValue.value !== undefined)
|
|
59
|
+
|
|
60
|
+
const internalValue = ref<State>(defaultValue.value) as Ref<State>
|
|
61
|
+
|
|
62
|
+
const value = computed<State>(() => {
|
|
63
|
+
return isControlled.value
|
|
64
|
+
? controlledValue.value as State
|
|
65
|
+
: internalValue.value
|
|
37
66
|
})
|
|
38
67
|
|
|
39
|
-
|
|
40
|
-
|
|
68
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
69
|
+
const initialDefaultValue = JSON.stringify(defaultValue.value)
|
|
70
|
+
|
|
71
|
+
watch(controlledValue, (nextControlledValue) => {
|
|
72
|
+
const nextIsControlled = nextControlledValue !== undefined
|
|
73
|
+
|
|
74
|
+
if (isControlled.value !== nextIsControlled) {
|
|
75
|
+
error(
|
|
76
|
+
`A component is changing the ${isControlled.value ? '' : 'un'}controlled ${stateName} state of ${componentName} to be ${isControlled.value ? 'un' : ''}controlled.`,
|
|
77
|
+
'Elements should not switch from uncontrolled to controlled (or vice versa).',
|
|
78
|
+
`Decide between using a controlled or uncontrolled ${componentName} element for the lifetime of the component.`,
|
|
79
|
+
'The nature of the state is determined during the first render. It\'s considered controlled if the value is not `undefined`.',
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
watch(defaultValue, (nextDefaultValue) => {
|
|
85
|
+
if (
|
|
86
|
+
!isControlled.value
|
|
87
|
+
&& JSON.stringify(nextDefaultValue) !== initialDefaultValue
|
|
88
|
+
) {
|
|
89
|
+
error(
|
|
90
|
+
`A component is changing the default ${stateName} state of an uncontrolled ${componentName} after being initialized.`,
|
|
91
|
+
`To suppress this warning opt to use a controlled ${componentName}.`,
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function setValue(next: State | Updater<State>) {
|
|
98
|
+
if (isControlled.value) {
|
|
99
|
+
return
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
internalValue.value = typeof next === 'function'
|
|
103
|
+
? (next as Updater<State>)(internalValue.value)
|
|
104
|
+
: next
|
|
41
105
|
}
|
|
42
106
|
|
|
43
107
|
return { value, setValue }
|
|
@@ -53,7 +53,12 @@ export function useFocusableWhenDisabled(
|
|
|
53
53
|
|
|
54
54
|
const additionalProps = {
|
|
55
55
|
onKeydown(event: KeyboardEvent) {
|
|
56
|
-
if (
|
|
56
|
+
if (
|
|
57
|
+
disabled
|
|
58
|
+
&& focusableWhenDisabled
|
|
59
|
+
&& !composite
|
|
60
|
+
&& event.key !== 'Tab'
|
|
61
|
+
) {
|
|
57
62
|
event.preventDefault()
|
|
58
63
|
}
|
|
59
64
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ComponentPublicInstance, Ref } from 'vue'
|
|
2
|
+
import { unref } from 'vue'
|
|
2
3
|
|
|
3
4
|
type Cleanup = () => void
|
|
4
5
|
type MaybeRef<T>
|
|
@@ -44,8 +45,8 @@ export function useMergedRefs<T = Element>(...refs: MaybeRef<T>[]) {
|
|
|
44
45
|
|
|
45
46
|
return (el: Element | ComponentPublicInstance | null) => {
|
|
46
47
|
// Vue template refs on components return ComponentPublicInstance, not the DOM element.
|
|
47
|
-
// Extract the root element if it's a component instance.
|
|
48
|
-
const instance = (el
|
|
48
|
+
// Extract the focusable/root element if it's a component instance.
|
|
49
|
+
const instance = resolveRefTarget<T>(el)
|
|
49
50
|
|
|
50
51
|
if (instance != null) {
|
|
51
52
|
// Mount / update: set all refs and collect cleanup callbacks
|
|
@@ -89,3 +90,26 @@ export function useMergedRefs<T = Element>(...refs: MaybeRef<T>[]) {
|
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
92
|
}
|
|
93
|
+
|
|
94
|
+
function resolveRefTarget<T>(el: Element | ComponentPublicInstance | null) {
|
|
95
|
+
if (el == null) {
|
|
96
|
+
return null
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (el instanceof Element) {
|
|
100
|
+
return el as T
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (typeof el === 'object' && 'element' in el) {
|
|
104
|
+
const exposedElement = unref(el.element)
|
|
105
|
+
if (exposedElement instanceof Element) {
|
|
106
|
+
return exposedElement as T
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if ('$el' in el) {
|
|
111
|
+
return el.$el as T | null
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return el as T
|
|
115
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter } from 'vue'
|
|
2
|
+
import { computed, toValue, watchSyncEffect } from 'vue'
|
|
3
|
+
import { useBaseUiId } from './useBaseUiId'
|
|
4
|
+
|
|
5
|
+
export function useRegisteredLabelId(
|
|
6
|
+
idProp: MaybeRefOrGetter<string | undefined>,
|
|
7
|
+
setLabelId: (id: string | undefined) => void,
|
|
8
|
+
) {
|
|
9
|
+
const generatedId = useBaseUiId()
|
|
10
|
+
const id = computed(() => toValue(idProp) ?? generatedId)
|
|
11
|
+
|
|
12
|
+
watchSyncEffect((onCleanup) => {
|
|
13
|
+
setLabelId(id.value)
|
|
14
|
+
|
|
15
|
+
onCleanup(() => {
|
|
16
|
+
setLabelId(undefined)
|
|
17
|
+
})
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
return id
|
|
21
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CSSProperties } from 'vue'
|
|
2
|
+
|
|
3
|
+
const visuallyHiddenBase: CSSProperties = {
|
|
4
|
+
clipPath: 'inset(50%)',
|
|
5
|
+
overflow: 'hidden',
|
|
6
|
+
whiteSpace: 'nowrap',
|
|
7
|
+
border: 0,
|
|
8
|
+
padding: 0,
|
|
9
|
+
width: 1,
|
|
10
|
+
height: 1,
|
|
11
|
+
margin: -1,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const visuallyHidden: CSSProperties = {
|
|
15
|
+
...visuallyHiddenBase,
|
|
16
|
+
position: 'fixed',
|
|
17
|
+
top: 0,
|
|
18
|
+
left: 0,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const visuallyHiddenInput: CSSProperties = {
|
|
22
|
+
...visuallyHiddenBase,
|
|
23
|
+
position: 'absolute',
|
|
24
|
+
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
let vue = require("vue");
|
|
2
|
-
|
|
3
|
-
//#region src/direction-provider/DirectionContext.ts
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
const directionContextKey = Symbol("DirectionContext");
|
|
8
|
-
function useDirection() {
|
|
9
|
-
const context = (0, vue.inject)(directionContextKey, void 0);
|
|
10
|
-
return (0, vue.computed)(() => context?.direction.value ?? "ltr");
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
//#endregion
|
|
14
|
-
Object.defineProperty(exports, 'directionContextKey', {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function () {
|
|
17
|
-
return directionContextKey;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
Object.defineProperty(exports, 'useDirection', {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function () {
|
|
23
|
-
return useDirection;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
//# sourceMappingURL=DirectionContext.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DirectionContext.cjs","names":[],"sources":["../../src/direction-provider/DirectionContext.ts"],"sourcesContent":[],"mappings":";;;;;;AAYA,MAAa,sBAAsB,OACjC,mBACD;AAUD,SAAgB,eAA2C;CACzD,MAAM,0BAAiB,qBAAqB,OAAU;AAEtD,gCAAsB,SAAS,UAAU,SAAS,MAAM"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { computed, inject } from "vue";
|
|
2
|
-
|
|
3
|
-
//#region src/direction-provider/DirectionContext.ts
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
const directionContextKey = Symbol("DirectionContext");
|
|
8
|
-
function useDirection() {
|
|
9
|
-
const context = inject(directionContextKey, void 0);
|
|
10
|
-
return computed(() => context?.direction.value ?? "ltr");
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
//#endregion
|
|
14
|
-
export { directionContextKey, useDirection };
|
|
15
|
-
//# sourceMappingURL=DirectionContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DirectionContext.js","names":[],"sources":["../../src/direction-provider/DirectionContext.ts"],"sourcesContent":[],"mappings":";;;;;;AAYA,MAAa,sBAAsB,OACjC,mBACD;AAUD,SAAgB,eAA2C;CACzD,MAAM,UAAU,OAAO,qBAAqB,OAAU;AAEtD,QAAO,eAAe,SAAS,UAAU,SAAS,MAAM"}
|