@d3plus/dom 3.1.0 → 3.1.1

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 CHANGED
@@ -1,5 +1,8 @@
1
1
  # @d3plus/dom
2
2
 
3
+ [![NPM version](https://img.shields.io/npm/v/@d3plus/dom.svg)](https://www.npmjs.com/package/@d3plus/dom)
4
+ [![codecov](https://codecov.io/gh/d3plus/d3plus/graph/badge.svg?flag=dom)](https://codecov.io/gh/d3plus/d3plus/flags)
5
+
3
6
  JavaScript functions for manipulating and analyzing DOM elements.
4
7
 
5
8
  ## Installing
@@ -52,7 +55,7 @@ Live examples can be found on [d3plus.org](https://d3plus.org/), which includes
52
55
 
53
56
  > **assign**(...`objects`: `Record`\<`string`, `unknown`\>[]): `Record`\<`string`, `unknown`\>
54
57
 
55
- Defined in: [assign.ts:21](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/dom/src/assign.ts#L21)
58
+ Defined in: [assign.ts:21](https://github.com/d3plus/d3plus/blob/fe174c3153bf379a226e4a41b6a8492a86c3a1b7/packages/dom/src/assign.ts#L21)
56
59
 
57
60
  A deeply recursive version of `Object.assign`.
58
61
 
@@ -84,7 +87,7 @@ assign({id: "foo", deep: {group: "A"}}, {id: "bar", deep: {value: 20}}));
84
87
 
85
88
  > **attrize**(`e`: `Attrable`, `a?`: `Record`\<`string`, `string` \| `number` \| `boolean` \| `null`\>): `void`
86
89
 
87
- Defined in: [attrize.ts:8](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/dom/src/attrize.ts#L8)
90
+ Defined in: [attrize.ts:8](https://github.com/d3plus/d3plus/blob/fe174c3153bf379a226e4a41b6a8492a86c3a1b7/packages/dom/src/attrize.ts#L8)
88
91
 
89
92
  Applies each key/value in an object as an attr.
90
93
 
@@ -107,7 +110,7 @@ Applies each key/value in an object as an attr.
107
110
 
108
111
  > **backgroundColor**(`elem`: `Element`): `string`
109
112
 
110
- Defined in: [backgroundColor.ts:7](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/dom/src/backgroundColor.ts#L7)
113
+ Defined in: [backgroundColor.ts:7](https://github.com/d3plus/d3plus/blob/fe174c3153bf379a226e4a41b6a8492a86c3a1b7/packages/dom/src/backgroundColor.ts#L7)
111
114
 
112
115
  Given a DOM element, returns its background color by walking up the
113
116
  ancestor chain until a non-transparent background is found. Falls back
@@ -131,7 +134,7 @@ to "rgb(255, 255, 255)" (white) if every ancestor is transparent.
131
134
 
132
135
  > **date**(`d`: `string` \| `number` \| `false` \| `undefined`): `false` \| `Date` \| `undefined`
133
136
 
134
- Defined in: [date.ts:5](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/dom/src/date.ts#L5)
137
+ Defined in: [date.ts:5](https://github.com/d3plus/d3plus/blob/fe174c3153bf379a226e4a41b6a8492a86c3a1b7/packages/dom/src/date.ts#L5)
135
138
 
136
139
  Parses numbers and strings into valid JavaScript Date objects, supporting years, quarters, months, and ISO 8601 formats.
137
140
 
@@ -153,7 +156,7 @@ Parses numbers and strings into valid JavaScript Date objects, supporting years,
153
156
 
154
157
  > **elem**(`selector`: `string`, `p?`: `ElemParams`): `Selection`
155
158
 
156
- Defined in: [elem.ts:28](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/dom/src/elem.ts#L28)
159
+ Defined in: [elem.ts:28](https://github.com/d3plus/d3plus/blob/fe174c3153bf379a226e4a41b6a8492a86c3a1b7/packages/dom/src/elem.ts#L28)
157
160
 
158
161
  Manages the enter/update/exit pattern for a single DOM element, applying enter, update, and exit attributes with optional transitions.
159
162
 
@@ -176,7 +179,7 @@ Manages the enter/update/exit pattern for a single DOM element, applying enter,
176
179
 
177
180
  > **fontExists**(`font`: `string` \| `string`[]): `string` \| `false`
178
181
 
179
- Defined in: [fontExists.ts:13](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/dom/src/fontExists.ts#L13)
182
+ Defined in: [fontExists.ts:13](https://github.com/d3plus/d3plus/blob/fe174c3153bf379a226e4a41b6a8492a86c3a1b7/packages/dom/src/fontExists.ts#L13)
180
183
 
181
184
  Given either a single font-family or a list of fonts, returns the name of the first font that can be rendered, or `false` if none are installed on the user's machine.
182
185
 
@@ -198,7 +201,7 @@ Given either a single font-family or a list of fonts, returns the name of the fi
198
201
 
199
202
  > **inViewport**(`elem`: `Element`, `buffer?`: `number`): `boolean`
200
203
 
201
- Defined in: [inViewport.ts:6](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/dom/src/inViewport.ts#L6)
204
+ Defined in: [inViewport.ts:6](https://github.com/d3plus/d3plus/blob/fe174c3153bf379a226e4a41b6a8492a86c3a1b7/packages/dom/src/inViewport.ts#L6)
202
205
 
203
206
  Determines whether a given DOM element is visible within the current viewport, with an optional pixel buffer.
204
207
 
@@ -221,7 +224,7 @@ Determines whether a given DOM element is visible within the current viewport, w
221
224
 
222
225
  > **isObject**(`item`: `unknown`): `boolean`
223
226
 
224
- Defined in: [isObject.ts:5](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/dom/src/isObject.ts#L5)
227
+ Defined in: [isObject.ts:5](https://github.com/d3plus/d3plus/blob/fe174c3153bf379a226e4a41b6a8492a86c3a1b7/packages/dom/src/isObject.ts#L5)
225
228
 
226
229
  Detects if a variable is a javascript Object.
227
230
 
@@ -243,7 +246,7 @@ Detects if a variable is a javascript Object.
243
246
 
244
247
  > **parseSides**(`sides`: `string` \| `number`): `ParsedSides`
245
248
 
246
- Defined in: [parseSides.ts:12](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/dom/src/parseSides.ts#L12)
249
+ Defined in: [parseSides.ts:12](https://github.com/d3plus/d3plus/blob/fe174c3153bf379a226e4a41b6a8492a86c3a1b7/packages/dom/src/parseSides.ts#L12)
247
250
 
248
251
  Converts a string of directional CSS shorthand values into an object with the values expanded.
249
252
 
@@ -265,7 +268,7 @@ Converts a string of directional CSS shorthand values into an object with the va
265
268
 
266
269
  > **rtl**(): `boolean`
267
270
 
268
- Defined in: [rtl.ts:4](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/dom/src/rtl.ts#L4)
271
+ Defined in: [rtl.ts:4](https://github.com/d3plus/d3plus/blob/fe174c3153bf379a226e4a41b6a8492a86c3a1b7/packages/dom/src/rtl.ts#L4)
269
272
 
270
273
  Returns `true` if the HTML or body element has either the "dir" HTML attribute or the "direction" CSS property set to "rtl".
271
274
 
@@ -281,7 +284,7 @@ Returns `true` if the HTML or body element has either the "dir" HTML attribute o
281
284
 
282
285
  > **stylize**(`e`: `Stylable`, `s?`: `Record`\<`string`, `string` \| `number` \| `boolean` \| `null`\>): `void`
283
286
 
284
- Defined in: [stylize.ts:8](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/dom/src/stylize.ts#L8)
287
+ Defined in: [stylize.ts:8](https://github.com/d3plus/d3plus/blob/fe174c3153bf379a226e4a41b6a8492a86c3a1b7/packages/dom/src/stylize.ts#L8)
285
288
 
286
289
  Applies each key/value in an object as a style.
287
290
 
@@ -306,7 +309,7 @@ Applies each key/value in an object as a style.
306
309
 
307
310
  > **textWidth**(`text`: `string`, `style?`: `Record`\<`string`, `string` \| `number`\>): `number`
308
311
 
309
- Defined in: [textWidth.ts:49](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/dom/src/textWidth.ts#L49)
312
+ Defined in: [textWidth.ts:49](https://github.com/d3plus/d3plus/blob/fe174c3153bf379a226e4a41b6a8492a86c3a1b7/packages/dom/src/textWidth.ts#L49)
310
313
 
311
314
  Given a text string, returns the predicted pixel width of the string when placed into DOM.
312
315
 
@@ -325,7 +328,7 @@ Given a text string, returns the predicted pixel width of the string when placed
325
328
 
326
329
  > **textWidth**(`text`: `string`[], `style?`: `Record`\<`string`, `string` \| `number`\>): `number`[]
327
330
 
328
- Defined in: [textWidth.ts:53](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/dom/src/textWidth.ts#L53)
331
+ Defined in: [textWidth.ts:53](https://github.com/d3plus/d3plus/blob/fe174c3153bf379a226e4a41b6a8492a86c3a1b7/packages/dom/src/textWidth.ts#L53)
329
332
 
330
333
  ##### Parameters
331
334
 
@@ -346,4 +349,4 @@ Defined in: [textWidth.ts:53](https://github.com/d3plus/d3plus/blob/e9db3c743521
346
349
 
347
350
  > **D3Selection** = `ReturnType`\<*typeof* `select`\>
348
351
 
349
- Defined in: [D3Selection.ts:12](https://github.com/d3plus/d3plus/blob/e9db3c74352143cd7b6bdc8d0786477ea971eb6d/packages/dom/src/D3Selection.ts#L12)
352
+ Defined in: [D3Selection.ts:12](https://github.com/d3plus/d3plus/blob/fe174c3153bf379a226e4a41b6a8492a86c3a1b7/packages/dom/src/D3Selection.ts#L12)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d3plus/dom",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "JavaScript functions for manipulating and analyzing DOM elements.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -44,6 +44,7 @@
44
44
  "build:types": "tsc",
45
45
  "build:umd": "node ../../scripts/build-umd.js",
46
46
  "dev": "node ../../scripts/dev.js",
47
- "test": "eslint index.ts src/**/*.ts && eslint --global=it test && mocha 'test/**/*-test.js'"
47
+ "test": "eslint index.ts src/**/*.ts && eslint --global=it test && mocha 'test/**/*-test.js'",
48
+ "test:coverage": "c8 -r text -r lcov --src src mocha 'test/**/*-test.js'"
48
49
  }
49
50
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- @d3plus/dom v3.0.16
2
+ @d3plus/dom v3.1.0
3
3
  JavaScript functions for manipulating and analyzing DOM elements.
4
4
  Copyright (c) 2026 D3plus - https://d3plus.org
5
5
  @license MIT
@@ -1,5 +1,5 @@
1
1
  /*
2
- @d3plus/dom v3.0.16
2
+ @d3plus/dom v3.1.0
3
3
  JavaScript functions for manipulating and analyzing DOM elements.
4
4
  Copyright (c) 2026 D3plus - https://d3plus.org
5
5
  @license MIT
package/umd/d3plus-dom.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- @d3plus/dom v3.0.16
2
+ @d3plus/dom v3.1.0
3
3
  JavaScript functions for manipulating and analyzing DOM elements.
4
4
  Copyright (c) 2026 D3plus - https://d3plus.org
5
5
  @license MIT
@@ -1,5 +1,5 @@
1
1
  /*
2
- @d3plus/dom v3.0.16
2
+ @d3plus/dom v3.1.0
3
3
  JavaScript functions for manipulating and analyzing DOM elements.
4
4
  Copyright (c) 2026 D3plus - https://d3plus.org
5
5
  @license MIT