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
@@ -1,196 +1 @@
1
- import type { ComputedRef, ExtractPropTypes, ToRef, UnwrapNestedRefs } from 'vue';
2
- /** Types */
3
- /**
4
- * IVue core reactive instance type with an extended .toRefs() method added.
5
- */
6
- export declare type IVue<T extends AnyClass> = InstanceType<T> & ExtendWithToRefs<T>;
7
- /**
8
- * Extend with .toRefs() method, so that a reactive class can be converted to a composable definition.
9
- */
10
- export interface ExtendWithToRefs<T extends AnyClass> {
11
- toRefs: IVueToRefsFn<T>;
12
- }
13
- /**
14
- * .toRefs() method type definition converts reactive class properties to composable .value properties.
15
- */
16
- export declare type IVueToRefsFn<T extends AnyClass> = (props?: (keyof InstanceType<T>)[]) => IVueToRefsFnReturn<InstanceType<T>>;
17
- /**
18
- * Converts a class properties to a composable .value Refs using ToRef vue type,
19
- * also knows NOT to convert functions to .value Refs but to leave them as is.
20
- */
21
- export declare type IVueToRefsFnReturn<T = any> = {
22
- [K in keyof T]: T[K] extends Function ? T[K] : ToRef<T[K]>;
23
- };
24
- /**
25
- * Unwraps the returned Refs of composable method T to a reactive type definition.
26
- */
27
- export declare type UnwrapComposable<T extends (...args: any[]) => any> = UnwrapNestedRefs<ReturnType<T>>;
28
- /**
29
- * Extracts object defined emit types by converting them to a plain interface
30
- */
31
- export declare type ExtractEmitTypes<T extends Record<string, any>> = UnionToIntersection<RecordToUnion<{
32
- [K in keyof T]: (evt: K, ...args: Parameters<T[K]>) => void;
33
- }>>;
34
- /**
35
- * Extract properties as all assigned properties because they have defaults.
36
- */
37
- export declare type ExtractPropDefaultTypes<O> = RequiredProperties<O>;
38
- /**
39
- * Extend slots interface T with prefixed 'before--' & 'after--' slots to create fully extensible flexible slots.
40
- */
41
- export declare type ExtendSlots<T> = PrefixKeys<T, 'before--'> & T & PrefixKeys<T, 'after--'>;
42
- /** Helper Types. */
43
- export declare type AnyClass = abstract new (...args: any[]) => any;
44
- /**
45
- * Descriptors map.
46
- */
47
- export declare type Descriptors = Map<string, PropertyDescriptor>;
48
- /**
49
- * Computeds hash map.
50
- */
51
- export declare type Computeds = Record<string, ComputedRef>;
52
- /**
53
- * Infer paramaters of a constructor function of a Class.
54
- */
55
- export declare type InferredArgs<T> = T extends {
56
- new (...args: infer P): any;
57
- } ? P : never[];
58
- /**
59
- * Prefix keys of an interface T with a prefix P.
60
- */
61
- export declare type PrefixKeys<T, P extends string | undefined = undefined> = {
62
- [K in Extract<keyof T, string> as P extends string ? `${P}${K}` : K]: T[K];
63
- };
64
- /**
65
- * Get Interface's property's function arguments Parmeters<F> parameter by key K
66
- */
67
- export declare type IFnParameter<T extends Record<any, any>, P extends keyof T, K extends number> = FnParameter<ValueOf<T, P>, K>;
68
- /**
69
- * Get function arguments Parmeters<F> parameter by key K
70
- */
71
- export declare type FnParameter<F extends (...args: any[]) => any, K extends number> = Parameters<F>[K];
72
- /**
73
- * Convert Union Type to Intersection Type.
74
- */
75
- export declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
76
- /**
77
- * Convert Record to Union Type.
78
- */
79
- export declare type RecordToUnion<T extends Record<string, any>> = T[keyof T];
80
- /**
81
- * Required Properties converts an interface with possible
82
- * optionally assigned properties like: { optional?: any; }
83
- * to a definitevely defined interface.
84
- */
85
- export declare type RequiredProperties<O> = {
86
- [K in keyof O]: ValueOf<ExtractPropTypes<O>, K>;
87
- };
88
- /**
89
- * Gets object T property by key [K].
90
- */
91
- export declare type ValueOf<T extends Record<any, any>, K> = T[K];
92
- /** Types End. */
93
- /**
94
- * Store all descriptors for each class prototype processed by
95
- * @see {getAllClassDescriptors}
96
- */
97
- export declare const descriptorsMap: Map<any, any>;
98
- /**
99
- * Get descriptors of an entire class prototype chain as a Map.
100
- * Completely emulates JavaScript class inheritance chain for getters and setters.
101
- *
102
- * @param className
103
- * @return {Descriptors}
104
- */
105
- export declare function getAllClassDescriptors(className: AnyClass): Descriptors;
106
- /**
107
- * Infinite Vue (ivue) class reactive initializer.
108
- *
109
- * Converts class instance to a reactive object,
110
- * where descriptors are converted to computeds.
111
- *
112
- * You can turn off computed behaviour by adding static
113
- * ivue object and setting the getter props to false.
114
- * class ClassName {
115
- * static ivue = {
116
- * getter: false
117
- * }
118
- * // .getter -> will be a standard JS non-computed getter
119
- * get getter () { return 'hello world'; }
120
- * }
121
- *
122
- * @param className Any Class
123
- * @param args Class constructor arguments that you would pass to a `new AnyClass(args...)`
124
- * @returns {IVue<T>}
125
- */
126
- export declare function ivue<T extends AnyClass>(className: T, ...args: InferredArgs<T>): IVue<T>;
127
- /**
128
- * Store all props for each class prototype processed by:
129
- * @see {getAllClassProperties}
130
- */
131
- export declare const propsMap: Map<object, Set<string> | any>;
132
- /**
133
- * Get properties of an entire class prototype chain as a Map.
134
- */
135
- export declare function getAllClassProperties(obj: object): Set<string>;
136
- /**
137
- * Convert reactive ivue class to Vue 3 refs.
138
- *
139
- * @param vue @see IVue
140
- * @param descriptors @see Descriptors
141
- * @param computeds @see Computeds
142
- * @returns {ExtendWithToRefs<T>['toRefs']}
143
- */
144
- export declare function ivueToRefs<T extends AnyClass>(vue: IVue<T>, descriptors: Descriptors, computeds: Computeds): ExtendWithToRefs<T>['toRefs'];
145
- /**
146
- * Vue props interface in defineComponent() style.
147
- */
148
- export declare type VuePropsObject = Record<string, {
149
- type: any;
150
- default?: any;
151
- required?: boolean;
152
- }>;
153
- /**
154
- * Vue Props with default properties declared as existing and having values.
155
- */
156
- export declare type VuePropsWithDefaults<T extends VuePropsObject> = {
157
- [K in keyof T]: {
158
- type: T[K]['type'];
159
- default: T[K]['default'];
160
- required?: boolean;
161
- };
162
- };
163
- /**
164
- * Determines if the value is a JavaScript Class.
165
- * Note that class is a class function in JavaScript.
166
- *
167
- * @param val Any value
168
- * @returns boolean If it's a JavaScript Class returns true
169
- */
170
- export declare function isClass(val: any): boolean;
171
- /**
172
- * Creates props with defaults in defineComponent() style.
173
- *
174
- * Merge defaults regular object with Vue types object
175
- * declared in defineComponent() style.
176
- *
177
- * This is made so that the defaults can be declared "as they are"
178
- * without requiring objects to be function callbacks returning an object.
179
- *
180
- * // You don't need to wrap objects in () => ({ nest: { nest :{} } })
181
- * // You can just delcare them normally.
182
- * const defaults = {
183
- * nest: {
184
- * nest
185
- * }
186
- * }
187
- *
188
- * This function will create the Vue expected callbacks for Objects, Arrays & Classes
189
- * but leave primitive properties and functions intact so that
190
- * the final object is fully defineComponent() style compatible.
191
- *
192
- * @param defaults Regular object of default key -> values
193
- * @param typedProps Props declared in defineComponent() style with type and possibly required declared, but without default
194
- * @returns Props declared in defineComponent() style with all properties having default property declared.
195
- */
196
- export declare function propsWithDefaults<T extends VuePropsObject>(defaults: Record<string, any>, typedProps: T): VuePropsWithDefaults<T>;
1
+ export * from './ivue';
@@ -0,0 +1,218 @@
1
+ import type { ComputedRef, ExtractPropTypes, ToRef, UnwrapNestedRefs } from 'vue';
2
+ import { UnwrapRef } from 'vue';
3
+ /** Types */
4
+ /**
5
+ * IVue core reactive instance type with an extended .toRefs() method added.
6
+ */
7
+ export declare type IVue<T extends AnyClass> = InstanceType<T> & ExtendWithToRefs<T>;
8
+ /**
9
+ * Extend with .toRefs() method, so that a reactive class can be converted to a composable definition.
10
+ */
11
+ export interface ExtendWithToRefs<T extends AnyClass> {
12
+ toRefs: IVueToRefsFn<T>;
13
+ }
14
+ /**
15
+ * .toRefs() method type definition converts reactive class properties to composable .value properties.
16
+ */
17
+ export declare type IVueToRefsFn<T extends AnyClass> = (props?: (keyof InstanceType<T>)[]) => IVueRefs<InstanceType<T>>;
18
+ /**
19
+ * Converts a class properties to a composable .value Refs using ToRef vue type,
20
+ * also knows NOT to convert functions to .value Refs but to leave them as is.
21
+ */
22
+ export declare type IVueRefs<T = any> = {
23
+ [K in keyof T]: T[K] extends Function ? T[K] : ToRef<T[K]>;
24
+ };
25
+ /**
26
+ * Unwraps the returned Refs of composable method T to a reactive type definition.
27
+ */
28
+ export declare type UseComposableReturn<T extends Object> = {
29
+ [K in keyof T]: T[K] extends {
30
+ value: any;
31
+ } ? T[K]['value'] : T[K];
32
+ };
33
+ export declare type UseComposable<T extends (...args: any[]) => any> = UseComposableReturn<ReturnType<T>>;
34
+ /**
35
+ * Extracts object defined emit types by converting them to a plain interface
36
+ */
37
+ export declare type ExtractEmitTypes<T extends Record<string, any>> = UnionToIntersection<RecordToUnion<{
38
+ [K in keyof T]: (evt: K, ...args: Parameters<T[K]>) => void;
39
+ }>>;
40
+ /**
41
+ * Extract properties as all assigned properties because they have defaults.
42
+ */
43
+ export declare type ExtractPropDefaultTypes<O> = {
44
+ [K in keyof O]: ValueOf<ExtractPropTypes<O>, K>;
45
+ };
46
+ /**
47
+ * Extend slots interface T with prefixed 'before--' & 'after--' slots to create fully extensible flexible slots.
48
+ */
49
+ export declare type ExtendSlots<T> = PrefixKeys<T, 'before--'> & T & PrefixKeys<T, 'after--'>;
50
+ /** Helper Types. */
51
+ /**
52
+ * Any JavaScript class of any type.
53
+ */
54
+ export declare type AnyClass = abstract new (...args: any[]) => any;
55
+ /**
56
+ * Descriptors map.
57
+ */
58
+ export declare type Descriptors = Map<string, PropertyDescriptor>;
59
+ /**
60
+ * Computeds hash map.
61
+ */
62
+ export declare type Computeds = Record<string, ComputedRef>;
63
+ /**
64
+ * Infer paramaters of a constructor function of a Class.
65
+ */
66
+ export declare type InferredArgs<T> = T extends {
67
+ new (...args: infer P): any;
68
+ } ? P : never[];
69
+ /**
70
+ * Prefix keys of an interface T with a prefix P.
71
+ */
72
+ export declare type PrefixKeys<T, P extends string | undefined = undefined> = {
73
+ [K in Extract<keyof T, string> as P extends string ? `${P}${K}` : K]: T[K];
74
+ };
75
+ /**
76
+ * Get Interface's property's function arguments Parmeters<F>
77
+ */
78
+ export declare type IFnParameters<T extends Record<any, any>, K extends string> = Parameters<Required<Pick<T, K>>[K]>;
79
+ /**
80
+ * Get Interface's [T] property's [P] function arguments Parmeters<F> parameter by key [K]
81
+ */
82
+ export declare type IFnParameter<T extends Record<any, any>, P extends keyof T, K extends number> = FnParameter<ValueOf<T, P>, K>;
83
+ /**
84
+ * Get function arguments Parmeters<F> parameter by key K
85
+ */
86
+ export declare type FnParameter<F extends (...args: any[]) => any, K extends number> = Parameters<F>[K];
87
+ /**
88
+ * Convert Union Type to Intersection Type.
89
+ */
90
+ export declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
91
+ /**
92
+ * Convert Record to Union Type.
93
+ */
94
+ export declare type RecordToUnion<T extends Record<string, any>> = T[keyof T];
95
+ /**
96
+ * Gets object T property by key [K].
97
+ */
98
+ export declare type ValueOf<T extends Record<any, any>, K> = T[K];
99
+ /** Types End. */
100
+ /**
101
+ * Store all descriptors for each class prototype processed by
102
+ * @see {getAllClassDescriptors}
103
+ */
104
+ export declare const descriptorsMap: Map<any, any>;
105
+ /**
106
+ * Get descriptors of an entire class prototype chain as a Map.
107
+ * Completely emulates JavaScript class inheritance chain for getters and setters.
108
+ *
109
+ * @param className
110
+ * @return {Descriptors}
111
+ */
112
+ export declare function getAllClassDescriptors(className: AnyClass): Descriptors;
113
+ /**
114
+ * Infinite Vue (ivue) class reactive initializer.
115
+ *
116
+ * Converts class instance to a reactive object,
117
+ * where descriptors are converted to computeds.
118
+ *
119
+ * You can turn off computed behaviour by adding static
120
+ * ivue object and setting the getter props to false.
121
+ * class ClassName {
122
+ * static ivue = {
123
+ * getter: false
124
+ * }
125
+ * // .getter -> will be a standard JS non-computed getter
126
+ * get getter () { return 'hello world'; }
127
+ * }
128
+ *
129
+ * @param className Any Class
130
+ * @param args Class constructor arguments that you would pass to a `new AnyClass(args...)`
131
+ * @returns {IVue<T>}
132
+ */
133
+ export declare function ivue<T extends AnyClass>(className: T, ...args: InferredArgs<T>): IVue<T>;
134
+ /**
135
+ * Store all props for each class prototype processed by:
136
+ * @see {getAllClassProperties}
137
+ */
138
+ export declare const propsMap: Map<object, Set<string> | any>;
139
+ /**
140
+ * Get properties of an entire class prototype chain as a Map.
141
+ */
142
+ export declare function getAllClassProperties(obj: object): Set<string>;
143
+ /**
144
+ * `iref` is an unwrapped type alias for Vue ref() function.
145
+ * `iref` does not alter the behavior of ref(), but simply
146
+ * transforms the type to an unwrapped ref value.
147
+ * @param val
148
+ * @returns
149
+ */
150
+ export declare function iref<T>(val?: T): UnwrapRef<T>;
151
+ /**
152
+ * `iuse` stands for composable.
153
+ * Returns unwrapped composable type definition without the Refs.
154
+ */
155
+ export declare function iuse<T extends Object>(val?: T): UseComposableReturn<UnwrapNestedRefs<T>>;
156
+ /**
157
+ * Convert reactive ivue class to Vue 3 refs.
158
+ *
159
+ * @param vue @see IVue
160
+ * @param descriptors @see Descriptors
161
+ * @param computeds @see Computeds
162
+ * @returns {ExtendWithToRefs<T>['toRefs']}
163
+ */
164
+ export declare function ivueToRefs<T extends AnyClass>(vue: IVue<T>, descriptors: Descriptors, computeds: Computeds): ExtendWithToRefs<T>['toRefs'];
165
+ /**
166
+ * Vue props interface in defineComponent() style.
167
+ */
168
+ export declare type VuePropsObject = Record<string, {
169
+ type: any;
170
+ default?: any;
171
+ required?: boolean;
172
+ }>;
173
+ /**
174
+ * Vue Props with default properties declared as existing and having values.
175
+ */
176
+ export declare type VuePropsWithDefaults<T extends VuePropsObject> = {
177
+ [K in keyof T]: {
178
+ type: T[K]['type'];
179
+ default: T[K]['default'];
180
+ required?: boolean;
181
+ };
182
+ };
183
+ /**
184
+ * Determines if the value is a JavaScript Class.
185
+ * Note that class is a class function in JavaScript.
186
+ *
187
+ * @param val Any value
188
+ * @returns boolean If it's a JavaScript Class returns true
189
+ */
190
+ export declare function isClass(val: any): boolean;
191
+ /**
192
+ * Creates props with defaults in defineComponent() style.
193
+ *
194
+ * Merge defaults regular object with Vue types object
195
+ * declared in defineComponent() style.
196
+ *
197
+ * This is made so that the defaults can be declared "as they are"
198
+ * without requiring objects to be function callbacks returning an object.
199
+ *
200
+ * // You don't need to wrap objects in () => ({ nest: { nest :{} } })
201
+ * // You can just delcare them normally.
202
+ * const defaults = {
203
+ * nest: {
204
+ * nest
205
+ * }
206
+ * }
207
+ *
208
+ * This function will create the Vue expected callbacks for Objects, Arrays & Classes
209
+ * but leave primitive properties and functions intact so that
210
+ * the final object is fully defineComponent() style compatible.
211
+ *
212
+ * @param defaults Regular object of default key -> values
213
+ * @param typedProps Props declared in defineComponent() style with type and possibly required declared, but without default
214
+ * @returns Props declared in defineComponent() style with all properties having default property declared.
215
+ */
216
+ export declare function propsWithDefaults<T extends VuePropsObject>(defaults: Record<string, any>, typedProps: T): VuePropsWithDefaults<T>;
217
+ /** Necessary ivue.ts to be treated as a module. */
218
+ export {};
@@ -1,9 +1,18 @@
1
- import { defineConfig } from 'vitepress'
1
+ import { defineConfig } from 'vitepress';
2
2
 
