uidex 0.5.1 → 0.6.0
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/cli/cli.cjs +50 -1
- package/dist/cli/cli.cjs.map +1 -1
- package/dist/headless/index.cjs +58 -4
- package/dist/headless/index.cjs.map +1 -1
- package/dist/headless/index.d.cts +1 -0
- package/dist/headless/index.d.ts +1 -0
- package/dist/headless/index.js +58 -4
- package/dist/headless/index.js.map +1 -1
- package/dist/index.cjs +92 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +92 -23
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +92 -23
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +3 -0
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.js +92 -23
- package/dist/react/index.js.map +1 -1
- package/dist/scan/index.cjs +50 -1
- package/dist/scan/index.cjs.map +1 -1
- package/dist/scan/index.d.cts +1 -0
- package/dist/scan/index.d.ts +1 -0
- package/dist/scan/index.js +50 -1
- package/dist/scan/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -90,6 +90,7 @@ interface ReportRecord {
|
|
|
90
90
|
interface Registry {
|
|
91
91
|
add(entity: Entity): void;
|
|
92
92
|
get<K extends EntityKind>(kind: K, id: string): EntityByKind<K> | undefined;
|
|
93
|
+
matchPattern<K extends EntityKind>(kind: K, id: string): EntityByKind<K> | undefined;
|
|
93
94
|
list<K extends EntityKind>(kind: K): ReadonlyArray<EntityByKind<K>>;
|
|
94
95
|
query(predicate: (entity: Entity) => boolean): Entity[];
|
|
95
96
|
byScope(scope: Scope): Entity[];
|
package/dist/headless/index.d.ts
CHANGED
|
@@ -90,6 +90,7 @@ interface ReportRecord {
|
|
|
90
90
|
interface Registry {
|
|
91
91
|
add(entity: Entity): void;
|
|
92
92
|
get<K extends EntityKind>(kind: K, id: string): EntityByKind<K> | undefined;
|
|
93
|
+
matchPattern<K extends EntityKind>(kind: K, id: string): EntityByKind<K> | undefined;
|
|
93
94
|
list<K extends EntityKind>(kind: K): ReadonlyArray<EntityByKind<K>>;
|
|
94
95
|
query(predicate: (entity: Entity) => boolean): Entity[];
|
|
95
96
|
byScope(scope: Scope): Entity[];
|
package/dist/headless/index.js
CHANGED
|
@@ -67,6 +67,7 @@ function freezeEntity(entity, flows) {
|
|
|
67
67
|
function createRegistry() {
|
|
68
68
|
const store = emptyStore();
|
|
69
69
|
let flowsCache = null;
|
|
70
|
+
const patternCache = /* @__PURE__ */ new Map();
|
|
70
71
|
const getFlows = () => {
|
|
71
72
|
if (flowsCache === null) flowsCache = Array.from(store.flow.values());
|
|
72
73
|
return flowsCache;
|
|
@@ -76,6 +77,7 @@ function createRegistry() {
|
|
|
76
77
|
const key = entityKey(entity);
|
|
77
78
|
store[entity.kind].set(key, entity);
|
|
78
79
|
flowsCache = null;
|
|
80
|
+
patternCache.delete(entity.kind);
|
|
79
81
|
};
|
|
80
82
|
const get = (kind, id) => {
|
|
81
83
|
assertEntityKind(kind);
|
|
@@ -83,6 +85,38 @@ function createRegistry() {
|
|
|
83
85
|
if (raw === void 0) return void 0;
|
|
84
86
|
return freezeEntity(raw, getFlows());
|
|
85
87
|
};
|
|
88
|
+
const getPatternsForKind = (kind) => {
|
|
89
|
+
const cached = patternCache.get(kind);
|
|
90
|
+
if (cached !== void 0)
|
|
91
|
+
return cached;
|
|
92
|
+
const patterns = [];
|
|
93
|
+
for (const [key, entity] of store[kind]) {
|
|
94
|
+
if (key.endsWith("*")) {
|
|
95
|
+
patterns.push({
|
|
96
|
+
prefix: key.slice(0, -1),
|
|
97
|
+
entity
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
patternCache.set(
|
|
102
|
+
kind,
|
|
103
|
+
patterns
|
|
104
|
+
);
|
|
105
|
+
return patterns;
|
|
106
|
+
};
|
|
107
|
+
const matchPattern = (kind, id) => {
|
|
108
|
+
assertEntityKind(kind);
|
|
109
|
+
const patterns = getPatternsForKind(kind);
|
|
110
|
+
if (patterns.length === 0) return void 0;
|
|
111
|
+
let best;
|
|
112
|
+
for (const entry of patterns) {
|
|
113
|
+
if (id.startsWith(entry.prefix) && (best === void 0 || entry.prefix.length > best.prefix.length)) {
|
|
114
|
+
best = entry;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (best === void 0) return void 0;
|
|
118
|
+
return freezeEntity(best.entity, getFlows());
|
|
119
|
+
};
|
|
86
120
|
const list = (kind) => {
|
|
87
121
|
assertEntityKind(kind);
|
|
88
122
|
const flows = getFlows();
|
|
@@ -133,6 +167,7 @@ function createRegistry() {
|
|
|
133
167
|
return {
|
|
134
168
|
add,
|
|
135
169
|
get,
|
|
170
|
+
matchPattern,
|
|
136
171
|
list,
|
|
137
172
|
query,
|
|
138
173
|
byScope,
|
|
@@ -823,6 +858,9 @@ var tailwind_built_default = `/*! tailwindcss v4.2.2 | MIT License | https://tai
|
|
|
823
858
|
.relative {
|
|
824
859
|
position: relative;
|
|
825
860
|
}
|
|
861
|
+
.static {
|
|
862
|
+
position: static;
|
|
863
|
+
}
|
|
826
864
|
.inset-0 {
|
|
827
865
|
inset: calc(var(--spacing) * 0);
|
|
828
866
|
}
|
|
@@ -3212,16 +3250,18 @@ function createCursorTooltip(deps) {
|
|
|
3212
3250
|
const renderBody = () => {
|
|
3213
3251
|
body.replaceChildren();
|
|
3214
3252
|
if (typeof currentContent === "string") {
|
|
3215
|
-
applyColor(
|
|
3253
|
+
applyColor("#a1a1aa");
|
|
3254
|
+
el2.style.opacity = "0.6";
|
|
3216
3255
|
body.append(document.createTextNode(currentContent));
|
|
3217
3256
|
return;
|
|
3218
3257
|
}
|
|
3219
3258
|
if (!currentContent) return;
|
|
3259
|
+
el2.style.opacity = "1";
|
|
3220
3260
|
const { entity, node } = currentContent;
|
|
3221
3261
|
const style = KIND_STYLE[entity.kind];
|
|
3222
3262
|
const demoted = entity.kind === "primitive";
|
|
3223
3263
|
applyColor(style?.color ?? DEFAULT_TOOLTIP_COLOR);
|
|
3224
|
-
el2.style.opacity =
|
|
3264
|
+
if (demoted) el2.style.opacity = "0.55";
|
|
3225
3265
|
if (style) {
|
|
3226
3266
|
const svg = createLucideElement(style.icon);
|
|
3227
3267
|
svg.setAttribute("aria-hidden", "true");
|
|
@@ -3272,7 +3312,7 @@ function createCursorTooltip(deps) {
|
|
|
3272
3312
|
// src/browser/surface/inspector.ts
|
|
3273
3313
|
function entityForRef(ref, registry) {
|
|
3274
3314
|
if (registry) {
|
|
3275
|
-
const found = registry.get(ref.kind, ref.id);
|
|
3315
|
+
const found = registry.get(ref.kind, ref.id) ?? registry.matchPattern?.(ref.kind, ref.id);
|
|
3276
3316
|
if (found) return found;
|
|
3277
3317
|
}
|
|
3278
3318
|
if (ref.kind === "route") return { kind: "route", path: ref.id, page: ref.id };
|
|
@@ -3329,7 +3369,8 @@ function createInspector(options) {
|
|
|
3329
3369
|
resolveAll = (target) => defaultResolveAllMatches(target, registry),
|
|
3330
3370
|
onHover,
|
|
3331
3371
|
onSelect,
|
|
3332
|
-
onCycle
|
|
3372
|
+
onCycle,
|
|
3373
|
+
onObscured
|
|
3333
3374
|
} = options;
|
|
3334
3375
|
let mounted = false;
|
|
3335
3376
|
let currentEl = null;
|
|
@@ -3338,6 +3379,13 @@ function createInspector(options) {
|
|
|
3338
3379
|
let layerIndex = 0;
|
|
3339
3380
|
let lastCursor = { x: 0, y: 0 };
|
|
3340
3381
|
const makeStack = () => stack.length > 0 ? { matches: stack, index: layerIndex, current: stack[layerIndex] } : null;
|
|
3382
|
+
const onDocumentLeave = () => {
|
|
3383
|
+
currentEl = null;
|
|
3384
|
+
stack = [];
|
|
3385
|
+
layerIndex = 0;
|
|
3386
|
+
session.highlight.unhover();
|
|
3387
|
+
onObscured?.(lastCursor);
|
|
3388
|
+
};
|
|
3341
3389
|
const onMouseMove = (e) => {
|
|
3342
3390
|
if (!(e.target instanceof Element)) return;
|
|
3343
3391
|
const matches = resolveAll(e.target);
|
|
@@ -3390,6 +3438,7 @@ function createInspector(options) {
|
|
|
3390
3438
|
document.head.appendChild(cursorStyleEl);
|
|
3391
3439
|
}
|
|
3392
3440
|
document.addEventListener("mousemove", onMouseMove);
|
|
3441
|
+
document.addEventListener("mouseleave", onDocumentLeave);
|
|
3393
3442
|
document.addEventListener("click", onClick, true);
|
|
3394
3443
|
document.addEventListener("contextmenu", onContextMenu, true);
|
|
3395
3444
|
},
|
|
@@ -3404,6 +3453,7 @@ function createInspector(options) {
|
|
|
3404
3453
|
cursorStyleEl = null;
|
|
3405
3454
|
}
|
|
3406
3455
|
document.removeEventListener("mousemove", onMouseMove);
|
|
3456
|
+
document.removeEventListener("mouseleave", onDocumentLeave);
|
|
3407
3457
|
document.removeEventListener("click", onClick, true);
|
|
3408
3458
|
document.removeEventListener("contextmenu", onContextMenu, true);
|
|
3409
3459
|
session.highlight.unhover();
|
|
@@ -4189,6 +4239,10 @@ function createSurfaceShell(options) {
|
|
|
4189
4239
|
},
|
|
4190
4240
|
onCycle: (stack, cursor) => {
|
|
4191
4241
|
showStack(stack, cursor);
|
|
4242
|
+
},
|
|
4243
|
+
onObscured: (cursor) => {
|
|
4244
|
+
overlay.hide();
|
|
4245
|
+
tooltip.update("iframe", cursor);
|
|
4192
4246
|
}
|
|
4193
4247
|
});
|
|
4194
4248
|
cleanup.add(inspector);
|