@archie/devtools 0.1.4 → 0.1.5
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/README.md +28 -0
- package/dist/{chunk-U4KG6UDY.mjs → chunk-ZG6HZFTJ.mjs} +1 -0
- package/dist/client/client.js +203 -93
- package/dist/client/client.mjs +203 -93
- package/dist/collection-binding.mjs +1 -1
- package/dist/index.d.mts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +38 -1
- package/dist/index.mjs +38 -2
- package/dist/inspector.standalone.js +72 -13
- package/dist/{inspector.standalone@0.1.4.js → inspector.standalone@0.1.5.js} +72 -13
- package/package.json +1 -1
|
@@ -7,6 +7,15 @@
|
|
|
7
7
|
var _rawDocumentQuerySelectorAll = Document.prototype.querySelectorAll
|
|
8
8
|
var _documentQuerySelectorsPatched = false
|
|
9
9
|
|
|
10
|
+
// Design-mode (arrange) overlay elements — HitArea, resize handles,
|
|
11
|
+
// drop-line, etc. — carry this attribute. Single source of truth so every
|
|
12
|
+
// check below (isInspectorElement, inspectorClickHandler, the dblclick
|
|
13
|
+
// descend guard) can never desync from a rename.
|
|
14
|
+
var DESIGN_MODE_UI_SELECTOR = "[data-design-mode-ui]"
|
|
15
|
+
// The grab HitArea specifically (DesignModeOverlay.tsx's `HitArea`) — the
|
|
16
|
+
// ONLY design-mode-ui element the dblclick descend guard below exempts.
|
|
17
|
+
var DESIGN_MODE_HIT_AREA_SELECTOR = '[data-design-mode-ui="hit-area"]'
|
|
18
|
+
|
|
10
19
|
function runInspector() {
|
|
11
20
|
var INSPECTOR_PROBLEMATIC_SELECTOR_PATTERNS = [
|
|
12
21
|
/\/\d+/,
|
|
@@ -1100,6 +1109,23 @@
|
|
|
1100
1109
|
)
|
|
1101
1110
|
}
|
|
1102
1111
|
|
|
1112
|
+
// The identity a wrapper ancestor climbs AS. A plain instrumented
|
|
1113
|
+
// wrapper climbs as its own direct meta. A kit-rendered wrapper (a
|
|
1114
|
+
// `Kit.Card` host div) carries kit-TEMPLATE direct meta instead, so it
|
|
1115
|
+
// falls back to the projected USAGE one level up in the screen file —
|
|
1116
|
+
// but that usage can itself be kit/chrome, so it's re-checked below.
|
|
1117
|
+
function getVisualUnitMetaForElement(el) {
|
|
1118
|
+
var directMeta = getDirectEditorMetaFromElement(el)
|
|
1119
|
+
if (!directMeta) return null
|
|
1120
|
+
if (!isKitOrChromeMeta(directMeta)) return directMeta
|
|
1121
|
+
|
|
1122
|
+
// The projected USAGE can itself be kit/chrome (e.g. a Kit.Card host
|
|
1123
|
+
// used inside a chrome file) — re-check it so the climb never enters
|
|
1124
|
+
// chrome scaffolding through a kit-rendered wrapper.
|
|
1125
|
+
var usageMeta = projectUsageMetaFromElement(el)
|
|
1126
|
+
return usageMeta && !isKitOrChromeMeta(usageMeta) ? usageMeta : null
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1103
1129
|
function climbVisualUnitChain(leaf) {
|
|
1104
1130
|
if (!leaf) return leaf
|
|
1105
1131
|
var currentFile = getOwnSourceFileForElement(leaf)
|
|
@@ -1114,8 +1140,8 @@
|
|
|
1114
1140
|
if (isScreenRootWrapperElement(parent)) break
|
|
1115
1141
|
if (getSoleElementChild(parent) !== current) break
|
|
1116
1142
|
|
|
1117
|
-
var parentMeta =
|
|
1118
|
-
if (!parentMeta
|
|
1143
|
+
var parentMeta = getVisualUnitMetaForElement(parent)
|
|
1144
|
+
if (!parentMeta) break
|
|
1119
1145
|
if (!parentMeta.file || parentMeta.file !== currentFile) break
|
|
1120
1146
|
if (isStructuralComponentNameForUnit(parentMeta.componentName)) break
|
|
1121
1147
|
|
|
@@ -1203,16 +1229,43 @@
|
|
|
1203
1229
|
return null
|
|
1204
1230
|
}
|
|
1205
1231
|
|
|
1232
|
+
// The point-hit stack at (x, y), topmost first. Prefers elementsFromPoint
|
|
1233
|
+
// (so a topmost overlay, e.g. the design-mode grab overlay, doesn't hide
|
|
1234
|
+
// the real element beneath it) and falls back to the single-element
|
|
1235
|
+
// elementFromPoint where the multi-element API isn't available.
|
|
1236
|
+
function collectPointHitList(x, y) {
|
|
1237
|
+
try {
|
|
1238
|
+
if (typeof document.elementsFromPoint === "function") {
|
|
1239
|
+
return document.elementsFromPoint(x, y) || []
|
|
1240
|
+
}
|
|
1241
|
+
} catch (_listError) {
|
|
1242
|
+
// fall through to the single-element lookup below
|
|
1243
|
+
}
|
|
1244
|
+
try {
|
|
1245
|
+
var single = document.elementFromPoint(x, y)
|
|
1246
|
+
return single ? [single] : []
|
|
1247
|
+
} catch (_pointError) {
|
|
1248
|
+
return []
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1206
1252
|
// The direct child of `container` that sits on the ancestor line to
|
|
1207
1253
|
// (x, y) — the "select child toward the point" step (double click).
|
|
1254
|
+
// Once a unit is selected, the full-coverage design-mode grab overlay
|
|
1255
|
+
// ([data-design-mode-ui]) sits topmost at that point, so a plain
|
|
1256
|
+
// elementFromPoint would just return the overlay itself — this walks
|
|
1257
|
+
// the hit stack and skips inspector/overlay elements to find the real
|
|
1258
|
+
// element underneath, exactly like getElementFromPoint does for hover.
|
|
1208
1259
|
function findImmediateChildTowardPoint(container, x, y) {
|
|
1260
|
+
var list = collectPointHitList(x, y)
|
|
1209
1261
|
var atPoint = null
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1262
|
+
for (var i = 0; i < list.length; i++) {
|
|
1263
|
+
if (!isInspectorElement(list[i])) {
|
|
1264
|
+
atPoint = list[i]
|
|
1265
|
+
break
|
|
1266
|
+
}
|
|
1214
1267
|
}
|
|
1215
|
-
if (!atPoint
|
|
1268
|
+
if (!atPoint) return null
|
|
1216
1269
|
if (!container.contains(atPoint) || atPoint === container) return null
|
|
1217
1270
|
|
|
1218
1271
|
var current = atPoint
|
|
@@ -2180,7 +2233,7 @@
|
|
|
2180
2233
|
// drop-line, etc. These belong to the unified visual editor and must
|
|
2181
2234
|
// pass mousedown/click events through to React (dnd-kit) instead of
|
|
2182
2235
|
// being treated as inspect targets.
|
|
2183
|
-
(element.closest && element.closest(
|
|
2236
|
+
(element.closest && element.closest(DESIGN_MODE_UI_SELECTOR))
|
|
2184
2237
|
)
|
|
2185
2238
|
}
|
|
2186
2239
|
|
|
@@ -5777,7 +5830,7 @@
|
|
|
5777
5830
|
if (
|
|
5778
5831
|
e.target &&
|
|
5779
5832
|
typeof e.target.closest === "function" &&
|
|
5780
|
-
e.target.closest(
|
|
5833
|
+
e.target.closest(DESIGN_MODE_UI_SELECTOR)
|
|
5781
5834
|
) {
|
|
5782
5835
|
return
|
|
5783
5836
|
}
|
|
@@ -6214,11 +6267,17 @@
|
|
|
6214
6267
|
"dblclick",
|
|
6215
6268
|
function (e) {
|
|
6216
6269
|
if (!isInspecting || !isElementSelected || !selectedElement) return
|
|
6217
|
-
|
|
6270
|
+
// Only the grab HitArea is exempted — it covers the whole selected
|
|
6271
|
+
// unit, so it (not the real element underneath) is what `e.target`
|
|
6272
|
+
// names for a double click inside it. The 8px resize band is NOT a
|
|
6273
|
+
// separate element — it's just the outer edge of that same HitArea
|
|
6274
|
+
// div (detected by pointer position against its rect), so it's
|
|
6275
|
+
// covered by this same exemption and a dblclick there DOES
|
|
6276
|
+
// descend. Every OTHER design-mode-ui element (toolbar, output
|
|
6277
|
+
// modal, …) still bails here, same as any other inspector UI.
|
|
6218
6278
|
if (
|
|
6219
|
-
e.target &&
|
|
6220
|
-
|
|
6221
|
-
e.target.closest("[data-design-mode-ui]")
|
|
6279
|
+
isInspectorElement(e.target) &&
|
|
6280
|
+
!(e.target && e.target.closest && e.target.closest(DESIGN_MODE_HIT_AREA_SELECTOR))
|
|
6222
6281
|
) {
|
|
6223
6282
|
return
|
|
6224
6283
|
}
|
|
@@ -7,6 +7,15 @@
|
|
|
7
7
|
var _rawDocumentQuerySelectorAll = Document.prototype.querySelectorAll
|
|
8
8
|
var _documentQuerySelectorsPatched = false
|
|
9
9
|
|
|
10
|
+
// Design-mode (arrange) overlay elements — HitArea, resize handles,
|
|
11
|
+
// drop-line, etc. — carry this attribute. Single source of truth so every
|
|
12
|
+
// check below (isInspectorElement, inspectorClickHandler, the dblclick
|
|
13
|
+
// descend guard) can never desync from a rename.
|
|
14
|
+
var DESIGN_MODE_UI_SELECTOR = "[data-design-mode-ui]"
|
|
15
|
+
// The grab HitArea specifically (DesignModeOverlay.tsx's `HitArea`) — the
|
|
16
|
+
// ONLY design-mode-ui element the dblclick descend guard below exempts.
|
|
17
|
+
var DESIGN_MODE_HIT_AREA_SELECTOR = '[data-design-mode-ui="hit-area"]'
|
|
18
|
+
|
|
10
19
|
function runInspector() {
|
|
11
20
|
var INSPECTOR_PROBLEMATIC_SELECTOR_PATTERNS = [
|
|
12
21
|
/\/\d+/,
|
|
@@ -1100,6 +1109,23 @@
|
|
|
1100
1109
|
)
|
|
1101
1110
|
}
|
|
1102
1111
|
|
|
1112
|
+
// The identity a wrapper ancestor climbs AS. A plain instrumented
|
|
1113
|
+
// wrapper climbs as its own direct meta. A kit-rendered wrapper (a
|
|
1114
|
+
// `Kit.Card` host div) carries kit-TEMPLATE direct meta instead, so it
|
|
1115
|
+
// falls back to the projected USAGE one level up in the screen file —
|
|
1116
|
+
// but that usage can itself be kit/chrome, so it's re-checked below.
|
|
1117
|
+
function getVisualUnitMetaForElement(el) {
|
|
1118
|
+
var directMeta = getDirectEditorMetaFromElement(el)
|
|
1119
|
+
if (!directMeta) return null
|
|
1120
|
+
if (!isKitOrChromeMeta(directMeta)) return directMeta
|
|
1121
|
+
|
|
1122
|
+
// The projected USAGE can itself be kit/chrome (e.g. a Kit.Card host
|
|
1123
|
+
// used inside a chrome file) — re-check it so the climb never enters
|
|
1124
|
+
// chrome scaffolding through a kit-rendered wrapper.
|
|
1125
|
+
var usageMeta = projectUsageMetaFromElement(el)
|
|
1126
|
+
return usageMeta && !isKitOrChromeMeta(usageMeta) ? usageMeta : null
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1103
1129
|
function climbVisualUnitChain(leaf) {
|
|
1104
1130
|
if (!leaf) return leaf
|
|
1105
1131
|
var currentFile = getOwnSourceFileForElement(leaf)
|
|
@@ -1114,8 +1140,8 @@
|
|
|
1114
1140
|
if (isScreenRootWrapperElement(parent)) break
|
|
1115
1141
|
if (getSoleElementChild(parent) !== current) break
|
|
1116
1142
|
|
|
1117
|
-
var parentMeta =
|
|
1118
|
-
if (!parentMeta
|
|
1143
|
+
var parentMeta = getVisualUnitMetaForElement(parent)
|
|
1144
|
+
if (!parentMeta) break
|
|
1119
1145
|
if (!parentMeta.file || parentMeta.file !== currentFile) break
|
|
1120
1146
|
if (isStructuralComponentNameForUnit(parentMeta.componentName)) break
|
|
1121
1147
|
|
|
@@ -1203,16 +1229,43 @@
|
|
|
1203
1229
|
return null
|
|
1204
1230
|
}
|
|
1205
1231
|
|
|
1232
|
+
// The point-hit stack at (x, y), topmost first. Prefers elementsFromPoint
|
|
1233
|
+
// (so a topmost overlay, e.g. the design-mode grab overlay, doesn't hide
|
|
1234
|
+
// the real element beneath it) and falls back to the single-element
|
|
1235
|
+
// elementFromPoint where the multi-element API isn't available.
|
|
1236
|
+
function collectPointHitList(x, y) {
|
|
1237
|
+
try {
|
|
1238
|
+
if (typeof document.elementsFromPoint === "function") {
|
|
1239
|
+
return document.elementsFromPoint(x, y) || []
|
|
1240
|
+
}
|
|
1241
|
+
} catch (_listError) {
|
|
1242
|
+
// fall through to the single-element lookup below
|
|
1243
|
+
}
|
|
1244
|
+
try {
|
|
1245
|
+
var single = document.elementFromPoint(x, y)
|
|
1246
|
+
return single ? [single] : []
|
|
1247
|
+
} catch (_pointError) {
|
|
1248
|
+
return []
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1206
1252
|
// The direct child of `container` that sits on the ancestor line to
|
|
1207
1253
|
// (x, y) — the "select child toward the point" step (double click).
|
|
1254
|
+
// Once a unit is selected, the full-coverage design-mode grab overlay
|
|
1255
|
+
// ([data-design-mode-ui]) sits topmost at that point, so a plain
|
|
1256
|
+
// elementFromPoint would just return the overlay itself — this walks
|
|
1257
|
+
// the hit stack and skips inspector/overlay elements to find the real
|
|
1258
|
+
// element underneath, exactly like getElementFromPoint does for hover.
|
|
1208
1259
|
function findImmediateChildTowardPoint(container, x, y) {
|
|
1260
|
+
var list = collectPointHitList(x, y)
|
|
1209
1261
|
var atPoint = null
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1262
|
+
for (var i = 0; i < list.length; i++) {
|
|
1263
|
+
if (!isInspectorElement(list[i])) {
|
|
1264
|
+
atPoint = list[i]
|
|
1265
|
+
break
|
|
1266
|
+
}
|
|
1214
1267
|
}
|
|
1215
|
-
if (!atPoint
|
|
1268
|
+
if (!atPoint) return null
|
|
1216
1269
|
if (!container.contains(atPoint) || atPoint === container) return null
|
|
1217
1270
|
|
|
1218
1271
|
var current = atPoint
|
|
@@ -2180,7 +2233,7 @@
|
|
|
2180
2233
|
// drop-line, etc. These belong to the unified visual editor and must
|
|
2181
2234
|
// pass mousedown/click events through to React (dnd-kit) instead of
|
|
2182
2235
|
// being treated as inspect targets.
|
|
2183
|
-
(element.closest && element.closest(
|
|
2236
|
+
(element.closest && element.closest(DESIGN_MODE_UI_SELECTOR))
|
|
2184
2237
|
)
|
|
2185
2238
|
}
|
|
2186
2239
|
|
|
@@ -5777,7 +5830,7 @@
|
|
|
5777
5830
|
if (
|
|
5778
5831
|
e.target &&
|
|
5779
5832
|
typeof e.target.closest === "function" &&
|
|
5780
|
-
e.target.closest(
|
|
5833
|
+
e.target.closest(DESIGN_MODE_UI_SELECTOR)
|
|
5781
5834
|
) {
|
|
5782
5835
|
return
|
|
5783
5836
|
}
|
|
@@ -6214,11 +6267,17 @@
|
|
|
6214
6267
|
"dblclick",
|
|
6215
6268
|
function (e) {
|
|
6216
6269
|
if (!isInspecting || !isElementSelected || !selectedElement) return
|
|
6217
|
-
|
|
6270
|
+
// Only the grab HitArea is exempted — it covers the whole selected
|
|
6271
|
+
// unit, so it (not the real element underneath) is what `e.target`
|
|
6272
|
+
// names for a double click inside it. The 8px resize band is NOT a
|
|
6273
|
+
// separate element — it's just the outer edge of that same HitArea
|
|
6274
|
+
// div (detected by pointer position against its rect), so it's
|
|
6275
|
+
// covered by this same exemption and a dblclick there DOES
|
|
6276
|
+
// descend. Every OTHER design-mode-ui element (toolbar, output
|
|
6277
|
+
// modal, …) still bails here, same as any other inspector UI.
|
|
6218
6278
|
if (
|
|
6219
|
-
e.target &&
|
|
6220
|
-
|
|
6221
|
-
e.target.closest("[data-design-mode-ui]")
|
|
6279
|
+
isInspectorElement(e.target) &&
|
|
6280
|
+
!(e.target && e.target.closest && e.target.closest(DESIGN_MODE_HIT_AREA_SELECTOR))
|
|
6222
6281
|
) {
|
|
6223
6282
|
return
|
|
6224
6283
|
}
|