vivth 1.5.3 → 1.5.5

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
@@ -198,7 +198,6 @@ npm i vivth
198
198
  - [neutral.E](#e)
199
199
  - [neutral.NewStyleSheetAsync](#newstylesheetasync)
200
200
  - [neutral.NewStyleSheetSync](#newstylesheetsync)
201
- - [neutral.WC_DefineCustomElement](#wc_definecustomelement)
202
201
  - [neutral.WC_TagName_type](#wc_tagname_type)
203
202
  - [neutral.EnsureValidTag](#ensurevalidtag)
204
203
  - [neutral.IsInViewPortSignal](#isinviewportsignal)
@@ -3924,9 +3923,9 @@ f.forInSignals((key, signal) => {
3924
3923
 
3925
3924
  #### reference: `WalkThrough`
3926
3925
 
3927
- - collection of static `methods` to walktrhough things, instead of regular looping;
3928
- - usefull to iterator that might be modified during iteration;
3929
- - mostlikely to be less performant, but with better result clarity;
3926
+ - collection of static `methods` to walkthrough things, instead of regular looping;
3927
+ - useful for iterators that might be modified during iteration;
3928
+ - most likely to be less performant, but with better result clarity;
3930
3929
 
3931
3930
  #### reference: `WalkThrough.set`
3932
3931
 
@@ -3936,7 +3935,7 @@ f.forInSignals((key, signal) => {
3936
3935
  /**
3937
3936
  * @template VAL
3938
3937
  * @param {Set<VAL>} setInstance
3939
- * @param {(value:VAL)=>void} callback
3938
+ * @param {(value: VAL) => void} callback
3940
3939
  * @returns {void}
3941
3940
  */
3942
3941
  ```
@@ -3958,7 +3957,7 @@ WalkThrough.set(setOfSomething, (value) => {
3958
3957
  /**
3959
3958
  * @template KEY, VAL
3960
3959
  * @param {Map<KEY, VAL>} mapInstance
3961
- * @param {(res:[key: KEY, value: VAL]) => void} callback
3960
+ * @param {(entry: [key: KEY, value: VAL]) => void} callback
3962
3961
  * @returns {void}
3963
3962
  */
3964
3963
  ```
@@ -3980,7 +3979,7 @@ WalkThrough.map(mapOfSomething, ([key, value]) => {
3980
3979
  /**
3981
3980
  * @template VAL
3982
3981
  * @param {VAL[]} arrayInstance
3983
- * @param {(res:[value: VAL, index: number]) => void} callback
3982
+ * @param {(entry: [index: number, value: VAL]) => void} callback
3984
3983
  * @returns {void}
3985
3984
  */
3986
3985
  ```
@@ -3989,7 +3988,7 @@ WalkThrough.map(mapOfSomething, ([key, value]) => {
3989
3988
 
3990
3989
  ```js
3991
3990
  import { WalkThrough } from "vivth/neutral";
3992
- WalkThrough.array(arrayOfSomething, ([value, index]) => {
3991
+ WalkThrough.array(arrayOfSomething, ([index, value]) => {
3993
3992
  // code
3994
3993
  });
3995
3994
  ```
@@ -7100,43 +7099,6 @@ text.nodeValue = "hello world";
7100
7099
 
7101
7100
  ---
7102
7101
 
7103
- <h2 id="wc_definecustomelement">neutral.WC_DefineCustomElement</h2>
7104
-
7105
- #### reference: `WC_DefineCustomElement`
7106
-
7107
- - helper funtion for wecomponent instantiator;
7108
- - it uses WC_createElement_bind, which uses `lit-html`;
7109
- - alternatively, if you want to create a baseline component that are not to be , you can just
7110
-
7111
- ```js
7112
- /**
7113
- * @template {new (...args: any[]) => HTMLElement} BASE_CONSTRUCTOR
7114
- * @template {{
7115
- * class?:string;
7116
- * style?:string;
7117
- * observedAttributes?: readonly string[];
7118
- * namedSlots?: readonly string[];
7119
- * props?: Record<string, keyof TypeMap|(new (...args:any[])=>any)>;
7120
- * }} STANDARD
7121
- * @template {(BASE_CONSTRUCTOR) & {
7122
- * tagName: string;
7123
- * extendIsValue: string;
7124
- * observedAttributes?: STANDARD["observedAttributes"];
7125
- * namedSlots?: STANDARD["namedSlots"];
7126
- * props?: STANDARD["props"];
7127
- * }} CREATEARGS
7128
- * @template {string} TAG
7129
- * @param {WC_TagName_type<TAG>} tagName
7130
- * @param {CREATEARGS} classRef
7131
- * @param {ElementDefinitionOptions} elementDefinitionOptions
7132
- * @returns {ReturnType<typeof WC_createElement_bind<CREATEARGS>>}
7133
- */
7134
- ```
7135
-
7136
- \*) <sub>[go to list of exported API and typehelpers](#list-of-exported-api-and-typehelpers)</sub>
7137
-
7138
- ---
7139
-
7140
7102
  <h2 id="wc_tagname_type">neutral.WC_TagName_type</h2>
7141
7103
 
7142
7104
  - jsdoc types:
@@ -7399,7 +7361,7 @@ text.nodeValue = "hello world";
7399
7361
  }
7400
7362
  ```
7401
7363
 
7402
- - By disabling `declaration`, you prevent the TypeScript compiler from attempting to resolve and export the complex recursive type definitions generated by this factory;
7364
+ - By disabling `declaration`, you prevent the TypeScript compiler from attempting to resolve and export the complex recursive type definitions generated by this generator;
7403
7365
 
7404
7366
  ```js
7405
7367
  /**
@@ -7475,9 +7437,7 @@ text.nodeValue = "hello world";
7475
7437
 
7476
7438
  ```js
7477
7439
  export MyWebComponent extends WC_extendsA(HTMLElement, {...options}){
7478
- static create = WC_DefineCustomElement('my-webcomponent', this);
7479
- // you can skip the defining with WC_DefineCustomElement if the class are meant to be extended abstract;
7480
- // or if you want to opt out from using `lit-html` template;
7440
+ static create = this.define('my-webcomponent', this);
7481
7441
  }
7482
7442
  ```
7483
7443
 
@@ -7574,8 +7534,8 @@ text.nodeValue = "hello world";
7574
7534
  #### reference: `WC_extendsB`
7575
7535
 
7576
7536
  - Generates a base class for Web Component definitions.
7577
- - Note: This generator does not support `connectedMoveCallback`.
7578
- For the needs of opting in to [connectedMoveCallback](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements) functionality, use [WC_extendsB](#wc_extendsb) instead.
7537
+ - Note: This generator have `connectedMoveCallback`.
7538
+ For the needs of opting out to [connectedMoveCallback](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements) functionality, use [WC_extendsA](#wc_extendsa) instead.
7579
7539
  - This class relies heavily on complex type inference which can cause issues, during declaration file generation. To avoid "circular type" errors or build failures, set the following in your `tsconfig.json`:
7580
7540
 
7581
7541
  ```json
@@ -7586,7 +7546,7 @@ text.nodeValue = "hello world";
7586
7546
  }
7587
7547
  ```
7588
7548
 
7589
- - By disabling `declaration`, you prevent the TypeScript compiler from attempting to resolve and export the complex recursive type definitions generated by this factory;
7549
+ - By disabling `declaration`, you prevent the TypeScript compiler from attempting to resolve and export the complex recursive type definitions generated by this generator;
7590
7550
 
7591
7551
  ```js
7592
7552
  /**
@@ -7664,9 +7624,7 @@ text.nodeValue = "hello world";
7664
7624
 
7665
7625
  ```js
7666
7626
  export MyWebComponent extends WC_extendsA(HTMLElement, {...options}){
7667
- static create = WC_DefineCustomElement('my-webcomponent', this);
7668
- // you can skip the defining if the class are meant to be extended abstract;
7669
- // or if you want to opt out from using `lit-html` template;
7627
+ static create = this.define('my-webcomponent', this);
7670
7628
  }
7671
7629
  ```
7672
7630
 
@@ -105,7 +105,6 @@ export { CSS } from "../../../src/web/common/CSS.mjs";
105
105
  export { E } from "../../../src/web/common/E.mjs";
106
106
  export { NewStyleSheetAsync } from "../../../src/web/common/NewStyleSheetAsync.mjs";
107
107
  export { NewStyleSheetSync } from "../../../src/web/common/NewStyleSheetSync.mjs";
108
- export { WC_DefineCustomElement } from "../../../src/web/common/WC_DefineCustomElement.mjs";
109
108
  export { IsInViewPortSignal } from "../../../src/web/signals/IsInViewPortSignal.mjs";
110
109
  export { ObserverSignal } from "../../../src/web/signals/ObserverSignal.mjs";
111
110
  export { WC_litRef } from "../../../src/web/signals/WC_litRef.mjs";
@@ -67,7 +67,6 @@ export { CSS } from "../../../src/web/common/CSS.mjs";
67
67
  export { E } from "../../../src/web/common/E.mjs";
68
68
  export { NewStyleSheetAsync } from "../../../src/web/common/NewStyleSheetAsync.mjs";
69
69
  export { NewStyleSheetSync } from "../../../src/web/common/NewStyleSheetSync.mjs";
70
- export { WC_DefineCustomElement } from "../../../src/web/common/WC_DefineCustomElement.mjs";
71
70
  export { IsInViewPortSignal } from "../../../src/web/signals/IsInViewPortSignal.mjs";
72
71
  export { ObserverSignal } from "../../../src/web/signals/ObserverSignal.mjs";
73
72
  export { WC_litRef } from "../../../src/web/signals/WC_litRef.mjs";
@@ -1,28 +1,29 @@
1
1
  /**
2
2
  * @description
3
- * - collection of static `methods` to walktrhough things, instead of regular looping;
4
- * - usefull to iterator that might be modified during iteration;
5
- * - mostlikely to be less performant, but with better result clarity;
3
+ * - collection of static `methods` to walkthrough things, instead of regular looping;
4
+ * - useful for iterators that might be modified during iteration;
5
+ * - most likely to be less performant, but with better result clarity;
6
6
  */
7
7
  export class WalkThrough {
8
8
  /**
9
- * @param {Iterator<any, any, any>} iterator
10
- * @param {(...any:any[])=>void} callback
9
+ * @template T
10
+ * @param {Iterator<T, any, any>} iterator
11
+ * @param {(value: T) => void} callback
11
12
  * @returns {void}
12
13
  */
13
- static #handler: (iterator: Iterator<any, any, any>, callback: (...any: any[]) => void) => void;
14
+ static #handler<T>(iterator: Iterator<T, any, any>, callback: (value: T) => void): void;
14
15
  /**
15
16
  * @description
16
17
  * - method helper to WalkThrough `Set`;
17
18
  * @template VAL
18
19
  * @param {Set<VAL>} setInstance
19
- * @param {(value:VAL)=>void} callback
20
+ * @param {(value: VAL) => void} callback
20
21
  * @returns {void}
21
22
  * @example
22
23
  * import { WalkThrough } from 'vivth/neutral';
23
24
  *
24
25
  * WalkThrough.set(setOfSomething, (value) => {
25
- * // code
26
+ * // code
26
27
  * })
27
28
  */
28
29
  static set<VAL>(setInstance: Set<VAL>, callback: (value: VAL) => void): void;
@@ -31,29 +32,29 @@ export class WalkThrough {
31
32
  * - method helper to WalkThrough `Map`;
32
33
  * @template KEY, VAL
33
34
  * @param {Map<KEY, VAL>} mapInstance
34
- * @param {(res:[key: KEY, value: VAL]) => void} callback
35
+ * @param {(entry: [key: KEY, value: VAL]) => void} callback
35
36
  * @returns {void}
36
37
  * @example
37
38
  * import { WalkThrough } from 'vivth/neutral';
38
39
  *
39
40
  * WalkThrough.map(mapOfSomething, ([key, value]) => {
40
- * // code
41
+ * // code
41
42
  * })
42
43
  */
43
- static map<KEY, VAL>(mapInstance: Map<KEY, VAL>, callback: (res: [key: KEY, value: VAL]) => void): void;
44
+ static map<KEY, VAL>(mapInstance: Map<KEY, VAL>, callback: (entry: [key: KEY, value: VAL]) => void): void;
44
45
  /**
45
46
  * @description
46
47
  * - method helper to WalkThrough `Array`;
47
48
  * @template VAL
48
49
  * @param {VAL[]} arrayInstance
49
- * @param {(res:[value: VAL, index: number]) => void} callback
50
+ * @param {(entry: [index: number, value: VAL]) => void} callback
50
51
  * @returns {void}
51
52
  * @example
52
53
  * import { WalkThrough } from 'vivth/neutral';
53
54
  *
54
- * WalkThrough.array(arrayOfSomething, ([value, index]) => {
55
- * // code
55
+ * WalkThrough.array(arrayOfSomething, ([index, value]) => {
56
+ * // code
56
57
  * })
57
58
  */
58
- static array<VAL>(arrayInstance: VAL[], callback: (res: [value: VAL, index: number]) => void): void;
59
+ static array<VAL>(arrayInstance: VAL[], callback: (entry: [index: number, value: VAL]) => void): void;
59
60
  }
@@ -18,7 +18,7 @@
18
18
  * }
19
19
  * }
20
20
  * ```
21
- * - By disabling `declaration`, you prevent the TypeScript compiler from attempting to resolve and export the complex recursive type definitions generated by this factory;
21
+ * - By disabling `declaration`, you prevent the TypeScript compiler from attempting to resolve and export the complex recursive type definitions generated by this generator;
22
22
  * @template {new (...args: any[]) => HTMLElement} BASE_CONSTRUCTOR
23
23
  * @template {{
24
24
  * class?:string;
@@ -86,9 +86,7 @@
86
86
  * @returns {RET}
87
87
  * @example
88
88
  * export MyWebComponent extends WC_extendsA(HTMLElement, {...options}){
89
- * static create = WC_DefineCustomElement('my-webcomponent', this);
90
- * // you can skip the defining with WC_DefineCustomElement if the class are meant to be extended abstract;
91
- * // or if you want to opt out from using `lit-html` template;
89
+ * static create = this.define('my-webcomponent', this);
92
90
  * }
93
91
  */
94
92
  export function WC_extendsA<BASE_CONSTRUCTOR extends new (...args: any[]) => HTMLElement, STANDARD extends {
@@ -8,8 +8,8 @@
8
8
  /**
9
9
  * @description
10
10
  * - Generates a base class for Web Component definitions.
11
- * - Note: This generator does not support `connectedMoveCallback`.
12
- * For the needs of opting in to [connectedMoveCallback](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements) functionality, use [WC_extendsB](#wc_extendsb) instead.
11
+ * - Note: This generator have `connectedMoveCallback`.
12
+ * For the needs of opting out to [connectedMoveCallback](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements) functionality, use [WC_extendsA](#wc_extendsa) instead.
13
13
  * - This class relies heavily on complex type inference which can cause issues, during declaration file generation. To avoid "circular type" errors or build failures, set the following in your `tsconfig.json`:
14
14
  * ```json
15
15
  * {
@@ -18,7 +18,7 @@
18
18
  * }
19
19
  * }
20
20
  * ```
21
- * - By disabling `declaration`, you prevent the TypeScript compiler from attempting to resolve and export the complex recursive type definitions generated by this factory;
21
+ * - By disabling `declaration`, you prevent the TypeScript compiler from attempting to resolve and export the complex recursive type definitions generated by this generator;
22
22
  * @template {new (...args: any[]) => HTMLElement} BASE_CONSTRUCTOR
23
23
  * @template {{
24
24
  * class?:string;
@@ -88,9 +88,7 @@
88
88
  * @returns {RET}
89
89
  * @example
90
90
  * export MyWebComponent extends WC_extendsA(HTMLElement, {...options}){
91
- * static create = WC_DefineCustomElement('my-webcomponent', this);
92
- * // you can skip the defining if the class are meant to be extended abstract;
93
- * // or if you want to opt out from using `lit-html` template;
91
+ * static create = this.define('my-webcomponent', this);
94
92
  * }
95
93
  */
96
94
  export function WC_extendsB<BASE_CONSTRUCTOR extends new (...args: any[]) => HTMLElement, STANDARD extends {
@@ -215,7 +215,6 @@ export { CSS } from '../../../src/web/common/CSS.mjs';
215
215
  export { E } from '../../../src/web/common/E.mjs';
216
216
  export { NewStyleSheetAsync } from '../../../src/web/common/NewStyleSheetAsync.mjs';
217
217
  export { NewStyleSheetSync } from '../../../src/web/common/NewStyleSheetSync.mjs';
218
- export { WC_DefineCustomElement } from '../../../src/web/common/WC_DefineCustomElement.mjs';
219
218
  /**
220
219
  * @template {string} TAG
221
220
  * @typedef {import('../../../src/web/common/WC_TagName_type.mjs').WC_TagName_type<TAG>} WC_TagName_type
@@ -177,7 +177,6 @@ export { CSS } from '../../../src/web/common/CSS.mjs';
177
177
  export { E } from '../../../src/web/common/E.mjs';
178
178
  export { NewStyleSheetAsync } from '../../../src/web/common/NewStyleSheetAsync.mjs';
179
179
  export { NewStyleSheetSync } from '../../../src/web/common/NewStyleSheetSync.mjs';
180
- export { WC_DefineCustomElement } from '../../../src/web/common/WC_DefineCustomElement.mjs';
181
180
  /**
182
181
  * @template {string} TAG
183
182
  * @typedef {import('../../../src/web/common/WC_TagName_type.mjs').WC_TagName_type<TAG>} WC_TagName_type
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vivth",
3
- "version": "1.5.3",
3
+ "version": "1.5.5",
4
4
  "description": "library primitives",
5
5
  "devDependencies": {
6
6
  "@types/bun": "^1.3.3",
@@ -2,72 +2,77 @@
2
2
 
3
3
  /**
4
4
  * @description
5
- * - collection of static `methods` to walktrhough things, instead of regular looping;
6
- * - usefull to iterator that might be modified during iteration;
7
- * - mostlikely to be less performant, but with better result clarity;
5
+ * - collection of static `methods` to walkthrough things, instead of regular looping;
6
+ * - useful for iterators that might be modified during iteration;
7
+ * - most likely to be less performant, but with better result clarity;
8
8
  */
9
9
  export class WalkThrough {
10
10
  /**
11
- * @param {Iterator<any, any, any>} iterator
12
- * @param {(...any:any[])=>void} callback
11
+ * @template T
12
+ * @param {Iterator<T, any, any>} iterator
13
+ * @param {(value: T) => void} callback
13
14
  * @returns {void}
14
15
  */
15
- static #handler = (iterator, callback) => {
16
+ static #handler(iterator, callback) {
16
17
  let result = iterator.next();
17
18
  while (!result.done) {
18
19
  callback(result.value);
19
20
  result = iterator.next();
20
21
  }
21
- };
22
+ }
23
+
22
24
  /**
23
25
  * @description
24
26
  * - method helper to WalkThrough `Set`;
25
27
  * @template VAL
26
28
  * @param {Set<VAL>} setInstance
27
- * @param {(value:VAL)=>void} callback
29
+ * @param {(value: VAL) => void} callback
28
30
  * @returns {void}
29
31
  * @example
30
32
  * import { WalkThrough } from 'vivth/neutral';
31
33
  *
32
34
  * WalkThrough.set(setOfSomething, (value) => {
33
- * // code
35
+ * // code
34
36
  * })
35
37
  */
36
38
  static set(setInstance, callback) {
37
39
  WalkThrough.#handler(setInstance.values(), callback);
38
40
  }
41
+
39
42
  /**
40
43
  * @description
41
44
  * - method helper to WalkThrough `Map`;
42
45
  * @template KEY, VAL
43
46
  * @param {Map<KEY, VAL>} mapInstance
44
- * @param {(res:[key: KEY, value: VAL]) => void} callback
47
+ * @param {(entry: [key: KEY, value: VAL]) => void} callback
45
48
  * @returns {void}
46
49
  * @example
47
50
  * import { WalkThrough } from 'vivth/neutral';
48
51
  *
49
52
  * WalkThrough.map(mapOfSomething, ([key, value]) => {
50
- * // code
53
+ * // code
51
54
  * })
52
55
  */
53
56
  static map(mapInstance, callback) {
54
57
  WalkThrough.#handler(mapInstance.entries(), callback);
55
58
  }
59
+
56
60
  /**
57
61
  * @description
58
62
  * - method helper to WalkThrough `Array`;
59
63
  * @template VAL
60
64
  * @param {VAL[]} arrayInstance
61
- * @param {(res:[value: VAL, index: number]) => void} callback
65
+ * @param {(entry: [index: number, value: VAL]) => void} callback
62
66
  * @returns {void}
63
67
  * @example
64
68
  * import { WalkThrough } from 'vivth/neutral';
65
69
  *
66
- * WalkThrough.array(arrayOfSomething, ([value, index]) => {
67
- * // code
70
+ * WalkThrough.array(arrayOfSomething, ([index, value]) => {
71
+ * // code
68
72
  * })
69
73
  */
70
74
  static array(arrayInstance, callback) {
71
- WalkThrough.#handler(arrayInstance.values(), callback);
75
+ // Changed .values() to .entries() to match your [index, value] requirement
76
+ WalkThrough.#handler(arrayInstance.entries(), callback);
72
77
  }
73
78
  }
@@ -3,7 +3,7 @@
3
3
  // import { Signal } from '../class/Signal.mjs';
4
4
  import { WalkThrough } from '../class/WalkThrough.mjs';
5
5
  import { ForInSync } from '../function/ForInSync.mjs';
6
- import { ForOfSync } from '../function/ForOfSync.mjs';
6
+ // import { ForOfSync } from '../function/ForOfSync.mjs';
7
7
  import { IsTypeOf } from '../function/IsTypeOf.mjs';
8
8
  import { WC_createElement_bind } from './bindings/WC_createElement_bind.mjs';
9
9
  import { WC_createNamedSlot } from './bindings/WC_createNamedSlot.mjs';
@@ -28,7 +28,7 @@ import { WC_createNamedSlot } from './bindings/WC_createNamedSlot.mjs';
28
28
  * }
29
29
  * }
30
30
  * ```
31
- * - By disabling `declaration`, you prevent the TypeScript compiler from attempting to resolve and export the complex recursive type definitions generated by this factory;
31
+ * - By disabling `declaration`, you prevent the TypeScript compiler from attempting to resolve and export the complex recursive type definitions generated by this generator;
32
32
  * @template {new (...args: any[]) => HTMLElement} BASE_CONSTRUCTOR
33
33
  * @template {{
34
34
  * class?:string;
@@ -96,9 +96,7 @@ import { WC_createNamedSlot } from './bindings/WC_createNamedSlot.mjs';
96
96
  * @returns {RET}
97
97
  * @example
98
98
  * export MyWebComponent extends WC_extendsA(HTMLElement, {...options}){
99
- * static create = WC_DefineCustomElement('my-webcomponent', this);
100
- * // you can skip the defining with WC_DefineCustomElement if the class are meant to be extended abstract;
101
- * // or if you want to opt out from using `lit-html` template;
99
+ * static create = this.define('my-webcomponent', this);
102
100
  * }
103
101
  */
104
102
  export function WC_extendsA(Base, staticMember = /** @type {any} */ ({})) {
@@ -212,9 +210,6 @@ export function WC_extendsA(Base, staticMember = /** @type {any} */ ({})) {
212
210
  this.setAttribute('style', style);
213
211
  }
214
212
  WalkThrough.set(this.#setOfConnected, (cb) => cb());
215
- ForOfSync(observedAttributes, (key) => {
216
- this.attributeChangedCallback(key, null, this.getAttribute(key));
217
- });
218
213
  }
219
214
 
220
215
  /**
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { WalkThrough } from '../class/WalkThrough.mjs';
4
4
  import { ForInSync } from '../function/ForInSync.mjs';
5
- import { ForOfSync } from '../function/ForOfSync.mjs';
5
+ // import { ForOfSync } from '../function/ForOfSync.mjs';
6
6
  import { IsTypeOf } from '../function/IsTypeOf.mjs';
7
7
  import { WC_createElement_bind } from './bindings/WC_createElement_bind.mjs';
8
8
  import { WC_createNamedSlot } from './bindings/WC_createNamedSlot.mjs';
@@ -14,11 +14,12 @@ import { WC_createNamedSlot } from './bindings/WC_createNamedSlot.mjs';
14
14
  /**
15
15
  * @typedef {typeof import('../function/IsTypeOf.mjs').TypeMap} TypeMap
16
16
  */
17
+
17
18
  /**
18
19
  * @description
19
20
  * - Generates a base class for Web Component definitions.
20
- * - Note: This generator does not support `connectedMoveCallback`.
21
- * For the needs of opting in to [connectedMoveCallback](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements) functionality, use [WC_extendsB](#wc_extendsb) instead.
21
+ * - Note: This generator have `connectedMoveCallback`.
22
+ * For the needs of opting out to [connectedMoveCallback](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements) functionality, use [WC_extendsA](#wc_extendsa) instead.
22
23
  * - This class relies heavily on complex type inference which can cause issues, during declaration file generation. To avoid "circular type" errors or build failures, set the following in your `tsconfig.json`:
23
24
  * ```json
24
25
  * {
@@ -27,7 +28,7 @@ import { WC_createNamedSlot } from './bindings/WC_createNamedSlot.mjs';
27
28
  * }
28
29
  * }
29
30
  * ```
30
- * - By disabling `declaration`, you prevent the TypeScript compiler from attempting to resolve and export the complex recursive type definitions generated by this factory;
31
+ * - By disabling `declaration`, you prevent the TypeScript compiler from attempting to resolve and export the complex recursive type definitions generated by this generator;
31
32
  * @template {new (...args: any[]) => HTMLElement} BASE_CONSTRUCTOR
32
33
  * @template {{
33
34
  * class?:string;
@@ -97,9 +98,7 @@ import { WC_createNamedSlot } from './bindings/WC_createNamedSlot.mjs';
97
98
  * @returns {RET}
98
99
  * @example
99
100
  * export MyWebComponent extends WC_extendsA(HTMLElement, {...options}){
100
- * static create = WC_DefineCustomElement('my-webcomponent', this);
101
- * // you can skip the defining if the class are meant to be extended abstract;
102
- * // or if you want to opt out from using `lit-html` template;
101
+ * static create = this.define('my-webcomponent', this);
103
102
  * }
104
103
  */
105
104
  export function WC_extendsB(Base, staticMember = /** @type {any} */ ({})) {
@@ -225,9 +224,6 @@ export function WC_extendsB(Base, staticMember = /** @type {any} */ ({})) {
225
224
  this.setAttribute('style', style);
226
225
  }
227
226
  WalkThrough.set(this.#setOfConnected, (cb) => cb());
228
- ForOfSync(observedAttributes, (key) => {
229
- this.attributeChangedCallback(key, null, this.getAttribute(key));
230
- });
231
227
  }
232
228
  /**
233
229
  * @protected
@@ -1,46 +0,0 @@
1
- // @ts-check
2
-
3
- import { WC_createElement_bind } from '../bindings/WC_createElement_bind.mjs';
4
-
5
- /**
6
- * @import {WC_TagName_type} from '../common/WC_TagName_type.mjs'
7
- */
8
- /**
9
- * @typedef {typeof import('../../function/IsTypeOf.mjs').TypeMap} TypeMap
10
- */
11
- /**
12
- * @description
13
- * - helper funtion for wecomponent instantiator;
14
- * - it uses WC_createElement_bind, which uses `lit-html`;
15
- * - alternatively, if you want to create a baseline component that are not to be , you can just
16
- * @template {new (...args: any[]) => HTMLElement} BASE_CONSTRUCTOR
17
- * @template {{
18
- * class?:string;
19
- * style?:string;
20
- * observedAttributes?: readonly string[];
21
- * namedSlots?: readonly string[];
22
- * props?: Record<string, keyof TypeMap|(new (...args:any[])=>any)>;
23
- * }} STANDARD
24
- * @template {(BASE_CONSTRUCTOR) & {
25
- * tagName: string;
26
- * extendIsValue: string;
27
- * observedAttributes?: STANDARD["observedAttributes"];
28
- * namedSlots?: STANDARD["namedSlots"];
29
- * props?: STANDARD["props"];
30
- * }} CREATEARGS
31
- * @template {string} TAG
32
- * @param {WC_TagName_type<TAG>} tagName
33
- * @param {CREATEARGS} classRef
34
- * @param {ElementDefinitionOptions} elementDefinitionOptions
35
- * @returns {ReturnType<typeof WC_createElement_bind<CREATEARGS>>}
36
- */
37
- export function WC_DefineCustomElement(tagName, classRef, elementDefinitionOptions) {
38
- if (elementDefinitionOptions && elementDefinitionOptions.extends) {
39
- classRef.tagName = elementDefinitionOptions.extends;
40
- classRef.extendIsValue = tagName;
41
- } else {
42
- classRef.tagName = tagName;
43
- }
44
- customElements.define(tagName, classRef, elementDefinitionOptions);
45
- return WC_createElement_bind(classRef);
46
- }