Skip to content

Commit

Permalink
chore: remove etoile
Browse files Browse the repository at this point in the history
  • Loading branch information
nonzzz committed Jan 13, 2025
1 parent 45fb7c6 commit e5ccf2d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
8 changes: 1 addition & 7 deletions src/etoile/etoile.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { asserts } from './graph'
import { Display, S } from './graph/display'
import { Schedule } from './schedule'

function traverse(graphs: Display[], handler: (graph: S) => void) {
export function traverse(graphs: Display[], handler: (graph: S) => void) {
const len = graphs.length
for (let i = 0; i < len; i++) {
const graph = graphs[i]
Expand All @@ -13,8 +12,3 @@ function traverse(graphs: Display[], handler: (graph: S) => void) {
}
}
}

export const etoile = {
Schedule,
traverse
}
13 changes: 7 additions & 6 deletions src/primitives/component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Box, etoile } from '../etoile'
import { Box, Schedule } from '../etoile'
import type { DOMEventDefinition } from '../etoile/native/dom'
import { log } from '../etoile/native/log'
import { createRoundBlock, createTitleText } from '../shared'
import type { RenderDecorator, Series } from './decorator'
import type { ExposedEventMethods, InternalEventDefinition } from './event'
Expand Down Expand Up @@ -101,7 +102,7 @@ export function resetLayout(treemap: TreemapLayout, w: number, h: number) {
treemap.reset(true)
}

export class Highlight extends etoile.Schedule<DOMEventDefinition> {
export class Highlight extends Schedule<DOMEventDefinition> {
reset() {
this.destory()
this.update()
Expand All @@ -122,7 +123,7 @@ export class Highlight extends etoile.Schedule<DOMEventDefinition> {
}
}

export class TreemapLayout extends etoile.Schedule<InternalEventDefinition> {
export class TreemapLayout extends Schedule<InternalEventDefinition> {
data: NativeModule[]
layoutNodes: LayoutModule[]
decorator: RenderDecorator
Expand All @@ -132,7 +133,7 @@ export class TreemapLayout extends etoile.Schedule<InternalEventDefinition> {
ellispsisWidthCache: Record<string, number>
highlight: Highlight

constructor(...args: ConstructorParameters<typeof etoile.Schedule>) {
constructor(...args: ConstructorParameters<typeof Schedule>) {
super(...args)
this.data = []
this.layoutNodes = []
Expand Down Expand Up @@ -273,7 +274,7 @@ export function createTreemap() {

function setOptions(options: TreemapOptions) {
if (!treemap) {
throw new Error('Treemap not initialized')
throw new Error(log.error('Treemap not initialized'))
}
treemap.data = bindParentForModule(options.data || [])

Expand All @@ -293,7 +294,7 @@ export function createTreemap() {

function zoom(id: string) {
if (!treemap) {
throw new Error("treemap don't init.")
throw new Error(log.error("treemap don't init."))
}
const node = findRelativeNodeById(id, treemap.layoutNodes)
if (node) {
Expand Down
4 changes: 2 additions & 2 deletions src/primitives/event.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { asserts, easing, etoile } from '../etoile'
import { asserts, easing, traverse } from '../etoile'
import { Display, Graph, S } from '../etoile/graph/display'
import { DOMEvent, DOM_EVENTS, createEffectScope } from '../etoile/native/dom'
import type { DOMEventMetadata, DOMEventType } from '../etoile/native/dom'
Expand Down Expand Up @@ -318,7 +318,7 @@ function stackMatrixTransform(graph: S, e: number, f: number, scale: number) {
}

function stackMatrixTransformWithGraphAndLayer(graphs: Display[], e: number, f: number, scale: number) {
etoile.traverse(graphs, (graph) => stackMatrixTransform(graph, e, f, scale))
traverse(graphs, (graph) => stackMatrixTransform(graph, e, f, scale))
}

interface DuckE {
Expand Down

0 comments on commit e5ccf2d

Please sign in to comment.