marko 6.4.7 → 6.4.9

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 (89) hide show
  1. package/dist/common/constants/closure-signal-prop.d.ts +1 -1
  2. package/dist/common/constants/closure-signal-prop.debug.d.ts +1 -1
  3. package/dist/debug/dom/catch.feat.js +1 -1
  4. package/dist/debug/dom/catch.feat.mjs +1 -1
  5. package/dist/debug/dom/controllable-input.feat.js +1 -1
  6. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  7. package/dist/debug/dom/controllable-open.feat.js +1 -1
  8. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  9. package/dist/debug/dom/controllable-select.feat.js +1 -1
  10. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  11. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  12. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  13. package/dist/debug/dom/controllable.feat.js +1 -1
  14. package/dist/debug/dom/controllable.feat.mjs +1 -1
  15. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  16. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  17. package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
  18. package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
  19. package/dist/debug/dom/lazy.feat.js +1 -1
  20. package/dist/debug/dom/lazy.feat.mjs +1 -1
  21. package/dist/debug/dom/placeholder.feat.js +1 -1
  22. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  23. package/dist/debug/{dom-D8znnhpf.js → dom-QkYva5Qx.js} +35 -61
  24. package/dist/debug/{dom-CFCBDift.mjs → dom-VKjkbuuo.mjs} +36 -50
  25. package/dist/debug/dom.js +4 -4
  26. package/dist/debug/dom.mjs +4 -4
  27. package/dist/debug/html.js +20 -13
  28. package/dist/debug/html.mjs +18 -11
  29. package/dist/dom/catch.feat.js +3 -3
  30. package/dist/dom/catch.feat.mjs +1 -1
  31. package/dist/dom/compat.d.ts +1 -1
  32. package/dist/dom/control-flow.d.ts +1 -1
  33. package/dist/dom/controllable-input.feat.js +1 -1
  34. package/dist/dom/controllable-input.feat.mjs +1 -1
  35. package/dist/dom/controllable-open.feat.js +1 -1
  36. package/dist/dom/controllable-open.feat.mjs +1 -1
  37. package/dist/dom/controllable-select.feat.js +1 -1
  38. package/dist/dom/controllable-select.feat.mjs +1 -1
  39. package/dist/dom/controllable-textarea.feat.js +1 -1
  40. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  41. package/dist/dom/controllable.feat.js +1 -1
  42. package/dist/dom/controllable.feat.mjs +1 -1
  43. package/dist/dom/dom.d.ts +2 -3
  44. package/dist/dom/dynamic-tag-script.feat.js +2 -2
  45. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  46. package/dist/dom/dynamic-tag-var.feat.js +3 -3
  47. package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
  48. package/dist/dom/lazy.feat.js +1 -1
  49. package/dist/dom/lazy.feat.mjs +1 -1
  50. package/dist/dom/placeholder.feat.js +3 -3
  51. package/dist/dom/placeholder.feat.mjs +1 -1
  52. package/dist/dom/resume.d.ts +1 -1
  53. package/dist/dom/scope.d.ts +1 -1
  54. package/dist/dom/signals.d.ts +1 -1
  55. package/dist/{dom-CVAevsbz.mjs → dom-DtKQb840.mjs} +19 -33
  56. package/dist/{dom-Bpkm72vV.js → dom-IujlfJ6b.js} +82 -106
  57. package/dist/dom.js +31 -31
  58. package/dist/dom.mjs +4 -4
  59. package/dist/html/serializer.d.ts +1 -1
  60. package/dist/html/writer.d.ts +3 -3
  61. package/dist/html.d.ts +1 -1
  62. package/dist/html.js +21 -15
  63. package/dist/html.mjs +21 -15
  64. package/dist/translator/core/show.d.ts +3 -4
  65. package/dist/translator/index.js +1253 -1134
  66. package/dist/translator/util/bindings.d.ts +6 -5
  67. package/dist/translator/util/branch-tag.d.ts +1 -1
  68. package/dist/translator/util/constants/slot-kind.d.ts +1 -1
  69. package/dist/translator/util/known-tag.d.ts +6 -2
  70. package/dist/translator/util/module-registrations.d.ts +1 -1
  71. package/dist/translator/util/optional.d.ts +1 -0
  72. package/dist/translator/util/params-tree.d.ts +3 -3
  73. package/dist/translator/util/reasons.d.ts +3 -4
  74. package/dist/translator/util/references.d.ts +13 -8
  75. package/dist/translator/util/replace-with-statements.d.ts +4 -0
  76. package/dist/translator/util/runtime.d.ts +1 -0
  77. package/dist/translator/util/scope-accessor.d.ts +1 -1
  78. package/dist/translator/util/sections.d.ts +42 -17
  79. package/dist/translator/util/signals.d.ts +3 -11
  80. package/dist/translator/util/slots.d.ts +1 -1
  81. package/dist/translator/util/solve-reasons.d.ts +6 -0
  82. package/dist/translator/util/static-text.d.ts +1 -0
  83. package/dist/translator/util/structure.d.ts +3 -2
  84. package/dist/translator/util/tag-import.d.ts +0 -2
  85. package/dist/translator/util/write-guard.d.ts +4 -1
  86. package/dist/translator/visitors/placeholder.d.ts +4 -4
  87. package/package.json +4 -4
  88. package/tags-html.d.ts +3 -0
  89. package/dist/translator/visitors/constants/sibling-text.d.ts +0 -6
