marko 6.4.11 → 6.4.13

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 (108) hide show
  1. package/dist/common/attr-tag.d.ts +1 -0
  2. package/dist/common/errors.d.ts +2 -0
  3. package/dist/common/helpers.d.ts +2 -0
  4. package/dist/debug/dom/catch.feat.js +1 -1
  5. package/dist/debug/dom/catch.feat.mjs +1 -1
  6. package/dist/debug/dom/compat.feat.js +143 -0
  7. package/dist/debug/dom/compat.feat.mjs +141 -0
  8. package/dist/debug/dom/controllable-input.feat.js +1 -1
  9. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  10. package/dist/debug/dom/controllable-open.feat.js +1 -1
  11. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  12. package/dist/debug/dom/controllable-select.feat.js +1 -1
  13. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  14. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  15. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  16. package/dist/debug/dom/controllable.feat.js +1 -1
  17. package/dist/debug/dom/controllable.feat.mjs +1 -1
  18. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  19. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  20. package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
  21. package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
  22. package/dist/debug/dom/lazy.feat.js +1 -1
  23. package/dist/debug/dom/lazy.feat.mjs +1 -1
  24. package/dist/debug/dom/placeholder.feat.js +1 -1
  25. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  26. package/dist/debug/{dom-DjUZd-9y.mjs → dom-BORByF2b.mjs} +54 -27
  27. package/dist/debug/{dom-mQ5mPBTF.js → dom-sfzdCRAg.js} +71 -38
  28. package/dist/debug/dom.js +4 -127
  29. package/dist/debug/dom.mjs +2 -119
  30. package/dist/debug/html/compat.feat.js +222 -0
  31. package/dist/debug/html/compat.feat.mjs +220 -0
  32. package/dist/debug/html-DMo6pc_h.mjs +3931 -0
  33. package/dist/debug/html-DfZjMkhx.js +4513 -0
  34. package/dist/debug/html.js +83 -4220
  35. package/dist/debug/html.mjs +1 -4133
  36. package/dist/dom/catch.feat.js +4 -4
  37. package/dist/dom/catch.feat.mjs +1 -1
  38. package/dist/dom/{compat.d.ts → compat.feat.d.ts} +18 -9
  39. package/dist/dom/compat.feat.js +101 -0
  40. package/dist/dom/compat.feat.mjs +100 -0
  41. package/dist/dom/control-flow.d.ts +0 -1
  42. package/dist/dom/controllable-input.feat.js +2 -2
  43. package/dist/dom/controllable-input.feat.mjs +1 -1
  44. package/dist/dom/controllable-open.feat.js +2 -2
  45. package/dist/dom/controllable-open.feat.mjs +1 -1
  46. package/dist/dom/controllable-select.feat.js +2 -2
  47. package/dist/dom/controllable-select.feat.mjs +1 -1
  48. package/dist/dom/controllable-textarea.feat.js +2 -2
  49. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  50. package/dist/dom/controllable.feat.js +2 -2
  51. package/dist/dom/controllable.feat.mjs +1 -1
  52. package/dist/dom/dom.d.ts +2 -1
  53. package/dist/dom/dynamic-tag-script.feat.js +2 -2
  54. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  55. package/dist/dom/dynamic-tag-var.feat.js +3 -3
  56. package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
  57. package/dist/dom/lazy.feat.js +1 -1
  58. package/dist/dom/lazy.feat.mjs +1 -1
  59. package/dist/dom/placeholder.feat.js +3 -3
  60. package/dist/dom/placeholder.feat.mjs +1 -1
  61. package/dist/dom/resume.d.ts +3 -1
  62. package/dist/{dom-HEWdZCCb.mjs → dom-DKn1bCPC.mjs} +15 -19
  63. package/dist/{dom-B8j2453O.js → dom-DRiewpRL.js} +127 -136
  64. package/dist/dom.d.ts +0 -1
  65. package/dist/dom.js +21 -95
  66. package/dist/dom.mjs +3 -72
  67. package/dist/html/{compat.d.ts → compat.feat.d.ts} +5 -4
  68. package/dist/html/compat.feat.js +165 -0
  69. package/dist/html/compat.feat.mjs +164 -0
  70. package/dist/html/dynamic-tag.d.ts +1 -2
  71. package/dist/html/writer.d.ts +2 -1
  72. package/dist/html-DMDc0zKs.mjs +2404 -0
  73. package/dist/html-DrHsybFm.js +2880 -0
  74. package/dist/html.d.ts +0 -1
  75. package/dist/html.js +2 -2566
  76. package/dist/html.mjs +3 -2561
  77. package/dist/translator/core/if.d.ts +0 -85
  78. package/dist/translator/core/index.d.ts +2 -85
  79. package/dist/translator/index.d.ts +2 -85
  80. package/dist/translator/index.js +332 -476
  81. package/dist/translator/interop/index.d.ts +2 -0
  82. package/dist/translator/util/assert.d.ts +2 -0
  83. package/dist/translator/util/branch-tag.d.ts +1 -1
  84. package/dist/translator/util/known-tag.d.ts +4 -1
  85. package/dist/translator/util/optional.d.ts +0 -1
  86. package/dist/translator/util/reasons.d.ts +0 -1
  87. package/dist/translator/util/references.d.ts +1 -0
  88. package/dist/translator/util/sections.d.ts +5 -1
  89. package/dist/translator/util/tag-facts.d.ts +2 -0
  90. package/dist/translator/util/translate-attrs.d.ts +1 -4
  91. package/dist/translator/visitors/program/index.d.ts +2 -2
  92. package/index.d.ts +2 -7
  93. package/package.json +4 -4
  94. package/tags/await.d.marko +9 -1
  95. package/tags/const.d.marko +7 -1
  96. package/tags/debug.d.marko +7 -1
  97. package/tags/define.d.marko +7 -1
  98. package/tags/effect.d.marko +6 -1
  99. package/tags/html-comment.d.marko +6 -0
  100. package/tags/html-script.d.marko +5 -0
  101. package/tags/html-style.d.marko +5 -0
  102. package/tags/id.d.marko +11 -1
  103. package/tags/let.d.marko +8 -1
  104. package/tags/lifecycle.d.marko +11 -1
  105. package/tags/log.d.marko +7 -1
  106. package/tags/script.d.marko +9 -1
  107. package/tags/show.d.marko +7 -1
  108. package/tags/try.d.marko +9 -1
