pinokiod 5.1.34 → 5.1.35

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "5.1.34",
3
+ "version": "5.1.35",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -132,3 +132,37 @@ body.dark .tab-link-popover .tab-link-popover-footer:hover,
132
132
  body.dark .tab-link-popover .tab-link-popover-footer:focus-visible {
133
133
  background: rgba(147, 197, 253, 0.35);
134
134
  }
135
+ .appcanvas > aside .menu-container .tab-link-popover-host {
136
+ display: flex;
137
+ align-items: center;
138
+ gap: 8px;
139
+ }
140
+ .appcanvas > aside .menu-container .tab-link-popover-trigger {
141
+ display: inline-flex;
142
+ align-items: center;
143
+ justify-content: center;
144
+ width: 18px;
145
+ height: 18px;
146
+ border-radius: 6px;
147
+ flex: 0 0 auto;
148
+ color: inherit;
149
+ opacity: 0.55;
150
+ cursor: pointer;
151
+ transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
152
+ }
153
+ .appcanvas > aside .menu-container .tab-link-popover-trigger i {
154
+ font-size: 14px;
155
+ }
156
+ .appcanvas > aside .menu-container .frame-link:hover .tab-link-popover-trigger,
157
+ .appcanvas > aside .menu-container .frame-link:focus-within .tab-link-popover-trigger {
158
+ opacity: 0.85;
159
+ }
160
+ .appcanvas > aside .menu-container .tab-link-popover-trigger:hover,
161
+ .appcanvas > aside .menu-container .tab-link-popover-trigger:focus-visible {
162
+ background: rgba(15, 23, 42, 0.08);
163
+ opacity: 1;
164
+ }
165
+ body.dark .appcanvas > aside .menu-container .tab-link-popover-trigger:hover,
166
+ body.dark .appcanvas > aside .menu-container .tab-link-popover-trigger:focus-visible {
167
+ background: rgba(148, 163, 184, 0.2);
168
+ }
@@ -10,6 +10,40 @@
10
10
  let tabLinkRouterHttpsActive = null
11
11
  let tabLinkPeerInfoPromise = null
12
12
  let tabLinkPeerInfoExpiry = 0
13
+ const TAB_LINK_TRIGGER_CLASS = "tab-link-popover-trigger"
14
+ const TAB_LINK_TRIGGER_HOST_CLASS = "tab-link-popover-host"
15
+
16
+ const shouldAttachTabLinkTrigger = (link) => {
17
+ if (!link || !link.classList || !link.classList.contains("frame-link")) {
18
+ return false
19
+ }
20
+ if (!link.hasAttribute("href")) {
21
+ return false
22
+ }
23
+ const href = link.getAttribute("href")
24
+ return typeof href === "string" && href.trim().length > 0
25
+ }
26
+
27
+ const createTabLinkTrigger = () => {
28
+ const trigger = document.createElement("span")
29
+ trigger.className = TAB_LINK_TRIGGER_CLASS
30
+ trigger.setAttribute("role", "button")
31
+ trigger.setAttribute("tabindex", "0")
32
+ trigger.setAttribute("aria-label", "Open in browser")
33
+ trigger.innerHTML = '<i class="fa-solid fa-arrow-up-right-from-square"></i>'
34
+ return trigger
35
+ }
36
+
37
+ const ensureTabLinkTrigger = (link) => {
38
+ if (!shouldAttachTabLinkTrigger(link)) {
39
+ return
40
+ }
41
+ if (link.querySelector(`.${TAB_LINK_TRIGGER_CLASS}`)) {
42
+ return
43
+ }
44
+ link.classList.add(TAB_LINK_TRIGGER_HOST_CLASS)
45
+ link.appendChild(createTabLinkTrigger())
46
+ }
13
47
 
