@remote-ui/core
Advanced tools
Comparing version 0.0.2 to 0.0.3
"use strict"; | ||
require("core-js/modules/es.symbol"); | ||
require("core-js/modules/es.symbol.description"); | ||
require("core-js/modules/es.symbol.iterator"); | ||
require("core-js/modules/es.array.filter"); | ||
require("core-js/modules/es.array.for-each"); | ||
require("core-js/modules/es.array.from"); | ||
require("core-js/modules/es.array.is-array"); | ||
require("core-js/modules/es.array.iterator"); | ||
require("core-js/modules/es.array.splice"); | ||
require("core-js/modules/es.date.to-string"); | ||
require("core-js/modules/es.map"); | ||
require("core-js/modules/es.object.define-properties"); | ||
require("core-js/modules/es.object.define-property"); | ||
require("core-js/modules/es.object.get-own-property-descriptor"); | ||
require("core-js/modules/es.object.get-own-property-descriptors"); | ||
require("core-js/modules/es.object.keys"); | ||
require("core-js/modules/es.object.to-string"); | ||
require("core-js/modules/es.regexp.to-string"); | ||
require("core-js/modules/es.string.iterator"); | ||
require("core-js/modules/web.dom-collections.for-each"); | ||
require("core-js/modules/web.dom-collections.iterator"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -4,0 +46,0 @@ value: true |
"use strict"; | ||
require("core-js/modules/es.symbol"); | ||
require("core-js/modules/es.symbol.description"); | ||
require("core-js/modules/es.symbol.iterator"); | ||
require("core-js/modules/es.array.concat"); | ||
require("core-js/modules/es.array.filter"); | ||
require("core-js/modules/es.array.for-each"); | ||
require("core-js/modules/es.array.from"); | ||
require("core-js/modules/es.array.index-of"); | ||
require("core-js/modules/es.array.is-array"); | ||
require("core-js/modules/es.array.iterator"); | ||
require("core-js/modules/es.array.map"); | ||
require("core-js/modules/es.array.splice"); | ||
require("core-js/modules/es.date.to-string"); | ||
require("core-js/modules/es.object.define-properties"); | ||
require("core-js/modules/es.object.define-property"); | ||
require("core-js/modules/es.object.freeze"); | ||
require("core-js/modules/es.object.get-own-property-descriptor"); | ||
require("core-js/modules/es.object.get-own-property-descriptors"); | ||
require("core-js/modules/es.object.keys"); | ||
require("core-js/modules/es.object.to-string"); | ||
require("core-js/modules/es.promise"); | ||
require("core-js/modules/es.reflect.define-property"); | ||
require("core-js/modules/es.regexp.to-string"); | ||
require("core-js/modules/es.string.iterator"); | ||
require("core-js/modules/es.weak-map"); | ||
require("core-js/modules/web.dom-collections.for-each"); | ||
require("core-js/modules/web.dom-collections.iterator"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -8,2 +62,4 @@ value: true | ||
require("regenerator-runtime/runtime"); | ||
var _types = require("./types"); | ||
@@ -10,0 +66,0 @@ |
@@ -34,3 +34,2 @@ "use strict"; | ||
var ANY_COMPONENT = Symbol('AnyComponent'); | ||
var RemoteComponentViolationType; // export interface RemoteComponentInsertChildViolation { | ||
@@ -37,0 +36,0 @@ // type: RemoteComponentViolationType.InsertChild; |
import { Dispatch, RemoteTextSerialization, RemoteComponentSerialization } from './types'; | ||
declare const ROOT_ID: unique symbol; | ||
declare type Child = RemoteTextSerialization | RemoteComponentSerialization<string>; | ||
declare type Child = RemoteTextSerialization | RemoteComponentSerialization<any>; | ||
interface Root { | ||
@@ -5,0 +5,0 @@ id: typeof ROOT_ID; |
@@ -0,3 +1,4 @@ | ||
import { RemoteChild } from '@remote-ui/types'; | ||
import { Dispatch, RemoteRoot } from './types'; | ||
export declare function createRemoteRoot<AllowedComponents extends string = string, AllowedChildrenTypes extends AllowedComponents = AllowedComponents>(dispatch: Dispatch, _config: any): RemoteRoot<AllowedComponents, AllowedChildrenTypes>; | ||
export declare function createRemoteRoot<AllowedComponents extends string = string, AllowedChildrenTypes extends AllowedComponents | RemoteChild = RemoteChild>(dispatch: Dispatch, _config: any): RemoteRoot<AllowedComponents, AllowedChildrenTypes>; | ||
//# sourceMappingURL=root.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { RemoteComponentMap } from '@remote-ui/types'; | ||
import { RemoteComponentMap, RemoteChild } from '@remote-ui/types'; | ||
declare type NonOptionalKeys<T> = { | ||
@@ -34,6 +34,5 @@ [K in keyof T]-?: undefined extends T[K] ? never : K; | ||
} | ||
declare const ANY_COMPONENT: unique symbol; | ||
declare type AllowedRemoteChildren<Children, Root extends RemoteRoot<any, any>> = Children extends string ? RemoteComponent<Children, Root> : never; | ||
declare type AllowedChildren<Children extends string | typeof ANY_COMPONENT, Root extends RemoteRoot<any, any>> = Children extends typeof ANY_COMPONENT ? RemoteComponent<any, Root> | RemoteText<Root> : AllowedRemoteChildren<Children, Root>; | ||
export interface RemoteRoot<AllowedComponents extends string | typeof ANY_COMPONENT = typeof ANY_COMPONENT, AllowedChildrenTypes extends AllowedComponents = AllowedComponents> { | ||
declare type AllowedChildren<Children extends string | RemoteChild, Root extends RemoteRoot<any, any>> = Children extends RemoteChild ? RemoteComponent<any, Root> | RemoteText<Root> : AllowedRemoteChildren<Children, Root>; | ||
export interface RemoteRoot<AllowedComponents extends string = string, AllowedChildrenTypes extends AllowedComponents | RemoteChild = RemoteChild> { | ||
readonly children: readonly AllowedChildren<AllowedChildrenTypes, RemoteRoot<AllowedComponents, AllowedChildrenTypes>>[]; | ||
@@ -43,3 +42,3 @@ appendChild(child: AllowedChildren<AllowedChildrenTypes, RemoteRoot<AllowedComponents, AllowedChildrenTypes>>): void | Promise<void>; | ||
insertChildBefore(child: AllowedChildren<AllowedChildrenTypes, RemoteRoot<AllowedComponents, AllowedChildrenTypes>>, before: AllowedChildren<AllowedChildrenTypes, RemoteRoot<AllowedComponents, AllowedChildrenTypes>>): void | Promise<void>; | ||
createComponent<Type extends AllowedComponents & string>(type: Type, ...propsPart: IfAllOptionalKeys<PropsForRemoteComponent<Type>, [PropsForRemoteComponent<Type>?], [PropsForRemoteComponent<Type>]>): RemoteComponent<Type, RemoteRoot<AllowedComponents, AllowedChildrenTypes>>; | ||
createComponent<Type extends AllowedComponents>(type: Type, ...propsPart: IfAllOptionalKeys<PropsForRemoteComponent<Type>, [PropsForRemoteComponent<Type>?], [PropsForRemoteComponent<Type>]>): RemoteComponent<Type, RemoteRoot<AllowedComponents, AllowedChildrenTypes>>; | ||
createText(text?: string): RemoteText<RemoteRoot<AllowedComponents, AllowedChildrenTypes>>; | ||
@@ -78,4 +77,4 @@ mount(): Promise<void>; | ||
export declare type Serialized<T> = T extends RemoteComponent<infer Type, any> ? RemoteComponentSerialization<Type> : T extends RemoteText<any> ? RemoteTextSerialization : never; | ||
export declare type PropsForRemoteComponent<T extends string> = T extends keyof RemoteComponentMap ? RemoteComponentMap[T] extends [infer U, any] ? U : never : never; | ||
export declare type ChildrenForRemoteComponent<T extends string> = T extends keyof RemoteComponentMap ? RemoteComponentMap[T] extends [any, infer U] ? U : never : never; | ||
export declare type PropsForRemoteComponent<T extends string> = T extends keyof RemoteComponentMap ? RemoteComponentMap[T] extends [infer U, ...any[]] ? U : never : never; | ||
export declare type ChildrenForRemoteComponent<T extends string> = T extends keyof RemoteComponentMap ? RemoteComponentMap[T] extends [any, infer U] ? U extends RemoteChild ? RemoteComponent<any, any> | RemoteText<any> : U : never : never; | ||
export declare enum RemoteComponentViolationType { | ||
@@ -82,0 +81,0 @@ InsertChild = 0, |
@@ -21,3 +21,2 @@ "use strict"; | ||
})(RemoteKind = exports.RemoteKind || (exports.RemoteKind = {})); | ||
const ANY_COMPONENT = Symbol('AnyComponent'); | ||
var RemoteComponentViolationType; | ||
@@ -24,0 +23,0 @@ (function (RemoteComponentViolationType) { |
{ | ||
"name": "@remote-ui/core", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"publishConfig": { | ||
@@ -10,6 +10,6 @@ "access": "public", | ||
"dependencies": { | ||
"@remote-ui/types": "^0.0.2", | ||
"remote-call": "^0.0.1" | ||
"@remote-ui/types": "^0.0.3", | ||
"remote-call": "^0.0.2" | ||
}, | ||
"gitHead": "e9052ca6dcbfe2feb0e625e5c29f3f8e5d98d77b" | ||
"gitHead": "9d5212902ec212aa459ca1e4ec451e5b6f31e76c" | ||
} |
@@ -6,3 +6,3 @@ import {createPackage} from '@sewing-kit/config'; | ||
pkg.entry({root: './src/index'}); | ||
pkg.plugin(defaultProjectPlugin); | ||
pkg.use(defaultProjectPlugin()); | ||
}); |
@@ -12,3 +12,3 @@ import {retain, release} from 'remote-call'; | ||
type Child = RemoteTextSerialization | RemoteComponentSerialization<string>; | ||
type Child = RemoteTextSerialization | RemoteComponentSerialization<any>; | ||
@@ -15,0 +15,0 @@ interface Root { |
@@ -0,1 +1,2 @@ | ||
import {RemoteChild} from '@remote-ui/types'; | ||
import { | ||
@@ -15,3 +16,3 @@ Action, | ||
AllowedComponents extends string = string, | ||
AllowedChildrenTypes extends AllowedComponents = AllowedComponents | ||
AllowedChildrenTypes extends AllowedComponents | RemoteChild = RemoteChild | ||
>( | ||
@@ -18,0 +19,0 @@ dispatch: Dispatch, |
@@ -1,2 +0,2 @@ | ||
import {RemoteComponentMap} from '@remote-ui/types'; | ||
import {RemoteComponentMap, RemoteChild} from '@remote-ui/types'; | ||
@@ -51,4 +51,2 @@ type NonOptionalKeys<T> = { | ||
const ANY_COMPONENT = Symbol('AnyComponent'); | ||
type AllowedRemoteChildren< | ||
@@ -60,5 +58,5 @@ Children, | ||
type AllowedChildren< | ||
Children extends string | typeof ANY_COMPONENT, | ||
Children extends string | RemoteChild, | ||
Root extends RemoteRoot<any, any> | ||
> = Children extends typeof ANY_COMPONENT | ||
> = Children extends RemoteChild | ||
? RemoteComponent<any, Root> | RemoteText<Root> | ||
@@ -68,6 +66,4 @@ : AllowedRemoteChildren<Children, Root>; | ||
export interface RemoteRoot< | ||
AllowedComponents extends | ||
| string | ||
| typeof ANY_COMPONENT = typeof ANY_COMPONENT, | ||
AllowedChildrenTypes extends AllowedComponents = AllowedComponents | ||
AllowedComponents extends string = string, | ||
AllowedChildrenTypes extends AllowedComponents | RemoteChild = RemoteChild | ||
> { | ||
@@ -100,3 +96,3 @@ readonly children: readonly AllowedChildren< | ||
): void | Promise<void>; | ||
createComponent<Type extends AllowedComponents & string>( | ||
createComponent<Type extends AllowedComponents>( | ||
type: Type, | ||
@@ -165,3 +161,3 @@ ...propsPart: IfAllOptionalKeys< | ||
> = T extends keyof RemoteComponentMap | ||
? RemoteComponentMap[T] extends [infer U, any] | ||
? RemoteComponentMap[T] extends [infer U, ...any[]] | ||
? U | ||
@@ -175,3 +171,5 @@ : never | ||
? RemoteComponentMap[T] extends [any, infer U] | ||
? U | ||
? U extends RemoteChild | ||
? RemoteComponent<any, any> | RemoteText<any> | ||
: U | ||
: never | ||
@@ -178,0 +176,0 @@ : never; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
256697
2556
+ Added@remote-ui/types@0.0.3(transitive)
+ Addedremote-call@0.0.2(transitive)
- Removed@remote-ui/types@0.0.2(transitive)
- Removedremote-call@0.0.1(transitive)
Updated@remote-ui/types@^0.0.3
Updatedremote-call@^0.0.2