basefn 1.0.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 (154) hide show
  1. package/README.md +104 -0
  2. package/package.json +82 -0
  3. package/rescript.json +32 -0
  4. package/src/Basefn.css +14 -0
  5. package/src/Basefn.res +105 -0
  6. package/src/Basefn.res.mjs +114 -0
  7. package/src/Basefn__Dom.res +9 -0
  8. package/src/Basefn__Dom.res.mjs +24 -0
  9. package/src/Basefn__Utils.res +15 -0
  10. package/src/Basefn__Utils.res.mjs +32 -0
  11. package/src/Demo.res +1417 -0
  12. package/src/Demo.res.mjs +2328 -0
  13. package/src/Eita.res.mjs +105 -0
  14. package/src/Eita__Accordion.res.mjs +77 -0
  15. package/src/Eita__Alert.res.mjs +81 -0
  16. package/src/Eita__AppLayout.res.mjs +100 -0
  17. package/src/Eita__Avatar.res.mjs +40 -0
  18. package/src/Eita__Badge.res.mjs +65 -0
  19. package/src/Eita__Breadcrumb.res.mjs +53 -0
  20. package/src/Eita__Button.res.mjs +47 -0
  21. package/src/Eita__Card.res.mjs +60 -0
  22. package/src/Eita__Checkbox.res.mjs +36 -0
  23. package/src/Eita__Dom.res.mjs +16 -0
  24. package/src/Eita__Drawer.res.mjs +112 -0
  25. package/src/Eita__Dropdown.res.mjs +96 -0
  26. package/src/Eita__Grid.res.mjs +24 -0
  27. package/src/Eita__Input.res.mjs +54 -0
  28. package/src/Eita__Kbd.res.mjs +42 -0
  29. package/src/Eita__Label.res.mjs +24 -0
  30. package/src/Eita__Modal.res.mjs +93 -0
  31. package/src/Eita__Progress.res.mjs +101 -0
  32. package/src/Eita__Radio.res.mjs +38 -0
  33. package/src/Eita__Select.res.mjs +40 -0
  34. package/src/Eita__Separator.res.mjs +70 -0
  35. package/src/Eita__Sidebar.res.mjs +103 -0
  36. package/src/Eita__Slider.res.mjs +89 -0
  37. package/src/Eita__Spinner.res.mjs +69 -0
  38. package/src/Eita__Stepper.res.mjs +114 -0
  39. package/src/Eita__Switch.res.mjs +84 -0
  40. package/src/Eita__Tabs.res.mjs +57 -0
  41. package/src/Eita__Textarea.res.mjs +39 -0
  42. package/src/Eita__Timeline.res.mjs +86 -0
  43. package/src/Eita__Toast.res.mjs +112 -0
  44. package/src/Eita__Tooltip.res.mjs +60 -0
  45. package/src/Eita__Topbar.res.mjs +96 -0
  46. package/src/Eita__Typography.res.mjs +183 -0
  47. package/src/Eita__Utils.res.mjs +32 -0
  48. package/src/Example.res +111 -0
  49. package/src/Example.res.mjs +176 -0
  50. package/src/components/Basefn__Accordion.css +70 -0
  51. package/src/components/Basefn__Accordion.res +79 -0
  52. package/src/components/Basefn__Accordion.res.mjs +77 -0
  53. package/src/components/Basefn__Alert.css +79 -0
  54. package/src/components/Basefn__Alert.res +68 -0
  55. package/src/components/Basefn__Alert.res.mjs +78 -0
  56. package/src/components/Basefn__AppLayout.css +100 -0
  57. package/src/components/Basefn__AppLayout.res +74 -0
  58. package/src/components/Basefn__AppLayout.res.mjs +100 -0
  59. package/src/components/Basefn__Avatar.css +25 -0
  60. package/src/components/Basefn__Avatar.res +23 -0
  61. package/src/components/Basefn__Avatar.res.mjs +40 -0
  62. package/src/components/Basefn__Badge.css +71 -0
  63. package/src/components/Basefn__Badge.res +43 -0
  64. package/src/components/Basefn__Badge.res.mjs +65 -0
  65. package/src/components/Basefn__Breadcrumb.css +36 -0
  66. package/src/components/Basefn__Breadcrumb.res +45 -0
  67. package/src/components/Basefn__Breadcrumb.res.mjs +53 -0
  68. package/src/components/Basefn__Button.css +83 -0
  69. package/src/components/Basefn__Button.res +32 -0
  70. package/src/components/Basefn__Button.res.mjs +54 -0
  71. package/src/components/Basefn__Card.css +50 -0
  72. package/src/components/Basefn__Card.res +45 -0
  73. package/src/components/Basefn__Card.res.mjs +60 -0
  74. package/src/components/Basefn__Checkbox.css +72 -0
  75. package/src/components/Basefn__Checkbox.res +25 -0
  76. package/src/components/Basefn__Checkbox.res.mjs +36 -0
  77. package/src/components/Basefn__Drawer.css +168 -0
  78. package/src/components/Basefn__Drawer.res +86 -0
  79. package/src/components/Basefn__Drawer.res.mjs +112 -0
  80. package/src/components/Basefn__Dropdown.css +76 -0
  81. package/src/components/Basefn__Dropdown.res +85 -0
  82. package/src/components/Basefn__Dropdown.res.mjs +96 -0
  83. package/src/components/Basefn__Grid.css +11 -0
  84. package/src/components/Basefn__Grid.res +296 -0
  85. package/src/components/Basefn__Grid.res.mjs +263 -0
  86. package/src/components/Basefn__Icon.css +12 -0
  87. package/src/components/Basefn__Icon.res +196 -0
  88. package/src/components/Basefn__Icon.res.mjs +183 -0
  89. package/src/components/Basefn__Input.css +44 -0
  90. package/src/components/Basefn__Input.res +48 -0
  91. package/src/components/Basefn__Input.res.mjs +63 -0
  92. package/src/components/Basefn__Kbd.css +65 -0
  93. package/src/components/Basefn__Kbd.res +27 -0
  94. package/src/components/Basefn__Kbd.res.mjs +42 -0
  95. package/src/components/Basefn__Label.css +22 -0
  96. package/src/components/Basefn__Label.res +18 -0
  97. package/src/components/Basefn__Label.res.mjs +24 -0
  98. package/src/components/Basefn__Modal.css +100 -0
  99. package/src/components/Basefn__Modal.res +74 -0
  100. package/src/components/Basefn__Modal.res.mjs +93 -0
  101. package/src/components/Basefn__Progress.css +69 -0
  102. package/src/components/Basefn__Progress.res +88 -0
  103. package/src/components/Basefn__Progress.res.mjs +101 -0
  104. package/src/components/Basefn__Radio.css +72 -0
  105. package/src/components/Basefn__Radio.res +35 -0
  106. package/src/components/Basefn__Radio.res.mjs +38 -0
  107. package/src/components/Basefn__Select.css +44 -0
  108. package/src/components/Basefn__Select.res +33 -0
  109. package/src/components/Basefn__Select.res.mjs +40 -0
  110. package/src/components/Basefn__Separator.css +85 -0
  111. package/src/components/Basefn__Separator.res +45 -0
  112. package/src/components/Basefn__Separator.res.mjs +70 -0
  113. package/src/components/Basefn__Sidebar.css +141 -0
  114. package/src/components/Basefn__Sidebar.res +95 -0
  115. package/src/components/Basefn__Sidebar.res.mjs +107 -0
  116. package/src/components/Basefn__Slider.css +97 -0
  117. package/src/components/Basefn__Slider.res +68 -0
  118. package/src/components/Basefn__Slider.res.mjs +89 -0
  119. package/src/components/Basefn__Spinner.css +63 -0
  120. package/src/components/Basefn__Spinner.res +44 -0
  121. package/src/components/Basefn__Spinner.res.mjs +69 -0
  122. package/src/components/Basefn__Stepper.css +141 -0
  123. package/src/components/Basefn__Stepper.res +86 -0
  124. package/src/components/Basefn__Stepper.res.mjs +114 -0
  125. package/src/components/Basefn__Switch.css +80 -0
  126. package/src/components/Basefn__Switch.res +62 -0
  127. package/src/components/Basefn__Switch.res.mjs +84 -0
  128. package/src/components/Basefn__Tabs.css +54 -0
  129. package/src/components/Basefn__Tabs.res +73 -0
  130. package/src/components/Basefn__Tabs.res.mjs +57 -0
  131. package/src/components/Basefn__Textarea.css +41 -0
  132. package/src/components/Basefn__Textarea.res +28 -0
  133. package/src/components/Basefn__Textarea.res.mjs +41 -0
  134. package/src/components/Basefn__ThemeToggle.css +5 -0
  135. package/src/components/Basefn__ThemeToggle.res +29 -0
  136. package/src/components/Basefn__ThemeToggle.res.mjs +49 -0
  137. package/src/components/Basefn__Timeline.css +144 -0
  138. package/src/components/Basefn__Timeline.res +70 -0
  139. package/src/components/Basefn__Timeline.res.mjs +86 -0
  140. package/src/components/Basefn__Toast.css +100 -0
  141. package/src/components/Basefn__Toast.res +92 -0
  142. package/src/components/Basefn__Toast.res.mjs +112 -0
  143. package/src/components/Basefn__Tooltip.css +84 -0
  144. package/src/components/Basefn__Tooltip.res +42 -0
  145. package/src/components/Basefn__Tooltip.res.mjs +60 -0
  146. package/src/components/Basefn__Topbar.css +130 -0
  147. package/src/components/Basefn__Topbar.res +92 -0
  148. package/src/components/Basefn__Topbar.res.mjs +91 -0
  149. package/src/components/Basefn__Typography.css +120 -0
  150. package/src/components/Basefn__Typography.res +96 -0
  151. package/src/components/Basefn__Typography.res.mjs +175 -0
  152. package/src/styles/Basefn__Theme.res +63 -0
  153. package/src/styles/Basefn__Theme.res.mjs +65 -0
  154. package/src/styles/variables.css +199 -0
