jj 2.8.0 → 2.9.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.
- package/SKILL.md +20 -2
- package/lib/bundle.cjs +61 -0
- package/lib/bundle.cjs.map +1 -1
- package/lib/bundle.d.cts +50 -0
- package/lib/bundle.d.ts +50 -0
- package/lib/bundle.global.js +61 -0
- package/lib/bundle.global.js.map +1 -1
- package/lib/bundle.js +61 -0
- package/lib/bundle.js.map +1 -1
- package/lib/bundle.min.cjs +1 -1
- package/lib/bundle.min.cjs.map +1 -1
- package/lib/bundle.min.d.cts +50 -0
- package/lib/bundle.min.d.ts +50 -0
- package/lib/bundle.min.global.js +1 -1
- package/lib/bundle.min.global.js.map +1 -1
- package/lib/bundle.min.js +1 -1
- package/lib/bundle.min.js.map +1 -1
- package/package.json +1 -1
package/lib/bundle.d.cts
CHANGED
|
@@ -319,6 +319,39 @@ declare class JJN<T extends Node = Node> extends JJET<T> {
|
|
|
319
319
|
* @throws {TypeError} If `ref` is not a Node.
|
|
320
320
|
*/
|
|
321
321
|
constructor(ref: T);
|
|
322
|
+
/**
|
|
323
|
+
* Gets the parent node wrapped in the most specific JJ wrapper available.
|
|
324
|
+
*
|
|
325
|
+
* @remarks
|
|
326
|
+
* Returns `null` when this node is detached and therefore has no parent.
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* ```ts
|
|
330
|
+
* const text = JJT.fromStr('hello')
|
|
331
|
+
* JJHE.create('div').addChild(text)
|
|
332
|
+
* const parent = text.parent // JJHE
|
|
333
|
+
* ```
|
|
334
|
+
*
|
|
335
|
+
* @returns The wrapped parent node, or `null` if this node has no parent.
|
|
336
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/parentNode | Node.parentNode}
|
|
337
|
+
*/
|
|
338
|
+
get parent(): Wrapped | null;
|
|
339
|
+
/**
|
|
340
|
+
* Gets the child nodes wrapped in the most specific JJ wrappers available.
|
|
341
|
+
*
|
|
342
|
+
* @remarks
|
|
343
|
+
* Returns an empty array when this node has no children.
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* ```ts
|
|
347
|
+
* const el = JJHE.create('div').addChild('hello', JJHE.create('span'))
|
|
348
|
+
* const children = el.children // [JJT, JJHE]
|
|
349
|
+
* ```
|
|
350
|
+
*
|
|
351
|
+
* @returns The wrapped child nodes.
|
|
352
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes | Node.childNodes}
|
|
353
|
+
*/
|
|
354
|
+
get children(): Wrapped[];
|
|
322
355
|
/**
|
|
323
356
|
* Clones the Node.
|
|
324
357
|
*
|
|
@@ -327,6 +360,23 @@ declare class JJN<T extends Node = Node> extends JJET<T> {
|
|
|
327
360
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/cloneNode | Node.cloneNode}
|
|
328
361
|
*/
|
|
329
362
|
clone(deep?: boolean): Wrapped;
|
|
363
|
+
/**
|
|
364
|
+
* Removes this node from its parent.
|
|
365
|
+
*
|
|
366
|
+
* @remarks
|
|
367
|
+
* If the node has no parent, this method does nothing.
|
|
368
|
+
*
|
|
369
|
+
* @example
|
|
370
|
+
* ```ts
|
|
371
|
+
* const el = JJHE.create('div')
|
|
372
|
+
* doc.body.addChild(el)
|
|
373
|
+
* el.rm()
|
|
374
|
+
* ```
|
|
375
|
+
*
|
|
376
|
+
* @returns This instance for chaining.
|
|
377
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/removeChild | Node.removeChild}
|
|
378
|
+
*/
|
|
379
|
+
rm(): this;
|
|
330
380
|
/**
|
|
331
381
|
* Creates a Text node from a string and appends it to this Node.
|
|
332
382
|
*
|
package/lib/bundle.d.ts
CHANGED
|
@@ -319,6 +319,39 @@ declare class JJN<T extends Node = Node> extends JJET<T> {
|
|
|
319
319
|
* @throws {TypeError} If `ref` is not a Node.
|
|
320
320
|
*/
|
|
321
321
|
constructor(ref: T);
|
|
322
|
+
/**
|
|
323
|
+
* Gets the parent node wrapped in the most specific JJ wrapper available.
|
|
324
|
+
*
|
|
325
|
+
* @remarks
|
|
326
|
+
* Returns `null` when this node is detached and therefore has no parent.
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* ```ts
|
|
330
|
+
* const text = JJT.fromStr('hello')
|
|
331
|
+
* JJHE.create('div').addChild(text)
|
|
332
|
+
* const parent = text.parent // JJHE
|
|
333
|
+
* ```
|
|
334
|
+
*
|
|
335
|
+
* @returns The wrapped parent node, or `null` if this node has no parent.
|
|
336
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/parentNode | Node.parentNode}
|
|
337
|
+
*/
|
|
338
|
+
get parent(): Wrapped | null;
|
|
339
|
+
/**
|
|
340
|
+
* Gets the child nodes wrapped in the most specific JJ wrappers available.
|
|
341
|
+
*
|
|
342
|
+
* @remarks
|
|
343
|
+
* Returns an empty array when this node has no children.
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* ```ts
|
|
347
|
+
* const el = JJHE.create('div').addChild('hello', JJHE.create('span'))
|
|
348
|
+
* const children = el.children // [JJT, JJHE]
|
|
349
|
+
* ```
|
|
350
|
+
*
|
|
351
|
+
* @returns The wrapped child nodes.
|
|
352
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes | Node.childNodes}
|
|
353
|
+
*/
|
|
354
|
+
get children(): Wrapped[];
|
|
322
355
|
/**
|
|
323
356
|
* Clones the Node.
|
|
324
357
|
*
|
|
@@ -327,6 +360,23 @@ declare class JJN<T extends Node = Node> extends JJET<T> {
|
|
|
327
360
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/cloneNode | Node.cloneNode}
|
|
328
361
|
*/
|
|
329
362
|
clone(deep?: boolean): Wrapped;
|
|
363
|
+
/**
|
|
364
|
+
* Removes this node from its parent.
|
|
365
|
+
*
|
|
366
|
+
* @remarks
|
|
367
|
+
* If the node has no parent, this method does nothing.
|
|
368
|
+
*
|
|
369
|
+
* @example
|
|
370
|
+
* ```ts
|
|
371
|
+
* const el = JJHE.create('div')
|
|
372
|
+
* doc.body.addChild(el)
|
|
373
|
+
* el.rm()
|
|
374
|
+
* ```
|
|
375
|
+
*
|
|
376
|
+
* @returns This instance for chaining.
|
|
377
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/removeChild | Node.removeChild}
|
|
378
|
+
*/
|
|
379
|
+
rm(): this;
|
|
330
380
|
/**
|
|
331
381
|
* Creates a Text node from a string and appends it to this Node.
|
|
332
382
|
*
|
package/lib/bundle.global.js
CHANGED
|
@@ -414,6 +414,44 @@
|
|
|
414
414
|
}
|
|
415
415
|
super(ref);
|
|
416
416
|
}
|
|
417
|
+
/**
|
|
418
|
+
* Gets the parent node wrapped in the most specific JJ wrapper available.
|
|
419
|
+
*
|
|
420
|
+
* @remarks
|
|
421
|
+
* Returns `null` when this node is detached and therefore has no parent.
|
|
422
|
+
*
|
|
423
|
+
* @example
|
|
424
|
+
* ```ts
|
|
425
|
+
* const text = JJT.fromStr('hello')
|
|
426
|
+
* JJHE.create('div').addChild(text)
|
|
427
|
+
* const parent = text.parent // JJHE
|
|
428
|
+
* ```
|
|
429
|
+
*
|
|
430
|
+
* @returns The wrapped parent node, or `null` if this node has no parent.
|
|
431
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/parentNode | Node.parentNode}
|
|
432
|
+
*/
|
|
433
|
+
get parent() {
|
|
434
|
+
const { parentNode } = this.ref;
|
|
435
|
+
return parentNode ? _JJN.wrap(parentNode) : null;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Gets the child nodes wrapped in the most specific JJ wrappers available.
|
|
439
|
+
*
|
|
440
|
+
* @remarks
|
|
441
|
+
* Returns an empty array when this node has no children.
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* ```ts
|
|
445
|
+
* const el = JJHE.create('div').addChild('hello', JJHE.create('span'))
|
|
446
|
+
* const children = el.children // [JJT, JJHE]
|
|
447
|
+
* ```
|
|
448
|
+
*
|
|
449
|
+
* @returns The wrapped child nodes.
|
|
450
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes | Node.childNodes}
|
|
451
|
+
*/
|
|
452
|
+
get children() {
|
|
453
|
+
return _JJN.wrapAll(this.ref.childNodes);
|
|
454
|
+
}
|
|
417
455
|
/**
|
|
418
456
|
* Clones the Node.
|
|
419
457
|
*
|
|
@@ -424,6 +462,29 @@
|
|
|
424
462
|
clone(deep) {
|
|
425
463
|
return _JJN.wrap(this.ref.cloneNode(deep));
|
|
426
464
|
}
|
|
465
|
+
/**
|
|
466
|
+
* Removes this node from its parent.
|
|
467
|
+
*
|
|
468
|
+
* @remarks
|
|
469
|
+
* If the node has no parent, this method does nothing.
|
|
470
|
+
*
|
|
471
|
+
* @example
|
|
472
|
+
* ```ts
|
|
473
|
+
* const el = JJHE.create('div')
|
|
474
|
+
* doc.body.addChild(el)
|
|
475
|
+
* el.rm()
|
|
476
|
+
* ```
|
|
477
|
+
*
|
|
478
|
+
* @returns This instance for chaining.
|
|
479
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/removeChild | Node.removeChild}
|
|
480
|
+
*/
|
|
481
|
+
rm() {
|
|
482
|
+
const { parentNode } = this.ref;
|
|
483
|
+
if (parentNode) {
|
|
484
|
+
parentNode.removeChild(this.ref);
|
|
485
|
+
}
|
|
486
|
+
return this;
|
|
487
|
+
}
|
|
427
488
|
/**
|
|
428
489
|
* Creates a Text node from a string and appends it to this Node.
|
|
429
490
|
*
|