phecda-vue 3.0.0-beta.18 → 3.0.0-beta.20
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/dist/index.js +21 -11
- package/dist/index.mjs +21 -11
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -222,21 +222,31 @@ __name(createSharedReactive, "createSharedReactive");
|
|
|
222
222
|
|
|
223
223
|
// src/composable.ts
|
|
224
224
|
var REF_SYMBOL = Symbol("ref");
|
|
225
|
+
function initInstance(model) {
|
|
226
|
+
const proxyFn = (0, import_phecda_web2.get)(model.prototype, "shallow") ? import_vue4.shallowReactive : import_vue4.reactive;
|
|
227
|
+
const instance = proxyFn(new model());
|
|
228
|
+
instance._promise = (0, import_phecda_web2.invokeHandler)("init", instance);
|
|
229
|
+
return instance;
|
|
230
|
+
}
|
|
231
|
+
__name(initInstance, "initInstance");
|
|
225
232
|
function useO(model) {
|
|
226
233
|
const { state, origin } = (0, import_phecda_web2.getActiveInstance)();
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
const instance = proxyFn(new model());
|
|
230
|
-
instance._promise = (0, import_phecda_web2.invokeHandler)("init", instance);
|
|
231
|
-
return instance;
|
|
232
|
-
}
|
|
234
|
+
if ((0, import_phecda_web2.get)(model.prototype, "isolate"))
|
|
235
|
+
return initInstance(model);
|
|
233
236
|
const tag = (0, import_phecda_web2.getTag)(model);
|
|
234
|
-
if (
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
if (tag in state) {
|
|
238
|
+
if (process.env.NODE_ENV === "development") {
|
|
239
|
+
if (origin.get(state[tag]) === model)
|
|
240
|
+
return state[tag];
|
|
241
|
+
} else {
|
|
242
|
+
if (origin.get(state[tag]) !== model)
|
|
243
|
+
console.warn(`Synonym model: Module taged "${String(tag)}" has been loaded before, so won't load Module "${model.name}"`);
|
|
244
|
+
return state[tag];
|
|
245
|
+
}
|
|
239
246
|
}
|
|
247
|
+
const instance = initInstance(model);
|
|
248
|
+
state[tag] = instance;
|
|
249
|
+
origin.set(instance, model);
|
|
240
250
|
return state[tag];
|
|
241
251
|
}
|
|
242
252
|
__name(useO, "useO");
|
package/dist/index.mjs
CHANGED
|
@@ -182,21 +182,31 @@ __name(createSharedReactive, "createSharedReactive");
|
|
|
182
182
|
|
|
183
183
|
// src/composable.ts
|
|
184
184
|
var REF_SYMBOL = Symbol("ref");
|
|
185
|
+
function initInstance(model) {
|
|
186
|
+
const proxyFn = get(model.prototype, "shallow") ? shallowReactive : reactive;
|
|
187
|
+
const instance = proxyFn(new model());
|
|
188
|
+
instance._promise = invokeHandler2("init", instance);
|
|
189
|
+
return instance;
|
|
190
|
+
}
|
|
191
|
+
__name(initInstance, "initInstance");
|
|
185
192
|
function useO(model) {
|
|
186
193
|
const { state, origin } = getActiveInstance2();
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
const instance = proxyFn(new model());
|
|
190
|
-
instance._promise = invokeHandler2("init", instance);
|
|
191
|
-
return instance;
|
|
192
|
-
}
|
|
194
|
+
if (get(model.prototype, "isolate"))
|
|
195
|
+
return initInstance(model);
|
|
193
196
|
const tag = getTag(model);
|
|
194
|
-
if (
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
if (tag in state) {
|
|
198
|
+
if (process.env.NODE_ENV === "development") {
|
|
199
|
+
if (origin.get(state[tag]) === model)
|
|
200
|
+
return state[tag];
|
|
201
|
+
} else {
|
|
202
|
+
if (origin.get(state[tag]) !== model)
|
|
203
|
+
console.warn(`Synonym model: Module taged "${String(tag)}" has been loaded before, so won't load Module "${model.name}"`);
|
|
204
|
+
return state[tag];
|
|
205
|
+
}
|
|
199
206
|
}
|
|
207
|
+
const instance = initInstance(model);
|
|
208
|
+
state[tag] = instance;
|
|
209
|
+
origin.set(instance, model);
|
|
200
210
|
return state[tag];
|
|
201
211
|
}
|
|
202
212
|
__name(useO, "useO");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phecda-vue",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.20",
|
|
4
4
|
"description": "provide phecda function to vue",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"vue": "^3.2.45",
|
|
16
|
-
"phecda-web": "1.0.1-beta.
|
|
16
|
+
"phecda-web": "1.0.1-beta.13"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"tsup": "^6.5.0"
|