@kent-tokyo/chematic 1.2.6 → 1.2.7

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.
@@ -86,6 +86,10 @@ export class ConformerHandle {
86
86
  export class DepictOptions {
87
87
  free(): void;
88
88
  [Symbol.dispose](): void;
89
+ /**
90
+ * Remove all element and per-atom label color overrides.
91
+ */
92
+ clear_label_colors(): void;
89
93
  constructor();
90
94
  /**
91
95
  * Set a per-atom color override (CSS color string). Calling multiple times
@@ -94,8 +98,20 @@ export class DepictOptions {
94
98
  */
95
99
  set_atom_color(idx: number, color: string): void;
96
100
  set_atom_ids(v: boolean): void;
101
+ /**
102
+ * Set the label text color of one atom (CSS color). Takes precedence over
103
+ * `set_element_label_color` and the default palette; unlike
104
+ * `set_atom_color` it does not highlight the atom. Last call wins.
105
+ */
106
+ set_atom_label_color(idx: number, color: string): void;
97
107
  set_background(bg: string): void;
98
108
  set_dark(dark: boolean): void;
109
+ /**
110
+ * Set the atom-label text color for every atom of `atomic_number`
111
+ * (CSS color). Only the label fill changes: no highlight is added and
112
+ * bond/highlight colors are untouched. Overridden by `set_atom_label_color`.
113
+ */
114
+ set_element_label_color(atomic_number: number, color: string): void;
99
115
  set_height(h: number): void;
100
116
  set_highlight_atoms(atoms: Uint32Array | number[]): void;
101
117
  set_highlight_bonds(bonds: Uint32Array | number[]): void;
@@ -104,6 +120,14 @@ export class DepictOptions {
104
120
  set_padding(p: number): void;
105
121
  set_show_atom_indices(v: boolean): void;
106
122
  set_width(w: number): void;
123
+ /**
124
+ * Apply an accessible label palette preset: `"light"` (checked at
125
+ * >= 4.5:1 on `#FFFFFF`) or `"dark"` (checked on `#0E2231`). Replaces
126
+ * any element label colors set before; per-atom label colors still win.
127
+ * Returns `false` (and changes nothing) for any other name. Contrast on
128
+ * other backgrounds is the caller's responsibility.
129
+ */
130
+ use_accessible_label_palette(theme: string): boolean;
107
131
  }
108
132
 
109
133
  export class MhfpLshHandle {
@@ -3891,11 +3915,14 @@ export interface InitOutput {
3891
3915
  readonly depict_reaction_svg: (a: number, b: number) => [number, number, number, number];
3892
3916
  readonly depict_svg_grid: (a: number, b: number, c: number) => [number, number];
3893
3917
  readonly depict_svg_grid_highlighted: (a: number, b: number, c: number, d: number, e: number) => [number, number];
3918
+ readonly depictoptions_clear_label_colors: (a: number) => void;
3894
3919
  readonly depictoptions_new: () => number;
3895
3920
  readonly depictoptions_set_atom_color: (a: number, b: number, c: number, d: number) => void;
3896
3921
  readonly depictoptions_set_atom_ids: (a: number, b: number) => void;
3922
+ readonly depictoptions_set_atom_label_color: (a: number, b: number, c: number, d: number) => void;
3897
3923
  readonly depictoptions_set_background: (a: number, b: number, c: number) => void;
3898
3924
  readonly depictoptions_set_dark: (a: number, b: number) => void;
3925
+ readonly depictoptions_set_element_label_color: (a: number, b: number, c: number, d: number) => void;
3899
3926
  readonly depictoptions_set_height: (a: number, b: number) => void;
3900
3927
  readonly depictoptions_set_highlight_atoms: (a: number, b: number, c: number) => void;
3901
3928
  readonly depictoptions_set_highlight_bonds: (a: number, b: number, c: number) => void;
@@ -3904,6 +3931,7 @@ export interface InitOutput {
3904
3931
  readonly depictoptions_set_padding: (a: number, b: number) => void;
3905
3932
  readonly depictoptions_set_show_atom_indices: (a: number, b: number) => void;
3906
3933
  readonly depictoptions_set_width: (a: number, b: number) => void;
3934
+ readonly depictoptions_use_accessible_label_palette: (a: number, b: number, c: number) => number;
3907
3935
  readonly detect_functional_groups: (a: number) => [number, number];
3908
3936
  readonly dice_ecfp4: (a: number, b: number) => number;
3909
3937
  readonly dice_ecfp6: (a: number, b: number) => number;
package/chematic_wasm.js CHANGED
@@ -169,6 +169,12 @@ export class DepictOptions {
169
169
  const ptr = this.__destroy_into_raw();
170
170
  wasm.__wbg_depictoptions_free(ptr, 0);
171
171
  }
172
+ /**
173
+ * Remove all element and per-atom label color overrides.
174
+ */
175
+ clear_label_colors() {
176
+ wasm.depictoptions_clear_label_colors(this.__wbg_ptr);
177
+ }
172
178
  constructor() {
173
179
  const ret = wasm.depictoptions_new();
174
180
  this.__wbg_ptr = ret;
@@ -194,6 +200,19 @@ export class DepictOptions {
194
200
  set_atom_ids(v) {
195
201
  wasm.depictoptions_set_atom_ids(this.__wbg_ptr, v);
196
202
  }
203
+ /**
204
+ * Set the label text color of one atom (CSS color). Takes precedence over
205
+ * `set_element_label_color` and the default palette; unlike
206
+ * `set_atom_color` it does not highlight the atom. Last call wins.
207
+ * @param {number} idx
208
+ * @param {string} color
209
+ */
210
+ set_atom_label_color(idx, color) {
211
+ const val2 = +idx;
212
+ const ptr0 = passStringToWasm0(color, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
213
+ const len0 = WASM_VECTOR_LEN;
214
+ wasm.depictoptions_set_atom_label_color(this.__wbg_ptr, val2, ptr0, len0);
215
+ }
197
216
  /**
198
217
  * @param {string} bg
199
218
  */
@@ -208,6 +227,19 @@ export class DepictOptions {
208
227
  set_dark(dark) {
209
228
  wasm.depictoptions_set_dark(this.__wbg_ptr, dark);
210
229
  }
230
+ /**
231
+ * Set the atom-label text color for every atom of `atomic_number`
232
+ * (CSS color). Only the label fill changes: no highlight is added and
233
+ * bond/highlight colors are untouched. Overridden by `set_atom_label_color`.
234
+ * @param {number} atomic_number
235
+ * @param {string} color
236
+ */
237
+ set_element_label_color(atomic_number, color) {
238
+ const val2 = +atomic_number;
239
+ const ptr0 = passStringToWasm0(color, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
240
+ const len0 = WASM_VECTOR_LEN;
241
+ wasm.depictoptions_set_element_label_color(this.__wbg_ptr, val2, ptr0, len0);
242
+ }
211
243
  /**
212
244
  * @param {number} h
213
245
  */
@@ -262,6 +294,21 @@ export class DepictOptions {
262
294
  set_width(w) {
263
295
  wasm.depictoptions_set_width(this.__wbg_ptr, w);
264
296
  }
297
+ /**
298
+ * Apply an accessible label palette preset: `"light"` (checked at
299
+ * >= 4.5:1 on `#FFFFFF`) or `"dark"` (checked on `#0E2231`). Replaces
300
+ * any element label colors set before; per-atom label colors still win.
301
+ * Returns `false` (and changes nothing) for any other name. Contrast on
302
+ * other backgrounds is the caller's responsibility.
303
+ * @param {string} theme
304
+ * @returns {boolean}
305
+ */
306
+ use_accessible_label_palette(theme) {
307
+ const ptr0 = passStringToWasm0(theme, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
308
+ const len0 = WASM_VECTOR_LEN;
309
+ const ret = wasm.depictoptions_use_accessible_label_palette(this.__wbg_ptr, ptr0, len0);
310
+ return ret !== 0;
311
+ }
265
312
  }
266
313
  if (Symbol.dispose) DepictOptions.prototype[Symbol.dispose] = DepictOptions.prototype.free;
267
314
 
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Kentaro Tanabe (kent-tokyo) <kent-tokyo@users.noreply.github.com>"
6
6
  ],
7
7
  "description": "WebAssembly bindings for chematic — use chematic from JavaScript/TypeScript",
8
- "version": "1.2.6",
8
+ "version": "1.2.7",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",