@bendyline/squisq 0.1.1 → 0.1.2
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 +85 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# @bendyline/squisq
|
|
2
|
+
|
|
3
|
+
Headless utilities for doc/block rendering, spatial math, Markdown parsing, and storage. Framework-agnostic — runs in the browser or Node.js with zero framework dependencies.
|
|
4
|
+
|
|
5
|
+
Part of the [Squisq](https://github.com/bendyline/squisq) monorepo.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@bendyline/squisq)
|
|
8
|
+
[](https://github.com/bendyline/squisq/blob/main/LICENSE)
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @bendyline/squisq
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## What's Inside
|
|
17
|
+
|
|
18
|
+
| Module | Description |
|
|
19
|
+
| ------------ | -------------------------------------------------------------------------------- |
|
|
20
|
+
| **schemas** | Type definitions — `Doc`, `BlockTemplate`, `Viewport`, `Theme`, `LayoutStrategy` |
|
|
21
|
+
| **doc** | Template registry, 17 block templates, animation/theme utilities |
|
|
22
|
+
| **markdown** | Markdown parsing, stringifying, AST types (`MarkdownDocument`), tree utilities |
|
|
23
|
+
| **spatial** | Haversine distance, Geohash encode/decode |
|
|
24
|
+
| **storage** | `StorageAdapter` interface, Memory + LocalStorage + LocalForage adapters |
|
|
25
|
+
|
|
26
|
+
## Subpath Imports
|
|
27
|
+
|
|
28
|
+
Import only what you need:
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import type { Doc, BlockTemplate, Theme } from '@bendyline/squisq/schemas';
|
|
32
|
+
import { getLayers, expandDocBlocks } from '@bendyline/squisq/doc';
|
|
33
|
+
import { parseMarkdown, stringifyMarkdown } from '@bendyline/squisq/markdown';
|
|
34
|
+
import { haversineDistance, geohashEncode } from '@bendyline/squisq/spatial';
|
|
35
|
+
import { LocalStorageAdapter } from '@bendyline/squisq/storage';
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Or import everything from the root:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { parseMarkdown, haversineDistance, getLayers } from '@bendyline/squisq';
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Quick Examples
|
|
45
|
+
|
|
46
|
+
### Parse Markdown
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import { parseMarkdown, stringifyMarkdown } from '@bendyline/squisq/markdown';
|
|
50
|
+
|
|
51
|
+
const doc = parseMarkdown('# Hello\n\nSome content');
|
|
52
|
+
console.log(doc.children); // AST nodes
|
|
53
|
+
|
|
54
|
+
const md = stringifyMarkdown(doc);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Spatial Utilities
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import { haversineDistance, geohashEncode } from '@bendyline/squisq/spatial';
|
|
61
|
+
|
|
62
|
+
const meters = haversineDistance(47.6, -122.3, 37.7, -122.4);
|
|
63
|
+
const hash = geohashEncode(47.6, -122.3, 7);
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Theme System
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
import { resolveTheme, getAvailableThemes } from '@bendyline/squisq/schemas';
|
|
70
|
+
|
|
71
|
+
const themes = getAvailableThemes(); // 8 built-in themes
|
|
72
|
+
const theme = resolveTheme('cinematic');
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Related Packages
|
|
76
|
+
|
|
77
|
+
| Package | Description |
|
|
78
|
+
| ---------------------------------------------------------------------------------------------- | ------------------------------------------- |
|
|
79
|
+
| [@bendyline/squisq-react](https://www.npmjs.com/package/@bendyline/squisq-react) | React components for rendering docs |
|
|
80
|
+
| [@bendyline/squisq-formats](https://www.npmjs.com/package/@bendyline/squisq-formats) | DOCX, PDF, HTML import/export |
|
|
81
|
+
| [@bendyline/squisq-editor-react](https://www.npmjs.com/package/@bendyline/squisq-editor-react) | React editor with raw/WYSIWYG/preview modes |
|
|
82
|
+
|
|
83
|
+
## License
|
|
84
|
+
|
|
85
|
+
[MIT](https://github.com/bendyline/squisq/blob/main/LICENSE)
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/squisq",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Headless utilities for doc/block rendering, spatial math, Markdown, and storage",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Bendyline",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/
|
|
9
|
+
"url": "https://github.com/bendyline/squisq.git",
|
|
10
10
|
"directory": "packages/core"
|
|
11
11
|
},
|
|
12
|
-
"homepage": "https://github.com/
|
|
12
|
+
"homepage": "https://github.com/bendyline/squisq",
|
|
13
13
|
"keywords": [
|
|
14
14
|
"doc",
|
|
15
15
|
"block",
|