ivue 1.0.2 → 1.0.4

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.
Files changed (114) hide show
  1. package/.idea/codeStyles/Project.xml +65 -0
  2. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  3. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  4. package/.idea/ivue.iml +8 -0
  5. package/.idea/modules.xml +8 -0
  6. package/.idea/php.xml +19 -0
  7. package/.idea/vcs.xml +6 -0
  8. package/README.md +23 -7
  9. package/coverage/clover.xml +159 -159
  10. package/coverage/coverage-final.json +1 -1
  11. package/coverage/index.html +17 -17
  12. package/coverage/index.ts.html +86 -107
  13. package/dist/index.es.js +74 -90
  14. package/dist/index.umd.js +1 -1
  15. package/dist/src/index.d.ts +1 -196
  16. package/dist/src/ivue.d.ts +218 -0
  17. package/docs/docs/.vitepress/config.ts +110 -22
  18. package/docs/docs/.vitepress/dist/404.html +4 -4
  19. package/docs/docs/.vitepress/dist/api/ivue.html +8 -8
  20. package/docs/docs/.vitepress/dist/api/propsWithDefaults.html +8 -8
  21. package/docs/docs/.vitepress/dist/assets/{api_ivue.md.BCZ4q_0D.js → api_ivue.md.MRwb9Lcb.js} +1 -1
  22. package/docs/docs/.vitepress/dist/assets/{api_ivue.md.BCZ4q_0D.lean.js → api_ivue.md.MRwb9Lcb.lean.js} +1 -1
  23. package/docs/docs/.vitepress/dist/assets/{api_propsWithDefaults.md.Cr5FwI9o.lean.js → api_propsWithDefaults.md.CeE4IC-K.js} +1 -1
  24. package/docs/docs/.vitepress/dist/assets/{api_propsWithDefaults.md.Cr5FwI9o.js → api_propsWithDefaults.md.CeE4IC-K.lean.js} +1 -1
  25. package/docs/docs/.vitepress/dist/assets/{app.DRiljpSE.js → app.ConZRsN0.js} +1 -1
  26. package/docs/docs/.vitepress/dist/assets/chunks/@localSearchIndexroot.CGLWArGd.js +1 -0
  27. package/docs/docs/.vitepress/dist/assets/chunks/Button.vue_vue_type_script_setup_true_lang.P7niV-n8.js +1 -0
  28. package/docs/docs/.vitepress/dist/assets/chunks/VPLocalSearchBox.C7VDyivS.js +7 -0
  29. package/docs/docs/.vitepress/dist/assets/chunks/framework.CNtPHGsN.js +1 -0
  30. package/docs/docs/.vitepress/dist/assets/chunks/index.es.DnWLDAUc.js +1 -0
  31. package/docs/docs/.vitepress/dist/assets/chunks/theme.B7n-r1TY.js +2 -0
  32. package/docs/docs/.vitepress/dist/assets/index.md.wPLoTLBY.js +1 -0
  33. package/docs/docs/.vitepress/dist/assets/index.md.wPLoTLBY.lean.js +1 -0
  34. package/docs/docs/.vitepress/dist/assets/pages_advanced-usage.md.BZgX-VP7.js +1 -0
  35. package/docs/docs/.vitepress/dist/assets/pages_advanced-usage.md.BZgX-VP7.lean.js +1 -0
  36. package/docs/docs/.vitepress/dist/assets/pages_api.md.C_PvCZns.js +7 -0
  37. package/docs/docs/.vitepress/dist/assets/pages_api.md.C_PvCZns.lean.js +7 -0
  38. package/docs/docs/.vitepress/dist/assets/pages_browse-code.md.CPluoaap.js +1 -0
  39. package/docs/docs/.vitepress/dist/assets/pages_browse-code.md.CPluoaap.lean.js +1 -0
  40. package/docs/docs/.vitepress/dist/assets/pages_getting-started.md.knQcOZyP.js +8 -0
  41. package/docs/docs/.vitepress/dist/assets/pages_getting-started.md.knQcOZyP.lean.js +1 -0
  42. package/docs/docs/.vitepress/dist/assets/pages_guidelines.md.DddPdPom.js +101 -0
  43. package/docs/docs/.vitepress/dist/assets/pages_guidelines.md.DddPdPom.lean.js +101 -0
  44. package/docs/docs/.vitepress/dist/assets/pages_how-it-works.md.OJGcGEXF.js +4 -0
  45. package/docs/docs/.vitepress/dist/assets/pages_how-it-works.md.OJGcGEXF.lean.js +4 -0
  46. package/docs/docs/.vitepress/dist/assets/pages_how-its-made.md.Vv9Z9TEi.js +1 -0
  47. package/docs/docs/.vitepress/dist/assets/pages_how-its-made.md.Vv9Z9TEi.lean.js +1 -0
  48. package/docs/docs/.vitepress/dist/assets/pages_introduction.md.DrDm-R8F.js +1 -0
  49. package/docs/docs/.vitepress/dist/assets/pages_introduction.md.DrDm-R8F.lean.js +1 -0
  50. package/docs/docs/.vitepress/dist/assets/pages_usage.md.zSOVjtFF.js +430 -0
  51. package/docs/docs/.vitepress/dist/assets/pages_usage.md.zSOVjtFF.lean.js +430 -0
  52. package/docs/docs/.vitepress/dist/assets/style.Fgx7OB_D.css +1 -0
  53. package/docs/docs/.vitepress/dist/hashmap.json +1 -1
  54. package/docs/docs/.vitepress/dist/index.html +9 -8
  55. package/docs/docs/.vitepress/dist/pages/advanced-usage.html +24 -0
  56. package/docs/docs/.vitepress/dist/pages/api.html +30 -0
  57. package/docs/docs/.vitepress/dist/pages/browse-code.html +24 -0
  58. package/docs/docs/.vitepress/dist/pages/getting-started.html +11 -11
  59. package/docs/docs/.vitepress/dist/pages/guidelines.html +125 -0
  60. package/docs/docs/.vitepress/dist/pages/how-it-works.html +11 -8
  61. package/docs/docs/.vitepress/dist/pages/how-its-made.html +24 -0
  62. package/docs/docs/.vitepress/dist/pages/introduction.html +9 -8
  63. package/docs/docs/.vitepress/dist/pages/usage.html +428 -14
  64. package/docs/docs/.vitepress/theme/index.js +5 -0
  65. package/docs/docs/.vitepress/theme/main.css +29 -0
  66. package/docs/docs/components/Button.vue +1 -1
  67. package/docs/docs/components/guidelines/CounterExternalRefsDetailed.vue +41 -0
  68. package/docs/docs/components/usage/CounterBasic.vue +17 -0
  69. package/docs/docs/components/usage/CounterComposables.vue +19 -0
  70. package/docs/docs/components/usage/CounterComposablesDestructuring.vue +46 -0
  71. package/docs/docs/components/usage/CounterComputeds.vue +25 -0
  72. package/docs/docs/components/usage/CounterComputedsDisabled.vue +32 -0
  73. package/docs/docs/components/usage/CounterDefineExpose.vue +12 -0
  74. package/docs/docs/components/usage/CounterDefineExposeAdvanced.vue +25 -0
  75. package/docs/docs/components/usage/CounterDefineExposeClass.ts +11 -0
  76. package/docs/docs/components/usage/CounterExternalRefs.vue +25 -0
  77. package/docs/docs/components/usage/CounterInsideComposables.vue +27 -0
  78. package/docs/docs/components/usage/CounterInternalRefs.vue +26 -0
  79. package/docs/docs/components/usage/CounterLifecycleHooks.vue +22 -0
  80. package/docs/docs/components/usage/CounterWatch.vue +25 -0
  81. package/docs/docs/components/usage/CounterWithProps.vue +29 -0
  82. package/docs/docs/components/usage/CounterWithPropsAndEmits.vue +36 -0
  83. package/docs/docs/components/usage/functions/useMouse.ts +22 -0
  84. package/docs/docs/index.md +10 -9
  85. package/docs/docs/pages/advanced-usage.md +11 -0
  86. package/docs/docs/pages/api.md +106 -0
  87. package/docs/docs/pages/browse-code.md +18 -0
  88. package/docs/docs/pages/getting-started.md +23 -5
  89. package/docs/docs/pages/guidelines.md +128 -0
  90. package/docs/docs/pages/how-it-works.md +71 -0
  91. package/docs/docs/pages/how-its-made.md +32 -0
  92. package/docs/docs/pages/introduction.md +37 -20
  93. package/docs/docs/pages/usage.md +347 -10
  94. package/docs/package.json +4 -3
  95. package/package.json +4 -2
  96. package/src/__tests__/ivue.vitest.spec.ts +228 -132
  97. package/src/index.ts +1 -463
  98. package/src/ivue.ts +495 -0
  99. package/vite.config.ts +4 -0
  100. package/docs/.env +0 -1
  101. package/docs/docs/.vitepress/dist/assets/chunks/framework.CEhE-9HF.js +0 -1
  102. package/docs/docs/.vitepress/dist/assets/chunks/theme.CldUEgAJ.js +0 -1
  103. package/docs/docs/.vitepress/dist/assets/index.md.B1vDz5mb.js +0 -1
  104. package/docs/docs/.vitepress/dist/assets/index.md.B1vDz5mb.lean.js +0 -1
  105. package/docs/docs/.vitepress/dist/assets/pages_getting-started.md.C7qtPEWU.js +0 -8
  106. package/docs/docs/.vitepress/dist/assets/pages_getting-started.md.C7qtPEWU.lean.js +0 -1
  107. package/docs/docs/.vitepress/dist/assets/pages_how-it-works.md.DKizt6Ny.js +0 -1
  108. package/docs/docs/.vitepress/dist/assets/pages_how-it-works.md.DKizt6Ny.lean.js +0 -1
  109. package/docs/docs/.vitepress/dist/assets/pages_introduction.md.Dkqu-XCz.js +0 -1
  110. package/docs/docs/.vitepress/dist/assets/pages_introduction.md.Dkqu-XCz.lean.js +0 -1
  111. package/docs/docs/.vitepress/dist/assets/pages_usage.md.qo7ICfLC.js +0 -17
  112. package/docs/docs/.vitepress/dist/assets/pages_usage.md.qo7ICfLC.lean.js +0 -17
  113. package/docs/docs/.vitepress/dist/assets/style.BSZVsGuP.css +0 -1
  114. package/docs/docs/components/examples/Counter.vue +0 -17
