@vireo-ai/trellis-ui 0.1.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/LICENSE +21 -0
- package/README.md +1 -0
- package/package.json +84 -0
- package/src/theme.css +536 -0
- package/trellis_ui/static/trellis_ui/css/styles.css +4382 -0
- package/trellis_ui/static/trellis_ui/js/esm/chunks/cally-TZl4LpyH.js +1134 -0
- package/trellis_ui/static/trellis_ui/js/esm/chunks/cally-TZl4LpyH.js.map +1 -0
- package/trellis_ui/static/trellis_ui/js/esm/chunks/dist-DMX3Q5Zu.js +551 -0
- package/trellis_ui/static/trellis_ui/js/esm/chunks/dist-DMX3Q5Zu.js.map +1 -0
- package/trellis_ui/static/trellis_ui/js/esm/index.js +14181 -0
- package/trellis_ui/static/trellis_ui/js/esm/index.js.map +1 -0
- package/trellis_ui/static/trellis_ui/js/index.js +10 -0
- package/types/bindings/disclosure.d.ts +3 -0
- package/types/bindings/index.d.ts +7 -0
- package/types/bindings/motion.d.ts +3 -0
- package/types/bindings/state.d.ts +3 -0
- package/types/bindings/types.d.ts +35 -0
- package/types/components/accordion/contract.d.ts +29 -0
- package/types/components/accordion/index.d.ts +44 -0
- package/types/components/action/contract.d.ts +14 -0
- package/types/components/action/index.d.ts +2 -0
- package/types/components/app/contract.d.ts +29 -0
- package/types/components/app/index.d.ts +2 -0
- package/types/components/badge/contract.d.ts +42 -0
- package/types/components/badge/index.d.ts +0 -0
- package/types/components/box/contract.d.ts +44 -0
- package/types/components/box/index.d.ts +2 -0
- package/types/components/brand/contract.d.ts +18 -0
- package/types/components/brand/index.d.ts +0 -0
- package/types/components/button/contract.d.ts +34 -0
- package/types/components/button/index.d.ts +3 -0
- package/types/components/card/contract.d.ts +56 -0
- package/types/components/card/index.d.ts +0 -0
- package/types/components/checkbox/contract.d.ts +85 -0
- package/types/components/checkbox/index.d.ts +34 -0
- package/types/components/combobox/contract.d.ts +57 -0
- package/types/components/combobox/index.d.ts +74 -0
- package/types/components/common.d.ts +61 -0
- package/types/components/date-picker/contract.d.ts +86 -0
- package/types/components/date-picker/index.d.ts +70 -0
- package/types/components/dropdown/contract.d.ts +18 -0
- package/types/components/dropdown/index.d.ts +53 -0
- package/types/components/field/contract.d.ts +67 -0
- package/types/components/field/index.d.ts +11 -0
- package/types/components/file-upload/contract.d.ts +60 -0
- package/types/components/file-upload/index.d.ts +35 -0
- package/types/components/frame/contract.d.ts +60 -0
- package/types/components/frame/index.d.ts +2 -0
- package/types/components/heading/contract.d.ts +8 -0
- package/types/components/heading/index.d.ts +0 -0
- package/types/components/image/contract.d.ts +19 -0
- package/types/components/image/index.d.ts +1 -0
- package/types/components/index.d.ts +1 -0
- package/types/components/input/contract.d.ts +49 -0
- package/types/components/input/index.d.ts +17 -0
- package/types/components/menu/contract.d.ts +34 -0
- package/types/components/menu/index.d.ts +0 -0
- package/types/components/modal/contract.d.ts +56 -0
- package/types/components/modal/index.d.ts +85 -0
- package/types/components/overlay/contract.d.ts +13 -0
- package/types/components/overlay/index.d.ts +0 -0
- package/types/components/radio/contract.d.ts +55 -0
- package/types/components/radio/index.d.ts +28 -0
- package/types/components/runtime.d.ts +35 -0
- package/types/components/scroll-area/contract.d.ts +23 -0
- package/types/components/scroll-area/index.d.ts +68 -0
- package/types/components/select/contract.d.ts +90 -0
- package/types/components/select/index.d.ts +92 -0
- package/types/components/separator/contract.d.ts +7 -0
- package/types/components/separator/index.d.ts +0 -0
- package/types/components/sidebar/contract.d.ts +66 -0
- package/types/components/sidebar/index.d.ts +106 -0
- package/types/components/slider/contract.d.ts +56 -0
- package/types/components/slider/index.d.ts +40 -0
- package/types/components/spacer/index.d.ts +0 -0
- package/types/components/stream/index.d.ts +0 -0
- package/types/components/switch/contract.d.ts +57 -0
- package/types/components/switch/index.d.ts +24 -0
- package/types/components/table/contract.d.ts +99 -0
- package/types/components/table/index.d.ts +2 -0
- package/types/components/tabs/contract.d.ts +25 -0
- package/types/components/tabs/index.d.ts +60 -0
- package/types/components/text/contract.d.ts +10 -0
- package/types/components/text/index.d.ts +0 -0
- package/types/components/textarea/contract.d.ts +22 -0
- package/types/components/textarea/index.d.ts +0 -0
- package/types/components/theme/contract.d.ts +6 -0
- package/types/components/theme/index.d.ts +0 -0
- package/types/components/toast/contract.d.ts +28 -0
- package/types/components/toast/index.d.ts +27 -0
- package/types/index.d.ts +46 -0
- package/types/motion/animate.d.ts +49 -0
- package/types/motion/index.d.ts +24 -0
- package/types/motion/presence.d.ts +34 -0
- package/types/motion/reduced-motion.d.ts +9 -0
- package/types/motion/stream.d.ts +18 -0
- package/types/motion/targets.d.ts +31 -0
- package/types/motion/view.d.ts +22 -0
- package/types/runtime/anchored-popover.d.ts +20 -0
- package/types/runtime/class-name.d.ts +9 -0
- package/types/runtime/codecs.d.ts +66 -0
- package/types/runtime/collection-navigation.d.ts +33 -0
- package/types/runtime/confirm.d.ts +18 -0
- package/types/runtime/create.d.ts +8 -0
- package/types/runtime/dismissable-layer.d.ts +8 -0
- package/types/runtime/dom.d.ts +39 -0
- package/types/runtime/form-control.d.ts +44 -0
- package/types/runtime/index.d.ts +85 -0
- package/types/runtime/manifest.d.ts +49 -0
- package/types/runtime/option-data.d.ts +5 -0
- package/types/runtime/props.d.ts +9 -0
- package/types/runtime/resizable.d.ts +36 -0
- package/types/runtime/scroll-lock.d.ts +3 -0
- package/types/runtime/stream.d.ts +47 -0
- package/types/runtime/styles.d.ts +28 -0
- package/types/runtime/theme.d.ts +17 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const TEXT_AS_VALUES: readonly ["span", "p", "div", "label", "kbd", "code", "strong"];
|
|
2
|
+
declare const TEXT_SIZE_VALUES: readonly ["xs", "sm", "base", "lg", "xl", "2xl"];
|
|
3
|
+
declare const TEXT_WEIGHT_VALUES: readonly ["normal", "medium", "semibold", "bold"];
|
|
4
|
+
declare const TEXT_COLOR_VALUES: readonly ["default", "muted", "subtle", "danger", "inherit"];
|
|
5
|
+
type TextAs = typeof TEXT_AS_VALUES[number];
|
|
6
|
+
type TextSize = typeof TEXT_SIZE_VALUES[number];
|
|
7
|
+
type TextWeight = typeof TEXT_WEIGHT_VALUES[number];
|
|
8
|
+
type TextColor = typeof TEXT_COLOR_VALUES[number];
|
|
9
|
+
export { TEXT_AS_VALUES, TEXT_COLOR_VALUES, TEXT_SIZE_VALUES, TEXT_WEIGHT_VALUES, };
|
|
10
|
+
export type { TextAs, TextColor, TextSize, TextWeight };
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type PropState } from '../../runtime';
|
|
2
|
+
declare const TEXTAREA_RESIZE_VALUES: readonly ["vertical", "horizontal", "both", "none"];
|
|
3
|
+
type TextareaResize = typeof TEXTAREA_RESIZE_VALUES[number];
|
|
4
|
+
declare const textareaSchema: {
|
|
5
|
+
name: import("../../runtime/codecs").StringCodec;
|
|
6
|
+
value: import("../../runtime/codecs").StringCodec;
|
|
7
|
+
placeholder: import("../../runtime/codecs").StringCodec;
|
|
8
|
+
size: import("../../runtime/codecs").OneOfCodec<"xs" | "sm" | "md" | "lg" | "xlg">;
|
|
9
|
+
variant: import("../../runtime/codecs").OneOfCodec<"outline" | "filled">;
|
|
10
|
+
rows: import("../../runtime/codecs").NumberCodec;
|
|
11
|
+
resize: import("../../runtime/codecs").OneOfCodec<"none" | "vertical" | "horizontal" | "both">;
|
|
12
|
+
disabled: import("../../runtime/codecs").BoolCodec;
|
|
13
|
+
readonly: import("../../runtime/codecs").BoolCodec;
|
|
14
|
+
required: import("../../runtime/codecs").BoolCodec;
|
|
15
|
+
invalid: import("../../runtime/codecs").BoolCodec;
|
|
16
|
+
rootClass: import("../../runtime/codecs").StringCodec;
|
|
17
|
+
controlClass: import("../../runtime/codecs").StringCodec;
|
|
18
|
+
class: import("../../runtime/codecs").StringCodec;
|
|
19
|
+
};
|
|
20
|
+
type TextareaProps = PropState<typeof textareaSchema>;
|
|
21
|
+
export { textareaSchema, TEXTAREA_RESIZE_VALUES };
|
|
22
|
+
export type { TextareaProps, TextareaResize };
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type PropState } from '../../runtime';
|
|
2
|
+
declare const TOAST_LEVELS: readonly ["info", "success", "warning", "danger", "debug"];
|
|
3
|
+
declare const TOAST_VARIANTS: readonly ["default", "info", "success", "warning", "danger", "debug"];
|
|
4
|
+
declare const TOAST_POSITIONS: readonly ["top-right", "top-left", "top-center", "bottom-right", "bottom-left", "bottom-center"];
|
|
5
|
+
declare const toastSchema: {
|
|
6
|
+
level: import("../../runtime/codecs").OneOfCodec<"success" | "warning" | "danger" | "info" | "debug">;
|
|
7
|
+
variant: import("../../runtime/codecs").OneOfCodec<"default" | "success" | "warning" | "danger" | "info" | "debug">;
|
|
8
|
+
title: import("../../runtime/codecs").StringCodec;
|
|
9
|
+
duration: import("../../runtime/codecs").NumberCodec;
|
|
10
|
+
dismissible: import("../../runtime/codecs").BoolCodec;
|
|
11
|
+
class: import("../../runtime/codecs").StringCodec;
|
|
12
|
+
contentClass: import("../../runtime/codecs").StringCodec;
|
|
13
|
+
closeClass: import("../../runtime/codecs").StringCodec;
|
|
14
|
+
};
|
|
15
|
+
declare const toastOutletSchema: {
|
|
16
|
+
id: import("../../runtime/codecs").StringCodec;
|
|
17
|
+
position: import("../../runtime/codecs").OneOfCodec<"top-right" | "top-left" | "top-center" | "bottom-right" | "bottom-left" | "bottom-center">;
|
|
18
|
+
duration: import("../../runtime/codecs").NumberCodec;
|
|
19
|
+
includeMessages: import("../../runtime/codecs").BoolCodec;
|
|
20
|
+
class: import("../../runtime/codecs").StringCodec;
|
|
21
|
+
};
|
|
22
|
+
type ToastLevel = typeof TOAST_LEVELS[number];
|
|
23
|
+
type ToastVariant = typeof TOAST_VARIANTS[number];
|
|
24
|
+
type ToastPosition = typeof TOAST_POSITIONS[number];
|
|
25
|
+
type ToastProps = PropState<typeof toastSchema>;
|
|
26
|
+
type ToastOutletProps = PropState<typeof toastOutletSchema>;
|
|
27
|
+
export { TOAST_LEVELS, TOAST_POSITIONS, TOAST_VARIANTS, toastOutletSchema, toastSchema };
|
|
28
|
+
export type { ToastLevel, ToastOutletProps, ToastPosition, ToastProps, ToastVariant };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type Alpine from 'alpinejs';
|
|
2
|
+
import { type CleanupStack, type TrellisAlpineComponent } from '../../runtime';
|
|
3
|
+
import { type ToastOutletProps, type ToastProps } from './contract';
|
|
4
|
+
type ToastDetail = {
|
|
5
|
+
message?: unknown;
|
|
6
|
+
title?: unknown;
|
|
7
|
+
level?: unknown;
|
|
8
|
+
variant?: unknown;
|
|
9
|
+
duration?: unknown;
|
|
10
|
+
dismissible?: unknown;
|
|
11
|
+
};
|
|
12
|
+
type ToastData = {
|
|
13
|
+
props: ToastProps;
|
|
14
|
+
cleanup: CleanupStack;
|
|
15
|
+
timer: number | null;
|
|
16
|
+
dismiss(): void;
|
|
17
|
+
};
|
|
18
|
+
type ToastOutletData = {
|
|
19
|
+
props: ToastOutletProps;
|
|
20
|
+
cleanup: CleanupStack;
|
|
21
|
+
add(detail: ToastDetail): void;
|
|
22
|
+
};
|
|
23
|
+
declare const UiToast: () => TrellisAlpineComponent<ToastData>;
|
|
24
|
+
declare const UiToastOutlet: () => TrellisAlpineComponent<ToastOutletData>;
|
|
25
|
+
declare const registerToast: (AlpineInstance: Alpine.Alpine) => void;
|
|
26
|
+
export { registerToast, UiToast, UiToastOutlet };
|
|
27
|
+
export type { ToastData, ToastDetail, ToastOutletData };
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Alpine as AlpineType } from 'alpinejs';
|
|
2
|
+
import { motion } from './motion';
|
|
3
|
+
import { bool, className, create, createResizable, cx, defineManifest, defineProps, defineStyles, json, number, oneOf, props, propsFromSchema, resolveStyle, string } from './runtime';
|
|
4
|
+
type TrellisUIPlugin = (AlpineInstance: AlpineType) => void;
|
|
5
|
+
declare const ui: {
|
|
6
|
+
readonly bool: import("./runtime/codecs").BoolCodec;
|
|
7
|
+
readonly className: ({ values }: import("./runtime").ClassNameOptions) => string;
|
|
8
|
+
readonly create: <const T extends Record<string, import("./runtime").StyleTree>>({ definition }: import("./runtime").CreateOptions<T>) => Readonly<T>;
|
|
9
|
+
readonly createResizable: ({ element, handle, axis, min, max, step, mode, hitArea, coarseHitArea, disabled, onStart, onResize, onEnd, }: import("./runtime").ResizableOptions) => (() => void);
|
|
10
|
+
readonly cx: ({ values }: import("./runtime").ClassNameOptions) => string;
|
|
11
|
+
readonly defineManifest: <const T extends import("./runtime").ComponentManifest>({ manifest }: import("./runtime").DefineManifestOptions<T>) => Readonly<T>;
|
|
12
|
+
readonly defineProps: <T extends Record<string, import("./runtime").CodecFn<unknown>>>({ el, schema, }: import("./runtime/codecs").DefinePropsOptions<T>) => import("./runtime").PropState<T>;
|
|
13
|
+
readonly defineStyles: <const T extends import("./runtime").StyleDefinition>({ definition }: import("./runtime").DefineStylesOptions<T>) => Readonly<T>;
|
|
14
|
+
readonly json: import("./runtime/codecs").JsonCodecFactory;
|
|
15
|
+
readonly motion: {
|
|
16
|
+
readonly createAnimator: <T extends string | number>(value: import("motion").MotionValue<T> | T, defaultOptions?: import("motion").ValueAnimationTransition<T>) => import("./motion").Animator<T>;
|
|
17
|
+
readonly parallel: (...handles: import("./motion").MotionHandle[]) => import("./motion").MotionHandle;
|
|
18
|
+
readonly sequential: (...steps: Array<() => import("./motion").MotionHandle>) => import("./motion").MotionHandle;
|
|
19
|
+
readonly bindTransform: <T extends import("./motion").TransformContext>(element: HTMLElement, values: T, compose: import("./motion").TransformComposer<T>) => (() => void);
|
|
20
|
+
readonly bindStyle: <T extends string | number>(element: HTMLElement, property: keyof CSSStyleDeclaration, value: import("motion").MotionValue<T>, map?: (value: T) => string) => (() => void);
|
|
21
|
+
readonly withReducedMotion: <T extends import("motion").AnimationOptions>(options: T, reducedOptions?: Partial<T>, preference?: import("./motion").MotionPreference) => T;
|
|
22
|
+
readonly resolveTargets: (scope?: import("./motion").ViewScope, targets?: import("./motion").MotionTarget | import("./motion").MotionTarget[] | null) => Element[];
|
|
23
|
+
readonly applyViewKeys: (scope?: import("./motion").ViewScope, options?: {
|
|
24
|
+
key?: string;
|
|
25
|
+
layout?: boolean;
|
|
26
|
+
}) => (() => void);
|
|
27
|
+
readonly animateView: (update: () => void | Promise<void>, targets?: import("./motion").MotionTarget | import("./motion").MotionTarget[] | null, options?: import("./motion").AnimateViewOptions) => import("./motion").MotionHandle;
|
|
28
|
+
readonly animatePresence: (element: Element, phase: import("./motion").PresencePhase, preset?: import("./motion").PresenceDefinition, options?: import("./motion").PresenceOptions) => import("./motion").MotionHandle;
|
|
29
|
+
readonly createPresenceLifecycle: ({ element, preset, enter, exit, options, enterOptions, exitOptions, owner, }: import("./motion").PresenceLifecycleOptions) => import("./motion").PresenceLifecycle;
|
|
30
|
+
readonly animateStreamPatch: <AlpineInstance>(_Alpine: AlpineInstance, patchOrPatches: import("./motion/stream").StreamPatchLike | import("./motion/stream").StreamPatchLike[], options?: import("./motion").AnimateStreamPatchOptions) => import("./motion").MotionHandle;
|
|
31
|
+
};
|
|
32
|
+
readonly number: import("./runtime/codecs").NumberCodec;
|
|
33
|
+
readonly oneOf: <T extends string>(allowed: readonly T[], fallback: T) => import("./runtime/codecs").OneOfCodec<T>;
|
|
34
|
+
readonly props: ({ inputs }: import("./runtime").PropsOptions) => import("./runtime").BindingObject;
|
|
35
|
+
readonly propsFromSchema: <const T extends Record<string, import("./runtime").CodecFn<unknown>>>({ schema, details, }: import("./runtime").PropsFromSchemaOptions<T>) => Record<string, import("./runtime").ManifestProp>;
|
|
36
|
+
readonly resolveStyle: ({ part, props, className: override, }: import("./runtime").ResolveStyleOptions) => string;
|
|
37
|
+
readonly string: import("./runtime/codecs").StringCodec;
|
|
38
|
+
};
|
|
39
|
+
declare const trellisUi: TrellisUIPlugin;
|
|
40
|
+
export { trellisUi, ui };
|
|
41
|
+
export default trellisUi;
|
|
42
|
+
export type { TrellisUIPlugin };
|
|
43
|
+
export { motion };
|
|
44
|
+
export { bool, className, create, createResizable, cx, defineManifest, defineProps, defineStyles, json, number, oneOf, props, propsFromSchema, resolveStyle, string, };
|
|
45
|
+
export type { ClassArray, ClassDictionary, ClassNameOptions, ClassValue, CodecFn, ComponentManifest, CreateOptions, DefineManifestOptions, DefineStylesOptions, ManifestPart, ManifestProp, ManifestPropDetails, ManifestToken, PropInput, PropState, PropsFromSchemaOptions, PropsOptions, ResizableOptions, ResizeAxis, ResizeEvent, ResizeMode, ResizePhase, ResolveStyleOptions, SchemaPropDetails, SchemaToProps, StyleDefinition, StylePart, StyleProps, StyleTree, TrellisAlpineComponent, } from './runtime';
|
|
46
|
+
export type { AnimateStreamPatchOptions, AnimateViewOptions, Animator, MotionHandle, MotionPreference, MotionTarget, PresenceDefinition, PresenceLifecycle, PresenceLifecycleCallbacks, PresenceLifecycleOptions, PresenceOptions, PresencePhase, PresencePreset, ResolvedViewTarget, TransformComposer, TransformContext, ViewPreset, ViewScope, } from './motion';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type AnimationPlaybackControls, type MotionValue, type ValueAnimationTransition } from 'motion';
|
|
2
|
+
type MotionHandle = {
|
|
3
|
+
finished: Promise<void>;
|
|
4
|
+
cancel(): void;
|
|
5
|
+
stop(): void;
|
|
6
|
+
complete(): void;
|
|
7
|
+
};
|
|
8
|
+
type Animator<T extends string | number> = {
|
|
9
|
+
value: MotionValue<T>;
|
|
10
|
+
animateTo(to: T, options?: ValueAnimationTransition<T>): MotionHandle;
|
|
11
|
+
};
|
|
12
|
+
type TransformContext = Record<string, MotionValue<number>>;
|
|
13
|
+
type TransformComposer<T extends TransformContext> = (ctx: T) => string;
|
|
14
|
+
declare const noopHandle: (run?: () => void | Promise<void>) => MotionHandle;
|
|
15
|
+
declare const toMotionHandle: (controls: Pick<AnimationPlaybackControls, "finished" | "cancel" | "stop" | "complete">, cleanup?: () => void) => MotionHandle;
|
|
16
|
+
declare const createAnimator: <T extends string | number>(value: MotionValue<T> | T, defaultOptions?: ValueAnimationTransition<T>) => Animator<T>;
|
|
17
|
+
declare const parallel: (...handles: MotionHandle[]) => MotionHandle;
|
|
18
|
+
declare const sequential: (...steps: Array<() => MotionHandle>) => MotionHandle;
|
|
19
|
+
declare const bindStyle: <T extends string | number>(element: HTMLElement, property: keyof CSSStyleDeclaration, value: MotionValue<T>, map?: (value: T) => string) => (() => void);
|
|
20
|
+
declare const bindTransform: <T extends TransformContext>(element: HTMLElement, values: T, compose: TransformComposer<T>) => (() => void);
|
|
21
|
+
declare const motionDurations: {
|
|
22
|
+
readonly fast: 0.14;
|
|
23
|
+
readonly normal: 0.18;
|
|
24
|
+
readonly slow: 0.24;
|
|
25
|
+
};
|
|
26
|
+
declare const motionEasings: {
|
|
27
|
+
readonly out: readonly [0.23, 1, 0.32, 1];
|
|
28
|
+
readonly inOut: readonly [0.77, 0, 0.175, 1];
|
|
29
|
+
};
|
|
30
|
+
declare const presenceOptions: {
|
|
31
|
+
popover: {
|
|
32
|
+
duration: 0.14;
|
|
33
|
+
ease: readonly [0.23, 1, 0.32, 1];
|
|
34
|
+
};
|
|
35
|
+
modal: {
|
|
36
|
+
duration: 0.24;
|
|
37
|
+
ease: readonly [0.23, 1, 0.32, 1];
|
|
38
|
+
};
|
|
39
|
+
toast: {
|
|
40
|
+
duration: 0.18;
|
|
41
|
+
ease: readonly [0.23, 1, 0.32, 1];
|
|
42
|
+
};
|
|
43
|
+
sidebar: {
|
|
44
|
+
duration: 0.24;
|
|
45
|
+
ease: readonly [0.23, 1, 0.32, 1];
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export { bindStyle, bindTransform, createAnimator, motionDurations, motionEasings, noopHandle, parallel, presenceOptions, sequential, toMotionHandle, };
|
|
49
|
+
export type { Animator, MotionHandle, TransformComposer, TransformContext };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare const motion: {
|
|
2
|
+
readonly createAnimator: <T extends string | number>(value: import("motion").MotionValue<T> | T, defaultOptions?: import("motion").ValueAnimationTransition<T>) => import("./animate").Animator<T>;
|
|
3
|
+
readonly parallel: (...handles: import("./animate").MotionHandle[]) => import("./animate").MotionHandle;
|
|
4
|
+
readonly sequential: (...steps: Array<() => import("./animate").MotionHandle>) => import("./animate").MotionHandle;
|
|
5
|
+
readonly bindTransform: <T extends import("./animate").TransformContext>(element: HTMLElement, values: T, compose: import("./animate").TransformComposer<T>) => (() => void);
|
|
6
|
+
readonly bindStyle: <T extends string | number>(element: HTMLElement, property: keyof CSSStyleDeclaration, value: import("motion").MotionValue<T>, map?: (value: T) => string) => (() => void);
|
|
7
|
+
readonly withReducedMotion: <T extends import("motion").AnimationOptions>(options: T, reducedOptions?: Partial<T>, preference?: import("./reduced-motion").MotionPreference) => T;
|
|
8
|
+
readonly resolveTargets: (scope?: import("./targets").ViewScope, targets?: import("./targets").MotionTarget | import("./targets").MotionTarget[] | null) => Element[];
|
|
9
|
+
readonly applyViewKeys: (scope?: import("./targets").ViewScope, options?: {
|
|
10
|
+
key?: string;
|
|
11
|
+
layout?: boolean;
|
|
12
|
+
}) => (() => void);
|
|
13
|
+
readonly animateView: (update: () => void | Promise<void>, targets?: import("./targets").MotionTarget | import("./targets").MotionTarget[] | null, options?: import("./view").AnimateViewOptions) => import("./animate").MotionHandle;
|
|
14
|
+
readonly animatePresence: (element: Element, phase: import("./presence").PresencePhase, preset?: import("./presence").PresenceDefinition, options?: import("./presence").PresenceOptions) => import("./animate").MotionHandle;
|
|
15
|
+
readonly createPresenceLifecycle: ({ element, preset, enter, exit, options, enterOptions, exitOptions, owner, }: import("./presence").PresenceLifecycleOptions) => import("./presence").PresenceLifecycle;
|
|
16
|
+
readonly animateStreamPatch: <AlpineInstance>(_Alpine: AlpineInstance, patchOrPatches: import("./stream").StreamPatchLike | import("./stream").StreamPatchLike[], options?: import("./stream").AnimateStreamPatchOptions) => import("./animate").MotionHandle;
|
|
17
|
+
};
|
|
18
|
+
export { motion };
|
|
19
|
+
export { bindStyle, bindTransform, createAnimator, parallel, sequential, type Animator, type MotionHandle, type TransformComposer, type TransformContext, } from './animate';
|
|
20
|
+
export { prefersReducedMotion, reducedMotionQuery, shouldReduceMotion, withReducedMotion, type MotionPreference, } from './reduced-motion';
|
|
21
|
+
export { animatePresence, createPresenceLifecycle, type PresenceDefinition, type PresenceLifecycle, type PresenceLifecycleCallbacks, type PresenceLifecycleOptions, type PresenceOptions, type PresencePhase, type PresencePreset, } from './presence';
|
|
22
|
+
export { animateStreamPatch, streamTargetsFromPatches, type AnimateStreamPatchOptions } from './stream';
|
|
23
|
+
export { MOTION_ACTIVE_ATTR, MOTION_KEY_ATTR, MOTION_LAYOUT_ATTR, MOTION_TEMP_ATTR, applyViewKeys, resolveTargets, resolveViewTargets, type MotionTarget, type ResolvedViewTarget, type ViewScope, } from './targets';
|
|
24
|
+
export { animateView, type AnimateViewOptions, type ViewPreset } from './view';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type AnimationOptions, type DOMKeyframesDefinition } from 'motion';
|
|
2
|
+
import { type MotionHandle } from './animate';
|
|
3
|
+
import { type MotionPreference } from './reduced-motion';
|
|
4
|
+
type PresencePhase = 'enter' | 'exit';
|
|
5
|
+
type PresencePreset = 'popover' | 'menu' | 'modal' | 'toast' | 'sidebar' | 'fade';
|
|
6
|
+
type PresenceDefinition = PresencePreset | DOMKeyframesDefinition;
|
|
7
|
+
type PresenceOptions = AnimationOptions & {
|
|
8
|
+
reducedMotion?: MotionPreference;
|
|
9
|
+
};
|
|
10
|
+
type PresenceLifecycleCallbacks = {
|
|
11
|
+
before?: () => void;
|
|
12
|
+
after?: () => void;
|
|
13
|
+
};
|
|
14
|
+
type PresenceLifecycleOptions = {
|
|
15
|
+
element: () => Element | null | undefined;
|
|
16
|
+
preset?: PresenceDefinition;
|
|
17
|
+
enter?: PresenceDefinition;
|
|
18
|
+
exit?: PresenceDefinition;
|
|
19
|
+
options?: PresenceOptions;
|
|
20
|
+
enterOptions?: PresenceOptions;
|
|
21
|
+
exitOptions?: PresenceOptions;
|
|
22
|
+
owner?: 'component' | false;
|
|
23
|
+
};
|
|
24
|
+
type PresenceLifecycle = {
|
|
25
|
+
readonly runId: number;
|
|
26
|
+
enter(callbacks?: PresenceLifecycleCallbacks): MotionHandle;
|
|
27
|
+
exit(callbacks?: PresenceLifecycleCallbacks): MotionHandle;
|
|
28
|
+
cancel(): void;
|
|
29
|
+
destroy(): void;
|
|
30
|
+
};
|
|
31
|
+
declare const animatePresence: (element: Element, phase: PresencePhase, preset?: PresenceDefinition, options?: PresenceOptions) => MotionHandle;
|
|
32
|
+
declare const createPresenceLifecycle: ({ element, preset, enter, exit, options, enterOptions, exitOptions, owner, }: PresenceLifecycleOptions) => PresenceLifecycle;
|
|
33
|
+
export { animatePresence, createPresenceLifecycle };
|
|
34
|
+
export type { PresenceDefinition, PresenceLifecycle, PresenceLifecycleCallbacks, PresenceLifecycleOptions, PresenceOptions, PresencePhase, PresencePreset };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AnimationOptions, DOMKeyframesDefinition } from 'motion';
|
|
2
|
+
type MotionPreference = 'user' | 'always' | 'never';
|
|
3
|
+
declare const reducedMotionQuery = "(prefers-reduced-motion: reduce)";
|
|
4
|
+
declare const prefersReducedMotion: () => boolean;
|
|
5
|
+
declare const shouldReduceMotion: (preference?: MotionPreference) => boolean;
|
|
6
|
+
declare const withReducedMotion: <T extends AnimationOptions>(options: T, reducedOptions?: Partial<T>, preference?: MotionPreference) => T;
|
|
7
|
+
declare const reduceKeyframes: (keyframes: DOMKeyframesDefinition) => DOMKeyframesDefinition;
|
|
8
|
+
export { prefersReducedMotion, reducedMotionQuery, reduceKeyframes, shouldReduceMotion, withReducedMotion, };
|
|
9
|
+
export type { MotionPreference };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type AnimateViewOptions } from './view';
|
|
2
|
+
import { type MotionTarget, type ViewScope } from './targets';
|
|
3
|
+
import { type MotionHandle } from './animate';
|
|
4
|
+
import { type MotionPreference } from './reduced-motion';
|
|
5
|
+
type StreamPatchLike = {
|
|
6
|
+
html?: string | null;
|
|
7
|
+
target?: string | null;
|
|
8
|
+
selector?: string | null;
|
|
9
|
+
};
|
|
10
|
+
type AnimateStreamPatchOptions = Omit<AnimateViewOptions, 'scope' | 'preset'> & {
|
|
11
|
+
scope?: ViewScope | 'target';
|
|
12
|
+
update?: () => void | Promise<void>;
|
|
13
|
+
reducedMotion?: MotionPreference;
|
|
14
|
+
};
|
|
15
|
+
declare const streamTargetsFromPatches: (patches: StreamPatchLike[]) => MotionTarget[];
|
|
16
|
+
declare const animateStreamPatch: <AlpineInstance>(_Alpine: AlpineInstance, patchOrPatches: StreamPatchLike | StreamPatchLike[], options?: AnimateStreamPatchOptions) => MotionHandle;
|
|
17
|
+
export { animateStreamPatch, streamTargetsFromPatches };
|
|
18
|
+
export type { AnimateStreamPatchOptions, StreamPatchLike };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
type MotionTarget = Element | string | {
|
|
2
|
+
selector: string;
|
|
3
|
+
} | {
|
|
4
|
+
part: string;
|
|
5
|
+
} | {
|
|
6
|
+
key: string;
|
|
7
|
+
} | {
|
|
8
|
+
from: MotionTarget;
|
|
9
|
+
to: MotionTarget;
|
|
10
|
+
};
|
|
11
|
+
type ViewScope = Element | Document | string | Iterable<Element>;
|
|
12
|
+
type ViewTargetDefinition = Element | string;
|
|
13
|
+
type ResolvedViewTarget = {
|
|
14
|
+
subject: ViewTargetDefinition;
|
|
15
|
+
newSubject?: ViewTargetDefinition;
|
|
16
|
+
};
|
|
17
|
+
declare const MOTION_KEY_ATTR = "data-ui-motion-key";
|
|
18
|
+
declare const MOTION_LAYOUT_ATTR = "data-ui-motion-layout";
|
|
19
|
+
declare const MOTION_TEMP_ATTR = "data-ui-motion-temp";
|
|
20
|
+
declare const MOTION_ACTIVE_ATTR = "data-ui-motion-active";
|
|
21
|
+
declare const cssEscape: (value: string) => string;
|
|
22
|
+
declare const keySelector: (key: string) => string;
|
|
23
|
+
declare const partSelector: (part: string) => string;
|
|
24
|
+
declare const resolveTargets: (scope?: ViewScope, targets?: MotionTarget | MotionTarget[] | null) => Element[];
|
|
25
|
+
declare const resolveViewTargets: (scope?: ViewScope, targets?: MotionTarget | MotionTarget[] | null) => ResolvedViewTarget[];
|
|
26
|
+
declare const applyViewKeys: (scope?: ViewScope, options?: {
|
|
27
|
+
key?: string;
|
|
28
|
+
layout?: boolean;
|
|
29
|
+
}) => (() => void);
|
|
30
|
+
export { MOTION_ACTIVE_ATTR, MOTION_KEY_ATTR, MOTION_LAYOUT_ATTR, MOTION_TEMP_ATTR, applyViewKeys, cssEscape, keySelector, partSelector, resolveTargets, resolveViewTargets, };
|
|
31
|
+
export type { MotionTarget, ResolvedViewTarget, ViewScope, ViewTargetDefinition };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type AnimationOptions, type DOMKeyframesDefinition, type ViewTransitionOptions } from 'motion';
|
|
2
|
+
import { type MotionHandle } from './animate';
|
|
3
|
+
import { type MotionPreference } from './reduced-motion';
|
|
4
|
+
import { type MotionTarget, type ViewScope } from './targets';
|
|
5
|
+
type ViewPreset = 'layout' | 'stream' | 'none';
|
|
6
|
+
type AnimateViewOptions = {
|
|
7
|
+
scope?: ViewScope;
|
|
8
|
+
reducedMotion?: MotionPreference;
|
|
9
|
+
preset?: ViewPreset;
|
|
10
|
+
transition?: ViewTransitionOptions;
|
|
11
|
+
layout?: boolean | AnimationOptions;
|
|
12
|
+
newView?: DOMKeyframesDefinition;
|
|
13
|
+
oldView?: DOMKeyframesDefinition;
|
|
14
|
+
enter?: DOMKeyframesDefinition;
|
|
15
|
+
exit?: DOMKeyframesDefinition;
|
|
16
|
+
className?: string;
|
|
17
|
+
crop?: boolean;
|
|
18
|
+
group?: boolean;
|
|
19
|
+
};
|
|
20
|
+
declare const animateView: (update: () => void | Promise<void>, targets?: MotionTarget | MotionTarget[] | null, options?: AnimateViewOptions) => MotionHandle;
|
|
21
|
+
export { animateView };
|
|
22
|
+
export type { AnimateViewOptions, ViewPreset };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type PopoverSide = 'top' | 'bottom' | 'left' | 'right';
|
|
2
|
+
type PopoverAlign = 'start' | 'center' | 'end';
|
|
3
|
+
type AnchoredPopoverOptions = {
|
|
4
|
+
reference: () => HTMLElement;
|
|
5
|
+
floating: () => HTMLElement;
|
|
6
|
+
position: () => PopoverSide;
|
|
7
|
+
align: () => PopoverAlign;
|
|
8
|
+
gap: () => number;
|
|
9
|
+
offset: () => number;
|
|
10
|
+
matchReferenceWidth?: boolean;
|
|
11
|
+
};
|
|
12
|
+
type AnchoredPopover = {
|
|
13
|
+
mounted(): boolean;
|
|
14
|
+
mount(): void;
|
|
15
|
+
unmount(): void;
|
|
16
|
+
sync(): void;
|
|
17
|
+
};
|
|
18
|
+
declare const createAnchoredPopover: ({ reference, floating, position: getPosition, align: getAlign, gap, offset, matchReferenceWidth, }: AnchoredPopoverOptions) => AnchoredPopover;
|
|
19
|
+
export { createAnchoredPopover };
|
|
20
|
+
export type { AnchoredPopover, AnchoredPopoverOptions, PopoverAlign, PopoverSide };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ClassValue } from 'clsx';
|
|
2
|
+
type ClassDictionary = Record<string, boolean | null | undefined>;
|
|
3
|
+
type ClassArray = ClassValue[];
|
|
4
|
+
type ClassNameOptions = {
|
|
5
|
+
values: readonly ClassValue[];
|
|
6
|
+
};
|
|
7
|
+
export declare const className: ({ values }: ClassNameOptions) => string;
|
|
8
|
+
export declare const cx: ({ values }: ClassNameOptions) => string;
|
|
9
|
+
export type { ClassArray, ClassDictionary, ClassNameOptions, ClassValue };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
type CodecKind = 'string' | 'number' | 'boolean' | 'enum' | 'json';
|
|
2
|
+
type CodecMeta<T> = {
|
|
3
|
+
type: CodecKind;
|
|
4
|
+
default: T;
|
|
5
|
+
values?: readonly string[];
|
|
6
|
+
emptyString?: 'default' | 'value';
|
|
7
|
+
};
|
|
8
|
+
interface CodecFn<T> {
|
|
9
|
+
(el: HTMLElement, attr: string): T;
|
|
10
|
+
readonly meta: CodecMeta<T>;
|
|
11
|
+
}
|
|
12
|
+
type SchemaToProps<T extends Record<string, CodecFn<unknown>>> = {
|
|
13
|
+
[K in keyof T]: ReturnType<T[K]>;
|
|
14
|
+
};
|
|
15
|
+
type PropState<T extends Record<string, CodecFn<unknown>>> = SchemaToProps<T> & {
|
|
16
|
+
readonly disconnect: () => void;
|
|
17
|
+
};
|
|
18
|
+
type DefinePropsOptions<T extends Record<string, CodecFn<unknown>>> = {
|
|
19
|
+
el: HTMLElement;
|
|
20
|
+
schema: T;
|
|
21
|
+
};
|
|
22
|
+
type ReactiveFn = <T>(value: T) => T;
|
|
23
|
+
interface StringCodec extends CodecFn<string> {
|
|
24
|
+
trim: StringCodec;
|
|
25
|
+
lower: StringCodec;
|
|
26
|
+
upper: StringCodec;
|
|
27
|
+
kebab: StringCodec;
|
|
28
|
+
camel: StringCodec;
|
|
29
|
+
snake: StringCodec;
|
|
30
|
+
default(val: string): StringCodec;
|
|
31
|
+
emptyAsValue: StringCodec;
|
|
32
|
+
emptyAsDefault: StringCodec;
|
|
33
|
+
maxLength(n: number): StringCodec;
|
|
34
|
+
prefix(p: string): StringCodec;
|
|
35
|
+
suffix(s: string): StringCodec;
|
|
36
|
+
}
|
|
37
|
+
interface NumberCodec extends CodecFn<number> {
|
|
38
|
+
clamp(min: number, max: number): NumberCodec;
|
|
39
|
+
min(n: number): NumberCodec;
|
|
40
|
+
max(n: number): NumberCodec;
|
|
41
|
+
step(n: number): NumberCodec;
|
|
42
|
+
default(val: number): NumberCodec;
|
|
43
|
+
}
|
|
44
|
+
interface BoolCodec extends CodecFn<boolean> {
|
|
45
|
+
default(val: boolean): BoolCodec;
|
|
46
|
+
}
|
|
47
|
+
interface OneOfCodec<T extends string> extends CodecFn<T> {
|
|
48
|
+
default(val: T): OneOfCodec<T>;
|
|
49
|
+
}
|
|
50
|
+
interface JsonCodec<T> extends CodecFn<T> {
|
|
51
|
+
default(val: T): JsonCodec<T>;
|
|
52
|
+
}
|
|
53
|
+
interface JsonCodecFactory {
|
|
54
|
+
<T>(fallback: T): JsonCodec<T>;
|
|
55
|
+
object<T extends Record<string, unknown>>(fallback: T): JsonCodec<T>;
|
|
56
|
+
array<T>(fallback: T[]): JsonCodec<T[]>;
|
|
57
|
+
}
|
|
58
|
+
declare const setPropReactivity: (nextReactive: ReactiveFn) => void;
|
|
59
|
+
declare const defineProps: <T extends Record<string, CodecFn<unknown>>>({ el, schema, }: DefinePropsOptions<T>) => PropState<T>;
|
|
60
|
+
declare const string: StringCodec;
|
|
61
|
+
declare const number: NumberCodec;
|
|
62
|
+
declare const bool: BoolCodec;
|
|
63
|
+
declare const json: JsonCodecFactory;
|
|
64
|
+
declare const oneOf: <T extends string>(allowed: readonly T[], fallback: T) => OneOfCodec<T>;
|
|
65
|
+
export { defineProps, setPropReactivity, string, number, bool, json, oneOf };
|
|
66
|
+
export type { BoolCodec, CodecFn, CodecKind, CodecMeta, DefinePropsOptions, JsonCodec, JsonCodecFactory, NumberCodec, OneOfCodec, PropState, ReactiveFn, SchemaToProps, StringCodec, };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
type CollectionRoot = HTMLElement | null;
|
|
2
|
+
type CollectionNavigationOptions = {
|
|
3
|
+
root: () => CollectionRoot;
|
|
4
|
+
itemSelector: string;
|
|
5
|
+
activeAttribute?: string;
|
|
6
|
+
isDisabled?: (el: HTMLElement) => boolean;
|
|
7
|
+
loop?: boolean | (() => boolean);
|
|
8
|
+
};
|
|
9
|
+
type CollectionItemsOptions = {
|
|
10
|
+
items?: HTMLElement[];
|
|
11
|
+
};
|
|
12
|
+
type CollectionElementOptions = {
|
|
13
|
+
el: HTMLElement;
|
|
14
|
+
};
|
|
15
|
+
type CollectionKeydownOptions = {
|
|
16
|
+
event: KeyboardEvent;
|
|
17
|
+
};
|
|
18
|
+
type CollectionNavigation = {
|
|
19
|
+
allItems(): HTMLElement[];
|
|
20
|
+
items(): HTMLElement[];
|
|
21
|
+
currentActiveIndex(options?: CollectionItemsOptions): number;
|
|
22
|
+
activateItem(options: CollectionElementOptions): void;
|
|
23
|
+
clearActiveItem(): void;
|
|
24
|
+
focusItem(options: CollectionElementOptions): void;
|
|
25
|
+
focusNext(): void;
|
|
26
|
+
focusPrevious(): void;
|
|
27
|
+
focusFirst(): void;
|
|
28
|
+
focusLast(): void;
|
|
29
|
+
handleKeydown(options: CollectionKeydownOptions): boolean;
|
|
30
|
+
};
|
|
31
|
+
declare const createCollectionNavigation: ({ root: getRoot, itemSelector, activeAttribute, isDisabled, loop, }: CollectionNavigationOptions) => CollectionNavigation;
|
|
32
|
+
export { createCollectionNavigation };
|
|
33
|
+
export type { CollectionElementOptions, CollectionItemsOptions, CollectionKeydownOptions, CollectionNavigation, CollectionNavigationOptions, };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type SubmitterElement = HTMLButtonElement | HTMLInputElement;
|
|
2
|
+
type ConfirmProceed = () => void;
|
|
3
|
+
type ConfirmCancel = () => void;
|
|
4
|
+
type ConfirmEventDetail = {
|
|
5
|
+
form: HTMLFormElement;
|
|
6
|
+
message: string;
|
|
7
|
+
submitter: SubmitterElement | null;
|
|
8
|
+
triggeringEvent: SubmitEvent;
|
|
9
|
+
proceed: ConfirmProceed;
|
|
10
|
+
cancel: ConfirmCancel;
|
|
11
|
+
};
|
|
12
|
+
type ConfirmRuntimeOptions = {
|
|
13
|
+
root?: Document;
|
|
14
|
+
};
|
|
15
|
+
declare const registerConfirm: ({ root }?: ConfirmRuntimeOptions) => void;
|
|
16
|
+
declare const unregisterConfirm: () => void;
|
|
17
|
+
export { registerConfirm, unregisterConfirm };
|
|
18
|
+
export type { ConfirmCancel, ConfirmEventDetail, ConfirmProceed, ConfirmRuntimeOptions };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type StyleTree = string | ReadonlyArray<StyleTree> | {
|
|
2
|
+
readonly [key: string]: StyleTree;
|
|
3
|
+
};
|
|
4
|
+
type CreateOptions<T extends Record<string, StyleTree>> = {
|
|
5
|
+
definition: T;
|
|
6
|
+
};
|
|
7
|
+
export declare const create: <const T extends Record<string, StyleTree>>({ definition }: CreateOptions<T>) => Readonly<T>;
|
|
8
|
+
export type { CreateOptions, StyleTree };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type DismissableLayerOptions = {
|
|
2
|
+
isEnabled: () => boolean;
|
|
3
|
+
roots: () => Array<EventTarget | null | undefined>;
|
|
4
|
+
onDismiss: (event: PointerEvent) => void;
|
|
5
|
+
};
|
|
6
|
+
declare const addDismissableLayer: ({ isEnabled, roots, onDismiss, }: DismissableLayerOptions) => (() => void);
|
|
7
|
+
export { addDismissableLayer };
|
|
8
|
+
export type { DismissableLayerOptions };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
type CleanupStack = Array<() => void>;
|
|
2
|
+
type DispatchOptions<T> = {
|
|
3
|
+
el: HTMLElement;
|
|
4
|
+
name: string;
|
|
5
|
+
detail?: T;
|
|
6
|
+
};
|
|
7
|
+
type AddListenerOptions = {
|
|
8
|
+
target: EventTarget;
|
|
9
|
+
event: string;
|
|
10
|
+
handler: EventListener;
|
|
11
|
+
cleanup?: CleanupStack;
|
|
12
|
+
options?: globalThis.AddEventListenerOptions;
|
|
13
|
+
};
|
|
14
|
+
type PresenceOptions = {
|
|
15
|
+
el: HTMLElement;
|
|
16
|
+
attr: string;
|
|
17
|
+
present: boolean;
|
|
18
|
+
value?: string;
|
|
19
|
+
};
|
|
20
|
+
type AttributeOptions = {
|
|
21
|
+
el: HTMLElement;
|
|
22
|
+
attr: string;
|
|
23
|
+
value: string;
|
|
24
|
+
};
|
|
25
|
+
type ElementOptions = {
|
|
26
|
+
el: HTMLElement;
|
|
27
|
+
};
|
|
28
|
+
type BoolOptions = {
|
|
29
|
+
value: string | undefined;
|
|
30
|
+
};
|
|
31
|
+
declare const asBool: ({ value }: BoolOptions) => boolean;
|
|
32
|
+
declare const dispatch: <T = unknown>({ el, name, detail }: DispatchOptions<T>) => void;
|
|
33
|
+
declare const addListener: ({ target, event, handler, cleanup, options, }: AddListenerOptions) => (() => void);
|
|
34
|
+
declare const setPresence: ({ el, attr, present, value }: PresenceOptions) => void;
|
|
35
|
+
declare const setAttribute: ({ el, attr, value }: AttributeOptions) => void;
|
|
36
|
+
declare const removeAttribute: ({ el, attr }: Omit<AttributeOptions, "value">) => void;
|
|
37
|
+
declare const isRtl: ({ el }: ElementOptions) => boolean;
|
|
38
|
+
export { addListener, asBool, dispatch, isRtl, removeAttribute, setAttribute, setPresence };
|
|
39
|
+
export type { AddListenerOptions, AttributeOptions, BoolOptions, CleanupStack, DispatchOptions, ElementOptions, PresenceOptions };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
type ControlState = {
|
|
2
|
+
disabled?: boolean;
|
|
3
|
+
required?: boolean;
|
|
4
|
+
invalid?: boolean;
|
|
5
|
+
};
|
|
6
|
+
type NativeControlState = ControlState & {
|
|
7
|
+
name?: string;
|
|
8
|
+
value?: string;
|
|
9
|
+
readonly?: boolean;
|
|
10
|
+
ariaRequired?: boolean;
|
|
11
|
+
nativeRequired?: boolean;
|
|
12
|
+
};
|
|
13
|
+
type HiddenInputState = {
|
|
14
|
+
name: string;
|
|
15
|
+
values: string[];
|
|
16
|
+
required?: boolean;
|
|
17
|
+
form?: string;
|
|
18
|
+
marker?: string;
|
|
19
|
+
};
|
|
20
|
+
type SyncControlPresenceOptions = {
|
|
21
|
+
el: HTMLElement;
|
|
22
|
+
state: ControlState;
|
|
23
|
+
value?: string;
|
|
24
|
+
};
|
|
25
|
+
type SyncNativeControlOptions = {
|
|
26
|
+
input: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;
|
|
27
|
+
state: NativeControlState;
|
|
28
|
+
};
|
|
29
|
+
type SyncRepeatedHiddenInputsOptions = {
|
|
30
|
+
container: HTMLElement;
|
|
31
|
+
state: HiddenInputState;
|
|
32
|
+
currentKey?: string;
|
|
33
|
+
};
|
|
34
|
+
type DispatchNativeControlChangeOptions = {
|
|
35
|
+
container: HTMLElement | null;
|
|
36
|
+
fallback: HTMLElement;
|
|
37
|
+
marker: string;
|
|
38
|
+
};
|
|
39
|
+
declare const syncControlPresence: ({ el, state, value, }: SyncControlPresenceOptions) => void;
|
|
40
|
+
declare const syncNativeControl: ({ input, state, }: SyncNativeControlOptions) => void;
|
|
41
|
+
declare const syncRepeatedHiddenInputs: ({ container, state, currentKey, }: SyncRepeatedHiddenInputsOptions) => string;
|
|
42
|
+
declare const dispatchNativeControlChange: ({ container, fallback, marker, }: DispatchNativeControlChangeOptions) => void;
|
|
43
|
+
export { dispatchNativeControlChange, syncControlPresence, syncNativeControl, syncRepeatedHiddenInputs, };
|
|
44
|
+
export type { ControlState, DispatchNativeControlChangeOptions, HiddenInputState, NativeControlState, SyncControlPresenceOptions, SyncNativeControlOptions, SyncRepeatedHiddenInputsOptions, };
|