tutuca 0.9.95 → 0.9.97
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/tutuca-cli.js +40 -10
- package/dist/tutuca-dev.ext.js +41 -9
- package/dist/tutuca-dev.js +41 -9
- package/dist/tutuca-dev.min.js +1 -1
- package/dist/tutuca-extra.ext.js +41 -9
- package/dist/tutuca-extra.js +41 -9
- package/dist/tutuca-extra.min.js +1 -1
- package/dist/tutuca.ext.js +41 -9
- package/dist/tutuca.js +41 -9
- package/dist/tutuca.min.js +1 -1
- package/package.json +1 -1
- package/skill/tutuca/semantics.md +3 -2
- package/skill/tutuca-source/tutuca.ext.js +41 -9
package/dist/tutuca-cli.js
CHANGED
|
@@ -8407,7 +8407,7 @@ class PathBuilder {
|
|
|
8407
8407
|
return this.add(new SeqStep(name, key));
|
|
8408
8408
|
}
|
|
8409
8409
|
}
|
|
8410
|
-
var NONE, BindStep, FieldStep, SeqStep, SeqAccessStep, EachBindStep, EachRenderItStep, DynStep, DynEachStep, NO_EVENT_INFO, BUBBLING_EVENTS;
|
|
8410
|
+
var NONE, BindStep, ScopeBindStep, FieldStep, SeqStep, SeqAccessStep, EachBindStep, EachRenderItStep, DynStep, DynEachStep, NO_EVENT_INFO, BUBBLING_EVENTS;
|
|
8411
8411
|
var init_path = __esm(() => {
|
|
8412
8412
|
NONE = Symbol("NONE");
|
|
8413
8413
|
BindStep = class BindStep extends Step {
|
|
@@ -8434,6 +8434,22 @@ var init_path = __esm(() => {
|
|
|
8434
8434
|
return null;
|
|
8435
8435
|
}
|
|
8436
8436
|
};
|
|
8437
|
+
ScopeBindStep = class ScopeBindStep extends BindStep {
|
|
8438
|
+
constructor(val, binds = {}) {
|
|
8439
|
+
super(binds);
|
|
8440
|
+
this.val = val;
|
|
8441
|
+
}
|
|
8442
|
+
enterFrame(stack, _prev, next) {
|
|
8443
|
+
const dyn = this.val.evalAsHandler(stack)?.call(stack.it) ?? {};
|
|
8444
|
+
return stack.enter(next, { ...this.binds, ...dyn }, false);
|
|
8445
|
+
}
|
|
8446
|
+
withIndex(i) {
|
|
8447
|
+
return new ScopeBindStep(this.val, { ...this.binds, key: i });
|
|
8448
|
+
}
|
|
8449
|
+
withKey(key) {
|
|
8450
|
+
return new ScopeBindStep(this.val, { ...this.binds, key });
|
|
8451
|
+
}
|
|
8452
|
+
};
|
|
8437
8453
|
FieldStep = class FieldStep extends Step {
|
|
8438
8454
|
constructor(field) {
|
|
8439
8455
|
super();
|
|
@@ -8492,9 +8508,9 @@ var init_path = __esm(() => {
|
|
|
8492
8508
|
}
|
|
8493
8509
|
};
|
|
8494
8510
|
EachBindStep = class EachBindStep extends Step {
|
|
8495
|
-
constructor(
|
|
8511
|
+
constructor(iterInfo, key) {
|
|
8496
8512
|
super();
|
|
8497
|
-
this.
|
|
8513
|
+
this.iterInfo = iterInfo;
|
|
8498
8514
|
this.key = key;
|
|
8499
8515
|
}
|
|
8500
8516
|
lookup(v, _dval) {
|
|
@@ -8504,8 +8520,7 @@ var init_path = __esm(() => {
|
|
|
8504
8520
|
return v;
|
|
8505
8521
|
}
|
|
8506
8522
|
enterFrame(stack, _prev, next) {
|
|
8507
|
-
|
|
8508
|
-
return stack.enter(next, { key: this.key, value: item }, false);
|
|
8523
|
+
return stack.enter(next, this.iterInfo.enrichBinds(stack, this.key), false);
|
|
8509
8524
|
}
|
|
8510
8525
|
toAbstractPathStep() {
|
|
8511
8526
|
return null;
|
|
@@ -9319,7 +9334,7 @@ class WeakMapDomCache {
|
|
|
9319
9334
|
const key = keys[i];
|
|
9320
9335
|
let next = cur.get(key);
|
|
9321
9336
|
if (!next) {
|
|
9322
|
-
if (
|
|
9337
|
+
if (!isWeakKey(key)) {
|
|
9323
9338
|
this.badKey += 1;
|
|
9324
9339
|
return;
|
|
9325
9340
|
}
|
|
@@ -9332,7 +9347,7 @@ class WeakMapDomCache {
|
|
|
9332
9347
|
const leaf = cur.get(lastKey);
|
|
9333
9348
|
if (leaf)
|
|
9334
9349
|
leaf[cacheKey] = v;
|
|
9335
|
-
else if (
|
|
9350
|
+
else if (isWeakKey(lastKey))
|
|
9336
9351
|
cur.set(lastKey, { [cacheKey]: v });
|
|
9337
9352
|
else
|
|
9338
9353
|
this.badKey += 1;
|
|
@@ -9344,6 +9359,7 @@ class WeakMapDomCache {
|
|
|
9344
9359
|
return { hit, miss, badKey };
|
|
9345
9360
|
}
|
|
9346
9361
|
}
|
|
9362
|
+
var isWeakKey = (k) => k !== null && (typeof k === "object" || typeof k === "function");
|
|
9347
9363
|
|
|
9348
9364
|
// src/vdom.js
|
|
9349
9365
|
function childOpts(vnode, ns, opts) {
|
|
@@ -9833,6 +9849,9 @@ class Renderer {
|
|
|
9833
9849
|
_renderMetadata(info) {
|
|
9834
9850
|
return new VComment(`§${JSON.stringify(info)}§`);
|
|
9835
9851
|
}
|
|
9852
|
+
renderScopeMeta(nid, dom) {
|
|
9853
|
+
return new VFragment([this._renderMetadata({ $: "Scope", nid }), dom]);
|
|
9854
|
+
}
|
|
9836
9855
|
}
|
|
9837
9856
|
var DATASET_ATTRS, getSeqInfo = (seq) => isIndexed(seq) ? imIndexedIter : isKeyed(seq) ? imKeyedIter : seq?.[SEQ_INFO] ?? unkIter, normalizeRange = (start, end, size) => {
|
|
9838
9857
|
let s = start == null ? 0 : start < 0 ? size + start : start;
|
|
@@ -10029,6 +10048,16 @@ class IterInfo {
|
|
|
10029
10048
|
const enricher = this.enrichWithVal?.evalAsHandler(stack) ?? null;
|
|
10030
10049
|
return { seq, filter, loopWith, enricher };
|
|
10031
10050
|
}
|
|
10051
|
+
enrichBinds(stack, key) {
|
|
10052
|
+
const { seq, loopWith, enricher } = this.eval(stack);
|
|
10053
|
+
const value = seq?.get ? seq.get(key, null) : null;
|
|
10054
|
+
const binds = { key, value };
|
|
10055
|
+
if (enricher) {
|
|
10056
|
+
const { iterData } = unpackLoopResult(loopWith.call(stack.it, seq), seq);
|
|
10057
|
+
enricher.call(stack.it, binds, key, value, iterData);
|
|
10058
|
+
}
|
|
10059
|
+
return binds;
|
|
10060
|
+
}
|
|
10032
10061
|
}
|
|
10033
10062
|
function xOp(consumed = [], { wrappable = false, wrapper = null } = {}) {
|
|
10034
10063
|
return { consumed: new Set(consumed), wrappable, wrapper };
|
|
@@ -10505,10 +10534,11 @@ var init_anode = __esm(() => {
|
|
|
10505
10534
|
ScopeNode = class ScopeNode extends WrapperNode {
|
|
10506
10535
|
render(stack, rx) {
|
|
10507
10536
|
const binds = this.val.evalAsHandler(stack)?.call(stack.it) ?? {};
|
|
10508
|
-
|
|
10537
|
+
const dom = this.node.render(stack.enter(stack.it, binds, false), rx);
|
|
10538
|
+
return rx.renderScopeMeta(this.nodeId, dom);
|
|
10509
10539
|
}
|
|
10510
10540
|
toPathStep(_ctx) {
|
|
10511
|
-
return new
|
|
10541
|
+
return new ScopeBindStep(this.val);
|
|
10512
10542
|
}
|
|
10513
10543
|
wrapNode(node) {
|
|
10514
10544
|
this.node = node;
|
|
@@ -10525,7 +10555,7 @@ var init_anode = __esm(() => {
|
|
|
10525
10555
|
return rx.renderEachWhen(stack, this.iterInfo, this.node, this.nodeId);
|
|
10526
10556
|
}
|
|
10527
10557
|
toPathStep(ctx) {
|
|
10528
|
-
return ctx.hasKey ? new EachBindStep(this.
|
|
10558
|
+
return ctx.hasKey ? new EachBindStep(this.iterInfo, ctx.key) : null;
|
|
10529
10559
|
}
|
|
10530
10560
|
static register = true;
|
|
10531
10561
|
};
|
package/dist/tutuca-dev.ext.js
CHANGED
|
@@ -145,6 +145,23 @@ class BindStep extends Step {
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
class ScopeBindStep extends BindStep {
|
|
149
|
+
constructor(val, binds = {}) {
|
|
150
|
+
super(binds);
|
|
151
|
+
this.val = val;
|
|
152
|
+
}
|
|
153
|
+
enterFrame(stack, _prev, next) {
|
|
154
|
+
const dyn = this.val.evalAsHandler(stack)?.call(stack.it) ?? {};
|
|
155
|
+
return stack.enter(next, { ...this.binds, ...dyn }, false);
|
|
156
|
+
}
|
|
157
|
+
withIndex(i) {
|
|
158
|
+
return new ScopeBindStep(this.val, { ...this.binds, key: i });
|
|
159
|
+
}
|
|
160
|
+
withKey(key) {
|
|
161
|
+
return new ScopeBindStep(this.val, { ...this.binds, key });
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
148
165
|
class FieldStep extends Step {
|
|
149
166
|
constructor(field) {
|
|
150
167
|
super();
|
|
@@ -206,9 +223,9 @@ class SeqAccessStep extends Step {
|
|
|
206
223
|
}
|
|
207
224
|
|
|
208
225
|
class EachBindStep extends Step {
|
|
209
|
-
constructor(
|
|
226
|
+
constructor(iterInfo, key) {
|
|
210
227
|
super();
|
|
211
|
-
this.
|
|
228
|
+
this.iterInfo = iterInfo;
|
|
212
229
|
this.key = key;
|
|
213
230
|
}
|
|
214
231
|
lookup(v, _dval) {
|
|
@@ -218,8 +235,7 @@ class EachBindStep extends Step {
|
|
|
218
235
|
return v;
|
|
219
236
|
}
|
|
220
237
|
enterFrame(stack, _prev, next) {
|
|
221
|
-
|
|
222
|
-
return stack.enter(next, { key: this.key, value: item }, false);
|
|
238
|
+
return stack.enter(next, this.iterInfo.enrichBinds(stack, this.key), false);
|
|
223
239
|
}
|
|
224
240
|
toAbstractPathStep() {
|
|
225
241
|
return null;
|
|
@@ -1306,6 +1322,8 @@ class RequestHandler {
|
|
|
1306
1322
|
import { isIndexed, isKeyed } from "immutable";
|
|
1307
1323
|
|
|
1308
1324
|
// src/cache.js
|
|
1325
|
+
var isWeakKey = (k) => k !== null && (typeof k === "object" || typeof k === "function");
|
|
1326
|
+
|
|
1309
1327
|
class NullDomCache {
|
|
1310
1328
|
get(_keys, _cacheKey) {}
|
|
1311
1329
|
set(_keys, _cacheKey, _v) {}
|
|
@@ -1349,7 +1367,7 @@ class WeakMapDomCache {
|
|
|
1349
1367
|
const key = keys[i];
|
|
1350
1368
|
let next = cur.get(key);
|
|
1351
1369
|
if (!next) {
|
|
1352
|
-
if (
|
|
1370
|
+
if (!isWeakKey(key)) {
|
|
1353
1371
|
this.badKey += 1;
|
|
1354
1372
|
return;
|
|
1355
1373
|
}
|
|
@@ -1362,7 +1380,7 @@ class WeakMapDomCache {
|
|
|
1362
1380
|
const leaf = cur.get(lastKey);
|
|
1363
1381
|
if (leaf)
|
|
1364
1382
|
leaf[cacheKey] = v;
|
|
1365
|
-
else if (
|
|
1383
|
+
else if (isWeakKey(lastKey))
|
|
1366
1384
|
cur.set(lastKey, { [cacheKey]: v });
|
|
1367
1385
|
else
|
|
1368
1386
|
this.badKey += 1;
|
|
@@ -1874,6 +1892,9 @@ class Renderer {
|
|
|
1874
1892
|
_renderMetadata(info) {
|
|
1875
1893
|
return new VComment(`§${JSON.stringify(info)}§`);
|
|
1876
1894
|
}
|
|
1895
|
+
renderScopeMeta(nid, dom) {
|
|
1896
|
+
return new VFragment([this._renderMetadata({ $: "Scope", nid }), dom]);
|
|
1897
|
+
}
|
|
1877
1898
|
}
|
|
1878
1899
|
var getSeqInfo = (seq) => isIndexed(seq) ? imIndexedIter : isKeyed(seq) ? imKeyedIter : seq?.[SEQ_INFO] ?? unkIter;
|
|
1879
1900
|
var normalizeRange = (start, end, size) => {
|
|
@@ -2394,10 +2415,11 @@ class SlotNode extends WrapperNode {
|
|
|
2394
2415
|
class ScopeNode extends WrapperNode {
|
|
2395
2416
|
render(stack, rx) {
|
|
2396
2417
|
const binds = this.val.evalAsHandler(stack)?.call(stack.it) ?? {};
|
|
2397
|
-
|
|
2418
|
+
const dom = this.node.render(stack.enter(stack.it, binds, false), rx);
|
|
2419
|
+
return rx.renderScopeMeta(this.nodeId, dom);
|
|
2398
2420
|
}
|
|
2399
2421
|
toPathStep(_ctx) {
|
|
2400
|
-
return new
|
|
2422
|
+
return new ScopeBindStep(this.val);
|
|
2401
2423
|
}
|
|
2402
2424
|
wrapNode(node) {
|
|
2403
2425
|
this.node = node;
|
|
@@ -2415,7 +2437,7 @@ class EachNode extends WrapperNode {
|
|
|
2415
2437
|
return rx.renderEachWhen(stack, this.iterInfo, this.node, this.nodeId);
|
|
2416
2438
|
}
|
|
2417
2439
|
toPathStep(ctx) {
|
|
2418
|
-
return ctx.hasKey ? new EachBindStep(this.
|
|
2440
|
+
return ctx.hasKey ? new EachBindStep(this.iterInfo, ctx.key) : null;
|
|
2419
2441
|
}
|
|
2420
2442
|
static register = true;
|
|
2421
2443
|
}
|
|
@@ -2434,6 +2456,16 @@ class IterInfo {
|
|
|
2434
2456
|
const enricher = this.enrichWithVal?.evalAsHandler(stack) ?? null;
|
|
2435
2457
|
return { seq, filter, loopWith, enricher };
|
|
2436
2458
|
}
|
|
2459
|
+
enrichBinds(stack, key) {
|
|
2460
|
+
const { seq, loopWith, enricher } = this.eval(stack);
|
|
2461
|
+
const value = seq?.get ? seq.get(key, null) : null;
|
|
2462
|
+
const binds = { key, value };
|
|
2463
|
+
if (enricher) {
|
|
2464
|
+
const { iterData } = unpackLoopResult(loopWith.call(stack.it, seq), seq);
|
|
2465
|
+
enricher.call(stack.it, binds, key, value, iterData);
|
|
2466
|
+
}
|
|
2467
|
+
return binds;
|
|
2468
|
+
}
|
|
2437
2469
|
}
|
|
2438
2470
|
function xOp(consumed = [], { wrappable = false, wrapper = null } = {}) {
|
|
2439
2471
|
return { consumed: new Set(consumed), wrappable, wrapper };
|
package/dist/tutuca-dev.js
CHANGED
|
@@ -7799,6 +7799,23 @@ class BindStep extends Step {
|
|
|
7799
7799
|
}
|
|
7800
7800
|
}
|
|
7801
7801
|
|
|
7802
|
+
class ScopeBindStep extends BindStep {
|
|
7803
|
+
constructor(val, binds = {}) {
|
|
7804
|
+
super(binds);
|
|
7805
|
+
this.val = val;
|
|
7806
|
+
}
|
|
7807
|
+
enterFrame(stack, _prev, next) {
|
|
7808
|
+
const dyn = this.val.evalAsHandler(stack)?.call(stack.it) ?? {};
|
|
7809
|
+
return stack.enter(next, { ...this.binds, ...dyn }, false);
|
|
7810
|
+
}
|
|
7811
|
+
withIndex(i) {
|
|
7812
|
+
return new ScopeBindStep(this.val, { ...this.binds, key: i });
|
|
7813
|
+
}
|
|
7814
|
+
withKey(key) {
|
|
7815
|
+
return new ScopeBindStep(this.val, { ...this.binds, key });
|
|
7816
|
+
}
|
|
7817
|
+
}
|
|
7818
|
+
|
|
7802
7819
|
class FieldStep extends Step {
|
|
7803
7820
|
constructor(field) {
|
|
7804
7821
|
super();
|
|
@@ -7860,9 +7877,9 @@ class SeqAccessStep extends Step {
|
|
|
7860
7877
|
}
|
|
7861
7878
|
|
|
7862
7879
|
class EachBindStep extends Step {
|
|
7863
|
-
constructor(
|
|
7880
|
+
constructor(iterInfo, key) {
|
|
7864
7881
|
super();
|
|
7865
|
-
this.
|
|
7882
|
+
this.iterInfo = iterInfo;
|
|
7866
7883
|
this.key = key;
|
|
7867
7884
|
}
|
|
7868
7885
|
lookup(v, _dval) {
|
|
@@ -7872,8 +7889,7 @@ class EachBindStep extends Step {
|
|
|
7872
7889
|
return v;
|
|
7873
7890
|
}
|
|
7874
7891
|
enterFrame(stack, _prev, next) {
|
|
7875
|
-
|
|
7876
|
-
return stack.enter(next, { key: this.key, value: item }, false);
|
|
7892
|
+
return stack.enter(next, this.iterInfo.enrichBinds(stack, this.key), false);
|
|
7877
7893
|
}
|
|
7878
7894
|
toAbstractPathStep() {
|
|
7879
7895
|
return null;
|
|
@@ -8957,6 +8973,8 @@ class RequestHandler {
|
|
|
8957
8973
|
}
|
|
8958
8974
|
|
|
8959
8975
|
// src/cache.js
|
|
8976
|
+
var isWeakKey = (k) => k !== null && (typeof k === "object" || typeof k === "function");
|
|
8977
|
+
|
|
8960
8978
|
class NullDomCache {
|
|
8961
8979
|
get(_keys, _cacheKey) {}
|
|
8962
8980
|
set(_keys, _cacheKey, _v) {}
|
|
@@ -9000,7 +9018,7 @@ class WeakMapDomCache {
|
|
|
9000
9018
|
const key = keys[i];
|
|
9001
9019
|
let next = cur.get(key);
|
|
9002
9020
|
if (!next) {
|
|
9003
|
-
if (
|
|
9021
|
+
if (!isWeakKey(key)) {
|
|
9004
9022
|
this.badKey += 1;
|
|
9005
9023
|
return;
|
|
9006
9024
|
}
|
|
@@ -9013,7 +9031,7 @@ class WeakMapDomCache {
|
|
|
9013
9031
|
const leaf = cur.get(lastKey);
|
|
9014
9032
|
if (leaf)
|
|
9015
9033
|
leaf[cacheKey] = v;
|
|
9016
|
-
else if (
|
|
9034
|
+
else if (isWeakKey(lastKey))
|
|
9017
9035
|
cur.set(lastKey, { [cacheKey]: v });
|
|
9018
9036
|
else
|
|
9019
9037
|
this.badKey += 1;
|
|
@@ -9525,6 +9543,9 @@ class Renderer {
|
|
|
9525
9543
|
_renderMetadata(info) {
|
|
9526
9544
|
return new VComment(`§${JSON.stringify(info)}§`);
|
|
9527
9545
|
}
|
|
9546
|
+
renderScopeMeta(nid, dom) {
|
|
9547
|
+
return new VFragment([this._renderMetadata({ $: "Scope", nid }), dom]);
|
|
9548
|
+
}
|
|
9528
9549
|
}
|
|
9529
9550
|
var getSeqInfo = (seq) => isIndexed(seq) ? imIndexedIter : isKeyed(seq) ? imKeyedIter : seq?.[SEQ_INFO] ?? unkIter;
|
|
9530
9551
|
var normalizeRange = (start, end, size) => {
|
|
@@ -10045,10 +10066,11 @@ class SlotNode extends WrapperNode {
|
|
|
10045
10066
|
class ScopeNode extends WrapperNode {
|
|
10046
10067
|
render(stack, rx) {
|
|
10047
10068
|
const binds = this.val.evalAsHandler(stack)?.call(stack.it) ?? {};
|
|
10048
|
-
|
|
10069
|
+
const dom = this.node.render(stack.enter(stack.it, binds, false), rx);
|
|
10070
|
+
return rx.renderScopeMeta(this.nodeId, dom);
|
|
10049
10071
|
}
|
|
10050
10072
|
toPathStep(_ctx) {
|
|
10051
|
-
return new
|
|
10073
|
+
return new ScopeBindStep(this.val);
|
|
10052
10074
|
}
|
|
10053
10075
|
wrapNode(node) {
|
|
10054
10076
|
this.node = node;
|
|
@@ -10066,7 +10088,7 @@ class EachNode extends WrapperNode {
|
|
|
10066
10088
|
return rx.renderEachWhen(stack, this.iterInfo, this.node, this.nodeId);
|
|
10067
10089
|
}
|
|
10068
10090
|
toPathStep(ctx) {
|
|
10069
|
-
return ctx.hasKey ? new EachBindStep(this.
|
|
10091
|
+
return ctx.hasKey ? new EachBindStep(this.iterInfo, ctx.key) : null;
|
|
10070
10092
|
}
|
|
10071
10093
|
static register = true;
|
|
10072
10094
|
}
|
|
@@ -10085,6 +10107,16 @@ class IterInfo {
|
|
|
10085
10107
|
const enricher = this.enrichWithVal?.evalAsHandler(stack) ?? null;
|
|
10086
10108
|
return { seq, filter, loopWith, enricher };
|
|
10087
10109
|
}
|
|
10110
|
+
enrichBinds(stack, key) {
|
|
10111
|
+
const { seq, loopWith, enricher } = this.eval(stack);
|
|
10112
|
+
const value = seq?.get ? seq.get(key, null) : null;
|
|
10113
|
+
const binds = { key, value };
|
|
10114
|
+
if (enricher) {
|
|
10115
|
+
const { iterData } = unpackLoopResult(loopWith.call(stack.it, seq), seq);
|
|
10116
|
+
enricher.call(stack.it, binds, key, value, iterData);
|
|
10117
|
+
}
|
|
10118
|
+
return binds;
|
|
10119
|
+
}
|
|
10088
10120
|
}
|
|
10089
10121
|
function xOp(consumed = [], { wrappable = false, wrapper = null } = {}) {
|
|
10090
10122
|
return { consumed: new Set(consumed), wrappable, wrapper };
|