@viewfly/core 1.2.1 → 1.2.2

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.
@@ -487,6 +487,10 @@ declare function withAnnotation<T extends ComponentSetup>(annotation: ComponentA
487
487
  interface ContextProps extends Props {
488
488
  providers: Provider[];
489
489
  }
490
+ /**
491
+ * @deprecated
492
+ * @param props
493
+ */
490
494
  declare function Context(props: ContextProps): () => ViewFlyNode<string | ComponentSetup<any>>;
491
495
 
492
496
  declare function withMemo<T extends Props = Props>(canUseMemo: ComponentInstance<T>['$useMemo'], render: () => JSXNode): ComponentInstance<T>;
@@ -1301,11 +1301,20 @@ function withAnnotation(annotation, componentSetup) {
1301
1301
  return function (props) {
1302
1302
  const instance = getCurrentInstance();
1303
1303
  const parentInjector = injectMap.get(instance) || getInjector(instance.parentComponent);
1304
- const injector = new ReflectiveInjector(parentInjector, annotation.providers || [], annotation.scope);
1304
+ const injector = new ReflectiveInjector(parentInjector, [{
1305
+ provide: Injector,
1306
+ useFactory() {
1307
+ return injector;
1308
+ }
1309
+ }, ...(annotation.providers || [])], annotation.scope);
1305
1310
  injectMap.set(instance, injector);
1306
1311
  return componentSetup(props);
1307
1312
  };
1308
1313
  }
1314
+ /**
1315
+ * @deprecated
1316
+ * @param props
1317
+ */
1309
1318
  function Context(props) {
1310
1319
  function createContextComponent(providers) {
1311
1320
  return withAnnotation({
package/bundles/index.js CHANGED
@@ -1303,11 +1303,20 @@ function withAnnotation(annotation, componentSetup) {
1303
1303
  return function (props) {
1304
1304
  const instance = getCurrentInstance();
1305
1305
  const parentInjector = injectMap.get(instance) || getInjector(instance.parentComponent);
1306
- const injector = new ReflectiveInjector(parentInjector, annotation.providers || [], annotation.scope);
1306
+ const injector = new ReflectiveInjector(parentInjector, [{
1307
+ provide: Injector,
1308
+ useFactory() {
1309
+ return injector;
1310
+ }
1311
+ }, ...(annotation.providers || [])], annotation.scope);
1307
1312
  injectMap.set(instance, injector);
1308
1313
  return componentSetup(props);
1309
1314
  };
1310
1315
  }
1316
+ /**
1317
+ * @deprecated
1318
+ * @param props
1319
+ */
1311
1320
  function Context(props) {
1312
1321
  function createContextComponent(providers) {
1313
1322
  return withAnnotation({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viewfly/core",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Viewfly is a simple and easy-to-use JavaScript framework with an intuitive development experience.",
5
5
  "main": "./bundles/index.js",
6
6
  "module": "./bundles/index.esm.js",
@@ -50,7 +50,7 @@
50
50
  "bugs": {
51
51
  "url": "https://github.com/viewfly/viewfly.git/issues"
52
52
  },
53
- "gitHead": "8b79b4e067238c81c61d62581b9f6d2c64f60677",
53
+ "gitHead": "84f994ca1bd19c075d9a142bbedfc10db14e7e93",
54
54
  "dependencies": {
55
55
  "reflect-metadata": "^0.2.2"
56
56
  }