@yahoo/uds-create-config 5.67.3 → 5.68.0
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.
|
@@ -903,8 +903,19 @@ type AuthoredComponent = ComponentBuilder<LayerMap, PropMap, unknown, unknown>;
|
|
|
903
903
|
* Everything else (the render's extras, the defaults, the forwards, the states) is read off the
|
|
904
904
|
* handle's type rather than restated, so the two can't drift. The laid-over props are compacted
|
|
905
905
|
* again, since laying them over spells the source's {@link StyleRefs} out entry by entry.
|
|
906
|
+
*
|
|
907
|
+
* The builder is read off `metadata()`'s return type, so a handle with statics on it (the Bridge's
|
|
908
|
+
* `Menu.Item`) is matched as the bare builder and keeps its statics. Matched whole, a handle whose
|
|
909
|
+
* statics are builders too passes TypeScript's complexity limit (TS2859) once a system's style props
|
|
910
|
+
* are registered.
|
|
911
|
+
*
|
|
912
|
+
* OPEN: a static that is the component itself (`Menu.Content`) keeps the source's types.
|
|
906
913
|
*/
|
|
907
|
-
type LinkedHandle<Handle, Props extends PropMap = Record<never, never>, Layers extends Record<string, LayerElement> = Record<never, never>> = Handle extends
|
|
914
|
+
type LinkedHandle<Handle, Props extends PropMap = Record<never, never>, Layers extends Record<string, LayerElement> = Record<never, never>> = Handle extends {
|
|
915
|
+
metadata(meta: never): infer Builder;
|
|
916
|
+
} ? Builder extends ComponentBuilder<infer L extends LayerMap, infer P extends PropMap, infer E, infer D, infer F extends string, infer S extends StateMap> ? WithStatics<ComponentBuilder<Without<L, keyof Layers> & Layers extends infer Swapped extends LayerMap ? Swapped : L, CompactProps<Without<P, keyof Props> & Props>, E, D, F, S>, Omit<Handle, keyof Builder>> : Handle : Handle;
|
|
917
|
+
/** A rebuilt handle with the source handle's statics beside it, when it has any. */
|
|
918
|
+
type WithStatics<Rebuilt, Statics> = [keyof Statics] extends [never] ? Rebuilt : Rebuilt & Statics;
|
|
908
919
|
interface DefineComponent {
|
|
909
920
|
/** The one-layer form: the element IS the component. */
|
|
910
921
|
<const El extends LayerElement>(element: El): ComponentBuilder<{
|