@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.
Files changed (173) hide show
  1. package/package.json +8 -4
  2. package/packages/client/src/components/app/styles.css +1 -30
  3. package/packages/client/src/components/button/styles.css +1 -122
  4. package/packages/client/src/components/date-picker/styles.css +47 -77
  5. package/packages/client/src/components/field/styles.css +10 -0
  6. package/packages/client/src/components/file-upload/styles.css +0 -28
  7. package/packages/client/src/components/panels/styles.css +43 -0
  8. package/packages/client/src/components/radio/styles.css +26 -21
  9. package/packages/client/src/components/scroll-area/styles.css +0 -4
  10. package/packages/client/src/components/select/styles.css +0 -30
  11. package/packages/client/src/components/sidebar/styles.css +8 -0
  12. package/packages/client/src/components/toast/styles.css +14 -7
  13. package/packages/client/src/styles/components.css +1 -0
  14. package/packages/client/src/styles/generated/theme-fonts.css +5 -0
  15. package/packages/client/src/styles/generated/theme-palette.css +2656 -0
  16. package/packages/client/src/styles/generated/theme-runtime.css +2966 -0
  17. package/packages/client/src/styles/generated-sources.css +1 -1
  18. package/packages/client/src/styles/static.css +1 -0
  19. package/packages/client/src/styles/theme.css +777 -738
  20. package/packages/client/types/cdn.d.ts +1 -4
  21. package/packages/client/types/component-api.d.ts +21 -0
  22. package/packages/client/types/components/accordion/contract.d.ts +3 -2
  23. package/packages/client/types/components/accordion/index.d.ts +28 -42
  24. package/packages/client/types/components/accordion/machine.d.ts +131 -0
  25. package/packages/client/types/components/accordion/runtime-docs.d.ts +2 -0
  26. package/packages/client/types/components/action/contract.d.ts +3 -3
  27. package/packages/client/types/components/app/contract.d.ts +25 -12
  28. package/packages/client/types/components/app/index.d.ts +2 -2
  29. package/packages/client/types/components/badge/contract.d.ts +5 -5
  30. package/packages/client/types/components/box/contract.d.ts +25 -28
  31. package/packages/client/types/components/brand/contract.d.ts +2 -2
  32. package/packages/client/types/components/button/contract.d.ts +5 -5
  33. package/packages/client/types/components/card/contract.d.ts +28 -31
  34. package/packages/client/types/components/checkbox/contract.d.ts +17 -17
  35. package/packages/client/types/components/checkbox/index.d.ts +20 -26
  36. package/packages/client/types/components/checkbox/machine.d.ts +41 -0
  37. package/packages/client/types/components/checkbox/runtime-docs.d.ts +2 -0
  38. package/packages/client/types/components/common.d.ts +53 -235
  39. package/packages/client/types/components/container/contract.d.ts +11 -12
  40. package/packages/client/types/components/date-picker/contract.d.ts +21 -16
  41. package/packages/client/types/components/date-picker/index.d.ts +38 -60
  42. package/packages/client/types/components/date-picker/machine.d.ts +529 -0
  43. package/packages/client/types/components/date-picker/runtime-docs.d.ts +2 -0
  44. package/packages/client/types/components/date-picker/value.d.ts +28 -0
  45. package/packages/client/types/components/dropdown/contract.d.ts +4 -4
  46. package/packages/client/types/components/dropdown/index.d.ts +20 -45
  47. package/packages/client/types/components/dropdown/machine.d.ts +93 -0
  48. package/packages/client/types/components/dropdown/runtime-docs.d.ts +2 -0
  49. package/packages/client/types/components/field/contract.d.ts +10 -6
  50. package/packages/client/types/components/field/index.d.ts +6 -6
  51. package/packages/client/types/components/field/machine.d.ts +13 -0
  52. package/packages/client/types/components/field/runtime-docs.d.ts +2 -0
  53. package/packages/client/types/components/file-upload/contract.d.ts +7 -4
  54. package/packages/client/types/components/file-upload/index.d.ts +34 -31
  55. package/packages/client/types/components/file-upload/machine.d.ts +127 -0
  56. package/packages/client/types/components/file-upload/runtime-docs.d.ts +2 -0
  57. package/packages/client/types/components/flex/contract.d.ts +16 -17
  58. package/packages/client/types/components/frame/contract.d.ts +41 -47
  59. package/packages/client/types/components/frame/index.d.ts +2 -2
  60. package/packages/client/types/components/grid/contract.d.ts +20 -21
  61. package/packages/client/types/components/heading/contract.d.ts +1 -1
  62. package/packages/client/types/components/image/contract.d.ts +3 -3
  63. package/packages/client/types/components/input/contract.d.ts +2 -2
  64. package/packages/client/types/components/input/index.d.ts +15 -12
  65. package/packages/client/types/components/input/machine.d.ts +20 -0
  66. package/packages/client/types/components/layout.d.ts +44 -225
  67. package/packages/client/types/components/menu/contract.d.ts +14 -8
  68. package/packages/client/types/components/modal/contract.d.ts +12 -12
  69. package/packages/client/types/components/modal/index.d.ts +41 -75
  70. package/packages/client/types/components/modal/machine.d.ts +129 -0
  71. package/packages/client/types/components/modal/runtime-docs.d.ts +2 -0
  72. package/packages/client/types/components/overlay/contract.d.ts +3 -3
  73. package/packages/client/types/components/panels/contract.d.ts +39 -0
  74. package/packages/client/types/components/panels/index.d.ts +54 -0
  75. package/packages/client/types/components/panels/machine.d.ts +151 -0
  76. package/packages/client/types/components/panels/runtime-docs.d.ts +2 -0
  77. package/packages/client/types/components/radio/contract.d.ts +11 -11
  78. package/packages/client/types/components/radio/index.d.ts +19 -23
  79. package/packages/client/types/components/radio/machine.d.ts +40 -0
  80. package/packages/client/types/components/radio/runtime-docs.d.ts +2 -0
  81. package/packages/client/types/components/runtime-docs.d.ts +2 -0
  82. package/packages/client/types/components/runtime.d.ts +16 -19
  83. package/packages/client/types/components/scroll-area/contract.d.ts +4 -7
  84. package/packages/client/types/components/scroll-area/index.d.ts +23 -49
  85. package/packages/client/types/components/scroll-area/machine.d.ts +21 -0
  86. package/packages/client/types/components/scroll-area/runtime-docs.d.ts +2 -0
  87. package/packages/client/types/components/section/contract.d.ts +12 -13
  88. package/packages/client/types/components/select/contract.d.ts +19 -15
  89. package/packages/client/types/components/select/index.d.ts +42 -89
  90. package/packages/client/types/components/select/machine.d.ts +476 -0
  91. package/packages/client/types/components/select/runtime-docs.d.ts +2 -0
  92. package/packages/client/types/components/shared/controlled-open.d.ts +11 -0
  93. package/packages/client/types/components/sidebar/contract.d.ts +19 -12
  94. package/packages/client/types/components/sidebar/index.d.ts +51 -88
  95. package/packages/client/types/components/sidebar/machine.d.ts +100 -0
  96. package/packages/client/types/components/sidebar/runtime-docs.d.ts +2 -0
  97. package/packages/client/types/components/slider/contract.d.ts +3 -3
  98. package/packages/client/types/components/slider/index.d.ts +17 -21
  99. package/packages/client/types/components/slider/machine.d.ts +37 -0
  100. package/packages/client/types/components/slider/runtime-docs.d.ts +2 -0
  101. package/packages/client/types/components/stack/contract.d.ts +16 -17
  102. package/packages/client/types/components/surface-manifest.d.ts +9 -0
  103. package/packages/client/types/components/switch/contract.d.ts +11 -11
  104. package/packages/client/types/components/switch/index.d.ts +13 -18
  105. package/packages/client/types/components/switch/machine.d.ts +19 -0
  106. package/packages/client/types/components/switch/runtime-docs.d.ts +2 -0
  107. package/packages/client/types/components/table/contract.d.ts +18 -18
  108. package/packages/client/types/components/tabs/contract.d.ts +10 -5
  109. package/packages/client/types/components/tabs/index.d.ts +33 -51
  110. package/packages/client/types/components/tabs/machine.d.ts +84 -0
  111. package/packages/client/types/components/tabs/runtime-docs.d.ts +2 -0
  112. package/packages/client/types/components/text/contract.d.ts +1 -1
  113. package/packages/client/types/components/textarea/contract.d.ts +2 -2
  114. package/packages/client/types/components/toast/contract.d.ts +5 -4
  115. package/packages/client/types/components/toast/index.d.ts +38 -12
  116. package/packages/client/types/components/toast/machine.d.ts +115 -0
  117. package/packages/client/types/components/toast/runtime-docs.d.ts +2 -0
  118. package/packages/client/types/directives/index.d.ts +3 -1
  119. package/packages/client/types/directives/layout.d.ts +3 -0
  120. package/packages/client/types/directives/request.d.ts +1 -2
  121. package/packages/client/types/directives/transition.d.ts +3 -0
  122. package/packages/client/types/docs/transition-docs.d.ts +30 -0
  123. package/packages/client/types/index.d.ts +8 -40
  124. package/packages/client/types/motion/animate.d.ts +5 -44
  125. package/packages/client/types/motion/controller.d.ts +33 -0
  126. package/packages/client/types/motion/index.d.ts +43 -20
  127. package/packages/client/types/motion/owned.d.ts +5 -0
  128. package/packages/client/types/motion/plan.d.ts +46 -0
  129. package/packages/client/types/motion/recipe.d.ts +56 -0
  130. package/packages/client/types/motion/registry.d.ts +12 -0
  131. package/packages/client/types/motion/resize.d.ts +15 -0
  132. package/packages/client/types/motion/subject.d.ts +10 -0
  133. package/packages/client/types/motion/targets.d.ts +2 -5
  134. package/packages/client/types/motion/view.d.ts +7 -2
  135. package/packages/client/types/runtime/alpine-machine.d.ts +68 -0
  136. package/packages/client/types/runtime/anchored-popover.d.ts +10 -2
  137. package/packages/client/types/runtime/codecs.d.ts +16 -2
  138. package/packages/client/types/runtime/{resizable.d.ts → drag-and-drop/index.d.ts} +4 -2
  139. package/packages/client/types/runtime/engine/request.d.ts +2 -2
  140. package/packages/client/types/runtime/engine/stream.d.ts +11 -5
  141. package/packages/client/types/runtime/focus-scope.d.ts +7 -0
  142. package/packages/client/types/runtime/identity.d.ts +3 -0
  143. package/packages/client/types/runtime/index.d.ts +9 -75
  144. package/packages/client/types/runtime/merge-bindings.d.ts +1 -1
  145. package/packages/client/types/runtime/semantic-observer.d.ts +10 -0
  146. package/packages/client/types/runtime/state-machine/index.d.ts +4 -0
  147. package/packages/client/types/runtime/state-machine/machine.d.ts +83 -0
  148. package/packages/client/types/runtime/state-machine/props-change.d.ts +12 -0
  149. package/packages/client/types/runtime/transition-coordinator.d.ts +52 -0
  150. package/packages/client/types/runtime/ui.d.ts +15 -0
  151. package/packages/client/types/utils/index.d.ts +2 -1
  152. package/packages/client/types/utils/number.d.ts +2 -0
  153. package/packages/client/types/utils/object.d.ts +4 -1
  154. package/packages/server/trellis_ui/static/trellis_ui/assets/css/trellis.css +9097 -2595
  155. package/packages/server/trellis_ui/static/trellis_ui/assets/css/trellis.min.css +1 -1
  156. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/index.js +17363 -13332
  157. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/index.js.map +1 -1
  158. package/packages/server/trellis_ui/static/trellis_ui/assets/js/trellis.js +8 -13
  159. package/packages/server/trellis_ui/static/trellis_ui/assets/js/trellis.min.js +8 -13
  160. package/packages/client/types/bindings/disclosure.d.ts +0 -3
  161. package/packages/client/types/bindings/index.d.ts +0 -7
  162. package/packages/client/types/bindings/motion.d.ts +0 -3
  163. package/packages/client/types/bindings/state.d.ts +0 -3
  164. package/packages/client/types/bindings/types.d.ts +0 -33
  165. package/packages/client/types/components/combobox/contract.d.ts +0 -60
  166. package/packages/client/types/components/combobox/index.d.ts +0 -80
  167. package/packages/client/types/components/textarea/index.d.ts +0 -13
  168. package/packages/client/types/motion/presence.d.ts +0 -34
  169. package/packages/client/types/runtime/class-name.d.ts +0 -9
  170. package/packages/client/types/runtime/create.d.ts +0 -8
  171. package/packages/client/types/runtime/machine.d.ts +0 -55
  172. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/cally-TZl4LpyH.js +0 -1134
  173. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/cally-TZl4LpyH.js.map +0 -1
