@01.software/sdk 0.15.0 → 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/ui/canvas.js CHANGED
@@ -363,15 +363,9 @@ function useQuickJS() {
363
363
  }
364
364
 
365
365
  // src/ui/Canvas/template-compiler.ts
366
+ var WIRE_FORMAT_VERSION = 1;
366
367
  var MAX_CACHE_SIZE = 100;
367
368
  var MAX_MATERIALIZE_DEPTH = 20;
368
- var IFRAME_BLOCKED_PROPS = /* @__PURE__ */ new Set([
369
- "srcdoc",
370
- "allow",
371
- "allowpaymentrequest",
372
- "name",
373
- "sandbox"
374
- ]);
375
369
  var ALLOWED_ELEMENTS = /* @__PURE__ */ new Set([
376
370
  "div",
377
371
  "span",
@@ -405,8 +399,7 @@ var ALLOWED_ELEMENTS = /* @__PURE__ */ new Set([
405
399
  "path",
406
400
  "g",
407
401
  "circle",
408
- "rect",
409
- "iframe"
402
+ "rect"
410
403
  ]);
411
404
  var BLOCKED_PATTERNS = [
412
405
  /\bdocument\s*\./,
@@ -438,7 +431,7 @@ var VM_SETUP = `
438
431
  var React = {
439
432
  createElement: function(type, props) {
440
433
  var args = Array.prototype.slice.call(arguments, 2);
441
- return { $$t: 'el', type: String(type), props: props || {}, ch: args };
434
+ return { $$t: 'el', $$v: 1, type: String(type), props: props || {}, ch: args };
442
435
  },
443
436
  Fragment: '__frag__'
444
437
  };
@@ -530,6 +523,7 @@ function materialize(node, depth = 0) {
530
523
  }
531
524
  if (typeof node !== "object") return null;
532
525
  const d = node;
526
+ if (d.$$v !== WIRE_FORMAT_VERSION) return null;
533
527
  if (d.$$t === "frag") {
534
528
  const ch = Array.isArray(d.ch) ? d.ch : [];
535
529
  return React.createElement(
@@ -547,7 +541,6 @@ function materialize(node, depth = 0) {
547
541
  for (const [k, v] of Object.entries(props)) {
548
542
  if (k.startsWith("on")) continue;
549
543
  if (k === "dangerouslySetInnerHTML" || k === "ref") continue;
550
- if (type === "iframe" && IFRAME_BLOCKED_PROPS.has(k)) continue;
551
544
  if ((k === "src" || k === "href") && !isSafeUrl(v)) continue;
552
545
  if (k === "style") {
553
546
  safeProps[k] = sanitizeStyle(v);
@@ -555,9 +548,6 @@ function materialize(node, depth = 0) {
555
548
  }
556
549
  safeProps[k] = v;
557
550
  }
558
- if (type === "iframe") {
559
- safeProps["sandbox"] = "allow-scripts allow-same-origin";
560
- }
561
551
  const children = ch.map((c) => materialize(c, depth + 1));
562
552
  return React.createElement(type, safeProps, ...children);
563
553
  }