foldkit 0.18.0 → 0.19.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 (69) hide show
  1. package/README.md +11 -11
  2. package/dist/effectExtensions/optionExtensions.d.ts +4 -0
  3. package/dist/effectExtensions/optionExtensions.d.ts.map +1 -1
  4. package/dist/effectExtensions/optionExtensions.js +2 -1
  5. package/dist/fieldValidation/index.d.ts.map +1 -1
  6. package/dist/fieldValidation/index.js +4 -4
  7. package/dist/html/index.d.ts +31 -3
  8. package/dist/html/index.d.ts.map +1 -1
  9. package/dist/html/index.js +49 -7
  10. package/dist/index.d.ts +1 -0
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +1 -0
  13. package/dist/message/index.d.ts +2 -0
  14. package/dist/message/index.d.ts.map +1 -0
  15. package/dist/message/index.js +1 -0
  16. package/dist/message/public.d.ts +2 -0
  17. package/dist/message/public.d.ts.map +1 -0
  18. package/dist/message/public.js +1 -0
  19. package/dist/route/index.d.ts +1 -0
  20. package/dist/route/index.d.ts.map +1 -1
  21. package/dist/route/index.js +1 -0
  22. package/dist/route/parser.js +17 -17
  23. package/dist/route/public.d.ts +1 -1
  24. package/dist/route/public.d.ts.map +1 -1
  25. package/dist/route/public.js +1 -1
  26. package/dist/runtime/runtime.js +8 -8
  27. package/dist/schema/index.d.ts +36 -8
  28. package/dist/schema/index.d.ts.map +1 -1
  29. package/dist/schema/index.js +6 -0
  30. package/dist/task/dom.d.ts +59 -0
  31. package/dist/task/dom.d.ts.map +1 -0
  32. package/dist/task/dom.js +113 -0
  33. package/dist/task/index.d.ts +6 -108
  34. package/dist/task/index.d.ts.map +1 -1
  35. package/dist/task/index.js +6 -168
  36. package/dist/task/inert.d.ts +25 -0
  37. package/dist/task/inert.d.ts.map +1 -0
  38. package/dist/task/inert.js +88 -0
  39. package/dist/task/public.d.ts +1 -1
  40. package/dist/task/public.d.ts.map +1 -1
  41. package/dist/task/public.js +1 -1
  42. package/dist/task/random.d.ts +12 -0
  43. package/dist/task/random.d.ts.map +1 -0
  44. package/dist/task/random.js +11 -0
  45. package/dist/task/scrollLock.d.ts +24 -0
  46. package/dist/task/scrollLock.d.ts.map +1 -0
  47. package/dist/task/scrollLock.js +48 -0
  48. package/dist/task/time.d.ts +42 -0
  49. package/dist/task/time.d.ts.map +1 -0
  50. package/dist/task/time.js +54 -0
  51. package/dist/task/timing.d.ts +36 -0
  52. package/dist/task/timing.d.ts.map +1 -0
  53. package/dist/task/timing.js +55 -0
  54. package/dist/ui/dialog/index.d.ts.map +1 -1
  55. package/dist/ui/dialog/index.js +4 -4
  56. package/dist/ui/disclosure/index.d.ts.map +1 -1
  57. package/dist/ui/disclosure/index.js +4 -4
  58. package/dist/ui/keyboard.d.ts.map +1 -1
  59. package/dist/ui/keyboard.js +1 -1
  60. package/dist/ui/menu/index.d.ts +70 -17
  61. package/dist/ui/menu/index.d.ts.map +1 -1
  62. package/dist/ui/menu/index.js +317 -112
  63. package/dist/ui/menu/public.d.ts +2 -2
  64. package/dist/ui/menu/public.d.ts.map +1 -1
  65. package/dist/ui/menu/public.js +1 -1
  66. package/dist/ui/tabs/index.d.ts.map +1 -1
  67. package/dist/ui/tabs/index.js +6 -6
  68. package/dist/url/index.js +4 -4
  69. package/package.json +5 -1
@@ -1,6 +1,6 @@
1
1
  import { Array, Match as M, Option, Schema as S, String, pipe } from 'effect';
2
2
  import { html } from '../../html';
3
- import { ts } from '../../schema';
3
+ import { m } from '../../message';
4
4
  import { evo } from '../../struct';
5
5
  import * as Task from '../../task';
6
6
  import { keyToIndex } from '../keyboard';
@@ -20,11 +20,11 @@ export const Model = S.Struct({
20
20
  });
