phylotree 2.4.0 → 2.6.0

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.
@@ -54,6 +54,8 @@ export interface RenderOptions {
54
54
  layout?: 'left-to-right' | 'right-to-left';
55
55
  /** Use radial/circular layout */
56
56
  'is-radial'?: boolean;
57
+ /** Use unrooted (equal-angle) layout */
58
+ 'is-unrooted'?: boolean;
57
59
  /** Align tip labels */
58
60
  'align-tips'?: boolean;
59
61
  /** Show node labels */
@@ -116,6 +118,8 @@ export class TreeRender {
116
118
  label_width: number;
117
119
  /** Rightmost leaf x position */
118
120
  right_most_leaf: number;
121
+ /** The container element */
122
+ container: string | HTMLElement;
119
123
 
120
124
  constructor(phylotree: Phylotree, options?: RenderOptions);
121
125
 
@@ -131,6 +135,9 @@ export class TreeRender {
131
135
  /** Get/set radial mode */
132
136
  radial(value?: boolean): boolean | this;
133
137
 
138
+ /** Get/set unrooted (equal-angle) layout mode */
139
+ unrooted(value?: boolean): boolean | this;
140
+
134
141
  /** Get/set align tips mode */
135
142
  alignTips(value?: boolean): boolean | this;
136
143
 
@@ -166,6 +173,117 @@ export class TreeRender {
166
173
 
167
174
  /** Selection callback setter */
168
175
  selectionCallback(callback: (selection: PhylotreeNode[]) => void): this;
176
+
177
+ /**
178
+ * Get or set spacing in the x-direction (horizontal spacing between nodes)
179
+ * @param attr The new spacing value if setting
180
+ * @param skip_render Whether to skip re-rendering after setting
181
+ * @returns The current spacing_x value if getting, or the TreeRender instance if setting
182
+ */
183
+ spacing_x(): number;
184
+ spacing_x(attr: number, skip_render?: boolean): this;
185
+
186
+ /**
187
+ * Get or set spacing in the y-direction (vertical spacing between levels)
188
+ * @param attr The new spacing value if setting
189
+ * @param skip_render Whether to skip re-rendering after setting
190
+ * @returns The current spacing_y value if getting, or the TreeRender instance if setting
191
+ */
192
+ spacing_y(): number;
193
+ spacing_y(attr: number, skip_render?: boolean): this;
194
+
195
+ /**
196
+ * Get or set the font size for labels
197
+ * @param attr The new font size if setting
198
+ * @returns The current font size if getting, or the TreeRender instance if setting
199
+ */
200
+ font_size(): number;
201
+ font_size(attr: number): this;
202
+
203
+ /**
204
+ * Get or set the scale bar font size
205
+ * @param attr The new font size if setting
206
+ * @returns The current scale bar font size if getting, or the TreeRender instance if setting
207
+ */
208
+ scale_bar_font_size(): number;
209
+ scale_bar_font_size(attr: number): this;
210
+
211
+ /**
212
+ * Get or set the node circle size
213
+ * @param attr The new circle size if setting
214
+ * @param attr2 Optional second parameter
215
+ * @returns The current node circle size if getting, or the TreeRender instance if setting
216
+ */
217
+ node_circle_size(): number;
218
+ node_circle_size(attr: number, attr2?: number): this;
219
+
220
+ /**
221
+ * Get or set CSS classes
222
+ * @param opt CSS class options
223
+ * @returns The current CSS classes if getting, or the TreeRender instance if setting
224
+ */
225
+ css(): { [key: string]: string };
226
+ css(opt: { [key: string]: string }): this;
227
+
228
+ /**
229
+ * Get or set transitions
230
+ * @param arg Transition settings
231
+ * @returns The current transition settings if getting, or the TreeRender instance if setting
232
+ */
233
+ transitions(): boolean | null;
234
+ transitions(arg: boolean): this;
235
+
236
+ /**
237
+ * Layout the tree
238
+ * @param transitions Whether to use transitions
239
+ * @returns The TreeRender instance
240
+ */
241
+ layout(transitions?: boolean): this;
242
+
243
+ /** Refresh the tree display */
244
+ refresh(): this;
245
+
246
+ /** Place nodes in the layout */
247
+ placenodes(): this;
248
+
249
+ /**
250
+ * Set the separation function for node spacing
251
+ * @param callback Function that returns additional spacing between nodes
252
+ * @returns The TreeRender instance
253
+ */
254
+ separation(callback: (node: PhylotreeNode, previous: PhylotreeNode) => number): this;
255
+
256
+ /**
257
+ * Set internal node labels based on children
258
+ * @param callback Function that determines label based on children
259
+ * @param respect_existing Whether to respect existing selections
260
+ * @returns The TreeRender instance
261
+ */
262
+ internalLabel(callback: (children: PhylotreeNode[]) => boolean, respect_existing?: boolean): this;
263
+
264
+ /**
265
+ * Get or set the count handler callback
266
+ * @param callback Function called with selection count
267
+ * @returns The current handler if getting, or the TreeRender instance if setting
268
+ */
269
+ countHandler(): ((count: number) => void) | null;
270
+ countHandler(callback: (count: number) => void): this;
271
+
272
+ /**
273
+ * Update the selection key name
274
+ * @param old_key The old key name
275
+ * @param new_key The new key name
276
+ * @returns The TreeRender instance
277
+ */
278
+ updateKeyName(old_key: string, new_key: string | null): this;
279
+
280
+ /**
281
+ * Set the size of the tree display
282
+ * @param attr Size as [width, height]
283
+ * @returns The current size if getting, or the TreeRender instance if setting
284
+ */
285
+ set_size(): [number, number];
286
+ set_size(attr: [number, number]): this;
169
287
  }
170
288
 
171
289
  /**