@hyperfixi/engine 3.3.0 → 4.0.1
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/CHANGELOG.md +199 -1
- package/README.md +66 -40
- package/dist/common.js +1 -1
- package/dist/common.min.js +1 -1
- package/dist/core.js +1 -1
- package/dist/core.min.js +1 -1
- package/dist/expressions-extra.d.ts +15 -0
- package/dist/full.js +29 -10
- package/dist/full.min.js +14 -14
- package/dist/hyperfixi-hs.dev.js +29 -10
- package/dist/hyperfixi-hs.js +14 -14
- package/dist/index.d.ts +1 -0
- package/dist/index.js +30 -10
- package/dist/minimal.js +1 -1
- package/dist/minimal.min.js +1 -1
- package/package.json +1 -1
package/dist/hyperfixi-hs.dev.js
CHANGED
|
@@ -2026,7 +2026,7 @@
|
|
|
2026
2026
|
cleanup,
|
|
2027
2027
|
/** The part of upstream's `internals` that pages and tests reach for. */
|
|
2028
2028
|
internals: { runtime: { cleanup, processNode } },
|
|
2029
|
-
version: false ? "dev" : "
|
|
2029
|
+
version: false ? "dev" : "4.0.1"
|
|
2030
2030
|
});
|
|
2031
2031
|
function boot() {
|
|
2032
2032
|
Object.assign(globalThis, { _hyperscript: api });
|
|
@@ -4512,6 +4512,17 @@ return { ${functions.map((name) => `${name}:${name}`).join(",")} } `
|
|
|
4512
4512
|
};
|
|
4513
4513
|
return node;
|
|
4514
4514
|
}
|
|
4515
|
+
function beepValue(ctx, expression, source, value) {
|
|
4516
|
+
if (triggerEvent(ctx.me, "hyperscript:beep", { element: ctx.me, expression, value })) {
|
|
4517
|
+
const typeName = value == null ? "object (null)" : get(get(value, "constructor"), "name") ?? "unknown";
|
|
4518
|
+
const shown = typeof value === "string" ? `"${value}"` : shouldAutoIterate(value) ? Array.from(value) : value;
|
|
4519
|
+
console.log(
|
|
4520
|
+
`///_ BEEP! The expression (${source}) evaluates to:`,
|
|
4521
|
+
shown,
|
|
4522
|
+
"of type " + typeName
|
|
4523
|
+
);
|
|
4524
|
+
}
|
|
4525
|
+
}
|
|
4515
4526
|
function beep(p) {
|
|
4516
4527
|
const start = p.pos();
|
|
4517
4528
|
if (!p.match("beep!")) return;
|
|
@@ -4523,23 +4534,31 @@ return { ${functions.map((name) => `${name}:${name}`).join(",")} } `
|
|
|
4523
4534
|
start,
|
|
4524
4535
|
root,
|
|
4525
4536
|
(value, ctx) => {
|
|
4526
|
-
|
|
4527
|
-
const typeName = value == null ? "object (null)" : get(get(value, "constructor"), "name") ?? "unknown";
|
|
4528
|
-
const shown = typeof value === "string" ? `"${value}"` : shouldAutoIterate(value) ? Array.from(value) : value;
|
|
4529
|
-
console.log(
|
|
4530
|
-
`///_ BEEP! The expression (${source}) evaluates to:`,
|
|
4531
|
-
shown,
|
|
4532
|
-
"of type " + typeName
|
|
4533
|
-
);
|
|
4534
|
-
}
|
|
4537
|
+
beepValue(ctx, root, source, value);
|
|
4535
4538
|
return value;
|
|
4536
4539
|
},
|
|
4537
4540
|
false
|
|
4538
4541
|
);
|
|
4539
4542
|
}
|
|
4543
|
+
function beepCommand(p, _keyword, start) {
|
|
4544
|
+
const values2 = [expr(p)];
|
|
4545
|
+
while (p.matchOp(",")) values2.push(expr(p));
|
|
4546
|
+
const sources = values2.map((v) => p.text(v));
|
|
4547
|
+
return {
|
|
4548
|
+
type: "beepCommand",
|
|
4549
|
+
values: values2,
|
|
4550
|
+
start,
|
|
4551
|
+
end: p.endPos(),
|
|
4552
|
+
run: (ctx) => all(
|
|
4553
|
+
values2.map((v) => v.ev(ctx)),
|
|
4554
|
+
(vals) => vals.forEach((value, i) => beepValue(ctx, values2[i], sources[i], value))
|
|
4555
|
+
)
|
|
4556
|
+
};
|
|
4557
|
+
}
|
|
4540
4558
|
function expressionsExtra(g) {
|
|
4541
4559
|
g.leaves.push(closest, some, blockLiteral);
|
|
4542
4560
|
g.unaries.push(beep, relative, positional);
|
|
4561
|
+
g.commands["beep!"] = beepCommand;
|
|
4543
4562
|
g.postfixes.push(typeCheckPostfix);
|
|
4544
4563
|
g.collections.push(collectionOp);
|
|
4545
4564
|
}
|