@b9g/crank 0.5.0-beta.2 → 0.5.0-beta.4
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/crank.cjs +506 -349
- package/crank.cjs.map +1 -1
- package/crank.d.ts +29 -54
- package/crank.js +506 -349
- package/crank.js.map +1 -1
- package/mod.cjs +2 -2
- package/mod.d.ts +1 -1
- package/mod.js +1 -1
- package/package.json +8 -8
- package/{xm.cjs → tags.cjs} +8 -8
- package/tags.cjs.map +1 -0
- package/tags.d.ts +2 -0
- package/{xm.js → tags.js} +9 -9
- package/tags.js.map +1 -0
- package/umd.js +506 -349
- package/umd.js.map +1 -1
- package/xm.cjs.map +0 -1
- package/xm.d.ts +0 -2
- package/xm.js.map +0 -1
package/crank.d.ts
CHANGED
|
@@ -220,16 +220,16 @@ declare class Retainer<TNode> {
|
|
|
220
220
|
* The cached child values of this element. Only host and component elements
|
|
221
221
|
* will use this property.
|
|
222
222
|
*/
|
|
223
|
-
|
|
223
|
+
cachedChildValues: ElementValue<TNode>;
|
|
224
224
|
/**
|
|
225
225
|
* The child which this retainer replaces. This property is used when an
|
|
226
226
|
* async retainer tree replaces previously rendered elements, so that the
|
|
227
227
|
* previously rendered elements can remain visible until the async tree
|
|
228
228
|
* fulfills. Will be set to undefined once this subtree fully renders.
|
|
229
229
|
*/
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
230
|
+
fallbackValue: RetainerChild<TNode>;
|
|
231
|
+
inflightValue: Promise<ElementValue<TNode>> | undefined;
|
|
232
|
+
onNextValues: Function | undefined;
|
|
233
233
|
constructor(el: Element);
|
|
234
234
|
}
|
|
235
235
|
/**
|
|
@@ -283,7 +283,7 @@ export interface RendererImpl<TNode, TScope, TRoot extends TNode = TNode, TResul
|
|
|
283
283
|
dispose<TTag extends string | symbol>(tag: TTag, node: TNode, props: TagProps<TTag>): unknown;
|
|
284
284
|
flush(root: TRoot): unknown;
|
|
285
285
|
}
|
|
286
|
-
declare const
|
|
286
|
+
declare const _RendererImpl: unique symbol;
|
|
287
287
|
/**
|
|
288
288
|
* An abstract class which is subclassed to render to different target
|
|
289
289
|
* environments. This class is responsible for kicking off the rendering
|
|
@@ -300,7 +300,7 @@ export declare class Renderer<TNode extends object = object, TScope = unknown, T
|
|
|
300
300
|
* A weakmap which stores element trees by root.
|
|
301
301
|
*/
|
|
302
302
|
cache: WeakMap<object, Retainer<TNode>>;
|
|
303
|
-
[
|
|
303
|
+
[_RendererImpl]: RendererImpl<TNode, TScope, TRoot, TResult>;
|
|
304
304
|
constructor(impl: Partial<RendererImpl<TNode, TScope, TRoot, TResult>>);
|
|
305
305
|
/**
|
|
306
306
|
* Renders an element tree into a specific root.
|
|
@@ -309,7 +309,7 @@ export declare class Renderer<TNode extends object = object, TScope = unknown, T
|
|
|
309
309
|
* used root to delete the previously rendered element tree from the cache.
|
|
310
310
|
* @param root - The node to be rendered into. The renderer will cache
|
|
311
311
|
* element trees per root.
|
|
312
|
-
* @param
|
|
312
|
+
* @param bridge - An optional context that will be the ancestor context of all
|
|
313
313
|
* elements in the tree. Useful for connecting different renderers so that
|
|
314
314
|
* events/provisions properly propagate. The context for a given root must be
|
|
315
315
|
* the same or an error will be thrown.
|
|
@@ -329,75 +329,50 @@ export interface ProvisionMap extends Crank.ProvisionMap {
|
|
|
329
329
|
}
|
|
330
330
|
/**
|
|
331
331
|
* @internal
|
|
332
|
-
* The internal class which holds
|
|
332
|
+
* The internal class which holds context data.
|
|
333
333
|
*/
|
|
334
334
|
declare class ContextImpl<TNode = unknown, TScope = unknown, TRoot extends TNode = TNode, TResult = unknown> {
|
|
335
|
-
/**
|
|
336
|
-
* flags - A bitmask. See CONTEXT FLAGS above.
|
|
337
|
-
*/
|
|
335
|
+
/** A bitmask. See CONTEXT FLAGS above. */
|
|
338
336
|
f: number;
|
|
337
|
+
/** The actual context associated with this impl. */
|
|
338
|
+
owner: Context<unknown, TResult>;
|
|
339
339
|
/**
|
|
340
|
-
*
|
|
341
|
-
*/
|
|
342
|
-
ctx: Context<unknown, TResult>;
|
|
343
|
-
/**
|
|
344
|
-
* renderer - The renderer which created this context.
|
|
340
|
+
* The renderer which created this context.
|
|
345
341
|
*/
|
|
346
342
|
renderer: RendererImpl<TNode, TScope, TRoot, TResult>;
|
|
347
|
-
/**
|
|
348
|
-
* root - The root node as set by the nearest ancestor portal.
|
|
349
|
-
*/
|
|
343
|
+
/** The root node as set by the nearest ancestor portal. */
|
|
350
344
|
root: TRoot | undefined;
|
|
351
345
|
/**
|
|
352
|
-
*
|
|
346
|
+
* The nearest ancestor host or portal retainer.
|
|
353
347
|
*
|
|
354
348
|
* When refresh is called, the host element will be arranged as the last step
|
|
355
349
|
* of the commit, to make sure the parent’s children properly reflects the
|
|
356
350
|
* components’s children.
|
|
357
351
|
*/
|
|
358
352
|
host: Retainer<TNode>;
|
|
359
|
-
/**
|
|
360
|
-
* parent - The parent context.
|
|
361
|
-
*/
|
|
353
|
+
/** The parent context impl. */
|
|
362
354
|
parent: ContextImpl<TNode, TScope, TRoot, TResult> | undefined;
|
|
363
|
-
/**
|
|
364
|
-
* scope - The value of the scope at the point of element’s creation.
|
|
365
|
-
*/
|
|
355
|
+
/** The value of the scope at the point of element’s creation. */
|
|
366
356
|
scope: TScope | undefined;
|
|
367
|
-
/**
|
|
368
|
-
* retainer - The internal node associated with this context.
|
|
369
|
-
*/
|
|
357
|
+
/** The internal node associated with this context. */
|
|
370
358
|
ret: Retainer<TNode>;
|
|
371
359
|
/**
|
|
372
|
-
*
|
|
360
|
+
* The iterator returned by the component function.
|
|
361
|
+
*
|
|
362
|
+
* Existence of this property implies that the component is a generator
|
|
363
|
+
* component. It is deleted when a component is returned.
|
|
373
364
|
*/
|
|
374
365
|
iterator: Iterator<Children, Children | void, unknown> | AsyncIterator<Children, Children | void, unknown> | undefined;
|
|
375
|
-
/*** async properties ***/
|
|
376
|
-
/**
|
|
377
|
-
* inflightBlock
|
|
378
|
-
*/
|
|
379
366
|
inflightBlock: Promise<unknown> | undefined;
|
|
380
|
-
/**
|
|
381
|
-
* inflightValue
|
|
382
|
-
*/
|
|
383
367
|
inflightValue: Promise<ElementValue<TNode>> | undefined;
|
|
384
|
-
/**
|
|
385
|
-
* enqueuedBlock
|
|
386
|
-
*/
|
|
387
368
|
enqueuedBlock: Promise<unknown> | undefined;
|
|
388
|
-
/**
|
|
389
|
-
* enqueuedValue
|
|
390
|
-
*/
|
|
391
369
|
enqueuedValue: Promise<ElementValue<TNode>> | undefined;
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
* implement the props async iterator. See the Symbol.asyncIterator method
|
|
395
|
-
* and the resumeCtxIterator function.
|
|
396
|
-
*/
|
|
397
|
-
onAvailable: Function | undefined;
|
|
370
|
+
onProps: ((props: Record<string, any>) => unknown) | undefined;
|
|
371
|
+
onPropsRequested: Function | undefined;
|
|
398
372
|
constructor(renderer: RendererImpl<TNode, TScope, TRoot, TResult>, root: TRoot | undefined, host: Retainer<TNode>, parent: ContextImpl<TNode, TScope, TRoot, TResult> | undefined, scope: TScope | undefined, ret: Retainer<TNode>);
|
|
399
373
|
}
|
|
400
|
-
declare const
|
|
374
|
+
declare const _ContextImpl: unique symbol;
|
|
375
|
+
declare type ComponentProps<T> = T extends (props: infer U) => any ? U : T;
|
|
401
376
|
/**
|
|
402
377
|
* A class which is instantiated and passed to every component as its this
|
|
403
378
|
* value. Contexts form a tree just like elements and all components in the
|
|
@@ -414,7 +389,7 @@ export declare class Context<TProps = any, TResult = any> implements EventTarget
|
|
|
414
389
|
/**
|
|
415
390
|
* @internal
|
|
416
391
|
*/
|
|
417
|
-
[
|
|
392
|
+
[_ContextImpl]: ContextImpl<unknown, unknown, unknown, TResult>;
|
|
418
393
|
constructor(impl: ContextImpl<unknown, unknown, unknown, TResult>);
|
|
419
394
|
/**
|
|
420
395
|
* The current props of the associated element.
|
|
@@ -423,7 +398,7 @@ export declare class Context<TProps = any, TResult = any> implements EventTarget
|
|
|
423
398
|
* component or via the context iterator methods. This property is mainly for
|
|
424
399
|
* plugins or utilities which wrap contexts.
|
|
425
400
|
*/
|
|
426
|
-
get props(): TProps
|
|
401
|
+
get props(): ComponentProps<TProps>;
|
|
427
402
|
/**
|
|
428
403
|
* The current value of the associated element.
|
|
429
404
|
*
|
|
@@ -432,8 +407,8 @@ export declare class Context<TProps = any, TResult = any> implements EventTarget
|
|
|
432
407
|
* mainly for plugins or utilities which wrap contexts.
|
|
433
408
|
*/
|
|
434
409
|
get value(): TResult;
|
|
435
|
-
[Symbol.iterator](): Generator<TProps
|
|
436
|
-
[Symbol.asyncIterator](): AsyncGenerator<TProps
|
|
410
|
+
[Symbol.iterator](): Generator<ComponentProps<TProps>>;
|
|
411
|
+
[Symbol.asyncIterator](): AsyncGenerator<ComponentProps<TProps>>;
|
|
437
412
|
/**
|
|
438
413
|
* Re-executes a component.
|
|
439
414
|
*
|