package/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # basefn-UI
2
+
3
+ A simple, neutrally styled UI component library for [Xote](https://github.com/brnrdog/xote) applications, primarily used to battle-test the Xote framework against a real-world user interface system.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install basefn
9
+ ```
10
+
11
+ Make sure you have installed [xote](https://github.com/brnrdog/xote) and [rescript-signals](https://github.com/brnrdog/rescript-signals).
12
+
13
+ ## Usage Patterns
14
+
15
+ Components accept both regular values and signals. Use the `static()` for static values, or `reactive()` for reactive signals:
16
+
17
+ ```rescript
18
+ open basefnUI
19
+ open ReactiveProp
20
+
21
+ // Using regular values (static)
22
+ <Button
23
+ variant={Button.Primary}
24
+ label={static("Click me")}
25
+ onClick={_ => Console.log("You clicked!")}
26
+ />
27
+
28
+ // Using signals (reactive)
29
+ let labelSignal = Signal.make("Click me")
30
+ <Button
31
+ variant={Button.Primary}
32
+ label={reactive(labelSignal)}
33
+ onClick={_ => Signal.set(labelSignal, "You clicked!")}
34
+ />
35
+ ```
36
+
37
+ ## Components
38
+
39
+ See the available components at [src/components](https://github.com/brnrdog/basefn-ui/tree/main/src/components). Contributions are welcome if features are missing.
40
+
41
+ ## Theming
42
+
43
+ All components use CSS variables for styling, making them easy to customize. Override the variables in your CSS:
44
+
45
+ ```css
46
+ :root {
47
+ --basefn-color-primary: #your-color;
48
+ --basefn-color-secondary: #your-color;
49
+ /* ... other variables */
50
+ }
51
+ ```
52
+
53
+ See `src/styles/variables.css` for all available CSS variables.
54
+
55
+ ## Development
56
+
57
+ ```bash
58
+ # Install dependencies
59
+ npm install
60
+
61
+ # Start development server with Vite (hot reload)
62
+ npm run dev
63
+
64
+ # Build ReScript code
65
+ npm run build
66
+
67
+ # Watch mode for ReScript
68
+ npm run watch
69
+
70
+ # Build for production
71
+ npm run build:vite
72
+
73
+ # Preview production build
74
+ npm run preview
75
+
76
+ # Clean ReScript build
77
+ npm run clean
78
+ ```
79
+
80
+ ### Running the Demo
81
+
82
+ 1. Install dependencies: `npm install`
83
+ 2. Build the ReScript code: `npm run build`
84
+ 3. Start the dev server: `npm run dev`
85
+ 4. Open your browser to `http://localhost:3000`
86
+
87
+ The demo application showcases all components with live form state updates.
88
+
89
+ ## Project Structure
90
+
91
+ ```
92
+ basefn-ui/
93
+ ├── src/
94
+ │ ├── components/ # All UI components
95
+ │ ├── styles/ # CSS variables and theming
96
+ │ ├── Basefn__Dom.res # Simple dom bindings used in the lib
97
+ │ └── Basefn.res # Main export file
98
+ ├── package.json
99
+ └── rescript.json
100
+ ```
101
+
102
+ ## License
103
+
104
+ MIT
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "basefn",
3
+ "version": "1.0.0",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/brnrdog/basefn.git"
7
+ },
8
+ "description": "A simple UI component library for Xote applications",
9
+ "main": "src/Basefn.res.mjs",
10
+ "type": "module",
11
+ "files": [
12
+ "src/**/*.res",
13
+ "src/**/*.resi",
14
+ "src/**/*.res.mjs",
15
+ "src/**/*.css",
16
+ "rescript.json"
17
+ ],
18
+ "scripts": {
19
+ "build": "rescript",
20
+ "clean": "rescript clean",
21
+ "watch": "rescript build -w",
22
+ "dev": "vite",
23
+ "preview": "vite preview",
24
+ "build:vite": "vite build"
25
+ },
26
+ "keywords": [
27
+ "rescript",
28
+ "xote",
29
+ "ui",
30
+ "components"
31
+ ],
32
+ "author": "Bernardo Gurgel <brnrdog@hey.com>",
33
+ "license": "MIT",
34
+ "dependencies": {
35
+ "@rescript/core": "^1.6.1",
36
+ "highlight.js": "^11.11.1",
37
+ "lucide": "^0.562.0",
38
+ "xote": "^4.8.0"
39
+ },
40
+ "release": {
41
+ "branches": [
42
+ "main"
43
+ ],
44
+ "plugins": [
45
+ "@semantic-release/commit-analyzer",
46
+ "@semantic-release/release-notes-generator",
47
+ [
48
+ "@semantic-release/changelog",
49
+ {
50
+ "changelogFile": "docs/CHANGELOG.md"
51
+ }
52
+ ],
53
+ [
54
+ "@semantic-release/git",
55
+ {
56
+ "assets": [
57
+ "docs/CHANGELOG.md"
58
+ ]
59
+ }
60
+ ],
61
+ "@semantic-release/github",
62
+ [
63
+ "@semantic-release/npm",
64
+ {
65
+ "npmPublish": true,
66
+ "provenance": true
67
+ }
68
+ ]
69
+ ]
70
+ },
71
+ "devDependencies": {
72
+ "@commitlint/cli": "^20.1.0",
73
+ "@commitlint/config-conventional": "^20.0.0",
74
+ "@rescript/core": "^1.6.1",
75
+ "@semantic-release/changelog": "^6.0.3",
76
+ "@semantic-release/git": "^10.0.1",
77
+ "@semantic-release/github": "^12.0.2",
78
+ "@semantic-release/npm": "^13.1.3",
79
+ "rescript": "^12.0.1",
80
+ "vite": "^5.0.0"
81
+ }
82
+ }
package/rescript.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "basefn",
3
+ "sources": [
4
+ {
5
+ "dir": "src",
6
+ "subdirs": true,
7
+ "public": ["Basefn"]
8
+ },
9
+ {
10
+ "dir": "docs",
11
+ "subdirs": true,
12
+ "public": ["Basefn"]
13
+ }
14
+ ],
15
+ "package-specs": {
16
+ "module": "esmodule",
17
+ "in-source": true
18
+ },
19
+ "suffix": ".res.mjs",
20
+ "dependencies": [
21
+ "@rescript/core",
22
+ "rescript-signals",
23
+ "xote"
24
+ ],
25
+ "compiler-flags": [
26
+ "-open RescriptCore"
27
+ ],
28
+ "jsx": {
29
+ "version": 4,
30
+ "module": "Xote__JSX"
31
+ }
32
+ }
package/src/Basefn.css ADDED
@@ -0,0 +1,14 @@
1
+ @import "./styles/variables.css";
2
+
3
+ .bold {
4
+ font-weight: 600;
5
+ }
6
+
7
+ .muted {
8
+ color: var(--basefn-color-neutral-500);
9
+ }
10
+
11
+ .font-normal {
12
+ font-weight: 400;
13
+ }
14
+
package/src/Basefn.res ADDED
@@ -0,0 +1,105 @@
1
+ %%raw(`import './basefn.css'`)
2
+ // Main basefn UI module - exposes all components and utilities
3
+
4
+ // Re-export component types
5
+ type selectOption = Basefn__Select.selectOption
6
+ type inputType = Basefn__Input.inputType
7
+ type buttonVariant = Basefn__Button.variant
8
+ type badgeVariant = Basefn__Badge.variant
9
+ type badgeSize = Basefn__Badge.size
10
+ type spinnerSize = Basefn__Spinner.size
11
+ type spinnerVariant = Basefn__Spinner.variant
12
+ type separatorOrientation = Basefn__Separator.orientation
13
+ type separatorVariant = Basefn__Separator.variant
14
+ type kbdSize = Basefn__Kbd.size
15
+ type typographyVariant = Basefn__Typography.variant
16
+ type typographyAlign = Basefn__Typography.align
17
+ type alertVariant = Basefn__Alert.variant
18
+ type progressSize = Basefn__Progress.size
19
+ type progressVariant = Basefn__Progress.variant
20
+ type tab = Basefn__Tabs.tab
21
+ type accordionItem = Basefn__Accordion.accordionItem
22
+ type breadcrumbItem = Basefn__Breadcrumb.breadcrumbItem
23
+ type modalSize = Basefn__Modal.size
24
+ type tooltipPosition = Basefn__Tooltip.position
25
+ type switchSize = Basefn__Switch.size
26
+ type dropdownMenuItem = Basefn__Dropdown.menuItem
27
+ type dropdownMenuContent = Basefn__Dropdown.menuContent
28
+ type toastVariant = Basefn__Toast.variant
29
+ type toastPosition = Basefn__Toast.position
30
+ type stepperOrientation = Basefn__Stepper.orientation
31
+ type stepStatus = Basefn__Stepper.stepStatus
32
+ type stepperStep = Basefn__Stepper.step
33
+ type drawerPosition = Basefn__Drawer.position
34
+ type drawerSize = Basefn__Drawer.size
35
+ type timelineOrientation = Basefn__Timeline.orientation
36
+ type timelineVariant = Basefn__Timeline.variant
37
+ type timelineItem = Basefn__Timeline.timelineItem
38
+ type sidebarSize = Basefn__Sidebar.size
39
+ type sidebarNavItem = Basefn__Sidebar.navItem
40
+ type sidebarNavSection = Basefn__Sidebar.navSection
41
+ type topbarSize = Basefn__Topbar.size
42
+ type topbarNavItem = Basefn__Topbar.navItem
43
+ type appLayoutContentWidth = Basefn__AppLayout.contentWidth
44
+ type iconName = Basefn__Icon.name
45
+ type iconSize = Basefn__Icon.size
46
+ type gridColumns = Basefn__Grid.columns
47
+ type gridRows = Basefn__Grid.rows
48
+ type gridAutoFlow = Basefn__Grid.autoFlow
49
+ type gridJustifyItems = Basefn__Grid.justifyItems
50
+ type gridAlignItems = Basefn__Grid.alignItems
51
+ type gridJustifyContent = Basefn__Grid.justifyContent
52
+ type gridAlignContent = Basefn__Grid.alignContent
53
+ type gridItemColumnSpan = Basefn__Grid.Item.columnSpan
54
+ type gridItemRowSpan = Basefn__Grid.Item.rowSpan
55
+
56
+ // Form Components
57
+ module Button = Basefn__Button
58
+ module Input = Basefn__Input
59
+ module Textarea = Basefn__Textarea
60
+ module Select = Basefn__Select
61
+ module Checkbox = Basefn__Checkbox
62
+ module Radio = Basefn__Radio
63
+ module Label = Basefn__Label
64
+
65
+ // Tier 1 Foundation Components
66
+ module Badge = Basefn__Badge
67
+ module Spinner = Basefn__Spinner
68
+ module Separator = Basefn__Separator
69
+ module Kbd = Basefn__Kbd
70
+ module Typography = Basefn__Typography
71
+
72
+ // Tier 2
73
+ module Card = Basefn__Card
74
+ module Avatar = Basefn__Avatar
75
+ module Grid = Basefn__Grid
76
+ module Alert = Basefn__Alert
77
+ module Progress = Basefn__Progress
78
+ module Tabs = Basefn__Tabs
79
+ module Accordion = Basefn__Accordion
80
+ module Breadcrumb = Basefn__Breadcrumb
81
+
82
+ // Tier 3
83
+ module Modal = Basefn__Modal
84
+ module Tooltip = Basefn__Tooltip
85
+ module Switch = Basefn__Switch
86
+ module Slider = Basefn__Slider
87
+ module Dropdown = Basefn__Dropdown
88
+ module Toast = Basefn__Toast
89
+
90
+ // Tier 4 - Navigation & Layout
91
+ module Stepper = Basefn__Stepper
92
+ module Drawer = Basefn__Drawer
93
+ module Timeline = Basefn__Timeline
94
+
95
+ // Application Layout
96
+ module Sidebar = Basefn__Sidebar
97
+ module Topbar = Basefn__Topbar
98
+ module AppLayout = Basefn__AppLayout
99
+
100
+ // Theme
101
+ module Theme = Basefn__Theme
102
+ module ThemeToggle = Basefn__ThemeToggle
103
+
104
+ // Icons
105
+ module Icon = Basefn__Icon
@@ -0,0 +1,114 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+
4
+ import './basefn.css'
5
+ ;
6
+
7
+ let Button;
8
+
9
+ let Input;
10
+
11
+ let Textarea;
12
+
13
+ let Select;
14
+
15
+ let Checkbox;
16
+
17
+ let Radio;
18
+
19
+ let Label;
20
+
21
+ let Badge;
22
+
23
+ let Spinner;
24
+
25
+ let Separator;
26
+
27
+ let Kbd;
28
+
29
+ let Typography;
30
+
31
+ let Card;
32
+
33
+ let Avatar;
34
+
35
+ let Grid;
36
+
37
+ let Alert;
38
+
39
+ let Progress;
40
+
41
+ let Tabs;
42
+
43
+ let Accordion;
44
+
45
+ let Breadcrumb;
46
+
47
+ let Modal;
48
+
49
+ let Tooltip;
50
+
51
+ let Switch;
52
+
53
+ let Slider;
54
+
55
+ let Dropdown;
56
+
57
+ let Toast;
58
+
59
+ let Stepper;
60
+
61
+ let Drawer;
62
+
63
+ let Timeline;
64
+
65
+ let Sidebar;
66
+
67
+ let Topbar;
68
+
69
+ let AppLayout;
70
+
71
+ let Theme;
72
+
73
+ let ThemeToggle;
74
+
75
+ let Icon;
76
+
77
+ export {
78
+ Button,
79
+ Input,
80
+ Textarea,
81
+ Select,
82
+ Checkbox,
83
+ Radio,
84
+ Label,
85
+ Badge,
86
+ Spinner,
87
+ Separator,
88
+ Kbd,
89
+ Typography,
90
+ Card,
91
+ Avatar,
92
+ Grid,
93
+ Alert,
94
+ Progress,
95
+ Tabs,
96
+ Accordion,
97
+ Breadcrumb,
98
+ Modal,
99
+ Tooltip,
100
+ Switch,
101
+ Slider,
102
+ Dropdown,
103
+ Toast,
104
+ Stepper,
105
+ Drawer,
106
+ Timeline,
107
+ Sidebar,
108
+ Topbar,
109
+ AppLayout,
110
+ Theme,
111
+ ThemeToggle,
112
+ Icon,
113
+ }
114
+ /* Not a pure module */
@@ -0,0 +1,9 @@
1
+ let target = (e: Dom.event) => Obj.magic(e)["target"]
2
+
3
+ let preventDefault = (e: Dom.event) => %raw(`e.preventDefault()`)
4
+
5
+ let stopPropagation = (e: Dom.event) => %raw(`e.stopPropagation()`)
6
+
7
+ let addEventListener = %raw(`function(a, b) { document.addEventListener(a, b) }`)
8
+
9
+ @set external setInnerHTML: (Dom.element, string) => unit = "setInnerHTML"
@@ -0,0 +1,24 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+
4
+ function target(e) {
5
+ return e.target;
6
+ }
7
+
8
+ function preventDefault(e) {
9
+ return (e.preventDefault());
10
+ }
11
+
12
+ function stopPropagation(e) {
13
+ return (e.stopPropagation());
14
+ }
15
+
16
+ let addEventListener = (function(a, b) { document.addEventListener(a, b) });
17
+
18
+ export {
19
+ target,
20
+ preventDefault,
21
+ stopPropagation,
22
+ addEventListener,
23
+ }
24
+ /* No side effect */
@@ -0,0 +1,15 @@
1
+ // Utility types and functions for handling both regular values and signals
2
+
3
+ type reactive<'a> =
4
+ | Value('a)
5
+ | SignalValue(Signals.Signal.t<'a>)
6
+
7
+ let getValue = (reactive: reactive<'a>): 'a => {
8
+ switch reactive {
9
+ | Value(v) => v
10
+ | SignalValue(s) => Signals.Signal.get(s)
11
+ }
12
+ }
13
+
14
+ let makeReactive = (value: 'a): reactive<'a> => Value(value)
15
+ let makeReactiveFromSignal = (signal: Signals.Signal.t<'a>): reactive<'a> => SignalValue(signal)
@@ -0,0 +1,32 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as Signals from "rescript-signals/src/Signals.res.mjs";
4
+
5
+ function getValue(reactive) {
6
+ if (reactive.TAG === "Value") {
7
+ return reactive._0;
8
+ } else {
9
+ return Signals.Signal.get(reactive._0);
10
+ }
11
+ }
12
+
13
+ function makeReactive(value) {
14
+ return {
15
+ TAG: "Value",
16
+ _0: value
17
+ };
18
+ }
19
+
20
+ function makeReactiveFromSignal(signal) {
21
+ return {
22
+ TAG: "SignalValue",
23
+ _0: signal
24
+ };
25
+ }
26
+
27
+ export {
28
+ getValue,
29
+ makeReactive,
30
+ makeReactiveFromSignal,
31
+ }
32
+ /* Signals Not a pure module */