From 8217bbc7a078ddf9075185e68e1f8f1cdb94a72e Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 5 Feb 2025 13:22:52 +0100 Subject: [PATCH 1/8] :bug: Fix problems with zoomIntoView --- CHANGES.md | 2 +- frontend/src/app/plugins/viewport.cljs | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 13d1e1453..7448619b7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -55,7 +55,7 @@ is a number of cores) - Fix error when reseting stroke cap - Fix problem with strokes not refreshing in Safari [Taiga #9040](https://tree.taiga.io/project/penpot/issue/9040) - Fix problem with multiple color changes [Taiga #9631](https://tree.taiga.io/project/penpot/issue/9631) - +- Fix problem in plugins with zoomIntoView [Plugins #189](https://github.com/penpot/penpot-plugins/issues/189) ## 2.4.3 diff --git a/frontend/src/app/plugins/viewport.cljs b/frontend/src/app/plugins/viewport.cljs index ab3622764..bacd9c90a 100644 --- a/frontend/src/app/plugins/viewport.cljs +++ b/frontend/src/app/plugins/viewport.cljs @@ -8,11 +8,11 @@ (:require [app.common.data.macros :as dm] [app.common.spec :as us] - [app.common.uuid :as uuid] [app.main.data.workspace.viewport :as dwv] [app.main.data.workspace.zoom :as dwz] [app.main.store :as st] [app.plugins.format :as format] + [app.plugins.shape :as ps] [app.plugins.utils :as u] [app.util.object :as obj])) @@ -85,12 +85,13 @@ :zoomIntoView (fn [shapes] - (let [ids - (->> shapes - (map (fn [v] - (if (string? v) - (uuid/uuid v) - (uuid/uuid (obj/get v "x"))))))] - (st/emit! (dwz/fit-to-shapes ids)))))) + (cond + (not (every? ps/shape-proxy? shapes)) + (u/display-not-valid :zoomIntoView "Argument should be valid shapes") + + :else + (let [ids (->> shapes + (map (fn [shape] (obj/get shape "$id"))))] + (st/emit! (dwz/fit-to-shapes ids))))))) From 9c626d22c791dade8635a1c5cbdcb6028dad4929 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 5 Feb 2025 13:24:07 +0100 Subject: [PATCH 2/8] :bug: Fix problem in plugins with renaming components --- CHANGES.md | 1 + frontend/src/app/plugins/library.cljs | 2 +- frontend/src/app/plugins/shape.cljs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 7448619b7..b300b83bc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -56,6 +56,7 @@ is a number of cores) - Fix problem with strokes not refreshing in Safari [Taiga #9040](https://tree.taiga.io/project/penpot/issue/9040) - Fix problem with multiple color changes [Taiga #9631](https://tree.taiga.io/project/penpot/issue/9631) - Fix problem in plugins with zoomIntoView [Plugins #189](https://github.com/penpot/penpot-plugins/issues/189) +- Fix problem in plugins with renaming components [Taiga #10060](https://tree.taiga.io/project/penpot/issue/10060) ## 2.4.3 diff --git a/frontend/src/app/plugins/library.cljs b/frontend/src/app/plugins/library.cljs index df5e05310..a269d2ab5 100644 --- a/frontend/src/app/plugins/library.cljs +++ b/frontend/src/app/plugins/library.cljs @@ -641,7 +641,7 @@ :else (let [component (u/proxy->library-component self) value (dm/str (d/nilv (:path component) "") " / " value)] - (st/emit! (dwl/rename-component id value)))))} + (st/emit! (dwl/rename-component-and-main-instance id value)))))} :path {:this true diff --git a/frontend/src/app/plugins/shape.cljs b/frontend/src/app/plugins/shape.cljs index a16deb8aa..e23917d13 100644 --- a/frontend/src/app/plugins/shape.cljs +++ b/frontend/src/app/plugins/shape.cljs @@ -211,7 +211,7 @@ (u/display-not-valid :name value) :else - (st/emit! (dwsh/update-shapes [id] #(assoc % :name value))))))} + (st/emit! (dw/end-rename-shape id value)))))} :blocked {:this true From 66076f133203b4c230b151407b211f887703c7ed Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 5 Feb 2025 15:27:48 +0100 Subject: [PATCH 3/8] :bug: Added upload svg with images method --- CHANGES.md | 1 + .../src/app/main/data/workspace/media.cljs | 21 +++++++++++++++++++ frontend/src/app/plugins/api.cljs | 19 +++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index b300b83bc..0264dbe4c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -57,6 +57,7 @@ is a number of cores) - Fix problem with multiple color changes [Taiga #9631](https://tree.taiga.io/project/penpot/issue/9631) - Fix problem in plugins with zoomIntoView [Plugins #189](https://github.com/penpot/penpot-plugins/issues/189) - Fix problem in plugins with renaming components [Taiga #10060](https://tree.taiga.io/project/penpot/issue/10060) +- Added upload svg with images method [#5489](https://github.com/penpot/penpot/issues/5489) ## 2.4.3 diff --git a/frontend/src/app/main/data/workspace/media.cljs b/frontend/src/app/main/data/workspace/media.cljs index dfebb5ab6..3a6be86c2 100644 --- a/frontend/src/app/main/data/workspace/media.cljs +++ b/frontend/src/app/main/data/workspace/media.cljs @@ -476,3 +476,24 @@ (rx/take 1) (rx/map #(svg/add-svg-shapes id % position {:ignore-selection? true :change-selection? false})))))) +(defn create-svg-shape-with-images + [file-id id name svg-string position on-success on-error] + (ptk/reify ::create-svg-shape-with-images + ptk/WatchEvent + (watch [_ _ _] + (->> (svg->clj [name svg-string]) + (rx/take 1) + (rx/mapcat + (fn [svg-data] + (->> (svg/upload-images svg-data file-id) + (rx/map #(assoc svg-data :image-data %))))) + (rx/map + (fn [svg-data] + (svg/add-svg-shapes + id + svg-data + position + {:ignore-selection? true + :change-selection? false}))) + (rx/tap on-success) + (rx/catch on-error))))) diff --git a/frontend/src/app/plugins/api.cljs b/frontend/src/app/plugins/api.cljs index e0cc93c36..9ce731f18 100644 --- a/frontend/src/app/plugins/api.cljs +++ b/frontend/src/app/plugins/api.cljs @@ -346,6 +346,25 @@ (st/emit! (dwm/create-svg-shape id "svg" svg-string (gpt/point 0 0))) (shape/shape-proxy plugin-id file-id page-id id)))) + :createShapeFromSvgWithImages + (fn [svg-string] + (js/Promise. + (fn [resolve reject] + (cond + (or (not (string? svg-string)) (empty? svg-string)) + (do + (u/display-not-valid :createShapeFromSvg "Svg not valid") + (reject "Svg not valid")) + + :else + (let [id (uuid/next) + file-id (:current-file-id @st/state) + page-id (:current-page-id @st/state)] + (st/emit! (dwm/create-svg-shape-with-images + file-id id "svg" svg-string (gpt/point 0 0) + #(resolve (shape/shape-proxy plugin-id file-id page-id id)) + reject))))))) + :createBoolean (fn [bool-type shapes] (let [bool-type (keyword bool-type)] From 7aa12378338c767558bdadc207ad322e96663fb0 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 5 Feb 2025 15:43:29 +0100 Subject: [PATCH 4/8] :bug: Fix problem with root frame parent reference --- CHANGES.md | 1 + frontend/src/app/plugins/shape.cljs | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 0264dbe4c..000c41513 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -58,6 +58,7 @@ is a number of cores) - Fix problem in plugins with zoomIntoView [Plugins #189](https://github.com/penpot/penpot-plugins/issues/189) - Fix problem in plugins with renaming components [Taiga #10060](https://tree.taiga.io/project/penpot/issue/10060) - Added upload svg with images method [#5489](https://github.com/penpot/penpot/issues/5489) +- Fix problem with root frame parent reference [Taiga #9437](https://tree.taiga.io/project/penpot/issue/9437) ## 2.4.3 diff --git a/frontend/src/app/plugins/shape.cljs b/frontend/src/app/plugins/shape.cljs index e23917d13..687d741c5 100644 --- a/frontend/src/app/plugins/shape.cljs +++ b/frontend/src/app/plugins/shape.cljs @@ -515,9 +515,10 @@ ;; not enumerable so there are no infinite loops :enumerable false :get (fn [self] - (let [shape (u/proxy->shape self) - parent-id (:parent-id shape)] - (shape-proxy plugin-id (obj/get self "$file") (obj/get self "$page") parent-id)))} + (let [shape (u/proxy->shape self)] + (when-not (cfh/root? shape) + (let [parent-id (:parent-id shape)] + (shape-proxy plugin-id (obj/get self "$file") (obj/get self "$page") parent-id)))))} :parentX {:this true From 508531cfc259d1020d67f9662e8ce68ab3b05aef Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 5 Feb 2025 15:54:44 +0100 Subject: [PATCH 5/8] :arrow_up: Update plugins runtime --- frontend/resources/plugins-runtime/index.js | 359 ++++++++++---------- 1 file changed, 181 insertions(+), 178 deletions(-) diff --git a/frontend/resources/plugins-runtime/index.js b/frontend/resources/plugins-runtime/index.js index c2b4e85d9..c51bb9dbf 100644 --- a/frontend/resources/plugins-runtime/index.js +++ b/frontend/resources/plugins-runtime/index.js @@ -3,7 +3,7 @@ var qn = (t) => { }; var Kn = (t, e, r) => e.has(t) || qn("Cannot " + r); var at = (t, e, r) => (Kn(t, e, "read from private field"), r ? r.call(t) : e.get(t)), tn = (t, e, r) => e.has(t) ? qn("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), fr = (t, e, r, n) => (Kn(t, e, "write to private field"), n ? n.call(t, r) : e.set(t, r), r); -const S = globalThis, { +const x = globalThis, { Array: na, ArrayBuffer: To, Date: oa, @@ -74,7 +74,7 @@ const S = globalThis, { return n; }, { apply: ue, - construct: xr, + construct: Sr, get: ya, getOwnPropertyDescriptor: _a, has: Oo, @@ -82,7 +82,7 @@ const S = globalThis, { ownKeys: qe, preventExtensions: ba, set: Mo -} = la, { isArray: pt, prototype: ve } = na, { prototype: Sr } = To, { prototype: jt } = $e, { prototype: Br } = RegExp, { prototype: cr } = Dt, { prototype: Ge } = _e, { prototype: Gr } = ze, { prototype: Lo } = Ut, { prototype: Vr } = Function, { prototype: Fo } = ca, { prototype: Do } = G( +} = la, { isArray: pt, prototype: ve } = na, { prototype: xr } = To, { prototype: jt } = $e, { prototype: Br } = RegExp, { prototype: cr } = Dt, { prototype: Ge } = _e, { prototype: Gr } = ze, { prototype: Lo } = Ut, { prototype: Vr } = Function, { prototype: Fo } = ca, { prototype: Do } = G( // eslint-disable-next-line no-empty-function, func-names function* () { } @@ -95,9 +95,9 @@ const S = globalThis, { ), jo = ( /** @type {any} */ P(ve.flatMap) -), Er = P(ve.pop), ne = P(ve.push), wa = P(ve.slice), Zo = P(ve.some), zo = P(ve.sort), xa = P(ve[De]), Sa = P(Sr.slice), Ea = P( +), Er = P(ve.pop), ne = P(ve.push), wa = P(ve.slice), Zo = P(ve.some), zo = P(ve.sort), Sa = P(ve[De]), xa = P(xr.slice), Ea = P( // @ts-expect-error we know it is there on all conforming platforms - ee(Sr, "byteLength").get + ee(xr, "byteLength").get ), ka = P(Uo.set), pe = P(jt.set), Ke = P(jt.get), Wr = P(jt.has), Pa = P(jt.delete), Aa = P(jt.entries), Ta = P(jt[De]), In = P(cr.add); P(cr.delete); const Yn = P(cr.forEach), Cn = P(cr.has), Ia = P(cr[De]), Rn = P(Br.test), $n = P(Br.exec), Ca = P(Br[$o]), Bo = P(Ge.endsWith), Go = P(Ge.includes), Ra = P(Ge.indexOf); @@ -404,7 +404,7 @@ const eo = new ze(), as = (t, e = t.name) => { }); } y(t); -}, Ce = (t = re`Assert failed`, e = S.Error, { +}, Ce = (t = re`Assert failed`, e = x.Error, { errorName: r = void 0, cause: n = void 0, errors: o = void 0, @@ -448,7 +448,7 @@ const Xa = (t) => { `); return Ho(e, " ") || r === -1 ? e : Nn(e, r + 1); }, Ir = { - getStackString: S.getStackString || Xa, + getStackString: x.getStackString || Xa, tagError: (t) => as(t), resetErrorTagNum: () => { yn = 0; @@ -532,8 +532,8 @@ const Qa = (t) => ue(cs, t, []) !== void 0, ei = (t) => { }); }); }, ri = () => { - if (typeof S.harden == "function") - return S.harden; + if (typeof x.harden == "function") + return x.harden; const t = new Ut(), { harden: e } = { /** * @template T @@ -752,7 +752,7 @@ function lt(t) { cause: !1 }; } -function xe(t) { +function Se(t) { return { // Properties of the TypedArray Constructors "[[Proto]]": "%TypedArray%", @@ -760,7 +760,7 @@ function xe(t) { prototype: t }; } -function Se(t) { +function xe(t) { return { // Properties of the TypedArray Prototype Objects "[[Proto]]": "%TypedArrayPrototype%", @@ -1471,39 +1471,39 @@ const so = { with: a }, // The TypedArray Constructors - BigInt64Array: xe("%BigInt64ArrayPrototype%"), - BigUint64Array: xe("%BigUint64ArrayPrototype%"), + BigInt64Array: Se("%BigInt64ArrayPrototype%"), + BigUint64Array: Se("%BigUint64ArrayPrototype%"), // https://github.com/tc39/proposal-float16array - Float16Array: xe("%Float16ArrayPrototype%"), - Float32Array: xe("%Float32ArrayPrototype%"), - Float64Array: xe("%Float64ArrayPrototype%"), - Int16Array: xe("%Int16ArrayPrototype%"), - Int32Array: xe("%Int32ArrayPrototype%"), - Int8Array: xe("%Int8ArrayPrototype%"), - Uint16Array: xe("%Uint16ArrayPrototype%"), - Uint32Array: xe("%Uint32ArrayPrototype%"), - Uint8ClampedArray: xe("%Uint8ClampedArrayPrototype%"), + Float16Array: Se("%Float16ArrayPrototype%"), + Float32Array: Se("%Float32ArrayPrototype%"), + Float64Array: Se("%Float64ArrayPrototype%"), + Int16Array: Se("%Int16ArrayPrototype%"), + Int32Array: Se("%Int32ArrayPrototype%"), + Int8Array: Se("%Int8ArrayPrototype%"), + Uint16Array: Se("%Uint16ArrayPrototype%"), + Uint32Array: Se("%Uint32ArrayPrototype%"), + Uint8ClampedArray: Se("%Uint8ClampedArrayPrototype%"), Uint8Array: { - ...xe("%Uint8ArrayPrototype%"), + ...Se("%Uint8ArrayPrototype%"), // https://github.com/tc39/proposal-arraybuffer-base64 fromBase64: a, // https://github.com/tc39/proposal-arraybuffer-base64 fromHex: a }, - "%BigInt64ArrayPrototype%": Se("BigInt64Array"), - "%BigUint64ArrayPrototype%": Se("BigUint64Array"), + "%BigInt64ArrayPrototype%": xe("BigInt64Array"), + "%BigUint64ArrayPrototype%": xe("BigUint64Array"), // https://github.com/tc39/proposal-float16array - "%Float16ArrayPrototype%": Se("Float16Array"), - "%Float32ArrayPrototype%": Se("Float32Array"), - "%Float64ArrayPrototype%": Se("Float64Array"), - "%Int16ArrayPrototype%": Se("Int16Array"), - "%Int32ArrayPrototype%": Se("Int32Array"), - "%Int8ArrayPrototype%": Se("Int8Array"), - "%Uint16ArrayPrototype%": Se("Uint16Array"), - "%Uint32ArrayPrototype%": Se("Uint32Array"), - "%Uint8ClampedArrayPrototype%": Se("Uint8ClampedArray"), + "%Float16ArrayPrototype%": xe("Float16Array"), + "%Float32ArrayPrototype%": xe("Float32Array"), + "%Float64ArrayPrototype%": xe("Float64Array"), + "%Int16ArrayPrototype%": xe("Int16Array"), + "%Int32ArrayPrototype%": xe("Int32Array"), + "%Int8ArrayPrototype%": xe("Int8Array"), + "%Uint16ArrayPrototype%": xe("Uint16Array"), + "%Uint32ArrayPrototype%": xe("Uint32Array"), + "%Uint8ClampedArrayPrototype%": xe("Uint8ClampedArray"), "%Uint8ArrayPrototype%": { - ...Se("Uint8Array"), + ...xe("Uint8Array"), // https://github.com/tc39/proposal-arraybuffer-base64 setFromBase64: a, // https://github.com/tc39/proposal-arraybuffer-base64 @@ -2031,7 +2031,7 @@ const ms = (t) => { finalIntrinsics: s, isPseudoNative: i }; - return y(c), n(us), n(hs(S, ds)), c; + return y(c), n(us), n(hs(x, ds)), c; }, ii = (t, e) => { const { addIntrinsics: r, finalIntrinsics: n } = ms(e); return r(hs(t, fs)), n(); @@ -2123,7 +2123,7 @@ function ci(t, e, r) { const m = p["[[Proto]]"]; i(f, h, m), typeof h == "function" && e(h); for (const A of qe(h)) { - const x = s(f, A), w = `${f}.${x}`, R = u(h, p, x); + const S = s(f, A), w = `${f}.${S}`, R = u(h, p, S); (!R || !l(w, h, A, R)) && ls(h, A, R === !1, w, r); } } @@ -2190,7 +2190,7 @@ function ui(t = "safe") { }, o = ({ powers: c = "none" } = {}) => { let l; return c === "original" ? l = function(...d) { - return new.target === void 0 ? ue(e, void 0, d) : xr(e, d, new.target); + return new.target === void 0 ? ue(e, void 0, d) : Sr(e, d, new.target); } : l = function(...d) { if (new.target === void 0) throw _( @@ -2200,7 +2200,7 @@ function ui(t = "safe") { throw _( "secure mode Calling new %SharedDate%() with no arguments throws" ); - return xr(e, d, new.target); + return Sr(e, d, new.target); }, B(l, { length: { value: 7 }, prototype: { @@ -2274,7 +2274,7 @@ function fi(t = "safe") { throw _(`unrecognized regExpTaming ${t}`); const e = Xe.prototype, r = (s = {}) => { const i = function(...l) { - return new.target === void 0 ? Xe(...l) : xr(Xe, l, new.target); + return new.target === void 0 ? Xe(...l) : Sr(Xe, l, new.target); }; if (B(i, { length: { value: 2 }, @@ -2479,7 +2479,7 @@ function mi(t, e, { warn: r }, n = []) { const o = new Dt(n); function s(d, f, h, p) { if ("value" in p && p.configurable) { - const { value: m } = p, A = Cn(o, h), { get: x, set: w } = ee( + const { value: m } = p, A = Cn(o, h), { get: S, set: w } = ee( { get [h]() { return m; @@ -2501,13 +2501,13 @@ function mi(t, e, { warn: r }, n = []) { }, h ); - D(x, "originalValue", { + D(S, "originalValue", { value: m, writable: !1, enumerable: !1, configurable: !1 }), D(f, h, { - get: x, + get: S, set: w, enumerable: p.enumerable, configurable: p.configurable @@ -2527,13 +2527,13 @@ function mi(t, e, { warn: r }, n = []) { const m = ee(f, p); if (!m || m.get || m.set) continue; - const A = `${d}.${_e(p)}`, x = h[p]; - if (x === !0) + const A = `${d}.${_e(p)}`, S = h[p]; + if (S === !0) i(A, f, p); - else if (x === "*") + else if (S === "*") c(A, m.value); - else if (ke(x)) - l(A, m.value, x); + else if (ke(S)) + l(A, m.value, S); else throw _(`Unexpected override enablement plan ${A}`); } @@ -2619,7 +2619,7 @@ ${o} configurable: !1 } }), G(Ee) === Ee.prototype || ao`Function prototype is the same accross compartments`, G(e) === Ee.prototype || ao`Function constructor prototype is the same accross compartments`, e; -}, xi = (t) => { +}, Si = (t) => { D( t, fa, @@ -2701,11 +2701,11 @@ ${o} configurable: !0 }); } -}, { Fail: Si, quote: bs } = Y, ws = new Ur( +}, { Fail: xi, quote: bs } = Y, ws = new Ur( Mn, y({ get(t, e) { - Si`Please report unexpected scope handler trap: ${bs(_e(e))}`; + xi`Please report unexpected scope handler trap: ${bs(_e(e))}`; } }) ), Ei = { @@ -2715,7 +2715,7 @@ ${o} throw Wt(`${_e(e)} is not defined`); }, has(t, e) { - return e in S; + return e in x; }, // note: this is likely a bug of safari // https://bugs.webkit.org/show_bug.cgi?id=195534 @@ -2736,18 +2736,18 @@ ${o} ownKeys(t) { return []; } -}, xs = y( +}, Ss = y( H( ws, Be(Ei) ) ), ki = new Ur( Mn, - xs -), Ss = (t) => { + Ss +), xs = (t) => { const e = { // inherit scopeTerminator behavior - ...xs, + ...Ss, // Redirect set properties to the globalObject. set(o, s, i) { return Mo(t, s, i); @@ -2767,7 +2767,7 @@ ${o} r ); }; -y(Ss); +y(xs); const { Fail: Pi } = Y, Ai = () => { const t = H(null), e = y({ eval: { @@ -2978,7 +2978,7 @@ const Ni = (t) => { globalTransforms: r = [], sloppyGlobalsMode: n = !1 }) => { - const o = n ? Ss(t) : ki, s = Ai(), { evalScope: i } = s, c = y({ + const o = n ? xs(t) : ki, s = Ai(), { evalScope: i } = s, c = y({ evalScope: i, moduleLexicals: e, globalObject: t, @@ -3028,7 +3028,7 @@ function Li(t = "safe") { throw _(`unrecognized domainTaming ${t}`); if (t === "unsafe") return; - const e = S.process || void 0; + const e = x.process || void 0; if (typeof e == "object") { const r = ee(e, "domain"); if (r !== void 0 && r.get !== void 0) @@ -3044,7 +3044,7 @@ function Li(t = "safe") { } } const Fi = () => { - const t = {}, e = S.ModuleSource; + const t = {}, e = x.ModuleSource; if (e !== void 0) { let n = function() { }; @@ -3142,38 +3142,38 @@ y(dt); const zn = (t, e) => { if (!t) return; - const { getStackString: r, tagError: n, takeMessageLogArgs: o, takeNoteLogArgsArray: s } = e, i = (x, w) => de(x, (T) => Kr(T) ? (ne(w, T), `(${n(T)})`) : T), c = (x, w, R, T, j) => { + const { getStackString: r, tagError: n, takeMessageLogArgs: o, takeNoteLogArgsArray: s } = e, i = (S, w) => de(S, (T) => Kr(T) ? (ne(w, T), `(${n(T)})`) : T), c = (S, w, R, T, j) => { const I = n(w), L = R === dt.MESSAGE ? `${I}:` : `${I} ${R}`, Z = i(T, j); - t[x](L, ...Z); - }, l = (x, w, R = void 0) => { + t[S](L, ...Z); + }, l = (S, w, R = void 0) => { if (w.length === 0) return; if (w.length === 1 && R === void 0) { - f(x, w[0]); + f(S, w[0]); return; } let T; w.length === 1 ? T = "Nested error" : T = `Nested ${w.length} errors`, R !== void 0 && (T = `${T} under ${R}`), t.group(T); try { for (const j of w) - f(x, j); + f(S, j); } finally { t.groupEnd(); } - }, u = new Ut(), d = (x) => (w, R) => { + }, u = new Ut(), d = (S) => (w, R) => { const T = []; - c(x, w, dt.NOTE, R, T), l(x, T, n(w)); - }, f = (x, w) => { + c(S, w, dt.NOTE, R, T), l(S, T, n(w)); + }, f = (S, w) => { if (lr(u, w)) return; const R = n(w); qr(u, w); const T = [], j = o(w), I = s( w, - d(x) + d(S) ); - j === void 0 ? t[x](`${R}:`, w.message) : c( - x, + j === void 0 ? t[S](`${R}:`, w.message) : c( + S, w, dt.MESSAGE, j, @@ -3182,24 +3182,24 @@ const zn = (t, e) => { let L = r(w); typeof L == "string" && L.length >= 1 && !Bo(L, ` `) && (L += ` -`), t[x](L), w.cause && c(x, w, dt.CAUSE, [w.cause], T), w.errors && c(x, w, dt.ERRORS, w.errors, T); +`), t[S](L), w.cause && c(S, w, dt.CAUSE, [w.cause], T), w.errors && c(S, w, dt.ERRORS, w.errors, T); for (const Z of I) - c(x, w, dt.NOTE, Z, T); - l(x, T, R); - }, h = de(jn, ([x, w]) => { + c(S, w, dt.NOTE, Z, T); + l(S, T, R); + }, h = de(jn, ([S, w]) => { const R = (...T) => { const j = [], I = i(T, j); - t[x] && t[x](...I), l(x, j); + t[S] && t[S](...I), l(S, j); }; - return D(R, "name", { value: x }), [x, y(R)]; + return D(R, "name", { value: S }), [S, y(R)]; }), p = et( Zn, - ([x, w]) => x in t - ), m = de(p, ([x, w]) => { + ([S, w]) => S in t + ), m = de(p, ([S, w]) => { const R = (...T) => { - t[x](...T); + t[S](...T); }; - return D(R, "name", { value: x }), [x, y(R)]; + return D(R, "name", { value: S }), [S, y(R)]; }), A = bt([...h, ...m]); return ( /** @type {VirtualConsole} */ @@ -3293,13 +3293,13 @@ const fo = (t) => { const s = ( /** @type {VirtualConsole} */ // eslint-disable-next-line no-nested-ternary - typeof S.console < "u" ? S.console : typeof S.print == "function" ? ( + typeof x.console < "u" ? x.console : typeof x.print == "function" ? ( // Make a good-enough console for eshost (including only functions that // log at a specific level with no special argument interpretation). // https://console.spec.whatwg.org/#logging ((u) => y({ debug: u, log: u, info: u, warn: u, error: u }))( // eslint-disable-next-line no-undef - po(S.print) + po(x.print) ) ) : void 0 ); @@ -3311,7 +3311,7 @@ const fo = (t) => { const i = ( /** @type {VirtualConsole} */ t === "unsafe" ? s : zn(s, o) - ), c = S.process || void 0; + ), c = x.process || void 0; if (e !== "none" && typeof c == "object" && typeof c.on == "function") { let u; if (e === "platform" || e === "exit") { @@ -3328,7 +3328,7 @@ const fo = (t) => { }); d && (c.on("unhandledRejection", d.unhandledRejectionHandler), c.on("rejectionHandled", d.rejectionHandledHandler), c.on("exit", d.processTerminationHandler)); } - const l = S.window || void 0; + const l = x.window || void 0; if (e !== "none" && typeof l == "object" && typeof l.addEventListener == "function" && l.addEventListener("error", (u) => { u.preventDefault(), i.error("SES_UNCAUGHT_EXCEPTION:", u.error), (e === "exit" || e === "abort") && (l.location.href = "about:blank"); }), r !== "none" && typeof l == "object" && typeof l.addEventListener == "function") { @@ -3444,8 +3444,8 @@ const fo = (t) => { if (lr(f, p)) return p; const m = { - prepareStackTrace(A, x) { - return he(l, A, { callSites: x }), p(A, Gi(x)); + prepareStackTrace(A, S) { + return he(l, A, { callSites: S }), p(A, Gi(S)); } }; return qr(f, m.prepareStackTrace), m.prepareStackTrace; @@ -3486,7 +3486,7 @@ function nc(t = "safe", e = "concise") { const r = le.prototype, { captureStackTrace: n } = le, o = typeof n == "function" ? "v8" : "unknown", s = (l = {}) => { const u = function(...f) { let h; - return new.target === void 0 ? h = ue(le, this, f) : h = xr(le, f, new.target), o === "v8" && ue(n, le, [h, u]), h; + return new.target === void 0 ? h = ue(le, this, f) : h = Sr(le, f, new.target), o === "v8" && ue(n, le, [h, u]), h; }; return B(u, { length: { value: 1 }, @@ -3850,7 +3850,7 @@ function* lc(t, e, r, n, o, s, i) { ); return pe(f, n, w), w; } - const x = Bt( + const S = Bt( t, e, r, @@ -3860,7 +3860,7 @@ function* lc(t, e, r, n, o, s, i) { s, i ); - return pe(f, n, x), x; + return pe(f, n, S), S; } else throw Ce( re`module descriptor must be a string or object for specifier ${U( @@ -3967,7 +3967,7 @@ const It = (t, e, r, n, o, s, i) => { o )}` }); -}, { quote: St } = Y, hc = () => { +}, { quote: xt } = Y, hc = () => { let t = !1; const e = H(null, { // Make this appear like an ESM module namespace object. @@ -3987,7 +3987,7 @@ const It = (t, e, r, n, o, s, i) => { get(r, n, o) { if (!t) throw _( - `Cannot get property ${St( + `Cannot get property ${xt( n )} of module exports namespace, the module has not yet begun to execute` ); @@ -3995,13 +3995,13 @@ const It = (t, e, r, n, o, s, i) => { }, set(r, n, o) { throw _( - `Cannot set property ${St(n)} of module exports namespace` + `Cannot set property ${xt(n)} of module exports namespace` ); }, has(r, n) { if (!t) throw _( - `Cannot check property ${St( + `Cannot check property ${xt( n )}, the module has not yet begun to execute` ); @@ -4009,7 +4009,7 @@ const It = (t, e, r, n, o, s, i) => { }, deleteProperty(r, n) { throw _( - `Cannot delete property ${St(n)}s of module exports namespace` + `Cannot delete property ${xt(n)}s of module exports namespace` ); }, ownKeys(r) { @@ -4022,7 +4022,7 @@ const It = (t, e, r, n, o, s, i) => { getOwnPropertyDescriptor(r, n) { if (!t) throw _( - `Cannot get own property descriptor ${St( + `Cannot get own property descriptor ${xt( n )}, the module has not yet begun to execute` ); @@ -4050,7 +4050,7 @@ const It = (t, e, r, n, o, s, i) => { }, defineProperty(r, n, o) { throw _( - `Cannot define property ${St(n)} of module exports namespace` + `Cannot define property ${xt(n)} of module exports namespace` ); }, apply(r, n, o) { @@ -4131,15 +4131,15 @@ const It = (t, e, r, n, o, s, i) => { const p = []; D(c, f, { get: () => h, - set: (x) => { - h = x; + set: (S) => { + h = S; for (const w of p) - w(x); + w(S); }, enumerable: !0, configurable: !1 - }), u[f] = (x) => { - ne(p, x), x(h); + }), u[f] = (S) => { + ne(p, S), S(h); }; }), u["*"] = (f) => { f(c); @@ -4178,7 +4178,7 @@ const It = (t, e, r, n, o, s, i) => { __reexportMap__: h = {}, __needsImportMeta__: p = !1, __syncModuleFunctor__: m - } = i, A = z(t, o), { __shimTransforms__: x, importMetaHook: w } = A, { exportsProxy: R, exportsTarget: T, activate: j } = Bn( + } = i, A = z(t, o), { __shimTransforms__: S, importMetaHook: w } = A, { exportsProxy: R, exportsTarget: T, activate: j } = Bn( o, A, e, @@ -4231,7 +4231,7 @@ const It = (t, e, r, n, o, s, i) => { `binding ${mr(we)} not yet initialized` ); return ie; - }, xt = y((Ie) => { + }, St = y((Ie) => { ie = Ie, ge = !1; for (const en of te) en(Ie); @@ -4245,14 +4245,14 @@ const It = (t, e, r, n, o, s, i) => { ae = { get: Ae, notify: (Ie) => { - Ie !== xt && (ne(te, Ie), ge || Ie(ie)); + Ie !== St && (ne(te, Ie), ge || Ie(ie)); } }, be[W] = ae, q && D(L, W, { get: Ae, set: Te, enumerable: !0, configurable: !1 - }), se[W] = xt; + }), se[W] = St; } I[we] = { get: ae.get, @@ -4274,13 +4274,13 @@ const It = (t, e, r, n, o, s, i) => { ie.execute(); const { notifiers: ge } = ie; for (const [te, Ae] of ae) { - const xt = ge[te]; - if (!xt) + const St = ge[te]; + if (!St) throw ir( `The requested module '${q}' does not provide an export named '${te}'` ); for (const Te of Ae) - xt(Te); + St(Te); } if (Hr(l, q)) for (const [te, Ae] of me( @@ -4312,7 +4312,7 @@ const It = (t, e, r, n, o, s, i) => { let wt; m !== void 0 ? wt = m : wt = Fs(A, u, { globalObject: o.globalThis, - transforms: x, + transforms: S, __moduleShimLexicals__: L }); let Pe = !1, st; @@ -4352,7 +4352,7 @@ const It = (t, e, r, n, o, s, i) => { o )}` ); - return Sc(t, e, i); + return xc(t, e, i); }; function _c(t) { return typeof t.__syncModuleProgram__ == "string"; @@ -4374,7 +4374,7 @@ function wc(t, e) { r )}, for module ${X(e)}`; } -function xc(t, e) { +function Sc(t, e) { ke(t) || ft`Invalid module source: must be of type object, got ${X( t )}, for module ${X(e)}`; @@ -4387,11 +4387,11 @@ function xc(t, e) { o )}, for module ${X(e)}`; } -const Sc = (t, e, r) => { +const xc = (t, e, r) => { const { compartment: n, moduleSpecifier: o, resolvedImports: s, moduleSource: i } = r, { instances: c } = z(t, n); if (Wr(c, o)) return Ke(c, o); - xc(i, o); + Sc(i, o); const l = new $e(); let u; if (_c(i)) @@ -4545,7 +4545,7 @@ const Ec = (...t) => { modules: r }; } -}, xn = (t, e, r, n = void 0) => { +}, Sn = (t, e, r, n = void 0) => { function o(...s) { if (new.target === void 0) throw _( @@ -4562,9 +4562,9 @@ const Ec = (...t) => { importNowHook: p, moduleMapHook: m, importMetaHook: A, - __noNamespaceBox__: x = !1 + __noNamespaceBox__: S = !1 } = Ec(...s), w = [...c, ...l], R = { __proto__: null, ...u }, T = { __proto__: null, ...d }, j = new $e(), I = new $e(), L = new $e(), Z = {}; - xi(Z), _s(Z); + Si(Z), _s(Z); const { safeEvaluate: se } = Un({ globalObject: Z, globalTransforms: w, @@ -4596,7 +4596,7 @@ const Ec = (...t) => { deferredExports: L, instances: I, parentCompartment: n, - noNamespaceBox: x + noNamespaceBox: S }); } return o.prototype = Vn, o; @@ -4608,10 +4608,10 @@ function kc() { return arguments; } const Pc = () => { - const t = Ee.prototype.constructor, e = ee(kc(), "callee"), r = e && e.get, n = Na(new _e()), o = G(n), s = Br[$o] && Ca(/./), i = s && G(s), c = xa([]), l = G(c), u = G(sa), d = Ta(new $e()), f = G(d), h = Ia(new Dt()), p = G(h), m = G(l); + const t = Ee.prototype.constructor, e = ee(kc(), "callee"), r = e && e.get, n = Na(new _e()), o = G(n), s = Br[$o] && Ca(/./), i = s && G(s), c = Sa([]), l = G(c), u = G(sa), d = Ta(new $e()), f = G(d), h = Ia(new Dt()), p = G(h), m = G(l); function* A() { } - const x = dn(A), w = x.prototype; + const S = dn(A), w = S.prototype; async function* R() { } const T = dn( @@ -4628,7 +4628,7 @@ const Pc = () => { "%AsyncGeneratorPrototype%": I, "%AsyncIteratorPrototype%": L, "%Generator%": w, - "%InertGeneratorFunction%": x, + "%InertGeneratorFunction%": S, "%IteratorPrototype%": m, "%MapIteratorPrototype%": f, "%RegExpStringIteratorPrototype%": i, @@ -4638,22 +4638,22 @@ const Pc = () => { "%TypedArray%": u, "%InertCompartment%": Gn }; - return S.Iterator && (J["%IteratorHelperPrototype%"] = G( + return x.Iterator && (J["%IteratorHelperPrototype%"] = G( // eslint-disable-next-line @endo/no-polymorphic-call - S.Iterator.from([]).take(0) + x.Iterator.from([]).take(0) ), J["%WrapForValidIteratorPrototype%"] = G( // eslint-disable-next-line @endo/no-polymorphic-call - S.Iterator.from({ + x.Iterator.from({ next() { return { value: void 0 }; } }) - )), S.AsyncIterator && (J["%AsyncIteratorHelperPrototype%"] = G( + )), x.AsyncIterator && (J["%AsyncIteratorHelperPrototype%"] = G( // eslint-disable-next-line @endo/no-polymorphic-call - S.AsyncIterator.from([]).take(0) + x.AsyncIterator.from([]).take(0) ), J["%WrapForValidAsyncIteratorPrototype%"] = G( // eslint-disable-next-line @endo/no-polymorphic-call - S.AsyncIterator.from({ next() { + x.AsyncIterator.from({ next() { } }) )), J; }, Us = (t, e) => { @@ -4734,10 +4734,10 @@ const Ac = () => { } }); }, Rc = () => { - if (typeof Sr.transfer == "function") + if (typeof xr.transfer == "function") return {}; - const t = S.structuredClone; - return typeof t != "function" ? {} : (D(Sr, "transfer", { + const t = x.structuredClone; + return typeof t != "function" ? {} : (D(xr, "transfer", { // @ts-expect-error value: { /** @@ -4753,7 +4753,7 @@ const Ac = () => { const o = new To(r), s = new mn(this), i = new mn(o); return ka(i, s), t(this, { transfer: [this] }), o; } else { - const o = Sa(this, 0, r); + const o = xa(this, 0, r); return t(this, { transfer: [this] }), o; } } @@ -4790,13 +4790,13 @@ const Ac = () => { return gr(vo); if (t !== "platform" && t !== "console") throw new _(`Invalid lockdown reporting option: ${t}`); - if (t === "console" || S.window === S || S.importScripts !== void 0) + if (t === "console" || x.window === x || x.importScripts !== void 0) return console; - if (S.console !== void 0) { - const e = S.console, r = Wo(e.error, e); + if (x.console !== void 0) { + const e = x.console, r = Wo(e.error, e); return gr(r); } - return S.print !== void 0 ? gr(S.print) : gr(vo); + return x.print !== void 0 ? gr(x.print) : gr(vo); }, bo = (t, e, r) => { const { warn: n, error: o, groupCollapsed: s, groupEnd: i } = e; let c = !1; @@ -4823,7 +4823,7 @@ const $c = ri(), Nc = () => { ` eval("SES_changed = true"); return SES_changed; ` - )(Ko, !1), t || delete S.SES_changed; + )(Ko, !1), t || delete x.SES_changed; } catch { t = !0; } @@ -4871,7 +4871,7 @@ const $c = ri(), Nc = () => { __hardenTaming__: m = ce("LOCKDOWN_HARDEN_TAMING", "safe"), dateTaming: A = "safe", // deprecated - mathTaming: x = "safe", + mathTaming: S = "safe", // deprecated ...w } = t; @@ -4883,20 +4883,20 @@ const $c = ri(), Nc = () => { Y.fail( wo`Already locked down at ${yr} (SES_ALREADY_LOCKED_DOWN)`, _ - ), yr = _("Prior lockdown (SES_ALREADY_LOCKED_DOWN)"), yr.stack, Nc(), S.Function.prototype.constructor !== S.Function && // @ts-ignore harden is absent on globalThis type def. - typeof S.harden == "function" && // @ts-ignore lockdown is absent on globalThis type def. - typeof S.lockdown == "function" && S.Date.prototype.constructor !== S.Date && typeof S.Date.now == "function" && // @ts-ignore does not recognize that Date constructor is a special + ), yr = _("Prior lockdown (SES_ALREADY_LOCKED_DOWN)"), yr.stack, Nc(), x.Function.prototype.constructor !== x.Function && // @ts-ignore harden is absent on globalThis type def. + typeof x.harden == "function" && // @ts-ignore lockdown is absent on globalThis type def. + typeof x.lockdown == "function" && x.Date.prototype.constructor !== x.Date && typeof x.Date.now == "function" && // @ts-ignore does not recognize that Date constructor is a special // Function. // eslint-disable-next-line @endo/no-polymorphic-call - Zr(S.Date.prototype.constructor.now(), NaN)) + Zr(x.Date.prototype.constructor.now(), NaN)) throw _( "Already locked down but not by this SES instance (SES_MULTIPLE_INSTANCES)" ); Li(d); const I = Ns(), { addIntrinsics: L, completePrototypes: Z, finalIntrinsics: se } = ms(T), J = Us($c, m); - L({ harden: J }), L(li()), L(ui(A)), L(nc(e, u)), L(di(x)), L(fi(s)), L(Ac()), L(Rc()), L(Fi()), L(Pc()), Z(); + L({ harden: J }), L(li()), L(ui(A)), L(nc(e, u)), L(di(S)), L(fi(s)), L(Ac()), L(Rc()), L(Fi()), L(Pc()), Z(); const be = se(), Me = { __proto__: null }; - typeof S.Buffer == "function" && (Me.Buffer = S.Buffer); + typeof x.Buffer == "function" && (Me.Buffer = x.Buffer); let dr; e === "safe" && (dr = be["%InitialGetStackString%"]); const zt = Zi( @@ -4905,13 +4905,13 @@ const $c = ri(), Nc = () => { o, dr ); - if (S.console = /** @type {Console} */ + if (x.console = /** @type {Console} */ zt.console, typeof /** @type {any} */ zt.console._times == "object" && (Me.SafeMap = G( // eslint-disable-next-line no-underscore-dangle /** @type {any} */ zt.console._times - )), (e === "unsafe" || e === "unsafe-debug") && S.assert === Y && (S.assert = Xr(void 0, !0)), vi(be, i), Ic(be), bo( + )), (e === "unsafe" || e === "unsafe-debug") && x.assert === Y && (x.assert = Xr(void 0, !0)), vi(be, i), Ic(be), bo( "SES Removing unpermitted intrinsics", T, (Pe) => ci( @@ -4919,21 +4919,21 @@ const $c = ri(), Nc = () => { I, Pe ) - ), _s(S), vs(S, { + ), _s(x), vs(x, { intrinsics: be, newGlobalPropertyNames: ro, - makeCompartmentConstructor: xn, + makeCompartmentConstructor: Sn, markVirtualizedNativeFunction: I }), f === "noEval") wn( - S, + x, Fa, I ); else if (f === "safeEval") { - const { safeEvaluate: Pe } = Un({ globalObject: S }); + const { safeEvaluate: Pe } = Un({ globalObject: x }); wn( - S, + x, Pe, I ); @@ -4960,43 +4960,43 @@ const $c = ri(), Nc = () => { hostIntrinsics: Me, globals: { // Harden evaluators - Function: S.Function, - eval: S.eval, + Function: x.Function, + eval: x.eval, // @ts-ignore Compartment does exist on globalThis - Compartment: S.Compartment, + Compartment: x.Compartment, // Harden Symbol - Symbol: S.Symbol + Symbol: x.Symbol } }; for (const st of Nt(ro)) - Pe.globals[st] = S[st]; + Pe.globals[st] = x[st]; return J(Pe), J; }; }; -S.lockdown = (t) => { +x.lockdown = (t) => { const e = Zs(t); - S.harden = e(); + x.harden = e(); }; -S.repairIntrinsics = (t) => { +x.repairIntrinsics = (t) => { const e = Zs(t); - S.hardenIntrinsics = () => { - S.harden = e(); + x.hardenIntrinsics = () => { + x.harden = e(); }; }; const Oc = Ns(), Mc = js("none"); -S.Compartment = xn( - xn, +x.Compartment = Sn( + Sn, // Any reporting that would need to be done should have already been done // during `lockdown()`. // See https://github.com/endojs/endo/pull/2624#discussion_r1840979770 - ii(S, Mc), + ii(x, Mc), Oc ); -S.assert = Y; +x.assert = Y; const Lc = Ms(Ir), Fc = ha( "MAKE_CAUSAL_CONSOLE_FROM_LOGGER_KEY_FOR_SES_AVA" ); -S[Fc] = Lc; +x[Fc] = Lc; const Dc = (t, e = t, r) => { let n = { x: 0, y: 0 }, o = { x: 0, y: 0 }, s = { x: 0, y: 0 }; const i = (u) => { @@ -5144,14 +5144,14 @@ var F; } t.joinValues = n, t.jsonStringifyReplacer = (o, s) => typeof s == "bigint" ? s.toString() : s; })(F || (F = {})); -var Sn; +var xn; (function(t) { t.mergeShapes = (e, r) => ({ ...e, ...r // second overwrites first }); -})(Sn || (Sn = {})); +})(xn || (xn = {})); const b = F.arrayToEnum([ "string", "nan", @@ -5439,7 +5439,7 @@ class je { return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath; } } -const xo = (t, e) => { +const So = (t, e) => { if (yt(e)) return { success: !0, data: e.value }; if (!t.common.issues.length) @@ -5526,7 +5526,7 @@ class O { data: e, parsedType: He(e) }, s = this._parseSync({ data: e, path: o.path, parent: o }); - return xo(o, s); + return So(o, s); } "~validate"(e) { var r, n; @@ -5580,7 +5580,7 @@ class O { data: e, parsedType: He(e) }, o = this._parse({ data: e, path: n.path, parent: n }), s = await (qt(o) ? o : Promise.resolve(o)); - return xo(n, s); + return So(n, s); } refine(e, r) { const n = (o) => typeof r == "string" || typeof r > "u" ? { message: r } : typeof r == "function" ? r(o) : r; @@ -7938,7 +7938,7 @@ var C; })(C || (C = {})); const ml = (t, e = { message: `Input not instance of ${t.name}` -}) => Ks((r) => r instanceof t, e), Ys = Re.create, Js = tt.create, gl = Dr.create, yl = rt.create, Xs = Kt.create, _l = _t.create, vl = Mr.create, bl = Yt.create, wl = Jt.create, xl = Lt.create, Sl = mt.create, El = Ye.create, kl = Lr.create, Pl = Ne.create, Al = V.create, Tl = V.strictCreate, Il = Xt.create, Cl = Qr.create, Rl = Qt.create, $l = Ze.create, Nl = er.create, Ol = Fr.create, Ml = vt.create, Ll = Ct.create, Fl = tr.create, Dl = rr.create, Ul = nt.create, jl = nr.create, Zl = Ft.create, So = Oe.create, zl = Ue.create, Bl = ot.create, Gl = Oe.createWithPreprocess, Vl = ur.create, Hl = () => Ys().optional(), Wl = () => Js().optional(), ql = () => Xs().optional(), Kl = { +}) => Ks((r) => r instanceof t, e), Ys = Re.create, Js = tt.create, gl = Dr.create, yl = rt.create, Xs = Kt.create, _l = _t.create, vl = Mr.create, bl = Yt.create, wl = Jt.create, Sl = Lt.create, xl = mt.create, El = Ye.create, kl = Lr.create, Pl = Ne.create, Al = V.create, Tl = V.strictCreate, Il = Xt.create, Cl = Qr.create, Rl = Qt.create, $l = Ze.create, Nl = er.create, Ol = Fr.create, Ml = vt.create, Ll = Ct.create, Fl = tr.create, Dl = rr.create, Ul = nt.create, jl = nr.create, Zl = Ft.create, xo = Oe.create, zl = Ue.create, Bl = ot.create, Gl = Oe.createWithPreprocess, Vl = ur.create, Hl = () => Ys().optional(), Wl = () => Js().optional(), ql = () => Xs().optional(), Kl = { string: (t) => Re.create({ ...t, coerce: !0 }), number: (t) => tt.create({ ...t, coerce: !0 }), boolean: (t) => Kt.create({ @@ -7968,7 +7968,7 @@ var K = /* @__PURE__ */ Object.freeze({ return F; }, get objectUtil() { - return Sn; + return xn; }, ZodParsedType: b, getParsedType: He, @@ -8020,13 +8020,13 @@ var K = /* @__PURE__ */ Object.freeze({ return C; }, coerce: Kl, - any: xl, + any: Sl, array: Pl, bigint: yl, boolean: Xs, date: _l, discriminatedUnion: Cl, - effect: So, + effect: xo, enum: Ul, function: Ll, instanceof: ml, @@ -8053,11 +8053,11 @@ var K = /* @__PURE__ */ Object.freeze({ strictObject: Tl, string: Ys, symbol: vl, - transformer: So, + transformer: xo, tuple: $l, undefined: bl, union: Il, - unknown: Sl, + unknown: xl, void: kl, NEVER: Yl, ZodIssueCode: g, @@ -8129,7 +8129,7 @@ async function eu(t, e, r, n) { }), l = [], p = []; }, A = () => { m(), u.forEach(clearTimeout), u.clear(), c && (c.removeEventListener("close", A), c.remove(), c = null), i = !0, r(); - }, x = async () => { + }, S = async () => { if (!s) { s = !0; return; @@ -8139,7 +8139,7 @@ async function eu(t, e, r, n) { const se = t.theme, J = Qs(e.host, L); (c == null ? void 0 : c.getAttribute("iframe-src")) !== J && (c = Ql(I, J, se, Z, d), c.setTheme(se), c.addEventListener("close", A, { once: !0 - }), c.addEventListener("load", x)); + }), c.addEventListener("load", S)); }, R = (I) => { l.push(I); }, T = (I, L, Z) => { @@ -8326,6 +8326,9 @@ function ru(t) { createShapeFromSvg(n) { return e("content:write"), t.context.createShapeFromSvg(n); }, + createShapeFromSvgWithImages(n) { + return e("content:write"), t.context.createShapeFromSvgWithImages(n); + }, group(n) { return e("content:write"), t.context.group(n); }, From 3012ccf90a2d5c74aad900c1dd66123ddb293b1e Mon Sep 17 00:00:00 2001 From: Alonso Torres Date: Wed, 5 Feb 2025 17:48:41 +0100 Subject: [PATCH 6/8] :bug: Fix problem with email notifications on deleted comments (#5772) --- frontend/src/app/main/data/workspace/comments.cljs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/main/data/workspace/comments.cljs b/frontend/src/app/main/data/workspace/comments.cljs index 2ccacdece..d88422177 100644 --- a/frontend/src/app/main/data/workspace/comments.cljs +++ b/frontend/src/app/main/data/workspace/comments.cljs @@ -207,12 +207,14 @@ ptk/WatchEvent (watch [_ state _] (rx/concat - (rx/of - (rt/nav :workspace - (-> (rt/get-params state) - (assoc :page-id (:page-id thread)) - (dissoc :comment-id)) - {::rt/replace true})) + (if (some? thread) + (rx/of + (rt/nav :workspace + (-> (rt/get-params state) + (assoc :page-id (:page-id thread)) + (dissoc :comment-id)) + {::rt/replace true})) + (rx/empty)) (->> (rx/of (dwd/select-for-drawing :comments) (center-to-comment-thread thread) From c774592b9ea2c5a8363d7b9d55f1b1aef46d262e Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Wed, 5 Feb 2025 19:11:44 +0100 Subject: [PATCH 7/8] :bug: Fix several bugs for the combination of status and share on workspace (#5773) * :sparkles: Add status notification bubble * :sparkles: Add file persistance functionality * :sparkles: Add new colors * :sparkles: Add status tooltips * :sparkles: Fix z-index share modal * :bug: Fix share modal doesn't register on workspace * :lipstick: Fix files formatting * :sparkles: Add revision fixes * :sparkles: Add revision fixes CI * :fire: Remove unused require --------- Co-authored-by: Elhombretecla --- .../styles/common/refactor/color-defs.scss | 2 +- frontend/src/app/main/ui/dashboard/team.scss | 1 + .../app/main/ui/workspace/left_header.cljs | 24 +++++++++++ .../app/main/ui/workspace/left_header.scss | 41 +++++++++++++++++++ .../app/main/ui/workspace/right_header.cljs | 36 +--------------- 5 files changed, 68 insertions(+), 36 deletions(-) diff --git a/frontend/resources/styles/common/refactor/color-defs.scss b/frontend/resources/styles/common/refactor/color-defs.scss index 46e6ba113..f3f1df5e2 100644 --- a/frontend/resources/styles/common/refactor/color-defs.scss +++ b/frontend/resources/styles/common/refactor/color-defs.scss @@ -35,7 +35,7 @@ --status-color-success-200: #a7e8d9; // Used on Register confirmation text --status-color-success-500: #2d9f8f; // Used on accept icon, and status widget - --status-color-warning-500: #fe4811; // Used on status widget, some buttons and warnings icons and elements + --status-color-warning-500: #f5a91b; // Used on status widget, some buttons and warnings icons and elements --status-color-error-500: #ff3277; // Used on discard icon, some borders and svg, and on status widget diff --git a/frontend/src/app/main/ui/dashboard/team.scss b/frontend/src/app/main/ui/dashboard/team.scss index 977e97b92..d6436705f 100644 --- a/frontend/src/app/main/ui/dashboard/team.scss +++ b/frontend/src/app/main/ui/dashboard/team.scss @@ -455,6 +455,7 @@ .modal-team-container-workspace { top: $s-40; + z-index: $z-index-modal; } .modal-title { diff --git a/frontend/src/app/main/ui/workspace/left_header.cljs b/frontend/src/app/main/ui/workspace/left_header.cljs index 82b819efd..757012b97 100644 --- a/frontend/src/app/main/ui/workspace/left_header.cljs +++ b/frontend/src/app/main/ui/workspace/left_header.cljs @@ -35,6 +35,11 @@ project-id (:id project) team-id (:team-id project) shared? (:is-shared file) + persistence + (mf/deref refs/persistence) + + persistence-status + (get persistence :status) read-only? (mf/use-ctx ctx/workspace-read-only?) @@ -108,6 +113,25 @@ {:class (stl/css :file-name) :title file-name :on-double-click start-editing-name} + ;;-- Persistende state widget + [:div {:class (case persistence-status + :pending (stl/css :status-notification :pending-status) + :saving (stl/css :status-notification :saving-status) + :saved (stl/css :status-notification :saved-status) + :error (stl/css :status-notification :error-status) + (stl/css :status-notification)) + :title (case persistence-status + :pending (tr "workspace.header.saving") + :saving (tr "workspace.header.saving") + :saved (tr "workspace.header.saved") + :error (tr "workspace.header.save-error") + nil)} + (case persistence-status + :pending i/status-alert + :saving i/status-alert + :saved i/status-tick + :error i/status-wrong + nil)] file-name])] (when ^boolean shared? [:span {:class (stl/css :shared-badge)} i/library]) diff --git a/frontend/src/app/main/ui/workspace/left_header.scss b/frontend/src/app/main/ui/workspace/left_header.scss index 207101743..df9ea3583 100644 --- a/frontend/src/app/main/ui/workspace/left_header.scss +++ b/frontend/src/app/main/ui/workspace/left_header.scss @@ -49,6 +49,9 @@ @include smallTitleTipography; text-transform: none; color: var(--title-foreground-color-hover); + align-items: center; + display: flex; + flex-direction: row; } .file-name-input { @@ -80,3 +83,41 @@ width: $s-16; } } + +.status-notification { + width: $s-6; + height: $s-6; + border-radius: 50%; + margin-right: $s-4; + flex-shrink: 0; + background-color: var(--status-widget-background-color-pending); + + &.pending-status { + background-color: var(--status-widget-background-color-warning); + } + + &.saving-status { + background-color: var(--status-widget-background-color-pending); + } + + &.saved-status { + background-color: var(--status-widget-background-color-success); + animation: jump 0.3s ease-out; + } + + &.error-status { + background-color: var(--status-widget-background-color-error); + } +} + +@keyframes jump { + 0% { + transform: translateY(0); + } + 50% { + transform: translateY(-4px); + } + 100% { + transform: translateY(0); + } +} diff --git a/frontend/src/app/main/ui/workspace/right_header.cljs b/frontend/src/app/main/ui/workspace/right_header.cljs index 63af366b8..96a9883c3 100644 --- a/frontend/src/app/main/ui/workspace/right_header.cljs +++ b/frontend/src/app/main/ui/workspace/right_header.cljs @@ -19,6 +19,7 @@ [app.main.store :as st] [app.main.ui.components.dropdown :refer [dropdown]] [app.main.ui.context :as ctx] + [app.main.ui.dashboard.team] [app.main.ui.ds.buttons.icon-button :refer [icon-button*]] [app.main.ui.exports.assets :refer [export-progress-widget]] [app.main.ui.formats :as fmt] @@ -32,39 +33,6 @@ (def ref:persistence-status (l/derived :status refs/persistence)) -;; --- Persistence state Widget - -(mf/defc persistence-state-widget - {::mf/wrap [mf/memo] - ::mf/wrap-props false} - [] - (let [status (mf/deref ref:persistence-status) - workspace-read-only? (mf/use-ctx ctx/workspace-read-only?)] - (when-not workspace-read-only? - [:div {:class (stl/css :persistence-status-widget)} - (case status - :pending - [:div {:class (stl/css :status-icon :pending-status) - :title (tr "workspace.header.unsaved")} - i/status-alert] - - :saving - [:div {:class (stl/css :status-icon :pending-status) - :title (tr "workspace.header.unsaved")} - i/status-alert] - - :saved - [:div {:class (stl/css :status-icon :saved-status) - :title (tr "workspace.header.saved")} - i/status-tick] - - :error - [:div {:class (stl/css :status-icon :error-status) - :title "There was an error saving the data. Please refresh if this persists."} - i/status-wrong] - - nil)]))) - ;; --- Zoom Widget (mf/defc zoom-widget-workspace @@ -216,8 +184,6 @@ [:div {:class (stl/css :users-section)} [:& active-sessions]] - [:& persistence-state-widget] - [:& export-progress-widget] [:div {:class (stl/css :separator)}] From 2cbc09a0e2003cf205dbde7146e69ed2b1ad13f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bel=C3=A9n=20Albeza?= Date: Thu, 6 Feb 2025 09:28:51 +0100 Subject: [PATCH 8/8] :bug: Fix local library being collapsed by default (#5775) * :bug: Fix local library being collapsed by default * :recycle: Move layers tab spec code to its own file --- .../playwright/ui/specs/assets-tab.spec.js | 67 +++++++++++++++++ .../playwright/ui/specs/layers-tab.spec.js | 21 ++++++ frontend/playwright/ui/specs/sidebar.spec.js | 73 ------------------- .../sidebar/assets/file_library.cljs | 4 +- 4 files changed, 90 insertions(+), 75 deletions(-) create mode 100644 frontend/playwright/ui/specs/assets-tab.spec.js create mode 100644 frontend/playwright/ui/specs/layers-tab.spec.js delete mode 100644 frontend/playwright/ui/specs/sidebar.spec.js diff --git a/frontend/playwright/ui/specs/assets-tab.spec.js b/frontend/playwright/ui/specs/assets-tab.spec.js new file mode 100644 index 000000000..bc5d7b5a2 --- /dev/null +++ b/frontend/playwright/ui/specs/assets-tab.spec.js @@ -0,0 +1,67 @@ +import { test, expect } from "@playwright/test"; +import { WorkspacePage } from "../pages/WorkspacePage"; + +test.beforeEach(async ({ page }) => { + await WorkspacePage.init(page); +}); + +test("User adds a library and its automatically selected in the color palette", async ({ + page, +}) => { + const workspacePage = new WorkspacePage(page); + await workspacePage.setupEmptyFile(); + await workspacePage.mockRPC( + "link-file-to-library", + "workspace/link-file-to-library.json", + ); + await workspacePage.mockRPC( + "unlink-file-from-library", + "workspace/unlink-file-from-library.json", + ); + await workspacePage.mockRPC( + "get-team-shared-files?team-id=*", + "workspace/get-team-shared-libraries-non-empty.json", + ); + + await workspacePage.goToWorkspace(); + + // Add Testing library 1 + await workspacePage.clickColorPalette(); + await workspacePage.clickAssets(); + // Now the get-file call should return a library + await workspacePage.mockRPC(/get\-file\?/, "workspace/get-file-library.json"); + await workspacePage.openLibrariesModal(); + await workspacePage.clickLibrary("Testing library 1"); + await workspacePage.closeLibrariesModal(); + + await expect( + workspacePage.palette.getByRole("button", { name: "test-color-187cd5" }), + ).toBeVisible(); + + // Remove Testing library 1 + await workspacePage.openLibrariesModal(); + await workspacePage.clickLibrary("Testing library 1"); + await workspacePage.closeLibrariesModal(); + + await expect( + workspacePage.palette.getByText( + "There are no color styles in your library yet", + ), + ).toBeVisible(); +}); + +test("BUG 10090 - Local library should be expanded by default", async ({ + page, +}) => { + const workspacePage = new WorkspacePage(page); + await workspacePage.setupEmptyFile(page); + + await workspacePage.goToWorkspace(); + + await workspacePage.clickAssets(); + + expect(workspacePage.sidebar.getByText("Local library")).toBeVisible(); + expect(workspacePage.sidebar.getByText("Components")).toBeVisible(); + expect(workspacePage.sidebar.getByText("Colors")).toBeVisible(); + expect(workspacePage.sidebar.getByText("Typographies")).toBeVisible(); +}); diff --git a/frontend/playwright/ui/specs/layers-tab.spec.js b/frontend/playwright/ui/specs/layers-tab.spec.js new file mode 100644 index 000000000..fd86e88a1 --- /dev/null +++ b/frontend/playwright/ui/specs/layers-tab.spec.js @@ -0,0 +1,21 @@ +import { test, expect } from "@playwright/test"; +import { WorkspacePage } from "../pages/WorkspacePage"; + +test.beforeEach(async ({ page }) => { + await WorkspacePage.init(page); +}); + +test("BUG 7466 - Layers tab height extends to the bottom when 'Pages' is collapsed", async ({ + page, +}) => { + const workspace = new WorkspacePage(page); + await workspace.setupEmptyFile(); + + await workspace.goToWorkspace(); + + const { height: heightExpanded } = await workspace.layers.boundingBox(); + await workspace.togglePages(); + const { height: heightCollapsed } = await workspace.layers.boundingBox(); + + expect(heightExpanded > heightCollapsed); +}); diff --git a/frontend/playwright/ui/specs/sidebar.spec.js b/frontend/playwright/ui/specs/sidebar.spec.js deleted file mode 100644 index b97301889..000000000 --- a/frontend/playwright/ui/specs/sidebar.spec.js +++ /dev/null @@ -1,73 +0,0 @@ -import { test, expect } from "@playwright/test"; -import { WorkspacePage } from "../pages/WorkspacePage"; - -test.beforeEach(async ({ page }) => { - await WorkspacePage.init(page); -}); - -test.describe("Layers tab", () => { - test("BUG 7466 - Layers tab height extends to the bottom when 'Pages' is collapsed", async ({ - page, - }) => { - const workspace = new WorkspacePage(page); - await workspace.setupEmptyFile(); - - await workspace.goToWorkspace(); - - const { height: heightExpanded } = await workspace.layers.boundingBox(); - await workspace.togglePages(); - const { height: heightCollapsed } = await workspace.layers.boundingBox(); - - expect(heightExpanded > heightCollapsed); - }); -}); - -test.describe("Assets tab", () => { - test("User adds a library and its automatically selected in the color palette", async ({ - page, - }) => { - const workspacePage = new WorkspacePage(page); - await workspacePage.setupEmptyFile(); - await workspacePage.mockRPC( - "link-file-to-library", - "workspace/link-file-to-library.json", - ); - await workspacePage.mockRPC( - "unlink-file-from-library", - "workspace/unlink-file-from-library.json", - ); - await workspacePage.mockRPC( - "get-team-shared-files?team-id=*", - "workspace/get-team-shared-libraries-non-empty.json", - ); - - await workspacePage.goToWorkspace(); - - // Add Testing library 1 - await workspacePage.clickColorPalette(); - await workspacePage.clickAssets(); - // Now the get-file call should return a library - await workspacePage.mockRPC( - /get\-file\?/, - "workspace/get-file-library.json", - ); - await workspacePage.openLibrariesModal(); - await workspacePage.clickLibrary("Testing library 1"); - await workspacePage.closeLibrariesModal(); - - await expect( - workspacePage.palette.getByRole("button", { name: "test-color-187cd5" }), - ).toBeVisible(); - - // Remove Testing library 1 - await workspacePage.openLibrariesModal(); - await workspacePage.clickLibrary("Testing library 1"); - await workspacePage.closeLibrariesModal(); - - await expect( - workspacePage.palette.getByText( - "There are no color styles in your library yet", - ), - ).toBeVisible(); - }); -}); diff --git a/frontend/src/app/main/ui/workspace/sidebar/assets/file_library.cljs b/frontend/src/app/main/ui/workspace/sidebar/assets/file_library.cljs index 296836b85..c66c9cd9f 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/assets/file_library.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/assets/file_library.cljs @@ -320,7 +320,7 @@ (tr "workspace.assets.not-found")]])])) (mf/defc file-library* - [{:keys [file is-local is-default-open? filters]}] + [{:keys [file is-local is-default-open filters]}] (let [file-id (:id file) file-name (:name file) page-id (dm/get-in file [:data :pages 0]) @@ -376,7 +376,7 @@ ;; if the user has closed it specifically, respect that false (or force-lib-open? - (d/nilv (:library open-status) is-default-open?))) + (d/nilv (:library open-status) is-default-open))) unselect-all (mf/use-fn