@remote-ui/core
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -24,8 +24,2 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "RemoteChild", { | ||
enumerable: true, | ||
get: function get() { | ||
return _types.RemoteChild; | ||
} | ||
}); | ||
Object.defineProperty(exports, "RemoteRoot", { | ||
@@ -32,0 +26,0 @@ enumerable: true, |
@@ -173,4 +173,3 @@ "use strict"; | ||
if (mounted && (element === remoteRoot || connected(element))) { | ||
// eslint-disable-next-line no-warning-comments | ||
// TODO: only create context once async queue is cleared | ||
// should only create context once async queue is cleared | ||
var remoteResult = remote(dispatch); | ||
@@ -177,0 +176,0 @@ |
@@ -6,12 +6,3 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "RemoteChild", { | ||
enumerable: true, | ||
get: function get() { | ||
return _types.RemoteChild; | ||
} | ||
}); | ||
exports.RemoteComponentViolationType = exports.RemoteKind = exports.UpdateOperation = exports.Action = void 0; | ||
var _types = require("@remote-ui/types"); | ||
var Action; | ||
@@ -44,2 +35,3 @@ exports.Action = Action; | ||
var ANY_COMPONENT = Symbol('AnyComponent'); | ||
var RemoteComponentViolationType; // export interface RemoteComponentInsertChildViolation { | ||
@@ -46,0 +38,0 @@ // type: RemoteComponentViolationType.InsertChild; |
export { createRemoteComponent } from './component'; | ||
export { Action, Dispatch, RemoteChild, RemoteRoot, RemoteComponent, RemoteText, Serialized, PropsForRemoteComponent, ChildrenForRemoteComponent, } from './types'; | ||
export { Action, Dispatch, RemoteRoot, RemoteComponent, RemoteText, Serialized, PropsForRemoteComponent, ChildrenForRemoteComponent, } from './types'; | ||
export { createRemoteRoot } from './root'; | ||
export { Receiver } from './receiver'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,3 +0,3 @@ | ||
import { Dispatch, RemoteChild, RemoteRoot } from './types'; | ||
export declare function createRemoteRoot<AllowedComponents extends string = string, AllowedChildrenTypes extends AllowedComponents | RemoteChild = RemoteChild>(dispatch: Dispatch, _config: any): RemoteRoot<AllowedComponents, AllowedChildrenTypes>; | ||
import { Dispatch, RemoteRoot } from './types'; | ||
export declare function createRemoteRoot<AllowedComponents extends string = string, AllowedChildrenTypes extends AllowedComponents = AllowedComponents>(dispatch: Dispatch, _config: any): RemoteRoot<AllowedComponents, AllowedChildrenTypes>; | ||
//# sourceMappingURL=root.d.ts.map |
@@ -73,4 +73,3 @@ "use strict"; | ||
if (mounted && (element === remoteRoot || connected(element))) { | ||
// eslint-disable-next-line no-warning-comments | ||
// TODO: only create context once async queue is cleared | ||
// should only create context once async queue is cleared | ||
const remoteResult = remote(dispatch); | ||
@@ -77,0 +76,0 @@ if (remoteResult == null || !('then' in remoteResult)) { |
@@ -1,3 +0,2 @@ | ||
import { RemoteChild, RemoteComponentMap } from '@remote-ui/types'; | ||
export { RemoteChild }; | ||
import { RemoteComponentMap } from '@remote-ui/types'; | ||
declare type NonOptionalKeys<T> = { | ||
@@ -35,5 +34,6 @@ [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, 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> { | ||
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> { | ||
readonly children: readonly AllowedChildren<AllowedChildrenTypes, RemoteRoot<AllowedComponents, AllowedChildrenTypes>>[]; | ||
@@ -43,3 +43,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>(type: Type, ...propsPart: IfAllOptionalKeys<PropsForRemoteComponent<Type>, [PropsForRemoteComponent<Type>?], [PropsForRemoteComponent<Type>]>): RemoteComponent<Type, RemoteRoot<AllowedComponents, AllowedChildrenTypes>>; | ||
createComponent<Type extends AllowedComponents & string>(type: Type, ...propsPart: IfAllOptionalKeys<PropsForRemoteComponent<Type>, [PropsForRemoteComponent<Type>?], [PropsForRemoteComponent<Type>]>): RemoteComponent<Type, RemoteRoot<AllowedComponents, AllowedChildrenTypes>>; | ||
createText(text?: string): RemoteText<RemoteRoot<AllowedComponents, AllowedChildrenTypes>>; | ||
@@ -78,4 +78,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> = RemoteComponentMap[T][0]; | ||
export declare type ChildrenForRemoteComponent<T extends string> = RemoteComponentMap[T][1]; | ||
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 enum RemoteComponentViolationType { | ||
@@ -86,2 +86,3 @@ InsertChild = 0, | ||
} | ||
export {}; | ||
//# sourceMappingURL=types.d.ts.map |
@@ -21,2 +21,3 @@ "use strict"; | ||
})(RemoteKind = exports.RemoteKind || (exports.RemoteKind = {})); | ||
const ANY_COMPONENT = Symbol('AnyComponent'); | ||
var RemoteComponentViolationType; | ||
@@ -23,0 +24,0 @@ (function (RemoteComponentViolationType) { |
{ | ||
"name": "@remote-ui/core", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"publishConfig": { | ||
@@ -9,3 +9,7 @@ "access": "public", | ||
"license": "MIT", | ||
"gitHead": "56d341f21de7383e7f74a69791b7aba6f6c19977" | ||
"dependencies": { | ||
"@remote-ui/types": "^0.0.2", | ||
"remote-call": "^0.0.1" | ||
}, | ||
"gitHead": "e9052ca6dcbfe2feb0e625e5c29f3f8e5d98d77b" | ||
} |
@@ -5,3 +5,2 @@ export {createRemoteComponent} from './component'; | ||
Dispatch, | ||
RemoteChild, | ||
RemoteRoot, | ||
@@ -8,0 +7,0 @@ RemoteComponent, |
@@ -5,3 +5,2 @@ import { | ||
Serialized, | ||
RemoteChild, | ||
RemoteRoot, | ||
@@ -17,3 +16,3 @@ RemoteText, | ||
AllowedComponents extends string = string, | ||
AllowedChildrenTypes extends AllowedComponents | RemoteChild = RemoteChild | ||
AllowedChildrenTypes extends AllowedComponents = AllowedComponents | ||
>( | ||
@@ -141,4 +140,3 @@ dispatch: Dispatch, | ||
if (mounted && (element === remoteRoot || connected(element as any))) { | ||
// eslint-disable-next-line no-warning-comments | ||
// TODO: only create context once async queue is cleared | ||
// should only create context once async queue is cleared | ||
const remoteResult = remote(dispatch); | ||
@@ -145,0 +143,0 @@ |
@@ -1,5 +0,3 @@ | ||
import {RemoteChild, RemoteComponentMap} from '@remote-ui/types'; | ||
import {RemoteComponentMap} from '@remote-ui/types'; | ||
export {RemoteChild}; | ||
type NonOptionalKeys<T> = { | ||
@@ -53,2 +51,4 @@ [K in keyof T]-?: undefined extends T[K] ? never : K; | ||
const ANY_COMPONENT = Symbol('AnyComponent'); | ||
type AllowedRemoteChildren< | ||
@@ -60,5 +60,5 @@ Children, | ||
type AllowedChildren< | ||
Children, | ||
Children extends string | typeof ANY_COMPONENT, | ||
Root extends RemoteRoot<any, any> | ||
> = Children extends RemoteChild | ||
> = Children extends typeof ANY_COMPONENT | ||
? RemoteComponent<any, Root> | RemoteText<Root> | ||
@@ -68,4 +68,6 @@ : AllowedRemoteChildren<Children, Root>; | ||
export interface RemoteRoot< | ||
AllowedComponents extends string = string, | ||
AllowedChildrenTypes extends AllowedComponents | RemoteChild = RemoteChild | ||
AllowedComponents extends | ||
| string | ||
| typeof ANY_COMPONENT = typeof ANY_COMPONENT, | ||
AllowedChildrenTypes extends AllowedComponents = AllowedComponents | ||
> { | ||
@@ -98,3 +100,3 @@ readonly children: readonly AllowedChildren< | ||
): void | Promise<void>; | ||
createComponent<Type extends AllowedComponents>( | ||
createComponent<Type extends AllowedComponents & string>( | ||
type: Type, | ||
@@ -162,7 +164,15 @@ ...propsPart: IfAllOptionalKeys< | ||
T extends string | ||
> = RemoteComponentMap[T][0]; | ||
> = T extends keyof RemoteComponentMap | ||
? RemoteComponentMap[T] extends [infer U, any] | ||
? U | ||
: never | ||
: never; | ||
export type ChildrenForRemoteComponent< | ||
T extends string | ||
> = RemoteComponentMap[T][1]; | ||
> = T extends keyof RemoteComponentMap | ||
? RemoteComponentMap[T] extends [any, infer U] | ||
? U | ||
: never | ||
: never; | ||
@@ -169,0 +179,0 @@ export enum RemoteComponentViolationType { |
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
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
252067
2
1965
+ Added@remote-ui/types@^0.0.2
+ Addedremote-call@^0.0.1
+ Added@remote-ui/types@0.0.2(transitive)
+ Addedremote-call@0.0.1(transitive)