marko 6.0.0-next.3.84 → 6.0.0-next.3.86

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
@@ -1048,7 +1048,10 @@ function dynamicClosureRead(valueAccessor, fn, getOwnerScope) {
1048
1048
  }
1049
1049
  function closure(valueAccessor, fn, getOwnerScope) {
1050
1050
  return (scope) => {
1051
- fn(scope, (getOwnerScope ? getOwnerScope(scope) : scope._)[valueAccessor]);
1051
+ fn(
1052
+ scope,
1053
+ (getOwnerScope ? getOwnerScope(scope) : scope._)[valueAccessor]
1054
+ );
1052
1055
  };
1053
1056
  }
1054
1057
  function setTagVar(scope, childAccessor, tagVarSignal2) {
@@ -1166,14 +1169,14 @@ function createTry(nodeAccessor, tryContent) {
1166
1169
  function renderCatch(scope, error) {
1167
1170
  let tryWithCatch = findBranchWithKey(scope, "b" /* CatchContent */);
1168
1171
  if (tryWithCatch) {
1169
- let placeholderBranch = tryWithCatch.c;
1170
- placeholderBranch && (tryWithCatch.n = 0, tryWithCatch._["d" /* ConditionalScope */ + tryWithCatch.a] = placeholderBranch, destroyBranch(tryWithCatch)), caughtError.add(pendingEffects), setConditionalRenderer(
1171
- tryWithCatch._,
1172
+ let owner = tryWithCatch._, placeholderBranch = tryWithCatch.c;
1173
+ placeholderBranch && (tryWithCatch.n = 0, owner["d" /* ConditionalScope */ + tryWithCatch.a] = placeholderBranch, destroyBranch(tryWithCatch)), caughtError.add(pendingEffects), setConditionalRenderer(
1174
+ owner,
1172
1175
  tryWithCatch.a,
1173
1176
  tryWithCatch.b,
1174
1177
  createAndSetupBranch
1175
1178
  ), tryWithCatch.b.l?.(
1176
- tryWithCatch._["d" /* ConditionalScope */ + tryWithCatch.a],
1179
+ owner["d" /* ConditionalScope */ + tryWithCatch.a],
1177
1180
  [error]
1178
1181
  );
1179
1182
  } else
package/dist/dom.mjs CHANGED
@@ -963,7 +963,10 @@ function dynamicClosureRead(valueAccessor, fn, getOwnerScope) {
963
963
  }
964
964
  function closure(valueAccessor, fn, getOwnerScope) {
965
965
  return (scope) => {
966
- fn(scope, (getOwnerScope ? getOwnerScope(scope) : scope._)[valueAccessor]);
966
+ fn(
967
+ scope,
968
+ (getOwnerScope ? getOwnerScope(scope) : scope._)[valueAccessor]
969
+ );
967
970
  };
968
971
  }
969
972
  function setTagVar(scope, childAccessor, tagVarSignal2) {
@@ -1081,14 +1084,14 @@ function createTry(nodeAccessor, tryContent) {
1081
1084
  function renderCatch(scope, error) {
1082
1085
  let tryWithCatch = findBranchWithKey(scope, "b" /* CatchContent */);
1083
1086
  if (tryWithCatch) {
1084
- let placeholderBranch = tryWithCatch.c;
1085
- placeholderBranch && (tryWithCatch.n = 0, tryWithCatch._["d" /* ConditionalScope */ + tryWithCatch.a] = placeholderBranch, destroyBranch(tryWithCatch)), caughtError.add(pendingEffects), setConditionalRenderer(
1086
- tryWithCatch._,
1087
+ let owner = tryWithCatch._, placeholderBranch = tryWithCatch.c;
1088
+ placeholderBranch && (tryWithCatch.n = 0, owner["d" /* ConditionalScope */ + tryWithCatch.a] = placeholderBranch, destroyBranch(tryWithCatch)), caughtError.add(pendingEffects), setConditionalRenderer(
1089
+ owner,
1087
1090
  tryWithCatch.a,
1088
1091
  tryWithCatch.b,
1089
1092
  createAndSetupBranch
1090
1093
  ), tryWithCatch.b.l?.(
1091
- tryWithCatch._["d" /* ConditionalScope */ + tryWithCatch.a],
1094
+ owner["d" /* ConditionalScope */ + tryWithCatch.a],
1092
1095
  [error]
1093
1096
  );
1094
1097
  } else
@@ -1,5 +1,5 @@
1
1
  import { patchDynamicTag } from "./dynamic-tag";
2
- import type { ServerRenderer } from "./template";
2
+ import { type ServerRenderer } from "./template";
3
3
  import { fork, nextScopeId, write, writeScript } from "./writer";
4
4
  export declare const compat: {
5
5
  fork: typeof fork;
@@ -1,10 +1,10 @@
1
1
  import { type Accessor } from "../common/types";
2
- import type { ServerRenderer } from "./template";
2
+ import { type ServerRenderer } from "./template";
3
3
  interface BodyContentObject {
4
4
  [x: PropertyKey]: unknown;
5
5
  content: ServerRenderer;
6
6
  }
7
- export declare let dynamicTag: (scopeId: number, accessor: Accessor, tag: unknown | string | ServerRenderer | BodyContentObject, inputOrArgs: unknown, content?: (() => void) | 0, inputIsArgs?: 1, resume?: 1) => unknown;
7
+ export declare let dynamicTag: (scopeId: number, accessor: Accessor, tag: unknown | string | ServerRenderer | BodyContentObject, inputOrArgs: unknown, content?: (() => void) | 0, inputIsArgs?: 1, shouldResume?: 1 | 0) => unknown;
8
8
  export declare function createContent(id: string, fn: ServerRenderer): ServerRenderer;
9
9
  export declare function registerContent(id: string, fn: ServerRenderer, scopeId?: number): ServerRenderer;
10
10
  export declare function patchDynamicTag(patch: (scopeId: number, accessor: Accessor, tag: unknown | string | ServerRenderer | BodyContentObject) => unknown): void;
@@ -3,3 +3,4 @@ export type ServerRenderer = ((...args: unknown[]) => unknown) & {
3
3
  ___id?: string;
4
4
  };
5
5
  export declare const createTemplate: (templateId: string, renderer: ServerRenderer) => Template;
6
+ export declare function isTemplate(renderer: ServerRenderer | Template): renderer is ServerRenderer & Template;
@@ -18,14 +18,16 @@ export declare function write(html: string): void;
18
18
  export declare function writeScript(script: string): void;
19
19
  export declare function writeEffect(scopeId: number, registryId: string): void;
20
20
  export declare function withContext<T>(key: PropertyKey, value: unknown, cb: () => T): T;
21
- export declare function setTagVar(parentScopeId: number, scopeOffsetAccessor: Accessor, childScope: PartialScope, registryId: string): void;
21
+ export declare function setTagVar(parentScopeId: number, scopeOffsetAccessor: Accessor, childScopeId: number, registryId: string): void;
22
22
  export declare function register<T extends WeakKey>(val: T, id: string, scopeId?: number): T;
23
23
  export declare function nextTagId(): string;
24
24
  export declare function nextScopeId(): number;
25
25
  export declare function peekNextScopeId(): number;
26
- export declare function peekNextScope(): PartialScope;
27
26
  export declare function getScopeById(scopeId: number | undefined): PartialScope | undefined;
28
- export declare function markResumeNode(scopeId: number, accessor: Accessor): string;
27
+ export declare function serializeIf(condition: undefined | 1 | Record<string, 1>, key: string): 1 | undefined;
28
+ export declare function serializeGuard(condition: undefined | 1 | Record<string, 1>, key: string): 0 | 1;
29
+ export declare function markResumeNode(scopeId: number, accessor: Accessor, shouldResume?: 0 | 1): string;
30
+ export declare function commentSeparator(shouldResume: 0 | 1): "" | "<!>";
29
31
  export declare function nodeRef(scopeId: number, id?: string): () => void;
30
32
  export declare function hoist(scopeId: number, id?: string): {
31
33
  (): void;
@@ -33,17 +35,17 @@ export declare function hoist(scopeId: number, id?: string): {
33
35
  };
34
36
  export declare function resumeClosestBranch(scopeId: number): void;
35
37
  export declare function withBranchId<T>(branchId: number, cb: () => T): T;
36
- 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;
37
- 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;
38
- export declare function resumeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor): void;
39
- 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;
40
- 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;
41
- 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;
42
- export declare function resumeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, dynamic?: 1): void;
43
- export declare function resumeSingleNodeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, dynamic?: 0 | 1, onlyChild?: 1): void;
38
+ 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, serializeBranch?: 0 | 1): void;
39
+ 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, serializeBranch?: 0 | 1, onlyChildInParent?: 1): void;
40
+ export declare function resumeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1): void;
41
+ export declare function resumeSingleNodeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, onlyChild?: 1): void;
42
+ 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, serializeBranch?: 0 | 1): void;
43
+ 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, serializeBranch?: 0 | 1, onlyChild?: 1): void;
44
+ export declare function resumeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 1): number | void;
45
+ export declare function resumeSingleNodeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, onlyChild?: 1): number | void;
44
46
  declare let writeScope: (scopeId: number, partialScope: PartialScope) => ScopeInternals;
45
47
  export { writeScope };
46
- export declare function writeExistingScope(scope: ScopeInternals): ScopeInternals;
48
+ export declare function writeExistingScope(scopeId: number): ScopeInternals;
47
49
  export declare function ensureScopeWithId(scopeId: number): PartialScope;
48
50
  export declare function $global(): $Global & {
49
51
  renderId: string;
package/dist/html.d.ts CHANGED
@@ -5,4 +5,4 @@ export { escapeScript, escapeStyle, escapeXML, toString } from "./html/content";
5
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
- 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";
8
+ export { $global, commentSeparator, ensureScopeWithId, fork, getScopeById, hoist, markResumeNode, nextScopeId, nextTagId, nodeRef, peekNextScopeId, register, resumeClosestBranch, resumeConditional, resumeForIn, resumeForOf, resumeForTo, resumeSingleNodeConditional, resumeSingleNodeForIn, resumeSingleNodeForOf, resumeSingleNodeForTo, serializeGuard, serializeIf, setTagVar, tryContent, write, writeEffect, writeExistingScope, writeScope, writeSubscribe, writeTrailers, } from "./html/writer";