@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
|
@@ -2952,6 +2952,21 @@ function createDrawTool(widgetType, opts = {}) {
|
|
|
2952
2952
|
registerBuiltinTools();
|
|
2953
2953
|
|
|
2954
2954
|
// ../core/src/widget/held-tools.ts
|
|
2955
|
+
function readHeldToolState(tool, ctx, threw) {
|
|
2956
|
+
if (tool.state === void 0) return void 0;
|
|
2957
|
+
let said;
|
|
2958
|
+
try {
|
|
2959
|
+
said = tool.state(ctx);
|
|
2960
|
+
} catch (err) {
|
|
2961
|
+
threw?.(err);
|
|
2962
|
+
return void 0;
|
|
2963
|
+
}
|
|
2964
|
+
if (typeof said !== "object" || said === null) return void 0;
|
|
2965
|
+
const glyph = said.glyph !== void 0 && isHeldGlyph(said.glyph) ? said.glyph : void 0;
|
|
2966
|
+
const label = typeof said.label === "string" && said.label.length > 0 ? said.label : void 0;
|
|
2967
|
+
if (said.enabled !== false && glyph === void 0 && label === void 0) return void 0;
|
|
2968
|
+
return { ...said.enabled === false ? { enabled: false } : {}, ...glyph !== void 0 ? { glyph } : {}, ...label !== void 0 ? { label } : {} };
|
|
2969
|
+
}
|
|
2955
2970
|
var MODS = /* @__PURE__ */ new Set(["mod", "shift", "alt"]);
|
|
2956
2971
|
function parseKey(spec) {
|
|
2957
2972
|
const parts = spec.split("+");
|
|
@@ -2979,6 +2994,7 @@ function validateHeldTools(type, tools2) {
|
|
|
2979
2994
|
seen.add(t.id);
|
|
2980
2995
|
if (t.kind !== void 0 && t.kind !== "mode" && t.kind !== "action") throw new Error(`ice: defineWidget("${type}") heldTools "${t.id}" \u2014 a tool is a "mode" or an "action" (or declared with neither).`);
|
|
2981
2996
|
if (t.kind === "action" && typeof t.run !== "function") throw new Error(`ice: defineWidget("${type}") heldTools "${t.id}" \u2014 an action runs an op: declare \`run\`.`);
|
|
2997
|
+
if (t.state !== void 0 && typeof t.state !== "function") throw new Error(`ice: defineWidget("${type}") heldTools "${t.id}" \u2014 \`state\` is a function of the object in hand: \`(ctx) => ({ enabled, glyph, label })\` (petition I49).`);
|
|
2982
2998
|
if (!isHeldGlyph(t.glyph)) throw new Error(`ice: defineWidget("${type}") heldTools "${t.id}" \u2014 a glyph is a name of the bar's set or a drawing \`{ path }\` (SVG path data in the 24-unit box).`);
|
|
2983
2999
|
for (const spec of t.keys ?? []) {
|
|
2984
3000
|
if (parseKey(spec) === void 0) throw new Error(`ice: defineWidget("${type}") heldTools "${t.id}" \u2014 the key "${spec}" is not a key spec ("1", "e", "mod+z", "mod+shift+z").`);
|
|
@@ -16697,6 +16713,9 @@ function createCanvasEngine(opts = {}) {
|
|
|
16697
16713
|
if (held === void 0 || !world.isAlive(held)) return false;
|
|
16698
16714
|
const tool = heldToolsOf(held).find((t) => t.id === id);
|
|
16699
16715
|
if (tool === void 0 || tool.kind === void 0) return false;
|
|
16716
|
+
const pose = stack.heldPose.current;
|
|
16717
|
+
const state = pose?.toolState !== void 0 ? pose.toolState(held, id) : readHeldToolState(tool, { world, entity: held, props: () => propsOf(held), local: void 0 });
|
|
16718
|
+
if (state?.enabled === false) return false;
|
|
16700
16719
|
if (tool.kind === "mode") {
|
|
16701
16720
|
const cur = world.get(held, HeldTool) ?? { id: "", prev: "" };
|
|
16702
16721
|
const next2 = cur.id !== id ? { id, prev: cur.id } : tool.toggle === true ? { id: cur.prev, prev: id } : void 0;
|
|
@@ -17107,6 +17126,7 @@ export {
|
|
|
17107
17126
|
defineTool,
|
|
17108
17127
|
tools,
|
|
17109
17128
|
createDrawTool,
|
|
17129
|
+
readHeldToolState,
|
|
17110
17130
|
keyMatches,
|
|
17111
17131
|
matchHeldTool,
|
|
17112
17132
|
isHeldGlyph,
|
|
@@ -17296,4 +17316,4 @@ export {
|
|
|
17296
17316
|
Local3 as Local,
|
|
17297
17317
|
DurableUndoStatus
|
|
17298
17318
|
};
|
|
17299
|
-
//# sourceMappingURL=chunk-
|
|
17319
|
+
//# sourceMappingURL=chunk-Y7K6CHSF.js.map
|