@atomscraft/core 0.1.0 → 0.1.1
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 +49 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,55 @@
|
|
|
1
1
|
# @atomscraft/core
|
|
2
2
|
|
|
3
|
-
Framework-agnostic behavior primitives used by AtomCraft components.
|
|
3
|
+
Framework-agnostic behavior primitives used by AtomCraft components. Use this
|
|
4
|
+
package when you need the interaction and data logic without React or CSS.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
4
7
|
|
|
5
8
|
```bash
|
|
6
|
-
|
|
9
|
+
npm install @atomscraft/core
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## What is included?
|
|
13
|
+
|
|
14
|
+
- Position calculations for popovers, menus and floating elements
|
|
15
|
+
- Keyboard navigation and typeahead helpers for list-like controls
|
|
16
|
+
- Date and calendar helpers, including ISO conversion and date ranges
|
|
17
|
+
- Filtering and text matching helpers
|
|
18
|
+
- Pagination and slider calculations
|
|
19
|
+
- Focusable-element discovery
|
|
20
|
+
- Small state-store, clipboard, class-name and data-attribute utilities
|
|
21
|
+
|
|
22
|
+
Everything is typed and has no React or DOM rendering dependency.
|
|
23
|
+
|
|
24
|
+
## Example
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { computePosition, getPageItems, snapToStep } from "@atomscraft/core";
|
|
28
|
+
|
|
29
|
+
const pageItems = getPageItems(3, 20);
|
|
30
|
+
const sliderValue = snapToStep(42, { min: 0, max: 100, step: 5 });
|
|
31
|
+
|
|
32
|
+
const position = computePosition(
|
|
33
|
+
{ x: 100, y: 80, width: 40, height: 32 },
|
|
34
|
+
{ width: 240, height: 120 },
|
|
35
|
+
{ width: 1024, height: 768 },
|
|
36
|
+
{ side: "bottom", align: "start", offset: 8 },
|
|
37
|
+
);
|
|
7
38
|
```
|
|
8
39
|
|
|
9
|
-
The
|
|
10
|
-
|
|
40
|
+
The exact options and return types are available through TypeScript
|
|
41
|
+
autocomplete. The source implementation and tests are in the repository.
|
|
42
|
+
|
|
43
|
+
## When should I use it?
|
|
44
|
+
|
|
45
|
+
Use `@atomscraft/core` to build a custom renderer, integrate AtomCraft behavior
|
|
46
|
+
into another framework, or share interaction logic between platforms. For ready-
|
|
47
|
+
made React components, install `@atomscraft/react` and `@atomscraft/css`.
|
|
48
|
+
|
|
49
|
+
## Related packages
|
|
50
|
+
|
|
51
|
+
- [`@atomscraft/react`](https://www.npmjs.com/package/@atomscraft/react) - React components
|
|
52
|
+
- [`@atomscraft/css`](https://www.npmjs.com/package/@atomscraft/css) - generated styles
|
|
53
|
+
- [`@atomscraft/tokens`](https://www.npmjs.com/package/@atomscraft/tokens) - design tokens
|
|
54
|
+
|
|
55
|
+
Documentation and examples: [AtomCraft UI on GitHub](https://github.com/NassimFarhat/AtomCraft-UI).
|