marko 6.4.15 → 6.5.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 (97) hide show
  1. package/cheatsheet.md +12 -1
  2. package/dist/debug/dom/catch.feat.js +2 -2
  3. package/dist/debug/dom/catch.feat.mjs +2 -2
  4. package/dist/debug/dom/compat.feat.js +1 -1
  5. package/dist/debug/dom/compat.feat.mjs +1 -1
  6. package/dist/debug/dom/controllable-input.feat.js +1 -1
  7. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  8. package/dist/debug/dom/controllable-open.feat.js +1 -1
  9. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  10. package/dist/debug/dom/controllable-select.feat.js +1 -1
  11. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  12. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  13. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  14. package/dist/debug/dom/controllable.feat.js +1 -1
  15. package/dist/debug/dom/controllable.feat.mjs +1 -1
  16. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  17. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  18. package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
  19. package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
  20. package/dist/debug/dom/lazy.feat.js +1 -1
  21. package/dist/debug/dom/lazy.feat.mjs +1 -1
  22. package/dist/debug/dom/placeholder.feat.js +1 -1
  23. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  24. package/dist/debug/{dom-sfzdCRAg.js → dom-BiJ_UKJV.js} +12 -12
  25. package/dist/debug/{dom-BORByF2b.mjs → dom-D3A8gh_D.mjs} +5 -5
  26. package/dist/debug/dom.js +3 -2
  27. package/dist/debug/dom.mjs +2 -2
  28. package/dist/debug/html/compat.feat.js +1 -1
  29. package/dist/debug/html/compat.feat.mjs +1 -1
  30. package/dist/debug/{html-C17tAtch.mjs → html-Bfl3MJP9.mjs} +29 -22
  31. package/dist/debug/{html-7qRi22mK.js → html-shBfuhlc.js} +29 -22
  32. package/dist/debug/html.js +1 -1
  33. package/dist/debug/html.mjs +1 -1
  34. package/dist/dom/catch.feat.js +3 -3
  35. package/dist/dom/catch.feat.mjs +2 -2
  36. package/dist/dom/compat.feat.js +1 -1
  37. package/dist/dom/compat.feat.mjs +1 -1
  38. package/dist/dom/control-flow.d.ts +1 -1
  39. package/dist/dom/controllable-input.feat.js +1 -1
  40. package/dist/dom/controllable-input.feat.mjs +1 -1
  41. package/dist/dom/controllable-open.feat.js +1 -1
  42. package/dist/dom/controllable-open.feat.mjs +1 -1
  43. package/dist/dom/controllable-select.feat.js +1 -1
  44. package/dist/dom/controllable-select.feat.mjs +1 -1
  45. package/dist/dom/controllable-textarea.feat.js +1 -1
  46. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  47. package/dist/dom/controllable.feat.js +1 -1
  48. package/dist/dom/controllable.feat.mjs +1 -1
  49. package/dist/dom/dynamic-tag-script.feat.js +1 -1
  50. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  51. package/dist/dom/dynamic-tag-var.feat.js +1 -1
  52. package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
  53. package/dist/dom/lazy.feat.js +1 -1
  54. package/dist/dom/lazy.feat.mjs +1 -1
  55. package/dist/dom/placeholder.feat.js +1 -1
  56. package/dist/dom/placeholder.feat.mjs +1 -1
  57. package/dist/dom/renderer.d.ts +1 -1
  58. package/dist/{dom-DRiewpRL.js → dom-B3piR0q1.js} +7 -7
  59. package/dist/{dom-DKn1bCPC.mjs → dom-CPk_8CMB.mjs} +5 -5
  60. package/dist/dom.d.ts +1 -1
  61. package/dist/dom.js +3 -3
  62. package/dist/dom.mjs +2 -2
  63. package/dist/html/assets.d.ts +1 -1
  64. package/dist/html/compat.feat.js +1 -1
  65. package/dist/html/compat.feat.mjs +1 -1
  66. package/dist/html/control-flow.d.ts +9 -9
  67. package/dist/html/for.d.ts +3 -3
  68. package/dist/html/serializer.d.ts +2 -0
  69. package/dist/html/writer.d.ts +2 -2
  70. package/dist/{html-6w1jd6wm.mjs → html-BD-y50wS.mjs} +27 -24
  71. package/dist/{html-BaAyg2TB.js → html-aFBpTKdf.js} +27 -24
  72. package/dist/html.js +1 -1
  73. package/dist/html.mjs +1 -1
  74. package/dist/translator/core/define.d.ts +6 -0
  75. package/dist/translator/core/show.d.ts +1 -1
  76. package/dist/translator/index.js +808 -751
  77. package/dist/translator/interop/build-aggregate-error.d.ts +1 -1
  78. package/dist/translator/util/assert.d.ts +2 -0
  79. package/dist/translator/util/bindings.d.ts +15 -8
  80. package/dist/translator/util/cyclic-memo.d.ts +2 -1
  81. package/dist/translator/util/entry-builder.d.ts +2 -3
  82. package/dist/translator/util/finalize-references.d.ts +0 -1
  83. package/dist/translator/util/for-selector.d.ts +0 -1
  84. package/dist/translator/util/module-registrations.d.ts +1 -0
  85. package/dist/translator/util/optional.d.ts +7 -5
  86. package/dist/translator/util/reasons.d.ts +1 -2
  87. package/dist/translator/util/references.d.ts +6 -5
  88. package/dist/translator/util/sections.d.ts +5 -1
  89. package/dist/translator/util/signals.d.ts +1 -1
  90. package/dist/translator/util/slots.d.ts +1 -2
  91. package/dist/translator/util/solve-reasons.d.ts +8 -6
  92. package/dist/translator/util/structure.d.ts +1 -0
  93. package/dist/translator/util/write-guard.d.ts +2 -0
  94. package/dist/translator/util/writer.d.ts +1 -2
  95. package/dist/translator/visitors/tag/native-tag.d.ts +2 -0
  96. package/index.d.ts +11 -0
  97. package/package.json +4 -4