@@ -84,7 +84,8 @@ export interface Binding {
84
84
  /** In a template's or `<define>`'s params tree, which known call sites set
85
85
  * directly. */
86
86
  exposed: boolean;
87
- /** Read on invocation from its own scope slot, so its signal stores it. */
87
+ /** Owns a scope slot read on invocation, through it or a direct alias, so
88
+ * its signal stores it. */
88
89
  hasLazyReads: boolean;
89
90
  }
90
91
  /** A param of a template or of a tag body, which its caller supplies. */
@@ -124,7 +125,7 @@ export declare function compareReferences(a: ReferencedBindings, b: ReferencedBi
124
125
  export declare function compareIntersections(a: Intersection, b: Intersection): number;
125
126
  export declare function getAliasRoot(binding: Binding): Binding;
126
127
  export declare const bindingUtil: Sorted<Binding>;
127
- export declare const propsUtil: Sorted<string>;
128
+ export declare const propertiesUtil: Sorted<string>;
128
129
  export declare function getCanonicalBinding(binding: Binding): Binding;
129
130
  export declare function someAlias<A>(binding: Binding, test: (binding: Binding, arg: A) => boolean, arg: A, directOnly?: boolean): boolean;
130
131
  export declare function someUpToAliasRoot<A>(binding: Binding | undefined, test: (binding: Binding, arg: A) => boolean, arg: A): boolean;
@@ -138,10 +139,10 @@ export declare function getDebugAccess(binding: Binding, toParam: boolean, forma
138
139
  };
139
140
  export declare function isTemplateParam(binding: Binding): boolean;
140
141
  export declare function getDebugName(binding: Binding): string;
141
- export declare function getDebugNames(refs: ReferencedBindings): string;
142
- export declare function getDebugNamesAsIdentifier(refs: ReferencedBindings): string;
142
+ export declare function getDebugNames(bindings: ReferencedBindings): string;
143
+ export declare function getDebugNamesAsIdentifier(bindings: ReferencedBindings): string;
143
144
  export declare function isInvokeOnlyBinding(binding: Binding): boolean;
144
145
  export declare function isOwnBinding(binding: Binding): boolean;
145
- export declare function hasNonConstantPropertyAlias(ref: Binding): boolean;
146
+ export declare function hasNonConstantPropertyAlias(binding: Binding): boolean;
146
147
  export declare function getPropertyPath(binding: Binding, ancestor: Binding): Opt<string>;
147
148
  export declare function isIndexProperty(property: string): boolean;
@@ -7,7 +7,7 @@ export declare function resumeOwnerByMarkerWhenUnconditional(bodySection: Sectio
7
7
  export declare function getBranchResumeArgs(tag: t.NodePath<t.MarkoTag>, branchReasons: Reasons, singleNode: boolean): (t.Expression | undefined)[];
8
8
  export declare function buildBranchEndArgs(tagSection: Section, nodeBinding: Binding, onlyChildParentTagName: string | false | undefined, singleNode: boolean | undefined): (t.Expression | undefined)[];
9
9
  export declare function isEndTagWrittenByBranch(nodeBinding: Binding | undefined): boolean;
10
- export declare function isSingleNodeBranch(bodySection: Section | undefined): boolean;
10
+ export declare function isSingleNodeContent(content: Section["content"] | undefined): boolean;
11
11
  export type ForType = "in" | "of" | "to" | "until";
12
12
  export declare function buildForRuntimeCall(type: ForType, attrs: Record<string, t.Expression>, params: t.ArrowFunctionExpression["params"], statements: t.Statement[]): t.ExpressionStatement;
13
13
  export declare function getForType(tag: t.MarkoTag): ForType | undefined;
@@ -8,7 +8,7 @@ export declare const Scope = 6;
8
8
  export declare const Owner = 7;
9
9
  export declare const ReturnChangeHandler = 8;
10
10
  export declare const Branch = 9;
11
- export declare const Instances = 10;
11
+ export declare const Scopes = 10;
12
12
  type Self = typeof import("./slot-kind");
13
13
  export type Value = Self[keyof Self];
14
14
  export {};
@@ -4,19 +4,23 @@ import { type ParamsTree } from "./params-tree";
4
4
  import { type KnownExprs } from "./reasons";
5
5
  import { type Section } from "./sections";
6
6
  import { type Sources } from "./sources";
7
- declare const kChildSection: unique symbol;
8
7
  declare const kParamsTree: unique symbol;
9
8
  declare const kKnownExprs: unique symbol;
10
9
  declare module "@marko/compiler/dist/types" {
11
10
  interface MarkoTagExtra {
12
11
  /** The dom binding a known tag holds its child's scope in. */
13
12
  childScopeBinding?: Binding;
14
- [kChildSection]?: Section;
13
+ /** The section a known tag renders: another template's, a `<define>` body. */
14
+ childSection?: Section;
15
15
  /** The child's params tree the call site was analyzed against. */
16
16
  [kParamsTree]?: ParamsTree;
17
17
  [kKnownExprs]?: KnownExprs;
18
18
  }
19
19
  }
20
+ export interface KnownTagExtra extends t.MarkoTagExtra {
21
+ childScopeBinding: Binding;
22
+ childSection: Section;
23
+ }
20
24
  export declare function knownTagAnalyze(tag: t.NodePath<t.MarkoTag>, childSection: Section, childParamsTree?: ParamsTree): void;
21
25
  export declare function analyzeRecursiveTags(): void;
22
26
  export declare function knownTagTranslateHTML(tag: t.NodePath<t.MarkoTag>, tagIdentifier: t.Expression): void;
@@ -16,7 +16,7 @@ declare module "@marko/compiler/dist/types" {
16
16
  * canonical name it is exported under.
17
17
  */
18
18
  export interface RegisteredExport {
19
- registerId: string;
19
+ registryId: string;
20
20
  exportName: string;
21
21
  filename: string;
22
22
  }
@@ -42,6 +42,7 @@ export declare function toSet<T>(data: Opt<T>): Set<T>;
42
42
  export declare function mapToString<T>(data: Opt<T>, sep: string, cb: (item: T, index: number) => string): string;
43
43
  export declare function findSorted<T>(compare: Compare<T>, data: T[], item: T): T | undefined;
44
44
  export declare function findIndexSorted<T>(compare: Compare<T>, data: T[], item: T): number;
45
+ export declare function searchSorted<T>(compare: Compare<T>, data: T[], item: T): number;
45
46
  export declare function addSorted<T, U extends T[]>(compare: Compare<T>, data: U, item: T): U;
46
47
  export declare function at<T>(data: Opt<T>, index: number): T | undefined;
47
48
  export declare function first<T>(data: OneMany<T>): T;
@@ -1,7 +1,7 @@
1
1
  import { type Binding } from "./bindings";
2
2
  export type ParamsTree = {
3
3
  binding: Binding;
4
- props: {
4
+ properties: {
5
5
  [prop: string]: ParamsTree;
6
6
  } | undefined;
7
7
  rest: ParamsTree | undefined;
@@ -14,5 +14,5 @@ declare module "@marko/compiler/dist/types" {
14
14
  export declare function exposeParamsTree(binding: Binding, bodyAnalyzed?: boolean): ParamsTree;
15
15
  export declare function getSettledParamsTree(paramsTree: ParamsTree | undefined): ParamsTree | undefined;
16
16
  export declare function getParamsTreeAt(paramsTree: ParamsTree | true, name: string): ParamsTree | true | undefined;
17
- export declare function getAllKnownPropNames(paramsTree: ParamsTree): string[];
18
- export declare function hasAllKnownProps(paramsTree: ParamsTree): boolean | undefined;
17
+ export declare function getAllKnownPropertyNames(paramsTree: ParamsTree): string[];
18
+ export declare function hasAllKnownProperties(paramsTree: ParamsTree): boolean | undefined;
@@ -11,15 +11,14 @@ export declare function addAlwaysReason(binding: Binding): void;
11
11
  export declare function addReasonExprs(slot: Slot, expr: Opt<t.NodeExtra>): void;
12
12
  export declare function addOwnerReason(from: Section, to: Section, reason: undefined | false | Reason): void;
13
13
  export declare function mapBodyParams(section: Section, reason: undefined | Reason, seen?: Set<ParamBinding>): Reason | undefined;
14
- export declare function isConditionalReason(reason: undefined | Reason): reason is Sources & {
14
+ export declare function isGuardedReason(reason: undefined | Reason): reason is Sources & {
15
15
  state: undefined;
16
16
  always: undefined;
17
17
  };
18
- export declare function isUnconditionalReason(reason: undefined | Reason): reason is Reason;
19
18
  export declare function isStateReason(reason: undefined | Reason): reason is Sources;
20
19
  export declare function getSourcesForExpr(expr: t.NodeExtra): Sources | undefined;
21
20
  export declare function getSourcesForExprs(exprs: Opt<t.NodeExtra> | boolean): Sources | undefined;
22
- export declare function getSourcesForRef(ref: ReferencedBindings): Sources | undefined;
21
+ export declare function getSourcesForReferencedBindings(bindings: ReferencedBindings): Sources | undefined;
23
22
  export declare function getSourcesForDerived({ binding, exprs, properties, }: NonNullable<Section["derives"]>): Sources | undefined;
24
23
  export declare function mapParamReason(program: Section, reason: Sources, exprs: KnownExprs | undefined, ownParams: boolean): Reason | undefined;
25
24
  export interface KnownExprs {
@@ -32,6 +31,6 @@ export declare function mapParamBindingToExpr(exprs: KnownExprs, binding: ParamB
32
31
  export declare function getKnownExprsAt(exprs: KnownExprs, binding: Binding): KnownExprs;
33
32
  export declare function applyReasonExprs(section: Section): void;
34
33
  export declare function mergeSlotReasons(section: Section): void;
35
- export declare function getNodeReasons(section: Section): Sources | import("./optional").SortedMany<Sources> | undefined;
34
+ export declare function getNodeReasons(section: Section): Reasons | undefined;
36
35
  export declare function getReasonsVersion(): number;
37
36
  export declare function setParamReasonGroups(section: Section, groups: ParamReasonGroups): void;
@@ -17,7 +17,7 @@ export interface Read {
17
17
  }
18
18
  export interface ResolvedRead {
19
19
  binding: Binding;
20
- props: Opt<string>;
20
+ properties: Opt<string>;
21
21
  inOwnBody: boolean;
22
22
  getter: Getter | undefined;
23
23
  /** Set for same-section local reads: the function root that owns the read. */
@@ -63,6 +63,9 @@ declare module "@marko/compiler/dist/types" {
63
63
  assignment?: Binding;
64
64
  assignmentTo?: Binding;
65
65
  read?: ResolvedRead;
66
+ /** For an expression root that is a dynamic tag's name, not one of its
67
+ * inputs: that tag. */
68
+ tagName?: t.MarkoTagExtra;
66
69
  dropped?: true;
67
70
  /** The expression this node sits in: dropped or merged as one. */
68
71
  exprRoot?: NodeExtra;
@@ -84,15 +87,17 @@ declare module "@marko/compiler/dist/types" {
84
87
  merged?: NodeExtra;
85
88
  }
86
89
  interface FunctionExtra {
90
+ /** Its body uses its scope when invoked, so a registered one is given it;
91
+ * complete once references finalize. */
87
92
  referencesScope?: boolean;
88
93
  [kReferencedBindingsInFunction]?: ReferencedBindings;
89
94
  referencedLocalBindingsInFunction?: SortedOpt<Binding>;
90
95
  [kConstantBindingsInFunction]?: ReferencedBindings;
91
96
  name?: string;
92
- registerId?: string;
97
+ registryId?: string;
93
98
  /** When client code reads the function itself, which registers it. */
94
99
  reason?: Reason;
95
- exportRegisterId?: string;
100
+ exportRegistryId?: string;
96
101
  }
97
102
  interface ArrowFunctionExpressionExtra extends FunctionExtra {
98
103
  }
@@ -120,11 +125,11 @@ export declare const getReferenceFinalizers: () => (() => void)[];
120
125
  export declare function onFinalizeReferences(finalize: () => void): void;
121
126
  export declare function addRead(exprExtra: ReferencedExtra, extra: t.NodeExtra, binding: Binding, section: Section, getter: Getter | undefined): Read;
122
127
  export declare function dropNodes(node: t.Node | t.Node[]): void;
123
- export declare function dropExtra(exprExtra: ReferencedExtra): void;
128
+ export declare function dropExpr(exprExtra: ReferencedExtra): void;
124
129
  export declare function dropContent(body: t.MarkoTagBody): void;
125
130
  export declare function getAllTagReferenceNodes(tag: t.MarkoTag, referenceNodes?: t.Node[], collectAttrTag?: (attrTag: t.MarkoTag) => void): t.Node[];
126
- export declare function createResolvedRead(binding: Binding, props: Opt<string>, inOwnBody?: boolean): ResolvedRead;
127
- export declare function createResolvedGetterRead(binding: Binding, props: Opt<string>, getter: Getter): ResolvedRead;
131
+ export declare function createResolvedRead(binding: Binding, properties: Opt<string>, inOwnBody?: boolean): ResolvedRead;
132
+ export declare function createResolvedGetterRead(binding: Binding, properties: Opt<string>, getter: Getter): ResolvedRead;
128
133
  export interface ReferencedExtra extends t.NodeExtra {
129
134
  section: Section;
130
135
  }
@@ -140,7 +145,7 @@ export declare function isAssignedBindingExtra(extra: t.NodeExtra | undefined):
140
145
  export interface RegisteredFnExtra extends ReferencedExtra, t.FunctionExtra {
141
146
  exprRoot: t.NodeExtra;
142
147
  name: string;
143
- registerId: string;
148
+ registryId: string;
144
149
  reason: Reason;
145
150
  }
146
151
  export declare function isRegisteredFnExtra(extra: t.NodeExtra | undefined): extra is RegisteredFnExtra;
@@ -152,5 +157,5 @@ export declare function getReferencedBindingsInFunction(extra: t.FunctionExtra):
152
157
  export declare function getConstantBindingsInFunction(extra: t.FunctionExtra): ReferencedBindings;
153
158
  export declare function setResolvedFunctionReads(extra: t.FunctionExtra, referencedBindings: ReferencedBindings, constantBindings: ReferencedBindings): void;
154
159
  export declare function setResolvedReads(extra: ReferencedExtra, referencedBindings: ReferencedBindings, lazyBindings: ReferencedBindings): void;
155
- export declare function getCanonicalExtra<T extends t.NodeExtra>(extra: T): T;
160
+ export declare function getCanonicalExpr<T extends t.NodeExtra>(extra: T): T;
156
161
  export {};
@@ -0,0 +1,4 @@
1
+ import { types as t } from "@marko/compiler";
2
+ export declare function replaceWithStatements(path: t.NodePath, statements?: t.Statement[]): void;
3
+ export declare function insertStatementBefore(path: t.NodePath, statement: t.Statement): void;
4
+ export declare function writeBodyStatements(body: t.Program | t.MarkoTagBody): void;
@@ -11,4 +11,5 @@ export type DOMRuntimeFeature = (typeof domRuntimeFeatures)[number];
11
11
  export declare function importRuntimeFeature(feature: DOMRuntimeFeature): void;
12
12
  export declare function getRuntimeFeatureImport(feature: DOMRuntimeFeature): t.ImportDeclaration;
13
13
  export declare function getRuntimePath(output: string): string;
14
+ export declare function absentArg(value: 0 | 1): t.NumericLiteral;
14
15
  export declare function getCompatRuntimeFile(): string;
@@ -10,4 +10,4 @@ export declare function getScopeAccessor(binding: Binding, encoded?: boolean, in
10
10
  export declare function getLocalsScopeAccessor(binding: Binding): string;
11
11
  export declare function getPrefixedScopeAccessor(binding: Binding, prefix: AccessorPrefix): string;
12
12
  export declare function getClosureAccessorLiteral(binding: Binding): t.NumericLiteral | t.StringLiteral;
13
- export declare function getSectionInstancesAccessorLiteral(section: Section): t.StringLiteral;
13
+ export declare function getSectionScopesAccessorLiteral(section: Section): t.StringLiteral;
@@ -3,7 +3,8 @@ import { type Binding, type Intersection, type IntersectionMeta, type ParamBindi
3
3
  import * as ContentType from "./constants/content-type";
4
4
  import type * as Step from "./constants/step";
5
5
  import * as StructureKind from "./constants/structure-kind";
6
- import { type OneMany, type Opt, Sorted, type SortedOpt } from "./optional";
6
+ import type { KnownTagExtra } from "./known-tag";
7
+ import { type OneMany, type Opt, Sorted } from "./optional";
7
8
  import { type KnownExprs, type Reason } from "./reasons";
8
9
  import { type Slot } from "./slots";
9
10
  import { type Sources } from "./sources";
@@ -30,7 +31,11 @@ export interface StructureText {
30
31
  export interface StructureNode {
31
32
  kind: typeof StructureKind.Node;
32
33
  binding: Binding | undefined;
33
- marker: boolean;
34
+ /** `undefined` for a text node at its section's edge: a marker where the
35
+ * section is a known child (`isKnownChild`), known once calls are analyzed. */
36
+ marker: boolean | undefined;
37
+ /** A placeholder's text node, written as a space where it is no marker. */
38
+ text?: true;
34
39
  }
35
40
  export interface StructureChild {
36
41
  kind: typeof StructureKind.Child;
@@ -62,19 +67,20 @@ export interface Section {
62
67
  selector: Set<Binding> | undefined;
63
68
  /** The canonical intersections its work waits on, once ids allocate. */
64
69
  intersections: Map<Intersection, IntersectionMeta> | undefined;
65
- /** The slots of its scope, its own and its bindings'. */
66
- slots: SortedOpt<Slot>;
70
+ /** The slots of its scope, its own and its bindings', which `slots.ts` keeps
71
+ * sorted. */
72
+ slots: Slot[];
67
73
  /** When client code reads anything in its scope: its slots' reasons merged. */
68
74
  reason: undefined | Reason;
69
75
  paramReasonGroups: ParamReasonGroups | undefined;
70
76
  returnValueExpr: t.NodeExtra | undefined;
71
77
  isHoistThrough: true | undefined;
72
78
  branchExpr: t.NodeExtra | undefined;
73
- /** For a `<define>` body or a template rendering itself, the sections whose
74
- * direct calls render it. */
75
- callSections: SortedOpt<Section>;
79
+ /** For a `<define>` body or a template rendering itself, the known tags whose
80
+ * direct calls render it (each in its child scope binding's section). */
81
+ renderedBy: Opt<KnownTagExtra>;
76
82
  /** The known tags rendering in it, in analyze order. */
77
- knownTags: t.MarkoTagExtra[] | undefined;
83
+ knownTags: KnownTagExtra[] | undefined;
78
84
  /** The content's rendering tag (its extra), and each child binding that
79
85
  * derives from the content, at `properties`. */
80
86
  derives: {
@@ -94,14 +100,14 @@ export interface Section {
94
100
  * `<define>` body or template it calls in place. */
95
101
  hasSetupWork: boolean;
96
102
  /** Its tag, which renders it in place into branch scopes at the tag's node
97
- * binding, and whether its branch expression's value can leave it unrendered. */
103
+ * binding; an `<if>` chain's at `index`, the renderer index it renders as. */
98
104
  branch: {
99
- nodeBinding: Binding;
100
- optional: boolean;
101
- /** An `<if>` branch's place in its chain, the renderer index it renders as. */
102
- index?: number;
103
- /** An `<await>` body, made with its owner: its promise settles into it. */
104
- await?: true;
105
+ kind: "if";
106
+ tag: ControlFlowTagExtra;
107
+ index: number;
108
+ } | {
109
+ kind: "for" | "await" | "try";
110
+ tag: ControlFlowTagExtra;
105
111
  } | undefined;
106
112
  content: null | {
107
113
  startType: ContentType;
@@ -110,6 +116,10 @@ export interface Section {
110
116
  };
111
117
  structure: StructureOp[] | null;
112
118
  }
119
+ /** A control flow tag's extra once analyzed: its branches render at its node. */
120
+ export interface ControlFlowTagExtra extends t.MarkoTagExtra {
121
+ nodeBinding: Binding;
122
+ }
113
123
  declare module "@marko/compiler/dist/types" {
114
124
  interface ProgramExtra {
115
125
  section?: Section;
@@ -118,6 +128,16 @@ declare module "@marko/compiler/dist/types" {
118
128
  interface MarkoTagBodyExtra {
119
129
  section?: Section;
120
130
  }
131
+ interface MarkoTagExtra {
132
+ /** For a tag rendering content in its place or through a template, whether
133
+ * text may merge into it from before; `undefined` at its section's edge. */
134
+ textBefore?: boolean;
135
+ }
136
+ interface MarkoPlaceholderExtra {
137
+ /** Whether text may merge into its text node from before; `undefined` at its
138
+ * section's edge. */
139
+ textBefore?: boolean;
140
+ }
121
141
  }
122
142
  export declare const sectionUtil: Sorted<Section>;
123
143
  export declare function ensureBodySection(path: t.NodePath<t.MarkoTagBody | t.Program>): Section | undefined;
@@ -128,10 +148,15 @@ export declare function getSection(path: t.NodePath): Section;
128
148
  export declare const getScopeIdIdentifier: (section: Section) => t.Identifier;
129
149
  export declare const getBranchRendererArgs: (section: Section) => [template?: t.Expression | undefined, walks?: t.Expression | undefined, setup?: t.Expression | undefined, params?: t.Expression | undefined], setBranchRendererArgs: (section: Section, value: [template?: t.Expression | undefined, walks?: t.Expression | undefined, setup?: t.Expression | undefined, params?: t.Expression | undefined]) => void;
130
150
  export declare function forEachSection(fn: (section: Section) => void): void;
131
- export declare function getDynamicTagContentClosures(section: Section): ReferencedBindings;
151
+ export declare function getDynamicTagContentClosures(section: Section): import("./optional").SortedOpt<Binding>;
132
152
  export declare function forEachAncestorSection<A>(from: Section, to: Section, fn: (section: Section, arg: A) => void, arg: A): void;
133
153
  export declare function forEachSectionReverse(fn: (section: Section) => void): void;
154
+ export declare function getContentInfo(path: t.NodePath<t.Program | t.MarkoTagBody>): Section["content"];
134
155
  export declare function getNodeContentType(path: t.NodePath<t.Statement>, edge: "startType" | "endType"): ContentType.Value | null;
156
+ export declare function isKnownChild(section: Section): boolean;
157
+ export declare const getSectionTextBefore: (key: Section) => boolean | undefined;
158
+ export declare function mayEndWithText(section: Section): boolean;
159
+ export declare function mayMergeWithText(path: t.NodePath, before: boolean): boolean | undefined;
135
160
  export declare function getRendererReason(section: Section): false | Sources;
136
161
  export declare function isOptionalBranch(section: Section): section is Section & {
137
162
  branch: NonNullable<Section["branch"]>;
@@ -140,7 +165,7 @@ export declare function isInParentSection(binding: Binding, section: Section): b
140
165
  export declare function isDirectClosure(section: Section, closure: Binding): boolean;
141
166
  export declare function isDynamicClosure(section: Section, closure: Binding): boolean;
142
167
  export declare function getDynamicClosureIndex(closure: Binding, closureSection: Section): number;
143
- export declare function getDirectClosures(section: Section): SortedOpt<Binding>;
168
+ export declare function getDirectClosures(section: Section): import("./optional").SortedOpt<Binding>;
144
169
  export declare function isSameOrAncestorSection(section: Section, other: Section): boolean;
145
170
  export declare function getCommonSection(section: Section, other: Section): Section;
146
171
  export declare function ensureSectionReasonGroups(section: Section): void;
@@ -33,17 +33,9 @@ export interface Signal {
33
33
  buildAssignment: ((valueSection: Section, value: t.Expression) => t.Expression | undefined) | undefined;
34
34
  }
35
35
  type closureSignalBuilder = (closure: Binding, render: t.Expression) => t.Expression;
36
- export type ClosureHop = {
37
- kind: "if";
38
- nodeBinding: Binding;
39
- index: number;
40
- } | {
41
- kind: "for";
42
- nodeBinding: Binding;
43
- };
44
36
  export declare const getSignals: (section: Section) => Map<unknown, Signal>;
45
- export declare function setClosureSignalBuilder(tag: t.NodePath<t.MarkoTag>, hop: ClosureHop, build?: closureSignalBuilder): void;
46
- export declare function buildClosureHop(hop: ClosureHop, render: t.Expression): t.CallExpression;
37
+ export declare function setClosureSignalBuilder(tag: t.NodePath<t.MarkoTag>, build?: closureSignalBuilder): void;
38
+ export declare function buildClosureHop(section: Section, render: t.Expression): t.CallExpression;
47
39
  export declare function setSectionOwnerResumedByMarker(section: Section): void;
48
40
  export declare function getContentClosureValues(bodySection: Section): {
49
41
  scope: t.Identifier;
@@ -65,7 +57,7 @@ export declare function trimEmptyArgs(args: (t.Expression | undefined | false)[]
65
57
  export declare function addStatement(type: "render" | "effect", targetSection: Section, expr: t.NodeExtra | undefined, statement: t.Statement | t.Statement[] | t.Expression, isPure?: boolean): void;
66
58
  export declare function addTagStatement(tag: t.NodePath<t.MarkoTag>, statement: t.Statement): void;
67
59
  export declare function addValue(targetSection: Section, expr: t.NodeExtra | undefined, signal: Signal, value?: t.Expression): void;
68
- export declare function getResumeRegisterId(section: Section, referencedBindings: string | ReferencedBindings, type?: string): string;
60
+ export declare function getResumeRegistryId(section: Section, referencedBindings: string | ReferencedBindings, type?: string): string;
69
61
  export declare function writeSignals(section: Section): Set<Signal>;
70
62
  export declare function writeRegisteredFns(): void;
71
63
  export declare function addHTMLEffectCall(section: Section, expr?: t.NodeExtra): void;
@@ -8,7 +8,7 @@ type SlotKind = SlotKind.Value;
8
8
  export { SlotKind };
9
9
  export type BindingSlotKind = typeof SlotKind.Value | typeof SlotKind.ChangeHandler | typeof SlotKind.ClosureScopes | typeof SlotKind.ClosureSignalIndex | typeof SlotKind.BranchExpr | typeof SlotKind.ParamGroup;
10
10
  export type SectionSlotKind = Exclude<SlotKind, BindingSlotKind>;
11
- export type PlaceSlotKind = typeof SlotKind.Value | typeof SlotKind.ChangeHandler | typeof SlotKind.ClosureScopes | typeof SlotKind.ClosureSignalIndex | typeof SlotKind.Owner | typeof SlotKind.ReturnChangeHandler | typeof SlotKind.Instances;
11
+ export type PlaceSlotKind = typeof SlotKind.Value | typeof SlotKind.ChangeHandler | typeof SlotKind.ClosureScopes | typeof SlotKind.ClosureSignalIndex | typeof SlotKind.Owner | typeof SlotKind.ReturnChangeHandler | typeof SlotKind.Scopes;
12
12
  /** A place in a scope that client code may read after resume, or a fact about
13
13
  * one a guard decides on (a condition changing, a branch or group resuming). */
14
14
  export type Slot = BindingSlot | SectionSlot;
@@ -6,4 +6,10 @@ import { type Section } from "./sections";
6
6
  export declare function solveReasons(intersectionsBySection: Map<Section, Intersection[]>): void;
7
7
  export declare function getReasonForBinding(binding: Binding, properties?: Opt<string> | true): undefined | Reason;
8
8
  export declare function getReasonForExpr(extra: t.NodeExtra): undefined | Reason;
9
+ export declare function bindingLandsRetained(binding: Binding, properties: Opt<string>): boolean;
10
+ export declare function getContentSites({ binding, properties, }: NonNullable<Section["derives"]>): {
11
+ unseen: boolean;
12
+ sites: Opt<t.MarkoTagExtra>;
13
+ deepSites: Opt<t.MarkoTagExtra>;
14
+ };
9
15
  export declare function landsRetained(extra: t.NodeExtra): boolean;
@@ -1,4 +1,5 @@
1
1
  import { types as t } from "@marko/compiler";
2
2
  export declare function isStaticText(node?: t.Node): boolean | undefined;
3
3
  export declare function followsStaticText(path: t.NodePath): boolean | undefined;
4
+ export declare function getPlaceholderContentType(placeholder: t.MarkoPlaceholder): 2 | 4 | null;
4
5
  export declare function getStaticPlaceholderText(placeholder: t.MarkoPlaceholder): string | undefined;
@@ -8,8 +8,9 @@ export declare function child(tag: t.NodePath<t.MarkoTag>, name: string, rendere
8
8
  export declare function writeTo(path: t.NodePath<any>): (strs: TemplateStringsArray, ...exprs: string[]) => void;
9
9
  export declare function writeModuleReadTo(path: t.NodePath<any>, read: string[]): void;
10
10
  export declare function writeTextTo(path: t.NodePath<any>, value: string): void;
11
- export declare function node(path: t.NodePath<t.MarkoTag | t.MarkoPlaceholder>, binding?: Binding): StructureNode | undefined;
12
- export declare function marker(path: t.NodePath<t.MarkoTag | t.MarkoPlaceholder>, binding: Binding): void;
11
+ export declare function node(path: t.NodePath<t.MarkoTag>, binding?: Binding): StructureNode | undefined;
12
+ export declare function text(path: t.NodePath<t.MarkoPlaceholder>, binding: Binding, marker: boolean | undefined): void;
13
+ export declare function marker(path: t.NodePath<t.MarkoTag>, binding: Binding): void;
13
14
  export declare function controlFlowNode(tag: t.NodePath<t.MarkoTag>, section: Section): Binding;
14
15
  interface SectionMeta {
15
16
  walks: t.Expression | undefined;
@@ -13,8 +13,6 @@ export type LoadImportConfig = {
13
13
  render: false;
14
14
  triggers: LoadTrigger[];
15
15
  };
16
- export declare function importOrSelfReferenceName(file: t.BabelFile, request: string, name: string, nameHint?: string): t.Identifier;
17
- export declare function isCircularRequest(file: t.BabelFile, request: string): boolean;
18
16
  export declare function trackTagImport(tagImport: string): void;
19
17
  export declare function getImportFacts(importDecl: t.NodePath<t.ImportDeclaration>): t.ImportDeclarationExtra & t.NodeExtra;
20
18
  export declare function getLoadAttr(importDecl: t.NodePath<t.ImportDeclaration>): t.NodePath<t.ImportAttribute> | undefined;
@@ -13,4 +13,7 @@ export declare function getWriteReason(binding: Binding): Sources | undefined;
13
13
  export declare function getBranchWriteReason(section: Section): Sources | undefined;
14
14
  export declare function getWriteGuard(section: Section, reason: undefined | Reason, omitUnconditional: boolean): t.Expression | undefined;
15
15
  export declare function getWriteGuardForAny(section: Section, reasons: undefined | Reasons, omitUnconditional: boolean): t.Expression | undefined;
16
- export declare function getExprIfWritten<T extends undefined | Reason, R extends (T extends {} ? t.Expression : undefined)>(section: Section, reason: T, expr: t.Expression): R;
16
+ export declare function getExprIfWritten(section: Section, reason: undefined | Reason, expr: t.Expression): t.Expression | undefined;
17
+ export declare function isEverWritten(section: Section, reason: undefined | Reason): boolean;
18
+ export declare function isWrittenForCall(section: Section, reason: undefined | Reason, call: t.MarkoTagExtra, callSection: Section): boolean;
19
+ export declare function getWriteBit(section: Section, reason: undefined | Reason): number | undefined;
@@ -1,10 +1,10 @@
1
1
  import { types as t } from "@marko/compiler";
2
- import * as SiblingText from "./constants/sibling-text";
3
- declare const kSiblingText: unique symbol;
4
- type SiblingText = SiblingText.Value;
2
+ declare const kTextAfter: unique symbol;
5
3
  declare module "@marko/compiler/dist/types" {
6
4
  interface MarkoPlaceholderExtra {
7
- [kSiblingText]?: SiblingText;
5
+ /** Whether text may merge into its text node from after; `undefined` at its
6
+ * section's edge. */
7
+ [kTextAfter]?: boolean;
8
8
  }
9
9
  }
10
10
  declare const _default: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.4.7",
3
+ "version": "6.4.9",
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.42.13",
54
+ "@marko/compiler": "^5.42.15",
55
55
  "csstype": "^3.2.3",
56
56
  "fastest-levenshtein": "^1.0.16",
57
57
  "magic-string": "^0.30.21"
58
58
  },
59
59
  "devDependencies": {
60
- "@marko/runtime-tags": "npm:marko@6.4.7",
61
- "marko": "5.39.47"
60
+ "@marko/runtime-tags": "npm:marko@6.4.9",
61
+ "marko": "5.39.48"
62
62
  },
63
63
  "engines": {
64
64
  "node": ">=22"
package/tags-html.d.ts CHANGED
@@ -97,6 +97,7 @@ declare global {
97
97
  search: NativeTag<Marko.HTML.Search, HTMLElement>;
98
98
  section: NativeTag<Marko.HTML.Section, HTMLElement>;
99
99
  select: NativeTag<Marko.HTML.Select, HTMLSelectElement>;
100
+ selectedcontent: NativeTag<Marko.HTML.SelectedContent, HTMLElement>;
100
101
  slot: NativeTag<Marko.HTML.Slot, HTMLSlotElement>;
101
102
  small: NativeTag<Marko.HTML.Small, HTMLElement>;
102
103
  source: NativeTag<Marko.HTML.Source, HTMLSourceElement>;
@@ -2056,6 +2057,8 @@ declare global {
2056
2057
  ) => void);
2057
2058
  }
2058
2059
 
2060
+ interface SelectedContent extends HTMLAttributes<HTMLElement> {}
2061
+
2059
2062
  interface Slot extends HTMLAttributes<HTMLSlotElement> {
2060
2063
  /**
2061
2064
  * Used to assign slots to other elements
@@ -1,6 +0,0 @@
1
- export declare const None = 0;
2
- export declare const Before = 1;
3
- export declare const After = 2;
4
- type Self = typeof import("./sibling-text");
5
- export type Value = Self[keyof Self];
6
- export {};