@@ -23,30 +23,30 @@
23
23
  <div class='clearfix'>
24
24
 
25
25
  <div class='fl pad1y space-right2'>
26
- <span class="strong">85% </span>
26
+ <span class="strong">100% </span>
27
27
  <span class="quiet">Statements</span>
28
- <span class='fraction'>136/160</span>
28
+ <span class='fraction'>160/160</span>
29
29
  </div>
30
30
 
31
31
 
32
32
  <div class='fl pad1y space-right2'>
33
33
  <span class="strong">100% </span>
34
34
  <span class="quiet">Branches</span>
35
- <span class='fraction'>55/55</span>
35
+ <span class='fraction'>71/71</span>
36
36
  </div>
37
37
 
38
38
 
39
39
  <div class='fl pad1y space-right2'>
40
- <span class="strong">75% </span>
40
+ <span class="strong">100% </span>
41
41
  <span class="quiet">Functions</span>
42
- <span class='fraction'>6/8</span>
42
+ <span class='fraction'>10/10</span>
43
43
  </div>
44
44
 
45
45
 
46
46
  <div class='fl pad1y space-right2'>
47
- <span class="strong">85% </span>
47
+ <span class="strong">100% </span>
48
48
  <span class="quiet">Lines</span>
49
- <span class='fraction'>136/160</span>
49
+ <span class='fraction'>160/160</span>
50
50
  </div>
