marko 6.0.0-next.3.68 → 6.0.0-next.3.70

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/dist/dom.js CHANGED
@@ -222,7 +222,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
222
222
  visits.length = 0;
223
223
  let branchEnd = (branchId, reference) => {
224
224
  let branch = scopeLookup[branchId] ||= {}, endNode = reference;
225
- for (; visitNodes.has(endNode = endNode.previousSibling); ) ;
225
+ for (; endNode.previousSibling !== branch.h && visitNodes.has(endNode = endNode.previousSibling); ) ;
226
226
  return endNode === lastEndNode && (endNode = reference.parentNode.insertBefore(
227
227
  new Text(),
228
228
  reference
package/dist/dom.mjs CHANGED
@@ -137,7 +137,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
137
137
  visits.length = 0;
138
138
  let branchEnd = (branchId, reference) => {
139
139
  let branch = scopeLookup[branchId] ||= {}, endNode = reference;
140
- for (; visitNodes.has(endNode = endNode.previousSibling); ) ;
140
+ for (; endNode.previousSibling !== branch.h && visitNodes.has(endNode = endNode.previousSibling); ) ;
141
141
  return endNode === lastEndNode && (endNode = reference.parentNode.insertBefore(
142
142
  new Text(),
143
143
  reference
@@ -1,12 +1,10 @@
1
- import type { Accessor } from "../common/types";
1
+ import { type Accessor } from "../common/types";
2
2
  import type { ServerRenderer } from "./template";
3
3
  interface BodyContentObject {
4
4
  [x: PropertyKey]: unknown;
5
5
  content: ServerRenderer;
6
6
  }
7
- export declare function dynamicTagId(tagName: unknown): string | ServerRenderer | undefined;
8
- export declare let dynamicTagInput: (scopeId: number, accessor: Accessor, tag: unknown | string | ServerRenderer | BodyContentObject, input: Record<string, unknown>, content?: () => void) => undefined;
9
- export declare let dynamicTagArgs: (scopeId: number, accessor: Accessor, tag: unknown | string | ServerRenderer | BodyContentObject, args: unknown[]) => undefined;
7
+ export declare let dynamicTag: (scopeId: number, accessor: Accessor, tag: unknown | string | ServerRenderer | BodyContentObject, inputOrArgs: unknown, content?: (() => void) | 0, inputIsArgs?: 1, resume?: 1) => unknown;
10
8
  export declare function createContent(id: string, fn: ServerRenderer): ServerRenderer;
11
9
  export declare function registerContent(id: string, fn: ServerRenderer, scopeId?: number): ServerRenderer;
12
10
  export declare function patchDynamicTag(patch: (scopeId: number, accessor: Accessor, tag: unknown | string | ServerRenderer | BodyContentObject) => unknown): void;
@@ -15,7 +15,7 @@ export declare function getScopeId(scope: unknown): number | undefined;
15
15
  export declare function write(html: string): void;
16
16
  export declare function writeScript(script: string): void;
17
17
  export declare function writeEffect(scopeId: number, registryId: string): void;
18
- export declare function withContext(key: PropertyKey, value: unknown, cb: () => void): void;
18
+ export declare function withContext<T>(key: PropertyKey, value: unknown, cb: () => T): T;
19
19
  export declare function setTagVar(parentScopeId: number, scopeOffsetAccessor: Accessor, childScope: PartialScope, registryId: string): void;
20
20
  export declare function register<T extends WeakKey>(val: T, id: string, scopeId?: number): T;
21
21
  export declare function nextTagId(): string;
@@ -30,14 +30,15 @@ export declare function hoist(scopeId: number, id?: string): {
30
30
  [Symbol.iterator]: /*elided*/ any;
31
31
  };
32
32
  export declare function resumeClosestBranch(scopeId: number): void;
33
- export declare function resumeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, scopeId: number, accessor: Accessor): void;
34
- export declare function resumeSingleNodeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, scopeId: number, accessor: Accessor, onlyChildInParent?: 1): void;
35
- export declare function resumeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, scopeId: number, accessor: Accessor): void;
36
- export declare function resumeSingleNodeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, scopeId: number, accessor: Accessor, onlyChild?: 1): void;
37
- export declare function resumeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, scopeId: number, accessor: Accessor): void;
38
- export declare function resumeSingleNodeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, scopeId: number, accessor: Accessor, onlyChild?: 1): void;
39
- export declare function resumeConditional(cb: () => void | number, scopeId: number, accessor: Accessor): void;
40
- export declare function resumeSingleNodeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, onlyChild?: 1): void;
33
+ export declare function withBranchId<T>(branchId: number, cb: () => T): T;
34
+ export declare function resumeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown), scopeId: number, accessor: Accessor): void;
35
+ export declare function resumeSingleNodeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown), scopeId: number, accessor: Accessor, onlyChildInParent?: 1): void;
36
+ export declare function resumeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor): void;
37
+ export declare function resumeSingleNodeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor, onlyChild?: 1): void;
38
+ export declare function resumeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor): void;
39
+ export declare function resumeSingleNodeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, onlyChild?: 1): void;
40
+ export declare function resumeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, dynamic?: 1): void;
41
+ export declare function resumeSingleNodeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, dynamic?: 0 | 1, onlyChild?: 1): void;
41
42
  declare let writeScope: (scopeId: number, partialScope: PartialScope) => ScopeInternals;