@@ -1,2 +1,2 @@
1
1
  import type { types as t } from "@marko/compiler";
2
- export declare function buildAggregateError(file: t.BabelFile, rootMsg: string, ...paths: [string, t.NodePath][]): SyntaxError;
2
+ export declare function buildAggregateError(file: t.BabelFile, rootMsg: string, ...features: [string, t.Node][]): SyntaxError;
@@ -26,6 +26,8 @@ export declare function assertForType(tag: t.NodePath<t.MarkoTag>): ForType;
26
26
  export declare function getForAttrs(type: ForType): string[];
27
27
  /** Throws for a param that a loop of `type` never supplies. */
28
28
  export declare function assertForParams(tag: t.NodePath<t.MarkoTag>, type: ForType): void;
29
+ /** The params a loop of `type` supplies, as its docs name them. */
30
+ export declare function getForParamNames(type: ForType): "item, index" | "key, value" | "num";
29
31
  export declare function coreTagLink(tag: t.NodePath<t.MarkoTag>): string;
30
32
  export declare function isValueAttr(attr: t.MarkoTag["attributes"][number]): attr is t.MarkoAttribute;
31
33
  export declare function isValueChangeAttr(attr: t.MarkoTag["attributes"][number]): attr is t.MarkoAttribute;
@@ -32,19 +32,24 @@ export interface Binding {
32
32
  derivedFrom: Opt<t.NodeExtra> | false;
33
33
  /** Its reads by expression, complete once `finalizeReferences` runs: pruning
34
34
  * hands an expression's reads to the nearest ancestor it also reads. */
35
- reads: Map<ReferencedExtra, Opt<Read>>;
36
- aliases: Set<Binding>;
35
+ reads: Map<ReferencedExtra, Opt<Read>> | undefined;
36
+ /** Unset while empty, as are `reads`, `getters` and `propertyAliases`. */
37
+ aliases: Set<Binding> | undefined;
37
38
  /** The sections reading it through a hoist: its own or its ancestors, so
38
39
  * the first is the outermost. */
39
40
  hoists: SortedOpt<Section>;
40
- getters: Map<Getter["hoisted"], boolean>;
41
+ getters: Map<Getter["hoisted"], boolean> | undefined;
41
42
  property: string | undefined;
42
- propertyAliases: Map<string, Binding>;
43
+ propertyAliases: Map<string, Binding> | undefined;
43
44
  excludeProperties: SortedOpt<string>;
44
45
  /** Its properties code assigns in place (`obj.x = 1`), all of them for a
45
46
  * computed one. */
46
47
  assignedProperties: SortedOpt<string> | true;
48
+ /** The binding it names part or all of, always a canonical one. */
47
49
  aliasOf: Binding | undefined;
50
+ /** The binding whose slot holds its value: the one a direct alias aliases,
51
+ * else itself; fixed once made. */
52
+ canonical: Binding;
48
53
  /** The value these `<for>` params iterate, by `of` or `in`. */
49
54
  iterates: {
50
55
  expr: t.NodeExtra;
@@ -126,13 +131,15 @@ export declare function compareIntersections(a: Intersection, b: Intersection):
126
131
  export declare function getAliasRoot(binding: Binding): Binding;
127
132
  export declare const bindingUtil: Sorted<Binding>;
128
133
  export declare const propertiesUtil: Sorted<string>;
129
- export declare function getCanonicalBinding(binding: Binding): Binding;
130
- export declare function someAlias<A>(binding: Binding, test: (binding: Binding, arg: A) => boolean, arg: A, directOnly?: boolean): boolean;
134
+ export declare function someAlias(binding: Binding, test: (binding: Binding) => boolean): boolean;
131
135
  export declare function someUpToAliasRoot<A>(binding: Binding | undefined, test: (binding: Binding, arg: A) => boolean, arg: A): boolean;
132
136
  export declare function getNearestDeclared(binding: Binding): Binding | undefined;
133
137
  export declare function getDeclaredAlias(binding: Binding): false | Binding | undefined;
134
- export declare function isDirectAlias(binding: Binding): boolean;
135
- export declare function isRest(binding: Binding): boolean;
138
+ export type Alias = Binding & {
139
+ aliasOf: Binding;
140
+ };
141
+ export declare function isDirectAlias(binding: Binding): binding is Alias;
142
+ export declare function isRest(binding: Binding): binding is Alias;
136
143
  export declare function getDebugAccess(binding: Binding, toParam: boolean, formatProperty: (property: string) => string): {
137
144
  root: Binding;
138
145
  access: string;
@@ -4,5 +4,6 @@ export declare function createAnalysisMemo<K extends object, R>(compute: (key: K
4
4
  export declare function createPassMemo<K extends object, R>(compute: (key: K) => R, cycleAnswer: R): (key: K) => R;
5
5
  export declare function resetPassMemos(): void;
6
6
  type MemoPath = Opt<string> | true;
7
- export declare function createPassPathMemo<K extends object, R>(compute: (key: K, path: MemoPath) => R, cycleAnswer: R): (key: K, path: MemoPath) => R;
7
+ type PathKey<K> = [K, MemoPath];
8
+ export declare function createPathKeys<K extends object>(): (key: K, path: MemoPath) => PathKey<K>;
8
9
  export {};
@@ -34,7 +34,7 @@ export type Reach = 0 | 1 | 2;
34
34
  type EntryFile = t.BabelFile & {
35
35
  [kState]?: EntryState;
36
36
  };
37
- export type VisitChild = (id: string, reach?: Reach) => void;
37
+ export type VisitChild = (file: t.BabelFile, reach?: Reach) => void;
38
38
  declare const kState: unique symbol;
39
39
  declare const builder: {
40
40
  build(entryFile: EntryFile, exportInit?: boolean): t.Statement[];
@@ -43,5 +43,4 @@ declare const builder: {
43
43
  export default builder;
44
44
  export declare function assertVisited<S>(entryFile: t.BabelFile, state: S | undefined): asserts state is S;
45
45
  export declare function createVisited(entryFile: t.BabelFile): Map<string, Reach>;
46
- export declare function resolveRelativeToEntry(entryFile: t.BabelFile, file: t.BabelFile, req: string): string;
47
- export declare function markReached(visited: Map<string, Reach>, resolved: string, reach: Reach): boolean;
46
+ export declare function markReached(entryFile: t.BabelFile, visited: Map<string, Reach>, file: t.BabelFile, reach: Reach): boolean;
@@ -5,4 +5,3 @@ export declare function finalizeReferences(): Map<Section, Intersection[]>;
5
5
  export declare function allocateIds(intersectionsBySection: Map<Section, Intersection[]>): void;
6
6
  export declare function getLastOwnSourceReturn(bindings: ReferencedBindings, section: Section): Binding | undefined;
7
7
  export declare function readsValuesOnResume(expr: t.NodeExtra): boolean;
8
- export declare function hasEmittedAssignment(binding: Binding): boolean;
@@ -1,5 +1,4 @@
1
1
  import { type Binding } from "./bindings";
2
2
  import type { Section } from "./sections";
3
3
  export declare function isForSelectorClosure(bodySection: Section, closure: Binding): boolean;
4
- export declare function isForSelectorValue(binding: Binding): boolean;
5
4
  export declare function detectForSelector(bodySection: Section, keyBinding: Binding): void;
@@ -20,6 +20,7 @@ export interface RegisteredExport {
20
20
  exportName: string;
21
21
  filename: string;
22
22
  }
23
+ export declare const getReferencesByFn: () => Map<RegisteredFnExtra, Set<t.NodeExtra>>;
23
24
  export declare function trackFunction(fn: t.NodePath<t.Function>, fnExtra: RegisteredFnExtra, markoRoot: MarkoRootPath): void;
24
25
  export declare function canIgnoreRegister(markoRoot: MarkoRootPath, exprRoot: t.NodePath<t.Node>): boolean;
25
26
  export declare function addFunctionReasons(): void;
@@ -14,11 +14,11 @@ export declare class Sorted<T> {
14
14
  add<U extends NonNullable<T>>(data: SortedOpt<U>, item: U): SortedOneMany<U>;
15
15
  union<U extends NonNullable<T>>(a: SortedOpt<U>, b: SortedOpt<U>): SortedOpt<U>;
16
16
  filter<U extends NonNullable<T>>(data: SortedOpt<U>, cb: (item: U) => boolean): SortedOpt<U>;
17
+ filter<U extends NonNullable<T>, C>(data: SortedOpt<U>, cb: (item: U, context: C) => boolean, context: C): SortedOpt<U>;
17
18
  leadingRun<U extends NonNullable<T>, K>(data: SortedOpt<U>, key: (item: U) => K, compareKeys: Compare<K>, bound: K): SortedOpt<U>;
18
19
  range<U extends NonNullable<T>, K>(data: SortedOpt<U>, key: (item: U) => K, compareKeys: Compare<K>, bound: K): SortedOpt<U>;
19
20
  forEachRun<U extends NonNullable<T>, K>(data: SortedOpt<U>, key: (item: U) => K, compareKeys: Compare<K>, fn: (key: K, run: SortedOneMany<U>) => void): void;
20
21
  reduceRuns<U extends NonNullable<T>, K, R>(data: SortedOpt<U>, key: (item: U) => K, compareKeys: Compare<K>, fn: (acc: R, key: K, run: SortedOneMany<U>) => R, initial: R): R;
21
- find<U extends NonNullable<T>>(data: SortedOpt<U>, item: U): U | undefined;
22
22
  has<U extends NonNullable<T>>(data: SortedOpt<U>, item: U): boolean;
23
23
  findIndex<U extends NonNullable<T>>(data: SortedOpt<U>, item: U): number;
24
24
  intersects<U extends NonNullable<T>>(a: SortedOpt<U>, b: SortedOpt<U>): boolean;
@@ -29,17 +29,19 @@ export declare function push<T>(data: Opt<T>, item: T): OneMany<T>;
29
29
  export declare function concat<T>(a: Opt<T>, b: Opt<T>): Opt<T>;
30
30
  export declare function size<T>(data: Opt<T>): number;
31
31
  export declare function filter<T>(data: Opt<T>, cb: (item: T) => boolean): Opt<T>;
32
- export declare function forEach<T>(data: Opt<T>, cb: (item: T, index: number) => void): void;
32
+ export declare function forEach<T>(data: Opt<T>, cb: (item: T) => void): void;
33
+ export declare function forEach<T, C>(data: Opt<T>, cb: (item: T, context: C) => void, context: C): void;
33
34
  export declare function fromIter<T>(data: Iterable<T>): T | Many<T> | undefined;
34
35
  export declare function find<T>(data: Opt<T>, cb: (item: T, index: number) => boolean): Opt<T>;
35
- export declare function some<T>(data: Opt<T>, cb: (item: T, index: number) => unknown): boolean;
36
- export declare function every<T>(data: Opt<T>, cb: (item: T, index: number) => boolean): boolean;
36
+ export declare function some<T>(data: Opt<T>, cb: (item: T) => unknown): boolean;
37
+ export declare function some<T, C>(data: Opt<T>, cb: (item: T, context: C) => unknown, context: C): boolean;
38
+ export declare function every<T>(data: Opt<T>, cb: (item: T) => boolean): boolean;
39
+ export declare function every<T, C>(data: Opt<T>, cb: (item: T, context: C) => boolean, context: C): boolean;
37
40
  export declare function reduce<T, R>(data: Opt<T>, cb: (acc: R | undefined, item: T, index: number) => R | undefined): R | undefined;
38
41
  export declare function reduce<T, R>(data: Opt<T>, cb: (acc: R, item: T, index: number) => R, initial: R): R;
39
42
  export declare function reduceWhile<T, R>(data: Opt<T>, cb: (acc: R, item: T) => R | undefined, initial: R): R | undefined;
40
43
  export declare function toArray<T, R>(data: Opt<T>, cb: (item: T, index: number) => R): R[];
41
44
  export declare function mapToString<T>(data: Opt<T>, sep: string, cb: (item: T, index: number) => string): string;
42
- export declare function findSorted<T>(compare: Compare<T>, data: T[], item: T): T | undefined;
43
45
  export declare function findIndexSorted<T>(compare: Compare<T>, data: T[], item: T): number;
44
46
  export declare function searchSorted<T>(compare: Compare<T>, data: T[], item: T): number;
45
47
  export declare function addSorted<T, U extends T[]>(compare: Compare<T>, data: U, item: T): U;
@@ -17,7 +17,7 @@ export declare function isGuardedReason(reason: undefined | Reason): reason is S
17
17
  };
18
18
  export declare function isStateReason(reason: undefined | Reason): reason is Sources;
19
19
  export declare function getSourcesForExpr(expr: t.NodeExtra): Sources | undefined;
20
- export declare function getSourcesForExprs(exprs: Opt<t.NodeExtra> | boolean): Sources | undefined;
20
+ export declare function getSourcesForExprs(exprs: Opt<t.NodeExtra>): Sources | undefined;
21
21
  export declare function getSourcesForReferencedBindings(bindings: ReferencedBindings): Sources | undefined;
22
22
  export declare function getSourcesForDerived({ binding, exprs, properties, }: NonNullable<Section["derives"]>): Sources | undefined;
23
23
  export declare function mapParamReason(program: Section, reason: Sources, exprs: KnownExprs | undefined, ownParams: boolean): Reason | undefined;
@@ -29,7 +29,6 @@ export declare function mapParamReasonToExpr(exprs: KnownExprs, reason: Opt<Para
29
29
  export declare function mapParamReasonToExpr(exprs: KnownExprs, reason: boolean | Opt<ParamBinding>): Opt<t.NodeExtra> | true;
30
30
  export declare function mapParamBindingToExpr(exprs: KnownExprs, binding: ParamBinding): Opt<t.NodeExtra>;
31
31
  export declare function applyReasonExprs(section: Section): void;
32
- export declare function mergeSlotReasons(section: Section): void;
33
32
  export declare function getNodeReasons(section: Section): Reasons | undefined;
34
33
  export declare function getReasonsVersion(): number;
35
34
  export declare function setParamReasonGroups(section: Section, groups: ParamReasonGroups): void;
@@ -1,12 +1,15 @@
1
1
  import { types as t } from "@marko/compiler";
2
2
  import { type Binding, BindingType, type Getter, type ReferencedBindings } from "./bindings";
3
- import { type OneMany, type Opt, type SortedOpt } from "./optional";
3
+ import { type Opt, type SortedOpt } from "./optional";
4
4
  import { type KnownExprs, type Reason } from "./reasons";
5
5
  import { type Section } from "./sections";
6
- interface ReferencedFunctionExtra extends t.FunctionExtra, ReferencedExtra {
6
+ export interface ReferencedFunctionExtra extends t.FunctionExtra, ReferencedExtra {
7
7
  }
8
8
  export interface Read {
9
9
  binding: Binding;
10
+ /** The binding holding it in `reads`: `binding`, or the nearest ancestor its
11
+ * expression also reads once pruning hands the read up. */
12
+ holder: Binding;
10
13
  extra: ReadExtra;
11
14
  inOwnBody: boolean;
12
15
  getter: Getter | undefined;
@@ -121,7 +124,6 @@ export declare function mergeReferenceGroup(section: Section, nodes: (t.Node | u
121
124
  export declare function setDerivedFrom(binding: Binding, expr: boolean | Opt<t.NodeExtra>, exprs?: KnownExprs): void;
122
125
  export declare const getAssignments: () => AssignedBindingExtra[];
123
126
  export declare const getReadsByExpression: () => Map<ReferencedExtra, Opt<Read>>;
124
- export declare const getFunctionReadsByExpression: () => Map<ReferencedExtra, Map<ReferencedFunctionExtra, OneMany<Read>>>;
125
127
  export declare const getReferenceFinalizers: () => (() => void)[];
126
128
  export declare function onFinalizeReferences(finalize: () => void): void;
127
129
  export declare function addRead(exprExtra: ReferencedExtra, extra: t.NodeExtra, exprRoot: t.NodeExtra, binding: Binding, section: Section, getter: Getter | undefined): Read;
@@ -130,8 +132,7 @@ export declare function dropExpr(exprExtra: ReferencedExtra): void;
130
132
  export declare function dropContent(body: t.MarkoTagBody): void;
131
133
  export declare function getAllTagReferenceNodes(tag: t.MarkoTag, referenceNodes?: t.Node[], collectAttrTag?: (attrTag: t.MarkoTag) => void): t.Node[];
132
134
  export declare function getChildTagReferenceNodes(tag: t.MarkoTag, referenceNodes: t.Node[], collectAttrTag?: (attrTag: t.MarkoTag) => void): t.Node[];
133
- export declare function createResolvedRead(binding: Binding, properties: Opt<string>, inOwnBody?: boolean): ResolvedRead;
134
- export declare function createResolvedGetterRead(binding: Binding, properties: Opt<string>, getter: Getter): ResolvedRead;
135
+ export declare function createResolvedRead(binding: Binding, properties: Opt<string>, inOwnBody?: boolean, getter?: Getter): ResolvedRead;
135
136
  export interface ReferencedExtra extends t.NodeExtra {
136
137
  section: Section;
137
138
  }
@@ -104,6 +104,9 @@ export interface Section {
104
104
  /** Whether analysis found work keyed by setup in the section, or in a
105
105
  * `<define>` body or template it calls in place. */
106
106
  hasSetupWork: boolean;
107
+ /** A tag variable in it holds a child's `<return>`, whose scope offset its
108
+ * renders may wait for. */
109
+ hasReturnedVar: boolean;
107
110
  /** Its tag, which renders it in place into branch scopes at the tag's node
108
111
  * binding; an `<if>` chain's at `index`, the renderer index it renders as. */
109
112
  branch: {
@@ -168,6 +171,7 @@ export declare function getRendererReason(section: Section): false | Sources;
168
171
  export declare function isOptionalBranch(section: Section): section is Section & {
169
172
  branch: NonNullable<Section["branch"]>;
170
173
  };
174
+ export declare function isLoopBody(section: Section): boolean;
171
175
  export declare function isInParentSection(binding: Binding, section: Section): boolean;
172
176
  export declare function isDirectClosure(section: Section, closure: Binding): boolean;
173
177
  export declare function isDynamicClosure(section: Section, closure: Binding): boolean;
@@ -176,7 +180,7 @@ export declare function getForClosureIndex(closure: Binding, closureSection?: Se
176
180
  export declare function getDirectClosures(section: Section): import("./optional").SortedOpt<Binding>;
177
181
  export declare function isSameOrAncestorSection(section: Section, other: Section): boolean;
178
182
  export declare function getCommonSection(section: Section, other: Section): Section;
179
- export declare function ensureSectionReasonGroups(section: Section): void;
183
+ export declare function ensureReasonGroups(section: Section, reason: Section["reason"]): void;
180
184
  export declare function getParamReasonGroupIndex(section: Section, group: ParamReasonGroup): number;
181
185
  export declare function findParamReasonGroupIndex(section: Section, group: ParamReasonGroup): number;
182
186
  export declare function forEachParamGroup(params: Sources["param"], fn: (section: Section, group: ParamReasonGroup) => void): void;
@@ -53,7 +53,6 @@ export declare function getSignal(section: Section, referencedBindings: Referenc
53
53
  export declare function initValue(binding: Binding, isLet?: boolean): Signal;
54
54
  export declare function signalHasWork(signal: Signal): boolean;
55
55
  export declare function buildSignalFn(signal: Signal): t.Expression;
56
- export declare function getSignalValueIdentifier(signal: Signal): t.Identifier;
57
56
  export declare function trimEmptyArgs(args: (t.Expression | undefined | false)[]): t.Expression[];
58
57
  export declare function addStatement(type: "render" | "effect", targetSection: Section, expr: t.NodeExtra | undefined, statement: t.Statement | t.Statement[] | t.Expression, isPure?: boolean): void;
59
58
  export declare function addTagStatement(tag: t.NodePath<t.MarkoTag>, statement: t.Statement): void;
@@ -65,3 +64,4 @@ export declare function addHTMLEffectCall(section: Section, expr?: t.NodeExtra):
65
64
  export declare function writeHTMLResumeStatements(path: t.NodePath<t.MarkoTag> | t.NodePath<t.Program>): void;
66
65
  export declare function getSetup(section: Section): Signal | undefined;
67
66
  export declare function replaceRegisteredFunctionNode(node: t.Node): t.CallExpression | t.ClassPrivateProperty | t.ClassProperty | t.Identifier | t.ObjectProperty | t.VariableDeclaration | undefined;
67
+ export declare function pushLocalProperty(binding: Binding, properties: t.ObjectExpression["properties"]): void;
@@ -21,8 +21,7 @@ interface BaseSlot {
21
21
  /** The sources whose changes lead client code to read it after resume,
22
22
  * unset while nothing does. */
23
23
  reason: Reason | undefined;
24
- /** The expressions it holds or renders (a param group's: what its call site
25
- * passes the group), whose sources its reason takes. */
24
+ /** The expressions it holds or renders, whose sources its reason takes. */
26
25
  reasonExprs: Opt<t.NodeExtra>;
27
26
  }
28
27
  export interface BindingSlot extends BaseSlot {
@@ -1,15 +1,17 @@
1
1
  import { types as t } from "@marko/compiler";
2
2
  import { type Binding, type Intersection } from "./bindings";
3
3
  import { type Opt } from "./optional";
4
- import { type Reason } from "./reasons";
4
+ import { type KnownExprs, type Reason } from "./reasons";
5
5
  import { type Section } from "./sections";
6
6
  export declare function solveReasons(intersectionsBySection: Map<Section, Intersection[]>): void;
7
- export declare function getReasonForBinding(binding: Binding, properties?: Opt<string> | true): undefined | Reason;
7
+ export declare function getReasonForBinding(binding: Binding, properties: Opt<string>, exprs: KnownExprs | undefined): undefined | Reason;
8
8
  export declare function getReasonForExpr(extra: t.NodeExtra): undefined | Reason;
9
9
  export declare function bindingLandsRetained(binding: Binding, properties: Opt<string>): boolean;
10
- export declare function getContentSites({ binding, properties, }: NonNullable<Section["derives"]>): {
10
+ export declare function getContentSites({ binding, properties, }: NonNullable<Section["derives"]>): ContentSites;
11
+ interface ContentSites {
11
12
  unseen: boolean;
12
- sites: Opt<t.MarkoTagExtra>;
13
- deepSites: Opt<t.MarkoTagExtra>;
14
- };
13
+ sites?: Opt<t.MarkoTagExtra>;
14
+ deepSites?: Opt<t.MarkoTagExtra>;
15
+ }
15
16
  export declare function landsRetained(extra: t.NodeExtra): boolean;
17
+ export {};
@@ -11,6 +11,7 @@ export declare function writeTextTo(path: t.NodePath<any>, value: string): void;
11
11
  export declare function node(path: t.NodePath<t.MarkoTag>, binding?: Binding): StructureNode | undefined;
12
12
  export declare function text(path: t.NodePath<t.MarkoPlaceholder>, binding: Binding, marker: boolean | undefined): void;
13
13
  export declare function marker(path: t.NodePath<t.MarkoTag>, binding: Binding): void;
14
+ export declare function markerNode(tag: t.NodePath<t.MarkoTag>, section: Section): Binding;
14
15
  export declare function controlFlowNode(tag: t.NodePath<t.MarkoTag>, section: Section): Binding;
15
16
  interface SectionMeta {
16
17
  walks: t.Expression | undefined;
@@ -10,6 +10,8 @@ export declare function buildGroupMask(groups: {
10
10
  }[]): t.Expression | undefined;
11
11
  export declare function getScopeReasonStatement(section: Section): t.Statement;
12
12
  export declare function getWriteReason(binding: Binding): Sources | undefined;
13
+ export declare function getMarkerGuard(nodeBinding: Binding): t.Expression | undefined;
14
+ export declare function isMarkerWritten(nodeBinding: Binding): boolean;
13
15
  export declare function getBranchWriteReason(section: Section): Sources | undefined;
14
16
  export declare function isBranchAlwaysMarked(section: Section): boolean;
15
17
  export declare function getWriteGuard(section: Section, reason: undefined | Reason, omitUnconditional: boolean): t.Expression | undefined;
@@ -1,9 +1,8 @@
1
1
  import { types as t } from "@marko/compiler";
2
2
  import { type Binding } from "./bindings";
3
- import type { Reason } from "./reasons";
4
3
  type Write = string | t.Expression | (() => undefined | string | t.Expression);
5
4
  export declare function writeTo(path: t.NodePath<any>, trailer?: boolean): (strs: TemplateStringsArray, ...exprs: Write[]) => void;
6
5
  export declare function flushBefore(path: t.NodePath<any>): void;
7
6
  export declare function flushInto(path: t.NodePath<t.MarkoTag> | t.NodePath<t.Program>): t.NodePath<t.MarkoTagBody | t.Program>;
8
- export declare function markNode(path: t.NodePath<t.MarkoTag | t.MarkoPlaceholder>, nodeBinding: Binding, reason: undefined | false | Reason, deferred?: boolean): void;
7
+ export declare function markNode(path: t.NodePath<t.MarkoTag | t.MarkoPlaceholder>, nodeBinding: Binding, deferred?: boolean): void;
9
8
  export {};
@@ -21,6 +21,8 @@ interface NativeAttrs {
21
21
  spread: number[] | undefined;
22
22
  /** Writes the page's nonce on a `<script>` or `<style>` that sets none itself. */
23
23
  injectsNonce: boolean;
24
+ /** With nothing else filling the element, the spread's `content` renders it. */
25
+ spreadContent: boolean;
24
26
  }
25
27
  interface Controllable {
26
28
  state: "checked" | "checkedValue" | "value" | "open";
package/index.d.ts CHANGED
@@ -116,6 +116,17 @@ declare global {
116
116
  /** @marko-overload-end */
117
117
  }
118
118
 
119
+ /**
120
+ * A template typed by its signature as a tag (eg `<T>(input: Input<T>) => Return<T>`),
121
+ * from which a tag using a generic template infers its type arguments.
122
+ */
123
+ export interface TemplateOf<
124
+ Signature extends (input: any) => any,
125
+ > extends Template<Parameters<Signature>[0], ReturnType<Signature>> {
126
+ /** Types only: its signature as a tag, never one to call. */
127
+ readonly _: Signature;
128
+ }
129
+
119
130
  export type AttrTag<T> = T & {
120
131
  [Symbol.iterator](): Iterator<T>;
121
132
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.4.15",
3
+ "version": "6.5.0",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",
@@ -51,14 +51,14 @@
51
51
  }
52
52
  },
53
53
  "dependencies": {
54
- "@marko/compiler": "^5.43.0",
54
+ "@marko/compiler": "^5.43.5",
55
55
  "csstype": "^3.2.3",
56
56
  "fastest-levenshtein": "^1.0.16",
57
57
  "magic-string": "^1.4.5"
58
58
  },
59
59
  "devDependencies": {
60
- "@marko/runtime-tags": "npm:marko@6.4.15",
61
- "marko": "5.40.2"
60
+ "@marko/runtime-tags": "npm:marko@6.5.0",
61
+ "marko": "5.41.0"
62
62
  },
63
63
  "engines": {
64
64
  "node": ">=22.12.0"