3
3
  // https://vitepress.vuejs.org/config/app-configs
4
4
  export default defineConfig({
5
+ titleTemplate: ':title | Infinite Vue ∞ ivue',
5
6
  themeConfig: {
7
+ outline: 'deep',
6
8
  siteTitle: 'ivue ∞ Infinite Vue',
9
+ socialLinks: [
10
+ { icon: 'github', link: 'https://github.com/infinite-system/ivue' },
11
+ { icon: 'twitter', link: 'https://x.com/evgenykalash' },
12
+ ],
13
+ search: {
14
+ provider: 'local',
15
+ },
7
16
  sidebar: [
8
17
  {
9
18
  collapsed: false,
@@ -18,39 +27,118 @@ export default defineConfig({
18
27
  collapsed: false,
19
28
  text: 'Usage',
20
29
  items: [
21
- { text: 'Basic Usage', link: '/pages/usage' },
22
- { text: 'Class Inheritance', link: '/pages/usage' },
23
- { text: 'Using Props', link: '/pages/usage' },
24
- { text: 'Using Emits', link: '/pages/usage' },
25
- { text: 'Using Composables', link: '/pages/usage' },
26
- { text: 'Define Expose', link: '/pages/usage' },
27
- { text: 'Extend Slots', link: '/pages/usage' },
30
+ { text: 'Basic Usage', link: '/pages/usage#basic-usage' },
31
+ { text: 'Using Props', link: '/pages/usage#using-props' },
32
+ { text: 'Using Emits', link: '/pages/usage#using-emits' },
33
+ { text: 'Using Refs', link: '/pages/usage#using-refs' },
34
+ {
35
+ text: 'Using Define Expose',
36
+ link: '/pages/usage#using-define-expose',
37
+ },
38
+ { text: 'Using Composables', link: '/pages/usage#using-composables' },
39
+ {
40
+ text: 'Using Inside Composables',
41
+ link: '/pages/usage#using-inside-composables',
42
+ },
43
+ { text: 'Using Computeds', link: '/pages/usage#using-computeds' },
44
+ { text: 'Using Watch', link: '/pages/usage#using-watch' },
45
+ {
46
+ text: 'Using Lifecycle Hooks',
47
+ link: '/pages/usage#using-lifecycle-hooks',
48
+ },
28
49
  ],
29
50
  },
51
+
30
52
  {
31
53
  collapsed: false,
32
- text: 'Functions',
54
+ text: 'Guidelines',
33
55
  items: [
34
- { text: 'ivue', link: '/api/init' },
35
- { text: '.toRefs()', link: '/api/init' },
36
- { text: 'propsWithDefaults', link: '/api/propsWithDefaults' },
56
+ {
57
+ text: "Dos and Don'ts",
58
+ link: '/pages/guidelines#dos-and-don-ts',
59
+ },
60
+ {
61
+ text: 'constructor() vs .init()',
62
+ link: '/pages/guidelines#constructor-vs-init',
63
+ },
64
+ {
65
+ text: 'Unwrapping Refs',
66
+ link: '/pages/guidelines#unwrapping-refs',
67
+ },
68
+ {
69
+ text: 'Naming Conventions',
70
+ link: '/pages/guidelines#naming-conventions',
71
+ },
37
72
  ],
38
73
  },
39
74
  {
75
+ collapsed: false,
76
+ text: 'Advanced Usage',
77
+ items: [
78
+ {
79
+ text: 'Extend Props Defaults',
80
+ link: '/pages/advanced-usage#extend-props-defaults',
81
+ },
82
+ { text: 'Extend Props', link: '/pages/advanced-usage#extend-props' },
83
+ { text: 'Extend Emits', link: '/pages/advanced-usage#extend-emits' },
84
+ { text: 'Extend Slots', link: '/pages/advanced-usage#extend-slots' },
85
+ {
86
+ text: 'Extend Classes',
87
+ link: '/pages/advanced-usage#extend-classes',
88
+ },
89
+ {
90
+ text: 'Extend Components',
91
+ link: '/pages/advanced-usage#extend-components',
92
+ },
93
+ ],
94
+ },
95
+ { text: 'API' },
96
+ {
97
+ collapsed: false,
98
+ text: 'Core Functions',
99
+ items: [
100
+ { text: 'ivue()', link: '/pages/api#ivue' },
101
+ { text: '.init()', link: '/pages/api#init' },
102
+ { text: '.toRefs()', link: '/pages/api#torefs' },
103
+ ],
104
+ },
105
+
106
+ {
107
+ collapsed: false,
108
+ text: 'Utility Functions',
109
+ items: [
110
+ { text: 'propsWithDefaults()', link: '/pages/api#propswithdefaults' },
111
+ ],
112
+ },
113
+
114
+ {
115
+ collapsed: false,
40
116
  text: 'Utility Types',
41
117
  items: [
42
- { text: 'UnwrapComposable', link: '/types/UnwrapComposable' },
43
- { text: 'ExtractEmitTypes', link: '/types/ExtractEmitTypes' },
44
- { text: 'ExtractPropDefaultTypes', link: '/types/ExtractPropDefaultTypes' },
45
- { text: 'ExtendSlots', link: '/types/ExtendSlots' },
118
+ {
119
+ text: 'ExtractPropDefaultTypes',
120
+ link: '/pages/api#extractpropdefaulttypes',
121
+ },
122
+ { text: 'ExtractEmitTypes', link: '/pages/api#extractemittypes' },
123
+ { text: 'ExtendSlots', link: '/pages/api#extendslots' },
124
+ { text: 'UseComposable', link: '/pages/api#UseComposable' },
46
125
  ],
47
126
  },
48
- ]
127
+
128
+ {
129
+ collapsed: false,
130
+ text: 'Source Code',
131
+ items: [
132
+ { text: 'Browse Code', link: '/pages/browse-code' },
133
+ ],
134
+ },
135
+ ],
49
136
  },
50
137
  base: '/ivue/',
51
- vite: { // To make vue-dd work, see https://github.com/vuetifyjs/vuetify/discussions/15735
138
+ vite: {
139
+ // To make vue-dd work, see https://github.com/vuetifyjs/vuetify/discussions/15735
52
140
  ssr: {
53
- noExternal: ["vue-dd"]
54
- }
55
- }
56
- })
141
+ noExternal: ['vue-dd'],
142
+ },
143
+ },
144
+ });
@@ -3,19 +3,19 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <title>404 | VitePress</title>
6
+ <title>404 | Infinite Vue ∞ ivue</title>
7
7
  <meta name="description" content="Not Found">
