@modular-component/with-components 0.3.1 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @modular-component/with-components
2
2
 
3
+ ## 0.3.3
4
+
5
+ ### Patch Changes
6
+
7
+ - b92d207: Relax constraint type to accept any component-type with the same props
8
+ - @modular-component/core@0.3.3
9
+
10
+ ## 0.3.2
11
+
12
+ ### Patch Changes
13
+
14
+ - @modular-component/core@0.3.2
15
+
3
16
  ## 0.3.1
4
17
 
5
18
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { ModularContext, GetConstraintFor, GetValueGetterFor, StageParams, Stage
3
3
  type Constraint<Context extends ModularContext> = GetConstraintFor<Context, 'components', Record<string, ComponentType<any>>>;
4
4
  export declare function components<Context extends ModularContext, Type extends Constraint<Context>>(components: GetValueGetterFor<Context, 'components', Type>): (_?: Context | undefined) => {
5
5
  field: "components";
6
- provide: (args: import("@modular-component/core/extend").GetArgsFor<Context, "components">) => Type;
6
+ provide: (args: import("@modular-component/core/extend").GetArgsFor<Context, "components">) => { [key in keyof Type]: Type[key] extends ComponentType<infer U> ? ComponentType<U> : never; };
7
7
  };
8
8
  export type WithComponents<Context extends ModularContext> = <Type extends Constraint<Context>>(...args: StageParams<typeof components<Context, Type>>) => StageReturn<typeof components<Context, Type>>;
9
9
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAGL,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,WAAW,EACZ,MAAM,gCAAgC,CAAA;AAEvC,KAAK,UAAU,CAAC,OAAO,SAAS,cAAc,IAAI,gBAAgB,CAChE,OAAO,EACP,YAAY,EACZ,MAAM,CAAC,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,CAAC,OAAO,CAAC,EAEhC,GAAG,IAAI,EAAE,WAAW,CAAC,OAAO,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,KACnD,WAAW,CAAC,OAAO,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAA"}
package/dist/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import { addTo, wrap, } from '@modular-component/core/extend';
2
2
  export function components(components) {
3
- return addTo().on('components').provide(wrap(components));
3
+ return addTo()
4
+ .on('components')
5
+ .provide((args) => wrap(components)(args));
4
6
  }
5
7
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EACL,IAAI,GAML,MAAM,gCAAgC,CAAA;AAQvC,MAAM,UAAU,UAAU,CAGxB,UAA0D;IAC1D,OAAO,KAAK,EAAW,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAA;AACpE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EACL,IAAI,GAML,MAAM,gCAAgC,CAAA;AAQvC,MAAM,UAAU,UAAU,CAGxB,UAA0D;IAC1D,OAAO,KAAK,EAAW;SACpB,EAAE,CAAC,YAAY,CAAC;SAChB,OAAO,CACN,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAIpB,CACJ,CAAA;AACL,CAAC"}
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "Sub-components",
10
10
  "Injection"
11
11
  ],
12
- "version": "0.3.1",
12
+ "version": "0.3.3",
13
13
  "type": "module",
14
14
  "license": "MIT",
15
15
  "publishConfig": {
@@ -29,7 +29,7 @@
29
29
  "license": "cp ../../LICENSE ./LICENSE"
30
30
  },
31
31
  "peerDependencies": {
32
- "@modular-component/core": "0.3.1",
32
+ "@modular-component/core": "0.3.3",
33
33
  "react": ">=17"
34
34
  },
35
35
  "devDependencies": {
package/src/index.ts CHANGED
@@ -19,7 +19,16 @@ export function components<
19
19
  Context extends ModularContext,
20
20
  Type extends Constraint<Context>,
21
21
  >(components: GetValueGetterFor<Context, 'components', Type>) {
22
- return addTo<Context>().on('components').provide(wrap(components))
22
+ return addTo<Context>()
23
+ .on('components')
24
+ .provide(
25
+ (args) =>
26
+ wrap(components)(args) as {
27
+ [key in keyof Type]: Type[key] extends ComponentType<infer U>
28
+ ? ComponentType<U>
29
+ : never
30
+ },
31
+ )
23
32
  }
24
33
 
25
34
  export type WithComponents<Context extends ModularContext> = <