vivth 1.5.4 → 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)
@@ -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";
@@ -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.4",
3
+ "version": "1.5.5",
4
4
  "description": "library primitives",
5
5
  "devDependencies": {
6
6
  "@types/bun": "^1.3.3",
@@ -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
- }