@vireo-ai/trellis-ui 0.1.2 → 0.1.5
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 +2 -5
- package/src/components/date-picker/styles.css +9 -0
- package/src/components/select/styles.css +9 -0
- package/src/theme.css +36 -4
- package/trellis_ui/static/trellis_ui/css/styles.css +307 -12
- package/trellis_ui/static/trellis_ui/js/esm/index.js +3605 -2210
- package/trellis_ui/static/trellis_ui/js/esm/index.js.map +1 -1
- package/trellis_ui/static/trellis_ui/js/index.js +6 -6
- package/types/components/accordion/contract.d.ts +2 -0
- package/types/components/accordion/index.d.ts +3 -1
- package/types/components/combobox/index.d.ts +8 -2
- package/types/components/container/contract.d.ts +30 -0
- package/types/components/container/index.d.ts +1 -0
- package/types/components/date-picker/index.d.ts +3 -2
- package/types/components/dropdown/index.d.ts +4 -2
- package/types/components/flex/contract.d.ts +35 -0
- package/types/components/flex/index.d.ts +1 -0
- package/types/components/grid/contract.d.ts +40 -0
- package/types/components/grid/index.d.ts +1 -0
- package/types/components/input/index.d.ts +1 -0
- package/types/components/layout.d.ts +408 -0
- package/types/components/modal/index.d.ts +4 -2
- package/types/components/runtime.d.ts +2 -0
- package/types/components/section/contract.d.ts +27 -0
- package/types/components/section/index.d.ts +1 -0
- package/types/components/select/index.d.ts +8 -2
- package/types/components/sidebar/index.d.ts +14 -7
- package/types/components/slider/index.d.ts +1 -0
- package/types/components/stack/contract.d.ts +29 -0
- package/types/components/stack/index.d.ts +1 -0
- package/types/components/table/contract.d.ts +4 -3
- package/types/components/tabs/index.d.ts +1 -0
- package/types/components/textarea/index.d.ts +13 -0
- package/types/components/toast/index.d.ts +4 -0
- package/types/index.d.ts +6 -4
- package/types/runtime/codecs.d.ts +11 -2
- package/types/runtime/index.d.ts +5 -2
- package/types/runtime/machine.d.ts +55 -0
- package/types/runtime/manifest.d.ts +2 -0
- package/types/runtime/stream.d.ts +1 -1
- package/trellis_ui/static/trellis_ui/js/esm/chunks/dist-DMX3Q5Zu.js +0 -551
- package/trellis_ui/static/trellis_ui/js/esm/chunks/dist-DMX3Q5Zu.js.map +0 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type Alpine from 'alpinejs';
|
|
2
|
+
import { type TrellisAlpineComponent } from '../../runtime';
|
|
3
|
+
import { type TextareaProps } from './contract';
|
|
4
|
+
type TextareaData = {
|
|
5
|
+
props: TextareaProps;
|
|
6
|
+
control(): HTMLElement;
|
|
7
|
+
textarea(): HTMLTextAreaElement;
|
|
8
|
+
sync(): void;
|
|
9
|
+
};
|
|
10
|
+
declare const UiTextarea: () => TrellisAlpineComponent<TextareaData>;
|
|
11
|
+
declare const registerTextarea: (AlpineInstance: Alpine.Alpine) => void;
|
|
12
|
+
export { registerTextarea, UiTextarea };
|
|
13
|
+
export type { TextareaData };
|
|
@@ -14,11 +14,15 @@ type ToastData = {
|
|
|
14
14
|
props: ToastProps;
|
|
15
15
|
cleanup: CleanupStack;
|
|
16
16
|
timer: number | null;
|
|
17
|
+
applyProps(changedKeys?: string[]): void;
|
|
18
|
+
sync(): void;
|
|
19
|
+
resetTimer(): void;
|
|
17
20
|
dismiss(): void;
|
|
18
21
|
};
|
|
19
22
|
type ToastOutletData = {
|
|
20
23
|
props: ToastOutletProps;
|
|
21
24
|
cleanup: CleanupStack;
|
|
25
|
+
sync(): void;
|
|
22
26
|
add(detail: ToastDetail): void;
|
|
23
27
|
};
|
|
24
28
|
declare const UiToast: () => TrellisAlpineComponent<ToastData>;
|
package/types/index.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import type { Alpine as AlpineType } from 'alpinejs';
|
|
2
2
|
import { motion } from './motion';
|
|
3
|
-
import { bool, className, create, createResizable, cx, defineManifest, defineProps, defineStyles, json, mergeBindings, number, oneOf, propsFromSchema, resolveStyle, string } from './runtime';
|
|
3
|
+
import { bool, className, create, createMachine, createVisibilityMachine, createResizable, cx, defineManifest, defineProps, defineStyles, json, mergeBindings, number, oneOf, propsFromSchema, resolveStyle, string } from './runtime';
|
|
4
4
|
type TrellisUIPlugin = (AlpineInstance: AlpineType) => void;
|
|
5
5
|
declare const ui: {
|
|
6
6
|
readonly bool: import("./runtime/codecs").BoolCodec;
|
|
7
7
|
readonly className: ({ values }: import("./runtime").ClassNameOptions) => string;
|
|
8
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>;
|
|
9
11
|
readonly createResizable: ({ element, handle, axis, min, max, step, mode, hitArea, coarseHitArea, disabled, onStart, onResize, onEnd, }: import("./runtime").ResizableOptions) => (() => void);
|
|
10
12
|
readonly cx: ({ values }: import("./runtime").ClassNameOptions) => string;
|
|
11
13
|
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>;
|
|
14
|
+
readonly defineProps: <T extends Record<string, import("./runtime").CodecFn<unknown>>>({ el, schema, onChange, }: import("./runtime/codecs").DefinePropsOptions<T>) => import("./runtime").PropState<T>;
|
|
13
15
|
readonly defineStyles: <const T extends import("./runtime").StyleDefinition>({ definition }: import("./runtime").DefineStylesOptions<T>) => Readonly<T>;
|
|
14
16
|
readonly json: import("./runtime/codecs").JsonCodecFactory;
|
|
15
17
|
readonly mergeBindings: ({ inputs }: import("./runtime").MergeBindingsOptions) => import("./runtime").BindingObject;
|
|
@@ -41,6 +43,6 @@ export { trellisUi, ui };
|
|
|
41
43
|
export default trellisUi;
|
|
42
44
|
export type { TrellisUIPlugin };
|
|
43
45
|
export { motion };
|
|
44
|
-
export { bool, className, create, createResizable, cx, defineManifest, defineProps, defineStyles, json, mergeBindings, number, oneOf, propsFromSchema, resolveStyle, string, };
|
|
45
|
-
export type { ClassArray, ClassDictionary, ClassNameOptions, ClassValue, CodecFn, ComponentManifest, CreateOptions, DefineManifestOptions, DefineStylesOptions, ManifestPart, ManifestProp, ManifestPropDetails, ManifestToken, BindingInput, PropState, PropsFromSchemaOptions, MergeBindingsOptions, ResizableOptions, ResizeAxis, ResizeEvent, ResizeMode, ResizePhase, ResolveStyleOptions, SchemaPropDetails, SchemaToProps, StyleDefinition, StylePart, StyleProps, StyleTree, TrellisAlpineComponent, } from './runtime';
|
|
46
|
+
export { bool, className, create, createMachine, createVisibilityMachine, createResizable, cx, defineManifest, defineProps, defineStyles, json, mergeBindings, number, oneOf, propsFromSchema, resolveStyle, string, };
|
|
47
|
+
export type { ClassArray, ClassDictionary, ClassNameOptions, ClassValue, CodecFn, ComponentManifest, CreateOptions, Machine, MachineAction, MachineActionList, MachineActionRef, MachineConfig, MachineEffect, MachineEvent, MachineEventObject, MachineGuard, MachineOptions, MachineScope, MachineStateConfig, MachineTransition, VisibilityMachineConfig, DefineManifestOptions, DefineStylesOptions, ManifestPart, ManifestProp, ManifestPropDetails, ManifestToken, BindingInput, PropState, PropsFromSchemaOptions, MergeBindingsOptions, ResizableOptions, ResizeAxis, ResizeEvent, ResizeMode, ResizePhase, ResolveStyleOptions, SchemaPropDetails, SchemaToProps, StyleDefinition, StylePart, StyleProps, StyleTree, TrellisAlpineComponent, } from './runtime';
|
|
46
48
|
export type { AnimateStreamPatchOptions, AnimateViewOptions, Animator, MotionHandle, MotionPreference, MotionTarget, PresenceDefinition, PresenceLifecycle, PresenceLifecycleCallbacks, PresenceLifecycleOptions, PresenceOptions, PresencePhase, PresencePreset, ResolvedViewTarget, TransformComposer, TransformContext, ViewPreset, ViewScope, } from './motion';
|
|
@@ -12,12 +12,21 @@ interface CodecFn<T> {
|
|
|
12
12
|
type SchemaToProps<T extends Record<string, CodecFn<unknown>>> = {
|
|
13
13
|
[K in keyof T]: ReturnType<T[K]>;
|
|
14
14
|
};
|
|
15
|
+
type SchemaPropKey<T extends Record<string, CodecFn<unknown>>> = Extract<keyof SchemaToProps<T>, string>;
|
|
15
16
|
type PropState<T extends Record<string, CodecFn<unknown>>> = SchemaToProps<T> & {
|
|
16
17
|
readonly disconnect: () => void;
|
|
17
18
|
};
|
|
19
|
+
type PropChangeSource = 'attribute' | 'property';
|
|
20
|
+
type PropChange<T extends Record<string, CodecFn<unknown>>> = {
|
|
21
|
+
key: SchemaPropKey<T>;
|
|
22
|
+
previous: SchemaToProps<T>[keyof SchemaToProps<T>];
|
|
23
|
+
value: SchemaToProps<T>[keyof SchemaToProps<T>];
|
|
24
|
+
source: PropChangeSource;
|
|
25
|
+
};
|
|
18
26
|
type DefinePropsOptions<T extends Record<string, CodecFn<unknown>>> = {
|
|
19
27
|
el: HTMLElement;
|
|
20
28
|
schema: T;
|
|
29
|
+
onChange?: (state: PropState<T>, changes: Array<PropChange<T>>) => void;
|
|
21
30
|
};
|
|
22
31
|
type ReactiveFn = <T>(value: T) => T;
|
|
23
32
|
interface StringCodec extends CodecFn<string> {
|
|
@@ -56,11 +65,11 @@ interface JsonCodecFactory {
|
|
|
56
65
|
array<T>(fallback: T[]): JsonCodec<T[]>;
|
|
57
66
|
}
|
|
58
67
|
declare const setPropReactivity: (nextReactive: ReactiveFn) => void;
|
|
59
|
-
declare const defineProps: <T extends Record<string, CodecFn<unknown>>>({ el, schema, }: DefinePropsOptions<T>) => PropState<T>;
|
|
68
|
+
declare const defineProps: <T extends Record<string, CodecFn<unknown>>>({ el, schema, onChange, }: DefinePropsOptions<T>) => PropState<T>;
|
|
60
69
|
declare const string: StringCodec;
|
|
61
70
|
declare const number: NumberCodec;
|
|
62
71
|
declare const bool: BoolCodec;
|
|
63
72
|
declare const json: JsonCodecFactory;
|
|
64
73
|
declare const oneOf: <T extends string>(allowed: readonly T[], fallback: T) => OneOfCodec<T>;
|
|
65
74
|
export { defineProps, setPropReactivity, string, number, bool, json, oneOf };
|
|
66
|
-
export type { BoolCodec, CodecFn, CodecKind, CodecMeta, DefinePropsOptions, JsonCodec, JsonCodecFactory, NumberCodec, OneOfCodec, PropState, ReactiveFn, SchemaToProps, StringCodec, };
|
|
75
|
+
export type { BoolCodec, CodecFn, CodecKind, CodecMeta, DefinePropsOptions, JsonCodec, JsonCodecFactory, NumberCodec, OneOfCodec, PropChange, PropChangeSource, PropState, ReactiveFn, SchemaToProps, StringCodec, };
|
package/types/runtime/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { registerConfirm, unregisterConfirm, type ConfirmEventDetail, type Confi
|
|
|
6
6
|
export { create, type CreateOptions, type StyleTree } from './create';
|
|
7
7
|
export { mergeBindings, type BindingInput, type BindingObject, type MergeBindingsOptions } from './merge-bindings';
|
|
8
8
|
export { defineProps, string, number, bool, json, oneOf, type CodecFn, type PropState, type SchemaToProps } from './codecs';
|
|
9
|
+
export { createMachine, createVisibilityMachine, type Machine, type MachineAction, type MachineActionList, type MachineActionRef, type MachineConfig, type MachineEffect, type MachineEvent, type MachineEventObject, type MachineGuard, type MachineOptions, type MachineScope, type MachineStateConfig, type MachineTransition, type VisibilityMachineConfig, } from './machine';
|
|
9
10
|
export { addListener, asBool, dispatch, isRtl, removeAttribute, setAttribute, setPresence, type AddListenerOptions, type AttributeOptions, type BoolOptions, type CleanupStack, type DispatchOptions, type ElementOptions, type PresenceOptions, } from './dom';
|
|
10
11
|
export { addDismissableLayer, type DismissableLayerOptions } from './dismissable-layer';
|
|
11
12
|
export { dispatchNativeControlChange, syncControlPresence, syncNativeControl, syncRepeatedHiddenInputs, type ControlState, type DispatchNativeControlChangeOptions, type HiddenInputState, type NativeControlState, type SyncControlPresenceOptions, type SyncNativeControlOptions, type SyncRepeatedHiddenInputsOptions, } from './form-control';
|
|
@@ -43,6 +44,8 @@ declare const ui: {
|
|
|
43
44
|
readonly splitControlValues: (value: string) => string[];
|
|
44
45
|
readonly createResizable: ({ element, handle, axis, min, max, step, mode, hitArea, coarseHitArea, disabled, onStart, onResize, onEnd, }: import("./resizable").ResizableOptions) => (() => void);
|
|
45
46
|
readonly mergeBindings: ({ inputs }: import("./merge-bindings").MergeBindingsOptions) => import("./merge-bindings").BindingObject;
|
|
47
|
+
readonly createMachine: <TContext>(config: import("./machine").MachineConfig<TContext>, options: import("./machine").MachineOptions<TContext>) => import("./machine").Machine<TContext>;
|
|
48
|
+
readonly createVisibilityMachine: <TContext>({ enter, exit, }?: import("./machine").VisibilityMachineConfig) => import("./machine").MachineConfig<TContext>;
|
|
46
49
|
readonly propsFromSchema: <const T extends Record<string, import("./codecs").CodecFn<unknown>>>({ schema, details, }: import("./manifest").PropsFromSchemaOptions<T>) => Record<string, import("./manifest").ManifestProp>;
|
|
47
50
|
readonly resolveStyle: ({ part, props, className: override, }: import("./styles").ResolveStyleOptions) => string;
|
|
48
51
|
readonly className: ({ values }: import("./class-name").ClassNameOptions) => string;
|
|
@@ -68,9 +71,9 @@ declare const ui: {
|
|
|
68
71
|
readonly applyStreamPatches: (AlpineInstance: import("./stream").StreamAlpine, payload: import("./stream").StreamPatchPayload | import("./stream").StreamPatchPayload[]) => void;
|
|
69
72
|
readonly applyUiEffect: (AlpineInstance: import("./stream").StreamAlpine, effect: import("./stream").UiEffectPayload) => void;
|
|
70
73
|
readonly applyUiEffects: (AlpineInstance: import("./stream").StreamAlpine, effects: import("./stream").UiEffectPayload | import("./stream").UiEffectPayload[]) => void;
|
|
71
|
-
readonly connectStream: (AlpineInstance: import("./stream").StreamAlpine, url: string) =>
|
|
74
|
+
readonly connectStream: (AlpineInstance: import("./stream").StreamAlpine, url: string) => {
|
|
72
75
|
abort(reason?: string): void;
|
|
73
|
-
}
|
|
76
|
+
};
|
|
74
77
|
readonly dispatchStreamEvent: (payload: import("./stream").StreamEventPayload) => void;
|
|
75
78
|
readonly applyThemeMode: (mode: import("./theme").ThemeMode) => import("./theme").ThemeChangeDetail;
|
|
76
79
|
readonly createThemeStore: () => import("./theme").ThemeStore;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
type MachineEventObject = {
|
|
2
|
+
type: string;
|
|
3
|
+
[key: string]: unknown;
|
|
4
|
+
};
|
|
5
|
+
type MachineEvent = string | MachineEventObject;
|
|
6
|
+
type MachineActionRef = string | MachineAction | MachineEffect;
|
|
7
|
+
type MachineActionList = MachineActionRef | MachineActionRef[];
|
|
8
|
+
type MachineTransition<TContext> = string | {
|
|
9
|
+
target?: string;
|
|
10
|
+
guard?: string | MachineGuard<TContext>;
|
|
11
|
+
actions?: MachineActionList;
|
|
12
|
+
};
|
|
13
|
+
type MachineStateConfig<TContext> = {
|
|
14
|
+
id?: string;
|
|
15
|
+
initial?: string;
|
|
16
|
+
tags?: string[];
|
|
17
|
+
entry?: MachineActionList;
|
|
18
|
+
exit?: MachineActionList;
|
|
19
|
+
on?: Record<string, MachineTransition<TContext> | Array<MachineTransition<TContext>>>;
|
|
20
|
+
states?: Record<string, MachineStateConfig<TContext>>;
|
|
21
|
+
};
|
|
22
|
+
type MachineConfig<TContext> = {
|
|
23
|
+
initial: string;
|
|
24
|
+
states: Record<string, MachineStateConfig<TContext>>;
|
|
25
|
+
};
|
|
26
|
+
type MachineScope<TContext> = {
|
|
27
|
+
context: TContext;
|
|
28
|
+
event: MachineEventObject;
|
|
29
|
+
state: string;
|
|
30
|
+
};
|
|
31
|
+
type MachineAction<TContext = unknown> = (scope: MachineScope<TContext>) => void;
|
|
32
|
+
type MachineEffect<TContext = unknown> = (scope: MachineScope<TContext>) => void | (() => void);
|
|
33
|
+
type MachineGuard<TContext = unknown> = (scope: MachineScope<TContext>) => boolean;
|
|
34
|
+
type MachineOptions<TContext> = {
|
|
35
|
+
context: TContext;
|
|
36
|
+
actions?: Record<string, MachineAction<TContext>>;
|
|
37
|
+
guards?: Record<string, MachineGuard<TContext>>;
|
|
38
|
+
effects?: Record<string, MachineEffect<TContext>>;
|
|
39
|
+
};
|
|
40
|
+
type VisibilityMachineConfig = {
|
|
41
|
+
enter?: MachineActionList;
|
|
42
|
+
exit?: MachineActionList;
|
|
43
|
+
};
|
|
44
|
+
type Machine<TContext> = {
|
|
45
|
+
state: string;
|
|
46
|
+
context: TContext;
|
|
47
|
+
send(event: MachineEvent): void;
|
|
48
|
+
matches(state: string): boolean;
|
|
49
|
+
hasTag(tag: string): boolean;
|
|
50
|
+
stop(): void;
|
|
51
|
+
};
|
|
52
|
+
declare const createVisibilityMachine: <TContext>({ enter, exit, }?: VisibilityMachineConfig) => MachineConfig<TContext>;
|
|
53
|
+
declare const createMachine: <TContext>(config: MachineConfig<TContext>, options: MachineOptions<TContext>) => Machine<TContext>;
|
|
54
|
+
export { createMachine, createVisibilityMachine };
|
|
55
|
+
export type { Machine, MachineAction, MachineActionList, MachineActionRef, MachineConfig, MachineEffect, MachineEvent, MachineEventObject, MachineGuard, MachineOptions, MachineScope, MachineStateConfig, MachineTransition, VisibilityMachineConfig, };
|
|
@@ -5,6 +5,7 @@ type ManifestProp = {
|
|
|
5
5
|
default?: unknown;
|
|
6
6
|
values?: readonly string[];
|
|
7
7
|
description?: string;
|
|
8
|
+
initialOnly?: boolean;
|
|
8
9
|
};
|
|
9
10
|
type ManifestPart = {
|
|
10
11
|
selector: string;
|
|
@@ -36,6 +37,7 @@ type ComponentManifest = {
|
|
|
36
37
|
};
|
|
37
38
|
type ManifestPropDetails = Pick<ManifestProp, 'description'> & {
|
|
38
39
|
name?: string;
|
|
40
|
+
initialOnly?: boolean;
|
|
39
41
|
};
|
|
40
42
|
type SchemaPropDetails<T extends Record<string, CodecFn<unknown>>> = {
|
|
41
43
|
[K in keyof T]?: ManifestPropDetails;
|
|
@@ -41,7 +41,7 @@ declare const dispatchStreamEvent: (payload: StreamEventPayload) => void;
|
|
|
41
41
|
declare const isManagedHistoryState: (state: unknown) => state is ManagedHistoryState;
|
|
42
42
|
declare const applyUiEffect: (AlpineInstance: StreamAlpine, effect: UiEffectPayload) => void;
|
|
43
43
|
declare const applyUiEffects: (AlpineInstance: StreamAlpine, effects: UiEffectPayload | UiEffectPayload[]) => void;
|
|
44
|
-
declare const connectStream: (AlpineInstance: StreamAlpine, url: string) =>
|
|
44
|
+
declare const connectStream: (AlpineInstance: StreamAlpine, url: string) => StreamController;
|
|
45
45
|
declare const registerStream: (AlpineInstance: Alpine.Alpine) => void;
|
|
46
46
|
export { applyUiEffect, applyUiEffects, applyStreamPatch, applyStreamPatchNow, applyStreamPatches, connectStream, dispatchStreamEvent, isManagedHistoryState, registerStream, };
|
|
47
47
|
export type { LocationPayload, PatchMode, StreamAlpine, StreamEventPayload, StreamPatchPayload, UiEffectPayload };
|