@foldkit/ui 0.150.0 → 0.151.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/animation/update.d.ts +10 -9
  2. package/dist/animation/update.d.ts.map +1 -1
  3. package/dist/animation/update.js +27 -35
  4. package/dist/calendar/index.d.ts +100 -11
  5. package/dist/calendar/index.d.ts.map +1 -1
  6. package/dist/calendar/index.js +66 -80
  7. package/dist/checkbox/index.d.ts +3 -4
  8. package/dist/checkbox/index.d.ts.map +1 -1
  9. package/dist/checkbox/index.js +3 -4
  10. package/dist/combobox/multi.d.ts +40 -51
  11. package/dist/combobox/multi.d.ts.map +1 -1
  12. package/dist/combobox/multi.js +19 -16
  13. package/dist/combobox/shared.d.ts +20 -20
  14. package/dist/combobox/shared.d.ts.map +1 -1
  15. package/dist/combobox/shared.js +134 -128
  16. package/dist/combobox/single.d.ts +38 -51
  17. package/dist/combobox/single.d.ts.map +1 -1
  18. package/dist/combobox/single.js +21 -17
  19. package/dist/datePicker/index.d.ts +182 -15
  20. package/dist/datePicker/index.d.ts.map +1 -1
  21. package/dist/datePicker/index.js +37 -54
  22. package/dist/dialog/index.d.ts +45 -7
  23. package/dist/dialog/index.d.ts.map +1 -1
  24. package/dist/dialog/index.js +54 -49
  25. package/dist/disclosure/index.d.ts +3 -4
  26. package/dist/disclosure/index.d.ts.map +1 -1
  27. package/dist/disclosure/index.js +3 -4
  28. package/dist/dragAndDrop/index.d.ts +96 -7
  29. package/dist/dragAndDrop/index.d.ts.map +1 -1
  30. package/dist/dragAndDrop/index.js +49 -61
  31. package/dist/fileDrop/index.d.ts +26 -11
  32. package/dist/fileDrop/index.d.ts.map +1 -1
  33. package/dist/fileDrop/index.js +16 -23
  34. package/dist/listbox/multi.d.ts +39 -52
  35. package/dist/listbox/multi.d.ts.map +1 -1
  36. package/dist/listbox/multi.js +9 -7
  37. package/dist/listbox/shared.d.ts +14 -22
  38. package/dist/listbox/shared.d.ts.map +1 -1
  39. package/dist/listbox/shared.js +113 -114
  40. package/dist/listbox/single.d.ts +40 -55
  41. package/dist/listbox/single.d.ts.map +1 -1
  42. package/dist/listbox/single.js +8 -7
  43. package/dist/menu/index.d.ts +131 -37
  44. package/dist/menu/index.d.ts.map +1 -1
  45. package/dist/menu/index.js +111 -120
  46. package/dist/popover/index.d.ts +71 -10
  47. package/dist/popover/index.d.ts.map +1 -1
  48. package/dist/popover/index.js +80 -73
  49. package/dist/radioGroup/index.d.ts +31 -19
  50. package/dist/radioGroup/index.d.ts.map +1 -1
  51. package/dist/radioGroup/index.js +18 -18
  52. package/dist/slider/index.d.ts +44 -13
  53. package/dist/slider/index.d.ts.map +1 -1
  54. package/dist/slider/index.js +33 -38
  55. package/dist/switch/index.d.ts +3 -4
  56. package/dist/switch/index.d.ts.map +1 -1
  57. package/dist/switch/index.js +3 -4
  58. package/dist/tabs/index.d.ts +31 -17
  59. package/dist/tabs/index.d.ts.map +1 -1
  60. package/dist/tabs/index.js +17 -17
  61. package/dist/test/apps/disabledButton.d.ts +17 -17
  62. package/dist/test/apps/disabledButton.d.ts.map +1 -1
  63. package/dist/test/apps/disabledButton.js +6 -4
  64. package/dist/toast/index.d.ts +96 -100
  65. package/dist/toast/index.d.ts.map +1 -1
  66. package/dist/toast/update.d.ts +97 -100
  67. package/dist/toast/update.d.ts.map +1 -1
  68. package/dist/toast/update.js +60 -58
  69. package/dist/tooltip/index.d.ts +2 -1
  70. package/dist/tooltip/index.d.ts.map +1 -1
  71. package/dist/tooltip/index.js +1 -1
  72. package/dist/tooltip/tooltip.d.ts +5 -10
  73. package/dist/tooltip/tooltip.d.ts.map +1 -1
  74. package/dist/tooltip/tooltip.js +45 -48
  75. package/dist/virtualList/index.d.ts +30 -29
  76. package/dist/virtualList/index.d.ts.map +1 -1
  77. package/dist/virtualList/index.js +21 -21
  78. package/package.json +3 -3
