@vireo-ai/trellis-ui 0.1.9 → 0.1.10
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/package.json +8 -4
- package/packages/client/src/components/app/styles.css +1 -30
- package/packages/client/src/components/button/styles.css +1 -122
- package/packages/client/src/components/date-picker/styles.css +47 -77
- package/packages/client/src/components/field/styles.css +10 -0
- package/packages/client/src/components/file-upload/styles.css +0 -28
- package/packages/client/src/components/panels/styles.css +43 -0
- package/packages/client/src/components/radio/styles.css +26 -21
- package/packages/client/src/components/scroll-area/styles.css +0 -4
- package/packages/client/src/components/select/styles.css +0 -30
- package/packages/client/src/components/sidebar/styles.css +8 -0
- package/packages/client/src/components/toast/styles.css +14 -7
- package/packages/client/src/styles/components.css +1 -0
- package/packages/client/src/styles/generated/theme-fonts.css +5 -0
- package/packages/client/src/styles/generated/theme-palette.css +2656 -0
- package/packages/client/src/styles/generated/theme-runtime.css +2966 -0
- package/packages/client/src/styles/generated-sources.css +1 -1
- package/packages/client/src/styles/static.css +1 -0
- package/packages/client/src/styles/theme.css +777 -738
- package/packages/client/types/cdn.d.ts +1 -4
- package/packages/client/types/component-api.d.ts +21 -0
- package/packages/client/types/components/accordion/contract.d.ts +3 -2
- package/packages/client/types/components/accordion/index.d.ts +28 -42
- package/packages/client/types/components/accordion/machine.d.ts +131 -0
- package/packages/client/types/components/accordion/runtime-docs.d.ts +2 -0
- package/packages/client/types/components/action/contract.d.ts +3 -3
- package/packages/client/types/components/app/contract.d.ts +25 -12
- package/packages/client/types/components/app/index.d.ts +2 -2
- package/packages/client/types/components/badge/contract.d.ts +5 -5
- package/packages/client/types/components/box/contract.d.ts +25 -28
- package/packages/client/types/components/brand/contract.d.ts +2 -2
- package/packages/client/types/components/button/contract.d.ts +5 -5
- package/packages/client/types/components/card/contract.d.ts +28 -31
- package/packages/client/types/components/checkbox/contract.d.ts +17 -17
- package/packages/client/types/components/checkbox/index.d.ts +20 -26
- package/packages/client/types/components/checkbox/machine.d.ts +41 -0
- package/packages/client/types/components/checkbox/runtime-docs.d.ts +2 -0
- package/packages/client/types/components/common.d.ts +53 -235
- package/packages/client/types/components/container/contract.d.ts +11 -12
- package/packages/client/types/components/date-picker/contract.d.ts +21 -16
- package/packages/client/types/components/date-picker/index.d.ts +38 -60
- package/packages/client/types/components/date-picker/machine.d.ts +529 -0
- package/packages/client/types/components/date-picker/runtime-docs.d.ts +2 -0
- package/packages/client/types/components/date-picker/value.d.ts +28 -0
- package/packages/client/types/components/dropdown/contract.d.ts +4 -4
- package/packages/client/types/components/dropdown/index.d.ts +20 -45
- package/packages/client/types/components/dropdown/machine.d.ts +93 -0
- package/packages/client/types/components/dropdown/runtime-docs.d.ts +2 -0
- package/packages/client/types/components/field/contract.d.ts +10 -6
- package/packages/client/types/components/field/index.d.ts +6 -6
- package/packages/client/types/components/field/machine.d.ts +13 -0
- package/packages/client/types/components/field/runtime-docs.d.ts +2 -0
- package/packages/client/types/components/file-upload/contract.d.ts +7 -4
- package/packages/client/types/components/file-upload/index.d.ts +34 -31
- package/packages/client/types/components/file-upload/machine.d.ts +127 -0
- package/packages/client/types/components/file-upload/runtime-docs.d.ts +2 -0
- package/packages/client/types/components/flex/contract.d.ts +16 -17
- package/packages/client/types/components/frame/contract.d.ts +41 -47
- package/packages/client/types/components/frame/index.d.ts +2 -2
- package/packages/client/types/components/grid/contract.d.ts +20 -21
- package/packages/client/types/components/heading/contract.d.ts +1 -1
- package/packages/client/types/components/image/contract.d.ts +3 -3
- package/packages/client/types/components/input/contract.d.ts +2 -2
- package/packages/client/types/components/input/index.d.ts +15 -12
- package/packages/client/types/components/input/machine.d.ts +20 -0
- package/packages/client/types/components/layout.d.ts +44 -225
- package/packages/client/types/components/menu/contract.d.ts +14 -8
- package/packages/client/types/components/modal/contract.d.ts +12 -12
- package/packages/client/types/components/modal/index.d.ts +41 -75
- package/packages/client/types/components/modal/machine.d.ts +129 -0
- package/packages/client/types/components/modal/runtime-docs.d.ts +2 -0
- package/packages/client/types/components/overlay/contract.d.ts +3 -3
- package/packages/client/types/components/panels/contract.d.ts +39 -0
- package/packages/client/types/components/panels/index.d.ts +54 -0
- package/packages/client/types/components/panels/machine.d.ts +151 -0
- package/packages/client/types/components/panels/runtime-docs.d.ts +2 -0
- package/packages/client/types/components/radio/contract.d.ts +11 -11
- package/packages/client/types/components/radio/index.d.ts +19 -23
- package/packages/client/types/components/radio/machine.d.ts +40 -0
- package/packages/client/types/components/radio/runtime-docs.d.ts +2 -0
- package/packages/client/types/components/runtime-docs.d.ts +2 -0
- package/packages/client/types/components/runtime.d.ts +16 -19
- package/packages/client/types/components/scroll-area/contract.d.ts +4 -7
- package/packages/client/types/components/scroll-area/index.d.ts +23 -49
- package/packages/client/types/components/scroll-area/machine.d.ts +21 -0
- package/packages/client/types/components/scroll-area/runtime-docs.d.ts +2 -0
- package/packages/client/types/components/section/contract.d.ts +12 -13
- package/packages/client/types/components/select/contract.d.ts +19 -15
- package/packages/client/types/components/select/index.d.ts +42 -89
- package/packages/client/types/components/select/machine.d.ts +476 -0
- package/packages/client/types/components/select/runtime-docs.d.ts +2 -0
- package/packages/client/types/components/shared/controlled-open.d.ts +11 -0
- package/packages/client/types/components/sidebar/contract.d.ts +19 -12
- package/packages/client/types/components/sidebar/index.d.ts +51 -88
- package/packages/client/types/components/sidebar/machine.d.ts +100 -0
- package/packages/client/types/components/sidebar/runtime-docs.d.ts +2 -0
- package/packages/client/types/components/slider/contract.d.ts +3 -3
- package/packages/client/types/components/slider/index.d.ts +17 -21
- package/packages/client/types/components/slider/machine.d.ts +37 -0
- package/packages/client/types/components/slider/runtime-docs.d.ts +2 -0
- package/packages/client/types/components/stack/contract.d.ts +16 -17
- package/packages/client/types/components/surface-manifest.d.ts +9 -0
- package/packages/client/types/components/switch/contract.d.ts +11 -11
- package/packages/client/types/components/switch/index.d.ts +13 -18
- package/packages/client/types/components/switch/machine.d.ts +19 -0
- package/packages/client/types/components/switch/runtime-docs.d.ts +2 -0
- package/packages/client/types/components/table/contract.d.ts +18 -18
- package/packages/client/types/components/tabs/contract.d.ts +10 -5
- package/packages/client/types/components/tabs/index.d.ts +33 -51
- package/packages/client/types/components/tabs/machine.d.ts +84 -0
- package/packages/client/types/components/tabs/runtime-docs.d.ts +2 -0
- package/packages/client/types/components/text/contract.d.ts +1 -1
- package/packages/client/types/components/textarea/contract.d.ts +2 -2
- package/packages/client/types/components/toast/contract.d.ts +5 -4
- package/packages/client/types/components/toast/index.d.ts +38 -12
- package/packages/client/types/components/toast/machine.d.ts +115 -0
- package/packages/client/types/components/toast/runtime-docs.d.ts +2 -0
- package/packages/client/types/directives/index.d.ts +3 -1
- package/packages/client/types/directives/layout.d.ts +3 -0
- package/packages/client/types/directives/request.d.ts +1 -2
- package/packages/client/types/directives/transition.d.ts +3 -0
- package/packages/client/types/docs/transition-docs.d.ts +30 -0
- package/packages/client/types/index.d.ts +8 -40
- package/packages/client/types/motion/animate.d.ts +5 -44
- package/packages/client/types/motion/controller.d.ts +33 -0
- package/packages/client/types/motion/index.d.ts +43 -20
- package/packages/client/types/motion/owned.d.ts +5 -0
- package/packages/client/types/motion/plan.d.ts +46 -0
- package/packages/client/types/motion/recipe.d.ts +56 -0
- package/packages/client/types/motion/registry.d.ts +12 -0
- package/packages/client/types/motion/resize.d.ts +15 -0
- package/packages/client/types/motion/subject.d.ts +10 -0
- package/packages/client/types/motion/targets.d.ts +2 -5
- package/packages/client/types/motion/view.d.ts +7 -2
- package/packages/client/types/runtime/alpine-machine.d.ts +68 -0
- package/packages/client/types/runtime/anchored-popover.d.ts +10 -2
- package/packages/client/types/runtime/codecs.d.ts +16 -2
- package/packages/client/types/runtime/{resizable.d.ts → drag-and-drop/index.d.ts} +4 -2
- package/packages/client/types/runtime/engine/request.d.ts +2 -2
- package/packages/client/types/runtime/engine/stream.d.ts +11 -5
- package/packages/client/types/runtime/focus-scope.d.ts +7 -0
- package/packages/client/types/runtime/identity.d.ts +3 -0
- package/packages/client/types/runtime/index.d.ts +9 -75
- package/packages/client/types/runtime/merge-bindings.d.ts +1 -1
- package/packages/client/types/runtime/semantic-observer.d.ts +10 -0
- package/packages/client/types/runtime/state-machine/index.d.ts +4 -0
- package/packages/client/types/runtime/state-machine/machine.d.ts +83 -0
- package/packages/client/types/runtime/state-machine/props-change.d.ts +12 -0
- package/packages/client/types/runtime/transition-coordinator.d.ts +52 -0
- package/packages/client/types/runtime/ui.d.ts +15 -0
- package/packages/client/types/utils/index.d.ts +2 -1
- package/packages/client/types/utils/number.d.ts +2 -0
- package/packages/client/types/utils/object.d.ts +4 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/css/trellis.css +9097 -2595
- package/packages/server/trellis_ui/static/trellis_ui/assets/css/trellis.min.css +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/index.js +17363 -13332
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/index.js.map +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/trellis.js +8 -13
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/trellis.min.js +8 -13
- package/packages/client/types/bindings/disclosure.d.ts +0 -3
- package/packages/client/types/bindings/index.d.ts +0 -7
- package/packages/client/types/bindings/motion.d.ts +0 -3
- package/packages/client/types/bindings/state.d.ts +0 -3
- package/packages/client/types/bindings/types.d.ts +0 -33
- package/packages/client/types/components/combobox/contract.d.ts +0 -60
- package/packages/client/types/components/combobox/index.d.ts +0 -80
- package/packages/client/types/components/textarea/index.d.ts +0 -13
- package/packages/client/types/motion/presence.d.ts +0 -34
- package/packages/client/types/runtime/class-name.d.ts +0 -9
- package/packages/client/types/runtime/create.d.ts +0 -8
- package/packages/client/types/runtime/machine.d.ts +0 -55
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/cally-TZl4LpyH.js +0 -1134
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/cally-TZl4LpyH.js.map +0 -1
|
@@ -1,48 +1,16 @@
|
|
|
1
1
|
import type { Alpine as AlpineType } from 'alpinejs';
|
|
2
2
|
import { motion } from './motion';
|
|
3
|
-
import { bool,
|
|
3
|
+
import { bool, createAlpineMachine, createMachine, createResizable, decodeProps, defineManifest, defineProps, defineStyles, json, mergeBindings, number, oneOf, propsFromSchema, resolveStyle, string } from './runtime';
|
|
4
|
+
import { ui } from './runtime/ui';
|
|
4
5
|
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 createMachine: <TContext>(config: import("./runtime").MachineConfig<TContext>, options: import("./runtime").MachineOptions<TContext>) => import("./runtime").Machine<TContext>;
|
|
10
|
-
readonly createVisibilityMachine: <TContext>({ enter, exit, }?: import("./runtime").VisibilityMachineConfig) => import("./runtime").MachineConfig<TContext>;
|
|
11
|
-
readonly createResizable: ({ element, handle, axis, min, max, step, mode, hitArea, coarseHitArea, disabled, onStart, onResize, onEnd, }: import("./runtime").ResizableOptions) => (() => void);
|
|
12
|
-
readonly cx: ({ values }: import("./runtime").ClassNameOptions) => string;
|
|
13
|
-
readonly defineManifest: <const T extends import("./runtime").ComponentManifest>({ manifest }: import("./runtime").DefineManifestOptions<T>) => Readonly<T>;
|
|
14
|
-
readonly defineProps: <T extends Record<string, import("./runtime").CodecFn<unknown>>>({ el, schema, onChange, }: import("./runtime/codecs").DefinePropsOptions<T>) => import("./runtime").PropState<T>;
|
|
15
|
-
readonly defineStyles: <const T extends import("./runtime").StyleDefinition>({ definition }: import("./runtime").DefineStylesOptions<T>) => Readonly<T>;
|
|
16
|
-
readonly json: import("./runtime/codecs").JsonCodecFactory;
|
|
17
|
-
readonly mergeBindings: ({ inputs }: import("./runtime").MergeBindingsOptions) => import("./runtime").BindingObject;
|
|
18
|
-
readonly motion: {
|
|
19
|
-
readonly createAnimator: <T extends string | number>(value: import("./motion").MotionValue<T> | T, defaultOptions?: import("./motion").ValueAnimationTransition<T>) => import("./motion").Animator<T>;
|
|
20
|
-
readonly parallel: (...handles: import("./motion").MotionHandle[]) => import("./motion").MotionHandle;
|
|
21
|
-
readonly sequential: (...steps: Array<() => import("./motion").MotionHandle>) => import("./motion").MotionHandle;
|
|
22
|
-
readonly bindTransform: <T extends import("./motion").TransformContext>(element: HTMLElement, values: T, compose: import("./motion").TransformComposer<T>) => (() => void);
|
|
23
|
-
readonly bindStyle: <T extends string | number>(element: HTMLElement, property: keyof CSSStyleDeclaration, value: import("./motion").MotionValue<T>, map?: (value: T) => string) => (() => void);
|
|
24
|
-
readonly withReducedMotion: <T extends import("./motion").AnimationOptions>(options: T, reducedOptions?: Partial<T>, preference?: import("./motion").MotionPreference) => T;
|
|
25
|
-
readonly resolveTargets: (scope?: import("./motion").ViewScope, targets?: import("./motion").MotionTarget | import("./motion").MotionTarget[] | null) => Element[];
|
|
26
|
-
readonly applyViewKeys: (scope?: import("./motion").ViewScope, options?: {
|
|
27
|
-
key?: string;
|
|
28
|
-
layout?: boolean;
|
|
29
|
-
}) => (() => void);
|
|
30
|
-
readonly animateView: (update: () => void | Promise<void>, targets?: import("./motion").MotionTarget | import("./motion").MotionTarget[] | null, options?: import("./motion").AnimateViewOptions) => import("./motion").MotionHandle;
|
|
31
|
-
readonly animatePresence: (element: Element, phase: import("./motion").PresencePhase, preset?: import("./motion").PresenceDefinition, options?: import("./motion").PresenceOptions) => import("./motion").MotionHandle;
|
|
32
|
-
readonly createPresenceLifecycle: ({ element, preset, enter, exit, options, enterOptions, exitOptions, owner, }: import("./motion").PresenceLifecycleOptions) => import("./motion").PresenceLifecycle;
|
|
33
|
-
readonly animateStreamPatch: <AlpineInstance>(_Alpine: AlpineInstance, patchOrPatches: import("./motion/stream").StreamPatchLike | import("./motion/stream").StreamPatchLike[], options?: import("./motion").AnimateStreamPatchOptions) => import("./motion").MotionHandle;
|
|
34
|
-
};
|
|
35
|
-
readonly number: import("./runtime/codecs").NumberCodec;
|
|
36
|
-
readonly oneOf: <T extends string>(allowed: readonly T[], fallback: T) => import("./runtime/codecs").OneOfCodec<T>;
|
|
37
|
-
readonly propsFromSchema: <const T extends Record<string, import("./runtime").CodecFn<unknown>>>({ schema, details, }: import("./runtime").PropsFromSchemaOptions<T>) => Record<string, import("./runtime").ManifestProp>;
|
|
38
|
-
readonly resolveStyle: ({ part, props, className: override, }: import("./runtime").ResolveStyleOptions) => string;
|
|
39
|
-
readonly string: import("./runtime/codecs").StringCodec;
|
|
40
|
-
};
|
|
41
6
|
declare const trellisUi: TrellisUIPlugin;
|
|
42
7
|
export { trellisUi, ui };
|
|
43
8
|
export default trellisUi;
|
|
44
9
|
export type { TrellisUIPlugin };
|
|
10
|
+
export type { ModalCancelDetail, UiDropdownApi, UiInputApi, UiModalApi, UiModalTriggerApi, UiPanelsApi } from './components/runtime';
|
|
45
11
|
export { motion };
|
|
46
|
-
export {
|
|
47
|
-
export
|
|
48
|
-
export
|
|
12
|
+
export { createTransitionCoordinator, defineHook } from './runtime';
|
|
13
|
+
export { registerTransitionDirective } from './directives';
|
|
14
|
+
export { bool, createAlpineMachine, createMachine, createResizable, decodeProps, defineManifest, defineProps, defineStyles, json, mergeBindings, number, oneOf, propsFromSchema, resolveStyle, string, };
|
|
15
|
+
export type { AlpineMachine, AlpineMachineOwner, AlpinePropsChangedEvent, CodecFn, ComponentManifest, CreateAlpineMachineOptions, DecodePropsOptions, Machine, MachineConfig, MachineEffect, MachineEffectList, MachineEffectRef, MachineEntry, MachineEvent, MachineEventObject, MachineGuard, MachineOptions, MachineReducer, MachineReducerList, MachineReducerRef, MachineScope, MachineSnapshot, MachineStateConfig, MachineStateValue, MachineTransition, MachineTransitionDefinition, MachineUpdate, DefineManifestOptions, DefineStylesOptions, ManifestPart, ManifestProp, ManifestPropDetails, ManifestToken, MachineFactoryScope, BindingInput, PropState, PropsFromSchemaOptions, MergeBindingsOptions, ResizableOptions, ResizeAxis, ResizeDirection, ResizeEvent, ResizeMode, ResizePhase, ResolveStyleOptions, SchemaPropDetails, SchemaToProps, StyleDefinition, StylePart, StyleProps, TrellisAlpineComponent, AnyTransitionHook, TransitionCallback, TransitionContext, TransitionCoordinator, TransitionCoordinatorOptions, TransitionEventCreator, TransitionHookDefinition, UiRuntime, } from './runtime';
|
|
16
|
+
export type { Controller, ControllerDefinitions, ControllerOptions, ControllerScalar, ControllerState, ControllerValueDefinition, ControllerValues, MotionHandle, MotionKeyframePreset, MotionPlanOptions, MotionPreference, MotionSpeed, MotionTransition, MotionTarget, StyleProjection, ViewPreset, ViewOptions, ViewScope, } from './motion';
|
|
@@ -1,53 +1,14 @@
|
|
|
1
|
-
import { type AnimationPlaybackControls
|
|
2
|
-
type MotionHandle = {
|
|
1
|
+
import { type AnimationPlaybackControls } from '../motion';
|
|
2
|
+
type MotionHandle = PromiseLike<void> & {
|
|
3
3
|
finished: Promise<void>;
|
|
4
4
|
cancel(): void;
|
|
5
5
|
stop(): void;
|
|
6
6
|
complete(): void;
|
|
7
7
|
};
|
|
8
|
-
|
|
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;
|
|
8
|
+
declare const motionHandle: (finished: Promise<void>, controls: Pick<MotionHandle, "cancel" | "stop" | "complete">) => MotionHandle;
|
|
14
9
|
declare const noopHandle: (run?: () => void | Promise<void>) => MotionHandle;
|
|
15
10
|
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
11
|
declare const parallel: (...handles: MotionHandle[]) => MotionHandle;
|
|
18
12
|
declare const sequential: (...steps: Array<() => MotionHandle>) => MotionHandle;
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
sheet: {
|
|
48
|
-
duration: 0.24;
|
|
49
|
-
ease: readonly [0.23, 1, 0.32, 1];
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
export { bindStyle, bindTransform, createAnimator, motionDurations, motionEasings, noopHandle, parallel, presenceOptions, sequential, toMotionHandle, };
|
|
53
|
-
export type { Animator, MotionHandle, TransformComposer, TransformContext };
|
|
13
|
+
export { motionHandle, noopHandle, parallel, sequential, toMotionHandle, };
|
|
14
|
+
export type { MotionHandle };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ValueAnimationTransition } from '../motion';
|
|
2
|
+
import { type MotionHandle } from './animate';
|
|
3
|
+
import { type MotionPreference } from './reduced-motion';
|
|
4
|
+
type ControllerScalar = string | number;
|
|
5
|
+
type ControllerValues = Record<string, ControllerScalar>;
|
|
6
|
+
type ControllerValueDefinition<T extends ControllerScalar> = T | Readonly<{
|
|
7
|
+
initial: T;
|
|
8
|
+
transition?: ValueAnimationTransition<T>;
|
|
9
|
+
}>;
|
|
10
|
+
type ControllerDefinitions = Record<string, ControllerValueDefinition<ControllerScalar>>;
|
|
11
|
+
type Widen<T> = T extends number ? number : T extends string ? string : never;
|
|
12
|
+
type DefinitionValue<T> = T extends {
|
|
13
|
+
initial: infer Initial;
|
|
14
|
+
} ? Widen<Initial> : Widen<T>;
|
|
15
|
+
type ControllerState<T extends ControllerDefinitions> = {
|
|
16
|
+
[K in keyof T]: DefinitionValue<T[K]>;
|
|
17
|
+
};
|
|
18
|
+
type StyleProjection<T extends ControllerValues> = (values: Readonly<T>) => Readonly<Record<string, string | number>>;
|
|
19
|
+
type ControllerOptions<T extends ControllerDefinitions> = Readonly<{
|
|
20
|
+
values: T;
|
|
21
|
+
style: StyleProjection<ControllerState<T>>;
|
|
22
|
+
reducedMotion?: MotionPreference;
|
|
23
|
+
}>;
|
|
24
|
+
type Controller<T extends ControllerValues> = {
|
|
25
|
+
mount(element: HTMLElement): () => void;
|
|
26
|
+
set(values: Partial<T>): void;
|
|
27
|
+
animate(values: Partial<T>, transition?: ValueAnimationTransition): MotionHandle;
|
|
28
|
+
current(): Readonly<T>;
|
|
29
|
+
destroy(): void;
|
|
30
|
+
};
|
|
31
|
+
declare const createController: <T extends ControllerDefinitions>(options: ControllerOptions<T>) => Controller<ControllerState<T>>;
|
|
32
|
+
export { createController };
|
|
33
|
+
export type { Controller, ControllerDefinitions, ControllerOptions, ControllerScalar, ControllerState, ControllerValueDefinition, ControllerValues, StyleProjection, };
|
|
@@ -1,24 +1,47 @@
|
|
|
1
|
-
declare const motion: {
|
|
2
|
-
readonly
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
declare const motion: ((subject: import("./subject").MotionSubject) => import("./plan").MotionPlan) & {
|
|
2
|
+
readonly presets: Readonly<{
|
|
3
|
+
opacity: Readonly<{
|
|
4
|
+
in: import("./recipe").MotionKeyframePreset;
|
|
5
|
+
out: import("./recipe").MotionKeyframePreset;
|
|
6
|
+
}>;
|
|
7
|
+
popover: Readonly<{
|
|
8
|
+
in: import("./recipe").MotionKeyframePreset;
|
|
9
|
+
out: import("./recipe").MotionKeyframePreset;
|
|
10
|
+
}>;
|
|
11
|
+
modal: Readonly<{
|
|
12
|
+
in: import("./recipe").MotionKeyframePreset;
|
|
13
|
+
out: import("./recipe").MotionKeyframePreset;
|
|
14
|
+
}>;
|
|
15
|
+
toast: Readonly<{
|
|
16
|
+
in: import("./recipe").MotionKeyframePreset;
|
|
17
|
+
out: import("./recipe").MotionKeyframePreset;
|
|
18
|
+
}>;
|
|
19
|
+
}>;
|
|
20
|
+
readonly speeds: Readonly<{
|
|
21
|
+
fast: Readonly<{
|
|
22
|
+
duration: 0.08;
|
|
23
|
+
bounce: 0;
|
|
24
|
+
}>;
|
|
25
|
+
moderate: Readonly<{
|
|
26
|
+
duration: 0.16;
|
|
27
|
+
bounce: 0;
|
|
28
|
+
}>;
|
|
29
|
+
slow: Readonly<{
|
|
30
|
+
duration: 0.24;
|
|
31
|
+
bounce: 0;
|
|
32
|
+
}>;
|
|
33
|
+
}>;
|
|
34
|
+
readonly createController: <T extends import("./controller").ControllerDefinitions>(options: import("./controller").ControllerOptions<T>) => import("./controller").Controller<import("./controller").ControllerState<T>>;
|
|
7
35
|
readonly withReducedMotion: <T extends import("../motion").AnimationOptions>(options: T, reducedOptions?: Partial<T>, preference?: import("./reduced-motion").MotionPreference) => T;
|
|
8
|
-
readonly
|
|
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;
|
|
36
|
+
readonly view: (update: () => void | Promise<void>, options?: import("./view").ViewOptions) => import("./animate").MotionHandle;
|
|
17
37
|
};
|
|
18
38
|
export { motion };
|
|
19
|
-
export {
|
|
39
|
+
export { type MotionHandle } from './animate';
|
|
40
|
+
export { createController, type Controller, type ControllerDefinitions, type ControllerOptions, type ControllerScalar, type ControllerState, type ControllerValueDefinition, type ControllerValues, type StyleProjection, } from './controller';
|
|
20
41
|
export { prefersReducedMotion, reducedMotionQuery, shouldReduceMotion, withReducedMotion, type MotionPreference, } from './reduced-motion';
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
42
|
+
export { createMotionPlan, MotionPlan, type MotionDefaults, type MotionPlanOptions, type MotionSegment, type MotionStage, } from './plan';
|
|
43
|
+
export { presets, speeds, type DurationSpeed, type MotionKeyframePreset, type MotionKeyframes, type MotionSpeed, type MotionSpeedName, type MotionTransition, type PhysicsSpeed, } from './recipe';
|
|
44
|
+
export { resize, type ResizeDestination, type ResizeOptions } from './resize';
|
|
45
|
+
export { type MotionSubject, type MotionTransitionSubject } from './subject';
|
|
46
|
+
export type { MotionTarget, ViewScope } from './targets';
|
|
47
|
+
export { view, type ViewOptions, type ViewPreset } from './view';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AnimationPlaybackControls } from '../motion';
|
|
2
|
+
import { type MotionHandle } from './animate';
|
|
3
|
+
import { type ActiveMotion, type MotionProperty } from './registry';
|
|
4
|
+
declare const ownMotion: (element: Element, start: (previous?: ActiveMotion) => Pick<AnimationPlaybackControls, "finished" | "cancel" | "stop" | "complete">, properties: ReadonlySet<MotionProperty>, signal?: AbortSignal | null, cleanup?: () => void) => MotionHandle;
|
|
5
|
+
export { ownMotion };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type DOMKeyframesDefinition } from '../motion';
|
|
2
|
+
import { type MotionHandle } from './animate';
|
|
3
|
+
import { type MotionSpeed, type MotionTransition } from './recipe';
|
|
4
|
+
import { type ResizeOptions } from './resize';
|
|
5
|
+
import { type MotionSubject } from './subject';
|
|
6
|
+
type MotionTarget = Element | string;
|
|
7
|
+
type AnimateSegment = Readonly<{
|
|
8
|
+
kind: 'animate';
|
|
9
|
+
target?: MotionTarget;
|
|
10
|
+
keyframes: Readonly<DOMKeyframesDefinition>;
|
|
11
|
+
speed?: MotionSpeed;
|
|
12
|
+
transition?: MotionTransition;
|
|
13
|
+
}>;
|
|
14
|
+
type ResizeSegment = Readonly<{
|
|
15
|
+
kind: 'resize';
|
|
16
|
+
options: ResizeOptions;
|
|
17
|
+
speed?: MotionSpeed;
|
|
18
|
+
}>;
|
|
19
|
+
type MotionSegment = AnimateSegment | ResizeSegment;
|
|
20
|
+
type MotionStage = readonly MotionSegment[];
|
|
21
|
+
type MotionDefaults = Readonly<{
|
|
22
|
+
speed?: MotionSpeed;
|
|
23
|
+
transition?: MotionTransition;
|
|
24
|
+
}>;
|
|
25
|
+
type MotionPlanOptions = Readonly<{
|
|
26
|
+
speed?: MotionSpeed;
|
|
27
|
+
transition?: MotionTransition;
|
|
28
|
+
}>;
|
|
29
|
+
declare class MotionPlan {
|
|
30
|
+
#private;
|
|
31
|
+
constructor(subject: MotionSubject, stages?: readonly MotionStage[], defaults?: MotionDefaults);
|
|
32
|
+
animate(keyframes: Readonly<DOMKeyframesDefinition>): MotionPlan;
|
|
33
|
+
animate(target: MotionTarget, keyframes: Readonly<DOMKeyframesDefinition>): MotionPlan;
|
|
34
|
+
with(keyframes: Readonly<DOMKeyframesDefinition>): MotionPlan;
|
|
35
|
+
with(target: MotionTarget, keyframes: Readonly<DOMKeyframesDefinition>): MotionPlan;
|
|
36
|
+
then(keyframes: Readonly<DOMKeyframesDefinition>): MotionPlan;
|
|
37
|
+
then(target: MotionTarget, keyframes: Readonly<DOMKeyframesDefinition>): MotionPlan;
|
|
38
|
+
resize(options: ResizeOptions): MotionPlan;
|
|
39
|
+
speed(speed: MotionSpeed): MotionPlan;
|
|
40
|
+
transition(transition: MotionTransition): MotionPlan;
|
|
41
|
+
defaults(options: MotionPlanOptions): MotionPlan;
|
|
42
|
+
play(): MotionHandle;
|
|
43
|
+
}
|
|
44
|
+
declare const createMotionPlan: (subject: MotionSubject) => MotionPlan;
|
|
45
|
+
export { createMotionPlan, MotionPlan };
|
|
46
|
+
export type { MotionDefaults, MotionPlanOptions, MotionSegment, MotionStage, MotionTarget };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { AnimationOptions, DOMKeyframesDefinition } from '../motion';
|
|
2
|
+
type MotionSpeedName = 'fast' | 'moderate' | 'slow';
|
|
3
|
+
type DurationSpeed = Readonly<{
|
|
4
|
+
duration: number;
|
|
5
|
+
bounce?: number;
|
|
6
|
+
}>;
|
|
7
|
+
type PhysicsSpeed = Readonly<{
|
|
8
|
+
stiffness: number;
|
|
9
|
+
damping: number;
|
|
10
|
+
mass?: number;
|
|
11
|
+
}>;
|
|
12
|
+
type MotionSpeed = MotionSpeedName | DurationSpeed | PhysicsSpeed;
|
|
13
|
+
type MotionKeyframes<T> = T | readonly T[];
|
|
14
|
+
type MotionKeyframePreset = Readonly<DOMKeyframesDefinition>;
|
|
15
|
+
type MotionTransition = Readonly<AnimationOptions>;
|
|
16
|
+
declare const speeds: Readonly<{
|
|
17
|
+
fast: Readonly<{
|
|
18
|
+
duration: 0.08;
|
|
19
|
+
bounce: 0;
|
|
20
|
+
}>;
|
|
21
|
+
moderate: Readonly<{
|
|
22
|
+
duration: 0.16;
|
|
23
|
+
bounce: 0;
|
|
24
|
+
}>;
|
|
25
|
+
slow: Readonly<{
|
|
26
|
+
duration: 0.24;
|
|
27
|
+
bounce: 0;
|
|
28
|
+
}>;
|
|
29
|
+
}>;
|
|
30
|
+
declare const motionEasings: {
|
|
31
|
+
readonly out: readonly [0.23, 1, 0.32, 1];
|
|
32
|
+
readonly inOut: readonly [0.77, 0, 0.175, 1];
|
|
33
|
+
};
|
|
34
|
+
declare const presets: Readonly<{
|
|
35
|
+
opacity: Readonly<{
|
|
36
|
+
in: MotionKeyframePreset;
|
|
37
|
+
out: MotionKeyframePreset;
|
|
38
|
+
}>;
|
|
39
|
+
popover: Readonly<{
|
|
40
|
+
in: MotionKeyframePreset;
|
|
41
|
+
out: MotionKeyframePreset;
|
|
42
|
+
}>;
|
|
43
|
+
modal: Readonly<{
|
|
44
|
+
in: MotionKeyframePreset;
|
|
45
|
+
out: MotionKeyframePreset;
|
|
46
|
+
}>;
|
|
47
|
+
toast: Readonly<{
|
|
48
|
+
in: MotionKeyframePreset;
|
|
49
|
+
out: MotionKeyframePreset;
|
|
50
|
+
}>;
|
|
51
|
+
}>;
|
|
52
|
+
declare const speedOptions: (speed?: MotionSpeed) => DurationSpeed | PhysicsSpeed;
|
|
53
|
+
declare const finalKeyframe: <T>(keyframes: MotionKeyframes<T>) => T;
|
|
54
|
+
declare const mutableKeyframes: <T>(keyframes: MotionKeyframes<T>) => T | T[];
|
|
55
|
+
export { finalKeyframe, motionEasings, mutableKeyframes, presets, speedOptions, speeds };
|
|
56
|
+
export type { DurationSpeed, MotionKeyframePreset, MotionKeyframes, MotionSpeed, MotionSpeedName, MotionTransition, PhysicsSpeed, };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MotionHandle } from './animate';
|
|
2
|
+
type MotionProperty = string;
|
|
3
|
+
type ActiveMotion = Readonly<{
|
|
4
|
+
handle: MotionHandle;
|
|
5
|
+
properties: ReadonlySet<MotionProperty>;
|
|
6
|
+
}>;
|
|
7
|
+
declare const activeMotion: (element: Element) => ActiveMotion | undefined;
|
|
8
|
+
declare const replaceMotion: (element: Element) => ActiveMotion | undefined;
|
|
9
|
+
declare const registerMotion: (element: Element, motion: ActiveMotion) => void;
|
|
10
|
+
declare const releaseMotion: (element: Element, handle: MotionHandle) => void;
|
|
11
|
+
export { activeMotion, registerMotion, releaseMotion, replaceMotion };
|
|
12
|
+
export type { ActiveMotion, MotionProperty };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type MotionHandle } from './animate';
|
|
2
|
+
import { type MotionKeyframes, type MotionSpeed } from './recipe';
|
|
3
|
+
import { type MotionSubject } from './subject';
|
|
4
|
+
type ResizeDestination = 'content' | 'collapsed';
|
|
5
|
+
type ResizeOptions = Readonly<{
|
|
6
|
+
from: ResizeDestination;
|
|
7
|
+
measure?: Element | string;
|
|
8
|
+
opacity?: MotionKeyframes<number>;
|
|
9
|
+
speed?: MotionSpeed;
|
|
10
|
+
target?: Element | string;
|
|
11
|
+
to: ResizeDestination;
|
|
12
|
+
}>;
|
|
13
|
+
declare const resize: (subject: MotionSubject, options: ResizeOptions) => MotionHandle;
|
|
14
|
+
export { resize };
|
|
15
|
+
export type { ResizeDestination, ResizeOptions };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type MotionTransitionSubject = Readonly<{
|
|
2
|
+
el: unknown;
|
|
3
|
+
root: unknown;
|
|
4
|
+
signal: AbortSignal;
|
|
5
|
+
}>;
|
|
6
|
+
type MotionSubject = Element | MotionTransitionSubject;
|
|
7
|
+
declare const resolveMotionTarget: (subject: MotionSubject, target?: Element | string) => Element;
|
|
8
|
+
declare const motionSignal: (subject: MotionSubject) => AbortSignal | null;
|
|
9
|
+
export { motionSignal, resolveMotionTarget };
|
|
10
|
+
export type { MotionSubject, MotionTransitionSubject };
|
|
@@ -16,16 +16,13 @@ type ResolvedViewTarget = {
|
|
|
16
16
|
};
|
|
17
17
|
declare const MOTION_KEY_ATTR = "data-ui-motion-key";
|
|
18
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
19
|
declare const cssEscape: (value: string) => string;
|
|
22
20
|
declare const keySelector: (key: string) => string;
|
|
23
21
|
declare const partSelector: (part: string) => string;
|
|
24
|
-
declare const resolveTargets: (scope?: ViewScope, targets?: MotionTarget | MotionTarget[] | null) => Element[];
|
|
25
22
|
declare const resolveViewTargets: (scope?: ViewScope, targets?: MotionTarget | MotionTarget[] | null) => ResolvedViewTarget[];
|
|
26
|
-
declare const
|
|
23
|
+
declare const markLayoutParticipant: (scope?: ViewScope, options?: {
|
|
27
24
|
key?: string;
|
|
28
25
|
layout?: boolean;
|
|
29
26
|
}) => (() => void);
|
|
30
|
-
export {
|
|
27
|
+
export { MOTION_KEY_ATTR, MOTION_LAYOUT_ATTR, cssEscape, keySelector, markLayoutParticipant, partSelector, resolveViewTargets, };
|
|
31
28
|
export type { MotionTarget, ResolvedViewTarget, ViewScope, ViewTargetDefinition };
|
|
@@ -17,6 +17,11 @@ type AnimateViewOptions = {
|
|
|
17
17
|
crop?: boolean;
|
|
18
18
|
group?: boolean;
|
|
19
19
|
};
|
|
20
|
+
type ViewOptions = AnimateViewOptions & {
|
|
21
|
+
targets?: MotionTarget | MotionTarget[] | null;
|
|
22
|
+
};
|
|
23
|
+
declare const configureViewFlush: (flush: () => Promise<unknown>) => void;
|
|
20
24
|
declare const animateView: (update: () => void | Promise<void>, targets?: MotionTarget | MotionTarget[] | null, options?: AnimateViewOptions) => MotionHandle;
|
|
21
|
-
|
|
22
|
-
export
|
|
25
|
+
declare const view: (update: () => void | Promise<void>, options?: ViewOptions) => MotionHandle;
|
|
26
|
+
export { animateView, configureViewFlush, view };
|
|
27
|
+
export type { AnimateViewOptions, ViewOptions, ViewPreset };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type Alpine from 'alpinejs';
|
|
2
|
+
import { type CodecFn, type PropChange, type SchemaToProps } from './codecs';
|
|
3
|
+
import { type TransitionCallback } from './transition-coordinator';
|
|
4
|
+
import type { Machine, MachineEvent, MachineSnapshot } from './state-machine';
|
|
5
|
+
type MachineElement = HTMLElement & Alpine.ElementWithXAttributes;
|
|
6
|
+
type MachineSchema = Record<string, CodecFn<unknown>>;
|
|
7
|
+
type MachineProps<TSchema extends MachineSchema> = SchemaToProps<TSchema>;
|
|
8
|
+
type TransitionHookLike = {
|
|
9
|
+
name: string;
|
|
10
|
+
state: string;
|
|
11
|
+
project?: (...args: never[]) => unknown;
|
|
12
|
+
projectEach?: (...args: never[]) => readonly unknown[];
|
|
13
|
+
onDone: string;
|
|
14
|
+
onError: string;
|
|
15
|
+
};
|
|
16
|
+
type HookName<THooks extends readonly {
|
|
17
|
+
name: string;
|
|
18
|
+
}[]> = THooks[number]['name'];
|
|
19
|
+
type HookData<THook> = THook extends {
|
|
20
|
+
project: (...args: never[]) => infer TData;
|
|
21
|
+
} ? TData : THook extends {
|
|
22
|
+
projectEach: (...args: never[]) => readonly (infer TData)[];
|
|
23
|
+
} ? TData : never;
|
|
24
|
+
type HookForName<THooks, TName> = Extract<THooks extends readonly unknown[] ? THooks[number] : never, {
|
|
25
|
+
name: TName;
|
|
26
|
+
}>;
|
|
27
|
+
type AlpinePropsChangedEvent<TSchema extends MachineSchema> = {
|
|
28
|
+
type: 'PROPS_CHANGED';
|
|
29
|
+
props: MachineProps<TSchema>;
|
|
30
|
+
changes: Array<PropChange<TSchema>>;
|
|
31
|
+
};
|
|
32
|
+
type MachineFactoryScope<TSchema extends MachineSchema> = {
|
|
33
|
+
el: MachineElement;
|
|
34
|
+
props: MachineProps<TSchema>;
|
|
35
|
+
};
|
|
36
|
+
type CreateAlpineMachineOptions<TContext, TSchema extends MachineSchema, THooks extends readonly TransitionHookLike[]> = {
|
|
37
|
+
schema: TSchema;
|
|
38
|
+
hooks: THooks;
|
|
39
|
+
createMachine(scope: MachineFactoryScope<TSchema>): Machine<TContext, MachineProps<TSchema>>;
|
|
40
|
+
resolveTransitionElement?(scope: Readonly<{
|
|
41
|
+
name: string;
|
|
42
|
+
data: unknown;
|
|
43
|
+
root: MachineElement;
|
|
44
|
+
registrationEl: MachineElement;
|
|
45
|
+
}>): MachineElement | null | undefined;
|
|
46
|
+
};
|
|
47
|
+
type AlpineMachineOwner<TProps = unknown> = {
|
|
48
|
+
onTransition<TData>(name: string, callback: TransitionCallback<TProps, TData, MachineElement>, el?: MachineElement): () => void;
|
|
49
|
+
};
|
|
50
|
+
type AlpineMachine<TContext, TProps, THooks extends readonly TransitionHookLike[]> = AlpineMachineOwner<TProps> & {
|
|
51
|
+
snapshot: {
|
|
52
|
+
current: MachineSnapshot<TContext, TProps> | null;
|
|
53
|
+
};
|
|
54
|
+
connect(el: MachineElement, snapshot?: {
|
|
55
|
+
current: MachineSnapshot<TContext, TProps> | null;
|
|
56
|
+
}): void;
|
|
57
|
+
disconnect(): void;
|
|
58
|
+
getSnapshot(): MachineSnapshot<TContext, TProps>;
|
|
59
|
+
getCommittedSnapshot(): MachineSnapshot<TContext, TProps>;
|
|
60
|
+
send(event: MachineEvent): void;
|
|
61
|
+
matches(state: string): boolean;
|
|
62
|
+
hasTag(tag: string): boolean;
|
|
63
|
+
onTransition<TName extends HookName<THooks>, TData = HookData<HookForName<THooks, TName>>>(name: TName, callback: TransitionCallback<TProps, TData, MachineElement>, el?: MachineElement): () => void;
|
|
64
|
+
};
|
|
65
|
+
declare const findAlpineMachineOwner: (AlpineInstance: Alpine.Alpine, el: Element) => AlpineMachineOwner | undefined;
|
|
66
|
+
declare const createAlpineMachine: <TContext, TSchema extends MachineSchema, const THooks extends readonly TransitionHookLike[]>({ schema, hooks, createMachine: machineFactory, resolveTransitionElement, }: CreateAlpineMachineOptions<TContext, TSchema, THooks>) => AlpineMachine<TContext, MachineProps<TSchema>, THooks>;
|
|
67
|
+
export { createAlpineMachine, findAlpineMachineOwner };
|
|
68
|
+
export type { AlpineMachine, AlpineMachineOwner, AlpinePropsChangedEvent, CreateAlpineMachineOptions, MachineFactoryScope, };
|
|
@@ -15,6 +15,14 @@ type AnchoredPopover = {
|
|
|
15
15
|
unmount(): void;
|
|
16
16
|
sync(): void;
|
|
17
17
|
};
|
|
18
|
+
type AnchoredPopoverSurface = {
|
|
19
|
+
opened(): boolean;
|
|
20
|
+
open(): void;
|
|
21
|
+
close(): void;
|
|
22
|
+
sync(): void;
|
|
23
|
+
destroy(): void;
|
|
24
|
+
};
|
|
18
25
|
declare const createAnchoredPopover: ({ reference, floating, position: getPosition, align: getAlign, gap, offset, matchReferenceWidth, }: AnchoredPopoverOptions) => AnchoredPopover;
|
|
19
|
-
|
|
20
|
-
export
|
|
26
|
+
declare const createAnchoredPopoverSurface: (options: AnchoredPopoverOptions) => AnchoredPopoverSurface;
|
|
27
|
+
export { createAnchoredPopover, createAnchoredPopoverSurface };
|
|
28
|
+
export type { AnchoredPopover, AnchoredPopoverOptions, AnchoredPopoverSurface, PopoverAlign, PopoverSide };
|
|
@@ -4,6 +4,7 @@ type CodecMeta<T> = {
|
|
|
4
4
|
default: T;
|
|
5
5
|
values?: readonly string[];
|
|
6
6
|
emptyString?: 'default' | 'value';
|
|
7
|
+
attribute?: string;
|
|
7
8
|
};
|
|
8
9
|
interface CodecFn<T> {
|
|
9
10
|
(el: HTMLElement, attr: string): T;
|
|
@@ -28,6 +29,10 @@ type DefinePropsOptions<T extends Record<string, CodecFn<unknown>>> = {
|
|
|
28
29
|
schema: T;
|
|
29
30
|
onChange?: (state: PropState<T>, changes: Array<PropChange<T>>) => void;
|
|
30
31
|
};
|
|
32
|
+
type DecodePropsOptions<T extends Record<string, CodecFn<unknown>>> = {
|
|
33
|
+
el: HTMLElement;
|
|
34
|
+
schema: T;
|
|
35
|
+
};
|
|
31
36
|
type ReactiveFn = <T>(value: T) => T;
|
|
32
37
|
interface StringCodec extends CodecFn<string> {
|
|
33
38
|
trim: StringCodec;
|
|
@@ -45,6 +50,8 @@ interface StringCodec extends CodecFn<string> {
|
|
|
45
50
|
}
|
|
46
51
|
interface NumberCodec extends CodecFn<number> {
|
|
47
52
|
clamp(min: number, max: number): NumberCodec;
|
|
53
|
+
snap(step: number): NumberCodec;
|
|
54
|
+
bounded(min: number, max: number, step?: number): NumberCodec;
|
|
48
55
|
min(n: number): NumberCodec;
|
|
49
56
|
max(n: number): NumberCodec;
|
|
50
57
|
step(n: number): NumberCodec;
|
|
@@ -64,6 +71,13 @@ interface JsonCodecFactory {
|
|
|
64
71
|
object<T extends Record<string, unknown>>(fallback: T): JsonCodec<T>;
|
|
65
72
|
array<T>(fallback: T[]): JsonCodec<T[]>;
|
|
66
73
|
}
|
|
74
|
+
declare const dataAttributeForProp: (key: string) => string;
|
|
75
|
+
declare const dataAttributeForSchemaProp: (key: string, codec: CodecFn<unknown>) => string;
|
|
76
|
+
declare const clampNumber: (value: number, min: number, max: number) => number;
|
|
77
|
+
declare const snapNumber: (value: number, step: number) => number;
|
|
78
|
+
declare const boundNumber: (value: number, min: number, max: number, step?: number) => number;
|
|
79
|
+
declare const attribute: <T>(codec: CodecFn<T>, name: string) => CodecFn<T>;
|
|
80
|
+
declare const decodeProps: <T extends Record<string, CodecFn<unknown>>>({ el, schema, }: DecodePropsOptions<T>) => SchemaToProps<T>;
|
|
67
81
|
declare const setPropReactivity: (nextReactive: ReactiveFn) => void;
|
|
68
82
|
declare const defineProps: <T extends Record<string, CodecFn<unknown>>>({ el, schema, onChange, }: DefinePropsOptions<T>) => PropState<T>;
|
|
69
83
|
declare const string: StringCodec;
|
|
@@ -71,5 +85,5 @@ declare const number: NumberCodec;
|
|
|
71
85
|
declare const bool: BoolCodec;
|
|
72
86
|
declare const json: JsonCodecFactory;
|
|
73
87
|
declare const oneOf: <T extends string>(allowed: readonly T[], fallback: T) => OneOfCodec<T>;
|
|
74
|
-
export { defineProps, setPropReactivity, string, number, bool, json, oneOf };
|
|
75
|
-
export type { BoolCodec, CodecFn, CodecKind, CodecMeta, DefinePropsOptions, JsonCodec, JsonCodecFactory, NumberCodec, OneOfCodec, PropChange, PropChangeSource, PropState, ReactiveFn, SchemaToProps, StringCodec, };
|
|
88
|
+
export { attribute, boundNumber, clampNumber, decodeProps, dataAttributeForProp, dataAttributeForSchemaProp, defineProps, setPropReactivity, snapNumber, string, number, bool, json, oneOf, };
|
|
89
|
+
export type { BoolCodec, CodecFn, CodecKind, CodecMeta, DecodePropsOptions, DefinePropsOptions, JsonCodec, JsonCodecFactory, NumberCodec, OneOfCodec, PropChange, PropChangeSource, PropState, ReactiveFn, SchemaToProps, StringCodec, };
|
|
@@ -2,6 +2,7 @@ import type Alpine from 'alpinejs';
|
|
|
2
2
|
type ResizeAxis = 'x' | 'y';
|
|
3
3
|
type ResizeMode = 'onChange' | 'onEnd';
|
|
4
4
|
type ResizePhase = 'start' | 'resize' | 'end';
|
|
5
|
+
type ResizeDirection = 'positive' | 'negative';
|
|
5
6
|
type ResizeEvent = {
|
|
6
7
|
width: number;
|
|
7
8
|
height: number;
|
|
@@ -25,12 +26,13 @@ type ResizableOptions = {
|
|
|
25
26
|
mode?: ResizeMode;
|
|
26
27
|
hitArea?: number;
|
|
27
28
|
coarseHitArea?: number;
|
|
29
|
+
direction?: ResizeDirection;
|
|
28
30
|
disabled?: () => boolean;
|
|
29
31
|
onStart?: (event: ResizeEvent) => void;
|
|
30
32
|
onResize?: (event: ResizeEvent) => void;
|
|
31
33
|
onEnd?: (event: ResizeEvent) => void;
|
|
32
34
|
};
|
|
33
|
-
declare const createResizable: ({ element, handle, axis, min, max, step, mode, hitArea, coarseHitArea, disabled, onStart, onResize, onEnd, }: ResizableOptions) => (() => void);
|
|
35
|
+
declare const createResizable: ({ element, handle, axis, min, max, step, mode, hitArea, coarseHitArea, direction, disabled, onStart, onResize, onEnd, }: ResizableOptions) => (() => void);
|
|
34
36
|
declare const registerResizable: (AlpineInstance: Alpine.Alpine) => void;
|
|
35
37
|
export { createResizable, registerResizable };
|
|
36
|
-
export type { ResizableOptions, ResizeAxis, ResizeEvent, ResizeMode, ResizePhase };
|
|
38
|
+
export type { ResizableOptions, ResizeAxis, ResizeDirection, ResizeEvent, ResizeMode, ResizePhase };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type Alpine from 'alpinejs';
|
|
2
|
-
import {
|
|
2
|
+
import type { StreamAlpine } from './stream';
|
|
3
3
|
type RequestMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
4
4
|
type RequestData = FormData | URLSearchParams | HTMLFormElement | Record<string, unknown> | string | Blob | ArrayBuffer;
|
|
5
5
|
type RequestExtra = Record<string, unknown> | FormData | URLSearchParams;
|
|
@@ -15,7 +15,7 @@ type RequestOptions = {
|
|
|
15
15
|
};
|
|
16
16
|
type RequestResult = {
|
|
17
17
|
response: Response | null;
|
|
18
|
-
type: 'empty' | '
|
|
18
|
+
type: 'empty' | 'redirect' | 'other' | 'aborted' | 'unavailable';
|
|
19
19
|
};
|
|
20
20
|
type RequestLifecycleDetail = {
|
|
21
21
|
source: Element | Document;
|