marko 6.4.1 → 6.4.3

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 (80) hide show
  1. package/cheatsheet.md +1 -1
  2. package/dist/common/constants/accessor-prop.d.ts +1 -0
  3. package/dist/common/constants/accessor-prop.debug.d.ts +1 -0
  4. package/dist/common/errors.d.ts +1 -0
  5. package/dist/common/opt.d.ts +1 -0
  6. package/dist/common/types.d.ts +1 -0
  7. package/dist/debug/dom/catch.feat.js +1 -1
  8. package/dist/debug/dom/catch.feat.mjs +1 -1
  9. package/dist/debug/dom/controllable-input.feat.js +1 -1
  10. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  11. package/dist/debug/dom/controllable-open.feat.js +1 -1
  12. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  13. package/dist/debug/dom/controllable-select.feat.js +1 -1
  14. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  15. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  16. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  17. package/dist/debug/dom/controllable.feat.js +1 -1
  18. package/dist/debug/dom/controllable.feat.mjs +1 -1
  19. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  20. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  21. package/dist/debug/dom/dynamic-tag-var.feat.js +6 -2
  22. package/dist/debug/dom/dynamic-tag-var.feat.mjs +6 -2
  23. package/dist/debug/dom/lazy.feat.js +1 -1
  24. package/dist/debug/dom/lazy.feat.mjs +1 -1
  25. package/dist/debug/dom/placeholder.feat.js +1 -1
  26. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  27. package/dist/debug/{dom-ClV4kVOO.js → dom-C7F3yZTh.js} +119 -24
  28. package/dist/debug/{dom-LFrKxOk5.mjs → dom-uEY0J_H9.mjs} +78 -25
  29. package/dist/debug/dom.js +16 -4
  30. package/dist/debug/dom.mjs +14 -5
  31. package/dist/debug/html.js +288 -78
  32. package/dist/debug/html.mjs +288 -79
  33. package/dist/dom/catch.feat.js +4 -4
  34. package/dist/dom/catch.feat.mjs +1 -1
  35. package/dist/dom/control-flow.d.ts +2 -2
  36. package/dist/dom/controllable-input.feat.js +2 -2
  37. package/dist/dom/controllable-input.feat.mjs +1 -1
  38. package/dist/dom/controllable-open.feat.js +2 -2
  39. package/dist/dom/controllable-open.feat.mjs +1 -1
  40. package/dist/dom/controllable-select.feat.js +2 -2
  41. package/dist/dom/controllable-select.feat.mjs +1 -1
  42. package/dist/dom/controllable-textarea.feat.js +2 -2
  43. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  44. package/dist/dom/controllable.feat.js +2 -2
  45. package/dist/dom/controllable.feat.mjs +1 -1
  46. package/dist/dom/dom.d.ts +1 -0
  47. package/dist/dom/dynamic-tag-script.feat.js +2 -2
  48. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  49. package/dist/dom/dynamic-tag-var.feat.js +4 -2
  50. package/dist/dom/dynamic-tag-var.feat.mjs +4 -3
  51. package/dist/dom/lazy.feat.js +1 -1
  52. package/dist/dom/lazy.feat.mjs +1 -1
  53. package/dist/dom/load.d.ts +1 -0
  54. package/dist/dom/placeholder.feat.js +3 -3
  55. package/dist/dom/placeholder.feat.mjs +1 -1
  56. package/dist/dom/queue.d.ts +4 -1
  57. package/dist/{dom-CNglVi8P.js → dom-CtIT8Mpr.js} +201 -138
  58. package/dist/{dom-DfP3MCo0.mjs → dom-DHg9YChM.mjs} +60 -27
  59. package/dist/dom.d.ts +3 -3
  60. package/dist/dom.js +41 -34
  61. package/dist/dom.mjs +12 -5
  62. package/dist/html/assets.d.ts +12 -6
  63. package/dist/html/attrs.d.ts +1 -0
  64. package/dist/html/compat.d.ts +10 -2
  65. package/dist/html/serializer.d.ts +1 -0
  66. package/dist/html/writer.d.ts +8 -0
  67. package/dist/html.d.ts +1 -1
  68. package/dist/html.js +207 -62
  69. package/dist/html.mjs +207 -62
  70. package/dist/translator/index.js +432 -213
  71. package/dist/translator/util/bindings.d.ts +9 -1
  72. package/dist/translator/util/constants/structure-kind.d.ts +1 -0
  73. package/dist/translator/util/known-tag.d.ts +2 -1
  74. package/dist/translator/util/module-read.d.ts +21 -0
  75. package/dist/translator/util/references.d.ts +1 -0
  76. package/dist/translator/util/runtime.d.ts +2 -0
  77. package/dist/translator/util/sections.d.ts +5 -1
  78. package/dist/translator/util/structure.d.ts +1 -0
  79. package/package.json +3 -3
  80. package/tags-html.d.ts +6 -5