@@ -1,55 +1,30 @@
1
1
  import type Alpine from 'alpinejs';
2
- import { type AnchoredPopover, type BindingObject, type CollectionNavigation, type Machine, type TrellisAlpineComponent } from '../../runtime';
3
- import type { PresenceLifecycle } from '../../motion';
2
+ import { type AlpineMachine, type TrellisAlpineComponent } from '../../runtime';
3
+ import { type BindingObject } from '../../runtime/merge-bindings';
4
4
  import { type DropdownProps } from './contract';
5
- type PopoverElement = HTMLElement & {
6
- showPopover(): void;
7
- hidePopover(): void;
8
- };
9
- type DropdownData = {
5
+ import { dropdownHooks, type DropdownContext } from './machine';
6
+ /**
7
+ * Public Alpine API for `ui.dropdown`.
8
+ *
9
+ * @public
10
+ */
11
+ interface UiDropdownApi {
12
+ /** Whether the dropdown is opening or fully open. */
10
13
  readonly isOpen: boolean;
11
- machine: Machine<Record<string, never>>;
12
- menuMotion: PresenceLifecycle | null;
13
- triggerId: string;
14
- menuId: string;
15
- props: DropdownProps;
16
- collection: CollectionNavigation | null;
17
- popover: AnchoredPopover | null;
18
- triggerCleanup: Array<() => void>;
19
- menuCleanup: Array<() => void>;
14
+ /** Opens the dropdown unless it is disabled. */
20
15
  open(event?: Event): void;
16
+ /** Closes the dropdown. Keyboard dismissal restores focus to the trigger. */
21
17
  close(event?: Event): void;
18
+ /** Reverses the current dropdown lifecycle, including an in-flight transition. */
22
19
  toggle(event?: Event): void;
23
- focusNext(): void;
24
- focusPrevious(): void;
25
- focusFirst(): void;
26
- focusLast(): void;
27
- activateItem(el: HTMLElement): void;
28
- clearActiveItem(): void;
29
- root: BindingObject;
30
- menu(el: HTMLElement): BindingObject;
31
- menuItem(el: HTMLElement): BindingObject;
32
- triggerEl(): HTMLElement;
33
- menuEl(): PopoverElement;
34
- allItemEls(): HTMLElement[];
35
- itemEls(): HTMLElement[];
36
- mount(): void;
37
- unmount(): void;
38
- applyProps(changedKeys?: string[]): void;
39
- syncFromPopover(event: ToggleEvent): void;
40
- syncPosition(): void;
41
- syncMenuAttributes(): void;
42
- syncTriggerAttributes(): void;
43
- finishClose(): void;
44
- setupMenu(): void;
45
- setupTrigger(): void;
46
- teardownTrigger(): void;
47
- teardownMenu(): void;
48
- selectItem(el: HTMLElement, event: Event): void;
49
- focusItem(el: HTMLElement): void;
50
- collectionNav(): CollectionNavigation;
20
+ }
21
+ type DropdownData = AlpineMachine<DropdownContext, DropdownProps, typeof dropdownHooks> & UiDropdownApi & {
22
+ readonly root: BindingObject;
23
+ readonly menu: BindingObject;
24
+ init(): void;
25
+ destroy(): void;
51
26
  };
52
27
  declare const UiDropdown: () => TrellisAlpineComponent<DropdownData>;
53
28
  declare const registerDropdown: (AlpineInstance: Alpine.Alpine) => void;
54
29
  export { registerDropdown, UiDropdown };
55
- export type { DropdownData };
30
+ export type { DropdownData, UiDropdownApi };
@@ -0,0 +1,93 @@
1
+ import { type Machine } from '../../runtime/state-machine';
2
+ import type { DropdownProps } from './contract';
3
+ type DropdownContext = Record<string, never>;
4
+ type DropdownFocus = 'menu' | 'first';
5
+ type DropdownMachineEffects = {
6
+ prepareOpen(focus: DropdownFocus): void;
7
+ finishOpen(): void;
8
+ prepareClose(restoreFocus: boolean): void;
9
+ finishClose(): void;
10
+ syncProps(): void;
11
+ };
12
+ type CreateDropdownMachineOptions = {
13
+ props: DropdownProps;
14
+ effects: DropdownMachineEffects;
15
+ };
16
+ declare const dropdownHooks: readonly [Readonly<{
17
+ name: "opening";
18
+ state: string;
19
+ onDone: string;
20
+ onError: string;
21
+ required?: boolean;
22
+ sends?: Record<string, import("../..").TransitionEventCreator>;
23
+ project?: (snapshot: Readonly<{
24
+ value: import("../..").MachineStateValue;
25
+ tags: readonly string[];
26
+ context: Readonly<DropdownContext>;
27
+ props: Readonly<import("../..").SchemaToProps<{
28
+ side: import("../../runtime/codecs").OneOfCodec<"top" | "bottom" | "left" | "right">;
29
+ align: import("../../runtime/codecs").OneOfCodec<"start" | "center" | "end">;
30
+ offset: import("../../runtime/codecs").NumberCodec;
31
+ gap: import("../../runtime/codecs").NumberCodec;
32
+ open: import("../../runtime/codecs").BoolCodec;
33
+ disabled: import("../../runtime/codecs").BoolCodec;
34
+ class: import("../../runtime/codecs").StringCodec;
35
+ }>>;
36
+ generations: Readonly<Record<string, number>>;
37
+ }>) => Record<string, never>;
38
+ projectEach?: (snapshot: Readonly<{
39
+ value: import("../..").MachineStateValue;
40
+ tags: readonly string[];
41
+ context: Readonly<DropdownContext>;
42
+ props: Readonly<import("../..").SchemaToProps<{
43
+ side: import("../../runtime/codecs").OneOfCodec<"top" | "bottom" | "left" | "right">;
44
+ align: import("../../runtime/codecs").OneOfCodec<"start" | "center" | "end">;
45
+ offset: import("../../runtime/codecs").NumberCodec;
46
+ gap: import("../../runtime/codecs").NumberCodec;
47
+ open: import("../../runtime/codecs").BoolCodec;
48
+ disabled: import("../../runtime/codecs").BoolCodec;
49
+ class: import("../../runtime/codecs").StringCodec;
50
+ }>>;
51
+ generations: Readonly<Record<string, number>>;
52
+ }>) => readonly Record<string, never>[];
53
+ }>, Readonly<{
54
+ name: "closing";
55
+ state: string;
56
+ onDone: string;
57
+ onError: string;
58
+ required?: boolean;
59
+ sends?: Record<string, import("../..").TransitionEventCreator>;
60
+ project?: (snapshot: Readonly<{
61
+ value: import("../..").MachineStateValue;
62
+ tags: readonly string[];
63
+ context: Readonly<DropdownContext>;
64
+ props: Readonly<import("../..").SchemaToProps<{
65
+ side: import("../../runtime/codecs").OneOfCodec<"top" | "bottom" | "left" | "right">;
66
+ align: import("../../runtime/codecs").OneOfCodec<"start" | "center" | "end">;
67
+ offset: import("../../runtime/codecs").NumberCodec;
68
+ gap: import("../../runtime/codecs").NumberCodec;
69
+ open: import("../../runtime/codecs").BoolCodec;
70
+ disabled: import("../../runtime/codecs").BoolCodec;
71
+ class: import("../../runtime/codecs").StringCodec;
72
+ }>>;
73
+ generations: Readonly<Record<string, number>>;
74
+ }>) => Record<string, never>;
75
+ projectEach?: (snapshot: Readonly<{
76
+ value: import("../..").MachineStateValue;
77
+ tags: readonly string[];
78
+ context: Readonly<DropdownContext>;
79
+ props: Readonly<import("../..").SchemaToProps<{
80
+ side: import("../../runtime/codecs").OneOfCodec<"top" | "bottom" | "left" | "right">;
81
+ align: import("../../runtime/codecs").OneOfCodec<"start" | "center" | "end">;
82
+ offset: import("../../runtime/codecs").NumberCodec;
83
+ gap: import("../../runtime/codecs").NumberCodec;
84
+ open: import("../../runtime/codecs").BoolCodec;
85
+ disabled: import("../../runtime/codecs").BoolCodec;
86
+ class: import("../../runtime/codecs").StringCodec;
87
+ }>>;
88
+ generations: Readonly<Record<string, number>>;
89
+ }>) => readonly Record<string, never>[];
90
+ }>];
91
+ declare const createDropdownMachine: ({ props, effects, }: CreateDropdownMachineOptions) => Machine<DropdownContext, DropdownProps>;
92
+ export { createDropdownMachine, dropdownHooks };
93
+ export type { CreateDropdownMachineOptions, DropdownContext, DropdownFocus, DropdownMachineEffects, };
@@ -0,0 +1,2 @@
1
+ declare const dropdownRuntimeDocs: import("../../docs/transition-docs").ComponentTransitionDocs;
2
+ export { dropdownRuntimeDocs };
@@ -1,4 +1,4 @@
1
- import { type PropState } from '../../runtime';
1
+ import { type SchemaToProps } from '../../runtime';
2
2
  import { type Orientation } from '../common';
3
3
  declare const FIELD_LAYOUTS: readonly ["stack", "grid", "inline"];
4
4
  declare const FIELD_GROUP_LAYOUTS: readonly ["stack", "row", "grid"];
@@ -60,8 +60,12 @@ declare const fieldsetLegendSchema: {
60
60
  required: import("../../runtime/codecs").BoolCodec;
61
61
  class: import("../../runtime/codecs").StringCodec;
62
62
  };
63
- type FieldProps = PropState<typeof fieldSchema>;
64
- type FieldGroupProps = PropState<typeof fieldGroupSchema>;
65
- type FieldsetProps = PropState<typeof fieldsetSchema>;
66
- export { FIELD_GROUP_LAYOUTS, FIELD_LAYOUTS, FIELD_ORIENTATIONS, fieldDescriptionSchema, fieldErrorSchema, fieldGroupSchema, fieldLabelSchema, fieldSchema, fieldsetLegendSchema, fieldsetSchema, };
67
- export type { FieldGroupLayout, FieldGroupProps, FieldLayout, FieldOrientation, FieldProps, FieldsetProps };
63
+ declare const fieldRuntimeSchema: {
64
+ invalid: import("../..").CodecFn<boolean>;
65
+ };
66
+ type FieldProps = SchemaToProps<typeof fieldSchema>;
67
+ type FieldGroupProps = SchemaToProps<typeof fieldGroupSchema>;
68
+ type FieldRuntimeProps = SchemaToProps<typeof fieldRuntimeSchema>;
69
+ type FieldsetProps = SchemaToProps<typeof fieldsetSchema>;
70
+ export { FIELD_GROUP_LAYOUTS, FIELD_LAYOUTS, FIELD_ORIENTATIONS, fieldDescriptionSchema, fieldErrorSchema, fieldGroupSchema, fieldLabelSchema, fieldRuntimeSchema, fieldSchema, fieldsetLegendSchema, fieldsetSchema, };
71
+ export type { FieldGroupLayout, FieldGroupProps, FieldLayout, FieldOrientation, FieldProps, FieldRuntimeProps, FieldsetProps };
@@ -1,11 +1,11 @@
1
1
  import type Alpine from 'alpinejs';
2
- import { type CleanupStack, type TrellisAlpineComponent } from '../../runtime';
3
- type FieldData = {
4
- observer: MutationObserver | null;
5
- listeners: CleanupStack;
6
- sync(): void;
2
+ import { type AlpineMachine, type TrellisAlpineComponent } from '../../runtime';
3
+ import { type FieldRuntimeProps } from './contract';
4
+ import { fieldHooks, type FieldContext } from './machine';
5
+ type FieldData = AlpineMachine<FieldContext, FieldRuntimeProps, typeof fieldHooks> & {
6
+ init(): void;
7
+ destroy(): void;
7
8
  };
8
9
  declare const UiField: () => TrellisAlpineComponent<FieldData>;
9
10
  declare const registerField: (AlpineInstance: Alpine.Alpine) => void;
10
11
  export { registerField, UiField };
11
- export type { FieldData };
@@ -0,0 +1,13 @@
1
+ import { type Machine, type MachineScope } from '../../runtime/state-machine';
2
+ import type { FieldRuntimeProps } from './contract';
3
+ type FieldContext = Record<string, never>;
4
+ type FieldEffects = {
5
+ sync(scope: MachineScope<FieldContext, FieldRuntimeProps>): void;
6
+ };
7
+ declare const fieldHooks: readonly [];
8
+ declare const createFieldMachine: ({ props, effects }: {
9
+ props: FieldRuntimeProps;
10
+ effects: FieldEffects;
11
+ }) => Machine<FieldContext, FieldRuntimeProps>;
12
+ export { createFieldMachine, fieldHooks };
13
+ export type { FieldContext, FieldEffects };
@@ -0,0 +1,2 @@
1
+ declare const fieldRuntimeDocs: import("../../docs/transition-docs").ComponentTransitionDocs;
2
+ export { fieldRuntimeDocs };
@@ -1,10 +1,12 @@
1
- import { type PropState } from '../../runtime';
1
+ import { type SchemaToProps } from '../../runtime';
2
2
  declare const FILE_UPLOAD_LAYOUTS: readonly ["stack", "inline"];
3
3
  declare const FILE_UPLOAD_PREVIEWS: readonly ["auto", "image", "none"];
4
4
  declare const FILE_UPLOAD_SIZES: readonly ["sm", "md", "lg"];
5
+ declare const FILE_UPLOAD_TRANSPORTS: readonly ["native", "direct"];
5
6
  type FileUploadLayout = (typeof FILE_UPLOAD_LAYOUTS)[number];
6
7
  type FileUploadPreview = (typeof FILE_UPLOAD_PREVIEWS)[number];
7
8
  type FileUploadSize = (typeof FILE_UPLOAD_SIZES)[number];
9
+ type FileUploadTransport = (typeof FILE_UPLOAD_TRANSPORTS)[number];
8
10
  declare const fileUploadSchema: {
9
11
  name: import("../../runtime/codecs").StringCodec;
10
12
  accept: import("../../runtime/codecs").StringCodec;
@@ -22,6 +24,7 @@ declare const fileUploadSchema: {
22
24
  empty: import("../../runtime/codecs").StringCodec;
23
25
  maxItems: import("../../runtime/codecs").NumberCodec;
24
26
  clearable: import("../../runtime/codecs").BoolCodec;
27
+ transport: import("../../runtime/codecs").OneOfCodec<"native" | "direct">;
25
28
  rootClass: import("../../runtime/codecs").StringCodec;
26
29
  dropzoneClass: import("../../runtime/codecs").StringCodec;
27
30
  listClass: import("../../runtime/codecs").StringCodec;
@@ -55,6 +58,6 @@ declare const fileUploadRemoveSchema: {
55
58
  label: import("../../runtime/codecs").StringCodec;
56
59
  class: import("../../runtime/codecs").StringCodec;
57
60
  };
58
- type FileUploadProps = PropState<typeof fileUploadSchema>;
59
- export { FILE_UPLOAD_LAYOUTS, FILE_UPLOAD_PREVIEWS, FILE_UPLOAD_SIZES, fileUploadDropzoneSchema, fileUploadItemSchema, fileUploadListSchema, fileUploadRemoveSchema, fileUploadSchema, };
60
- export type { FileUploadLayout, FileUploadPreview, FileUploadProps, FileUploadSize, };
61
+ type FileUploadProps = SchemaToProps<typeof fileUploadSchema>;
62
+ export { FILE_UPLOAD_LAYOUTS, FILE_UPLOAD_PREVIEWS, FILE_UPLOAD_SIZES, FILE_UPLOAD_TRANSPORTS, fileUploadDropzoneSchema, fileUploadItemSchema, fileUploadListSchema, fileUploadRemoveSchema, fileUploadSchema, };
63
+ export type { FileUploadLayout, FileUploadPreview, FileUploadProps, FileUploadSize, FileUploadTransport, };
@@ -1,36 +1,39 @@
1
1
  import type Alpine from 'alpinejs';
2
- import { type CleanupStack, type TrellisAlpineComponent } from '../../runtime';
2
+ import { type AlpineMachine, type TrellisAlpineComponent } from '../../runtime';
3
3
  import { type FileUploadProps } from './contract';
4
- type PendingFile = {
5
- id: string;
6
- file: File;
7
- name: string;
8
- size: string;
9
- type: string;
10
- previewUrl: string;
11
- };
12
- type FileUploadData = {
13
- props: FileUploadProps;
14
- listeners: CleanupStack;
15
- files: PendingFile[];
16
- limitReached: boolean;
17
- emptyInputChangeClears: boolean;
18
- root(): HTMLElement;
19
- input(): HTMLInputElement;
20
- dropzone(): HTMLElement | null;
21
- list(): HTMLElement | null;
22
- isInputUnavailable(): boolean;
23
- sync(): void;
24
- syncFormEncoding(): void;
25
- syncInputAttributes(): void;
26
- syncFromInput(): void;
27
- addFiles(files: File[]): void;
28
- removePending(index: number): void;
29
- clearExisting(button: HTMLElement): void;
30
- renderFiles(): void;
31
- setDragging(value: boolean): void;
4
+ import { fileUploadHooks, type FileTransferStatus, type FileUploadContext, type FileUploadMetadata, type FileUploadRecord } from './machine';
5
+ /**
6
+ * Public Alpine API for `ui.file-upload`.
7
+ *
8
+ * @public
9
+ */
10
+ interface UiFileUploadApi {
11
+ /** Serializable metadata for the current pending or transferred files. */
12
+ readonly files: readonly FileUploadRecord[];
13
+ /** Whether pending or existing file content is present. */
14
+ readonly hasFiles: boolean;
15
+ /** Whether an external file is over the drop target. */
16
+ readonly isDragging: boolean;
17
+ /** Whether the direct transport hook is pending. */
18
+ readonly isUploading: boolean;
19
+ /** Whether the configured client-side item limit is full. */
20
+ readonly isLimitReached: boolean;
21
+ /** Opens the native file picker when interaction is available. */
22
+ browse(): void;
23
+ /** Removes a pending file by its stable record id. */
24
+ remove(id: string): void;
25
+ /** Retries failed or canceled direct-upload records. */
26
+ retry(): void;
27
+ /** Cancels the active direct-upload batch. */
28
+ cancel(): void;
29
+ /** Returns the original browser File for transport code without cloning it. */
30
+ file(id: string): File | null;
31
+ }
32
+ type FileUploadData = AlpineMachine<FileUploadContext, FileUploadProps, typeof fileUploadHooks> & UiFileUploadApi & {
33
+ init(): void;
34
+ destroy(): void;
32
35
  };
33
36
  declare const UiFileUpload: () => TrellisAlpineComponent<FileUploadData>;
34
37
  declare const registerFileUpload: (AlpineInstance: Alpine.Alpine) => void;
35
- export { registerFileUpload, UiFileUpload, };
36
- export type { FileUploadData, PendingFile };
38
+ export { registerFileUpload, UiFileUpload };
39
+ export type { FileTransferStatus, FileUploadData, FileUploadMetadata, FileUploadRecord, UiFileUploadApi };
@@ -0,0 +1,127 @@
1
+ import { type Machine, type MachineScope } from '../../runtime/state-machine';
2
+ import type { FileUploadProps } from './contract';
3
+ type FileSelectionSource = 'picker' | 'drop' | 'remove' | 'props' | 'clear';
4
+ type FileTransferStatus = 'selected' | 'uploading' | 'complete' | 'failed' | 'canceled';
5
+ type FileUploadMetadata = {
6
+ id: string;
7
+ name: string;
8
+ bytes: number;
9
+ size: string;
10
+ type: string;
11
+ };
12
+ type FileUploadRecord = FileUploadMetadata & {
13
+ status: FileTransferStatus;
14
+ progress: number;
15
+ };
16
+ type FileUploadContext = {
17
+ selection: {
18
+ files: FileUploadMetadata[];
19
+ limitReached: boolean;
20
+ rejectedCount: number;
21
+ limitRejectedCount: number;
22
+ source: FileSelectionSource;
23
+ };
24
+ existing: {
25
+ present: boolean;
26
+ cleared: boolean;
27
+ };
28
+ transfer: {
29
+ status: 'native' | 'idle' | 'uploading' | 'complete' | 'failed' | 'canceled';
30
+ activeIds: string[];
31
+ progress: Record<string, number>;
32
+ results: Record<string, Exclude<FileTransferStatus, 'selected' | 'uploading'>>;
33
+ error: string;
34
+ };
35
+ };
36
+ type FileUploadMachineEffects = {
37
+ commitSelection(scope: MachineScope<FileUploadContext, FileUploadProps>): void;
38
+ resetSelection(scope: MachineScope<FileUploadContext, FileUploadProps>): void;
39
+ syncProps(scope: MachineScope<FileUploadContext, FileUploadProps>): void;
40
+ syncDragging(scope: MachineScope<FileUploadContext, FileUploadProps>): void;
41
+ clearExisting(scope: MachineScope<FileUploadContext, FileUploadProps>): void;
42
+ syncTransfer(scope: MachineScope<FileUploadContext, FileUploadProps>): void;
43
+ emitComplete(scope: MachineScope<FileUploadContext, FileUploadProps>): void;
44
+ emitError(scope: MachineScope<FileUploadContext, FileUploadProps>): void;
45
+ emitCancel(scope: MachineScope<FileUploadContext, FileUploadProps>): void;
46
+ };
47
+ type CreateFileUploadMachineOptions = {
48
+ props: FileUploadProps;
49
+ context: FileUploadContext;
50
+ effects: FileUploadMachineEffects;
51
+ };
52
+ declare const fileUploadHooks: readonly [Readonly<{
53
+ name: "uploading";
54
+ state: string;
55
+ onDone: string;
56
+ onError: string;
57
+ required?: boolean;
58
+ sends?: Record<string, import("../..").TransitionEventCreator>;
59
+ project?: (snapshot: Readonly<{
60
+ value: import("../..").MachineStateValue;
61
+ tags: readonly string[];
62
+ context: Readonly<FileUploadContext>;
63
+ props: Readonly<import("../..").SchemaToProps<{
64
+ name: import("../../runtime/codecs").StringCodec;
65
+ accept: import("../../runtime/codecs").StringCodec;
66
+ capture: import("../../runtime/codecs").StringCodec;
67
+ multiple: import("../../runtime/codecs").BoolCodec;
68
+ required: import("../../runtime/codecs").BoolCodec;
69
+ disabled: import("../../runtime/codecs").BoolCodec;
70
+ invalid: import("../../runtime/codecs").BoolCodec;
71
+ preview: import("../../runtime/codecs").OneOfCodec<"image" | "none" | "auto">;
72
+ layout: import("../../runtime/codecs").OneOfCodec<"stack" | "inline">;
73
+ size: import("../../runtime/codecs").OneOfCodec<"sm" | "md" | "lg">;
74
+ heading: import("../../runtime/codecs").StringCodec;
75
+ text: import("../../runtime/codecs").StringCodec;
76
+ browseLabel: import("../../runtime/codecs").StringCodec;
77
+ empty: import("../../runtime/codecs").StringCodec;
78
+ maxItems: import("../../runtime/codecs").NumberCodec;
79
+ clearable: import("../../runtime/codecs").BoolCodec;
80
+ transport: import("../../runtime/codecs").OneOfCodec<"native" | "direct">;
81
+ rootClass: import("../../runtime/codecs").StringCodec;
82
+ dropzoneClass: import("../../runtime/codecs").StringCodec;
83
+ listClass: import("../../runtime/codecs").StringCodec;
84
+ itemClass: import("../../runtime/codecs").StringCodec;
85
+ class: import("../../runtime/codecs").StringCodec;
86
+ }>>;
87
+ generations: Readonly<Record<string, number>>;
88
+ }>) => {
89
+ files: FileUploadMetadata[];
90
+ };
91
+ projectEach?: (snapshot: Readonly<{
92
+ value: import("../..").MachineStateValue;
93
+ tags: readonly string[];
94
+ context: Readonly<FileUploadContext>;
95
+ props: Readonly<import("../..").SchemaToProps<{
96
+ name: import("../../runtime/codecs").StringCodec;
97
+ accept: import("../../runtime/codecs").StringCodec;
98
+ capture: import("../../runtime/codecs").StringCodec;
99
+ multiple: import("../../runtime/codecs").BoolCodec;
100
+ required: import("../../runtime/codecs").BoolCodec;
101
+ disabled: import("../../runtime/codecs").BoolCodec;
102
+ invalid: import("../../runtime/codecs").BoolCodec;
103
+ preview: import("../../runtime/codecs").OneOfCodec<"image" | "none" | "auto">;
104
+ layout: import("../../runtime/codecs").OneOfCodec<"stack" | "inline">;
105
+ size: import("../../runtime/codecs").OneOfCodec<"sm" | "md" | "lg">;
106
+ heading: import("../../runtime/codecs").StringCodec;
107
+ text: import("../../runtime/codecs").StringCodec;
108
+ browseLabel: import("../../runtime/codecs").StringCodec;
109
+ empty: import("../../runtime/codecs").StringCodec;
110
+ maxItems: import("../../runtime/codecs").NumberCodec;
111
+ clearable: import("../../runtime/codecs").BoolCodec;
112
+ transport: import("../../runtime/codecs").OneOfCodec<"native" | "direct">;
113
+ rootClass: import("../../runtime/codecs").StringCodec;
114
+ dropzoneClass: import("../../runtime/codecs").StringCodec;
115
+ listClass: import("../../runtime/codecs").StringCodec;
116
+ itemClass: import("../../runtime/codecs").StringCodec;
117
+ class: import("../../runtime/codecs").StringCodec;
118
+ }>>;
119
+ generations: Readonly<Record<string, number>>;
120
+ }>) => readonly {
121
+ files: FileUploadMetadata[];
122
+ }[];
123
+ }>];
124
+ declare const createFileUploadMachine: ({ props, context, effects }: CreateFileUploadMachineOptions) => Machine<FileUploadContext, FileUploadProps>;
125
+ declare const recordsFromSnapshot: (context: Readonly<FileUploadContext>) => FileUploadRecord[];
126
+ export { createFileUploadMachine, fileUploadHooks, recordsFromSnapshot };
127
+ export type { CreateFileUploadMachineOptions, FileSelectionSource, FileTransferStatus, FileUploadContext, FileUploadMachineEffects, FileUploadMetadata, FileUploadRecord, };
@@ -0,0 +1,2 @@
1
+ declare const fileUploadRuntimeDocs: import("../../docs/transition-docs").ComponentTransitionDocs;
2
+ export { fileUploadRuntimeDocs };
@@ -1,35 +1,34 @@
1
- import { type PropState } from '../../runtime';
1
+ import { type SchemaToProps } from '../../runtime';
2
2
  import { type LayoutAlign, type LayoutAs, type LayoutJustify, type LayoutSpace } from '../layout';
3
3
  declare const FLEX_DISPLAYS: readonly ["flex", "inline-flex", "none"];
4
4
  declare const FLEX_DIRECTIONS: readonly ["row", "column", "row-reverse", "column-reverse"];
5
5
  declare const FLEX_WRAPS: readonly ["nowrap", "wrap", "wrap-reverse"];
6
6
  declare const flexSchema: {
7
- padding: import("../../runtime/codecs").OneOfCodec<"0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9">;
8
- paddingX: import("../../runtime/codecs").OneOfCodec<"0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9">;
9
- paddingY: import("../../runtime/codecs").OneOfCodec<"0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9">;
10
- margin: import("../../runtime/codecs").OneOfCodec<"0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9">;
11
- marginX: import("../../runtime/codecs").OneOfCodec<"0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9">;
12
- marginY: import("../../runtime/codecs").OneOfCodec<"0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9">;
13
- surface: import("../../runtime/codecs").OneOfCodec<"none" | "subtle" | "accent" | "app" | "chrome" | "panel" | "raised" | "overlay" | "inverse">;
14
- tone: import("../../runtime/codecs").OneOfCodec<"solid" | "alpha">;
7
+ padding: import("../../runtime/codecs").OneOfCodec<"1" | "0" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6.5" | "7.5" | "8.5" | "9.5" | "10.5" | "11.5">;
8
+ paddingX: import("../../runtime/codecs").OneOfCodec<"1" | "0" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6.5" | "7.5" | "8.5" | "9.5" | "10.5" | "11.5">;
9
+ paddingY: import("../../runtime/codecs").OneOfCodec<"1" | "0" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6.5" | "7.5" | "8.5" | "9.5" | "10.5" | "11.5">;
10
+ margin: import("../../runtime/codecs").OneOfCodec<"1" | "0" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6.5" | "7.5" | "8.5" | "9.5" | "10.5" | "11.5">;
11
+ marginX: import("../../runtime/codecs").OneOfCodec<"1" | "0" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6.5" | "7.5" | "8.5" | "9.5" | "10.5" | "11.5">;
12
+ marginY: import("../../runtime/codecs").OneOfCodec<"1" | "0" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6.5" | "7.5" | "8.5" | "9.5" | "10.5" | "11.5">;
13
+ surface: import("../../runtime/codecs").OneOfCodec<"1" | "0" | "2" | "inherit" | "3" | "4" | "5" | "6" | "7" | "8" | "+1" | "+2" | "+3" | "+4" | "+5" | "+6" | "+7" | "+8">;
15
14
  radius: import("../../runtime/codecs").OneOfCodec<"none" | "xs" | "sm" | "md" | "lg" | "full">;
16
- elevation: import("../../runtime/codecs").OneOfCodec<"1" | "none" | "2" | "3" | "4" | "5" | "6">;
15
+ elevation: import("../../runtime/codecs").OneOfCodec<"1" | "match" | "2" | "none" | "3" | "4" | "5" | "6" | "7" | "8">;
17
16
  width: import("../../runtime/codecs").OneOfCodec<"xs" | "sm" | "md" | "lg" | "full" | "auto" | "xl" | "prose">;
18
17
  height: import("../../runtime/codecs").OneOfCodec<"xs" | "sm" | "md" | "lg" | "full" | "auto" | "xl">;
19
18
  class: import("../../runtime/codecs").StringCodec;
20
- align: import("../../runtime/codecs").OneOfCodec<"end" | "center" | "start" | "stretch" | "baseline">;
21
- justify: import("../../runtime/codecs").OneOfCodec<"end" | "center" | "start" | "between">;
22
- gap: import("../../runtime/codecs").OneOfCodec<"0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9">;
23
- gapX: import("../../runtime/codecs").OneOfCodec<"0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9">;
24
- gapY: import("../../runtime/codecs").OneOfCodec<"0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9">;
19
+ align: import("../../runtime/codecs").OneOfCodec<"start" | "center" | "end" | "stretch" | "baseline">;
20
+ justify: import("../../runtime/codecs").OneOfCodec<"start" | "center" | "end" | "between">;
21
+ gap: import("../../runtime/codecs").OneOfCodec<"1" | "0" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6.5" | "7.5" | "8.5" | "9.5" | "10.5" | "11.5">;
22
+ gapX: import("../../runtime/codecs").OneOfCodec<"1" | "0" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6.5" | "7.5" | "8.5" | "9.5" | "10.5" | "11.5">;
23
+ gapY: import("../../runtime/codecs").OneOfCodec<"1" | "0" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "0.5" | "1.5" | "2.5" | "3.5" | "4.5" | "5.5" | "6.5" | "7.5" | "8.5" | "9.5" | "10.5" | "11.5">;
25
24
  as: import("../../runtime/codecs").OneOfCodec<"article" | "aside" | "div" | "footer" | "form" | "header" | "li" | "main" | "nav" | "ol" | "section" | "span" | "ul">;
26
- display: import("../../runtime/codecs").OneOfCodec<"flex" | "none" | "inline-flex">;
25
+ display: import("../../runtime/codecs").OneOfCodec<"none" | "flex" | "inline-flex">;
27
26
  direction: import("../../runtime/codecs").OneOfCodec<"row" | "column" | "row-reverse" | "column-reverse">;
28
27
  wrap: import("../../runtime/codecs").OneOfCodec<"nowrap" | "wrap" | "wrap-reverse">;
29
28
  };
30
29
  type FlexDisplay = typeof FLEX_DISPLAYS[number];
31
30
  type FlexDirection = typeof FLEX_DIRECTIONS[number];
32
31
  type FlexWrap = typeof FLEX_WRAPS[number];
33
- type FlexProps = PropState<typeof flexSchema>;
32
+ type FlexProps = SchemaToProps<typeof flexSchema>;
34
33
  export { FLEX_DIRECTIONS, FLEX_DISPLAYS, FLEX_WRAPS, flexSchema, };
35
34
  export type { FlexDirection, FlexDisplay, FlexProps, FlexWrap, LayoutAlign as FlexAlign, LayoutAs as FlexAs, LayoutJustify as FlexJustify, LayoutSpace as FlexSpace, };