@@ -15,6 +15,8 @@ export declare function createInteropTranslator(translate5: any): {
15
15
  analyze: Record<"Accessor" | "AnyTypeAnnotation" | "ArgumentPlaceholder" | "ArrayExpression" | "ArrayPattern" | "ArrayTypeAnnotation" | "ArrowFunctionExpression" | "AssignmentExpression" | "AssignmentPattern" | "AwaitExpression" | "BigIntLiteral" | "Binary" | "BinaryExpression" | "BindExpression" | "BindingIdentifier" | "Block" | "BlockParent" | "BlockScoped" | "BlockStatement" | "BooleanLiteral" | "BooleanLiteralTypeAnnotation" | "BooleanTypeAnnotation" | "BreakStatement" | "CallExpression" | "CatchClause" | "Class" | "ClassAccessorProperty" | "ClassBody" | "ClassDeclaration" | "ClassExpression" | "ClassImplements" | "ClassMethod" | "ClassPrivateMethod" | "ClassPrivateProperty" | "ClassProperty" | "CompletionStatement" | "Conditional" | "ConditionalExpression" | "ContinueStatement" | "DebuggerStatement" | "DecimalLiteral" | "Declaration" | "DeclareClass" | "DeclareExportAllDeclaration" | "DeclareExportDeclaration" | "DeclareFunction" | "DeclareInterface" | "DeclareModule" | "DeclareModuleExports" | "DeclareOpaqueType" | "DeclareTypeAlias" | "DeclareVariable" | "DeclaredPredicate" | "Decorator" | "Directive" | "DirectiveLiteral" | "DoExpression" | "DoWhileStatement" | "EmptyStatement" | "EmptyTypeAnnotation" | "EnumBody" | "EnumBooleanBody" | "EnumBooleanMember" | "EnumDeclaration" | "EnumDefaultedMember" | "EnumMember" | "EnumNumberBody" | "EnumNumberMember" | "EnumStringBody" | "EnumStringMember" | "EnumSymbolBody" | "ExistentialTypeParam" | "ExistsTypeAnnotation" | "ExportAllDeclaration" | "ExportDeclaration" | "ExportDefaultDeclaration" | "ExportDefaultSpecifier" | "ExportNamedDeclaration" | "ExportNamespaceSpecifier" | "ExportSpecifier" | "Expression" | "ExpressionStatement" | "ExpressionWrapper" | "File" | "Flow" | "FlowBaseAnnotation" | "FlowDeclaration" | "FlowPredicate" | "FlowType" | "For" | "ForAwaitStatement" | "ForInStatement" | "ForOfStatement" | "ForStatement" | "ForXStatement" | "Function" | "FunctionDeclaration" | "FunctionExpression" | "FunctionParameter" | "FunctionParent" | "FunctionTypeAnnotation" | "FunctionTypeParam" | "Generated" | "GenericTypeAnnotation" | "Identifier" | "IfStatement" | "Immutable" | "Import" | "ImportAttribute" | "ImportDeclaration" | "ImportDefaultSpecifier" | "ImportExpression" | "ImportNamespaceSpecifier" | "ImportOrExportDeclaration" | "ImportSpecifier" | "IndexedAccessType" | "InferredPredicate" | "InterfaceDeclaration" | "InterfaceExtends" | "InterfaceTypeAnnotation" | "InterpreterDirective" | "IntersectionTypeAnnotation" | "JSX" | "JSXAttribute" | "JSXClosingElement" | "JSXClosingFragment" | "JSXElement" | "JSXEmptyExpression" | "JSXExpressionContainer" | "JSXFragment" | "JSXIdentifier" | "JSXMemberExpression" | "JSXNamespacedName" | "JSXOpeningElement" | "JSXOpeningFragment" | "JSXSpreadAttribute" | "JSXSpreadChild" | "JSXText" | "LVal" | "LabeledStatement" | "Literal" | "LogicalExpression" | "Loop" | "Marko" | "MarkoAttribute" | "MarkoCDATA" | "MarkoClass" | "MarkoComment" | "MarkoDeclaration" | "MarkoDocumentType" | "MarkoParseError" | "MarkoPlaceholder" | "MarkoScriptlet" | "MarkoSpreadAttribute" | "MarkoTag" | "MarkoTagBody" | "MarkoText" | "MemberExpression" | "MetaProperty" | "Method" | "Miscellaneous" | "MixedTypeAnnotation" | "ModuleDeclaration" | "ModuleExpression" | "ModuleSpecifier" | "NewExpression" | "Noop" | "NullLiteral" | "NullLiteralTypeAnnotation" | "NullableTypeAnnotation" | "NumberLiteral" | "NumberLiteralTypeAnnotation" | "NumberTypeAnnotation" | "NumericLiteral" | "NumericLiteralTypeAnnotation" | "ObjectExpression" | "ObjectMember" | "ObjectMethod" | "ObjectPattern" | "ObjectProperty" | "ObjectTypeAnnotation" | "ObjectTypeCallProperty" | "ObjectTypeIndexer" | "ObjectTypeInternalSlot" | "ObjectTypeProperty" | "ObjectTypeSpreadProperty" | "OpaqueType" | "OptionalCallExpression" | "OptionalIndexedAccessType" | "OptionalMemberExpression" | "ParenthesizedExpression" | "Pattern" | "PatternLike" | "PipelineBareFunction" | "PipelinePrimaryTopicReference" | "PipelineTopicExpression" | "Placeholder" | "Private" | "PrivateName" | "Program" | "Property" | "Pure" | "Pureish" | "QualifiedTypeIdentifier" | "RecordExpression" | "Referenced" | "ReferencedIdentifier" | "ReferencedMemberExpression" | "RegExpLiteral" | "RegexLiteral" | "RestElement" | "RestProperty" | "ReturnStatement" | "Scopable" | "Scope" | "SequenceExpression" | "SpreadElement" | "SpreadProperty" | "Standardized" | "Statement" | "StaticBlock" | "StringLiteral" | "StringLiteralTypeAnnotation" | "StringTypeAnnotation" | "Super" | "SwitchCase" | "SwitchStatement" | "SymbolTypeAnnotation" | "TSAnyKeyword" | "TSArrayType" | "TSAsExpression" | "TSBaseType" | "TSBigIntKeyword" | "TSBooleanKeyword" | "TSCallSignatureDeclaration" | "TSConditionalType" | "TSConstructSignatureDeclaration" | "TSConstructorType" | "TSDeclareFunction" | "TSDeclareMethod" | "TSEntityName" | "TSEnumBody" | "TSEnumDeclaration" | "TSEnumMember" | "TSExportAssignment" | "TSExpressionWithTypeArguments" | "TSExternalModuleReference" | "TSFunctionType" | "TSImportEqualsDeclaration" | "TSImportType" | "TSIndexSignature" | "TSIndexedAccessType" | "TSInferType" | "TSInstantiationExpression" | "TSInterfaceBody" | "TSInterfaceDeclaration" | "TSIntersectionType" | "TSIntrinsicKeyword" | "TSLiteralType" | "TSMappedType" | "TSMethodSignature" | "TSModuleBlock" | "TSModuleDeclaration" | "TSNamedTupleMember" | "TSNamespaceExportDeclaration" | "TSNeverKeyword" | "TSNonNullExpression" | "TSNullKeyword" | "TSNumberKeyword" | "TSObjectKeyword" | "TSOptionalType" | "TSParameterProperty" | "TSParenthesizedType" | "TSPropertySignature" | "TSQualifiedName" | "TSRestType" | "TSSatisfiesExpression" | "TSStringKeyword" | "TSSymbolKeyword" | "TSTemplateLiteralType" | "TSThisType" | "TSTupleType" | "TSType" | "TSTypeAliasDeclaration" | "TSTypeAnnotation" | "TSTypeAssertion" | "TSTypeElement" | "TSTypeLiteral" | "TSTypeOperator" | "TSTypeParameter" | "TSTypeParameterDeclaration" | "TSTypeParameterInstantiation" | "TSTypePredicate" | "TSTypeQuery" | "TSTypeReference" | "TSUndefinedKeyword" | "TSUnionType" | "TSUnknownKeyword" | "TSVoidKeyword" | "TaggedTemplateExpression" | "TemplateElement" | "TemplateLiteral" | "Terminatorless" | "ThisExpression" | "ThisTypeAnnotation" | "ThrowStatement" | "TopicReference" | "TryStatement" | "TupleExpression" | "TupleTypeAnnotation" | "TypeAlias" | "TypeAnnotation" | "TypeCastExpression" | "TypeParameter" | "TypeParameterDeclaration" | "TypeParameterInstantiation" | "TypeScript" | "TypeofTypeAnnotation" | "UnaryExpression" | "UnaryLike" | "UnionTypeAnnotation" | "UpdateExpression" | "User" | "UserWhitespacable" | "V8IntrinsicIdentifier" | "Var" | "VariableDeclaration" | "VariableDeclarator" | "Variance" | "VoidPattern" | "VoidTypeAnnotation" | "While" | "WhileStatement" | "WithStatement" | "YieldExpression" | "enter" | "exit" | `${string}|${string}`, t.VisitNode<unknown, t.Node> | undefined>;
16
16
  translate: t.Visitor<unknown>;
17
17
  tagDiscoveryDirs: any[];
18
+ classTaglibs: any;
19
+ optionalTaglibs: any;
18
20
  taglibs: Taglibs;
19
21
  getRuntimeEntryFiles(output: Config["output"], optimize: boolean): any[];
20
22
  };