42
43
  export { writeScope };
43
44
  export declare function writeExistingScope(scope: ScopeInternals): ScopeInternals;
@@ -70,6 +71,7 @@ export declare class State {
70
71
  hasReorderRuntime: boolean;
71
72
  hasWrittenResume: boolean;
72
73
  trailerHTML: string;
74
+ resumes: string;
73
75
  nonceAttr: string;
74
76
  serializer: Serializer;
75
77
  writeReorders: Chunk[] | null;
@@ -88,7 +90,7 @@ export declare class State {
88
90
  export declare class Boundary extends AbortController {
89
91
  state: State;
90
92
  onNext: () => void;
91
- private count;
93
+ count: number;
92
94
  constructor(state: State, parent?: AbortSignal);
93
95
  get done(): boolean;
94
96
  startAsync(): void;
@@ -115,9 +117,9 @@ export declare class Chunk {
115
117
  consume(): Chunk;
116
118
  render(content: () => void): Chunk;
117
119
  render<T>(content: (val: T) => void, val: T): Chunk;
120
+ flushScript(): this;
121
+ flushHTML(): string;
118
122
  }
119
- export declare function prepareChunk(chunk: Chunk): Chunk;
120
- export declare function flushChunk(head: Chunk, last: boolean): string;
121
123
  export declare function writeTrailers(html: string): void;
122
124
  type QueueCallback = (ticked: true) => void;
123
125
  export declare function queueTick(cb: QueueCallback): void;
package/dist/html.d.ts CHANGED
@@ -2,7 +2,7 @@ export { attrTag, attrTags } from "./common/attr-tag";
2
2
  export { attr, attrs, classAttr, controllable_detailsOrDialog_open, controllable_input_checked, controllable_input_checkedValue, controllable_input_value, controllable_select_value, controllable_textarea_value, optionValueAttr, partialAttrs, styleAttr, } from "./html/attrs";
3
3
  export { compat } from "./html/compat";
4
4
  export { escapeScript, escapeStyle, escapeXML, toString } from "./html/content";
5
- export { createContent, dynamicTagArgs, dynamicTagId, dynamicTagInput, registerContent, } from "./html/dynamic-tag";
5
+ export { createContent, dynamicTag, registerContent } from "./html/dynamic-tag";
6
6
  export { forIn, forInBy, forOf, forOfBy, forTo, forToBy } from "./html/for";
7
7
  export { createTemplate } from "./html/template";
8
8
  export { $global, ensureScopeWithId, fork, getScopeById, hoist, markResumeNode, nextScopeId, nextTagId, nodeRef, peekNextScope, register, resumeClosestBranch, resumeConditional, resumeForIn, resumeForOf, resumeForTo, resumeSingleNodeConditional, resumeSingleNodeForIn, resumeSingleNodeForOf, resumeSingleNodeForTo, setTagVar, tryContent, write, writeEffect, writeExistingScope, writeScope, writeSubscribe, writeTrailers, } from "./html/writer";