@markless/core 0.3.3 → 0.4.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.
Files changed (2) hide show
  1. package/dist/index.d.ts +30 -4
  2. package/package.json +4 -4
package/dist/index.d.ts CHANGED
@@ -4,8 +4,8 @@ import { ResumePayloadDocumentInput, ResumePayloadScriptsInput, ResumePayloadScr
4
4
 
5
5
  //#region src/framework-api.d.ts
6
6
  type AsyncComputedValue<T> = T extends Promise<infer Value> ? Awaited<Value> : T;
7
- type ElementHandle<T extends Element = Element> = T | undefined;
8
- type SharedScope = 'request' | 'container' | 'page';
7
+ type ElementHandle<T extends Element | readonly Element[] = Element> = T extends readonly (infer E extends Element)[] ? E[] : T | undefined;
8
+ type SharedScope = 'request' | 'container' | 'page' | 'widget';
9
9
  type SharedOptions = {
10
10
  readonly scope: SharedScope;
11
11
  };
@@ -38,10 +38,36 @@ declare class FrameworkApiRuntimeError extends Error implements FrameworkApiRunt
38
38
  }
39
39
  declare function state<T>(initial: T): T;
40
40
  declare function computed<T>(derive: () => T): AsyncComputedValue<T>;
41
- declare function element<T extends Element = Element>(): ElementHandle<T>;
41
+ declare function element<T extends Element | Element[] = Element>(): ElementHandle<T>;
42
42
  type SharedDefinition<T> = () => T;
43
43
  declare function shared<T>(create: () => T, options?: SharedOptions): SharedDefinition<T>;
44
44
  declare function storage(fallback: string): string;
45
45
  declare function storage(key: string, fallback: string): string;
46
46
  //#endregion
47
- export { type AsyncComputedValue, type CsrRenderArtifact, type CsrRenderContainer, type CsrRenderOptions, type CsrRenderOutput, type CsrRenderable, type ElementHandle, type FrameworkApiName, type FrameworkApiRuntimeDiagnostic, FrameworkApiRuntimeError, type RenderTarget, type RenderToStringOptions, type ResumePayloadDocumentInput, type ResumePayloadScriptsInput, type ResumePayloadScriptsResult, type SharedDefinition, type SharedOptions, type SharedScope, type SsrRenderArtifact, type SsrRenderOutput, type SsrRenderable, computed, element, render, renderToString, resumeFromPayloadDocument, resumeFromPayloadScripts, shared, state, storage };
47
+ //#region src/jsx-types.d.ts
48
+ /** Anything that can sit in a component's `children` position. */
49
+ type Children = __MarklessTypeService.Child;
50
+ /** The HTML tags that cannot have children; every other tag's props include them. */
51
+ type VoidTagName = 'area' | 'base' | 'br' | 'col' | 'embed' | 'hr' | 'img' | 'input' | 'link' | 'meta' | 'source' | 'track' | 'wbr';
52
+ /**
53
+ * Every attribute, event handler, `attach`, and `el` the given intrinsic tag accepts.
54
+ * Tags that can hold content also accept `children`; void tags do not, so a part
55
+ * wrapping an `<input>` cannot be projected into by mistake.
56
+ */
57
+ type PropsOf<Tag extends __MarklessTypeService.IntrinsicTagName> = __MarklessTypeService.IntrinsicElementFor<Tag> & (Tag extends VoidTagName ? unknown : {
58
+ readonly children?: Children;
59
+ });
60
+ /**
61
+ * The instance fields a widget root seeds from its props: the same fields the
62
+ * consumer knows, made required and mutable, because a prop is optional to the
63
+ * consumer while the root assigns every one of them on every render.
64
+ */
65
+ type Seeded<Props, Keys extends keyof Props> = { -readonly [Field in Keys]-?: Props[Field] };
66
+ /**
67
+ * A compiled TSRX component, as a value: what a `.tsrx` module's default export
68
+ * is, what test harnesses mount, and what composition renders. The runtime's
69
+ * internal contract stays internal; this is the name consumers see.
70
+ */
71
+ type Component = CsrRenderable;
72
+ //#endregion
73
+ export { type AsyncComputedValue, type Children, type Component, type CsrRenderArtifact, type CsrRenderContainer, type CsrRenderOptions, type CsrRenderOutput, type CsrRenderable, type ElementHandle, type FrameworkApiName, type FrameworkApiRuntimeDiagnostic, FrameworkApiRuntimeError, type PropsOf, type RenderTarget, type RenderToStringOptions, type ResumePayloadDocumentInput, type ResumePayloadScriptsInput, type ResumePayloadScriptsResult, type Seeded, type SharedDefinition, type SharedOptions, type SharedScope, type SsrRenderArtifact, type SsrRenderOutput, type SsrRenderable, computed, element, render, renderToString, resumeFromPayloadDocument, resumeFromPayloadScripts, shared, state, storage };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markless/core",
3
- "version": "0.3.3",
3
+ "version": "0.4.0",
4
4
  "description": "Markless core authoring APIs: resumable TSRX apps with no hydration and no VDOM.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -113,9 +113,9 @@
113
113
  "provenance": true
114
114
  },
115
115
  "dependencies": {
116
- "@markless/bundler": "0.3.3",
117
- "@markless/router": "0.3.3",
118
- "@markless/web": "0.3.3"
116
+ "@markless/router": "0.4.0",
117
+ "@markless/web": "0.4.0",
118
+ "@markless/bundler": "0.4.0"
119
119
  },
120
120
  "scripts": {}
121
121
  }