@@ -14,6 +14,8 @@ export declare function assertIdentifierVar(tag: t.NodePath<t.MarkoTag>): void;
14
14
  export declare function assertNoTagVarMutation(tag: t.NodePath<t.MarkoTag>): void;
15
15
  export declare function assertHasBody(tag: t.NodePath<t.MarkoTag>): void;
16
16
  export declare function assertNoBodyContent(tag: t.NodePath<t.MarkoTag>): void;
17
+ export declare function assertNoNativeAttrTags(tag: t.NodePath<t.MarkoTag>): void;
18
+ export declare function assertNotContentAttrTag(tag: t.NodePath<t.MarkoTag>): void;
17
19
  export declare function buildAttrsError(tag: t.NodePath<t.MarkoTag>, attrs: t.MarkoTag["attributes"], msg: string): Error;
18
20
  export declare function buildAttrError(tag: t.NodePath<t.MarkoTag>, attr: t.MarkoTag["attributes"][number], msg: string): Error;
19
21
  export declare function buildAttrNameError(tag: t.NodePath<t.MarkoTag>, attr: t.MarkoAttribute, msg: string): Error;
@@ -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 isSingleNodeContent(content: Section["content"] | undefined): boolean;
10
+ export declare function isSingleNodeContent(content: Section["content"]): 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,6 +8,10 @@ declare const kParamsTree: unique symbol;
8
8
  declare const kKnownExprs: unique symbol;