21
21
  // MESSAGE
22
22
  /** Sent when a tab is selected via click or keyboard. Updates both the active and focused indices. */
23
- export const TabSelected = ts('TabSelected', { index: S.Number });
23
+ export const TabSelected = m('TabSelected', { index: S.Number });
24
24
  /** Sent when a tab receives keyboard focus in `Manual` mode without being activated. */
25
- export const TabFocused = ts('TabFocused', { index: S.Number });
25
+ export const TabFocused = m('TabFocused', { index: S.Number });
26
26
  /** Placeholder message used when no action is needed, such as after a focus command completes. */
27
- export const NoOp = ts('NoOp');
27
+ export const NoOp = m('NoOp');
28
28
  /** Union of all messages the tabs component can produce. */
29
29
  export const Message = S.Union(TabSelected, TabFocused, NoOp);
30
30
  /** Creates an initial tabs model from a config. Defaults to first tab, horizontal orientation, and automatic activation. */
@@ -67,7 +67,7 @@ export const view = (config) => {
67
67
  const { div, empty, AriaControls, AriaDisabled, AriaLabelledBy, AriaOrientation, AriaSelected, Class, DataAttribute, Disabled, Hidden, Id, OnClick, OnKeyDownPreventDefault, Role, Tabindex, Type, keyed, } = html();
68
68
  const { model, model: { id, orientation, activationMode, focusedIndex }, toMessage, tabs, tabToConfig, isTabDisabled, persistPanels, tabListElement = 'div', tabElement = 'button', panelElement = 'div', className, tabListClassName, } = config;
69
69
  const isDisabled = (index) => !!isTabDisabled &&
70
- pipe(tabs, Array.get(index), Option.exists((tab) => isTabDisabled(tab, index)));
70
+ pipe(tabs, Array.get(index), Option.exists(tab => isTabDisabled(tab, index)));
71
71
  const { nextKey, previousKey } = M.value(orientation).pipe(M.when('Horizontal', () => ({
72
72
  nextKey: 'ArrowRight',
73
73
  previousKey: 'ArrowLeft',
@@ -114,7 +114,7 @@ export const view = (config) => {
114
114
  });
115
115
  const activePanelOnly = pipe(tabs, Array.get(model.activeIndex), Option.match({
116
116
  onNone: () => empty,
117
- onSome: (tab) => {
117
+ onSome: tab => {
118
118
  const activeConfig = tabToConfig(tab, { isActive: true });
119
119
  return keyed(panelElement)(tabPanelId(id, model.activeIndex), [
120
120
  Class(activeConfig.panelClassName),
package/dist/url/index.js CHANGED
@@ -31,7 +31,7 @@ const LocationAndHrefFromString = S.transformOrFail(S.String, LocationAndHref, {
31
31
  },
32
32
  };
33
33
  },
34
- catch: (error) => new ParseResult.Type(ast, urlString, `Invalid URL: ${error}`),
34
+ catch: error => new ParseResult.Type(ast, urlString, `Invalid URL: ${error}`),
35
35
  }),
36
36
  encode: ({ href, location }) => {
37
37
  const portString = location.port ? `:${location.port}` : '';
@@ -52,14 +52,14 @@ const UrlFromLocationAndHref = S.transform(LocationAndHref, Url, {
52
52
  hash: OptionExt.fromString(hashPart || ''),
53
53
  };
54
54
  },
55
- encode: (url) => {
55
+ encode: url => {
56
56
  const search = Option.match(url.search, {
57
57
  onNone: () => '',
58
- onSome: (s) => `?${s}`,
58
+ onSome: s => `?${s}`,
59
59
  });
60
60
  const hash = Option.match(url.hash, {
61
61
  onNone: () => '',
62
- onSome: (h) => `#${h}`,
62
+ onSome: h => `#${h}`,
63
63
  });
64
64
  const href = `${url.pathname}${search}${hash}`;
65
65
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foldkit",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "Elm-inspired UI framework powered by Effect",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -15,6 +15,10 @@
15
15
  "types": "./dist/html/public.d.ts",
16
16
  "import": "./dist/html/public.js"
17
17
  },
18
+ "./message": {
19
+ "types": "./dist/message/public.d.ts",
20
+ "import": "./dist/message/public.js"
21
+ },
18
22
  "./navigation": {
19
23
  "types": "./dist/navigation/public.d.ts",
20
24
  "import": "./dist/navigation/public.js"