@@ -94,55 +94,50 @@ export const fractionOfValue = (value, min, max) => {
94
94
  const PAGE_STEP_MULTIPLIER = 10;
95
95
  const nextValueForDirection = (value, min, max, step, direction) => __foldkitBrandViewResult((M.value(direction).pipe(M.withReturnType(), M.when('StepIncrement', () => __foldkitBrandViewResult((snapAndClamp(value + step, min, max, step)), "@foldkit/ui/slider/index.js#anonymous")), M.when('StepDecrement', () => __foldkitBrandViewResult((snapAndClamp(value - step, min, max, step)), "@foldkit/ui/slider/index.js#anonymous~2")), M.when('PageIncrement', () => __foldkitBrandViewResult((snapAndClamp(value + step * PAGE_STEP_MULTIPLIER, min, max, step)), "@foldkit/ui/slider/index.js#anonymous~3")), M.when('PageDecrement', () => __foldkitBrandViewResult((snapAndClamp(value - step * PAGE_STEP_MULTIPLIER, min, max, step)), "@foldkit/ui/slider/index.js#anonymous~4")), M.when('Min', () => __foldkitBrandViewResult((min), "@foldkit/ui/slider/index.js#anonymous~5")), M.when('Max', () => __foldkitBrandViewResult((max), "@foldkit/ui/slider/index.js#anonymous~6")), M.exhaustive)), "@foldkit/ui/slider/index.js#nextValueForDirection");
96
96
  const withUpdateReturn = M.withReturnType();
97
- const changedValueOption = (currentValue, nextValue) => __foldkitBrandViewResult((nextValue === currentValue
98
- ? Option.none()
99
- : Option.some(OutMessage.ChangedValue({ value: nextValue }))), "@foldkit/ui/slider/index.js#changedValueOption");
100
- /** Processes a slider message and returns the next model, commands, and an
101
- * optional out-message for the parent. The value lives in the parent Model:
102
- * the view supplies the current value on the messages that need it, and value
103
- * changes surface as `ChangedValue` rather than mutating this Model. */
97
+ const withChangedValue = (model, currentValue, nextValue) => {
98
+ if (nextValue === currentValue) {
99
+ return __foldkitBrandViewResult(({ model }), "@foldkit/ui/slider/index.js#withChangedValue");
100
+ }
101
+ else {
102
+ return __foldkitBrandViewResult(({
103
+ model,
104
+ outMessage: OutMessage.ChangedValue({ value: nextValue }),
105
+ }), "@foldkit/ui/slider/index.js#withChangedValue");
106
+ }
107
+ };
108
+ /** Processes a Slider Message and returns the next Model, optional Commands,
109
+ * and an optional OutMessage for the parent. The value lives in the parent
110
+ * Model: the view supplies the current value on the Messages that need it,
111
+ * and value changes surface as `ChangedValue` rather than mutating this
112
+ * Model. */
104
113
  export const update = (model, message) => __foldkitBrandViewResult((Message.match(message, {
105
- PressedThumb: ({ originValue }) => __foldkitBrandViewResult((M.value(model.dragState).pipe(withUpdateReturn, M.tag('Dragging', () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/slider/index.js#anonymous~7")), M.orElse(() => __foldkitBrandViewResult(([
106
- evo(model, { dragState: () => __foldkitBrandViewResult((Dragging({ originValue })), "@foldkit/ui/slider/index.js#dragState") }),
107
- [],
108
- Option.none(),
109
- ]), "@foldkit/ui/slider/index.js#anonymous~8")))), "@foldkit/ui/slider/index.js#PressedThumb"),
114
+ PressedThumb: ({ originValue }) => __foldkitBrandViewResult((M.value(model.dragState).pipe(withUpdateReturn, M.tag('Dragging', () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/slider/index.js#anonymous~7"))), M.orElse(() => (__foldkitBrandViewResult(({
115
+ model: evo(model, { dragState: () => __foldkitBrandViewResult((Dragging({ originValue })), "@foldkit/ui/slider/index.js#dragState") }),
116
+ }), "@foldkit/ui/slider/index.js#anonymous~8"))))), "@foldkit/ui/slider/index.js#PressedThumb"),
110
117
  // NOTE: the pointerdown event on the thumb bubbles to the track, so a