8
8
  <meta name="generator" content="VitePress v1.3.2">
9
- <link rel="preload stylesheet" href="/ivue/assets/style.BSZVsGuP.css" as="style">
9
+ <link rel="preload stylesheet" href="/ivue/assets/style.Fgx7OB_D.css" as="style">
10
10
 
11
- <script type="module" src="/ivue/assets/app.DRiljpSE.js"></script>
11
+ <script type="module" src="/ivue/assets/app.ConZRsN0.js"></script>
12
12
  <link rel="preload" href="/ivue/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
13
13
  <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
14
14
  <script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
15
15
  </head>
16
16
  <body>
17
17
  <div id="app"></div>
18
- <script>window.__VP_HASH_MAP__=JSON.parse("{\"api_ivue.md\":\"BCZ4q_0D\",\"api_propswithdefaults.md\":\"Cr5FwI9o\",\"index.md\":\"B1vDz5mb\",\"pages_getting-started.md\":\"C7qtPEWU\",\"pages_how-it-works.md\":\"DKizt6Ny\",\"pages_introduction.md\":\"Dkqu-XCz\",\"pages_usage.md\":\"qo7ICfLC\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"VitePress\",\"description\":\"A VitePress site\",\"base\":\"/ivue/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":true,\"themeConfig\":{\"siteTitle\":\"ivue ∞ Infinite Vue\",\"sidebar\":[{\"collapsed\":false,\"text\":\"Guide\",\"items\":[{\"text\":\"What is ivue?\",\"link\":\"/pages/introduction\"},{\"text\":\"How it works?\",\"link\":\"/pages/how-it-works\"},{\"text\":\"Getting Started\",\"link\":\"/pages/getting-started\"}]},{\"collapsed\":false,\"text\":\"Usage\",\"items\":[{\"text\":\"Basic Usage\",\"link\":\"/pages/usage\"},{\"text\":\"Class Inheritance\",\"link\":\"/pages/usage\"},{\"text\":\"Using Props\",\"link\":\"/pages/usage\"},{\"text\":\"Using Emits\",\"link\":\"/pages/usage\"},{\"text\":\"Using Composables\",\"link\":\"/pages/usage\"},{\"text\":\"Define Expose\",\"link\":\"/pages/usage\"},{\"text\":\"Extend Slots\",\"link\":\"/pages/usage\"}]},{\"collapsed\":false,\"text\":\"Functions\",\"items\":[{\"text\":\"ivue\",\"link\":\"/api/init\"},{\"text\":\".toRefs()\",\"link\":\"/api/init\"},{\"text\":\"propsWithDefaults\",\"link\":\"/api/propsWithDefaults\"}]},{\"text\":\"Utility Types\",\"items\":[{\"text\":\"UnwrapComposable\",\"link\":\"/types/UnwrapComposable\"},{\"text\":\"ExtractEmitTypes\",\"link\":\"/types/ExtractEmitTypes\"},{\"text\":\"ExtractPropDefaultTypes\",\"link\":\"/types/ExtractPropDefaultTypes\"},{\"text\":\"ExtendSlots\",\"link\":\"/types/ExtendSlots\"}]}]},\"locales\":{},\"scrollOffset\":134,\"cleanUrls\":false}");</script>
18
+ <script>window.__VP_HASH_MAP__=JSON.parse("{\"api_ivue.md\":\"MRwb9Lcb\",\"api_propswithdefaults.md\":\"CeE4IC-K\",\"index.md\":\"wPLoTLBY\",\"pages_advanced-usage.md\":\"BZgX-VP7\",\"pages_api.md\":\"C_PvCZns\",\"pages_browse-code.md\":\"CPluoaap\",\"pages_getting-started.md\":\"knQcOZyP\",\"pages_guidelines.md\":\"DddPdPom\",\"pages_how-it-works.md\":\"OJGcGEXF\",\"pages_how-its-made.md\":\"Vv9Z9TEi\",\"pages_introduction.md\":\"DrDm-R8F\",\"pages_usage.md\":\"zSOVjtFF\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"VitePress\",\"titleTemplate\":\":title | Infinite Vue ∞ ivue\",\"description\":\"A VitePress site\",\"base\":\"/ivue/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":true,\"themeConfig\":{\"outline\":\"deep\",\"siteTitle\":\"ivue ∞ Infinite Vue\",\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://github.com/infinite-system/ivue\"},{\"icon\":\"twitter\",\"link\":\"https://x.com/evgenykalash\"}],\"search\":{\"provider\":\"local\"},\"sidebar\":[{\"collapsed\":false,\"text\":\"Guide\",\"items\":[{\"text\":\"What is ivue?\",\"link\":\"/pages/introduction\"},{\"text\":\"How it works?\",\"link\":\"/pages/how-it-works\"},{\"text\":\"Getting Started\",\"link\":\"/pages/getting-started\"}]},{\"collapsed\":false,\"text\":\"Usage\",\"items\":[{\"text\":\"Basic Usage\",\"link\":\"/pages/usage#basic-usage\"},{\"text\":\"Using Props\",\"link\":\"/pages/usage#using-props\"},{\"text\":\"Using Emits\",\"link\":\"/pages/usage#using-emits\"},{\"text\":\"Using Refs\",\"link\":\"/pages/usage#using-refs\"},{\"text\":\"Using Define Expose\",\"link\":\"/pages/usage#using-define-expose\"},{\"text\":\"Using Composables\",\"link\":\"/pages/usage#using-composables\"},{\"text\":\"Using Inside Composables\",\"link\":\"/pages/usage#using-inside-composables\"},{\"text\":\"Using Computeds\",\"link\":\"/pages/usage#using-computeds\"},{\"text\":\"Using Watch\",\"link\":\"/pages/usage#using-watch\"},{\"text\":\"Using Lifecycle Hooks\",\"link\":\"/pages/usage#using-lifecycle-hooks\"}]},{\"collapsed\":false,\"text\":\"Guidelines\",\"items\":[{\"text\":\"Dos and Don'ts\",\"link\":\"/pages/guidelines#dos-and-don-ts\"},{\"text\":\"constructor() vs .init()\",\"link\":\"/pages/guidelines#constructor-vs-init\"},{\"text\":\"Unwrapping Refs\",\"link\":\"/pages/guidelines#unwrapping-refs\"},{\"text\":\"Naming Conventions\",\"link\":\"/pages/guidelines#naming-conventions\"}]},{\"collapsed\":false,\"text\":\"Advanced Usage\",\"items\":[{\"text\":\"Extend Props Defaults\",\"link\":\"/pages/advanced-usage#extend-props-defaults\"},{\"text\":\"Extend Props\",\"link\":\"/pages/advanced-usage#extend-props\"},{\"text\":\"Extend Emits\",\"link\":\"/pages/advanced-usage#extend-emits\"},{\"text\":\"Extend Slots\",\"link\":\"/pages/advanced-usage#extend-slots\"},{\"text\":\"Extend Classes\",\"link\":\"/pages/advanced-usage#extend-classes\"},{\"text\":\"Extend Components\",\"link\":\"/pages/advanced-usage#extend-components\"}]},{\"text\":\"API\"},{\"collapsed\":false,\"text\":\"Core Functions\",\"items\":[{\"text\":\"ivue()\",\"link\":\"/pages/api#ivue\"},{\"text\":\".init()\",\"link\":\"/pages/api#init\"},{\"text\":\".toRefs()\",\"link\":\"/pages/api#torefs\"}]},{\"collapsed\":false,\"text\":\"Utility Functions\",\"items\":[{\"text\":\"propsWithDefaults()\",\"link\":\"/pages/api#propswithdefaults\"}]},{\"collapsed\":false,\"text\":\"Utility Types\",\"items\":[{\"text\":\"ExtractPropDefaultTypes\",\"link\":\"/pages/api#extractpropdefaulttypes\"},{\"text\":\"ExtractEmitTypes\",\"link\":\"/pages/api#extractemittypes\"},{\"text\":\"ExtendSlots\",\"link\":\"/pages/api#extendslots\"},{\"text\":\"UseComposable\",\"link\":\"/pages/api#UseComposable\"}]},{\"collapsed\":false,\"text\":\"Source Code\",\"items\":[{\"text\":\"Browse Code\",\"link\":\"/pages/browse-code\"}]}]},\"locales\":{},\"scrollOffset\":134,\"cleanUrls\":false}");</script>
19
19
 
20
20
  </body>
21
21
  </html>