ivue 1.2.2 → 1.2.3
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/docs/docs/.vitepress/dist/404.html +2 -2
- package/docs/docs/.vitepress/dist/api/ivue.html +3 -3
- package/docs/docs/.vitepress/dist/api/propsWithDefaults.html +3 -3
- package/docs/docs/.vitepress/dist/assets/{app.2nR_jJ6K.js → app.DQ9wCVNL.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/chunks/@localSearchIndexroot.HQhVwKCx.js +1 -0
- package/docs/docs/.vitepress/dist/assets/chunks/{VPLocalSearchBox.DkPjtbh1.js → VPLocalSearchBox.EJpZrMkj.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/chunks/{theme.DoTp8yA-.js → theme.BCqH7Ey3.js} +2 -2
- package/docs/docs/.vitepress/dist/assets/{pages_browse-code.md.D-gTrMhG.js → pages_browse-code.md.d01mQ5OL.js} +2 -2
- package/docs/docs/.vitepress/dist/assets/{pages_getting-started.md.COvbcFGT.js → pages_getting-started.md.g77_aCnX.js} +2 -2
- package/docs/docs/.vitepress/dist/assets/{pages_guidelines.md.BI1PexCc.js → pages_guidelines.md.DufOHb7U.js} +2 -2
- package/docs/docs/.vitepress/dist/assets/{pages_guidelines.md.BI1PexCc.lean.js → pages_guidelines.md.DufOHb7U.lean.js} +2 -2
- package/docs/docs/.vitepress/dist/assets/{pages_how-it-works.md.NImDvDby.js → pages_how-it-works.md.BaYaFawX.js} +2 -2
- package/docs/docs/.vitepress/dist/assets/{pages_how-it-works.md.NImDvDby.lean.js → pages_how-it-works.md.BaYaFawX.lean.js} +2 -2
- package/docs/docs/.vitepress/dist/assets/{pages_usage.md.DRJXyExt.js → pages_usage.md.Fo9SdFjd.js} +29 -29
- package/docs/docs/.vitepress/dist/assets/{pages_usage.md.DRJXyExt.lean.js → pages_usage.md.Fo9SdFjd.lean.js} +29 -29
- package/docs/docs/.vitepress/dist/hashmap.json +1 -1
- package/docs/docs/.vitepress/dist/index.html +3 -3
- package/docs/docs/.vitepress/dist/pages/advanced-usage.html +3 -3
- package/docs/docs/.vitepress/dist/pages/api.html +3 -3
- package/docs/docs/.vitepress/dist/pages/browse-code.html +6 -6
- package/docs/docs/.vitepress/dist/pages/getting-started.html +6 -6
- package/docs/docs/.vitepress/dist/pages/guidelines.html +5 -5
- package/docs/docs/.vitepress/dist/pages/how-it-works.html +6 -6
- package/docs/docs/.vitepress/dist/pages/how-its-made.html +3 -3
- package/docs/docs/.vitepress/dist/pages/introduction.html +3 -3
- package/docs/docs/.vitepress/dist/pages/usage.html +32 -32
- package/docs/docs/pages/guidelines.md +1 -1
- package/docs/docs/pages/usage.md +7 -7
- package/package.json +1 -1
- package/docs/docs/.vitepress/dist/assets/chunks/@localSearchIndexroot.yrRWVEzw.js +0 -1
- /package/docs/docs/.vitepress/dist/assets/{pages_browse-code.md.D-gTrMhG.lean.js → pages_browse-code.md.d01mQ5OL.lean.js} +0 -0
- /package/docs/docs/.vitepress/dist/assets/{pages_getting-started.md.COvbcFGT.lean.js → pages_getting-started.md.g77_aCnX.lean.js} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import{d as s,c as i,o as a,a5 as n}from"./chunks/framework.CvEKxEoK.js";const p=n(`<h1 id="how-it-works" tabindex="-1">How it works? <a class="header-anchor" href="#how-it-works" aria-label="Permalink to "How it works?""></a></h1><h2 id="what-ivue-is-not" tabindex="-1">What ivue is NOT? <a class="header-anchor" href="#what-ivue-is-not" aria-label="Permalink to "What ivue is NOT?""></a></h2><p>To understand how ivue works and how it does it, it is important to understand what it does not do.</p><div class="info custom-block"><p class="custom-block-title"><code>ivue</code> is different from other class based libraries</p><p>— <code>ivue</code> does NOT inherit from a base Class.<br> — <code>ivue</code> does NOT use Decorators to achieve its objectives.<br> — <code>ivue</code> does NOT alter Vue 3 underlying behavior, but rather relies on it.<br> — <code>ivue</code> is NOT the same as Class Components (though you can build components with it).<br> — <code>ivue</code> aims to be opaque, by giving the developer the Class API reactivity system.<br> — <code>ivue</code> omits custom implementations of IOC Container, Decorators & Mixins, etc. by design.<br> — <code>ivue</code> enforces a sane default standard of operation to contain the ever flexible Class API.<br></p></div><div class="tip custom-block"><p class="custom-block-title">IVUE IMPLEMENTS MINIMAL API ARCHITECTURE</p><p>Things like IOC Container, Decorators, Traits, Mixins, etc. were omitted by design to slim down the surface area and scope of <code>ivue</code> core purpose, which was JavaScript / TypeScript Class API based reactivity. Any Traits, Decorators & IOC Container can be built around it using third-party libraries or roll your own systems. You are more than welcome to contribute in this area!</p></div><h2 id="how-it-works-1" tabindex="-1">How it works? <a class="header-anchor" href="#how-it-works-1" aria-label="Permalink to "How it works?""></a></h2><div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> ivue</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"><</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">T</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> extends</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> AnyClass</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">>(</span></span>
|
|
2
2
|
<span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;"> className</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> T</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
3
3
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> ...</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">args</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> InferredArgs</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"><</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">T</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">></span></span>
|
|
4
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> IVue</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"><</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">T</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">>;</span></span></code></pre></div><p>The main <code>ivue()</code> initializer function uses TypeScript to be able to infer and validate the constrcutor argument types of <code>AnyClass</code> and passes those arguments to the constructor of <code>AnyClass</code>.</p><p><code>ivue</code> allows you to pass any number of arguments into the class <code>constructor(arg1, arg2, arg3, ...etc)</code></p><p><code>ivue()</code> initializer function returns an extended Vue 3 <code>reactive()</code> object in which getters and setters are internally converted to computeds and adds <code>.toRefs()</code> method to the created object. Computeds auto-unwrap themselves when they are accessed as a reactive object property, so the <code>.value</code> properties and computeds get flattened in the resulting object and do not require <code>.value</code> to be accessed.</p><p><code>ivue</code> replicates native JavaScript / TypeScript class implementation by extending descriptors (getters and setters) up the whole prototype ancestors chain thus supporting classical inheritance.</p><p><code>ivue</code> aims to be opaque and minimal, just doing the minimum to convert a class to a reactive object, leaving the rest to be implemented using Vue 3 Composition API inside an initializer function called <code>.init()</code></p><h2 id="usage-recommendation" tabindex="-1">Usage Recommendation <a class="header-anchor" href="#usage-recommendation" aria-label="Permalink to "Usage Recommendation""></a></h2><p><code>ivue</code> recommends all class properties to be defined as <code>ref()</code> to be able to interoperate with <code>defineExpose()</code>, if you simply pass reactive props which are not Refs through <code>defineExpose()</code>, they will lose reactivity. <code>ref()</code> refs just like computed refs get flattened into the <code>reactive()</code> object, so there is no need to worry about using <code>.value</code>. The <code>ref()</code> refs are necessary just internally for Vue 3 to know which refs to keep reactive, and we just convert the types back to their normal types as if they have no reactivity at all, so <code>Ref<number></code> is <code>number</code> in <code>ivue</code>, so rather than going in the direction of complexifying the types, we are going in the opposite direction towards simplification.</p><p><code>ivue</code> recommends all class functions, getters and setters to be defined in plain full function style (not arrow functions), this allows all <code>ivue</code> classes to be extensible at any point. By using plain standard functions, getters and setters allows for any getter, setter, function or property to be overriden by extending this class. Arrow functions break full extensibility of classes, so avoid using them inside of classes.</p><p>See: <a href="/ivue/pages/guidelines.html">More Guidelines</a></p><h2 id="minimal-api-surface-area" tabindex="-1">Minimal API Surface Area <a class="header-anchor" href="#minimal-api-surface-area" aria-label="Permalink to "Minimal API Surface Area""></a></h2><p><code>ivue()</code> initializer function is the main core function to initialize the <code>ivue</code> reactive object<br><code>iref()</code> ref initializer instantiates the Ref but Unwraps its type as the raw type of the Ref<br><code>iuse()</code> function converts the type of composables to they Unwraped raw types<br><code>.init()</code> method helps initialize the reactive state like <code>watch</code>, <code>onMount</code>, etc.<br><code>.toRefs()</code> method allows to interoperate with Vue 3 Composables<br> Utility Types help to achieve the rest of <code>ivue</code> capabilities</p><details class="details custom-block"><summary>Click to see the whole latest <code>ivue</code> source code from github main branch below:</summary><div class="vp-code-group vp-adaptive-theme"><div class="tabs"><input type="radio" name="group-
|
|
4
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">:</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> IVue</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"><</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">T</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">>;</span></span></code></pre></div><p>The main <code>ivue()</code> initializer function uses TypeScript to be able to infer and validate the constrcutor argument types of <code>AnyClass</code> and passes those arguments to the constructor of <code>AnyClass</code>.</p><p><code>ivue</code> allows you to pass any number of arguments into the class <code>constructor(arg1, arg2, arg3, ...etc)</code></p><p><code>ivue()</code> initializer function returns an extended Vue 3 <code>reactive()</code> object in which getters and setters are internally converted to computeds and adds <code>.toRefs()</code> method to the created object. Computeds auto-unwrap themselves when they are accessed as a reactive object property, so the <code>.value</code> properties and computeds get flattened in the resulting object and do not require <code>.value</code> to be accessed.</p><p><code>ivue</code> replicates native JavaScript / TypeScript class implementation by extending descriptors (getters and setters) up the whole prototype ancestors chain thus supporting classical inheritance.</p><p><code>ivue</code> aims to be opaque and minimal, just doing the minimum to convert a class to a reactive object, leaving the rest to be implemented using Vue 3 Composition API inside an initializer function called <code>.init()</code></p><h2 id="usage-recommendation" tabindex="-1">Usage Recommendation <a class="header-anchor" href="#usage-recommendation" aria-label="Permalink to "Usage Recommendation""></a></h2><p><code>ivue</code> recommends all class properties to be defined as <code>ref()</code> to be able to interoperate with <code>defineExpose()</code>, if you simply pass reactive props which are not Refs through <code>defineExpose()</code>, they will lose reactivity. <code>ref()</code> refs just like computed refs get flattened into the <code>reactive()</code> object, so there is no need to worry about using <code>.value</code>. The <code>ref()</code> refs are necessary just internally for Vue 3 to know which refs to keep reactive, and we just convert the types back to their normal types as if they have no reactivity at all, so <code>Ref<number></code> is <code>number</code> in <code>ivue</code>, so rather than going in the direction of complexifying the types, we are going in the opposite direction towards simplification.</p><p><code>ivue</code> recommends all class functions, getters and setters to be defined in plain full function style (not arrow functions), this allows all <code>ivue</code> classes to be extensible at any point. By using plain standard functions, getters and setters allows for any getter, setter, function or property to be overriden by extending this class. Arrow functions break full extensibility of classes, so avoid using them inside of classes.</p><p>See: <a href="/ivue/pages/guidelines.html">More Guidelines</a></p><h2 id="minimal-api-surface-area" tabindex="-1">Minimal API Surface Area <a class="header-anchor" href="#minimal-api-surface-area" aria-label="Permalink to "Minimal API Surface Area""></a></h2><p><code>ivue()</code> initializer function is the main core function to initialize the <code>ivue</code> reactive object<br><code>iref()</code> ref initializer instantiates the Ref but Unwraps its type as the raw type of the Ref<br><code>iuse()</code> function converts the type of composables to they Unwraped raw types<br><code>.init()</code> method helps initialize the reactive state like <code>watch</code>, <code>onMount</code>, etc.<br><code>.toRefs()</code> method allows to interoperate with Vue 3 Composables<br> Utility Types help to achieve the rest of <code>ivue</code> capabilities</p><details class="details custom-block"><summary>Click to see the whole latest <code>ivue</code> source code from github main branch below:</summary><div class="vp-code-group vp-adaptive-theme"><div class="tabs"><input type="radio" name="group-2ZTbG" id="tab-5_JnvII" checked><label for="tab-5_JnvII">ivue.ts</label></div><div class="blocks"><div class="language-ts vp-adaptive-theme active line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">/* eslint-disable @typescript-eslint/ban-types */</span></span>
|
|
5
5
|
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">/* eslint-disable @typescript-eslint/no-explicit-any */</span></span>
|
|
6
6
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { ComputedRef, ExtractPropTypes, Ref, ToRef } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 'vue'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
|
|
7
7
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { computed, reactive, ref, toRef } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 'vue'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>
|
|
@@ -21,7 +21,7 @@ import{d as s,c as i,o as a,a5 as n}from"./chunks/framework.CvEKxEoK.js";const p
|
|
|
21
21
|
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span>
|
|
22
22
|
<span class="line"></span>
|
|
23
23
|
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">/**</span></span>
|
|
24
|
-
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> *
|
|
24
|
+
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> * Type definition for \`.toRefs()\` method converts reactive class properties to composable .value properties.</span></span>
|
|
25
25
|
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> * But if unwrap = true is specified, the refs will be unwrapped refs available to be merged with the the root class properties.</span></span>
|
|
26
26
|
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> */</span></span>
|
|
27
27
|
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> interface</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> IVueToRefsFn</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"><</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">T</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> extends</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> AnyClass</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">> {</span></span>
|