@@ -39,12 +39,17 @@ export interface Binding {
39
39
  property: string | undefined;
40
40
  propertyAliases: Map<string, Binding>;
41
41
  excludeProperties: SortedOpt<string>;
42
+ /** Its properties code assigns in place (`obj.x = 1`), all of them for a
43
+ * computed one. */
44
+ assignedProperties: SortedOpt<string> | true;
42
45
  aliasOf: Binding | undefined;
43
46
  /** The value these `<for>` params iterate, by `of` or `in`. */
44
47
  iterates: {
45
48
  expr: t.NodeExtra;
46
49
  type: "of" | "in";
47
50
  } | undefined;
51
+ /** For an array rest, the source index it starts at: `rest[0]` of
52
+ * `[a, ...rest]` is the source's `[1]`. */
48
53
  restOffset: number | undefined;
49
54
  /** For a tag variable a child's `<return>` writes, the node binding of the
50
55
  * tag rendering that child. */
@@ -95,9 +100,11 @@ export interface Getter {
95
100
  invoked: boolean;
96
101
  }
97
102
  export declare const getBindings: () => Set<Binding>;
98
- export declare function createBinding(name: string, type: Binding["type"], refSection: Section, aliased?: Binding["aliasOf"], property?: string, excludeProperties?: SortedOpt<string>, loc?: t.SourceLocation | null, refDeclared?: boolean): Binding;
103
+ export declare function createBinding(name: string, type: Binding["type"], refSection: Section, aliased?: Binding["aliasOf"], property?: string, excludeProperties?: SortedOpt<string>, loc?: t.SourceLocation | null, refDeclared?: boolean, restOffset?: number): Binding;
99
104
  export declare function reserveId(binding: Binding, offset: ReservedId): void;
100
105
  export declare function getOrCreatePropertyAlias(binding: Binding, property: string): Binding;
106
+ export declare function addAssignedProperty(binding: Binding, property: string | undefined): void;
107
+ export declare function getAssignedObject(binding: Binding): Binding | undefined;
101
108
  export declare function getPropertyAlias(binding: Binding | undefined, properties: Opt<string>): Binding | undefined;
102
109
  export declare function compareReferences(a: ReferencedBindings, b: ReferencedBindings): number;
103
110
  /**
@@ -113,6 +120,7 @@ export declare function someAlias<A>(binding: Binding, test: (binding: Binding,
113
120
  export declare function someAliased<A>(binding: Binding | undefined, test: (binding: Binding, arg: A) => boolean, arg: A): boolean;
114
121
  export declare function getNearestDeclared(binding: Binding): Binding | undefined;
115
122
  export declare function isDirectAlias(binding: Binding): boolean;
123
+ export declare function isRest(binding: Binding): boolean;
116
124
  export declare function getDebugScopeAccess(binding: Binding): {
117
125
  root: Binding;
118
126
  access: string;
@@ -1,6 +1,7 @@
1
1
  export declare const Node = "node";
2
2
  export declare const Text = "text";
3
3
  export declare const Child = "child";
4
+ export declare const ModuleRead = "moduleRead";
4
5
  export declare const SectionRef = "sectionRef";
5
6
  export declare const ExportRef = "exportRef";
6
7
  type Self = typeof import("./structure-kind");
@@ -14,7 +14,8 @@ declare module "@marko/compiler/dist/types" {
14
14
  [kKnownExprs]?: KnownExprs;
15
15
  }
16
16
  }
17
- export declare function knownTagAnalyze(tag: t.NodePath<t.MarkoTag>, contentSection: Section, propTree: BindingPropTree | undefined): void;
17
+ export declare function knownTagAnalyze(tag: t.NodePath<t.MarkoTag>, contentSection: Section, childParamsTree?: BindingPropTree): void;
18
+ export declare function analyzeRecursiveTags(): void;
18
19
  export declare function knownTagTranslateHTML(tag: t.NodePath<t.MarkoTag>, tagIdentifier: t.Expression): void;
19
20
  export declare function knownTagTranslateDOM(tag: t.NodePath<t.MarkoTag>, getBindingIdentifier: (binding: Binding, preferredName?: string, directContent?: boolean) => t.Identifier, callSetup: ((section: Section, childBinding: Binding) => void) | undefined): void;
20
21
  export declare function finalizeKnownTags(section: Section): void;
@@ -0,0 +1,21 @@
1
+ import { types as t } from "@marko/compiler";
2
+ declare const kModuleRead: unique symbol;
3
+ declare module "@marko/compiler/dist/types" {
4
+ interface NodeExtra {
5
+ [kModuleRead]?: ModuleRead | null;
6
+ }
7
+ }
8
+ /** A read of an import binding (`styles.box`), set once its module loads. */
9
+ export interface ModuleRead {
10
+ /** The binding's name, then the member names read from it. */
11
+ read: string[];
12
+ /** The import's source; none for a `<style/name>` tag's own stylesheet module. */
13
+ request: string | undefined;
14
+ }
15
+ /** The module read an expression is, resolved on first use: translate replaces
16
+ * a `<style/name>` tag. */
17
+ export declare function getModuleRead(path: t.NodePath, expr: t.Expression): ModuleRead | undefined;
18
+ /** A module read of a stylesheet module, whose reads are class name strings. */
19
+ export declare function getStyleImportRead(path: t.NodePath, expr: t.Expression): string[] | undefined;
20
+ export declare function toModuleReadExpression([name, ...members]: string[]): t.Identifier | t.MemberExpression;
21
+ export {};
@@ -106,6 +106,7 @@ export declare function trackVarReferences(tag: t.NodePath<t.MarkoTag>, type: Bi
106
106
  export declare function trackParamsReferences(body: t.NodePath<t.MarkoTagBody | t.Program>, type: BindingType): Binding | undefined;
107
107
  export declare function isReferenceInOwnBody(bindingPath: t.NodePath, reference: t.NodePath): boolean;
108
108
  export declare function isReferenceHoisted(bindingPath: t.NodePath, reference: t.NodePath): boolean;
109
+ export declare function assertReferencedInRender(ref: t.NodePath, name: string, markoRoot?: import("./get-root").MarkoExprRootPath | null): void;
109
110
  export declare function setReferencesScope(path: t.NodePath<any>): void;
110
111
  export declare function trackGlobalReference(path: t.NodePath<t.Identifier>): void;
111
112
  export declare function mergeReferences<T extends t.Node>(section: Section, target: T, nodes: (t.Node | undefined)[]): NonNullable<T["extra"]> & ReferencedExtra;
@@ -1,6 +1,7 @@
1
1
  import { types as t } from "@marko/compiler";
2
2
  import type { Falsy } from "../../common/types";
3
3
  import { _attr, _attr_class, _attr_style, _escape, _escape_script, _escape_style, _unescaped } from "../../html";
4
+ import { escapeDoubleQuotedAttrValue } from "../../html/attrs";
4
5
  export type DOMRuntimeHelpers = keyof typeof import("../../dom");
5
6
  export type HTMLRuntimeHelpers = keyof typeof import("../../html");
6
7
  export declare function importRuntime(name: DOMRuntimeHelpers | HTMLRuntimeHelpers): t.Identifier;
@@ -19,6 +20,7 @@ export declare function getHTMLRuntime(): {
19
20
  _attr_style: typeof _attr_style;
20
21
  _escape_script: typeof _escape_script;
21
22
  _escape_style: typeof _escape_style;
23
+ escapeDoubleQuotedAttrValue: typeof escapeDoubleQuotedAttrValue;
22
24
  };
23
25
  export declare function getRuntimePath(output: string): string;
24
26
  export declare function getCompatRuntimeFile(): string;
@@ -23,7 +23,7 @@ export interface StructureExportRef {
23
23
  path: string;
24
24
  hint: string;
25
25
  }
26
- export type StructureOp = string | Step.Value | StructureText | StructureNode | StructureChild;
26
+ export type StructureOp = string | Step.Value | StructureText | StructureNode | StructureChild | StructureModuleRead;
27
27
  export interface StructureText {
28
28
  kind: typeof StructureKind.Text;
29
29
  value: string;
@@ -39,6 +39,10 @@ export interface StructureChild {
39
39
  binding: Binding;
40
40
  renderer?: StructureRef;
41
41
  }
42
+ export interface StructureModuleRead {
43
+ kind: typeof StructureKind.ModuleRead;
44
+ read: string[];
45
+ }
42
46
  export interface Section {
43
47
  id: number;
44
48
  name: string;
@@ -7,6 +7,7 @@ export declare function exit(path: t.NodePath<any>): void;
7
7
  export declare function enterShallow(path: t.NodePath<any>): void;
8
8
  export declare function child(tag: t.NodePath<t.MarkoTag>, name: string, renderer?: StructureRef): void;
9
9
  export declare function writeTo(path: t.NodePath<any>): (strs: TemplateStringsArray, ...exprs: string[]) => void;
10
+ export declare function writeModuleReadTo(path: t.NodePath<any>, read: string[]): void;
10
11
  export declare function writeTextTo(path: t.NodePath<any>, value: string): void;
11
12
  export declare function node(path: t.NodePath<t.MarkoTag | t.MarkoPlaceholder>, binding?: Binding): StructureNode | undefined;
12
13
  export declare function marker(path: t.NodePath<t.MarkoTag | t.MarkoPlaceholder>, binding: Binding): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.4.1",
3
+ "version": "6.4.3",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",
@@ -57,8 +57,8 @@
57
57
  "magic-string": "^0.30.21"
58
58
  },
59
59
  "devDependencies": {
60
- "@marko/runtime-tags": "npm:marko@6.4.1",
61
- "marko": "5.39.44"
60
+ "@marko/runtime-tags": "npm:marko@6.4.3",
61
+ "marko": "5.39.45"
62
62
  },
63
63
  "engines": {
64
64
  "node": ">=22"
package/tags-html.d.ts CHANGED
@@ -2225,11 +2225,6 @@ declare global {
2225
2225
  */
2226
2226
  autocomplete?: AttrAutoComplete;
2227
2227
 
2228
- /**
2229
- * (Safari only). Controls the autocorrect behavior of the <textarea> element.
2230
- */
2231
- autocorrect?: AttrOnOff;
2232
-
2233
2228
  /**
2234
2229
  * Specifies the visible width of the <textarea> element in terms of character width.
2235
2230
  * @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-textarea-cols
@@ -4208,6 +4203,12 @@ declare global {
4208
4203
  | "sentences"
4209
4204
  | "words";
4210
4205
 
4206
+ /**
4207
+ * Controls whether user agents may autocorrect spelling while the user types.
4208
+ * @see https://html.spec.whatwg.org/multipage/interaction.html#attr-autocorrect
4209
+ */
4210
+ autocorrect?: AttrOnOff;
4211
+
4211
4212
  /**
4212
4213
  * Indicates whether the element should automatically get focus when the page loads.
4213
4214
  * @see https://html.spec.whatwg.org/multipage/interaction.html#the-autofocus-attribute