51
51
 
52
52
 
@@ -519,19 +519,7 @@
519
519
  <a name='L454'></a><a href='#L454'>454</a>
520
520
  <a name='L455'></a><a href='#L455'>455</a>
521
521
  <a name='L456'></a><a href='#L456'>456</a>
522
- <a name='L457'></a><a href='#L457'>457</a>
523
- <a name='L458'></a><a href='#L458'>458</a>
524
- <a name='L459'></a><a href='#L459'>459</a>
525
- <a name='L460'></a><a href='#L460'>460</a>
526
- <a name='L461'></a><a href='#L461'>461</a>
527
- <a name='L462'></a><a href='#L462'>462</a>
528
- <a name='L463'></a><a href='#L463'>463</a>
529
- <a name='L464'></a><a href='#L464'>464</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
530
- <span class="cline-any cline-neutral">&nbsp;</span>
531
- <span class="cline-any cline-neutral">&nbsp;</span>
532
- <span class="cline-any cline-neutral">&nbsp;</span>
533
- <span class="cline-any cline-neutral">&nbsp;</span>
534
- <span class="cline-any cline-neutral">&nbsp;</span>
522
+ <a name='L457'></a><a href='#L457'>457</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
535
523
  <span class="cline-any cline-neutral">&nbsp;</span>
536
524
  <span class="cline-any cline-neutral">&nbsp;</span>
537
525
  <span class="cline-any cline-yes">1x</span>
@@ -667,8 +655,6 @@
667
655
  <span class="cline-any cline-neutral">&nbsp;</span>
668
656
  <span class="cline-any cline-neutral">&nbsp;</span>
669
657
  <span class="cline-any cline-neutral">&nbsp;</span>
670
- <span class="cline-any cline-neutral">&nbsp;</span>
671
- <span class="cline-any cline-neutral">&nbsp;</span>
672
658
  <span class="cline-any cline-yes">1x</span>
673
659
  <span class="cline-any cline-neutral">&nbsp;</span>
674
660
  <span class="cline-any cline-neutral">&nbsp;</span>
@@ -930,19 +916,22 @@
930
916
  <span class="cline-any cline-neutral">&nbsp;</span>
931
917
  <span class="cline-any cline-neutral">&nbsp;</span>
932
918
  <span class="cline-any cline-neutral">&nbsp;</span>
919
+ <span class="cline-any cline-yes">1x</span>
920
+ <span class="cline-any cline-yes">14x</span>
921
+ <span class="cline-any cline-neutral">&nbsp;</span>
922
+ <span class="cline-any cline-yes">14x</span>
923
+ <span class="cline-any cline-neutral">&nbsp;</span>
924
+ <span class="cline-any cline-neutral">&nbsp;</span>
925
+ <span class="cline-any cline-yes">14x</span>
933
926
  <span class="cline-any cline-neutral">&nbsp;</span>
934
927
  <span class="cline-any cline-yes">1x</span>
935
- <span class="cline-any cline-no">&nbsp;</span>
928
+ <span class="cline-any cline-yes">14x</span>
929
+ <span class="cline-any cline-yes">3x</span>
930
+ <span class="cline-any cline-yes">3x</span>
931
+ <span class="cline-any cline-yes">14x</span>
936
932
  <span class="cline-any cline-neutral">&nbsp;</span>
937
- <span class="cline-any cline-no">&nbsp;</span>
938
933
  <span class="cline-any cline-neutral">&nbsp;</span>
939
934
  <span class="cline-any cline-neutral">&nbsp;</span>
940
- <span class="cline-any cline-no">&nbsp;</span>
941
- <span class="cline-any cline-no">&nbsp;</span>
942
- <span class="cline-any cline-no">&nbsp;</span>
943
- <span class="cline-any cline-no">&nbsp;</span>
944
- <span class="cline-any cline-no">&nbsp;</span>
945
- <span class="cline-any cline-no">&nbsp;</span>
946
935
  <span class="cline-any cline-neutral">&nbsp;</span>
947
936
  <span class="cline-any cline-neutral">&nbsp;</span>
948
937
  <span class="cline-any cline-neutral">&nbsp;</span>
@@ -966,41 +955,33 @@
966
955
  <span class="cline-any cline-neutral">&nbsp;</span>
967
956
  <span class="cline-any cline-neutral">&nbsp;</span>
968
957
  <span class="cline-any cline-neutral">&nbsp;</span>
958
+ <span class="cline-any cline-yes">1x</span>
959
+ <span class="cline-any cline-yes">1x</span>
960
+ <span class="cline-any cline-yes">1x</span>
961
+ <span class="cline-any cline-yes">1x</span>
962
+ <span class="cline-any cline-yes">1x</span>
963
+ <span class="cline-any cline-yes">8x</span>
969
964
  <span class="cline-any cline-neutral">&nbsp;</span>
965
+ <span class="cline-any cline-yes">2x</span>
966
+ <span class="cline-any cline-yes">8x</span>
967
+ <span class="cline-any cline-yes">6x</span>
970
968
  <span class="cline-any cline-neutral">&nbsp;</span>
969
+ <span class="cline-any cline-yes">1x</span>
970
+ <span class="cline-any cline-yes">6x</span>
971
971
  <span class="cline-any cline-neutral">&nbsp;</span>
972
+ <span class="cline-any cline-yes">5x</span>
973
+ <span class="cline-any cline-yes">5x</span>
974
+ <span class="cline-any cline-yes">6x</span>
975
+ <span class="cline-any cline-yes">8x</span>
976
+ <span class="cline-any cline-yes">1x</span>
972
977
  <span class="cline-any cline-yes">1x</span>
