Skip to content

Commit

Permalink
Publish v0.24.0
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Jan 9, 2025
1 parent 9f93d34 commit 8a7ed5c
Show file tree
Hide file tree
Showing 20 changed files with 152 additions and 42 deletions.
20 changes: 15 additions & 5 deletions dist/adapter-fxhash.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
prng: { defPRNG, sfc32 },
utils: { equiv, isString, hashString }
} = $genart;
var BIGINT_MAX = 2n ** 63n;
var FxhashAdapter = class {
_searchParams;
_params;
Expand All @@ -36,8 +37,9 @@
});
$fx.on(
"params:update",
(...args) => {
let [id, value] = Object.entries(args[0])[0];
() => true,
(_, rawParam) => {
let [id, value] = Object.entries(rawParam)[0];
const adaptedParam = this._adaptations[id];
if (adaptedParam) {
id = adaptedParam.id;
Expand All @@ -52,12 +54,11 @@
this._cache[id] = value;
if (param.update !== "reload") {
$genart.setParamValue(id, value);
} else {
location.reload();
}
return true;
},
() => {
}
// (...args) => console.log("update post", args)
);
window.addEventListener("resize", () => {
const { width, height, dpr } = this._screen;
Expand Down Expand Up @@ -91,6 +92,12 @@
get prng() {
return this._prng || (this._prng = defPRNG($fx.hash, hashString($fx.hash), sfc32));
}
get collector() {
return $fx.minter;
}
get iteration() {
return $fx.iteration;
}
configure(_) {
}
async updateParam(id, _) {
Expand Down Expand Up @@ -137,6 +144,9 @@
switch (src.type) {
case "bigint": {
const { min, max } = src;
if (min < -BIGINT_MAX || max >= BIGINT_MAX) {
this.warn(`value range out of bounds for param: ${id}`);
}
dest.options = { min, max };
break;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/adapter-fxhash.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion dist/adapter-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
utils: { equiv, isString, parseUUID }
} = $genart;
var LayerAdapter = class {
mode = "play";
_prng;
_params;
_cache = {};
Expand Down Expand Up @@ -59,6 +58,9 @@
get id() {
return "@genart-api/adapter-layer";
}
get mode() {
return "play";
}
get screen() {
return {
width: $layer.width,
Expand Down
2 changes: 1 addition & 1 deletion dist/adapter-layer.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 13 additions & 3 deletions dist/adapter-urlparams.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
var HEIGHT = "__height";
var DPR = "__dpr";
var SEED = "__seed";
var MODE = "__mode";
var COLLECTOR = "__collector";
var ITER = "__iteration";
var MAX_SEED = 1n << 128n;
var URLParamsAdapter = class {
params;
Expand Down Expand Up @@ -80,7 +83,14 @@
return "@genart-api/adapter-urlparams";
}
get mode() {
return this.params.get("__mode") || "play";
return this.params.get(MODE) || "play";
}
get collector() {
return this.params.get(COLLECTOR) ?? void 0;
}
get iteration() {
const id = this.params.get(ITER);
return id ? parseNum(id, 0) : void 0;
}
get screen() {
return {
Expand Down Expand Up @@ -170,7 +180,7 @@
case "datetime":
return { value: new Date(Date.parse(value)) };
case "binary":
case "img":
case "image":
return { value: await decompressBytes(base64Decode(value)) };
case "numlist":
return { value: value.split(",").map((x) => parseNum(x)) };
Expand Down Expand Up @@ -207,7 +217,7 @@
case "bigint":
return stringifyBigInt(spec.value, 16);
case "binary":
case "img":
case "image":
return base64Encode(
await compressBytes(spec.value)
);
Expand Down
Loading

0 comments on commit 8a7ed5c

Please sign in to comment.