@b9g/crank 0.5.0-beta.3 → 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.d.ts CHANGED
@@ -332,61 +332,47 @@ export interface ProvisionMap extends Crank.ProvisionMap {
332
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
- * ctx - The actual object passed as this to components.
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
- * host - The nearest host or portal retainer.
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
- * iterator - The iterator returned by the component function.
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
366
  inflightBlock: Promise<unknown> | undefined;
377
367
  inflightValue: Promise<ElementValue<TNode>> | undefined;
378
368
  enqueuedBlock: Promise<unknown> | undefined;
379
369
  enqueuedValue: Promise<ElementValue<TNode>> | undefined;
380
- /**
381
- * onProps - A callback used in conjunction with the IsAvailable flag to
382
- * implement the props async iterator. See the Symbol.asyncIterator method
383
- * and the resumeCtxIterator function.
384
- */
385
370
  onProps: ((props: Record<string, any>) => unknown) | undefined;
386
371
  onPropsRequested: Function | undefined;
387
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>);
388
373
  }
389
374
  declare const _ContextImpl: unique symbol;
375
+ declare type ComponentProps<T> = T extends (props: infer U) => any ? U : T;
390
376
  /**
391
377
  * A class which is instantiated and passed to every component as its this
392
378
  * value. Contexts form a tree just like elements and all components in the
@@ -412,7 +398,7 @@ export declare class Context<TProps = any, TResult = any> implements EventTarget
412
398
  * component or via the context iterator methods. This property is mainly for
413
399
  * plugins or utilities which wrap contexts.
414
400
  */
415
- get props(): TProps;
401
+ get props(): ComponentProps<TProps>;
416
402
  /**
417
403
  * The current value of the associated element.
418
404
  *
@@ -421,8 +407,8 @@ export declare class Context<TProps = any, TResult = any> implements EventTarget
421
407
  * mainly for plugins or utilities which wrap contexts.
422
408
  */
423
409
  get value(): TResult;
424
- [Symbol.iterator](): Generator<TProps>;
425
- [Symbol.asyncIterator](): AsyncGenerator<TProps>;
410
+ [Symbol.iterator](): Generator<ComponentProps<TProps>>;
411
+ [Symbol.asyncIterator](): AsyncGenerator<ComponentProps<TProps>>;
426
412
  /**
427
413
  * Re-executes a component.
428
414
  *