foldkit 0.19.0 → 0.21.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 (61) hide show
  1. package/README.md +3 -3
  2. package/dist/command/index.d.ts +4 -0
  3. package/dist/command/index.d.ts.map +1 -0
  4. package/dist/command/index.js +1 -0
  5. package/dist/command/public.d.ts +2 -0
  6. package/dist/command/public.d.ts.map +1 -0
  7. package/dist/command/public.js +1 -0
  8. package/dist/html/index.d.ts +14 -0
  9. package/dist/html/index.d.ts.map +1 -1
  10. package/dist/html/index.js +5 -1
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/runtime/public.d.ts +2 -2
  14. package/dist/runtime/public.d.ts.map +1 -1
  15. package/dist/runtime/public.js +1 -1
  16. package/dist/runtime/runtime.d.ts +18 -19
  17. package/dist/runtime/runtime.d.ts.map +1 -1
  18. package/dist/runtime/runtime.js +9 -9
  19. package/dist/task/dom.d.ts +26 -27
  20. package/dist/task/dom.d.ts.map +1 -1
  21. package/dist/task/dom.js +36 -37
  22. package/dist/task/elementMovement.d.ts +21 -0
  23. package/dist/task/elementMovement.d.ts.map +1 -0
  24. package/dist/task/elementMovement.js +49 -0
  25. package/dist/task/error.d.ts +18 -0
  26. package/dist/task/error.d.ts.map +1 -0
  27. package/dist/task/error.js +7 -0
  28. package/dist/task/index.d.ts +2 -0
  29. package/dist/task/index.d.ts.map +1 -1
  30. package/dist/task/index.js +2 -0
  31. package/dist/task/inert.d.ts +12 -11
  32. package/dist/task/inert.d.ts.map +1 -1
  33. package/dist/task/inert.js +12 -13
  34. package/dist/task/public.d.ts +1 -1
  35. package/dist/task/public.d.ts.map +1 -1
  36. package/dist/task/public.js +1 -1
  37. package/dist/task/random.d.ts +3 -4
  38. package/dist/task/random.d.ts.map +1 -1
  39. package/dist/task/random.js +3 -4
  40. package/dist/task/scrollLock.d.ts +9 -9
  41. package/dist/task/scrollLock.d.ts.map +1 -1
  42. package/dist/task/scrollLock.js +9 -11
  43. package/dist/task/time.d.ts +17 -16
  44. package/dist/task/time.d.ts.map +1 -1
  45. package/dist/task/time.js +20 -21
  46. package/dist/task/timing.d.ts +14 -15
  47. package/dist/task/timing.d.ts.map +1 -1
  48. package/dist/task/timing.js +16 -20
  49. package/dist/ui/dialog/index.d.ts +1 -1
  50. package/dist/ui/dialog/index.d.ts.map +1 -1
  51. package/dist/ui/dialog/index.js +5 -11
  52. package/dist/ui/disclosure/index.d.ts +1 -1
  53. package/dist/ui/disclosure/index.d.ts.map +1 -1
  54. package/dist/ui/disclosure/index.js +5 -8
  55. package/dist/ui/menu/index.d.ts +7 -3
  56. package/dist/ui/menu/index.d.ts.map +1 -1
  57. package/dist/ui/menu/index.js +45 -43
  58. package/dist/ui/tabs/index.d.ts +4 -5
  59. package/dist/ui/tabs/index.d.ts.map +1 -1
  60. package/dist/ui/tabs/index.js +6 -8
  61. package/package.json +9 -1
@@ -1,4 +1,4 @@
1
- import { Array, Match as M, Option, Schema as S, String, pipe } from 'effect';
1
+ import { Array, Effect, Match as M, Option, Schema as S, String, pipe, } from 'effect';
2
2
  import { html } from '../../html';
3
3
  import { m } from '../../message';
4
4
  import { evo } from '../../struct';
@@ -10,12 +10,11 @@ export { wrapIndex, findFirstEnabledIndex, keyToIndex } from '../keyboard';
10
10
  export const Orientation = S.Literal('Horizontal', 'Vertical');
11
11
  /** Controls whether tabs activate on focus (`Automatic`) or require an explicit selection (`Manual`). */
12
12
  export const ActivationMode = S.Literal('Automatic', 'Manual');
