@archie/devtools 0.1.5 → 0.1.6

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.
@@ -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.5" ? "0.1.5" : null;
10133
+ return "0.1.6" ? "0.1.6" : null;
10134
10134
  }
10135
10135
  var REMOTE_INSPECTOR_VERSION = readBuildVersion();
10136
10136
  var isRemoteInspectorUrlVersioned = REMOTE_INSPECTOR_VERSION !== null;
@@ -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.5" ? "0.1.5" : null;
10098
+ return "0.1.6" ? "0.1.6" : 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
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archie/devtools",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "DevTools for Archie generated applications - Route synchronization and editor communication",
5
5
  "sideEffects": false,
6
6
  "repository": {