973
- <span class="cline-any cline-no">&nbsp;</span>
974
- <span class="cline-any cline-no">&nbsp;</span>
975
- <span class="cline-any cline-no">&nbsp;</span>
976
- <span class="cline-any cline-no">&nbsp;</span>
977
- <span class="cline-any cline-no">&nbsp;</span>
978
- <span class="cline-any cline-neutral">&nbsp;</span>
979
- <span class="cline-any cline-no">&nbsp;</span>
980
- <span class="cline-any cline-no">&nbsp;</span>
981
- <span class="cline-any cline-no">&nbsp;</span>
982
- <span class="cline-any cline-neutral">&nbsp;</span>
983
- <span class="cline-any cline-no">&nbsp;</span>
984
- <span class="cline-any cline-no">&nbsp;</span>
985
- <span class="cline-any cline-neutral">&nbsp;</span>
986
- <span class="cline-any cline-no">&nbsp;</span>
987
- <span class="cline-any cline-no">&nbsp;</span>
988
- <span class="cline-any cline-no">&nbsp;</span>
989
- <span class="cline-any cline-no">&nbsp;</span>
990
- <span class="cline-any cline-no">&nbsp;</span>
991
- <span class="cline-any cline-no">&nbsp;</span>
992
978
  <span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">/* eslint-disable @typescript-eslint/ban-types */
993
979
  /* eslint-disable @typescript-eslint/no-explicit-any */
994
- import type {
995
- ComputedRef,
996
- ExtractPropTypes,
997
- ToRef,
998
- UnwrapNestedRefs,
999
- } from 'vue';
1000
- import { computed, reactive, toRef } from 'vue';
980
+ import type { ComputedRef, ExtractPropTypes, Ref, ToRef } from 'vue';
981
+ import { UnwrapRef, computed, reactive, toRef } from 'vue';
1001
982
  &nbsp;
1002
983
  /** Types */
1003
- /**
984
+ /**
1004
985
  * IVue core reactive instance type with an extended .toRefs() method added.
1005
986
  */
1006
987
  export type IVue&lt;T extends AnyClass&gt; = InstanceType&lt;T&gt; &amp; ExtendWithToRefs&lt;T&gt;;
@@ -1030,8 +1011,13 @@ export type IVueToRefsFnReturn&lt;T = any&gt; = {
1030
1011
  /**
1031
1012
  * Unwraps the returned Refs of composable method T to a reactive type definition.
1032
1013
  */
1033
- export type UnwrapComposable&lt;T extends (...args: any[]) =&gt; any&gt; =
1034
- UnwrapNestedRefs&lt;ReturnType&lt;T&gt;&gt;;
1014
+ export type UnwrapComposable&lt;T extends (...args: any[]) =&gt; any&gt; = {
1015
+ [K in keyof ReturnType&lt;T&gt;]: UnwrapRef&lt;ReturnType&lt;T&gt;&gt;[K] extends Function
1016
+ ? UnwrapRef&lt;ReturnType&lt;T&gt;&gt;[K] // Handle function
1017
+ : UnwrapRef&lt;ReturnType&lt;T&gt;&gt;[K] extends Ref
1018
+ ? UnwrapRef&lt;ReturnType&lt;T&gt;&gt;[K]['value']
1019
+ : UnwrapRef&lt;ReturnType&lt;T&gt;&gt;[K]; // Handle property
1020
+ };
1035
1021
  &nbsp;
1036
1022
  /**
1037
1023
  * Extracts object defined emit types by converting them to a plain interface
@@ -1046,7 +1032,9 @@ export type ExtractEmitTypes&lt;T extends Record&lt;string, any&gt;&gt; =
1046
1032
  /**
1047
1033
  * Extract properties as all assigned properties because they have defaults.
1048
1034
  */
1049
- export type ExtractPropDefaultTypes&lt;O&gt; = RequiredProperties&lt;O&gt;;
1035
+ export type ExtractPropDefaultTypes&lt;O&gt; = {
1036
+ [K in keyof O]: ValueOf&lt;ExtractPropTypes&lt;O&gt;, K&gt;;
1037
+ };
1050
1038
  &nbsp;
1051
1039
  /**
1052
1040
  * Extend slots interface T with prefixed 'before--' &amp; 'after--' slots to create fully extensible flexible slots.
@@ -1113,15 +1101,6 @@ export type UnionToIntersection&lt;U&gt; = (
1113
1101
  */
1114
1102
  export type RecordToUnion&lt;T extends Record&lt;string, any&gt;&gt; = T[keyof T];
1115
1103
  &nbsp;
1116
- /**
1117
- * Required Properties converts an interface with possible
1118
- * optionally assigned properties like: { optional?: any; }
1119
- * to a definitevely defined interface.
1120
- */
1121
- export type RequiredProperties&lt;O&gt; = {
1122
- [K in keyof O]: ValueOf&lt;ExtractPropTypes&lt;O&gt;, K&gt;;
1123
- };
1124
- &nbsp;
1125
1104
  /**
1126
1105
  * Gets object T property by key [K].
1127
1106
  */
@@ -1367,7 +1346,6 @@ export function ivueToRefs&lt;T extends AnyClass&gt;(
1367
1346
  };
1368
1347
  }
1369
1348
  &nbsp;
1370
- &nbsp;
1371
1349
  /**
1372
1350
  * Vue props interface in defineComponent() style.
1373
1351
  */
