tempo-sdk 0.0.44 → 0.0.51

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.
Files changed (43) hide show
  1. package/dist/assets/editor.d.ts +1 -1
  2. package/dist/assets/editor.js +4 -2
  3. package/dist/assets/editor.js.map +1 -1
  4. package/dist/assets/index.d.ts +112 -24
  5. package/dist/assets/index.js +309 -1
  6. package/dist/assets/index.js.map +1 -1
  7. package/dist/assets/parser.d.ts +14 -3
  8. package/dist/assets/parser.js +7 -3
  9. package/dist/canvas/index.d.ts +1 -1
  10. package/dist/canvas/index.js +21 -12
  11. package/dist/canvas/index.js.map +1 -1
  12. package/dist/canvas/interact-projection.js +3 -2
  13. package/dist/canvas/svelte.d.ts +1 -1
  14. package/dist/canvas/svelte.js +2 -2
  15. package/dist/{chunk-ZT2REPH4.js → chunk-57KAYXHF.js} +1 -1
  16. package/dist/chunk-57KAYXHF.js.map +1 -0
  17. package/dist/chunk-DI2ZFAWL.js +14 -0
  18. package/dist/chunk-DI2ZFAWL.js.map +1 -0
  19. package/dist/chunk-DX6XAXCK.js +827 -0
  20. package/dist/chunk-DX6XAXCK.js.map +1 -0
  21. package/dist/chunk-K3EYTZLL.js +45 -0
  22. package/dist/chunk-K3EYTZLL.js.map +1 -0
  23. package/dist/{chunk-MUW75SOS.js → chunk-LFYKJJC5.js} +3 -3
  24. package/dist/{chunk-MUW75SOS.js.map → chunk-LFYKJJC5.js.map} +1 -1
  25. package/dist/{chunk-IWULHYPW.js → chunk-O65OD3NA.js} +216 -19
  26. package/dist/chunk-O65OD3NA.js.map +1 -0
  27. package/dist/{chunk-KQHC77IF.js → chunk-PULSTDX2.js} +17 -5
  28. package/dist/chunk-PULSTDX2.js.map +1 -0
  29. package/dist/{chunk-U52RN7MP.js → chunk-ZZYNOX24.js} +23 -811
  30. package/dist/chunk-ZZYNOX24.js.map +1 -0
  31. package/dist/index.js +195 -19
  32. package/dist/index.js.map +1 -1
  33. package/dist/nextjs/plugin.js +1 -1
  34. package/dist/nextjs.cjs +2 -2
  35. package/dist/nextjs.cjs.map +1 -1
  36. package/dist/nextjs.js +1 -1
  37. package/dist/{storyboard-xVaRTJAu.d.ts → storyboard-CBHki7Aw.d.ts} +2 -1
  38. package/dist/{types-B-dRoF2T.d.ts → types-C7cvcY6T.d.ts} +5 -1
  39. package/package.json +2 -2
  40. package/dist/chunk-IWULHYPW.js.map +0 -1
  41. package/dist/chunk-KQHC77IF.js.map +0 -1
  42. package/dist/chunk-U52RN7MP.js.map +0 -1
  43. package/dist/chunk-ZT2REPH4.js.map +0 -1
@@ -3,7 +3,24 @@ import {
3
3
  } from "./chunk-65B52AR7.js";
4
4
  import {
5
5
  isProjectionPendingOnly
6
- } from "./chunk-ZT2REPH4.js";
6
+ } from "./chunk-57KAYXHF.js";
7
+ import {
8
+ captureAttributes,
9
+ captureHead,
10
+ captureWithSupplementalRoots,
11
+ collectElementStates,
12
+ countCaptureStyleRead,
13
+ countIdentityNodeVisited,
14
+ findLowestCommonAncestor,
15
+ generateSelector,
16
+ getHeadTracker,
17
+ readCaptureFlushCounters,
18
+ readCaptureProducerCardinality,
19
+ registerCaptureRootObserver,
20
+ registerDocumentCaptureProducer,
21
+ removeScriptTags,
22
+ resetCaptureFlushCounters
23
+ } from "./chunk-DX6XAXCK.js";
7
24
 
8
25
  // ../../modules/iframe-projection/fiber/react-types.ts