111
118
  // thumb press also dispatches PressedPointer. Short-circuit when already
112
119
  // Dragging so the bubbled track handler cannot shift the value away
113
120
  // from the thumb's current position. Fine-grained sliders (e.g. step
114
121
  // 0.05) see a visible jump without this guard, because the cursor sits
115
122
  // off-center on a non-zero-width thumb.
116
- PressedPointer: ({ value, originValue }) => __foldkitBrandViewResult((M.value(model.dragState).pipe(withUpdateReturn, M.tag('Dragging', () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/slider/index.js#anonymous~9")), M.orElse(() => {
123
+ PressedPointer: ({ value, originValue }) => __foldkitBrandViewResult((M.value(model.dragState).pipe(withUpdateReturn, M.tag('Dragging', () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/slider/index.js#anonymous~9"))), M.orElse(() => {
117
124
  const snapped = snapAndClamp(value, model.min, model.max, model.step);
118
- return __foldkitBrandViewResult(([
119
- evo(model, { dragState: () => __foldkitBrandViewResult((Dragging({ originValue })), "@foldkit/ui/slider/index.js#dragState~2") }),
120
- [],
121
- changedValueOption(originValue, snapped),
122
- ]), "@foldkit/ui/slider/index.js#anonymous~10");
125
+ return __foldkitBrandViewResult((withChangedValue(evo(model, { dragState: () => __foldkitBrandViewResult((Dragging({ originValue })), "@foldkit/ui/slider/index.js#dragState~2") }), originValue, snapped)), "@foldkit/ui/slider/index.js#anonymous~10");
123
126
  }))), "@foldkit/ui/slider/index.js#PressedPointer"),
124
- MovedDragPointer: ({ value }) => __foldkitBrandViewResult((M.value(model.dragState).pipe(withUpdateReturn, M.tag('Dragging', () => __foldkitBrandViewResult(([
127
+ MovedDragPointer: ({ value }) => __foldkitBrandViewResult((M.value(model.dragState).pipe(withUpdateReturn, M.tag('Dragging', () => (__foldkitBrandViewResult(({
125
128
  model,
126
- [],
127
- Option.some(OutMessage.ChangedValue({
129
+ outMessage: OutMessage.ChangedValue({
128
130
  value: snapAndClamp(value, model.min, model.max, model.step),
129
- })),
130
- ]), "@foldkit/ui/slider/index.js#anonymous~11")), M.orElse(() => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/slider/index.js#anonymous~12")))), "@foldkit/ui/slider/index.js#MovedDragPointer"),
131
- ReleasedDragPointer: () => __foldkitBrandViewResult((M.value(model.dragState).pipe(withUpdateReturn, M.tag('Dragging', () => __foldkitBrandViewResult(([
132
- evo(model, { dragState: () => __foldkitBrandViewResult((Idle()), "@foldkit/ui/slider/index.js#dragState~3") }),
133
- [],
134
- Option.none(),
135
- ]), "@foldkit/ui/slider/index.js#anonymous~13")), M.orElse(() => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/slider/index.js#anonymous~14")))), "@foldkit/ui/slider/index.js#ReleasedDragPointer"),
136
- CancelledDrag: () => __foldkitBrandViewResult((M.value(model.dragState).pipe(withUpdateReturn, M.tag('Dragging', ({ originValue }) => __foldkitBrandViewResult(([
137
- evo(model, { dragState: () => __foldkitBrandViewResult((Idle()), "@foldkit/ui/slider/index.js#dragState~4") }),
138
- [],
139
- Option.some(OutMessage.ChangedValue({ value: originValue })),
140
- ]), "@foldkit/ui/slider/index.js#anonymous~15")), M.orElse(() => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/slider/index.js#anonymous~16")))), "@foldkit/ui/slider/index.js#CancelledDrag"),
141
- PressedKeyboardNavigation: ({ direction, value }) => __foldkitBrandViewResult(([
142
- model,
143
- [],
144
- changedValueOption(value, nextValueForDirection(value, model.min, model.max, model.step, direction)),
145
- ]), "@foldkit/ui/slider/index.js#PressedKeyboardNavigation"),
131
+ }),
132
+ }), "@foldkit/ui/slider/index.js#anonymous~11"))), M.orElse(() => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/slider/index.js#anonymous~12"))))), "@foldkit/ui/slider/index.js#MovedDragPointer"),
133
+ ReleasedDragPointer: () => __foldkitBrandViewResult((M.value(model.dragState).pipe(withUpdateReturn, M.tag('Dragging', () => (__foldkitBrandViewResult(({
134
+ model: evo(model, { dragState: () => __foldkitBrandViewResult((Idle()), "@foldkit/ui/slider/index.js#dragState~3") }),
135
+ }), "@foldkit/ui/slider/index.js#anonymous~13"))), M.orElse(() => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/slider/index.js#anonymous~14"))))), "@foldkit/ui/slider/index.js#ReleasedDragPointer"),
136
+ CancelledDrag: () => __foldkitBrandViewResult((M.value(model.dragState).pipe(withUpdateReturn, M.tag('Dragging', ({ originValue }) => (__foldkitBrandViewResult(({
137
+ model: evo(model, { dragState: () => __foldkitBrandViewResult((Idle()), "@foldkit/ui/slider/index.js#dragState~4") }),
138
+ outMessage: OutMessage.ChangedValue({ value: originValue }),
139
+ }), "@foldkit/ui/slider/index.js#anonymous~15"))), M.orElse(() => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/slider/index.js#anonymous~16"))))), "@foldkit/ui/slider/index.js#CancelledDrag"),
140
+ PressedKeyboardNavigation: ({ direction, value }) => __foldkitBrandViewResult((withChangedValue(model, value, nextValueForDirection(value, model.min, model.max, model.step, direction))), "@foldkit/ui/slider/index.js#PressedKeyboardNavigation"),
146
141
  })), "@foldkit/ui/slider/index.js#update");
147
142
  /** Reflects an externally-driven range onto the slider. Use this when min/max
148
143
  * derive from external state (e.g. a bounded buffer whose first/last index
@@ -65,10 +65,9 @@ export declare const descriptionId: (id: string) => string;
65
65
  * )
66
66
  *
67
67
  * // In update:
68
- * ToggledNotifications: ({ isChecked }) => [
69
- * evo(model, { notificationsEnabled: () => isChecked }),
70
- * [],
71
- * ],
68
+ * ToggledNotifications: ({ isChecked }) => ({
69
+ * model: evo(model, { notificationsEnabled: () => isChecked }),
70
+ * }),
72
71
  * ``` */
73
72
  export declare const view: <Message>(config: ViewConfig<Message>, h: HtmlBuilder<Message>) => Html;
74
73
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/switch/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAIhE;;;;;;;;;;sEAUsE;AACtE,MAAM,MAAM,gBAAgB,CAAC,OAAO,IAAI,QAAQ,CAAC;IAC/C,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACzC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACxC,WAAW,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IAC9C,WAAW,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC/C,CAAC,CAAA;AAEF;;;;;;;;;;;;;;;;;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C,CAAC,CAAA;CAC/C,CAAC,CAAA;AAEF;;;;;;;;;;;;;;;;;yEAiByE;AACzE,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,OAAO,CAAA;IACzC,MAAM,EAAE,CAAC,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAA;IACvD,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAC,CAAA;AAEF,uEAAuE;AACvE,eAAO,MAAM,OAAO,GAAI,IAAI,MAAM,KAAG,MAAuB,CAAA;AAE5D,6EAA6E;AAC7E,eAAO,MAAM,aAAa,GAAI,IAAI,MAAM,KAAG,MAA6B,CAAA;AAExE;;;;;;;;;;;;;;;;;;;;UAoBU;AACV,eAAO,MAAM,IAAI,GAAI,OAAO,EAC1B,QAAQ,UAAU,CAAC,OAAO,CAAC,EAC3B,GAAG,WAAW,CAAC,OAAO,CAAC,KACtB,IAgEF,CAAA"}
@@ -21,10 +21,9 @@ export const descriptionId = (id) => __foldkitBrandViewResult((`${id}-descriptio
21
21
  * )
22
22
  *
23
23
  * // In update:
24
- * ToggledNotifications: ({ isChecked }) => [
25
- * evo(model, { notificationsEnabled: () => isChecked }),
26
- * [],
27
- * ],
24
+ * ToggledNotifications: ({ isChecked }) => ({
25
+ * model: evo(model, { notificationsEnabled: () => isChecked }),
26
+ * }),
28
27
  * ``` */
29
28
  export const view = (config, h) => {
30
29
  const { id, isChecked, onToggle, toView, isDisabled = false, isReadOnly = false, name, value: formValue = 'on', } = config;
@@ -1,4 +1,5 @@
1
1
  import { Effect, Option, Schema as S } from 'effect';
2
+ import { type Update } from 'foldkit';
2
3
  import * as Command from 'foldkit/command';
3
4
  import { type ChildAttribute, type Html } from 'foldkit/html';
4
5
  import { type View as SubmodelView } from 'foldkit/submodel';
@@ -39,7 +40,8 @@ export type Selected<Value extends string = string> = Readonly<{
39
40
  readonly value: Value;
40
41
  readonly index: number;
41
42
  }>;
42
- /** Union of out-messages the tabs component can produce. Surfaced as the third element of `update`'s return tuple and pattern-matched by the parent. */
43
+ /** Union of OutMessages the tabs component can produce. The parent's
44
+ * `Update.foldChild` config handles them through `foldOutMessage`. */
43
45
  export declare const OutMessage: import("foldkit/message").MessageUnion<{
44
46
  readonly Selected: {
45
47
  readonly value: S.String;
@@ -66,16 +68,32 @@ export declare const FocusTab: Command.CommandDefinitionWithArgs<"FocusTab", {
66
68
  }, Effect.Effect<{
67
69
  readonly _tag: "CompletedFocusTab";
68
70
  }, never, never>>;
69
- type UpdateReturn = readonly [
70
- Model,
71
- ReadonlyArray<Command.Command<Message>>,
72
- Option.Option<OutMessage>
73
- ];
74
- /** Processes a tabs message and returns the next model, commands, and an
75
- * optional OutMessage. `Selected` fires when a tab is committed via click or
76
- * keyboard; the parent stores the new value and passes it back in as
71
+ /** Processes a Tabs Message and returns the next Model, optional Commands, and
72
+ * an optional OutMessage. `Selected` fires when a tab is committed via click
73
+ * or keyboard; the parent stores the new value and passes it back in as
77
74
  * `selectedValue`. */
78
- export declare const update: (model: Model, message: Message) => UpdateReturn;
75
+ export declare const update: (model: Model, message: Message) => Readonly<{
76
+ model: {
77
+ readonly id: string;
78
+ readonly maybeFocusedIndex: Option.Option<number>;
79
+ readonly activationMode: "Automatic" | "Manual";
80
+ };
81
+ commands?: Update.Commands<{
82
+ readonly _tag: "SelectedTab";
83
+ readonly index: number;
84
+ readonly value: string;
85
+ } | {
86
+ readonly _tag: "FocusedTab";
87
+ readonly index: number;
88
+ } | {
89
+ readonly _tag: "CompletedFocusTab";
90
+ }, never>;
91
+ outMessage?: Readonly<{
92
+ readonly _tag: "Selected";
93
+ readonly value: string;
94
+ readonly index: number;
95
+ }>;
96
+ }>;
79
97
  /** Per-tab render info passed to the consumer's `toView`. Generic over
80
98
  * `Value extends string`: when `Tabs.create<MyUnion>()` is declared,
81
99
  * `tab.value` is typed `MyUnion` so the consumer can switch on it without
@@ -126,11 +144,7 @@ export type ViewInputs<Value extends string = string> = Readonly<{
126
144
  * the bundle rather than calling `create` itself. */
127
145
  export type Bundle<Value extends string = string> = Readonly<{
128
146
  view: SubmodelView<Model, Message, ViewInputs<Value>>;
129
- update: (model: Model, message: Message) => readonly [
130
- Model,
131
- ReadonlyArray<Command.Command<Message>>,
132
- Option.Option<OutMessage<Value>>
133
- ];
147
+ update: (model: Model, message: Message) => Update.ReturnWithOutMessage<Model, Message, OutMessage<Value>>;
134
148
  }>;
135
149
  /** Pairs the tabs `view` and `update` behind a single Value-typed entry
136
150
  * point. Declare once at module scope so consumers receive
@@ -143,8 +157,8 @@ export type Bundle<Value extends string = string> = Readonly<{
143
157
  * // In view (selectedValue is the parent-owned active tab):
144
158
  * h.submodel({ view: DemoTabs.view, viewInputs: { selectedValue, ... }, ... })
145
159
  *
146
- * // In update, fold the Selected OutMessage into your Model:
147
- * const [next, commands, maybeOutMessage] = DemoTabs.update(model, message)
160
+ * // In the parent update, pass DemoTabs.update to Update.foldChild and
161
+ * // fold the Selected OutMessage into your Model.
148
162
  * ```
149
163
  *
150
164
  * The internal view stays typed `ReadonlyArray<string>`; consumers can
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tabs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAEN,MAAM,EACN,MAAM,IAAI,CAAC,EAGZ,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAE1C,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,IAAI,EAAmB,MAAM,cAAc,CAAA;AAG9E,OAAO,EAAE,KAAK,IAAI,IAAI,YAAY,EAAc,MAAM,kBAAkB,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AE,MAAM,KAAK,OAAO,CAAA;IACxD,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B,CAAC,CAAA;AA+JF;;;sDAGsD;AACtD,MAAM,MAAM,MAAM,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,IAAI,QAAQ,CAAC;IAC3D,IAAI,EAAE,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAA;IACrD,MAAM,EAAE,CACN,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,KACb,MAAM,CAAC,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAA;CACpE,CAAC,CAAA;AAEF;;;;;;;;;;;;;;;;;mDAiBmD;AACnD,eAAO,MAAM,MAAM,GAAI,KAAK,SAAS,MAAM,GAAG,MAAM,OAAK,MAAM,CAAC,KAAK,CAmBpE,CAAA"}
@@ -34,7 +34,8 @@ export const Message = defineMessageUnion({
34
34
  FocusedTab: { index: S.Number },
35
35
  CompletedFocusTab: {},
36
36
  });
37
- /** Union of out-messages the tabs component can produce. Surfaced as the third element of `update`'s return tuple and pattern-matched by the parent. */
37
+ /** Union of OutMessages the tabs component can produce. The parent's
38
+ * `Update.foldChild` config handles them through `foldOutMessage`. */
38
39
  export const OutMessage = defineMessageUnion({
39
40
  Selected: {
40
41
  value: S.String,
@@ -58,22 +59,21 @@ export const FocusTab = Command.define('FocusTab', {
58
59
  messages: [Message.CompletedFocusTab],
59
60
  execute: ({ id, index }) => __foldkitBrandViewResult((Dom.focus(idSelector(tabId(id, index))).pipe(Effect.ignore, Effect.as(Message.CompletedFocusTab()))), "@foldkit/ui/tabs/index.js#execute"),
60
61
  });
61
- /** Processes a tabs message and returns the next model, commands, and an
62
- * optional OutMessage. `Selected` fires when a tab is committed via click or
63
- * keyboard; the parent stores the new value and passes it back in as
62
+ /** Processes a Tabs Message and returns the next Model, optional Commands, and
63
+ * an optional OutMessage. `Selected` fires when a tab is committed via click
64
+ * or keyboard; the parent stores the new value and passes it back in as
64
65
  * `selectedValue`. */
65
66
  export const update = (model, message) => __foldkitBrandViewResult((Message.match(message, {
66
- SelectedTab: ({ index, value }) => __foldkitBrandViewResult(([
67
- evo(model, { maybeFocusedIndex: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/tabs/index.js#maybeFocusedIndex") }),
68
- [FocusTab({ id: model.id, index })],
69
- Option.some(OutMessage.Selected({ value, index })),
70
- ]), "@foldkit/ui/tabs/index.js#SelectedTab"),
71
- FocusedTab: ({ index }) => __foldkitBrandViewResult(([
72
- evo(model, { maybeFocusedIndex: () => __foldkitBrandViewResult((Option.some(index)), "@foldkit/ui/tabs/index.js#maybeFocusedIndex~2") }),
73
- [FocusTab({ id: model.id, index })],
74
- Option.none(),
75
- ]), "@foldkit/ui/tabs/index.js#FocusedTab"),
76
- CompletedFocusTab: () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/tabs/index.js#CompletedFocusTab"),
67
+ SelectedTab: ({ index, value }) => (__foldkitBrandViewResult(({
68
+ model: evo(model, { maybeFocusedIndex: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/tabs/index.js#maybeFocusedIndex") }),
69
+ commands: [FocusTab({ id: model.id, index })],
70
+ outMessage: OutMessage.Selected({ value, index }),
71
+ }), "@foldkit/ui/tabs/index.js#SelectedTab")),
72
+ FocusedTab: ({ index }) => (__foldkitBrandViewResult(({
73
+ model: evo(model, { maybeFocusedIndex: () => __foldkitBrandViewResult((Option.some(index)), "@foldkit/ui/tabs/index.js#maybeFocusedIndex~2") }),
74
+ commands: [FocusTab({ id: model.id, index })],
75
+ }), "@foldkit/ui/tabs/index.js#FocusedTab")),
76
+ CompletedFocusTab: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/tabs/index.js#CompletedFocusTab")),
77
77
  })), "@foldkit/ui/tabs/index.js#update");
78
78
  const internalView = defineView((model, viewInputs, h) => {
79
79
  const { id, activationMode, maybeFocusedIndex } = model;
@@ -154,8 +154,8 @@ const internalView = defineView((model, viewInputs, h) => {
154
154
  * // In view (selectedValue is the parent-owned active tab):
155
155
  * h.submodel({ view: DemoTabs.view, viewInputs: { selectedValue, ... }, ... })
156
156
  *
157
- * // In update, fold the Selected OutMessage into your Model:
158
- * const [next, commands, maybeOutMessage] = DemoTabs.update(model, message)
157
+ * // In the parent update, pass DemoTabs.update to Update.foldChild and
158
+ * // fold the Selected OutMessage into your Model.
159
159
  * ```
160
160
  *
161
161
  * The internal view stays typed `ReadonlyArray<string>`; consumers can
@@ -1,5 +1,6 @@
1
1
  import { Option, Schema as S } from 'effect';
2
2
  import type { Html, HtmlBuilder } from 'foldkit/html';
3
+ import * as Update from 'foldkit/update';
3
4
  export declare const Model: S.Struct<{
4
5
  readonly isEnabled: S.Boolean;
5
6
  readonly dialog: S.Struct<{
@@ -39,24 +40,22 @@ export declare const Message: import("foldkit/message").MessageUnion<{
39
40
  }>;
40
41
  export type Message = typeof Message.Type;
41
42
  export declare const initialModel: Model;
42
- export declare const update: (model: Model, message: Message) => readonly [{
43
- readonly isEnabled: boolean;
44
- readonly dialog: {
45
- readonly id: string;
46
- readonly isOpen: boolean;
47
- readonly isAnimated: boolean;
48
- readonly animation: {
43
+ export declare const update: (model: Model, message: Message) => Readonly<{
44
+ model: {
45
+ readonly isEnabled: boolean;
46
+ readonly dialog: {
49
47
  readonly id: string;
50
- readonly isShowing: boolean;
51
- readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
48
+ readonly isOpen: boolean;
49
+ readonly isAnimated: boolean;
50
+ readonly animation: {
51
+ readonly id: string;
52
+ readonly isShowing: boolean;
53
+ readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
54
+ };
55
+ readonly maybeFocusSelector: Option.Option<string>;
52
56
  };
53
- readonly maybeFocusSelector: Option.Option<string>;
54
57
  };
55
- }, readonly Readonly<{
56
- name: string;
57
- args?: Record<string, unknown>;
58
- key?: string;
59
- effect: import("effect/Effect").Effect<{
58
+ commands?: Update.Commands<{
60
59
  readonly _tag: "ClickedToggle";
61
60
  } | {
62
61
  readonly _tag: "ClickedSubmit";
@@ -86,8 +85,9 @@ export declare const update: (model: Model, message: Message) => readonly [{
86
85
  readonly _tag: "EndedAnimation";
87
86
  };
88
87
  };
89
- }, never, never>;
90
- }>[]];
88
+ }, never>;
89
+ outMessage?: never;
90
+ }>;
91
91
  /** Plain view, no dialog wrapper. */
92
92
  export declare const view: (model: Model, h: HtmlBuilder<Message>) => Html;
93
93
  /** View with submit button inside a dialog's panel. */
@@ -1 +1 @@
1
- {"version":3,"file":"disabledButton.d.ts","sourceRoot":"","sources":["../../../src/test/apps/disabledButton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAExD,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AASrD,eAAO,MAAM,KAAK;;;;;;;;;;;;;EAGhB,CAAA;AACF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;EAIlB,CAAA;AACF,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAIzC,eAAO,MAAM,YAAY,EAAE,KAG1B,CAAA;AAoBD,eAAO,MAAM,MAAM,GAAI,OAAO,KAAK,EAAE,SAAS,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KASlD,CAAA;AAeH,qCAAqC;AACrC,eAAO,MAAM,IAAI,GAAI,OAAO,KAAK,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,KAAG,IAQ5D,CAAA;AAED,uDAAuD;AACvD,eAAO,MAAM,cAAc,GAAI,OAAO,KAAK,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,KAAG,IAyBtE,CAAA"}
1
+ {"version":3,"file":"disabledButton.d.ts","sourceRoot":"","sources":["../../../src/test/apps/disabledButton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AACxD,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAGrD,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAA;AAMxC,eAAO,MAAM,KAAK;;;;;;;;;;;;;EAGhB,CAAA;AACF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;EAIlB,CAAA;AACF,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAIzC,eAAO,MAAM,YAAY,EAAE,KAG1B,CAAA;AAoBD,eAAO,MAAM,MAAM,GAAI,OAAO,KAAK,EAAE,SAAS,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQjD,CAAA;AAeJ,qCAAqC;AACrC,eAAO,MAAM,IAAI,GAAI,OAAO,KAAK,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,KAAG,IAQ5D,CAAA;AAED,uDAAuD;AACvD,eAAO,MAAM,cAAc,GAAI,OAAO,KAAK,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,KAAG,IAyBtE,CAAA"}
@@ -22,8 +22,8 @@ export const initialModel = {
22
22
  };
23
23
  // UPDATE
24
24
  const foldDialogOutMessage = M.type().pipe(M.withReturnType(), M.tagsExhaustive({
25
- Opened: () => __foldkitBrandViewResult((model => __foldkitBrandViewResult(([model, []]), "@foldkit/ui/test/apps/disabledButton.js#anonymous")), "@foldkit/ui/test/apps/disabledButton.js#Opened"),
26
- Closed: () => __foldkitBrandViewResult((model => __foldkitBrandViewResult(([model, []]), "@foldkit/ui/test/apps/disabledButton.js#anonymous~2")), "@foldkit/ui/test/apps/disabledButton.js#Closed"),
25
+ Opened: () => __foldkitBrandViewResult((model => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/test/apps/disabledButton.js#anonymous"))), "@foldkit/ui/test/apps/disabledButton.js#Opened"),
26
+ Closed: () => __foldkitBrandViewResult((model => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/test/apps/disabledButton.js#anonymous~2"))), "@foldkit/ui/test/apps/disabledButton.js#Closed"),
27
27
  }));
28
28
  const foldDialog = Update.foldChild({
29
29
  update: Dialog.update,
@@ -33,8 +33,10 @@ const foldDialog = Update.foldChild({
33
33
  foldOutMessage: foldDialogOutMessage,
34
34
  });
35
35
  export const update = (model, message) => __foldkitBrandViewResult((Message.match(message, {
36
- ClickedToggle: () => __foldkitBrandViewResult(([{ ...model, isEnabled: !model.isEnabled }, []]), "@foldkit/ui/test/apps/disabledButton.js#ClickedToggle"),
37
- ClickedSubmit: () => __foldkitBrandViewResult(([model, []]), "@foldkit/ui/test/apps/disabledButton.js#ClickedSubmit"),
36
+ ClickedToggle: () => (__foldkitBrandViewResult(({
37
+ model: evo(model, { isEnabled: isEnabled => __foldkitBrandViewResult((!isEnabled), "@foldkit/ui/test/apps/disabledButton.js#isEnabled") }),
38
+ }), "@foldkit/ui/test/apps/disabledButton.js#ClickedToggle")),
39
+ ClickedSubmit: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/test/apps/disabledButton.js#ClickedSubmit")),
38
40
  GotDialogMessage: ({ message: dialogMessage }) => __foldkitBrandViewResult((foldDialog(model, dialogMessage)), "@foldkit/ui/test/apps/disabledButton.js#GotDialogMessage"),
39
41
  })), "@foldkit/ui/test/apps/disabledButton.js#update");
40
42
  // VIEW