@@ -1390,32 +1368,33 @@ export type VuePropsWithDefaults&lt;T extends VuePropsObject&gt; = {
1390
1368
  /**
1391
1369
  * Determines if the value is a JavaScript Class.
1392
1370
  * Note that class is a class function in JavaScript.
1393
- *
1371
+ *
1394
1372
  * @param val Any value
1395
1373
  * @returns boolean If it's a JavaScript Class returns true
1396
1374
  */
1397
- export <span class="fstat-no" title="function not covered" >function isClass(val: any): boolean {</span>
1398
- <span class="cstat-no" title="statement not covered" > if (typeof val !== 'function') return false; // Not a function, so not a class function either</span>
1375
+ export function isClass(val: any): boolean {
1376
+ if (typeof val !== 'function') return false; // Not a function, so not a class function either
1399
1377
  &nbsp;
1400
- <span class="cstat-no" title="statement not covered" > if (!val.prototype) return false; // Arrow function, so not a class</span>
1378
+ if (!val.prototype) return false; // Arrow function, so not a class
1401
1379
  &nbsp;
1402
1380
  // Finally -&gt; distinguish between a normal function and a class function
1403
- <span class="cstat-no" title="statement not covered" > if (Object.getOwnPropertyDescriptor(val, 'prototype')?.writable) { // Has writable prototype</span>
1404
- <span class="cstat-no" title="statement not covered" > return false; // Normal function</span>
1405
- <span class="cstat-no" title="statement not covered" > } else {</span>
1406
- <span class="cstat-no" title="statement not covered" > return true; // Class -&gt; Not a function</span>
1407
- <span class="cstat-no" title="statement not covered" > }</span>
1408
- <span class="cstat-no" title="statement not covered" >}</span>
1381
+ if (Object.getOwnPropertyDescriptor(val, 'prototype')?.writable) {
1382
+ // Has writable prototype
1383
+ return false; // Normal function
1384
+ } else {
1385
+ return true; // Class -&gt; Not a function
1386
+ }
1387
+ }
1409
1388
  &nbsp;
1410
1389
  /**
1411
1390
  * Creates props with defaults in defineComponent() style.
1412
- *
1413
- * Merge defaults regular object with Vue types object
1391
+ *
1392
+ * Merge defaults regular object with Vue types object
1414
1393
  * declared in defineComponent() style.
1415
- *
1394
+ *
1416
1395
  * This is made so that the defaults can be declared "as they are"
1417
1396
  * without requiring objects to be function callbacks returning an object.
1418
- *
1397
+ *
1419
1398
  * // You don't need to wrap objects in () =&gt; ({ nest: { nest :{} } })
1420
1399
  * // You can just delcare them normally.
1421
1400
  * const defaults = {
@@ -1423,35 +1402,35 @@ export <span class="fstat-no" title="function not covered" >function isClass(val
1423
1402
  * nest
1424
1403
  * }
1425
1404
  * }
1426
- *
1427
- * This function will create the Vue expected callbacks for Objects, Arrays &amp; Classes
1428
- * but leave primitive properties and functions intact so that
1405
+ *
1406
+ * This function will create the Vue expected callbacks for Objects, Arrays &amp; Classes
1407
+ * but leave primitive properties and functions intact so that
1429
1408
  * the final object is fully defineComponent() style compatible.
1430
- *
1409
+ *
1431
1410
  * @param defaults Regular object of default key -&gt; values
1432
1411
  * @param typedProps Props declared in defineComponent() style with type and possibly required declared, but without default
1433
1412
  * @returns Props declared in defineComponent() style with all properties having default property declared.
1434
1413
  */
1435
- export <span class="fstat-no" title="function not covered" >function createPropsWithDefaults&lt;T extends VuePropsObject&gt;(</span>
1436
- <span class="cstat-no" title="statement not covered" > defaults: Record&lt;string, any&gt;,</span>
1437
- <span class="cstat-no" title="statement not covered" > typedProps: T</span>
1438
- <span class="cstat-no" title="statement not covered" >): VuePropsWithDefaults&lt;T&gt; {</span>
1439
- <span class="cstat-no" title="statement not covered" > for (const prop in typedProps) {</span>
1440
- <span class="cstat-no" title="statement not covered" > if (typeof defaults?.[prop] === 'object' &amp;&amp; defaults?.[prop] !== null) {</span>
1441
- /** Handle Arrays &amp; Objects -&gt; wrap them with an arrow function. */
1442
- <span class="cstat-no" title="statement not covered" > typedProps[prop].default = () =&gt; defaults?.[prop];</span>
1443
- <span class="cstat-no" title="statement not covered" > } else {</span>
1444
- <span class="cstat-no" title="statement not covered" > if (isClass(defaults?.[prop])) {</span>
1414
+ export function propsWithDefaults&lt;T extends VuePropsObject&gt;(
1415
+ defaults: Record&lt;string, any&gt;,
1416
+ typedProps: T
1417
+ ): VuePropsWithDefaults&lt;T&gt; {
1418
+ for (const prop in typedProps) {
1419
+ if (typeof defaults?.[prop] === 'object' &amp;&amp; defaults?.[prop] !== null) {
1420
+ /** Handle Arrays &amp; Objects -&gt; wrap them with an arrow function. */
1421
+ typedProps[prop].default = () =&gt; defaults?.[prop];
1422
+ } else {
1423
+ if (isClass(defaults?.[prop])) {
1445
1424
  /** Handle JavaScript Classes -&gt; wrap them with an arrow function */
1446
- <span class="cstat-no" title="statement not covered" > typedProps[prop].default = () =&gt; defaults?.[prop];</span>
1447
- <span class="cstat-no" title="statement not covered" > } else {</span>
1425
+ typedProps[prop].default = () =&gt; defaults?.[prop];
1426
+ } else {
1448
1427
  /** Handle JavaScript Function And All primitive properties -&gt; output directly */
1449
- <span class="cstat-no" title="statement not covered" > typedProps[prop].default = defaults?.[prop];</span>
1450
- <span class="cstat-no" title="statement not covered" > }</span>
1451
- <span class="cstat-no" title="statement not covered" > }</span>
1452
- <span class="cstat-no" title="statement not covered" > }</span>
1453
- <span class="cstat-no" title="statement not covered" > return typedProps as VuePropsWithDefaults&lt;T&gt;;</span>
1454
- <span class="cstat-no" title="statement not covered" >}</span>
1428
+ typedProps[prop].default = defaults?.[prop];
1429
+ }
1430
+ }
1431
+ }
1432
+ return typedProps as VuePropsWithDefaults&lt;T&gt;;
1433
+ }
1455
1434
  &nbsp;</pre></td></tr></table></pre>
1456
1435
 
1457
1436
  <div class='push'></div><!-- for sticky footer -->
@@ -1459,7 +1438,7 @@ export <span class="fstat-no" title="function not covered" >function createProps
1459
1438
  <div class='footer quiet pad2 space-top1 center small'>
1460
1439
  Code coverage generated by
1461
1440
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
1462
- at 2024-08-10T22:45:44.482Z
1441
+ at 2024-08-13T00:42:34.338Z
1463
1442
  </div>
1464
1443
  <script src="prettify.js"></script>
1465
1444
  <script>
package/dist/index.es.js CHANGED
@@ -1,108 +1,92 @@
1
- import { reactive as A, computed as l, toRef as M } from "vue";
2
- const y = /* @__PURE__ */ new Map();
3
- function C(n) {
4
- if (y.has(n))
5
- return y.get(n);
6
- const o = /* @__PURE__ */ new Map();
7
- let t = n.prototype;
1
+ import { reactive as y, computed as g, ref as O, toRef as d } from "vue";
2
+ const l = /* @__PURE__ */ new Map();
3
+ function h(e) {
4
+ if (l.has(e))
5
+ return l.get(e);
6
+ const r = /* @__PURE__ */ new Map();
7
+ let t = e.prototype;
8
8
  for (; t.constructor !== Object; )
9
- Object.entries(Object.getOwnPropertyDescriptors(t)).forEach(
10
- ([O, e]) => {
11
- const f = o.get(O);
12
- f !== e && (e != null && e.get || e != null && e.set) && (f != null && f.get && (e.get = f == null ? void 0 : f.get), f != null && f.set && (e.set = f == null ? void 0 : f.set), o.set(O, e));
13
- }
14
- ), t = Object.getPrototypeOf(t);
15
- return y.set(n, o), o;
9
+ Object.entries(Object.getOwnPropertyDescriptors(t)).forEach(([i, s]) => {
10
+ const n = r.get(i);
11
+ n !== s && (s != null && s.get || s != null && s.set) && (n != null && n.get && (s.get = n == null ? void 0 : n.get), n != null && n.set && (s.set = n == null ? void 0 : n.set), r.set(i, s));
12
+ }), t = Object.getPrototypeOf(t);
13
+ return l.set(e, r), r;
16
14
  }
17
- function x(n, ...o) {
18
- var f, h;
19
- const t = C(n), O = t != null && t.size ? {} : null, e = A(new n(...o));
20
- for (const [g, i] of t)
21
- ((f = n == null ? void 0 : n.ivue) == null ? void 0 : f[g]) !== !1 && Object.defineProperty(e, g, {
22
- get: i.get ? () => {
23
- var b, w;
24
- return g in O ? (
25
- /** Get the existing computed, because we are in reactive scope, .value will auto unwrap itself. */
26
- O[g]
27
- ) : (
28
- /** Create the computed and return it, because we are in reactive scope, .value will auto unwrap itself. */
29
- O[g] = l({
30
- get: (b = i.get) == null ? void 0 : b.bind(e),
31
- set: (w = i.set) == null ? void 0 : w.bind(e)
32
- })
33
- );
34
- } : void 0,
35
- set: (h = i.set) == null ? void 0 : h.bind(e),
36
- enumerable: !1
37
- });
38
- return Object.defineProperty(e, "toRefs", {
39
- get: () => R(e, t, O),
40
- enumerable: !1
41
- }), "init" in e && e.init(), e;
15
+ function v(e, ...r) {
16
+ var n, f;
17
+ const t = h(e), i = t != null && t.size ? {} : null, s = y(new e(...r));
18
+ for (const [c, o] of t)
19
+ ((n = e == null ? void 0 : e.ivue) == null ? void 0 : n[c]) !== !1 && Object.defineProperty(s, c, { get: o.get ? () => {
20
+ var u, a;
21
+ return c in i ? i[c] : i[c] = g({ get: (u = o.get) == null ? void 0 : u.bind(s), set: (a = o.set) == null ? void 0 : a.bind(s) });
22
+ } : void 0, set: (f = o.set) == null ? void 0 : f.bind(s), enumerable: !1 });
23
+ return Object.defineProperty(s, "toRefs", { get: () => w(s, t, i), enumerable: !1 }), "init" in s && s.init(), s;
42
24
  }
43
- const c = /* @__PURE__ */ new Map();
44
- function E(n) {
45
- if (c.has(n.constructor))
46
- return c.get(n.constructor);
47
- const o = n.constructor, t = /* @__PURE__ */ new Set();
25
+ const p = /* @__PURE__ */ new Map();
26
+ function j(e) {
27
+ if (p.has(e.constructor))
28
+ return p.get(e.constructor);
29
+ const r = e.constructor, t = /* @__PURE__ */ new Set();
48
30
  do
49
- Object.getOwnPropertyNames(n).forEach((O) => {
50
- ["caller", "callee", "arguments", "constructor"].includes(O) || t.add(O);
51
- }), n = Object.getPrototypeOf(n);
52
- while (n.constructor !== Object);
53
- return c.set(o, t), t;
31
+ Object.getOwnPropertyNames(e).forEach((i) => {
32
+ ["caller", "callee", "arguments", "constructor"].includes(i) || t.add(i);
33
+ }), e = Object.getPrototypeOf(e);
34
+ while (e.constructor !== Object);
35
+ return p.set(r, t), t;
36
+ }
37
+ function M(e) {
38
+ return O(e);
39
+ }
40
+ function A(e) {
41
+ return e;
54
42
  }
55
- function R(n, o, t) {
56
- return function(O) {
57
- var f, h;
58
- const e = {};
59
- if (Array.isArray(O) && O.length)
60
- for (let g = 0; g < O.length; g++) {
61
- const i = O[g];
62
- if (o.has(i))
63
- if (i in t)
64
- e[i] = t[i];
43
+ function w(e, r, t) {
44
+ return function(i) {
45
+ var n, f;
46
+ const s = {};
47
+ if (Array.isArray(i) && i.length)
48
+ for (let c = 0; c < i.length; c++) {
49
+ const o = i[c];
50
+ if (r.has(o))
51
+ if (o in t)
52
+ s[o] = t[o];
65
53
  else {
66
- const b = o.get(i);
67
- e[i] = t[i] = l({
68
- get: (f = b == null ? void 0 : b.get) == null ? void 0 : f.bind(n),
69
- set: (h = b == null ? void 0 : b.set) == null ? void 0 : h.bind(n)
70
- });
54
+ const u = r.get(o);
55
+ s[o] = t[o] = g({ get: (n = u == null ? void 0 : u.get) == null ? void 0 : n.bind(e), set: (f = u == null ? void 0 : u.set) == null ? void 0 : f.bind(e) });
71
56
  }
72
57
  else
73
- typeof n[i] == "function" ? e[i] = n[i].bind(n) : e[i] = M(n, i);
58
+ typeof e[o] == "function" ? s[o] = e[o].bind(e) : s[o] = d(e, o);
74
59
  }
75
60
  else {
76
- let g = new Set(E(n));
77
- o.forEach((i, b) => {
78
- var w, j;
79
- b in t ? e[b] = t[b] : e[b] = t[b] = l({
80
- get: (w = i.get) == null ? void 0 : w.bind(n),
81
- set: (j = i.set) == null ? void 0 : j.bind(n)
82
- }), g == null || g.delete(b);
83
- }), g.forEach((i) => {
84
- typeof n[i] == "function" ? e[i] = n[i].bind(n) : e[i] = M(n, i), g == null || g.delete(i);
85
- }), g = null;
61
+ let c = new Set(j(e));
62
+ r.forEach((o, u) => {
63
+ var a, b;
64
+ s[u] = u in t ? t[u] : t[u] = g({ get: (a = o.get) == null ? void 0 : a.bind(e), set: (b = o.set) == null ? void 0 : b.bind(e) }), c == null || c.delete(u);
65
+ }), c.forEach((o) => {
66
+ typeof e[o] == "function" ? s[o] = e[o].bind(e) : s[o] = d(e, o);
67
+ }), c = null;
86
68
  }
87
- return e;
69
+ return s;
88
70
  };
89
71
  }
90
- function P(n) {
91
- var o;
92
- return !(typeof n != "function" || !n.prototype || (o = Object.getOwnPropertyDescriptor(n, "prototype")) != null && o.writable);
72
+ function P(e) {
73
+ var r;
74
+ return typeof e == "function" && !!e.prototype && !((r = Object.getOwnPropertyDescriptor(e, "prototype")) != null && r.writable);
93
75
  }
94
- function z(n, o) {
95
- for (const t in o)
96
- typeof (n == null ? void 0 : n[t]) == "object" && (n == null ? void 0 : n[t]) !== null ? o[t].default = () => n == null ? void 0 : n[t] : P(n == null ? void 0 : n[t]) ? o[t].default = () => n == null ? void 0 : n[t] : o[t].default = n == null ? void 0 : n[t];
97
- return o;
76
+ function D(e, r) {
77
+ for (const t in r)
78
+ typeof (e == null ? void 0 : e[t]) == "object" && (e == null ? void 0 : e[t]) !== null || P(e == null ? void 0 : e[t]) ? r[t].default = () => e == null ? void 0 : e[t] : r[t].default = e == null ? void 0 : e[t];
79
+ return r;
98
80
  }
99
81
  export {
100
- y as descriptorsMap,
101
- C as getAllClassDescriptors,
102
- E as getAllClassProperties,
82
+ l as descriptorsMap,
83
+ h as getAllClassDescriptors,
84
+ j as getAllClassProperties,
85
+ M as iref,
103
86
  P as isClass,
104
- x as ivue,
105
- R as ivueToRefs,
106
- c as propsMap,
107
- z as propsWithDefaults
87
+ A as iuse,
88
+ v as ivue,
89
+ w as ivueToRefs,
90
+ p as propsMap,
91
+ D as propsWithDefaults
108
92
  };
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(l,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],h):(l=typeof globalThis<"u"?globalThis:l||self,h(l.ivue={},l.Vue))})(this,function(l,h){"use strict";const w=new Map;function j(n){if(w.has(n))return w.get(n);const f=new Map;let e=n.prototype;for(;e.constructor!==Object;)Object.entries(Object.getOwnPropertyDescriptors(e)).forEach(([c,t])=>{const o=f.get(c);o!==t&&(t!=null&&t.get||t!=null&&t.set)&&(o!=null&&o.get&&(t.get=o==null?void 0:o.get),o!=null&&o.set&&(t.set=o==null?void 0:o.set),f.set(c,t))}),e=Object.getPrototypeOf(e);return w.set(n,f),f}function T(n,...f){var o,y;const e=j(n),c=e!=null&&e.size?{}:null,t=h.reactive(new n(...f));for(const[g,i]of e)((o=n==null?void 0:n.ivue)==null?void 0:o[g])!==!1&&Object.defineProperty(t,g,{get:i.get?()=>{var b,O;return g in c?c[g]:c[g]=h.computed({get:(b=i.get)==null?void 0:b.bind(t),set:(O=i.set)==null?void 0:O.bind(t)})}:void 0,set:(y=i.set)==null?void 0:y.bind(t),enumerable:!1});return Object.defineProperty(t,"toRefs",{get:()=>A(t,e,c),enumerable:!1}),"init"in t&&t.init(),t}const M=new Map;function C(n){if(M.has(n.constructor))return M.get(n.constructor);const f=n.constructor,e=new Set;do Object.getOwnPropertyNames(n).forEach(c=>{["caller","callee","arguments","constructor"].includes(c)||e.add(c)}),n=Object.getPrototypeOf(n);while(n.constructor!==Object);return M.set(f,e),e}function A(n,f,e){return function(c){var o,y;const t={};if(Array.isArray(c)&&c.length)for(let g=0;g<c.length;g++){const i=c[g];if(f.has(i))if(i in e)t[i]=e[i];else{const b=f.get(i);t[i]=e[i]=h.computed({get:(o=b==null?void 0:b.get)==null?void 0:o.bind(n),set:(y=b==null?void 0:b.set)==null?void 0:y.bind(n)})}else typeof n[i]=="function"?t[i]=n[i].bind(n):t[i]=h.toRef(n,i)}else{let g=new Set(C(n));f.forEach((i,b)=>{var O,R;b in e?t[b]=e[b]:t[b]=e[b]=h.computed({get:(O=i.get)==null?void 0:O.bind(n),set:(R=i.set)==null?void 0:R.bind(n)}),g==null||g.delete(b)}),g.forEach(i=>{typeof n[i]=="function"?t[i]=n[i].bind(n):t[i]=h.toRef(n,i),g==null||g.delete(i)}),g=null}return t}}function s(n){var f;return!(typeof n!="function"||!n.prototype||(f=Object.getOwnPropertyDescriptor(n,"prototype"))!=null&&f.writable)}function u(n,f){for(const e in f)typeof(n==null?void 0:n[e])=="object"&&(n==null?void 0:n[e])!==null?f[e].default=()=>n==null?void 0:n[e]:s(n==null?void 0:n[e])?f[e].default=()=>n==null?void 0:n[e]:f[e].default=n==null?void 0:n[e];return f}l.descriptorsMap=w,l.getAllClassDescriptors=j,l.getAllClassProperties=C,l.isClass=s,l.ivue=T,l.ivueToRefs=A,l.propsMap=M,l.propsWithDefaults=u,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
1
+ (function(s,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):l((s=typeof globalThis<"u"?globalThis:s||self).ivue={},s.Vue)})(this,function(s,l){"use strict";const d=new Map;function b(t){if(d.has(t))return d.get(t);const r=new Map;let e=t.prototype;for(;e.constructor!==Object;)Object.entries(Object.getOwnPropertyDescriptors(e)).forEach(([c,o])=>{const i=r.get(c);i!==o&&(o!=null&&o.get||o!=null&&o.set)&&(i!=null&&i.get&&(o.get=i==null?void 0:i.get),i!=null&&i.set&&(o.set=i==null?void 0:i.set),r.set(c,o))}),e=Object.getPrototypeOf(e);return d.set(t,r),r}const g=new Map;function y(t){if(g.has(t.constructor))return g.get(t.constructor);const r=t.constructor,e=new Set;do Object.getOwnPropertyNames(t).forEach(c=>{["caller","callee","arguments","constructor"].includes(c)||e.add(c)}),t=Object.getPrototypeOf(t);while(t.constructor!==Object);return g.set(r,e),e}function O(t,r,e){return function(c){var i,p;const o={};if(Array.isArray(c)&&c.length)for(let u=0;u<c.length;u++){const n=c[u];if(r.has(n))if(n in e)o[n]=e[n];else{const f=r.get(n);o[n]=e[n]=l.computed({get:(i=f==null?void 0:f.get)==null?void 0:i.bind(t),set:(p=f==null?void 0:f.set)==null?void 0:p.bind(t)})}else typeof t[n]=="function"?o[n]=t[n].bind(t):o[n]=l.toRef(t,n)}else{let u=new Set(y(t));r.forEach((n,f)=>{var a,j;o[f]=f in e?e[f]:e[f]=l.computed({get:(a=n.get)==null?void 0:a.bind(t),set:(j=n.set)==null?void 0:j.bind(t)}),u==null||u.delete(f)}),u.forEach(n=>{typeof t[n]=="function"?o[n]=t[n].bind(t):o[n]=l.toRef(t,n)}),u=null}return o}}function h(t){var r;return typeof t=="function"&&!!t.prototype&&!((r=Object.getOwnPropertyDescriptor(t,"prototype"))!=null&&r.writable)}s.descriptorsMap=d,s.getAllClassDescriptors=b,s.getAllClassProperties=y,s.iref=function(t){return l.ref(t)},s.isClass=h,s.iuse=function(t){return t},s.ivue=function(t,...r){var i,p;const e=b(t),c=e!=null&&e.size?{}:null,o=l.reactive(new t(...r));for(const[u,n]of e)((i=t==null?void 0:t.ivue)==null?void 0:i[u])!==!1&&Object.defineProperty(o,u,{get:n.get?()=>{var f,a;return u in c?c[u]:c[u]=l.computed({get:(f=n.get)==null?void 0:f.bind(o),set:(a=n.set)==null?void 0:a.bind(o)})}:void 0,set:(p=n.set)==null?void 0:p.bind(o),enumerable:!1});return Object.defineProperty(o,"toRefs",{get:()=>O(o,e,c),enumerable:!1}),"init"in o&&o.init(),o},s.ivueToRefs=O,s.propsMap=g,s.propsWithDefaults=function(t,r){for(const e in r)typeof(t==null?void 0:t[e])=="object"&&(t==null?void 0:t[e])!==null||h(t==null?void 0:t[e])?r[e].default=()=>t==null?void 0:t[e]:r[e].default=t==null?void 0:t[e];return r},Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});