@domphy/ui 0.1.1 → 0.1.3

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.
package/README.md CHANGED
@@ -1,19 +1,21 @@
1
1
  # @domphy/ui
2
2
 
3
- ~60 ready-to-use patches for Domphy — buttons, inputs, dialogs, tooltips, tabs, and more. Includes `@domphy/core` and `@domphy/theme`.
3
+ Ready-made patches for Domphy.
4
+
5
+ `@domphy/ui` includes `@domphy/core` and `@domphy/theme`, and provides patches for buttons, inputs, dialogs, menus, tabs, tooltips, and more.
6
+
7
+ ## Install
4
8
 
5
9
  ```bash
6
10
  npm install @domphy/ui
7
11
  ```
8
12
 
9
- ## What is a Patch?
10
-
11
- A Patch is a function that returns a partial element descriptor. It augments a native HTML element without wrapping or owning it. The element's own properties always win.
13
+ ## Quick Example
12
14
 
13
15
  ```ts
14
16
  import { ElementNode } from "@domphy/core"
15
17
  import { themeApply } from "@domphy/theme"
16
- import { button, tooltip, tabs } from "@domphy/ui"
18
+ import { button, tooltip } from "@domphy/ui"
17
19
 
18
20
  themeApply()
19
21
 
@@ -21,40 +23,40 @@ const App = {
21
23
  div: [
22
24
  {
23
25
  button: "Save",
24
- $: [button(), tooltip({ content: "Save changes" })]
25
- }
26
+ $: [
27
+ button({ color: "primary" }),
28
+ tooltip({ content: "Save changes" }),
29
+ ],
30
+ },
26
31
  ],
27
- dataTheme: "light"
32
+ dataTheme: "light",
28
33
  }
29
34
 
30
35
  new ElementNode(App).render(document.body)
31
36
  ```
32
37
 
33
- ## Customization via ownership
38
+ ## What A Patch Is
39
+
40
+ A patch returns a `PartialElement` and merges into a native element.
34
41
 
35
- Every patch ships as readable source. To fully customize, copy the patch into your project and modify it directly — no configuration API to work around.
42
+ It does not create a wrapper component or own a separate DOM boundary.
36
43
 
37
44
  ```ts
38
- import { toState, merge } from "@domphy/core"
39
- import { themeColor, themeSpacing, themeSize } from "@domphy/theme"
40
-
41
- // your own patch — full control
42
- function myButton() {
43
- return (base) => merge(base, {
44
- style: {
45
- fontSize: (l) => themeSize(l, "inherit"),
46
- padding: `${themeSpacing(1)} ${themeSpacing(3)}`,
47
- borderRadius: themeSpacing(2),
48
- backgroundColor: (l) => themeColor(l, "inherit", "primary"),
49
- color: (l) => themeColor(l, "shift-6", "primary"),
50
- "&:hover": {
51
- backgroundColor: (l) => themeColor(l, "increase-1", "primary"),
52
- },
53
- }
54
- })
45
+ {
46
+ button: "Save",
47
+ $: [button()],
55
48
  }
56
49
  ```
57
50
 
51
+ ## Customization
52
+
53
+ Most customization should happen in one of these ways:
54
+
55
+ 1. pass patch props
56
+ 2. use `dataTone` or `dataSize` context
57
+ 3. override inline on the element
58
+ 4. copy the patch into your app and create your own variant
59
+
58
60
  ## CDN
59
61
 
60
62
  ```html
@@ -64,6 +66,9 @@ function myButton() {
64
66
  </script>
65
67
  ```
66
68
 
67
- ---
69
+ ## Docs
68
70
 
69
- **[Full documentation →](https://www.domphy.com/docs/ui/)**
71
+ - [UI guide](https://www.domphy.com/docs/ui/)
72
+ - [Customization](https://www.domphy.com/docs/ui/customization)
73
+ - [Creation](https://www.domphy.com/docs/ui/creation)
74
+ - [Patch catalog](https://www.domphy.com/docs/ui/patches/button)