Skip to content

Commit

Permalink
chore: release v0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nonzzz committed Nov 26, 2024
1 parent f193749 commit 30a072b
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.2.1

Optimize render and cache.

# 0.2.0

Break preset color scheme. Add cache
Expand Down
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,45 @@ $ yarn add squarified

See the dev directory for a minimal example.

### API

```ts
// convert data into expected data
declare function c2m<
T extends AnyObject & {
groups: any[]
},
K extends keyof T
>(data: T, key: K, modifier?: (data: T) => T): T & {
weight: number
}

// preset theme layout (unstable)
declare function presetDecorator(app: TreemapLayout): void

declare function getNodeDepth(node: NativeModule): number

declare function visit<T extends AnyObject>(data: T[], fn: (data: T) => boolean | void): T | null

declare function findRelativeNode(p: {
x: number
y: number
}, layoutNodes: LayoutModule[]): LayoutModule | null

declare function findRelativeNodeById(id: string, layoutNodes: LayoutModule[]): LayoutModule | null

interface App {
init: (el: HTMLElement) => void
dispose: () => void
setOptions: (options: TreemapOptions) => void
resize: () => void
use: (using: Using, register: (app: TreemapLayout) => void) => void
zoom: (id: string) => void
}

declare function createTreemap(): App
```

### Auth

Kanno
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "squarified",
"version": "0.2.0",
"version": "0.2.1",
"description": "squarified tree map",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down
9 changes: 0 additions & 9 deletions src/shared/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ import { Matrix2D } from '../etoile/native/matrix'
import type { RectStyleOptions } from '../etoile/graph/rect'
import { Rect, Text } from '../etoile'

export function isObject(data: NonNullable<Record<string, any>>): data is object {
return Object.prototype.toString.call(data) === '[object Object]'
}

export function hashCode(str: string) {
let hash = 0
for (let i = 0; i < str.length; i++) {
Expand All @@ -24,11 +20,6 @@ export function perferNumeric(s: string | number) {

export function noop() {}

export function replaceString<S extends string, From extends string, To extends string>(str: S, searchValue: From, replaceValue: To) {
return str.replace(searchValue, replaceValue) as S extends `${infer L}${From extends '' ? never : From}${infer R}` ? `${L}${To}${R}`
: S
}

export function createFillBlock(x: number, y: number, width: number, height: number, style?: Partial<RectStyleOptions>) {
return new Rect({ width, height, x, y, style })
}
Expand Down

0 comments on commit 30a072b

Please sign in to comment.