marko 6.0.66 → 6.0.67
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/dist/common/for.d.ts +1 -0
- package/dist/debug/dom.js +16 -0
- package/dist/debug/dom.mjs +16 -0
- package/dist/debug/html.js +57 -4
- package/dist/debug/html.mjs +54 -3
- package/dist/dom/control-flow.d.ts +1 -0
- package/dist/dom.d.ts +2 -2
- package/dist/dom.js +14 -0
- package/dist/dom.mjs +14 -0
- package/dist/html/for.d.ts +2 -2
- package/dist/html/writer.d.ts +1 -0
- package/dist/html.d.ts +2 -2
- package/dist/html.js +39 -4
- package/dist/html.mjs +36 -3
- package/dist/translator/core/for.d.ts +7 -1
- package/dist/translator/core/index.d.ts +6 -0
- package/dist/translator/index.d.ts +6 -0
- package/dist/translator/index.js +30 -1
- package/package.json +2 -2
package/dist/common/for.d.ts
CHANGED
@@ -2,3 +2,4 @@ import type { Falsy } from "./types";
|
|
2
2
|
export declare function forIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void): void;
|
3
3
|
export declare function forOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void): void;
|
4
4
|
export declare function forTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void): void;
|
5
|
+
export declare function forUntil(until: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void): void;
|
package/dist/debug/dom.js
CHANGED
@@ -64,6 +64,7 @@ __export(dom_exports, {
|
|
64
64
|
_for_in: () => _for_in,
|
65
65
|
_for_of: () => _for_of,
|
66
66
|
_for_to: () => _for_to,
|
67
|
+
_for_until: () => _for_until,
|
67
68
|
_hoist: () => _hoist,
|
68
69
|
_html: () => _html,
|
69
70
|
_id: () => _id,
|
@@ -90,6 +91,7 @@ __export(dom_exports, {
|
|
90
91
|
forIn: () => forIn,
|
91
92
|
forOf: () => forOf,
|
92
93
|
forTo: () => forTo,
|
94
|
+
forUntil: () => forUntil,
|
93
95
|
init: () => init,
|
94
96
|
run: () => run
|
95
97
|
});
|
@@ -140,6 +142,13 @@ function forTo(to, from, step, cb) {
|
|
140
142
|
cb(start + i * delta);
|
141
143
|
}
|
142
144
|
}
|
145
|
+
function forUntil(until, from, step, cb) {
|
146
|
+
const start = from || 0;
|
147
|
+
const delta = step || 1;
|
148
|
+
for (let steps = (until - start) / delta, i = 0; i < steps; i++) {
|
149
|
+
cb(start + i * delta);
|
150
|
+
}
|
151
|
+
}
|
143
152
|
|
144
153
|
// src/common/helpers.ts
|
145
154
|
function classValue(classValue2) {
|
@@ -1945,6 +1954,13 @@ function _for_to(nodeAccessor, renderer) {
|
|
1945
1954
|
([to, from, step, by = byFirstArg], cb) => forTo(to, from, step, (v) => cb(by(v), [v]))
|
1946
1955
|
);
|
1947
1956
|
}
|
1957
|
+
function _for_until(nodeAccessor, renderer) {
|
1958
|
+
return loop(
|
1959
|
+
nodeAccessor,
|
1960
|
+
renderer,
|
1961
|
+
([until, from, step, by = byFirstArg], cb) => forUntil(until, from, step, (v) => cb(by(v), [v]))
|
1962
|
+
);
|
1963
|
+
}
|
1948
1964
|
function loop(nodeAccessor, renderer, forEach) {
|
1949
1965
|
const params = renderer.___params;
|
1950
1966
|
enableBranches();
|
package/dist/debug/dom.mjs
CHANGED
@@ -43,6 +43,13 @@ function forTo(to, from, step, cb) {
|
|
43
43
|
cb(start + i * delta);
|
44
44
|
}
|
45
45
|
}
|
46
|
+
function forUntil(until, from, step, cb) {
|
47
|
+
const start = from || 0;
|
48
|
+
const delta = step || 1;
|
49
|
+
for (let steps = (until - start) / delta, i = 0; i < steps; i++) {
|
50
|
+
cb(start + i * delta);
|
51
|
+
}
|
52
|
+
}
|
46
53
|
|
47
54
|
// src/common/helpers.ts
|
48
55
|
function classValue(classValue2) {
|
@@ -1848,6 +1855,13 @@ function _for_to(nodeAccessor, renderer) {
|
|
1848
1855
|
([to, from, step, by = byFirstArg], cb) => forTo(to, from, step, (v) => cb(by(v), [v]))
|
1849
1856
|
);
|
1850
1857
|
}
|
1858
|
+
function _for_until(nodeAccessor, renderer) {
|
1859
|
+
return loop(
|
1860
|
+
nodeAccessor,
|
1861
|
+
renderer,
|
1862
|
+
([until, from, step, by = byFirstArg], cb) => forUntil(until, from, step, (v) => cb(by(v), [v]))
|
1863
|
+
);
|
1864
|
+
}
|
1851
1865
|
function loop(nodeAccessor, renderer, forEach) {
|
1852
1866
|
const params = renderer.___params;
|
1853
1867
|
enableBranches();
|
@@ -2315,6 +2329,7 @@ export {
|
|
2315
2329
|
_for_in,
|
2316
2330
|
_for_of,
|
2317
2331
|
_for_to,
|
2332
|
+
_for_until,
|
2318
2333
|
_hoist,
|
2319
2334
|
_html,
|
2320
2335
|
_id,
|
@@ -2341,6 +2356,7 @@ export {
|
|
2341
2356
|
forIn,
|
2342
2357
|
forOf,
|
2343
2358
|
forTo,
|
2359
|
+
forUntil,
|
2344
2360
|
init,
|
2345
2361
|
run
|
2346
2362
|
};
|
package/dist/debug/html.js
CHANGED
@@ -50,6 +50,7 @@ __export(html_exports, {
|
|
50
50
|
_for_in: () => _for_in,
|
51
51
|
_for_of: () => _for_of,
|
52
52
|
_for_to: () => _for_to,
|
53
|
+
_for_until: () => _for_until,
|
53
54
|
_hoist: () => _hoist,
|
54
55
|
_html: () => _html,
|
55
56
|
_id: () => _id,
|
@@ -77,8 +78,9 @@ __export(html_exports, {
|
|
77
78
|
forInBy: () => forInBy,
|
78
79
|
forOf: () => forOf,
|
79
80
|
forOfBy: () => forOfBy,
|
81
|
+
forStepBy: () => forStepBy,
|
80
82
|
forTo: () => forTo,
|
81
|
-
|
83
|
+
forUntil: () => forUntil
|
82
84
|
});
|
83
85
|
module.exports = __toCommonJS(html_exports);
|
84
86
|
|
@@ -204,6 +206,13 @@ function forTo(to, from, step, cb) {
|
|
204
206
|
cb(start + i * delta);
|
205
207
|
}
|
206
208
|
}
|
209
|
+
function forUntil(until, from, step, cb) {
|
210
|
+
const start = from || 0;
|
211
|
+
const delta = step || 1;
|
212
|
+
for (let steps = (until - start) / delta, i = 0; i < steps; i++) {
|
213
|
+
cb(start + i * delta);
|
214
|
+
}
|
215
|
+
}
|
207
216
|
|
208
217
|
// src/html/for.ts
|
209
218
|
function forOfBy(by, item, index) {
|
@@ -221,7 +230,7 @@ function forInBy(by, name, value) {
|
|
221
230
|
}
|
222
231
|
return name;
|
223
232
|
}
|
224
|
-
function
|
233
|
+
function forStepBy(by, index) {
|
225
234
|
if (by) {
|
226
235
|
return by(index);
|
227
236
|
}
|
@@ -1932,7 +1941,7 @@ function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, ser
|
|
1932
1941
|
}
|
1933
1942
|
withBranchId(branchId, () => {
|
1934
1943
|
cb(i);
|
1935
|
-
loopScopes.set(
|
1944
|
+
loopScopes.set(forStepBy(by, i), writeScope(branchId, {}));
|
1936
1945
|
});
|
1937
1946
|
});
|
1938
1947
|
if (loopScopes.size) {
|
@@ -1953,6 +1962,48 @@ function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, ser
|
|
1953
1962
|
singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : ""
|
1954
1963
|
);
|
1955
1964
|
}
|
1965
|
+
function _for_until(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1966
|
+
const { state } = $chunk.boundary;
|
1967
|
+
const resumeBranch = serializeBranch !== 0;
|
1968
|
+
const resumeMarker = serializeMarker !== 0;
|
1969
|
+
let flushBranchIds = "";
|
1970
|
+
if (resumeBranch) {
|
1971
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1972
|
+
forUntil(to, from, step, (i) => {
|
1973
|
+
const branchId = _peek_scope_id();
|
1974
|
+
if (resumeMarker) {
|
1975
|
+
if (singleNode) {
|
1976
|
+
flushBranchIds = " " + branchId + flushBranchIds;
|
1977
|
+
} else {
|
1978
|
+
$chunk.writeHTML(
|
1979
|
+
state.mark("[" /* BranchStart */, flushBranchIds)
|
1980
|
+
);
|
1981
|
+
flushBranchIds = branchId + "";
|
1982
|
+
}
|
1983
|
+
}
|
1984
|
+
withBranchId(branchId, () => {
|
1985
|
+
cb(i);
|
1986
|
+
loopScopes.set(forStepBy(by, i), writeScope(branchId, {}));
|
1987
|
+
});
|
1988
|
+
});
|
1989
|
+
if (loopScopes.size) {
|
1990
|
+
writeScope(scopeId, {
|
1991
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1992
|
+
});
|
1993
|
+
}
|
1994
|
+
} else {
|
1995
|
+
forUntil(to, from, step, cb);
|
1996
|
+
}
|
1997
|
+
writeBranchEnd(
|
1998
|
+
scopeId,
|
1999
|
+
accessor,
|
2000
|
+
resumeBranch,
|
2001
|
+
resumeMarker,
|
2002
|
+
parentEndTag,
|
2003
|
+
singleNode,
|
2004
|
+
singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : ""
|
2005
|
+
);
|
2006
|
+
}
|
1956
2007
|
function _if(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1957
2008
|
const { state } = $chunk.boundary;
|
1958
2009
|
const resumeBranch = serializeBranch !== 0;
|
@@ -3412,6 +3463,7 @@ function NOOP3() {
|
|
3412
3463
|
_for_in,
|
3413
3464
|
_for_of,
|
3414
3465
|
_for_to,
|
3466
|
+
_for_until,
|
3415
3467
|
_hoist,
|
3416
3468
|
_html,
|
3417
3469
|
_id,
|
@@ -3439,6 +3491,7 @@ function NOOP3() {
|
|
3439
3491
|
forInBy,
|
3440
3492
|
forOf,
|
3441
3493
|
forOfBy,
|
3494
|
+
forStepBy,
|
3442
3495
|
forTo,
|
3443
|
-
|
3496
|
+
forUntil
|
3444
3497
|
});
|
package/dist/debug/html.mjs
CHANGED
@@ -120,6 +120,13 @@ function forTo(to, from, step, cb) {
|
|
120
120
|
cb(start + i * delta);
|
121
121
|
}
|
122
122
|
}
|
123
|
+
function forUntil(until, from, step, cb) {
|
124
|
+
const start = from || 0;
|
125
|
+
const delta = step || 1;
|
126
|
+
for (let steps = (until - start) / delta, i = 0; i < steps; i++) {
|
127
|
+
cb(start + i * delta);
|
128
|
+
}
|
129
|
+
}
|
123
130
|
|
124
131
|
// src/html/for.ts
|
125
132
|
function forOfBy(by, item, index) {
|
@@ -137,7 +144,7 @@ function forInBy(by, name, value) {
|
|
137
144
|
}
|
138
145
|
return name;
|
139
146
|
}
|
140
|
-
function
|
147
|
+
function forStepBy(by, index) {
|
141
148
|
if (by) {
|
142
149
|
return by(index);
|
143
150
|
}
|
@@ -1848,7 +1855,7 @@ function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, ser
|
|
1848
1855
|
}
|
1849
1856
|
withBranchId(branchId, () => {
|
1850
1857
|
cb(i);
|
1851
|
-
loopScopes.set(
|
1858
|
+
loopScopes.set(forStepBy(by, i), writeScope(branchId, {}));
|
1852
1859
|
});
|
1853
1860
|
});
|
1854
1861
|
if (loopScopes.size) {
|
@@ -1869,6 +1876,48 @@ function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, ser
|
|
1869
1876
|
singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : ""
|
1870
1877
|
);
|
1871
1878
|
}
|
1879
|
+
function _for_until(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1880
|
+
const { state } = $chunk.boundary;
|
1881
|
+
const resumeBranch = serializeBranch !== 0;
|
1882
|
+
const resumeMarker = serializeMarker !== 0;
|
1883
|
+
let flushBranchIds = "";
|
1884
|
+
if (resumeBranch) {
|
1885
|
+
const loopScopes = /* @__PURE__ */ new Map();
|
1886
|
+
forUntil(to, from, step, (i) => {
|
1887
|
+
const branchId = _peek_scope_id();
|
1888
|
+
if (resumeMarker) {
|
1889
|
+
if (singleNode) {
|
1890
|
+
flushBranchIds = " " + branchId + flushBranchIds;
|
1891
|
+
} else {
|
1892
|
+
$chunk.writeHTML(
|
1893
|
+
state.mark("[" /* BranchStart */, flushBranchIds)
|
1894
|
+
);
|
1895
|
+
flushBranchIds = branchId + "";
|
1896
|
+
}
|
1897
|
+
}
|
1898
|
+
withBranchId(branchId, () => {
|
1899
|
+
cb(i);
|
1900
|
+
loopScopes.set(forStepBy(by, i), writeScope(branchId, {}));
|
1901
|
+
});
|
1902
|
+
});
|
1903
|
+
if (loopScopes.size) {
|
1904
|
+
writeScope(scopeId, {
|
1905
|
+
["LoopScopeMap:" /* LoopScopeMap */ + accessor]: loopScopes
|
1906
|
+
});
|
1907
|
+
}
|
1908
|
+
} else {
|
1909
|
+
forUntil(to, from, step, cb);
|
1910
|
+
}
|
1911
|
+
writeBranchEnd(
|
1912
|
+
scopeId,
|
1913
|
+
accessor,
|
1914
|
+
resumeBranch,
|
1915
|
+
resumeMarker,
|
1916
|
+
parentEndTag,
|
1917
|
+
singleNode,
|
1918
|
+
singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : ""
|
1919
|
+
);
|
1920
|
+
}
|
1872
1921
|
function _if(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1873
1922
|
const { state } = $chunk.boundary;
|
1874
1923
|
const resumeBranch = serializeBranch !== 0;
|
@@ -3327,6 +3376,7 @@ export {
|
|
3327
3376
|
_for_in,
|
3328
3377
|
_for_of,
|
3329
3378
|
_for_to,
|
3379
|
+
_for_until,
|
3330
3380
|
_hoist,
|
3331
3381
|
_html,
|
3332
3382
|
_id,
|
@@ -3354,6 +3404,7 @@ export {
|
|
3354
3404
|
forInBy,
|
3355
3405
|
forOf,
|
3356
3406
|
forOfBy,
|
3407
|
+
forStepBy,
|
3357
3408
|
forTo,
|
3358
|
-
|
3409
|
+
forUntil
|
3359
3410
|
};
|
@@ -14,3 +14,4 @@ export declare function setConditionalRenderer<T>(scope: Scope, nodeAccessor: Ac
|
|
14
14
|
export declare function _for_of(nodeAccessor: Accessor, renderer: Renderer): (scope: Scope, value: [all: unknown[], by?: ((item: unknown, index: number) => unknown) | undefined]) => void;
|
15
15
|
export declare function _for_in(nodeAccessor: Accessor, renderer: Renderer): (scope: Scope, value: [obj: {}, by?: ((key: string, v: unknown) => unknown) | undefined]) => void;
|
16
16
|
export declare function _for_to(nodeAccessor: Accessor, renderer: Renderer): (scope: Scope, value: [to: number, from: number, step: number, by?: ((v: number) => unknown) | undefined]) => void;
|
17
|
+
export declare function _for_until(nodeAccessor: Accessor, renderer: Renderer): (scope: Scope, value: [until: number, from: number, step: number, by?: ((v: number) => unknown) | undefined]) => void;
|
package/dist/dom.d.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
export { attrTag, attrTags } from "./common/attr-tag";
|
2
|
-
export { forIn, forOf, forTo } from "./common/for";
|
2
|
+
export { forIn, forOf, forTo, forUntil } from "./common/for";
|
3
3
|
export { $signal, $signalReset } from "./dom/abort-signal";
|
4
4
|
export { compat } from "./dom/compat";
|
5
|
-
export { _await, _dynamic_tag, _for_in, _for_of, _for_to, _if, _try, } from "./dom/control-flow";
|
5
|
+
export { _await, _dynamic_tag, _for_in, _for_of, _for_to, _for_until, _if, _try, } from "./dom/control-flow";
|
6
6
|
export { _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open_script as _attr_details_open_script, _attr_details_or_dialog_open as _attr_dialog_open, _attr_details_or_dialog_open_script as _attr_dialog_open_script, _attr_input_checked, _attr_input_checked_script, _attr_input_checkedValue, _attr_input_checkedValue_script, _attr_input_value, _attr_input_value_script, _attr_select_value, _attr_select_value_script, _attr_textarea_value, _attr_textarea_value_script, } from "./dom/controllable";
|
7
7
|
export { _attr, _attr_class, _attr_class_item, _attr_class_items, _attr_content, _attr_style, _attr_style_item, _attr_style_items, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_script, _html, _lifecycle, _text, _text_content, } from "./dom/dom";
|
8
8
|
export { _on } from "./dom/event";
|
package/dist/dom.js
CHANGED
@@ -61,6 +61,7 @@ __export(dom_exports, {
|
|
61
61
|
_for_in: () => _for_in,
|
62
62
|
_for_of: () => _for_of,
|
63
63
|
_for_to: () => _for_to,
|
64
|
+
_for_until: () => _for_until,
|
64
65
|
_hoist: () => _hoist,
|
65
66
|
_html: () => _html,
|
66
67
|
_id: () => _id,
|
@@ -87,6 +88,7 @@ __export(dom_exports, {
|
|
87
88
|
forIn: () => forIn,
|
88
89
|
forOf: () => forOf,
|
89
90
|
forTo: () => forTo,
|
91
|
+
forUntil: () => forUntil,
|
90
92
|
init: () => init,
|
91
93
|
run: () => run
|
92
94
|
});
|
@@ -121,6 +123,11 @@ function forTo(to, from, step, cb) {
|
|
121
123
|
for (let steps = (to - start) / delta, i = 0; i <= steps; i++)
|
122
124
|
cb(start + i * delta);
|
123
125
|
}
|
126
|
+
function forUntil(until, from, step, cb) {
|
127
|
+
let start = from || 0, delta = step || 1;
|
128
|
+
for (let steps = (until - start) / delta, i = 0; i < steps; i++)
|
129
|
+
cb(start + i * delta);
|
130
|
+
}
|
124
131
|
|
125
132
|
// src/common/helpers.ts
|
126
133
|
function classValue(classValue2) {
|
@@ -1271,6 +1278,13 @@ function _for_to(nodeAccessor, renderer) {
|
|
1271
1278
|
([to, from, step, by = byFirstArg], cb) => forTo(to, from, step, (v) => cb(by(v), [v]))
|
1272
1279
|
);
|
1273
1280
|
}
|
1281
|
+
function _for_until(nodeAccessor, renderer) {
|
1282
|
+
return loop(
|
1283
|
+
nodeAccessor,
|
1284
|
+
renderer,
|
1285
|
+
([until, from, step, by = byFirstArg], cb) => forUntil(until, from, step, (v) => cb(by(v), [v]))
|
1286
|
+
);
|
1287
|
+
}
|
1274
1288
|
function loop(nodeAccessor, renderer, forEach) {
|
1275
1289
|
let params = renderer.m;
|
1276
1290
|
return enableBranches(), (scope, value) => {
|
package/dist/dom.mjs
CHANGED
@@ -27,6 +27,11 @@ function forTo(to, from, step, cb) {
|
|
27
27
|
for (let steps = (to - start) / delta, i = 0; i <= steps; i++)
|
28
28
|
cb(start + i * delta);
|
29
29
|
}
|
30
|
+
function forUntil(until, from, step, cb) {
|
31
|
+
let start = from || 0, delta = step || 1;
|
32
|
+
for (let steps = (until - start) / delta, i = 0; i < steps; i++)
|
33
|
+
cb(start + i * delta);
|
34
|
+
}
|
30
35
|
|
31
36
|
// src/common/helpers.ts
|
32
37
|
function classValue(classValue2) {
|
@@ -1177,6 +1182,13 @@ function _for_to(nodeAccessor, renderer) {
|
|
1177
1182
|
([to, from, step, by = byFirstArg], cb) => forTo(to, from, step, (v) => cb(by(v), [v]))
|
1178
1183
|
);
|
1179
1184
|
}
|
1185
|
+
function _for_until(nodeAccessor, renderer) {
|
1186
|
+
return loop(
|
1187
|
+
nodeAccessor,
|
1188
|
+
renderer,
|
1189
|
+
([until, from, step, by = byFirstArg], cb) => forUntil(until, from, step, (v) => cb(by(v), [v]))
|
1190
|
+
);
|
1191
|
+
}
|
1180
1192
|
function loop(nodeAccessor, renderer, forEach) {
|
1181
1193
|
let params = renderer.m;
|
1182
1194
|
return enableBranches(), (scope, value) => {
|
@@ -1491,6 +1503,7 @@ export {
|
|
1491
1503
|
_for_in,
|
1492
1504
|
_for_of,
|
1493
1505
|
_for_to,
|
1506
|
+
_for_until,
|
1494
1507
|
_hoist,
|
1495
1508
|
_html,
|
1496
1509
|
_id,
|
@@ -1517,6 +1530,7 @@ export {
|
|
1517
1530
|
forIn,
|
1518
1531
|
forOf,
|
1519
1532
|
forTo,
|
1533
|
+
forUntil,
|
1520
1534
|
init,
|
1521
1535
|
run
|
1522
1536
|
};
|
package/dist/html/for.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export { forIn, forOf, forTo } from "../common/for";
|
1
|
+
export { forIn, forOf, forTo, forUntil } from "../common/for";
|
2
2
|
export declare function forOfBy(by: unknown, item: any, index: unknown): any;
|
3
3
|
export declare function forInBy(by: unknown, name: string, value: unknown): any;
|
4
|
-
export declare function
|
4
|
+
export declare function forStepBy(by: unknown, index: number): any;
|
package/dist/html/writer.d.ts
CHANGED
@@ -42,6 +42,7 @@ export declare function withBranchId<T>(branchId: number, cb: () => T): T;
|
|
42
42
|
export declare function _for_of(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1): void;
|
43
43
|
export declare function _for_in(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1): void;
|
44
44
|
export declare function _for_to(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1): void;
|
45
|
+
export declare function _for_until(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1): void;
|
45
46
|
export declare function _if(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1): void;
|
46
47
|
declare let writeScope: (scopeId: number, partialScope: PartialScope) => ScopeInternals;
|
47
48
|
export declare function writeScopeToState(state: State, scopeId: number, partialScope: PartialScope): ScopeInternals;
|
package/dist/html.d.ts
CHANGED
@@ -3,6 +3,6 @@ export { _attr, _attr_class, _attr_details_or_dialog_open as _attr_details_open,
|
|
3
3
|
export { compat } from "./html/compat";
|
4
4
|
export { _escape, _escape_script, _escape_style, _unescaped, } from "./html/content";
|
5
5
|
export { _content, _content_resume, _dynamic_tag } from "./html/dynamic-tag";
|
6
|
-
export { forIn, forInBy, forOf, forOfBy, forTo,
|
6
|
+
export { forIn, forInBy, forOf, forOfBy, forStepBy, forTo, forUntil, } from "./html/for";
|
7
7
|
export { _template } from "./html/template";
|
8
|
-
export { _attr_content, _await, _el, _el_resume, _existing_scope, _for_in, _for_of, _for_to, _hoist, _html, _id, _if, _peek_scope_id, _resume, _resume_branch, _scope, _scope_id, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _subscribe, _trailers, _try, _var, $global, } from "./html/writer";
|
8
|
+
export { _attr_content, _await, _el, _el_resume, _existing_scope, _for_in, _for_of, _for_to, _for_until, _hoist, _html, _id, _if, _peek_scope_id, _resume, _resume_branch, _scope, _scope_id, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _subscribe, _trailers, _try, _var, $global, } from "./html/writer";
|
package/dist/html.js
CHANGED
@@ -47,6 +47,7 @@ __export(html_exports, {
|
|
47
47
|
_for_in: () => _for_in,
|
48
48
|
_for_of: () => _for_of,
|
49
49
|
_for_to: () => _for_to,
|
50
|
+
_for_until: () => _for_until,
|
50
51
|
_hoist: () => _hoist,
|
51
52
|
_html: () => _html,
|
52
53
|
_id: () => _id,
|
@@ -74,8 +75,9 @@ __export(html_exports, {
|
|
74
75
|
forInBy: () => forInBy,
|
75
76
|
forOf: () => forOf,
|
76
77
|
forOfBy: () => forOfBy,
|
78
|
+
forStepBy: () => forStepBy,
|
77
79
|
forTo: () => forTo,
|
78
|
-
|
80
|
+
forUntil: () => forUntil
|
79
81
|
});
|
80
82
|
module.exports = __toCommonJS(html_exports);
|
81
83
|
|
@@ -167,6 +169,11 @@ function forTo(to, from, step, cb) {
|
|
167
169
|
for (let steps = (to - start) / delta, i = 0; i <= steps; i++)
|
168
170
|
cb(start + i * delta);
|
169
171
|
}
|
172
|
+
function forUntil(until, from, step, cb) {
|
173
|
+
let start = from || 0, delta = step || 1;
|
174
|
+
for (let steps = (until - start) / delta, i = 0; i < steps; i++)
|
175
|
+
cb(start + i * delta);
|
176
|
+
}
|
170
177
|
|
171
178
|
// src/html/for.ts
|
172
179
|
function forOfBy(by, item, index) {
|
@@ -175,7 +182,7 @@ function forOfBy(by, item, index) {
|
|
175
182
|
function forInBy(by, name, value) {
|
176
183
|
return by ? by(name, value) : name;
|
177
184
|
}
|
178
|
-
function
|
185
|
+
function forStepBy(by, index) {
|
179
186
|
return by ? by(index) : index;
|
180
187
|
}
|
181
188
|
|
@@ -1249,7 +1256,7 @@ function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, ser
|
|
1249
1256
|
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(
|
1250
1257
|
state.mark("[" /* BranchStart */, flushBranchIds)
|
1251
1258
|
), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
1252
|
-
cb(i), loopScopes.set(
|
1259
|
+
cb(i), loopScopes.set(forStepBy(by, i), writeScope(branchId, {}));
|
1253
1260
|
});
|
1254
1261
|
}), loopScopes.size && writeScope(scopeId, {
|
1255
1262
|
["m" /* LoopScopeMap */ + accessor]: loopScopes
|
@@ -1266,6 +1273,32 @@ function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, ser
|
|
1266
1273
|
singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : ""
|
1267
1274
|
);
|
1268
1275
|
}
|
1276
|
+
function _for_until(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1277
|
+
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, flushBranchIds = "";
|
1278
|
+
if (resumeBranch) {
|
1279
|
+
let loopScopes = /* @__PURE__ */ new Map();
|
1280
|
+
forUntil(to, from, step, (i) => {
|
1281
|
+
let branchId = _peek_scope_id();
|
1282
|
+
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(
|
1283
|
+
state.mark("[" /* BranchStart */, flushBranchIds)
|
1284
|
+
), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
1285
|
+
cb(i), loopScopes.set(forStepBy(by, i), writeScope(branchId, {}));
|
1286
|
+
});
|
1287
|
+
}), loopScopes.size && writeScope(scopeId, {
|
1288
|
+
["m" /* LoopScopeMap */ + accessor]: loopScopes
|
1289
|
+
});
|
1290
|
+
} else
|
1291
|
+
forUntil(to, from, step, cb);
|
1292
|
+
writeBranchEnd(
|
1293
|
+
scopeId,
|
1294
|
+
accessor,
|
1295
|
+
resumeBranch,
|
1296
|
+
resumeMarker,
|
1297
|
+
parentEndTag,
|
1298
|
+
singleNode,
|
1299
|
+
singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : ""
|
1300
|
+
);
|
1301
|
+
}
|
1269
1302
|
function _if(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1270
1303
|
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchId = _peek_scope_id();
|
1271
1304
|
resumeMarker && resumeBranch && !singleNode && $chunk.writeHTML(state.mark("[" /* BranchStart */, ""));
|
@@ -2219,6 +2252,7 @@ function NOOP3() {
|
|
2219
2252
|
_for_in,
|
2220
2253
|
_for_of,
|
2221
2254
|
_for_to,
|
2255
|
+
_for_until,
|
2222
2256
|
_hoist,
|
2223
2257
|
_html,
|
2224
2258
|
_id,
|
@@ -2246,6 +2280,7 @@ function NOOP3() {
|
|
2246
2280
|
forInBy,
|
2247
2281
|
forOf,
|
2248
2282
|
forOfBy,
|
2283
|
+
forStepBy,
|
2249
2284
|
forTo,
|
2250
|
-
|
2285
|
+
forUntil
|
2251
2286
|
});
|
package/dist/html.mjs
CHANGED
@@ -86,6 +86,11 @@ function forTo(to, from, step, cb) {
|
|
86
86
|
for (let steps = (to - start) / delta, i = 0; i <= steps; i++)
|
87
87
|
cb(start + i * delta);
|
88
88
|
}
|
89
|
+
function forUntil(until, from, step, cb) {
|
90
|
+
let start = from || 0, delta = step || 1;
|
91
|
+
for (let steps = (until - start) / delta, i = 0; i < steps; i++)
|
92
|
+
cb(start + i * delta);
|
93
|
+
}
|
89
94
|
|
90
95
|
// src/html/for.ts
|
91
96
|
function forOfBy(by, item, index) {
|
@@ -94,7 +99,7 @@ function forOfBy(by, item, index) {
|
|
94
99
|
function forInBy(by, name, value) {
|
95
100
|
return by ? by(name, value) : name;
|
96
101
|
}
|
97
|
-
function
|
102
|
+
function forStepBy(by, index) {
|
98
103
|
return by ? by(index) : index;
|
99
104
|
}
|
100
105
|
|
@@ -1168,7 +1173,7 @@ function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, ser
|
|
1168
1173
|
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(
|
1169
1174
|
state.mark("[" /* BranchStart */, flushBranchIds)
|
1170
1175
|
), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
1171
|
-
cb(i), loopScopes.set(
|
1176
|
+
cb(i), loopScopes.set(forStepBy(by, i), writeScope(branchId, {}));
|
1172
1177
|
});
|
1173
1178
|
}), loopScopes.size && writeScope(scopeId, {
|
1174
1179
|
["m" /* LoopScopeMap */ + accessor]: loopScopes
|
@@ -1185,6 +1190,32 @@ function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, ser
|
|
1185
1190
|
singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : ""
|
1186
1191
|
);
|
1187
1192
|
}
|
1193
|
+
function _for_until(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1194
|
+
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, flushBranchIds = "";
|
1195
|
+
if (resumeBranch) {
|
1196
|
+
let loopScopes = /* @__PURE__ */ new Map();
|
1197
|
+
forUntil(to, from, step, (i) => {
|
1198
|
+
let branchId = _peek_scope_id();
|
1199
|
+
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(
|
1200
|
+
state.mark("[" /* BranchStart */, flushBranchIds)
|
1201
|
+
), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
1202
|
+
cb(i), loopScopes.set(forStepBy(by, i), writeScope(branchId, {}));
|
1203
|
+
});
|
1204
|
+
}), loopScopes.size && writeScope(scopeId, {
|
1205
|
+
["m" /* LoopScopeMap */ + accessor]: loopScopes
|
1206
|
+
});
|
1207
|
+
} else
|
1208
|
+
forUntil(to, from, step, cb);
|
1209
|
+
writeBranchEnd(
|
1210
|
+
scopeId,
|
1211
|
+
accessor,
|
1212
|
+
resumeBranch,
|
1213
|
+
resumeMarker,
|
1214
|
+
parentEndTag,
|
1215
|
+
singleNode,
|
1216
|
+
singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : ""
|
1217
|
+
);
|
1218
|
+
}
|
1188
1219
|
function _if(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1189
1220
|
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchId = _peek_scope_id();
|
1190
1221
|
resumeMarker && resumeBranch && !singleNode && $chunk.writeHTML(state.mark("[" /* BranchStart */, ""));
|
@@ -2137,6 +2168,7 @@ export {
|
|
2137
2168
|
_for_in,
|
2138
2169
|
_for_of,
|
2139
2170
|
_for_to,
|
2171
|
+
_for_until,
|
2140
2172
|
_hoist,
|
2141
2173
|
_html,
|
2142
2174
|
_id,
|
@@ -2164,6 +2196,7 @@ export {
|
|
2164
2196
|
forInBy,
|
2165
2197
|
forOf,
|
2166
2198
|
forOfBy,
|
2199
|
+
forStepBy,
|
2167
2200
|
forTo,
|
2168
|
-
|
2201
|
+
forUntil
|
2169
2202
|
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
2
|
-
type ForType = "in" | "of" | "to";
|
2
|
+
type ForType = "in" | "of" | "to" | "until";
|
3
3
|
declare const _default: {
|
4
4
|
analyze(tag: t.NodePath<t.MarkoTag>): void;
|
5
5
|
translate: {
|
@@ -28,6 +28,12 @@ declare const _default: {
|
|
28
28
|
description: string;
|
29
29
|
}[];
|
30
30
|
};
|
31
|
+
until: {
|
32
|
+
type: string;
|
33
|
+
autocomplete: {
|
34
|
+
description: string;
|
35
|
+
}[];
|
36
|
+
};
|
31
37
|
from: {
|
32
38
|
type: string;
|
33
39
|
autocomplete: {
|
package/dist/translator/index.js
CHANGED
@@ -2386,6 +2386,7 @@ var pureDOMFunctions = /* @__PURE__ */ new Set([
|
|
2386
2386
|
"_for_in",
|
2387
2387
|
"_for_of",
|
2388
2388
|
"_for_to",
|
2389
|
+
"_for_until",
|
2389
2390
|
"_let",
|
2390
2391
|
"_const"
|
2391
2392
|
]);
|
@@ -7281,6 +7282,9 @@ var for_default = {
|
|
7281
7282
|
case "to":
|
7282
7283
|
allowAttrs = ["to", "from", "step"];
|
7283
7284
|
break;
|
7285
|
+
case "until":
|
7286
|
+
allowAttrs = ["until", "from", "step"];
|
7287
|
+
break;
|
7284
7288
|
default:
|
7285
7289
|
throw tag.buildCodeFrameError(
|
7286
7290
|
"The [`<for>` tag](https://markojs.com/docs/reference/core-tag#for) requires an `of=`, `in=`, or `to=` attribute."
|
@@ -7472,6 +7476,14 @@ var for_default = {
|
|
7472
7476
|
}
|
7473
7477
|
]
|
7474
7478
|
},
|
7479
|
+
until: {
|
7480
|
+
type: "number",
|
7481
|
+
autocomplete: [
|
7482
|
+
{
|
7483
|
+
description: "Iterates up to the provided number (exclusive)"
|
7484
|
+
}
|
7485
|
+
]
|
7486
|
+
},
|
7475
7487
|
from: {
|
7476
7488
|
type: "number",
|
7477
7489
|
autocomplete: [
|
@@ -7484,7 +7496,7 @@ var for_default = {
|
|
7484
7496
|
type: "number",
|
7485
7497
|
autocomplete: [
|
7486
7498
|
{
|
7487
|
-
description: "The amount to increment during each
|
7499
|
+
description: "The amount to increment during each iteration (with from/to/until)"
|
7488
7500
|
}
|
7489
7501
|
]
|
7490
7502
|
}
|
@@ -7502,6 +7514,10 @@ var for_default = {
|
|
7502
7514
|
{
|
7503
7515
|
snippet: "for|${1:index}| to=${2:number}",
|
7504
7516
|
descriptionMoreURL: "https://markojs.com/docs/reference/core-tag#for"
|
7517
|
+
},
|
7518
|
+
{
|
7519
|
+
snippet: "for|${1:index}| until=${2:number}",
|
7520
|
+
descriptionMoreURL: "https://markojs.com/docs/reference/core-tag#for"
|
7505
7521
|
}
|
7506
7522
|
]
|
7507
7523
|
};
|
@@ -7521,6 +7537,7 @@ function getForType(tag) {
|
|
7521
7537
|
case "of":
|
7522
7538
|
case "in":
|
7523
7539
|
case "to":
|
7540
|
+
case "until":
|
7524
7541
|
return attr.name;
|
7525
7542
|
}
|
7526
7543
|
}
|
@@ -7534,6 +7551,8 @@ function forTypeToRuntime(type) {
|
|
7534
7551
|
return "forIn";
|
7535
7552
|
case "to":
|
7536
7553
|
return "forTo";
|
7554
|
+
case "until":
|
7555
|
+
return "forUntil";
|
7537
7556
|
}
|
7538
7557
|
}
|
7539
7558
|
function forTypeToHTMLResumeRuntime(type) {
|
@@ -7544,6 +7563,8 @@ function forTypeToHTMLResumeRuntime(type) {
|
|
7544
7563
|
return "_for_in";
|
7545
7564
|
case "to":
|
7546
7565
|
return "_for_to";
|
7566
|
+
case "until":
|
7567
|
+
return "_for_until";
|
7547
7568
|
}
|
7548
7569
|
}
|
7549
7570
|
function forTypeToDOMRuntime(type) {
|
@@ -7554,6 +7575,8 @@ function forTypeToDOMRuntime(type) {
|
|
7554
7575
|
return "_for_in";
|
7555
7576
|
case "to":
|
7556
7577
|
return "_for_to";
|
7578
|
+
case "until":
|
7579
|
+
return "_for_until";
|
7557
7580
|
}
|
7558
7581
|
}
|
7559
7582
|
function getBaseArgsInForTag(type, attrs) {
|
@@ -7568,6 +7591,12 @@ function getBaseArgsInForTag(type, attrs) {
|
|
7568
7591
|
attrs.from || import_compiler34.types.numericLiteral(0),
|
7569
7592
|
attrs.step || import_compiler34.types.numericLiteral(1)
|
7570
7593
|
];
|
7594
|
+
case "until":
|
7595
|
+
return [
|
7596
|
+
attrs.until,
|
7597
|
+
attrs.from || import_compiler34.types.numericLiteral(0),
|
7598
|
+
attrs.step || import_compiler34.types.numericLiteral(1)
|
7599
|
+
];
|
7571
7600
|
}
|
7572
7601
|
}
|
7573
7602
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "marko",
|
3
|
-
"version": "6.0.
|
3
|
+
"version": "6.0.67",
|
4
4
|
"description": "Optimized runtime for Marko templates.",
|
5
5
|
"keywords": [
|
6
6
|
"api",
|
@@ -48,7 +48,7 @@
|
|
48
48
|
"build": "node -r ~ts ./scripts/bundle.ts"
|
49
49
|
},
|
50
50
|
"dependencies": {
|
51
|
-
"@marko/compiler": "^5.39.
|
51
|
+
"@marko/compiler": "^5.39.35",
|
52
52
|
"csstype": "^3.1.3",
|
53
53
|
"magic-string": "^0.30.17"
|
54
54
|
},
|