13
- /** Schema for the tabs component's state, tracking active/focused indices, orientation, and activation mode. */
13
+ /** Schema for the tabs component's state, tracking active/focused indices and activation mode. */
14
14
  export const Model = S.Struct({
15
15
  id: S.String,
16
16
  activeIndex: S.Number,
17
17
  focusedIndex: S.Number,
18
- orientation: Orientation,
19
18
  activationMode: ActivationMode,
20
19
  });
21
20
  // MESSAGE
@@ -27,14 +26,13 @@ export const TabFocused = m('TabFocused', { index: S.Number });
27
26
  export const NoOp = m('NoOp');
28
27
  /** Union of all messages the tabs component can produce. */
29
28
  export const Message = S.Union(TabSelected, TabFocused, NoOp);
30
- /** Creates an initial tabs model from a config. Defaults to first tab, horizontal orientation, and automatic activation. */
29
+ /** Creates an initial tabs model from a config. Defaults to first tab and automatic activation. */
31
30
  export const init = (config) => {
32
31
  const activeIndex = config.activeIndex ?? 0;
33
32
  return {
34
33
  id: config.id,
35
34
  activeIndex,
36
35
  focusedIndex: activeIndex,
37
- orientation: config.orientation ?? 'Horizontal',
38
36
  activationMode: config.activationMode ?? 'Automatic',
39
37
  };
40
38
  };
@@ -48,14 +46,14 @@ export const update = (model, message) => M.value(message).pipe(M.withReturnType
48
46
  activeIndex: () => index,
49
47
  focusedIndex: () => index,
50
48
  }),
51
- [Task.focus(tabSelector, () => NoOp())],
49
+ [Task.focus(tabSelector).pipe(Effect.ignore, Effect.as(NoOp()))],
52
50
  ];
53
51
  },
54
52
  TabFocused: ({ index }) => {
55
53
  const tabSelector = `#${tabId(model.id, index)}`;
56
54
  return [
57
55
  evo(model, { focusedIndex: () => index }),
58
- [Task.focus(tabSelector, () => NoOp())],
56
+ [Task.focus(tabSelector).pipe(Effect.ignore, Effect.as(NoOp()))],
59
57
  ];
60
58
  },
61
59
  NoOp: () => [model, []],
@@ -65,7 +63,7 @@ const tabId = (id, index) => `${id}-tab-${index}`;
65
63
  /** Renders a headless tab group with accessible ARIA roles, roving tabindex, and keyboard navigation. */
66
64
  export const view = (config) => {
67
65
  const { div, empty, AriaControls, AriaDisabled, AriaLabelledBy, AriaOrientation, AriaSelected, Class, DataAttribute, Disabled, Hidden, Id, OnClick, OnKeyDownPreventDefault, Role, Tabindex, Type, keyed, } = html();
68
- const { model, model: { id, orientation, activationMode, focusedIndex }, toMessage, tabs, tabToConfig, isTabDisabled, persistPanels, tabListElement = 'div', tabElement = 'button', panelElement = 'div', className, tabListClassName, } = config;
66
+ const { model, model: { id, activationMode, focusedIndex }, toMessage, tabs, tabToConfig, isTabDisabled, persistPanels, orientation = 'Horizontal', tabListElement = 'div', tabElement = 'button', panelElement = 'div', className, tabListClassName, } = config;
69
67
  const isDisabled = (index) => !!isTabDisabled &&
70
68
  pipe(tabs, Array.get(index), Option.exists(tab => isTabDisabled(tab, index)));
71
69
  const { nextKey, previousKey } = M.value(orientation).pipe(M.when('Horizontal', () => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foldkit",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "description": "Elm-inspired UI framework powered by Effect",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -11,6 +11,10 @@
11
11
  "types": "./dist/index.d.ts",
12
12
  "import": "./dist/index.js"
13
13
  },
14
+ "./command": {
15
+ "types": "./dist/command/public.d.ts",
16
+ "import": "./dist/command/public.js"
17
+ },
14
18
  "./html": {
15
19
  "types": "./dist/html/public.d.ts",
16
20
  "import": "./dist/html/public.js"
@@ -43,6 +47,10 @@
43
47
  "types": "./dist/struct/public.d.ts",
44
48
  "import": "./dist/struct/public.js"
45
49
  },
50
+ "./task": {
51
+ "types": "./dist/task/public.d.ts",
52
+ "import": "./dist/task/public.js"
53
+ },
46
54
  "./ui": {
47
55
  "types": "./dist/ui/index.d.ts",
48
56
  "import": "./dist/ui/index.js"