9
9
  declare const kPassesInput: unique symbol;
10
10
  declare module "@marko/compiler/dist/types" {
11
+ interface MarkoSpreadAttributeExtra {
12
+ /** The binding it spreads, which its known child reads prop by prop. */
13
+ knownSpread?: Binding;
14
+ }
11
15
  interface MarkoTagExtra {
12
16
  /** The dom binding a known tag holds its child's scope in. */
13
17
  childScopeBinding?: Binding;
@@ -34,7 +38,6 @@ export declare function addKnownTagReasons(section: Section): void;
34
38
  export declare function callsOtherTemplateSetup(section: Section): boolean;
35
39
  type TranslateDOMInfo = {
36
40
  tagSection: Section;
37
- knownExprs: KnownExprs;
38
41
  getBindingIdentifier: (binding: Binding, preferredName?: string, directContent?: boolean) => t.Identifier;
39
42
  childScopeBinding: Binding;
40
43
  };
@@ -38,7 +38,6 @@ export declare function reduce<T, R>(data: Opt<T>, cb: (acc: R | undefined, item
38
38
  export declare function reduce<T, R>(data: Opt<T>, cb: (acc: R, item: T, index: number) => R, initial: R): R;
39
39
  export declare function reduceWhile<T, R>(data: Opt<T>, cb: (acc: R, item: T) => R | undefined, initial: R): R | undefined;
40
40
  export declare function toArray<T, R>(data: Opt<T>, cb: (item: T, index: number) => R): R[];
41
- export declare function toSet<T>(data: Opt<T>): Set<T>;
42
41
  export declare function mapToString<T>(data: Opt<T>, sep: string, cb: (item: T, index: number) => string): string;
43
42
  export declare function findSorted<T>(compare: Compare<T>, data: T[], item: T): T | undefined;
44
43
  export declare function findIndexSorted<T>(compare: Compare<T>, data: T[], item: T): number;
@@ -28,7 +28,6 @@ export interface KnownExprs {
28
28
  export declare function mapParamReasonToExpr(exprs: KnownExprs, reason: Opt<ParamBinding>): Opt<t.NodeExtra>;
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
- export declare function getKnownExprsAt(exprs: KnownExprs, binding: Binding): KnownExprs;
32
31
  export declare function applyReasonExprs(section: Section): void;
33
32
  export declare function mergeSlotReasons(section: Section): void;
34
33
  export declare function getNodeReasons(section: Section): Reasons | undefined;
@@ -145,6 +145,7 @@ export interface AssignedBindingExtra extends ReferencedExtra {
145
145
  /** The outermost function holding it; none when that escapes into a call. */
146
146
  fnRoot: ReferencedFunctionExtra | undefined;
147
147
  }
148
+ export declare function hasResumableWriter(source: Binding): boolean;
148
149
  export declare function hasResumableAssignment(binding: Binding): boolean;
149
150
  export declare function isAssignedBindingExtra(extra: t.NodeExtra | undefined): extra is AssignedBindingExtra;
150
151
  export interface RegisteredFnExtra extends ReferencedExtra, t.FunctionExtra {
@@ -114,7 +114,9 @@ export interface Section {
114
114
  kind: "for" | "await" | "try";
115
115
  tag: ControlFlowTagExtra;
116
116
  } | undefined;
117
- content: null | {
117
+ /** What renders at its edges, `null` for nothing; set once its body is
118
+ * analyzed (`settleContent`). */
119
+ content: undefined | null | {
118
120
  startType: ContentType;
119
121
  endType: ContentType;
120
122
  singleChild: boolean;
@@ -156,6 +158,7 @@ export declare function forEachSection(fn: (section: Section) => void): void;
156
158
  export declare function getDynamicTagContentClosures(section: Section): import("./optional").SortedOpt<Binding>;
157
159
  export declare function forEachAncestorSection<A>(from: Section, to: Section, fn: (section: Section, arg: A) => void, arg: A): void;
158
160
  export declare function forEachSectionReverse(fn: (section: Section) => void): void;
161
+ export declare function settleContent(body: t.NodePath<t.Program | t.MarkoTagBody>): void;
159
162
  export declare function getContentInfo(path: t.NodePath<t.Program | t.MarkoTagBody>): Section["content"];
160
163
  export declare function getNodeContentType(path: t.NodePath<t.Statement>, edge: "startType" | "endType"): ContentType.Value | null;
161
164
  export declare function isKnownChild(section: Section): boolean;
@@ -175,6 +178,7 @@ export declare function isSameOrAncestorSection(section: Section, other: Section
175
178
  export declare function getCommonSection(section: Section, other: Section): Section;
176
179
  export declare function ensureSectionReasonGroups(section: Section): void;
177
180
  export declare function getParamReasonGroupIndex(section: Section, group: ParamReasonGroup): number;
181
+ export declare function findParamReasonGroupIndex(section: Section, group: ParamReasonGroup): number;
178
182
  export declare function forEachParamGroup(params: Sources["param"], fn: (section: Section, group: ParamReasonGroup) => void): void;
179
183
  export declare function reduceParamGroups<R>(params: Sources["param"], fn: (acc: R, section: Section, group: ParamReasonGroup) => R, initial: R): R;
180
184
  export declare function setReadsOwner(from: Section, to: Section): void;
@@ -16,6 +16,8 @@ export interface TagFacts {
16
16
  /** Its insertion mode drops an unknown element but keeps its children, so a
17
17
  * wrapper around content inside it is discarded. */
18
18
  discardsWrapperChildren?: true;
19
+ /** Its `content` attribute is an html attribute, not content it renders. */
20
+ htmlContentAttr?: true;
19
21
  }
20
22
  export declare const controllableElements: Map<string, {
21
23
  attrs: string[];
@@ -1,10 +1,8 @@
1
1
  import { types as t } from "@marko/compiler";
2
- import { type Binding } from "./bindings";
3
2
  import { type AttrTagMeta, type AttrTagLookup } from "./nested-attribute-tags";
4
- import { type SortedOpt } from "./optional";
5
3
  import { type ParamsTree } from "./params-tree";
6
4
  type ContentKey = "renderBody" | "content";
7
- export declare function translateAttrs(tag: t.NodePath<t.MarkoTag>, paramsTree?: ParamsTree | true, skip?: SortedOpt<string>, statements?: t.Statement[], contentKey?: ContentKey): {
5
+ export declare function translateAttrs(tag: t.NodePath<t.MarkoTag>, paramsTree?: ParamsTree | true, statements?: t.Statement[], contentKey?: ContentKey): {
8
6
  properties: (t.ObjectMethod | t.ObjectProperty | t.SpreadElement)[];
9
7
  statements: t.Statement[];
10
8
  };
@@ -17,5 +15,4 @@ export declare function appendAttrTag(prev: t.Expression | undefined | false, pr
17
15
  /** Unwraps a lone spread to the spread argument itself, so the result may alias
18
16
  * a caller binding; anything the runtime writes to needs its own object. */
19
17
  export declare function propsToExpression(props: t.ObjectExpression["properties"]): t.Expression;
20
- export declare function getSingleKnownSpread(paramsTree: ParamsTree | true, attributes: (t.MarkoAttribute | t.MarkoSpreadAttribute)[]): Binding | undefined;
21
18
  export {};
@@ -18,8 +18,8 @@ declare module "@marko/compiler/dist/types" {
18
18
  /** The signal of each of the template's param bindings, a property of
19
19
  * one included. */
20
20
  params: Map<Binding, string>;
21
- /** The `_dynamic_tag_content` signal of each binding only a name-only
22
- * dynamic tag reads. */
21
+ /** The `_dynamic_tag_content` signal of each binding read only as the
22
+ * whole name of a name-only dynamic tag. */
23
23
  directContent: Map<Binding, string>;
24
24
  };
25
25
  styleFile?: string;
package/index.d.ts CHANGED
@@ -137,9 +137,7 @@ declare global {
137
137
  ? Name extends keyof NativeTags
138
138
  ? NativeTags[Name]["input"]
139
139
  : Record<string, unknown>
140
- : Name extends
141
- | Template<infer Input, any>
142
- | { _(): () => (input: infer Input) => any }
140
+ : Name extends Template<infer Input, any>
143
141
  ? Input
144
142
  : Name extends Body<infer Args, any>
145
143
  ? Args extends {
@@ -159,10 +157,7 @@ declare global {
159
157
  ? Name extends keyof NativeTags
160
158
  ? NativeTags[Name]["return"]
161
159
  : () => Element
162
- : Name extends
163
- | { _(): () => (input: any) => { return: infer Return } }
164
- | Template<any, infer Return>
165
- | Body<any, infer Return>
160
+ : Name extends Template<any, infer Return> | Body<any, infer Return>
166
161
  ? Return
167
162
  : never;
168
163
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.4.11",
3
+ "version": "6.4.13",
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.17",
54
+ "@marko/compiler": "^5.43.0",
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.11",
61
- "marko": "5.39.50"
60
+ "@marko/runtime-tags": "npm:marko@6.4.13",
61
+ "marko": "5.40.0"
62
62
  },
63
63
  "engines": {
64
64
  "node": ">=22.12.0"
@@ -1,6 +1,14 @@
1
- /** File for types only, not actual implementation **/
1
+ /* File for types only, not actual implementation */
2
2
 
3
+ /**
4
+ * Unwraps the promise in its `value=` and renders its content with the result,
5
+ * passed as a tag parameter. Inside a `<try>`, its `@placeholder` shows while
6
+ * the promise is pending and its `@catch` if it rejects.
7
+ *
8
+ * [Marko docs](https://markojs.com/docs/reference/core-tag#await)
9
+ */
3
10
  export interface Input<T> {
11
+ /** The promise to wait for. */
4
12
  value: T;
5
13
  content: Marko.Body<[Awaited<T>]>
6
14
  }
@@ -1,5 +1,11 @@
1
- /** File for types only, not actual implementation **/
1
+ /* File for types only, not actual implementation */
2
2
 
3
+ /**
4
+ * Exposes its `value=` through its tag variable, updated whenever what the
5
+ * value reads changes.
6
+ *
7
+ * [Marko docs](https://markojs.com/docs/reference/core-tag#const)
8
+ */
3
9
  export interface Input<T> {
4
10
  value: T;
5
11
  }
@@ -1,5 +1,11 @@
1
- /** File for types only, not actual implementation **/
1
+ /* File for types only, not actual implementation */
2
2
 
3
+ /**
4
+ * Runs a `debugger` statement once the tag renders.
5
+ *
6
+ * [Marko docs](https://markojs.com/docs/reference/core-tag#debug)
7
+ */
3
8
  export interface Input {
9
+ /** Runs the `debugger` statement again whenever it changes. */
4
10
  value?: any;
5
11
  }
@@ -1,5 +1,11 @@
1
- /** File for types only, not actual implementation **/
1
+ /* File for types only, not actual implementation */
2
2
 
3
+ /**
4
+ * Creates a reusable snippet: its tag variable holds the attributes it was
5
+ * given, including its content, and renders that content as a tag.
6
+ *
7
+ * [Marko docs](https://markojs.com/docs/reference/core-tag#define)
8
+ */
3
9
  export type Input<T> = T;
4
10
 
5
11
  return=input
@@ -1,5 +1,10 @@
1
- /** File for types only, not actual implementation **/
1
+ /* File for types only, not actual implementation */
2
2
 
3
+ /**
4
+ * @deprecated Replaced by `<script>`, which runs its body as code.
5
+ *
6
+ * [`<script>` docs](https://markojs.com/docs/reference/core-tag#script)
7
+ */
3
8
  export interface Input {
4
9
  value?(): void;
5
10
  }
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Outputs a literal `<!-- comment -->`, which a template's own comments are
3
+ * not. Its tag variable is a getter for the comment node.
4
+ *
5
+ * [Marko docs](https://markojs.com/docs/reference/core-tag#html-comment)
6
+ */
1
7
  export interface Input {}
2
8
 
3
9
  return=(null! as () => Comment)
@@ -1,3 +1,8 @@
1
+ /**
2
+ * A native `<script>` element, without the handling Marko gives `<script>`.
3
+ *
4
+ * [Marko docs](https://markojs.com/docs/reference/core-tag#html-script--html-style)
5
+ */
1
6
  export interface Input extends Marko.HTML.Script {}
2
7
 
3
8
  return=(null! as () => HTMLScriptElement)
@@ -1,3 +1,8 @@
1
+ /**
2
+ * A native `<style>` element, without the handling Marko gives `<style>`.
3
+ *
4
+ * [Marko docs](https://markojs.com/docs/reference/core-tag#html-script--html-style)
5
+ */
1
6
  export interface Input extends Marko.HTML.Style {}
2
7
 
3
8
  return=(null! as () => HTMLStyleElement)
package/tags/id.d.marko CHANGED
@@ -1,6 +1,16 @@
1
- /** File for types only, not actual implementation **/
1
+ /* File for types only, not actual implementation */
2
2
 
3
+ /**
4
+ * Exposes a short unique id string through its tag variable, for `id=` and
5
+ * aria attributes.
6
+ *
7
+ * [Marko docs](https://markojs.com/docs/reference/core-tag#id)
8
+ */
3
9
  export interface Input {
10
+ /**
11
+ * Used instead of the generated id when it is a non-empty string; `null`,
12
+ * `false` and `""` fall back to the generated one.
13
+ */
4
14
  value?: string | null | false;
5
15
  }
6
16
 
package/tags/let.d.marko CHANGED
@@ -1,5 +1,12 @@
1
- /** File for types only, not actual implementation **/
1
+ /* File for types only, not actual implementation */
2
2
 
3
+ /**
4
+ * Introduces mutable state through its tag variable, starting from its
5
+ * `value=`. Updating the variable re-runs everything that reads it, and a
6
+ * `valueChange=` makes the state controllable.
7
+ *
8
+ * [Marko docs](https://markojs.com/docs/reference/core-tag#let)
9
+ */
3
10
  export type Input<T = undefined, K = T> =
4
11
  | { value: T; valueChange?: ((newValue: K) => void) | false | null }
5
12
  | { value?: undefined; valueChange?: ((newValue: K) => void) | false | null };
@@ -1,12 +1,22 @@
1
- /** File for types only, not actual implementation **/
1
+ /* File for types only, not actual implementation */
2
2
 
3
3
  /* `R` is inferred from what `onMount` returns, so a return value read from `this`
4
4
  is circular; such a tag passes its type explicitly (`<lifecycle<{ … }>>`). */
5
+ /**
6
+ * Synchronizes side effects from imperative client APIs. Its attributes are
7
+ * assigned onto `this` before each call, and what `onMount` returns is merged
8
+ * onto it.
9
+ *
10
+ * [Marko docs](https://markojs.com/docs/reference/core-tag#lifecycle)
11
+ */
5
12
  export type Input<
6
13
  T extends object,
7
14
  R extends object = {},
8
15
  > = T & ThisType<T & R> & {
16
+ /** Called once this tag is attached to the DOM, and never again. */
9
17
  onMount?: () => R | void;
18
+ /** Called every time a value read by any of this tag's attributes changes. */
10
19
  onUpdate?: () => void;
20
+ /** Called once this tag is removed from the DOM. */
11
21
  onDestroy?: () => void;
12
22
  };
package/tags/log.d.marko CHANGED
@@ -1,5 +1,11 @@
1
- /** File for types only, not actual implementation **/
1
+ /* File for types only, not actual implementation */
2
2
 
3
+ /**
4
+ * Logs its `value=` with `console.log`, on the server and in the browser, and
5
+ * again whenever it changes.
6
+ *
7
+ * [Marko docs](https://markojs.com/docs/reference/core-tag#log)
8
+ */
3
9
  export interface Input {
4
10
  value: any;
5
11
  }
@@ -1,5 +1,13 @@
1
- /** File for types only, not actual implementation **/
1
+ /* File for types only, not actual implementation */
2
2
 
3
+ /**
4
+ * Runs its body as code once the template is mounted in the browser, and again
5
+ * whenever a tag variable or parameter it reads changes. For a native
6
+ * `<script>` element, use `<html-script>`.
7
+ *
8
+ * [Marko docs](https://markojs.com/docs/reference/core-tag#script)
9
+ */
3
10
  export interface Input {
11
+ /** Run instead of a body, under the same conditions. */
4
12
  value?(): unknown;
5
13
  }
package/tags/show.d.marko CHANGED
@@ -1,5 +1,11 @@
1
- /** File for types only, not actual implementation **/
1
+ /* File for types only, not actual implementation */
2
2
 
3
+ /**
4
+ * Displays its content only while its `value=` is truthy. Unlike `<if>`, the
5
+ * content stays rendered and mounted, so its state persists across toggles.
6
+ *
7
+ * [Marko docs](https://markojs.com/docs/reference/core-tag#show)
8
+ */
3
9
  export interface Input {
4
10
  value: unknown;
5
11
  content: Marko.Body;
package/tags/try.d.marko CHANGED
@@ -1,9 +1,17 @@
1
- /** File for types only, not actual implementation **/
1
+ /* File for types only, not actual implementation */
2
2
 
3
+ /**
4
+ * Catches errors thrown while rendering its content, and shows a placeholder
5
+ * while an `<await>` in it is pending.
6
+ *
7
+ * [Marko docs](https://markojs.com/docs/reference/core-tag#try)
8
+ */
3
9
  export interface Input {
4
10
  content: Marko.Body,
11
+ /** Displayed while an `<await>` in the content is pending. */
5
12
  placeholder?: Marko.AttrTag<{ content?: Marko.Body }>,
6
13
  // `any` keeps the documented `${err.message}` working; annotating the
7
14
  // parameter as `|err: unknown|` opts a catch into narrowing.
15
+ /** Replaces the content when it throws, with the error as its tag parameter. */
8
16
  catch?: Marko.AttrTag<{ content?: Marko.Body<[any]> }>,
9
17
  }