@archie/devtools 0.1.5 → 0.1.7
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/client/client.js
CHANGED
|
@@ -10130,7 +10130,7 @@ function isPreviewOrigin(origin) {
|
|
|
10130
10130
|
var DEFAULT_SCRIPT_ID = "archie-inspector-script";
|
|
10131
10131
|
var R2_INSPECTOR_BASE_URL = "https://pub-bf238c278d9644b39ec34ecaca1d315c.r2.dev";
|
|
10132
10132
|
function readBuildVersion() {
|
|
10133
|
-
return "0.1.
|
|
10133
|
+
return "0.1.7" ? "0.1.7" : null;
|
|
10134
10134
|
}
|
|
10135
10135
|
var REMOTE_INSPECTOR_VERSION = readBuildVersion();
|
|
10136
10136
|
var isRemoteInspectorUrlVersioned = REMOTE_INSPECTOR_VERSION !== null;
|
package/dist/client/client.mjs
CHANGED
|
@@ -10095,7 +10095,7 @@ function isPreviewOrigin(origin) {
|
|
|
10095
10095
|
var DEFAULT_SCRIPT_ID = "archie-inspector-script";
|
|
10096
10096
|
var R2_INSPECTOR_BASE_URL = "https://pub-bf238c278d9644b39ec34ecaca1d315c.r2.dev";
|
|
10097
10097
|
function readBuildVersion() {
|
|
10098
|
-
return "0.1.
|
|
10098
|
+
return "0.1.7" ? "0.1.7" : null;
|
|
10099
10099
|
}
|
|
10100
10100
|
var REMOTE_INSPECTOR_VERSION = readBuildVersion();
|
|
10101
10101
|
var isRemoteInspectorUrlVersioned = REMOTE_INSPECTOR_VERSION !== null;
|
|
@@ -1126,6 +1126,98 @@
|
|
|
1126
1126
|
return usageMeta && !isKitOrChromeMeta(usageMeta) ? usageMeta : null
|
|
1127
1127
|
}
|
|
1128
1128
|
|
|
1129
|
+
// True when `el`'s OWN identity is a directly-authored screen/project
|
|
1130
|
+
// node — its own host fiber carries `__editorMeta` that is neither
|
|
1131
|
+
// kit-origin nor chrome, i.e. a plain hand-written wrapper (`<a>`, a
|
|
1132
|
+
// layout `<div>`). FALSE for a component INSTANCE whose selectable
|
|
1133
|
+
// identity only exists by projecting onto an owning fiber — kit-runtime
|
|
1134
|
+
// renders `<Button>`'s `<button>`/`Kit.Card`'s host `<div>` with no such
|
|
1135
|
+
// direct, non-template meta of their own (see `getOwnerEditorMetaFromElement`
|
|
1136
|
+
// and `projectUsageMetaFromElement`'s docstrings above).
|
|
1137
|
+
function isBareAuthoredNode(el) {
|
|
1138
|
+
var direct = getDirectEditorMetaFromElement(el)
|
|
1139
|
+
return !!direct && !isKitOrChromeMeta(direct)
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
function parseCssLengthForUnit(value) {
|
|
1143
|
+
var n = parseFloat(value)
|
|
1144
|
+
return isNaN(n) ? 0 : n
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
function hasVisibleBorderSideForUnit(style, widthProp, styleProp) {
|
|
1148
|
+
var styleValue = style.getPropertyValue(styleProp)
|
|
1149
|
+
return (
|
|
1150
|
+
parseCssLengthForUnit(style.getPropertyValue(widthProp)) > 0 &&
|
|
1151
|
+
styleValue !== "none" &&
|
|
1152
|
+
styleValue !== ""
|
|
1153
|
+
)
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
// A wrapper's OWN visual footprint — background, border, shadow,
|
|
1157
|
+
// radius or padding it renders on its own box, the signal that a click
|
|
1158
|
+
// on it hits something the user perceives as a distinct surface, not
|
|
1159
|
+
// bare layout plumbing (a plain `<a>`/`<div>` with zero box styling of
|
|
1160
|
+
// its own). Used only to decide whether a BARE wrapper (see
|
|
1161
|
+
// `isBareAuthoredNode`) may still swallow a component instance — a
|
|
1162
|
+
// styled wrapper (a card) keeps the pre-existing #52 behavior.
|
|
1163
|
+
function hasOwnVisualStyle(el) {
|
|
1164
|
+
if (!el) return false
|
|
1165
|
+
var style
|
|
1166
|
+
try {
|
|
1167
|
+
style = window.getComputedStyle(el)
|
|
1168
|
+
} catch (styleError) {
|
|
1169
|
+
// Unverifiable — fail OPEN to the pre-existing climb behavior
|
|
1170
|
+
// (never newly block a climb the runtime already performed).
|
|
1171
|
+
return true
|
|
1172
|
+
}
|
|
1173
|
+
if (!style) return true
|
|
1174
|
+
|
|
1175
|
+
var backgroundColor = style.getPropertyValue("background-color")
|
|
1176
|
+
if (
|
|
1177
|
+
backgroundColor &&
|
|
1178
|
+
backgroundColor !== "transparent" &&
|
|
1179
|
+
backgroundColor !== "rgba(0, 0, 0, 0)" &&
|
|
1180
|
+
backgroundColor !== "rgba(0,0,0,0)"
|
|
1181
|
+
) {
|
|
1182
|
+
return true
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
var backgroundImage = style.getPropertyValue("background-image")
|
|
1186
|
+
if (backgroundImage && backgroundImage !== "none") return true
|
|
1187
|
+
|
|
1188
|
+
var boxShadow = style.getPropertyValue("box-shadow")
|
|
1189
|
+
if (boxShadow && boxShadow !== "none") return true
|
|
1190
|
+
|
|
1191
|
+
if (
|
|
1192
|
+
hasVisibleBorderSideForUnit(style, "border-top-width", "border-top-style") ||
|
|
1193
|
+
hasVisibleBorderSideForUnit(style, "border-right-width", "border-right-style") ||
|
|
1194
|
+
hasVisibleBorderSideForUnit(style, "border-bottom-width", "border-bottom-style") ||
|
|
1195
|
+
hasVisibleBorderSideForUnit(style, "border-left-width", "border-left-style")
|
|
1196
|
+
) {
|
|
1197
|
+
return true
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
if (
|
|
1201
|
+
parseCssLengthForUnit(style.getPropertyValue("border-top-left-radius")) > 0 ||
|
|
1202
|
+
parseCssLengthForUnit(style.getPropertyValue("border-top-right-radius")) > 0 ||
|
|
1203
|
+
parseCssLengthForUnit(style.getPropertyValue("border-bottom-left-radius")) > 0 ||
|
|
1204
|
+
parseCssLengthForUnit(style.getPropertyValue("border-bottom-right-radius")) > 0
|
|
1205
|
+
) {
|
|
1206
|
+
return true
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
if (
|
|
1210
|
+
parseCssLengthForUnit(style.getPropertyValue("padding-top")) > 0 ||
|
|
1211
|
+
parseCssLengthForUnit(style.getPropertyValue("padding-right")) > 0 ||
|
|
1212
|
+
parseCssLengthForUnit(style.getPropertyValue("padding-bottom")) > 0 ||
|
|
1213
|
+
parseCssLengthForUnit(style.getPropertyValue("padding-left")) > 0
|
|
1214
|
+
) {
|
|
1215
|
+
return true
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
return false
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1129
1221
|
function climbVisualUnitChain(leaf) {
|
|
1130
1222
|
if (!leaf) return leaf
|
|
1131
1223
|
var currentFile = getOwnSourceFileForElement(leaf)
|
|
@@ -1161,6 +1253,25 @@
|
|
|
1161
1253
|
break
|
|
1162
1254
|
}
|
|
1163
1255
|
|
|
1256
|
+
// Bare-wrapper guard (ARCH — instance swallowed by a styleless
|
|
1257
|
+
// wrapper): a plain, directly-authored wrapper (an `<a>`, a layout
|
|
1258
|
+
// `<div>`) with NO visual footprint of its own, whose only child is
|
|
1259
|
+
// a component INSTANCE (its identity reachable only by projecting
|
|
1260
|
+
// onto an owning fiber — never a bare node itself), must not
|
|
1261
|
+
// swallow that instance: the instance is what the user sees and
|
|
1262
|
+
// clicks, the wrapper is invisible plumbing. A wrapper that itself
|
|
1263
|
+
// renders real background/border/shadow/radius/padding (a card)
|
|
1264
|
+
// keeps the existing #52 behavior and still wins the climb, and a
|
|
1265
|
+
// kit-rendered wrapper (itself a projected instance, never a bare
|
|
1266
|
+
// node) is untouched by this guard — see `isBareAuthoredNode`.
|
|
1267
|
+
if (
|
|
1268
|
+
isBareAuthoredNode(parent) &&
|
|
1269
|
+
!isBareAuthoredNode(current) &&
|
|
1270
|
+
!hasOwnVisualStyle(parent)
|
|
1271
|
+
) {
|
|
1272
|
+
break
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1164
1275
|
current = parent
|
|
1165
1276
|
}
|
|
1166
1277
|
return current
|
|
@@ -4012,6 +4123,30 @@
|
|
|
4012
4123
|
)
|
|
4013
4124
|
}
|
|
4014
4125
|
|
|
4126
|
+
// Same "usage outranks kit template" precedence as
|
|
4127
|
+
// `getInspectorInfoFromElement`/`getExactSourceSignatureFromElement`
|
|
4128
|
+
// (see those docstrings) — `extractMetadata`'s `editorMeta`/`vid`/
|
|
4129
|
+
// `nodeMeta` used to read plain `findNearestEditorMeta`, which walks
|
|
4130
|
+
// the fiber chain nearest-meta-wins with NO usage projection. That is
|
|
4131
|
+
// correct for a bare, directly-authored node, but wrong the moment
|
|
4132
|
+
// `element` is a kit-rendered host with its OWN kit-template direct
|
|
4133
|
+
// meta (Kit.Card's root div, a real, instrumented `origin:'kit'`/
|
|
4134
|
+
// `template:true` position) — it reported the TEMPLATE's own internal
|
|
4135
|
+
// vid instead of the screen-file USAGE's, the instant the bare-wrapper
|
|
4136
|
+
// guard above (or any other caller) hands `extractMetadata` a
|
|
4137
|
+
// kit-rendered node directly, instead of one already climbed past by
|
|
4138
|
+
// `climbVisualUnitChain`'s kit-wrapper fallback.
|
|
4139
|
+
function resolveEditorMetaResultForElement(element) {
|
|
4140
|
+
if (!element) return null
|
|
4141
|
+
var usageMeta = projectUsageMetaFromElement(element)
|
|
4142
|
+
if (usageMeta) return { meta: usageMeta, element: element }
|
|
4143
|
+
var directMeta = getDirectEditorMetaFromElement(element)
|
|
4144
|
+
if (directMeta) return { meta: directMeta, element: element }
|
|
4145
|
+
var ownerMeta = getOwnerEditorMetaFromElement(element)
|
|
4146
|
+
if (ownerMeta) return { meta: ownerMeta, element: element }
|
|
4147
|
+
return findNearestEditorMeta(element)
|
|
4148
|
+
}
|
|
4149
|
+
|
|
4015
4150
|
function extractMetadata(element) {
|
|
4016
4151
|
if (!element) return null
|
|
4017
4152
|
|
|
@@ -4027,7 +4162,7 @@
|
|
|
4027
4162
|
}
|
|
4028
4163
|
|
|
4029
4164
|
const inspectorInfo = getInspectorInfoFromElement(element)
|
|
4030
|
-
const editorMeta =
|
|
4165
|
+
const editorMeta = resolveEditorMetaResultForElement(element)
|
|
4031
4166
|
|
|
4032
4167
|
return {
|
|
4033
4168
|
tagName: tagName,
|
|
@@ -1126,6 +1126,98 @@
|
|
|
1126
1126
|
return usageMeta && !isKitOrChromeMeta(usageMeta) ? usageMeta : null
|
|
1127
1127
|
}
|
|
1128
1128
|
|
|
1129
|
+
// True when `el`'s OWN identity is a directly-authored screen/project
|
|
1130
|
+
// node — its own host fiber carries `__editorMeta` that is neither
|
|
1131
|
+
// kit-origin nor chrome, i.e. a plain hand-written wrapper (`<a>`, a
|
|
1132
|
+
// layout `<div>`). FALSE for a component INSTANCE whose selectable
|
|
1133
|
+
// identity only exists by projecting onto an owning fiber — kit-runtime
|
|
1134
|
+
// renders `<Button>`'s `<button>`/`Kit.Card`'s host `<div>` with no such
|
|
1135
|
+
// direct, non-template meta of their own (see `getOwnerEditorMetaFromElement`
|
|
1136
|
+
// and `projectUsageMetaFromElement`'s docstrings above).
|
|
1137
|
+
function isBareAuthoredNode(el) {
|
|
1138
|
+
var direct = getDirectEditorMetaFromElement(el)
|
|
1139
|
+
return !!direct && !isKitOrChromeMeta(direct)
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
function parseCssLengthForUnit(value) {
|
|
1143
|
+
var n = parseFloat(value)
|
|
1144
|
+
return isNaN(n) ? 0 : n
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
function hasVisibleBorderSideForUnit(style, widthProp, styleProp) {
|
|
1148
|
+
var styleValue = style.getPropertyValue(styleProp)
|
|
1149
|
+
return (
|
|
1150
|
+
parseCssLengthForUnit(style.getPropertyValue(widthProp)) > 0 &&
|
|
1151
|
+
styleValue !== "none" &&
|
|
1152
|
+
styleValue !== ""
|
|
1153
|
+
)
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
// A wrapper's OWN visual footprint — background, border, shadow,
|
|
1157
|
+
// radius or padding it renders on its own box, the signal that a click
|
|
1158
|
+
// on it hits something the user perceives as a distinct surface, not
|
|
1159
|
+
// bare layout plumbing (a plain `<a>`/`<div>` with zero box styling of
|
|
1160
|
+
// its own). Used only to decide whether a BARE wrapper (see
|
|
1161
|
+
// `isBareAuthoredNode`) may still swallow a component instance — a
|
|
1162
|
+
// styled wrapper (a card) keeps the pre-existing #52 behavior.
|
|
1163
|
+
function hasOwnVisualStyle(el) {
|
|
1164
|
+
if (!el) return false
|
|
1165
|
+
var style
|
|
1166
|
+
try {
|
|
1167
|
+
style = window.getComputedStyle(el)
|
|
1168
|
+
} catch (styleError) {
|
|
1169
|
+
// Unverifiable — fail OPEN to the pre-existing climb behavior
|
|
1170
|
+
// (never newly block a climb the runtime already performed).
|
|
1171
|
+
return true
|
|
1172
|
+
}
|
|
1173
|
+
if (!style) return true
|
|
1174
|
+
|
|
1175
|
+
var backgroundColor = style.getPropertyValue("background-color")
|
|
1176
|
+
if (
|
|
1177
|
+
backgroundColor &&
|
|
1178
|
+
backgroundColor !== "transparent" &&
|
|
1179
|
+
backgroundColor !== "rgba(0, 0, 0, 0)" &&
|
|
1180
|
+
backgroundColor !== "rgba(0,0,0,0)"
|
|
1181
|
+
) {
|
|
1182
|
+
return true
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
var backgroundImage = style.getPropertyValue("background-image")
|
|
1186
|
+
if (backgroundImage && backgroundImage !== "none") return true
|
|
1187
|
+
|
|
1188
|
+
var boxShadow = style.getPropertyValue("box-shadow")
|
|
1189
|
+
if (boxShadow && boxShadow !== "none") return true
|
|
1190
|
+
|
|
1191
|
+
if (
|
|
1192
|
+
hasVisibleBorderSideForUnit(style, "border-top-width", "border-top-style") ||
|
|
1193
|
+
hasVisibleBorderSideForUnit(style, "border-right-width", "border-right-style") ||
|
|
1194
|
+
hasVisibleBorderSideForUnit(style, "border-bottom-width", "border-bottom-style") ||
|
|
1195
|
+
hasVisibleBorderSideForUnit(style, "border-left-width", "border-left-style")
|
|
1196
|
+
) {
|
|
1197
|
+
return true
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
if (
|
|
1201
|
+
parseCssLengthForUnit(style.getPropertyValue("border-top-left-radius")) > 0 ||
|
|
1202
|
+
parseCssLengthForUnit(style.getPropertyValue("border-top-right-radius")) > 0 ||
|
|
1203
|
+
parseCssLengthForUnit(style.getPropertyValue("border-bottom-left-radius")) > 0 ||
|
|
1204
|
+
parseCssLengthForUnit(style.getPropertyValue("border-bottom-right-radius")) > 0
|
|
1205
|
+
) {
|
|
1206
|
+
return true
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
if (
|
|
1210
|
+
parseCssLengthForUnit(style.getPropertyValue("padding-top")) > 0 ||
|
|
1211
|
+
parseCssLengthForUnit(style.getPropertyValue("padding-right")) > 0 ||
|
|
1212
|
+
parseCssLengthForUnit(style.getPropertyValue("padding-bottom")) > 0 ||
|
|
1213
|
+
parseCssLengthForUnit(style.getPropertyValue("padding-left")) > 0
|
|
1214
|
+
) {
|
|
1215
|
+
return true
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
return false
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1129
1221
|
function climbVisualUnitChain(leaf) {
|
|
1130
1222
|
if (!leaf) return leaf
|
|
1131
1223
|
var currentFile = getOwnSourceFileForElement(leaf)
|
|
@@ -1161,6 +1253,25 @@
|
|
|
1161
1253
|
break
|
|
1162
1254
|
}
|
|
1163
1255
|
|
|
1256
|
+
// Bare-wrapper guard (ARCH — instance swallowed by a styleless
|
|
1257
|
+
// wrapper): a plain, directly-authored wrapper (an `<a>`, a layout
|
|
1258
|
+
// `<div>`) with NO visual footprint of its own, whose only child is
|
|
1259
|
+
// a component INSTANCE (its identity reachable only by projecting
|
|
1260
|
+
// onto an owning fiber — never a bare node itself), must not
|
|
1261
|
+
// swallow that instance: the instance is what the user sees and
|
|
1262
|
+
// clicks, the wrapper is invisible plumbing. A wrapper that itself
|
|
1263
|
+
// renders real background/border/shadow/radius/padding (a card)
|
|
1264
|
+
// keeps the existing #52 behavior and still wins the climb, and a
|
|
1265
|
+
// kit-rendered wrapper (itself a projected instance, never a bare
|
|
1266
|
+
// node) is untouched by this guard — see `isBareAuthoredNode`.
|
|
1267
|
+
if (
|
|
1268
|
+
isBareAuthoredNode(parent) &&
|
|
1269
|
+
!isBareAuthoredNode(current) &&
|
|
1270
|
+
!hasOwnVisualStyle(parent)
|
|
1271
|
+
) {
|
|
1272
|
+
break
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1164
1275
|
current = parent
|
|
1165
1276
|
}
|
|
1166
1277
|
return current
|
|
@@ -4012,6 +4123,30 @@
|
|
|
4012
4123
|
)
|
|
4013
4124
|
}
|
|
4014
4125
|
|
|
4126
|
+
// Same "usage outranks kit template" precedence as
|
|
4127
|
+
// `getInspectorInfoFromElement`/`getExactSourceSignatureFromElement`
|
|
4128
|
+
// (see those docstrings) — `extractMetadata`'s `editorMeta`/`vid`/
|
|
4129
|
+
// `nodeMeta` used to read plain `findNearestEditorMeta`, which walks
|
|
4130
|
+
// the fiber chain nearest-meta-wins with NO usage projection. That is
|
|
4131
|
+
// correct for a bare, directly-authored node, but wrong the moment
|
|
4132
|
+
// `element` is a kit-rendered host with its OWN kit-template direct
|
|
4133
|
+
// meta (Kit.Card's root div, a real, instrumented `origin:'kit'`/
|
|
4134
|
+
// `template:true` position) — it reported the TEMPLATE's own internal
|
|
4135
|
+
// vid instead of the screen-file USAGE's, the instant the bare-wrapper
|
|
4136
|
+
// guard above (or any other caller) hands `extractMetadata` a
|
|
4137
|
+
// kit-rendered node directly, instead of one already climbed past by
|
|
4138
|
+
// `climbVisualUnitChain`'s kit-wrapper fallback.
|
|
4139
|
+
function resolveEditorMetaResultForElement(element) {
|
|
4140
|
+
if (!element) return null
|
|
4141
|
+
var usageMeta = projectUsageMetaFromElement(element)
|
|
4142
|
+
if (usageMeta) return { meta: usageMeta, element: element }
|
|
4143
|
+
var directMeta = getDirectEditorMetaFromElement(element)
|
|
4144
|
+
if (directMeta) return { meta: directMeta, element: element }
|
|
4145
|
+
var ownerMeta = getOwnerEditorMetaFromElement(element)
|
|
4146
|
+
if (ownerMeta) return { meta: ownerMeta, element: element }
|
|
4147
|
+
return findNearestEditorMeta(element)
|
|
4148
|
+
}
|
|
4149
|
+
|
|
4015
4150
|
function extractMetadata(element) {
|
|
4016
4151
|
if (!element) return null
|
|
4017
4152
|
|
|
@@ -4027,7 +4162,7 @@
|
|
|
4027
4162
|
}
|
|
4028
4163
|
|
|
4029
4164
|
const inspectorInfo = getInspectorInfoFromElement(element)
|
|
4030
|
-
const editorMeta =
|
|
4165
|
+
const editorMeta = resolveEditorMetaResultForElement(element)
|
|
4031
4166
|
|
|
4032
4167
|
return {
|
|
4033
4168
|
tagName: tagName,
|