9
26
  var FiberTag = {
@@ -506,397 +523,6 @@ function getHook() {
506
523
  return window.__REACT_DEVTOOLS_GLOBAL_HOOK__ ?? null;
507
524
  }
508
525
 
509
- // ../../modules/iframe-projection/html/watch-head.ts
510
- var INCLUDE_TAGS = /* @__PURE__ */ new Set(["STYLE", "META", "BASE", "LINK"]);
511
- var INCLUDE_LINK_RELS = /* @__PURE__ */ new Set(["stylesheet"]);
512
- var instance = null;
513
- function getHeadTracker() {
514
- if (!instance) {
515
- instance = new HeadTrackerImpl();
516
- }
517
- return instance;
518
- }
519
- var HeadSubscriptionImpl = class {
520
- constructor(doc, callback, onUnsubscribe) {
521
- this.hasMutations = false;
522
- this.doc = doc;
523
- this.callback = callback;
524
- this.onUnsubscribe = onUnsubscribe;
525
- }
526
- flush(isInitial) {
527
- if (!isInitial && !this.hasMutations) {
528
- return void 0;
529
- }
530
- this.hasMutations = false;
531
- return captureHead(this.doc);
532
- }
533
- unsubscribe() {
534
- this.onUnsubscribe();
535
- }
536
- /** Called by tracker when relevant mutation detected */
537
- notifyMutation(details) {
538
- this.hasMutations = true;
539
- this.callback(details);
540
- }
541
- };
542
- var HeadTrackerImpl = class {
543
- constructor() {
544
- this.docObservers = /* @__PURE__ */ new Map();
545
- this.activeSubscriptions = 0;
546
- }
547
- subscribe(doc, onMutation) {
548
- let docState = this.docObservers.get(doc);
549
- if (!docState) {
550
- docState = this.createDocObserver(doc);
551
- this.docObservers.set(doc, docState);
552
- }
553
- const subscription = new HeadSubscriptionImpl(doc, onMutation, () => {
554
- this.unsubscribe(doc, subscription);
555
- });
556
- docState.subscriptions.add(subscription);
557
- this.activeSubscriptions += 1;
558
- return subscription;
559
- }
560
- createDocObserver(doc) {
561
- const subscriptions = /* @__PURE__ */ new Set();
562
- const notify = (details) => {
563
- for (const sub of subscriptions) {
564
- sub.notifyMutation(details);
565
- }
566
- };
567
- const observeHead = (head) => {
568
- const observer = new MutationObserver((mutations) => {
569
- const details = this.readRelevantMutations(mutations, head);
570
- if (!details) return;
571
- notify(details);
572
- });
573
- observer.observe(head, {
574
- childList: true,
575
- subtree: true,
576
- attributes: true,
577
- characterData: true
578
- });
579
- return observer;
580
- };
581
- if (doc.head) {
582
- return { observer: observeHead(doc.head), subscriptions };
583
- }
584
- const bootstrap = new MutationObserver(() => {
585
- const head = doc.head;
586
- if (!head) return;
587
- bootstrap.disconnect();
588
- state.observer = observeHead(head);
589
- notify({ stylesheetPaths: [] });
590
- });
591
- bootstrap.observe(doc, { childList: true, subtree: true });
592
- const state = { observer: bootstrap, subscriptions };
593
- return state;
594
- }
595
- unsubscribe(doc, sub) {
596
- const docState = this.docObservers.get(doc);
597
- if (!docState) return;
598
- if (!docState.subscriptions.delete(sub)) return;
599
- this.activeSubscriptions = Math.max(0, this.activeSubscriptions - 1);
600
- if (docState.subscriptions.size === 0) {
601
- docState.observer.disconnect();
602
- this.docObservers.delete(doc);
603
- }
604
- }
605
- /**
606
- * Check if mutations contain changes to elements we care about.
607
- * This filtering runs once per mutation batch (not once per subscription).
608
- */
609
- readRelevantMutations(mutations, head) {
610
- let relevant = false;
611
- const stylesheetPaths = /* @__PURE__ */ new Set();
612
- const collectStylesheetPath = (node) => {
613
- const element = node instanceof Element ? node : node?.parentElement ?? null;
614
- if (!element) return;
615
- const candidates = [
616
- element,
617
- ...element.querySelectorAll(
618
- "style[data-vite-dev-id], link[rel~='stylesheet']"
619
- )
620
- ];
621
- for (const candidate of candidates) {
622
- if (candidate instanceof HTMLStyleElement) {
623
- const id = candidate.getAttribute("data-vite-dev-id")?.trim();
624
- if (id) stylesheetPaths.add(id);
625
- } else if (candidate instanceof HTMLLinkElement && shouldIncludeLink(candidate)) {
626
- const href = candidate.getAttribute("href")?.trim() || candidate.href;
627
- if (href) stylesheetPaths.add(href);
628
- }
629
- }
630
- };
631
- for (const mutation of mutations) {
632
- const target = mutation.target;
633
- const element = target instanceof Element ? target : target.parentElement;
634
- if (!element || !head.contains(element) && target !== head) continue;
635
- const tagName = element.tagName;
636
- if (INCLUDE_TAGS.has(tagName)) {
637
- if (tagName === "LINK") {
638
- if (!shouldIncludeLink(element)) continue;
639
- }
640
- relevant = true;
641
- collectStylesheetPath(element);
642
- }
643
- if (mutation.type === "childList" && target === head) {
644
- relevant = true;
645
- }
646
- if (mutation.type === "childList") {
647
- for (const node of mutation.addedNodes) collectStylesheetPath(node);
648
- for (const node of mutation.removedNodes) collectStylesheetPath(node);
649
- }
650
- }
651
- return relevant ? { stylesheetPaths: [...stylesheetPaths] } : null;
652
- }
653
- destroy() {
654
- for (const docState of this.docObservers.values()) {
655
- docState.observer.disconnect();
656
- docState.subscriptions.clear();
657
- }
658
- this.docObservers.clear();
659
- this.activeSubscriptions = 0;
660
- }
661
- readPerfSnapshot() {
662
- return {
663
- observers: this.docObservers.size,
664
- subscriptions: this.activeSubscriptions
665
- };
666
- }
667
- };
668
- function captureHead(doc) {
669
- const head = doc.head;
670
- if (!head) return "";
671
- const baseURI = doc.baseURI;
672
- const fragments = [];
673
- for (const child of Array.from(head.children)) {
674
- const tagName = child.tagName;
675
- if (!INCLUDE_TAGS.has(tagName)) continue;
676
- if (tagName === "LINK") {
677
- if (!shouldIncludeLink(child)) continue;
678
- if (isDisabledStylesheet(child)) continue;
679
- }
680
- if (tagName === "META") {
681
- const httpEquiv = child.getAttribute("http-equiv")?.toLowerCase();
682
- const name = child.getAttribute("name")?.toLowerCase();
683
- if (httpEquiv === "content-security-policy" || name === "content-security-policy") {
684
- continue;
685
- }
686
- }
687
- let clone = child.cloneNode(true);
688
- materializeStyleElementCssom(child, clone);
689
- if (tagName === "LINK") {
690
- clone = materializeStylesheetLinkCssom(child, clone);
691
- }
692
- resolveUrls(clone, baseURI);
693
- if (clone.tagName === "LINK") {
694
- clone.removeAttribute("crossorigin");
695
- } else if (clone.tagName === "STYLE") {
696
- escapeStyleForHtmlSerialization(clone);
697
- }
698
- fragments.push(clone.outerHTML);
699
- }
700
- fragments.push(...captureAdoptedStyleSheets(doc));
701
- return fragments.join("\n");
702
- }
703
- function materializeStylesheetLinkCssom(source, clone) {
704
- const link = source;
705
- const cssText = serializeCssRules(link.sheet);
706
- if (!cssText) {
707
- return clone;
708
- }
709
- const style = source.ownerDocument.createElement("style");
710
- for (const attribute of Array.from(source.attributes)) {
711
- if ([
712
- "as",
713
- "crossorigin",
714
- "fetchpriority",
715
- "href",
716
- "integrity",
717
- "referrerpolicy",
718
- "rel"
719
- ].includes(attribute.name.toLowerCase())) {
720
- continue;
721
- }
722
- style.setAttribute(attribute.name, attribute.value);
723
- }
724
- style.setAttribute("data-projection-stylesheet-href", link.href);
725
- style.textContent = absolutifyCssReferences(cssText, link.href);
726
- return style;
727
- }
728
- function materializeStyleElementCssom(source, clone) {
729
- if (source.tagName !== "STYLE" || clone.tagName !== "STYLE") {
730
- return;
731
- }
732
- const style = source;
733
- const text = style.textContent ?? "";
734
- if (text.trim().length > 0) {
735
- return;
736
- }
737
- const cssText = serializeCssRules(style.sheet);
738
- if (cssText) {
739
- clone.textContent = cssText;
740
- }
741
- }
742
- function captureAdoptedStyleSheets(doc) {
743
- const sheets = Array.from(doc.adoptedStyleSheets ?? []);
744
- if (sheets.length === 0) {
745
- return [];
746
- }
747
- const fragments = [];
748
- for (const sheet of sheets) {
749
- const cssText = serializeCssRules(sheet);
750
- if (!cssText) {
751
- continue;
752
- }
753
- const style = doc.createElement("style");
754
- style.setAttribute("data-projection-adopted-stylesheet", "true");
755
- style.textContent = cssText;
756
- escapeStyleForHtmlSerialization(style);
757
- fragments.push(style.outerHTML);
758
- }
759
- return fragments;
760
- }
761
- function escapeStyleForHtmlSerialization(style) {
762
- style.textContent = (style.textContent ?? "").replace(/<\//gi, "<\\/");
763
- }
764
- function serializeCssRules(sheet) {
765
- if (!sheet) {
766
- return "";
767
- }
768
- try {
769
- return Array.from(sheet.cssRules).map((rule) => rule.cssText).join("\n");
770
- } catch {
771
- return "";
772
- }
773
- }
774
- function absolutifyCssReferences(cssText, baseHref) {
775
- if (!/^https?:/i.test(baseHref)) {
776
- return cssText;
777
- }
778
- const resolve = (value) => {
779
- const trimmed = value.trim();
780
- if (!trimmed || trimmed.startsWith("#") || /^(?:data|blob|javascript):/i.test(trimmed)) {
781
- return /^javascript:/i.test(trimmed) ? "" : trimmed;
782
- }
783
- try {
784
- return new URL(trimmed, baseHref).href;
785
- } catch {
786
- return trimmed;
787
- }
788
- };
789
- return cssText.replace(
790
- /url\(\s*(["']?)([^"')]+)\1\s*\)/gi,
791
- (_match, quote, value) => `url(${quote}${resolve(value)}${quote})`
792
- ).replace(
793
- /@import\s+(["'])([^"']+)\1/gi,
794
- (_match, quote, value) => `@import ${quote}${resolve(value)}${quote}`
795
- );
796
- }
797
- function shouldIncludeLink(element) {
798
- const rel = element.getAttribute("rel");
799
- if (!rel) {
800
- return false;
801
- }
802
- return rel.toLowerCase().split(/\s+/).some((token) => INCLUDE_LINK_RELS.has(token));
803
- }
804
- function isDisabledStylesheet(element) {
805
- const link = element;
806
- return link.disabled || link.sheet?.disabled === true;
807
- }
808
- function resolveUrls(element, baseURI) {
809
- if (!baseURI || !baseURI.startsWith("http")) {
810
- return;
811
- }
812
- const href = element.getAttribute("href");
813
- if (href && !isAbsoluteUrl(href)) {
814
- try {
815
- element.setAttribute("href", new URL(href, baseURI).href);
816
- } catch {
817
- }
818
- }
819
- const src = element.getAttribute("src");
820
- if (src && !isAbsoluteUrl(src)) {
821
- try {
822
- element.setAttribute("src", new URL(src, baseURI).href);
823
- } catch {
824
- }
825
- }
826
- }
827
- function isAbsoluteUrl(url) {
828
- return /^(https?:)?\/\//i.test(url) || url.startsWith("data:");
829
- }
830
-
831
- // ../../modules/iframe-projection/shared/capture-perf.ts
832
- var counters = {
833
- styleReadCount: 0,
834
- identityNodesVisited: 0,
835
- sourceVersionDomScanNodes: 0,
836
- sourceVersionFiberSerializeNodes: 0,
837
- sourceVersionFiberReductionNodes: 0,
838
- sourceVersionFallbackScanNodes: 0
839
- };
840
- var producerReferencesByDocument = /* @__PURE__ */ new Map();
841
- var activeDocumentProducers = 0;
842
- var activeRootObservers = 0;
843
- var activeReactCommitSubscriptions = 0;
844
- function registerDocumentCaptureProducer(document2) {
845
- const references = producerReferencesByDocument.get(document2) ?? 0;
846
- if (references === 0) activeDocumentProducers += 1;
847
- producerReferencesByDocument.set(document2, references + 1);
848
- activeReactCommitSubscriptions += 1;
849
- let active = true;
850
- return () => {
851
- if (!active) return;
852
- active = false;
853
- const current = producerReferencesByDocument.get(document2) ?? 0;
854
- if (current <= 1) {
855
- producerReferencesByDocument.delete(document2);
856
- activeDocumentProducers = Math.max(0, activeDocumentProducers - 1);
857
- } else {
858
- producerReferencesByDocument.set(document2, current - 1);
859
- }
860
- activeReactCommitSubscriptions = Math.max(
861
- 0,
862
- activeReactCommitSubscriptions - 1
863
- );
864
- };
865
- }
866
- function registerCaptureRootObserver() {
867
- activeRootObservers += 1;
868
- let active = true;
869
- return () => {
870
- if (!active) return;
871
- active = false;
872
- activeRootObservers = Math.max(0, activeRootObservers - 1);
873
- };
874
- }
875
- function readCaptureProducerCardinality() {
876
- return {
877
- activeDocumentProducers,
878
- activeRootObservers,
879
- reactCommitSubscriptions: activeReactCommitSubscriptions
880
- };
881
- }
882
- function countCaptureStyleRead() {
883
- counters.styleReadCount += 1;
884
- }
885
- function countIdentityNodeVisited() {
886
- counters.identityNodesVisited += 1;
887
- }
888
- function resetCaptureFlushCounters() {
889
- counters.styleReadCount = 0;
890
- counters.identityNodesVisited = 0;
891
- counters.sourceVersionDomScanNodes = 0;
892
- counters.sourceVersionFiberSerializeNodes = 0;
893
- counters.sourceVersionFiberReductionNodes = 0;
894
- counters.sourceVersionFallbackScanNodes = 0;
895
- }
896
- function readCaptureFlushCounters() {
897
- return { ...counters };
898
- }
899
-
900
526
  // ../../modules/iframe-projection/combined/projection-capture-perf.ts
901
527
  function buildProjectionCapturePerf(input) {
902
528
  const flushCounters = readCaptureFlushCounters();
@@ -951,420 +577,6 @@ function buildProjectionCapturePerf(input) {
951
577
  };
952
578
  }
953
579
 
954
- // ../../modules/iframe-projection/html/declared-facts.ts
955
- var SOURCE_ANNOTATED_SELECTOR = "[data-tempo-filepath], [data-tempo-html-filepath]";
956
- var NAMESPACES = [
957
- {
958
- filepathAttr: "data-tempo-filepath",
959
- positionAttr: "data-tempo-position",
960
- modifiedTsAttr: "data-tempo-modifiedts",
961
- sourceVersionAttr: "data-tempo-source-version"
962
- },
963
- {
964
- filepathAttr: "data-tempo-html-filepath",
965
- positionAttr: "data-tempo-html-offset",
966
- modifiedTsAttr: "data-tempo-html-modifiedts",
967
- sourceVersionAttr: "data-tempo-html-source-version"
968
- }
969
- ];
970
- function computeDeclaredFacts(targetElement, captureRoot, scopeSelector, portalElements) {
971
- const observedVersions = {};
972
- const observedSourceVersions = {};
973
- const anchorSet = /* @__PURE__ */ new Set();
974
- const visit = (element) => {
975
- for (const ns of NAMESPACES) {
976
- const filepath = element.getAttribute(ns.filepathAttr);
977
- if (filepath == null || filepath.length === 0) continue;
978
- const modifiedTsRaw = element.getAttribute(ns.modifiedTsAttr);
979
- if (modifiedTsRaw != null) {
980
- const modifiedTs = Number(modifiedTsRaw);
981
- if (!Number.isNaN(modifiedTs)) {
982
- const existing = observedVersions[filepath];
983
- if (existing === void 0 || modifiedTs > existing) {
984
- observedVersions[filepath] = modifiedTs;
985
- const version = element.getAttribute(ns.sourceVersionAttr);
986
- if (version != null && version.length > 0) {
987
- observedSourceVersions[filepath] = version;
988
- } else {
989
- delete observedSourceVersions[filepath];
990
- }
991
- }
992
- }
993
- }
994
- const position = element.getAttribute(ns.positionAttr);
995
- if (position != null && position.length > 0) {
996
- anchorSet.add(`${filepath} ${position}`);
997
- }
998
- }
999
- };
1000
- const walkRoots = [targetElement, ...portalElements];
1001
- for (const root of walkRoots) {
1002
- if (root.matches(SOURCE_ANNOTATED_SELECTOR)) visit(root);
1003
- for (const annotated of root.querySelectorAll(SOURCE_ANNOTATED_SELECTOR)) {
1004
- visit(annotated);
1005
- }
1006
- }
1007
- const complete = targetElement === captureRoot;
1008
- return {
1009
- complete,
1010
- scopeSelector: complete ? null : scopeSelector,
1011
- observedVersions,
1012
- observedSourceVersions,
1013
- containedAnchors: Array.from(anchorSet),
1014
- renderError: computeRenderError(captureRoot)
1015
- };
1016
- }
1017
- function computeRenderError(captureRoot) {
1018
- const errorElement = captureRoot.matches('[data-render-error="true"]') ? captureRoot : captureRoot.querySelector('[data-render-error="true"]');
1019
- if (!errorElement) return null;
1020
- return {
1021
- message: errorElement.getAttribute("data-render-error-message")
1022
- };
1023
- }
1024
-
1025
- // ../../modules/iframe-projection/html/displayability.ts
1026
- var IGNORED_CONTENT_TAGS = /* @__PURE__ */ new Set([
1027
- "DATALIST",
1028
- "LINK",
1029
- "META",
1030
- "NOSCRIPT",
1031
- "SCRIPT",
1032
- "STYLE",
1033
- "TEMPLATE"
1034
- ]);
1035
- var VISUAL_ASSET_TAGS = /* @__PURE__ */ new Set([
1036
- "AUDIO",
1037
- "CANVAS",
1038
- "EMBED",
1039
- "IFRAME",
1040
- "IMG",
1041
- "INPUT",
1042
- "OBJECT",
1043
- "SELECT",
1044
- "SVG",
1045
- "TEXTAREA",
1046
- "VIDEO"
1047
- ]);
1048
- function measureComputedDisplayability(captureRoot, supplementalRoots = []) {
1049
- const doc = captureRoot.ownerDocument;
1050
- const view = doc.defaultView;
1051
- if (!view || !captureRoot.isConnected || supplementalRoots.some(
1052
- (root) => root.ownerDocument !== doc || !root.isConnected
1053
- )) {
1054
- return null;
1055
- }
1056
- const result = {
1057
- version: 1,
1058
- elementCount: 0,
1059
- paintedElementCount: 0,
1060
- nonEmptyTextNodeCount: 0,
1061
- visualAssetCount: 0
1062
- };
1063
- try {
1064
- const rootBlocked = hasBlockingElementInChain(captureRoot, view);
1065
- const rootTextVisible = !rootBlocked && elementHasVisibleComputedVisibility(captureRoot, view);
1066
- for (const child of Array.from(captureRoot.childNodes)) {
1067
- visitNode(child, rootBlocked, rootTextVisible, view, result);
1068
- }
1069
- for (const supplementalRoot of supplementalRoots) {
1070
- visitNode(
1071
- supplementalRoot,
1072
- hasBlockingElementInChain(supplementalRoot.parentElement, view),
1073
- true,
1074
- view,
1075
- result
1076
- );
1077
- }
1078
- } catch {
1079
- return null;
1080
- }
1081
- return result;
1082
- }
1083
- function visitNode(node, blockedByAncestor, parentTextVisible, view, result) {
1084
- if (node.nodeType === 3) {
1085
- if (!blockedByAncestor && parentTextVisible && (node.textContent?.trim().length ?? 0) > 0) {
1086
- result.nonEmptyTextNodeCount += 1;
1087
- }
1088
- return;
1089
- }
1090
- if (node.nodeType !== 1) return;
1091
- const element = node;
1092
- const blocked = blockedByAncestor || elementBlocksSubtree(element, view);
1093
- if (blocked) return;
1094
- const visible = elementHasVisibleComputedVisibility(element, view);
1095
- if (visible) {
1096
- result.elementCount += 1;
1097
- if (elementPaintsOwnPixels(element, view)) {
1098
- result.paintedElementCount = (result.paintedElementCount ?? 0) + 1;
1099
- }
1100
- if (VISUAL_ASSET_TAGS.has(element.tagName)) {
1101
- result.visualAssetCount += 1;
1102
- }
1103
- }
1104
- for (const child of Array.from(element.childNodes)) {
1105
- visitNode(child, false, visible, view, result);
1106
- }
1107
- }
1108
- function elementPaintsOwnPixels(element, view) {
1109
- countCaptureStyleRead();
1110
- const style = view.getComputedStyle(element);
1111
- if (colorCanPaint(style.backgroundColor)) return true;
1112
- if (style.backgroundImage && style.backgroundImage !== "none") return true;
1113
- if (style.boxShadow && style.boxShadow !== "none") return true;
1114
- if (style.outlineStyle !== "none" && parseFloat(style.outlineWidth) > 0 && colorCanPaint(style.outlineColor)) {
1115
- return true;
1116
- }
1117
- for (const side of ["Top", "Right", "Bottom", "Left"]) {
1118
- if (style[`border${side}Style`] !== "none" && parseFloat(style[`border${side}Width`]) > 0 && colorCanPaint(style[`border${side}Color`])) {
1119
- return true;
1120
- }
1121
- }
1122
- return false;
1123
- }
1124
- function colorCanPaint(value) {
1125
- const normalized = value.trim().toLowerCase().replace(/ /g, "");
1126
- if (!normalized || normalized === "transparent") return false;
1127
- return !(/^rgba\([^)]*,0(?:\.0+)?\)$/.test(normalized) || /^rgb\([^)]*\/0(?:\.0+)?\)$/.test(normalized));
1128
- }
1129
- function hasBlockingElementInChain(start, view) {
1130
- for (let element = start; element; element = element.parentElement) {
1131
- if (elementBlocksSubtree(element, view)) return true;
1132
- }
1133
- return false;
1134
- }
1135
- function elementBlocksSubtree(element, view) {
1136
- if (IGNORED_CONTENT_TAGS.has(element.tagName)) return true;
1137
- if (element.hasAttribute("hidden")) return true;
1138
- if (element.tagName === "DIALOG" && !element.hasAttribute("open")) {
1139
- return true;
1140
- }
1141
- if (element.tagName === "INPUT" && element.getAttribute("type")?.trim().toLowerCase() === "hidden") {
1142
- return true;
1143
- }
1144
- countCaptureStyleRead();
1145
- const style = view.getComputedStyle(element);
1146
- const opacity = style.opacity.trim();
1147
- return style.display === "none" || opacity.length > 0 && Number(opacity) <= 0 || style.getPropertyValue("content-visibility") === "hidden";
1148
- }
1149
- function elementHasVisibleComputedVisibility(element, view) {
1150
- countCaptureStyleRead();
1151
- const visibility = view.getComputedStyle(element).visibility;
1152
- return visibility !== "hidden" && visibility !== "collapse";
1153
- }
1154
-
1155
- // ../../modules/iframe-projection/html/selectors.ts
1156
- function generateSelector(element, root) {
1157
- if (!root) {
1158
- if (element === document.documentElement) return ":root";
1159
- if (element === document.head) return "head";
1160
- if (element === document.body) return "body";
1161
- }
1162
- if (root && element === root) return "";
1163
- const parts = [];
1164
- let current = element;
1165
- const stopAt = root ?? document.documentElement;
1166
- while (current && current !== stopAt) {
1167
- const parent = current.parentElement;
1168
- if (!parent) break;
1169
- const tagName = current.tagName.toLowerCase();
1170
- let index = 1;
1171
- let sibling = current.previousElementSibling;
1172
- while (sibling) {
1173
- if (sibling.tagName === current.tagName) index++;
1174
- sibling = sibling.previousElementSibling;
1175
- }
1176
- let sameTypeSiblings = 0;
1177
- for (const child of parent.children) {
1178
- if (child.tagName === current.tagName) sameTypeSiblings++;
1179
- }
1180
- if (sameTypeSiblings > 1) {
1181
- parts.unshift(`${tagName}:nth-of-type(${index})`);
1182
- } else {
1183
- parts.unshift(tagName);
1184
- }
1185
- current = parent;
1186
- }
1187
- if (parts.length === 0) {
1188
- if (element === document.body) return "body";
1189
- if (element === document.head) return "head";
1190
- return "";
1191
- }
1192
- const path = parts.join(" > ");
1193
- if (root) return `:scope > ${path}`;
1194
- return path;
1195
- }
1196
- function findLowestCommonAncestor(nodes) {
1197
- if (nodes.size === 0) return null;
1198
- const ancestorChains = [];
1199
- for (const node of nodes) {
1200
- const chain = [];
1201
- let current = node instanceof Element ? node : node.parentElement;
1202
- while (current && current !== document) {
1203
- if (current instanceof Element) {
1204
- chain.unshift(current);
1205
- }
1206
- current = current.parentNode;
1207
- }
1208
- if (chain.length > 0) {
1209
- ancestorChains.push(chain);
1210
- }
1211
- }
1212
- if (ancestorChains.length === 0) {
1213
- return document.documentElement;
1214
- }
1215
- let lca = document.documentElement;
1216
- const firstChain = ancestorChains[0];
1217
- const minLength = Math.min(...ancestorChains.map((c) => c.length));
1218
- for (let i = 0; i < minLength; i++) {
1219
- const candidate = firstChain[i];
1220
- if (candidate && ancestorChains.every((chain) => chain[i] === candidate)) {
1221
- lca = candidate;
1222
- } else {
1223
- break;
1224
- }
1225
- }
1226
- return lca;
1227
- }
1228
-
1229
- // ../../modules/iframe-projection/html/capture.ts
1230
- function captureWithSupplementalRoots(element, supplementalRoots) {
1231
- syncFormStateToAttributes(element);
1232
- const selector = generateSelector(element, element);
1233
- const html = removeScriptTags(element.innerHTML);
1234
- const attributes = captureAttributes(element);
1235
- const documentElementAttributes = element.ownerDocument ? captureAttributes(element.ownerDocument.documentElement) : void 0;
1236
- const bodyAttributes = element.ownerDocument?.body ? captureAttributes(element.ownerDocument.body) : void 0;
1237
- const baseUrl = element.ownerDocument?.baseURI;
1238
- const states = collectElementStates(element);
1239
- const displayability = measureComputedDisplayability(
1240
- element,
1241
- supplementalRoots
1242
- );
1243
- return {
1244
- // Whole-surface one-shot: the element is both the capture root and the
1245
- // serialized scope, so `complete` is true and there is no scope selector.
1246
- declared: computeDeclaredFacts(element, element, "", supplementalRoots),
1247
- ...displayability && { displayability },
1248
- dom: {
1249
- selector,
1250
- html,
1251
- attributes,
1252
- documentElementAttributes,
1253
- bodyAttributes
1254
- },
1255
- states,
1256
- baseUrl
1257
- };
1258
- }
1259
- function syncFormStateToAttributes(root) {
1260
- for (const input of root.querySelectorAll(
1261
- 'input[type="checkbox"], input[type="radio"]'
1262
- )) {
1263
- const el = input;
1264
- if (el.checked) {
1265
- el.setAttribute("checked", "");
1266
- } else {
1267
- el.removeAttribute("checked");
1268
- }
1269
- }
1270
- for (const input of root.querySelectorAll(
1271
- 'input:not([type="checkbox"]):not([type="radio"])'
1272
- )) {
1273
- const el = input;
1274
- if (el.value !== el.getAttribute("value")) {
1275
- el.setAttribute("value", el.value);
1276
- }
1277
- }
1278
- for (const textarea of root.querySelectorAll("textarea")) {
1279
- const el = textarea;
1280
- if (el.value !== el.textContent) {
1281
- el.textContent = el.value;
1282
- }
1283
- if (el.hasAttribute("value")) {
1284
- el.removeAttribute("value");
1285
- }
1286
- }
1287
- for (const select of root.querySelectorAll("select")) {
1288
- const el = select;
1289
- for (const option of el.options) {
1290
- if (option.selected) {
1291
- option.setAttribute("selected", "");
1292
- } else {
1293
- option.removeAttribute("selected");
1294
- }
1295
- }
1296
- }
1297
- }
1298
- function removeScriptTags(html) {
1299
- return html.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi, "");
1300
- }
1301
- function captureAttributes(element) {
1302
- const attrs = {};
1303
- for (const attr of Array.from(element.attributes)) {
1304
- attrs[attr.name] = attr.value;
1305
- }
1306
- return attrs;
1307
- }
1308
- function collectElementStates(root, options = {}) {
1309
- const { includeDocumentScroll = true } = options;
1310
- const states = [];
1311
- for (const input of root.querySelectorAll("input")) {
1312
- const el = input;
1313
- const isCheckable = el.type === "checkbox" || el.type === "radio";
1314
- const hasNonDefault = isCheckable ? el.checked !== el.defaultChecked : el.value !== el.defaultValue;
1315
- if (hasNonDefault) {
1316
- const selector = generateSelector(el, root);
1317
- if (isCheckable) {
1318
- states.push({ selector, checked: el.checked });
1319
- } else {
1320
- states.push({ selector, value: el.value });
1321
- }
1322
- }
1323
- }
1324
- for (const textarea of root.querySelectorAll("textarea")) {
1325
- const el = textarea;
1326
- if (el.value !== el.defaultValue) {
1327
- const selector = generateSelector(el, root);
1328
- states.push({ selector, value: el.value });
1329
- }
1330
- }
1331
- for (const select of root.querySelectorAll("select")) {
1332
- const el = select;
1333
- for (const option of el.options) {
1334
- if (option.selected !== option.defaultSelected) {
1335
- const selector = generateSelector(option, root);
1336
- states.push({ selector, selected: option.selected });
1337
- }
1338
- }
1339
- }
1340
- states.push({
1341
- selector: "",
1342
- scrollTop: root.scrollTop,
1343
- scrollLeft: root.scrollLeft
1344
- });
1345
- if (includeDocumentScroll) {
1346
- const scrollingEl = root.ownerDocument?.scrollingElement;
1347
- if (scrollingEl && scrollingEl !== root) {
1348
- states.push({
1349
- selector: ":root",
1350
- scrollTop: scrollingEl.scrollTop,
1351
- scrollLeft: scrollingEl.scrollLeft
1352
- });
1353
- }
1354
- }
1355
- for (const el of root.querySelectorAll("*")) {
1356
- if (el.scrollTop > 0 || el.scrollLeft > 0) {
1357
- const selector = generateSelector(el, root);
1358
- states.push({
1359
- selector,
1360
- scrollTop: el.scrollTop,
1361
- scrollLeft: el.scrollLeft
1362
- });
1363
- }
1364
- }
1365
- return states;
1366
- }
1367
-
1368
580
  // ../../modules/iframe-projection/html/watch-dom.ts
1369
581
  var DOM_ID_ATTR = "data-dom-id";
1370
582
  var sessionHash = null;
@@ -4116,12 +3328,12 @@ function createProjectionOutbox(options) {
4116
3328
  }
4117
3329
 
4118
3330
  // ../../modules/iframe-projection/shared/portal-tracker.ts
4119
- var instance2 = null;
3331
+ var instance = null;
4120
3332
  function getPortalTracker() {
4121
- if (!instance2) {
4122
- instance2 = new PortalTrackerImpl();
3333
+ if (!instance) {
3334
+ instance = new PortalTrackerImpl();
4123
3335
  }
4124
- return instance2;
3336
+ return instance;
4125
3337
  }
4126
3338
  function isElementOwnedByRoot(candidate, root) {
4127
3339
  const fiber = getFiberFromElement(candidate);
@@ -7614,4 +6826,4 @@ function installTempoInteractProjectionSource() {
7614
6826
  export {
7615
6827
  installTempoInteractProjectionSource
7616
6828
  };
7617
- //# sourceMappingURL=chunk-U52RN7MP.js.map
6829
+ //# sourceMappingURL=chunk-ZZYNOX24.js.map