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
package/dist/index.cjs
CHANGED
|
@@ -155,6 +155,7 @@ function freezeEntity(entity, flows) {
|
|
|
155
155
|
function createRegistry() {
|
|
156
156
|
const store = emptyStore();
|
|
157
157
|
let flowsCache = null;
|
|
158
|
+
const patternCache = /* @__PURE__ */ new Map();
|
|
158
159
|
const getFlows = () => {
|
|
159
160
|
if (flowsCache === null) flowsCache = Array.from(store.flow.values());
|
|
160
161
|
return flowsCache;
|
|
@@ -164,6 +165,7 @@ function createRegistry() {
|
|
|
164
165
|
const key = entityKey(entity);
|
|
165
166
|
store[entity.kind].set(key, entity);
|
|
166
167
|
flowsCache = null;
|
|
168
|
+
patternCache.delete(entity.kind);
|
|
167
169
|
};
|
|
168
170
|
const get = (kind, id) => {
|
|
169
171
|
assertEntityKind(kind);
|
|
@@ -171,6 +173,38 @@ function createRegistry() {
|
|
|
171
173
|
if (raw === void 0) return void 0;
|
|
172
174
|
return freezeEntity(raw, getFlows());
|
|
173
175
|
};
|
|
176
|
+
const getPatternsForKind = (kind) => {
|
|
177
|
+
const cached = patternCache.get(kind);
|
|
178
|
+
if (cached !== void 0)
|
|
179
|
+
return cached;
|
|
180
|
+
const patterns = [];
|
|
181
|
+
for (const [key, entity] of store[kind]) {
|
|
182
|
+
if (key.endsWith("*")) {
|
|
183
|
+
patterns.push({
|
|
184
|
+
prefix: key.slice(0, -1),
|
|
185
|
+
entity
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
patternCache.set(
|
|
190
|
+
kind,
|
|
191
|
+
patterns
|
|
192
|
+
);
|
|
193
|
+
return patterns;
|
|
194
|
+
};
|
|
195
|
+
const matchPattern = (kind, id) => {
|
|
196
|
+
assertEntityKind(kind);
|
|
197
|
+
const patterns = getPatternsForKind(kind);
|
|
198
|
+
if (patterns.length === 0) return void 0;
|
|
199
|
+
let best;
|
|
200
|
+
for (const entry of patterns) {
|
|
201
|
+
if (id.startsWith(entry.prefix) && (best === void 0 || entry.prefix.length > best.prefix.length)) {
|
|
202
|
+
best = entry;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (best === void 0) return void 0;
|
|
206
|
+
return freezeEntity(best.entity, getFlows());
|
|
207
|
+
};
|
|
174
208
|
const list = (kind) => {
|
|
175
209
|
assertEntityKind(kind);
|
|
176
210
|
const flows = getFlows();
|
|
@@ -221,6 +255,7 @@ function createRegistry() {
|
|
|
221
255
|
return {
|
|
222
256
|
add,
|
|
223
257
|
get,
|
|
258
|
+
matchPattern,
|
|
224
259
|
list,
|
|
225
260
|
query,
|
|
226
261
|
byScope,
|
|
@@ -1173,6 +1208,9 @@ var tailwind_built_default = `/*! tailwindcss v4.2.2 | MIT License | https://tai
|
|
|
1173
1208
|
.relative {
|
|
1174
1209
|
position: relative;
|
|
1175
1210
|
}
|
|
1211
|
+
.static {
|
|
1212
|
+
position: static;
|
|
1213
|
+
}
|
|
1176
1214
|
.inset-0 {
|
|
1177
1215
|
inset: calc(var(--spacing) * 0);
|
|
1178
1216
|
}
|
|
@@ -3563,16 +3601,18 @@ function createCursorTooltip(deps) {
|
|
|
3563
3601
|
const renderBody = () => {
|
|
3564
3602
|
body.replaceChildren();
|
|
3565
3603
|
if (typeof currentContent === "string") {
|
|
3566
|
-
applyColor(
|
|
3604
|
+
applyColor("#a1a1aa");
|
|
3605
|
+
el2.style.opacity = "0.6";
|
|
3567
3606
|
body.append(document.createTextNode(currentContent));
|
|
3568
3607
|
return;
|
|
3569
3608
|
}
|
|
3570
3609
|
if (!currentContent) return;
|
|
3610
|
+
el2.style.opacity = "1";
|
|
3571
3611
|
const { entity, node } = currentContent;
|
|
3572
3612
|
const style = KIND_STYLE[entity.kind];
|
|
3573
3613
|
const demoted = entity.kind === "primitive";
|
|
3574
3614
|
applyColor(style?.color ?? DEFAULT_TOOLTIP_COLOR);
|
|
3575
|
-
el2.style.opacity =
|
|
3615
|
+
if (demoted) el2.style.opacity = "0.55";
|
|
3576
3616
|
if (style) {
|
|
3577
3617
|
const svg2 = (0, import_lucide2.createElement)(style.icon);
|
|
3578
3618
|
svg2.setAttribute("aria-hidden", "true");
|
|
@@ -3623,7 +3663,7 @@ function createCursorTooltip(deps) {
|
|
|
3623
3663
|
// src/browser/surface/inspector.ts
|
|
3624
3664
|
function entityForRef(ref2, registry) {
|
|
3625
3665
|
if (registry) {
|
|
3626
|
-
const found = registry.get(ref2.kind, ref2.id);
|
|
3666
|
+
const found = registry.get(ref2.kind, ref2.id) ?? registry.matchPattern?.(ref2.kind, ref2.id);
|
|
3627
3667
|
if (found) return found;
|
|
3628
3668
|
}
|
|
3629
3669
|
if (ref2.kind === "route") return { kind: "route", path: ref2.id, page: ref2.id };
|
|
@@ -3733,7 +3773,8 @@ function createInspector(options) {
|
|
|
3733
3773
|
resolveAll = (target) => defaultResolveAllMatches(target, registry),
|
|
3734
3774
|
onHover,
|
|
3735
3775
|
onSelect,
|
|
3736
|
-
onCycle
|
|
3776
|
+
onCycle,
|
|
3777
|
+
onObscured
|
|
3737
3778
|
} = options;
|
|
3738
3779
|
let mounted = false;
|
|
3739
3780
|
let currentEl = null;
|
|
@@ -3742,6 +3783,13 @@ function createInspector(options) {
|
|
|
3742
3783
|
let layerIndex = 0;
|
|
3743
3784
|
let lastCursor = { x: 0, y: 0 };
|
|
3744
3785
|
const makeStack = () => stack.length > 0 ? { matches: stack, index: layerIndex, current: stack[layerIndex] } : null;
|
|
3786
|
+
const onDocumentLeave = () => {
|
|
3787
|
+
currentEl = null;
|
|
3788
|
+
stack = [];
|
|
3789
|
+
layerIndex = 0;
|
|
3790
|
+
session.highlight.unhover();
|
|
3791
|
+
onObscured?.(lastCursor);
|
|
3792
|
+
};
|
|
3745
3793
|
const onMouseMove = (e) => {
|
|
3746
3794
|
if (!(e.target instanceof Element)) return;
|
|
3747
3795
|
const matches = resolveAll(e.target);
|
|
@@ -3794,6 +3842,7 @@ function createInspector(options) {
|
|
|
3794
3842
|
document.head.appendChild(cursorStyleEl);
|
|
3795
3843
|
}
|
|
3796
3844
|
document.addEventListener("mousemove", onMouseMove);
|
|
3845
|
+
document.addEventListener("mouseleave", onDocumentLeave);
|
|
3797
3846
|
document.addEventListener("click", onClick, true);
|
|
3798
3847
|
document.addEventListener("contextmenu", onContextMenu, true);
|
|
3799
3848
|
},
|
|
@@ -3808,6 +3857,7 @@ function createInspector(options) {
|
|
|
3808
3857
|
cursorStyleEl = null;
|
|
3809
3858
|
}
|
|
3810
3859
|
document.removeEventListener("mousemove", onMouseMove);
|
|
3860
|
+
document.removeEventListener("mouseleave", onDocumentLeave);
|
|
3811
3861
|
document.removeEventListener("click", onClick, true);
|
|
3812
3862
|
document.removeEventListener("contextmenu", onContextMenu, true);
|
|
3813
3863
|
session.highlight.unhover();
|
|
@@ -4706,6 +4756,10 @@ function createSurfaceShell(options) {
|
|
|
4706
4756
|
},
|
|
4707
4757
|
onCycle: (stack, cursor) => {
|
|
4708
4758
|
showStack(stack, cursor);
|
|
4759
|
+
},
|
|
4760
|
+
onObscured: (cursor) => {
|
|
4761
|
+
overlay.hide();
|
|
4762
|
+
tooltip.update("iframe", cursor);
|
|
4709
4763
|
}
|
|
4710
4764
|
});
|
|
4711
4765
|
cleanup.add(inspector);
|
|
@@ -5603,6 +5657,14 @@ var badgeVariants = cva(badgeBase, {
|
|
|
5603
5657
|
}
|
|
5604
5658
|
}
|
|
5605
5659
|
});
|
|
5660
|
+
function badgeTpl(content, options = {}) {
|
|
5661
|
+
const { variant, size, class: extra } = options;
|
|
5662
|
+
return import_lit_html2.html`
|
|
5663
|
+
<span class=${cn(badgeVariants({ variant, size }), extra)} data-slot="badge"
|
|
5664
|
+
>${content}</span
|
|
5665
|
+
>
|
|
5666
|
+
`;
|
|
5667
|
+
}
|
|
5606
5668
|
|
|
5607
5669
|
// src/browser/views/primitives/chip.ts
|
|
5608
5670
|
var CHIP_CLASS = "inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground";
|
|
@@ -6931,7 +6993,10 @@ function renderDetailSurface(surface, ctx, root) {
|
|
|
6931
6993
|
>
|
|
6932
6994
|
${surface.title}
|
|
6933
6995
|
</h2>` : import_lit_html2.nothing}
|
|
6934
|
-
<span class="ml-auto"
|
|
6996
|
+
<span class="ml-auto flex items-center gap-1">
|
|
6997
|
+
${surface.unregistered ? badgeTpl("Unregistered", { variant: "warning", size: "sm" }) : import_lit_html2.nothing}
|
|
6998
|
+
${kindBadgeTpl(surface.entityKind)}
|
|
6999
|
+
</span>
|
|
6935
7000
|
</div>
|
|
6936
7001
|
${surface.subtitle ? subtitleTpl(surface.subtitle) : import_lit_html2.nothing}
|
|
6937
7002
|
<div
|
|
@@ -9801,12 +9866,11 @@ function createEntityDetailView(config) {
|
|
|
9801
9866
|
if (!ctx.ref || ctx.ref.kind !== kind) {
|
|
9802
9867
|
return { kind: "detail", entityKind: kind };
|
|
9803
9868
|
}
|
|
9804
|
-
const
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
const
|
|
9809
|
-
const meta = metaEntity.meta;
|
|
9869
|
+
const exactEntity = ctx.registry.get(kind, ctx.ref.id);
|
|
9870
|
+
const patternEntity = exactEntity ? void 0 : ctx.registry.matchPattern?.(kind, ctx.ref.id);
|
|
9871
|
+
const entity = exactEntity ?? patternEntity;
|
|
9872
|
+
const metaEntity = entity ? entity : null;
|
|
9873
|
+
const meta = metaEntity?.meta;
|
|
9810
9874
|
const actions = [];
|
|
9811
9875
|
const cloud = ctx.cloud;
|
|
9812
9876
|
actions.push({ ...reportAction(ctx.ref), group: "Report" });
|
|
@@ -9824,14 +9888,16 @@ function createEntityDetailView(config) {
|
|
|
9824
9888
|
actions.push({ ...highlightElementAction(ctx.ref), group: "Inspect" });
|
|
9825
9889
|
actions.push({ ...copyScreenshotAction(ctx.ref), group: "Inspect" });
|
|
9826
9890
|
}
|
|
9827
|
-
|
|
9828
|
-
|
|
9829
|
-
|
|
9830
|
-
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
|
|
9834
|
-
|
|
9891
|
+
if (metaEntity?.loc) {
|
|
9892
|
+
actions.push({
|
|
9893
|
+
...copyPathAction(ctx.ref, metaEntity.loc),
|
|
9894
|
+
group: "Inspect"
|
|
9895
|
+
});
|
|
9896
|
+
actions.push({
|
|
9897
|
+
...copySnapshotAction(ctx.ref, metaEntity.loc),
|
|
9898
|
+
group: "Inspect"
|
|
9899
|
+
});
|
|
9900
|
+
}
|
|
9835
9901
|
const sections = [];
|
|
9836
9902
|
if (meta?.description) {
|
|
9837
9903
|
sections.push({ id: "description", text: meta.description });
|
|
@@ -9839,8 +9905,10 @@ function createEntityDetailView(config) {
|
|
|
9839
9905
|
if (offerAcceptance && meta?.acceptance?.length) {
|
|
9840
9906
|
sections.push({ id: "acceptance", items: meta.acceptance });
|
|
9841
9907
|
}
|
|
9842
|
-
|
|
9843
|
-
|
|
9908
|
+
if (entity) {
|
|
9909
|
+
for (const s of config.extraSections?.(ctx, entity) ?? []) {
|
|
9910
|
+
sections.push(s);
|
|
9911
|
+
}
|
|
9844
9912
|
}
|
|
9845
9913
|
if (!DOM_BACKED_KINDS2.has(kind)) {
|
|
9846
9914
|
sections.push({
|
|
@@ -9869,8 +9937,9 @@ function createEntityDetailView(config) {
|
|
|
9869
9937
|
return {
|
|
9870
9938
|
kind: "detail",
|
|
9871
9939
|
entityKind: kind,
|
|
9872
|
-
title: displayName(metaEntity),
|
|
9873
|
-
subtitle: config.subtitle?.(ctx,
|
|
9940
|
+
title: patternEntity ? ctx.ref.id : metaEntity ? displayName(metaEntity) : ctx.ref.id,
|
|
9941
|
+
subtitle: exactEntity ? config.subtitle?.(ctx, exactEntity) : void 0,
|
|
9942
|
+
unregistered: !entity,
|
|
9874
9943
|
actions,
|
|
9875
9944
|
sections
|
|
9876
9945
|
};
|