marko 6.4.16 → 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.
- package/cheatsheet.md +12 -1
- package/dist/debug/dom/catch.feat.js +2 -2
- package/dist/debug/dom/catch.feat.mjs +2 -2
- package/dist/debug/dom/compat.feat.js +1 -1
- package/dist/debug/dom/compat.feat.mjs +1 -1
- package/dist/debug/dom/controllable-input.feat.js +1 -1
- package/dist/debug/dom/controllable-input.feat.mjs +1 -1
- package/dist/debug/dom/controllable-open.feat.js +1 -1
- package/dist/debug/dom/controllable-open.feat.mjs +1 -1
- package/dist/debug/dom/controllable-select.feat.js +1 -1
- package/dist/debug/dom/controllable-select.feat.mjs +1 -1
- package/dist/debug/dom/controllable-textarea.feat.js +1 -1
- package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/debug/dom/controllable.feat.js +1 -1
- package/dist/debug/dom/controllable.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/debug/dom/lazy.feat.js +1 -1
- package/dist/debug/dom/lazy.feat.mjs +1 -1
- package/dist/debug/dom/placeholder.feat.js +1 -1
- package/dist/debug/dom/placeholder.feat.mjs +1 -1
- package/dist/debug/{dom-BLoTKI2r.js → dom-BiJ_UKJV.js} +9 -9
- package/dist/debug/{dom-DlBA4dCe.mjs → dom-D3A8gh_D.mjs} +4 -4
- package/dist/debug/dom.js +1 -1
- package/dist/debug/dom.mjs +1 -1
- package/dist/debug/html/compat.feat.js +1 -1
- package/dist/debug/html/compat.feat.mjs +1 -1
- package/dist/debug/{html-DM7X2D_b.mjs → html-Bfl3MJP9.mjs} +27 -24
- package/dist/debug/{html-Du0z056z.js → html-shBfuhlc.js} +27 -24
- package/dist/debug/html.js +1 -1
- package/dist/debug/html.mjs +1 -1
- package/dist/dom/catch.feat.js +3 -3
- package/dist/dom/catch.feat.mjs +2 -2
- package/dist/dom/compat.feat.js +1 -1
- package/dist/dom/compat.feat.mjs +1 -1
- package/dist/dom/control-flow.d.ts +1 -1
- package/dist/dom/controllable-input.feat.js +1 -1
- package/dist/dom/controllable-input.feat.mjs +1 -1
- package/dist/dom/controllable-open.feat.js +1 -1
- package/dist/dom/controllable-open.feat.mjs +1 -1
- package/dist/dom/controllable-select.feat.js +1 -1
- package/dist/dom/controllable-select.feat.mjs +1 -1
- package/dist/dom/controllable-textarea.feat.js +1 -1
- package/dist/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/dom/controllable.feat.js +1 -1
- package/dist/dom/controllable.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-script.feat.js +1 -1
- package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-var.feat.js +1 -1
- package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/dom/lazy.feat.js +1 -1
- package/dist/dom/lazy.feat.mjs +1 -1
- package/dist/dom/placeholder.feat.js +1 -1
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/{dom-BRtFOIF-.js → dom-B3piR0q1.js} +5 -5
- package/dist/{dom-Cqajrs_w.mjs → dom-CPk_8CMB.mjs} +4 -4
- package/dist/dom.js +2 -2
- package/dist/dom.mjs +1 -1
- package/dist/html/compat.feat.js +1 -1
- package/dist/html/compat.feat.mjs +1 -1
- package/dist/html/writer.d.ts +0 -1
- package/dist/{html-C3dQGQ2x.mjs → html-BD-y50wS.mjs} +25 -22
- package/dist/{html-4A3vJpIT.js → html-aFBpTKdf.js} +25 -22
- package/dist/html.js +1 -1
- package/dist/html.mjs +1 -1
- package/dist/translator/core/define.d.ts +6 -0
- package/dist/translator/core/show.d.ts +1 -1
- package/dist/translator/index.js +577 -611
- package/dist/translator/util/assert.d.ts +2 -0
- package/dist/translator/util/bindings.d.ts +15 -8
- package/dist/translator/util/cyclic-memo.d.ts +0 -1
- package/dist/translator/util/entry-builder.d.ts +2 -3
- package/dist/translator/util/finalize-references.d.ts +0 -1
- package/dist/translator/util/for-selector.d.ts +0 -1
- package/dist/translator/util/module-registrations.d.ts +1 -0
- package/dist/translator/util/optional.d.ts +7 -5
- package/dist/translator/util/reasons.d.ts +1 -2
- package/dist/translator/util/references.d.ts +6 -5
- package/dist/translator/util/sections.d.ts +4 -1
- package/dist/translator/util/signals.d.ts +1 -1
- package/dist/translator/util/slots.d.ts +1 -2
- package/dist/translator/util/solve-reasons.d.ts +2 -2
- package/dist/translator/util/structure.d.ts +1 -0
- package/dist/translator/visitors/tag/native-tag.d.ts +2 -0
- package/index.d.ts +11 -0
- package/package.json +4 -4
|
@@ -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
|
-
|
|
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
|
|
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
|
|
135
|
-
|
|
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;
|
|
@@ -5,6 +5,5 @@ export declare function createPassMemo<K extends object, R>(compute: (key: K) =>
|
|
|
5
5
|
export declare function resetPassMemos(): void;
|
|
6
6
|
type MemoPath = Opt<string> | true;
|
|
7
7
|
type PathKey<K> = [K, MemoPath];
|
|
8
|
-
export declare function createPassPathMemo<K extends object, R>(compute: (key: K, path: MemoPath) => R, cycleAnswer: R): (key: K, path: MemoPath) => R;
|
|
9
8
|
export declare function createPathKeys<K extends object>(): (key: K, path: MemoPath) => PathKey<K>;
|
|
10
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 = (
|
|
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
|
|
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
|
|
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
|
|
36
|
-
export declare function
|
|
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>
|
|
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
|
|
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: {
|
|
@@ -177,7 +180,7 @@ export declare function getForClosureIndex(closure: Binding, closureSection?: Se
|
|
|
177
180
|
export declare function getDirectClosures(section: Section): import("./optional").SortedOpt<Binding>;
|
|
178
181
|
export declare function isSameOrAncestorSection(section: Section, other: Section): boolean;
|
|
179
182
|
export declare function getCommonSection(section: Section, other: Section): Section;
|
|
180
|
-
export declare function
|
|
183
|
+
export declare function ensureReasonGroups(section: Section, reason: Section["reason"]): void;
|
|
181
184
|
export declare function getParamReasonGroupIndex(section: Section, group: ParamReasonGroup): number;
|
|
182
185
|
export declare function findParamReasonGroupIndex(section: Section, group: ParamReasonGroup): number;
|
|
183
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
|
|
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,10 +1,10 @@
|
|
|
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
|
|
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
10
|
export declare function getContentSites({ binding, properties, }: NonNullable<Section["derives"]>): ContentSites;
|
|
@@ -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;
|
|
@@ -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.
|
|
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.
|
|
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.
|
|
61
|
-
"marko": "5.
|
|
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"
|