14
48
  const ensureTabLinkPopoverEl = () => {
15
49
  if (!tabLinkPopoverEl) {
@@ -38,7 +72,12 @@
38
72
  if (targetMode === "_self") {
39
73
  window.location.assign(url)
40
74
  } else {
41
- window.open(url, "_blank", "browser")
75
+ const agent = document.body ? document.body.getAttribute("data-agent") : null
76
+ if (agent === "electron") {
77
+ window.open(url, "_blank", "browser")
78
+ } else {
79
+ window.open(url, "_blank")
80
+ }
42
81
  // fetch("/go", {
43
82
  // method: "POST",
44
83
  // headers: {
@@ -1611,27 +1650,80 @@
1611
1650
  if (!container) {
1612
1651
  return
1613
1652
  }
1653
+ if (container.dataset.tabLinkPopoverReady === "1") {
1654
+ return
1655
+ }
1656
+ container.dataset.tabLinkPopoverReady = "1"
1614
1657
 
1615
- container.addEventListener("mouseover", (event) => {
1616
- const link = event.target.closest(".frame-link")
1617
- if (!link || !container.contains(link)) {
1658
+ const ensureTriggers = (root) => {
1659
+ if (!root || !root.querySelectorAll) {
1618
1660
  return
1619
1661
  }
1620
- renderTabLinkPopover(link, { requireAlternate: false })
1662
+ root.querySelectorAll(".frame-link").forEach((link) => {
1663
+ ensureTabLinkTrigger(link)
1664
+ })
1665
+ }
1666
+
1667
+ ensureTriggers(container)
1668
+
1669
+ const observer = new MutationObserver((mutations) => {
1670
+ mutations.forEach((mutation) => {
1671
+ mutation.addedNodes.forEach((node) => {
1672
+ if (!node || node.nodeType !== 1) {
1673
+ return
1674
+ }
1675
+ if (node.classList && node.classList.contains("frame-link")) {
1676
+ ensureTabLinkTrigger(node)
1677
+ }
1678
+ if (node.querySelectorAll) {
1679
+ node.querySelectorAll(".frame-link").forEach((link) => {
1680
+ ensureTabLinkTrigger(link)
1681
+ })
1682
+ }
1683
+ })
1684
+ })
1621
1685
  })
1686
+ observer.observe(container, { childList: true, subtree: true })
1622
1687
 
1623
- container.addEventListener("mouseout", (event) => {
1624
- const origin = event.target.closest(".frame-link")
1625
- if (!origin || !container.contains(origin)) {
1688
+ const togglePopoverForLink = (link) => {
1689
+ if (!link) {
1626
1690
  return
1627
1691
  }
1628
- const related = event.relatedTarget
1629
1692
  const popover = tabLinkPopoverEl || document.getElementById(TAB_LINK_POPOVER_ID)
1630
- if (related && (origin.contains(related) || (popover && popover.contains(related)))) {
1693
+ if (tabLinkActiveLink === link && popover && popover.classList.contains("visible")) {
1694
+ hideTabLinkPopover({ immediate: true })
1631
1695
  return
1632
1696
  }
1633
- hideTabLinkPopover()
1634
- })
1697
+ renderTabLinkPopover(link, { requireAlternate: false })
1698
+ }
1699
+
1700
+ const handleTriggerClick = (event) => {
1701
+ const trigger = event.target.closest(`.${TAB_LINK_TRIGGER_CLASS}`)
1702
+ if (!trigger || !container.contains(trigger)) {
1703
+ return
1704
+ }
1705
+ event.preventDefault()
1706
+ event.stopPropagation()
1707
+ const link = trigger.closest(".frame-link")
1708
+ togglePopoverForLink(link)
1709
+ }
1710
+
1711
+ const handleTriggerKeydown = (event) => {
1712
+ if (event.key !== "Enter" && event.key !== " ") {
1713
+ return
1714
+ }
1715
+ const trigger = event.target.closest(`.${TAB_LINK_TRIGGER_CLASS}`)
1716
+ if (!trigger || !container.contains(trigger)) {
1717
+ return
1718
+ }
1719
+ event.preventDefault()
1720
+ event.stopPropagation()
1721
+ const link = trigger.closest(".frame-link")
1722
+ togglePopoverForLink(link)
1723
+ }
1724
+
1725
+ container.addEventListener("click", handleTriggerClick, true)
1726
+ container.addEventListener("keydown", handleTriggerKeydown, true)
1635
1727
  }
1636
1728
 
1637
1729
  const handleGlobalPointer = (event) => {
@@ -25,7 +25,6 @@ body.dark #devtab.selected {
25
25
  background: rgb(27, 28, 29) !important;
26
26
  }
27
27
  .config-info {
28
- cursor: pointer;
29
28
  display: flex;
30
29
  align-items: center;
31
30
  font-size: 12px;
@@ -34,9 +33,6 @@ body.dark #devtab.selected {
34
33
  body.dark .snapshot-comment {
35
34
  color: white;
36
35
  }
37
- .config-info:hover, .config-info:hover i {
38
- color: rgba(127, 91, 243, 0.95);
39
- }
40
36
  #editortab {
41
37
  color: #7f5bf3;
42
38
  }
@@ -44,9 +40,15 @@ body.dark #layout-toggle {
44
40
  color: white;
45
41
  }
46
42
  #layout-toggle {
47
- padding: 10px;
43
+ padding: 6px 10px;
48
44
  border: none;
49
45
  background: none;
46
+ cursor: pointer;
47
+ font-size: 16px;
48
+ }
49
+ #layout-toggle:hover,
50
+ #layout-toggle:hover i {
51
+ color: rgba(127, 91, 243, 0.95);
50
52
  }
51
53
  #devtab {
52
54
  align-items: center;
@@ -1272,12 +1274,12 @@ body.dark .submenu {
1272
1274
  }
1273
1275
  body.dark .disk-usage {
1274
1276
  border-right: 1px solid rgba(255,255,255,0.1);
1275
- color: black;
1277
+ color: white;
1276
1278
  }
1277
1279
  .disk-usage {
1278
1280
  border-right: 1px solid rgba(0,0,0,0.1);
1279
1281
  font-weight: bold;
1280
- color: white;
1282
+ color: black;
1281
1283
  padding: 5px 10px;
1282
1284
  border-radius: 4px;
1283
1285
  }
@@ -3324,6 +3326,9 @@ body.dark .snapshot-footer {
3324
3326
  color: white;
3325
3327
  border-top: 1px solid rgba(148, 163, 184, 0.2);
3326
3328
  }
3329
+ html.snapshot-footer-dismissed .snapshot-footer {
3330
+ display: none !important;
3331
+ }
3327
3332
  .snapshot-footer .btn {
3328
3333
  font-size: 14px;
3329
3334
  }
@@ -3403,6 +3408,21 @@ body.dark .snapshot-footer-input input {
3403
3408
  <script src="/popper.min.js"></script>
3404
3409
  <script src="/tippy-bundle.umd.min.js"></script>
3405
3410
  <script src="/tab-link-popover.js"></script>
3411
+ <script>
3412
+ (function() {
3413
+ try {
3414
+ var workspace = <%- JSON.stringify(name || "") %>
3415
+ var pendingSnapshotId = <%- JSON.stringify(pendingSnapshotId ? String(pendingSnapshotId) : "") %>
3416
+ if (!workspace || pendingSnapshotId) {
3417
+ return
3418
+ }
3419
+ var key = "pinokio.snapshot-footer.dismissed:" + workspace
3420
+ if (window.localStorage && window.localStorage.getItem(key) === "1") {
3421
+ document.documentElement.classList.add("snapshot-footer-dismissed")
3422
+ }
3423
+ } catch (_) {}
3424
+ })()
3425
+ </script>
3406
3426
  </head>
3407
3427
  <body class='<%=theme%>' data-platform="<%=platform%>" data-agent="<%=agent%>">
3408
3428
  <header class='navheader grabbable'>
@@ -3650,6 +3670,7 @@ body.dark .snapshot-footer-input input {
3650
3670
  <button type="button" class="btn btn-primary snapshot-btn-save">
3651
3671
  <i class="fa-solid fa-circle-check"></i> Save checkpoint
3652
3672
  </button>
3673
+ <button type="button" class="btn snapshot-btn-dismiss">Dismiss</button>
3653
3674
  </div>
3654
3675
  </div>
3655
3676
  <% if (registryEnabled) { %>
@@ -5774,7 +5795,7 @@ const rerenderMenuSection = (container, html) => {
5774
5795
  }
5775
5796
  })
5776
5797
 
5777
- const layoutToggleButton = document.querySelector(".config-info")
5798
+ const layoutToggleButton = document.getElementById("layout-toggle")
5778
5799
  if (layoutToggleButton) {
5779
5800
  const layoutToggleIcon = layoutToggleButton.querySelector("i.fa-bars")
5780
5801
  const appcanvas = document.querySelector(".appcanvas")
@@ -8572,7 +8593,12 @@ const rerenderMenuSection = (container, html) => {
8572
8593
  event.preventDefault()
8573
8594
  event.stopPropagation()
8574
8595
  try {
8575
- window.open(remoteHref, '_blank', 'browser')
8596
+ const agent = document.body ? document.body.getAttribute('data-agent') : null
8597
+ if (agent === 'electron') {
8598
+ window.open(remoteHref, '_blank', 'browser')
8599
+ } else {
8600
+ window.open(remoteHref, '_blank')
8601
+ }
8576
8602
  } catch (error) {
8577
8603
  console.error('Failed to open remote URL:', error)
8578
8604
  }
@@ -9655,6 +9681,7 @@ document.addEventListener("DOMContentLoaded", () => {
9655
9681
  const publishPanel = footer.querySelector(".snapshot-footer-publish")
9656
9682
  const publishBtn = footer.querySelector(".snapshot-btn-publish")
9657
9683
  const laterBtn = footer.querySelector(".snapshot-btn-later")
9684
+ const dismissBtn = footer.querySelector(".snapshot-btn-dismiss")
9658
9685
  const publishText = publishPanel ? publishPanel.querySelector(".snapshot-footer-publish-text") : null
9659
9686
  const publishActions = publishPanel ? publishPanel.querySelector(".snapshot-footer-actions") : null
9660
9687
  if (!saveBtn) return
@@ -9664,6 +9691,28 @@ document.addEventListener("DOMContentLoaded", () => {
9664
9691
  footer.classList.add("hidden")
9665
9692
  return
9666
9693
  }
9694
+ const pendingSnapshotId = footer.getAttribute("data-pending-snapshot-id")
9695
+ const dismissStorageKey = `pinokio.snapshot-footer.dismissed:${workspace}`
9696
+ const getDismissedState = () => {
9697
+ try {
9698
+ return window.localStorage.getItem(dismissStorageKey) === "1"
9699
+ } catch (_) {
9700
+ return false
9701
+ }
9702
+ }
9703
+ const setDismissedState = (dismissed) => {
9704
+ try {
9705
+ if (dismissed) {
9706
+ window.localStorage.setItem(dismissStorageKey, "1")
9707
+ } else {
9708
+ window.localStorage.removeItem(dismissStorageKey)
9709
+ }
9710
+ } catch (_) {}
9711
+ }
9712
+ if (!pendingSnapshotId && getDismissedState()) {
9713
+ footer.classList.add("hidden")
9714
+ return
9715
+ }
9667
9716
  let savedSnapshotId = null
9668
9717
  const saveOriginal = saveBtn.innerHTML
9669
9718
  const publishOriginal = publishBtn ? publishBtn.innerHTML : ""
@@ -9688,7 +9737,6 @@ document.addEventListener("DOMContentLoaded", () => {
9688
9737
  if (publishPanel) publishPanel.classList.remove("hidden")
9689
9738
  if (savePanel) savePanel.classList.add("hidden")
9690
9739
  }
9691
- const pendingSnapshotId = footer.getAttribute("data-pending-snapshot-id")
9692
9740
  if (pendingSnapshotId) {
9693
9741
  savedSnapshotId = pendingSnapshotId
9694
9742
  showPublishPanel()
@@ -9992,9 +10040,16 @@ document.addEventListener("DOMContentLoaded", () => {
9992
10040
  }
9993
10041
  }
9994
10042
 
10043
+ const handleDismiss = (event) => {
10044
+ event.preventDefault()
10045
+ setDismissedState(true)
10046
+ footer.classList.add("hidden")
10047
+ }
10048
+
9995
10049
  saveBtn.addEventListener("click", handleSave)
9996
10050
  if (registryBetaEnabled && publishBtn) publishBtn.addEventListener("click", handlePublish)
9997
10051
  if (registryBetaEnabled && laterBtn) laterBtn.addEventListener("click", handleLater)
10052
+ if (dismissBtn) dismissBtn.addEventListener("click", handleDismiss)
9998
10053
  })
9999
10054
  </script>
10000
10055
  </body>
@@ -146,11 +146,18 @@ body.dark .comment {
146
146
  background: rgba(127, 91, 243, 0.9);
147
147
  }
148
148
  #delete-project {
149
- color: firebrick;
150
- background: none;
149
+ color: #fff;
150
+ background: firebrick;
151
+ width: 100%;
152
+ display: block;
153
+ text-align: center;
154
+ margin-top: 20px;
155
+ padding: 12px 16px;
151
156
  }
152
157
  #delete-project:hover {
153
- border: 1px solid firebrick;
158
+ background: #b22222;
159
+ color: #fff;
160
+ border: none;
154
161
  }
155
162
  a#customize {
156
163
  text-decoration: underline;
@@ -361,11 +368,6 @@ document.addEventListener("DOMContentLoaded", async () => {
361
368
  <% if (home) { %>
362
369
  <a class='home-button home' href="/home"><i class='fa-solid fa-home'></i></a>
363
370
  <% } %>
364
- <% if (name) { %>
365
- <button class='btn' id='delete-project'>
366
- <i class="fa-solid fa-trash"></i> Delete Project
367
- </button>
368
- <% } %>
369
371
  <div class='flexible'></div>
370
372
  <div class='nav-btns'>
371
373
  <a class='btn' href="<%=editorpath%>"><i class="fa-solid fa-pen-to-square"></i> Edit file</a>
@@ -388,6 +390,11 @@ document.addEventListener("DOMContentLoaded", async () => {
388
390
  </div>
389
391
  <% } %>
390
392
  <% }) %>
393
+ <% if (name) { %>
394
+ <button class='btn' id='delete-project'>
395
+ <i class="fa-solid fa-trash"></i> Delete Project
396
+ </button>
397
+ <% } %>
391
398
  </div>
392
399
  </main>
393
400
  </body>