@vibecook/ice 0.16.0-portals.3 → 0.16.0
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/{chunk-NB4ALBIY.js → chunk-BH5AFWJX.js} +57 -215
- package/dist/chunk-BH5AFWJX.js.map +1 -0
- package/dist/{chunk-SUNUMQLC.js → chunk-REJTEK3V.js} +214 -14
- package/dist/chunk-REJTEK3V.js.map +1 -0
- package/dist/{chunk-SHU3HVMF.js → chunk-Y7K6CHSF.js} +21 -1
- package/dist/chunk-Y7K6CHSF.js.map +1 -0
- package/dist/{chunk-6VY7I6VA.js → chunk-ZTY2VRIS.js} +2 -2
- package/dist/desk-kit.js +2 -6
- package/dist/desk-objects.js +17 -10
- package/dist/desk-objects.js.map +1 -1
- package/dist/desk.js +7 -5
- package/dist/devtools.js +1 -1
- package/dist/dom.js +2 -2
- package/dist/index.js +3 -1
- package/dist/react.js +9 -5
- package/dist/react.js.map +1 -1
- package/dist/types/packages/core/src/facade/create-canvas-engine.d.ts +2 -1
- package/dist/types/packages/core/src/index.d.ts +1 -1
- package/dist/types/packages/core/src/systems/held.d.ts +5 -1
- package/dist/types/packages/core/src/widget/held-tools.d.ts +35 -0
- package/dist/types/packages/desk/src/compose/marks.d.ts +17 -4
- package/dist/types/packages/desk/src/compose/reflector.d.ts +5 -2
- package/dist/types/packages/desk/src/host/index.d.ts +1 -0
- package/dist/types/packages/desk/src/host/live-texture.d.ts +70 -0
- package/dist/types/packages/desk/src/index.d.ts +1 -1
- package/dist/types/packages/desk/src/kinds/world.d.ts +16 -6
- package/dist/types/packages/desk/src/kit/live.d.ts +11 -71
- package/dist/types/packages/desk/src/theme.d.ts +12 -0
- package/dist/types/packages/objects/src/board/board-pen.d.ts +1 -1
- package/dist/types/packages/objects/src/calendar/hand.d.ts +5 -1
- package/dist/types/packages/objects/src/notebook/leaf.d.ts +1 -1
- package/dist/types/packages/react/src/selection-menu.d.ts +4 -1
- package/package.json +1 -1
- package/dist/chunk-NB4ALBIY.js.map +0 -1
- package/dist/chunk-SHU3HVMF.js.map +0 -1
- package/dist/chunk-SUNUMQLC.js.map +0 -1
- /package/dist/{chunk-6VY7I6VA.js.map → chunk-ZTY2VRIS.js.map} +0 -0
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
boxOf,
|
|
40
40
|
boxOfPortal,
|
|
41
41
|
carryOf,
|
|
42
|
+
chainBytes,
|
|
42
43
|
chainOf,
|
|
43
44
|
clipOf,
|
|
44
45
|
createServices,
|
|
@@ -60,12 +61,15 @@ import {
|
|
|
60
61
|
insidePresent,
|
|
61
62
|
insideViewOfFace,
|
|
62
63
|
intersectBox,
|
|
64
|
+
kindPalette,
|
|
63
65
|
kitWgsl,
|
|
64
66
|
lampOf,
|
|
65
67
|
lightValues,
|
|
66
68
|
linear,
|
|
67
69
|
litByOwn,
|
|
68
70
|
matUniformValues,
|
|
71
|
+
mipCount,
|
|
72
|
+
mipsInto,
|
|
69
73
|
progressOf,
|
|
70
74
|
readingTarget,
|
|
71
75
|
rgb,
|
|
@@ -78,7 +82,7 @@ import {
|
|
|
78
82
|
spring,
|
|
79
83
|
themeFrom,
|
|
80
84
|
tilted
|
|
81
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-BH5AFWJX.js";
|
|
82
86
|
import {
|
|
83
87
|
BLEND_OVER,
|
|
84
88
|
bindGroup,
|
|
@@ -150,6 +154,7 @@ import {
|
|
|
150
154
|
heldEntity,
|
|
151
155
|
menuActionsFor,
|
|
152
156
|
openTray,
|
|
157
|
+
readHeldToolState,
|
|
153
158
|
scrollTray,
|
|
154
159
|
selectedEntities,
|
|
155
160
|
setTrayCategory,
|
|
@@ -164,7 +169,7 @@ import {
|
|
|
164
169
|
trayTakeProps,
|
|
165
170
|
widgetSpawnInits,
|
|
166
171
|
widgetTypeFor
|
|
167
|
-
} from "./chunk-
|
|
172
|
+
} from "./chunk-Y7K6CHSF.js";
|
|
168
173
|
import {
|
|
169
174
|
clientToScreen,
|
|
170
175
|
cubicBezierEase,
|
|
@@ -3924,15 +3929,20 @@ function withKindActs(a, selected, menuOf) {
|
|
|
3924
3929
|
const menu = menuSlots(menuActionsFor(selected, menuOf));
|
|
3925
3930
|
return menu.length === 0 ? a : { ...a, menu };
|
|
3926
3931
|
}
|
|
3927
|
-
function heldSlots(tools, swatches = {}) {
|
|
3928
|
-
return tools.filter((t) => t.bar !== false).map((t) =>
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3932
|
+
function heldSlots(tools, swatches = {}, stateOf) {
|
|
3933
|
+
return tools.filter((t) => t.bar !== false).map((t) => {
|
|
3934
|
+
const now = stateOf?.(t);
|
|
3935
|
+
const glyph = now?.glyph ?? t.glyph;
|
|
3936
|
+
return {
|
|
3937
|
+
id: t.id,
|
|
3938
|
+
label: now?.label ?? t.label,
|
|
3939
|
+
...t.kind !== void 0 ? { kind: t.kind } : {},
|
|
3940
|
+
...t.hint !== void 0 ? { hint: t.hint } : {},
|
|
3941
|
+
...glyph !== void 0 ? { glyph } : {},
|
|
3942
|
+
...swatches[t.id] !== void 0 ? { swatch: swatches[t.id] } : {},
|
|
3943
|
+
...now?.enabled === false ? { enabled: false } : {}
|
|
3944
|
+
};
|
|
3945
|
+
});
|
|
3936
3946
|
}
|
|
3937
3947
|
var guidesQ = defineQuery([GuideLine]);
|
|
3938
3948
|
var barsQ = defineQuery([SpacingBar]);
|
|
@@ -6214,7 +6224,8 @@ function readGhosts(w) {
|
|
|
6214
6224
|
}
|
|
6215
6225
|
function looksOf(kinds, palette, theme) {
|
|
6216
6226
|
const out = /* @__PURE__ */ new Map();
|
|
6217
|
-
|
|
6227
|
+
const handed = kindPalette(palette);
|
|
6228
|
+
for (const k of kinds) if (k.theme !== void 0) out.set(k.name, k.theme(handed, theme.name));
|
|
6218
6229
|
return out;
|
|
6219
6230
|
}
|
|
6220
6231
|
|
|
@@ -7574,6 +7585,12 @@ function tellAnchor(kind, call, err) {
|
|
|
7574
7585
|
const kept = call === "readout" ? "no word (petition I22)" : "no swatches (petition I24)";
|
|
7575
7586
|
console.error(`[ice] desk: the kind "${kind}"'s \`open.${call}\` threw \u2014 the anchor carries its held tools and ${kept}; said once a page`, err);
|
|
7576
7587
|
}
|
|
7588
|
+
function tellToolState(kind, tool, err) {
|
|
7589
|
+
const key = `state ${kind} ${tool}`;
|
|
7590
|
+
if (toldAnchor.has(key)) return;
|
|
7591
|
+
toldAnchor.add(key);
|
|
7592
|
+
console.error(`[ice] desk: the kind "${kind}"'s held tool "${tool}" threw in its \`state\` \u2014 the tool stands as declared: live, its own glyph and label (petition I49); said once a page`, err);
|
|
7593
|
+
}
|
|
7577
7594
|
function hostNumber(name, v) {
|
|
7578
7595
|
if (v === void 0) return void 0;
|
|
7579
7596
|
if (typeof v !== "number" || !Number.isFinite(v) || v < 0) throw new Error(`[ice] deskLayer: \`${name}\` is ${String(v)} \u2014 a finite number \u2265 0 (CSS px, or ms for a time)`);
|
|
@@ -7736,6 +7753,12 @@ function deskLayer(opts) {
|
|
|
7736
7753
|
return {};
|
|
7737
7754
|
}
|
|
7738
7755
|
};
|
|
7756
|
+
const toolStateOf = (kind, tool, e) => {
|
|
7757
|
+
if (kind === void 0 || tool.state === void 0) return void 0;
|
|
7758
|
+
return readHeldToolState(tool, { world, entity: e, props: () => propsOf2(e), local: locals.get(kind.name) }, (err) => {
|
|
7759
|
+
tellToolState(kind.name, tool.id, err);
|
|
7760
|
+
});
|
|
7761
|
+
};
|
|
7739
7762
|
const anchorOf = () => {
|
|
7740
7763
|
const a = builder.anchor();
|
|
7741
7764
|
if (trayOpen(world)) return { ...a, box: null, count: 0 };
|
|
@@ -7745,7 +7768,7 @@ function deskLayer(opts) {
|
|
|
7745
7768
|
const swatches = swatchesOf(kind);
|
|
7746
7769
|
const active = world.isAlive(h.entity) ? world.get(h.entity, HeldTool)?.id ?? "" : "";
|
|
7747
7770
|
const readout = readoutOf(kind, h.entity);
|
|
7748
|
-
return { ...a, held: { tools: heldSlots(kind?.open?.tools ?? [], swatches), active, landing: h.landing, settled: h.settled, ...hold.travelMs !== void 0 ? { travelMs: hold.travelMs } : {}, ...readout !== void 0 ? { readout } : {} } };
|
|
7771
|
+
return { ...a, held: { tools: heldSlots(kind?.open?.tools ?? [], swatches, (t) => toolStateOf(kind, t, h.entity)), active, landing: h.landing, settled: h.settled, ...hold.travelMs !== void 0 ? { travelMs: hold.travelMs } : {}, ...readout !== void 0 ? { readout } : {} } };
|
|
7749
7772
|
};
|
|
7750
7773
|
const listeners = /* @__PURE__ */ new Set();
|
|
7751
7774
|
let published = "";
|
|
@@ -8043,6 +8066,12 @@ function deskLayer(opts) {
|
|
|
8043
8066
|
faults.strike(k.name, "cursor", err, e);
|
|
8044
8067
|
return void 0;
|
|
8045
8068
|
}
|
|
8069
|
+
},
|
|
8070
|
+
// …and (petition I49) what the kind says of its tool `id` now: core's `ops.useHeldTool` does nothing for one it says is disabled
|
|
8071
|
+
toolState: (e, id3) => {
|
|
8072
|
+
const k = builder.kindOf(e);
|
|
8073
|
+
const tool = k?.open?.tools?.find((t) => t.id === id3);
|
|
8074
|
+
return tool === void 0 ? void 0 : toolStateOf(k, tool, e);
|
|
8046
8075
|
}
|
|
8047
8076
|
};
|
|
8048
8077
|
const heldPose2 = ctx.heldPose;
|
|
@@ -8558,6 +8587,175 @@ function inkRaster(opts) {
|
|
|
8558
8587
|
};
|
|
8559
8588
|
}
|
|
8560
8589
|
|
|
8590
|
+
// ../desk/src/host/live-texture.ts
|
|
8591
|
+
function extent(what, v) {
|
|
8592
|
+
if (typeof v !== "number" || !Number.isFinite(v) || v < 1) throw new Error(`createLiveTexture: ${what} must be a finite number \u2265 1 (got ${String(v)})`);
|
|
8593
|
+
return Math.floor(v);
|
|
8594
|
+
}
|
|
8595
|
+
function logicalOf(l) {
|
|
8596
|
+
if (l === void 0) return null;
|
|
8597
|
+
const ok = (v) => typeof v === "number" && Number.isFinite(v) && v > 0;
|
|
8598
|
+
if (!Array.isArray(l) || !ok(l[0]) || !ok(l[1])) throw new Error(`LiveWriter: a logical size is [width, height], each finite and > 0 (got ${JSON.stringify(l)})`);
|
|
8599
|
+
return [l[0], l[1]];
|
|
8600
|
+
}
|
|
8601
|
+
var isVideoFrame = (s) => typeof s.close === "function" && typeof s.codedWidth === "number";
|
|
8602
|
+
function wholeOf(s) {
|
|
8603
|
+
if (isVideoFrame(s)) return { x: 0, y: 0, width: s.displayWidth, height: s.displayHeight };
|
|
8604
|
+
const c = s;
|
|
8605
|
+
return { x: 0, y: 0, width: c.width, height: c.height };
|
|
8606
|
+
}
|
|
8607
|
+
function createLiveTexture(device, o) {
|
|
8608
|
+
const format = o.format ?? "rgba8unorm-srgb";
|
|
8609
|
+
if (format !== "rgba8unorm-srgb" && format !== "rgba8unorm") throw new Error(`createLiveTexture: format must be "rgba8unorm-srgb" or "rgba8unorm" (got ${String(format)})`);
|
|
8610
|
+
if (typeof o.label !== "string") throw new Error("createLiveTexture: `label` is required \u2014 the caller's, `<kind>/live <key>` by convention");
|
|
8611
|
+
const chain = o.mips !== false;
|
|
8612
|
+
let width = extent("width", o.width);
|
|
8613
|
+
let height = extent("height", o.height);
|
|
8614
|
+
const make = (w, h) => device.createTexture({
|
|
8615
|
+
label: o.label,
|
|
8616
|
+
size: [w, h],
|
|
8617
|
+
format,
|
|
8618
|
+
mipLevelCount: chain ? mipCount(w, h) : 1,
|
|
8619
|
+
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.COPY_SRC | GPUTextureUsage.RENDER_ATTACHMENT
|
|
8620
|
+
});
|
|
8621
|
+
let texture = make(width, height);
|
|
8622
|
+
let view = null;
|
|
8623
|
+
let revision = 0;
|
|
8624
|
+
let epoch = 0;
|
|
8625
|
+
let mipped = { epoch: -1, revision: -1, depth: 0 };
|
|
8626
|
+
let logical = null;
|
|
8627
|
+
let gone = false;
|
|
8628
|
+
const sized = (w, h) => {
|
|
8629
|
+
if (w === width && h === height) return;
|
|
8630
|
+
logical = null;
|
|
8631
|
+
texture.destroy();
|
|
8632
|
+
width = w;
|
|
8633
|
+
height = h;
|
|
8634
|
+
texture = make(w, h);
|
|
8635
|
+
view = null;
|
|
8636
|
+
epoch += 1;
|
|
8637
|
+
};
|
|
8638
|
+
const face2 = {
|
|
8639
|
+
get width() {
|
|
8640
|
+
return width;
|
|
8641
|
+
},
|
|
8642
|
+
get height() {
|
|
8643
|
+
return height;
|
|
8644
|
+
},
|
|
8645
|
+
format,
|
|
8646
|
+
get revision() {
|
|
8647
|
+
return revision;
|
|
8648
|
+
},
|
|
8649
|
+
get epoch() {
|
|
8650
|
+
return epoch;
|
|
8651
|
+
},
|
|
8652
|
+
view() {
|
|
8653
|
+
if (view === null) view = texture.createView();
|
|
8654
|
+
return view;
|
|
8655
|
+
},
|
|
8656
|
+
prepare(encoder, upTo) {
|
|
8657
|
+
if (gone || revision === 0) return;
|
|
8658
|
+
if (mipped.epoch !== epoch || mipped.revision !== revision) mipped = { epoch, revision, depth: 0 };
|
|
8659
|
+
const to = Math.min(Math.floor(upTo), texture.mipLevelCount - 1);
|
|
8660
|
+
if (!(to > mipped.depth)) return;
|
|
8661
|
+
mipsInto(device, encoder, texture, mipped.depth + 1, to);
|
|
8662
|
+
mipped.depth = to;
|
|
8663
|
+
},
|
|
8664
|
+
get bytes() {
|
|
8665
|
+
return chainBytes(width, height, texture.mipLevelCount);
|
|
8666
|
+
},
|
|
8667
|
+
get logical() {
|
|
8668
|
+
return logical ?? [width, height];
|
|
8669
|
+
}
|
|
8670
|
+
};
|
|
8671
|
+
return {
|
|
8672
|
+
face: face2,
|
|
8673
|
+
present(source, rect, size) {
|
|
8674
|
+
try {
|
|
8675
|
+
if (gone) return;
|
|
8676
|
+
const r = rect ?? wholeOf(source);
|
|
8677
|
+
const w = extent("the source's width", r.width);
|
|
8678
|
+
const h = extent("the source's height", r.height);
|
|
8679
|
+
const l = logicalOf(size);
|
|
8680
|
+
sized(w, h);
|
|
8681
|
+
device.queue.copyExternalImageToTexture({ source, origin: [r.x, r.y] }, { texture, premultipliedAlpha: false }, [w, h]);
|
|
8682
|
+
logical = l;
|
|
8683
|
+
revision += 1;
|
|
8684
|
+
} finally {
|
|
8685
|
+
if (isVideoFrame(source)) source.close();
|
|
8686
|
+
}
|
|
8687
|
+
},
|
|
8688
|
+
presentBytes(bytes, w0, h0, size) {
|
|
8689
|
+
if (gone) return;
|
|
8690
|
+
const w = extent("width", w0);
|
|
8691
|
+
const h = extent("height", h0);
|
|
8692
|
+
if (bytes.byteLength < w * h * 4) throw new Error(`LiveWriter.presentBytes: ${bytes.byteLength} bytes for ${w} \xD7 ${h} RGBA8 rows (${w * h * 4} wanted)`);
|
|
8693
|
+
const l = logicalOf(size);
|
|
8694
|
+
sized(w, h);
|
|
8695
|
+
device.queue.writeTexture({ texture }, bytes, { bytesPerRow: w * 4, rowsPerImage: h }, [w, h]);
|
|
8696
|
+
logical = l;
|
|
8697
|
+
revision += 1;
|
|
8698
|
+
},
|
|
8699
|
+
presentTexture(src, rect, size) {
|
|
8700
|
+
if (gone) return;
|
|
8701
|
+
const r = rect ?? { x: 0, y: 0, width: src.width, height: src.height };
|
|
8702
|
+
const w = extent("the source's width", r.width);
|
|
8703
|
+
const h = extent("the source's height", r.height);
|
|
8704
|
+
const l = logicalOf(size);
|
|
8705
|
+
sized(w, h);
|
|
8706
|
+
const encoder = device.createCommandEncoder({ label: `${o.label} present` });
|
|
8707
|
+
encoder.copyTextureToTexture({ texture: src, origin: [r.x, r.y] }, { texture }, [w, h]);
|
|
8708
|
+
device.queue.submit([encoder.finish()]);
|
|
8709
|
+
logical = l;
|
|
8710
|
+
revision += 1;
|
|
8711
|
+
},
|
|
8712
|
+
resize(w, h) {
|
|
8713
|
+
if (gone) return;
|
|
8714
|
+
sized(extent("width", w), extent("height", h));
|
|
8715
|
+
},
|
|
8716
|
+
destroy() {
|
|
8717
|
+
if (gone) return;
|
|
8718
|
+
gone = true;
|
|
8719
|
+
texture.destroy();
|
|
8720
|
+
}
|
|
8721
|
+
};
|
|
8722
|
+
}
|
|
8723
|
+
function stillLive(device, frames) {
|
|
8724
|
+
const open = /* @__PURE__ */ new Set();
|
|
8725
|
+
return {
|
|
8726
|
+
open(key, spec) {
|
|
8727
|
+
if (open.has(key)) throw new Error(`stillLive: the face "${key}" is open twice \u2014 one face per key per desk (design-019 \xA73.2)`);
|
|
8728
|
+
open.add(key);
|
|
8729
|
+
const still = typeof frames === "function" ? frames(key, spec) : frames[key];
|
|
8730
|
+
let writer;
|
|
8731
|
+
let taken = false;
|
|
8732
|
+
let closed = false;
|
|
8733
|
+
return {
|
|
8734
|
+
key,
|
|
8735
|
+
texture: () => writer?.face,
|
|
8736
|
+
take() {
|
|
8737
|
+
if (taken || closed || still === void 0) return false;
|
|
8738
|
+
taken = true;
|
|
8739
|
+
writer = createLiveTexture(device, { label: `live/still ${key}`, width: still.width, height: still.height });
|
|
8740
|
+
writer.presentBytes(still.bytes, still.width, still.height, still.logical);
|
|
8741
|
+
return true;
|
|
8742
|
+
},
|
|
8743
|
+
state: () => closed ? { is: "closed" } : still === void 0 ? { is: "starting" } : { is: "live" },
|
|
8744
|
+
info: () => still?.info ?? {},
|
|
8745
|
+
demand: () => {
|
|
8746
|
+
},
|
|
8747
|
+
close() {
|
|
8748
|
+
if (closed) return;
|
|
8749
|
+
closed = true;
|
|
8750
|
+
writer?.destroy();
|
|
8751
|
+
writer = void 0;
|
|
8752
|
+
open.delete(key);
|
|
8753
|
+
}
|
|
8754
|
+
};
|
|
8755
|
+
}
|
|
8756
|
+
};
|
|
8757
|
+
}
|
|
8758
|
+
|
|
8561
8759
|
// ../desk/src/gpu-ablation.ts
|
|
8562
8760
|
var median = (v) => {
|
|
8563
8761
|
const s = [...v].sort((a, b) => a - b);
|
|
@@ -8906,10 +9104,12 @@ export {
|
|
|
8906
9104
|
deskLayer,
|
|
8907
9105
|
penFaces,
|
|
8908
9106
|
inkRaster,
|
|
9107
|
+
createLiveTexture,
|
|
9108
|
+
stillLive,
|
|
8909
9109
|
kindsIn,
|
|
8910
9110
|
withoutKind,
|
|
8911
9111
|
ablateKinds,
|
|
8912
9112
|
STILL_PALETTE,
|
|
8913
9113
|
createStill
|
|
8914
9114
|
};
|
|
8915
|
-
//# sourceMappingURL=chunk-
|
|
9115
|
+
//# sourceMappingURL=chunk-REJTEK3V.js.map
|