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/react/index.cjs
CHANGED
|
@@ -115,6 +115,7 @@ function freezeEntity(entity, flows) {
|
|
|
115
115
|
function createRegistry() {
|
|
116
116
|
const store = emptyStore();
|
|
117
117
|
let flowsCache = null;
|
|
118
|
+
const patternCache = /* @__PURE__ */ new Map();
|
|
118
119
|
const getFlows = () => {
|
|
119
120
|
if (flowsCache === null) flowsCache = Array.from(store.flow.values());
|
|
120
121
|
return flowsCache;
|
|
@@ -124,6 +125,7 @@ function createRegistry() {
|
|
|
124
125
|
const key = entityKey(entity);
|
|
125
126
|
store[entity.kind].set(key, entity);
|
|
126
127
|
flowsCache = null;
|
|
128
|
+
patternCache.delete(entity.kind);
|
|
127
129
|
};
|
|
128
130
|
const get = (kind, id) => {
|
|
129
131
|
assertEntityKind(kind);
|
|
@@ -131,6 +133,38 @@ function createRegistry() {
|
|
|
131
133
|
if (raw === void 0) return void 0;
|
|
132
134
|
return freezeEntity(raw, getFlows());
|
|
133
135
|
};
|
|
136
|
+
const getPatternsForKind = (kind) => {
|
|
137
|
+
const cached = patternCache.get(kind);
|
|
138
|
+
if (cached !== void 0)
|
|
139
|
+
return cached;
|
|
140
|
+
const patterns = [];
|
|
141
|
+
for (const [key, entity] of store[kind]) {
|
|
142
|
+
if (key.endsWith("*")) {
|
|
143
|
+
patterns.push({
|
|
144
|
+
prefix: key.slice(0, -1),
|
|
145
|
+
entity
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
patternCache.set(
|
|
150
|
+
kind,
|
|
151
|
+
patterns
|
|
152
|
+
);
|
|
153
|
+
return patterns;
|
|
154
|
+
};
|
|
155
|
+
const matchPattern = (kind, id) => {
|
|
156
|
+
assertEntityKind(kind);
|
|
157
|
+
const patterns = getPatternsForKind(kind);
|
|
158
|
+
if (patterns.length === 0) return void 0;
|
|
159
|
+
let best;
|
|
160
|
+
for (const entry of patterns) {
|
|
161
|
+
if (id.startsWith(entry.prefix) && (best === void 0 || entry.prefix.length > best.prefix.length)) {
|
|
162
|
+
best = entry;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (best === void 0) return void 0;
|
|
166
|
+
return freezeEntity(best.entity, getFlows());
|
|
167
|
+
};
|
|
134
168
|
const list = (kind) => {
|
|
135
169
|
assertEntityKind(kind);
|
|
136
170
|
const flows = getFlows();
|
|
@@ -181,6 +215,7 @@ function createRegistry() {
|
|
|
181
215
|
return {
|
|
182
216
|
add,
|
|
183
217
|
get,
|
|
218
|
+
matchPattern,
|
|
184
219
|
list,
|
|
185
220
|
query,
|
|
186
221
|
byScope,
|
|
@@ -1130,6 +1165,9 @@ var tailwind_built_default = `/*! tailwindcss v4.2.2 | MIT License | https://tai
|
|
|
1130
1165
|
.relative {
|
|
1131
1166
|
position: relative;
|
|
1132
1167
|
}
|
|
1168
|
+
.static {
|
|
1169
|
+
position: static;
|
|
1170
|
+
}
|
|
1133
1171
|
.inset-0 {
|
|
1134
1172
|
inset: calc(var(--spacing) * 0);
|
|
1135
1173
|
}
|
|
@@ -3520,16 +3558,18 @@ function createCursorTooltip(deps) {
|
|
|
3520
3558
|
const renderBody = () => {
|
|
3521
3559
|
body.replaceChildren();
|
|
3522
3560
|
if (typeof currentContent === "string") {
|
|
3523
|
-
applyColor(
|
|
3561
|
+
applyColor("#a1a1aa");
|
|
3562
|
+
el2.style.opacity = "0.6";
|
|
3524
3563
|
body.append(document.createTextNode(currentContent));
|
|
3525
3564
|
return;
|
|
3526
3565
|
}
|
|
3527
3566
|
if (!currentContent) return;
|
|
3567
|
+
el2.style.opacity = "1";
|
|
3528
3568
|
const { entity, node } = currentContent;
|
|
3529
3569
|
const style = KIND_STYLE[entity.kind];
|
|
3530
3570
|
const demoted = entity.kind === "primitive";
|
|
3531
3571
|
applyColor(style?.color ?? DEFAULT_TOOLTIP_COLOR);
|
|
3532
|
-
el2.style.opacity =
|
|
3572
|
+
if (demoted) el2.style.opacity = "0.55";
|
|
3533
3573
|
if (style) {
|
|
3534
3574
|
const svg2 = (0, import_lucide2.createElement)(style.icon);
|
|
3535
3575
|
svg2.setAttribute("aria-hidden", "true");
|
|
@@ -3580,7 +3620,7 @@ function createCursorTooltip(deps) {
|
|
|
3580
3620
|
// src/browser/surface/inspector.ts
|
|
3581
3621
|
function entityForRef(ref2, registry) {
|
|
3582
3622
|
if (registry) {
|
|
3583
|
-
const found = registry.get(ref2.kind, ref2.id);
|
|
3623
|
+
const found = registry.get(ref2.kind, ref2.id) ?? registry.matchPattern?.(ref2.kind, ref2.id);
|
|
3584
3624
|
if (found) return found;
|
|
3585
3625
|
}
|
|
3586
3626
|
if (ref2.kind === "route") return { kind: "route", path: ref2.id, page: ref2.id };
|
|
@@ -3646,7 +3686,8 @@ function createInspector(options) {
|
|
|
3646
3686
|
resolveAll = (target) => defaultResolveAllMatches(target, registry),
|
|
3647
3687
|
onHover,
|
|
3648
3688
|
onSelect,
|
|
3649
|
-
onCycle
|
|
3689
|
+
onCycle,
|
|
3690
|
+
onObscured
|
|
3650
3691
|
} = options;
|
|
3651
3692
|
let mounted = false;
|
|
3652
3693
|
let currentEl = null;
|
|
@@ -3655,6 +3696,13 @@ function createInspector(options) {
|
|
|
3655
3696
|
let layerIndex = 0;
|
|
3656
3697
|
let lastCursor = { x: 0, y: 0 };
|
|
3657
3698
|
const makeStack = () => stack.length > 0 ? { matches: stack, index: layerIndex, current: stack[layerIndex] } : null;
|
|
3699
|
+
const onDocumentLeave = () => {
|
|
3700
|
+
currentEl = null;
|
|
3701
|
+
stack = [];
|
|
3702
|
+
layerIndex = 0;
|
|
3703
|
+
session.highlight.unhover();
|
|
3704
|
+
onObscured?.(lastCursor);
|
|
3705
|
+
};
|
|
3658
3706
|
const onMouseMove = (e) => {
|
|
3659
3707
|
if (!(e.target instanceof Element)) return;
|
|
3660
3708
|
const matches = resolveAll(e.target);
|
|
@@ -3707,6 +3755,7 @@ function createInspector(options) {
|
|
|
3707
3755
|
document.head.appendChild(cursorStyleEl);
|
|
3708
3756
|
}
|
|
3709
3757
|
document.addEventListener("mousemove", onMouseMove);
|
|
3758
|
+
document.addEventListener("mouseleave", onDocumentLeave);
|
|
3710
3759
|
document.addEventListener("click", onClick, true);
|
|
3711
3760
|
document.addEventListener("contextmenu", onContextMenu, true);
|
|
3712
3761
|
},
|
|
@@ -3721,6 +3770,7 @@ function createInspector(options) {
|
|
|
3721
3770
|
cursorStyleEl = null;
|
|
3722
3771
|
}
|
|
3723
3772
|
document.removeEventListener("mousemove", onMouseMove);
|
|
3773
|
+
document.removeEventListener("mouseleave", onDocumentLeave);
|
|
3724
3774
|
document.removeEventListener("click", onClick, true);
|
|
3725
3775
|
document.removeEventListener("contextmenu", onContextMenu, true);
|
|
3726
3776
|
session.highlight.unhover();
|
|
@@ -4619,6 +4669,10 @@ function createSurfaceShell(options) {
|
|
|
4619
4669
|
},
|
|
4620
4670
|
onCycle: (stack, cursor) => {
|
|
4621
4671
|
showStack(stack, cursor);
|
|
4672
|
+
},
|
|
4673
|
+
onObscured: (cursor) => {
|
|
4674
|
+
overlay.hide();
|
|
4675
|
+
tooltip.update("iframe", cursor);
|
|
4622
4676
|
}
|
|
4623
4677
|
});
|
|
4624
4678
|
cleanup.add(inspector);
|
|
@@ -5516,6 +5570,14 @@ var badgeVariants = cva(badgeBase, {
|
|
|
5516
5570
|
}
|
|
5517
5571
|
}
|
|
5518
5572
|
});
|
|
5573
|
+
function badgeTpl(content, options = {}) {
|
|
5574
|
+
const { variant, size, class: extra } = options;
|
|
5575
|
+
return import_lit_html2.html`
|
|
5576
|
+
<span class=${cn(badgeVariants({ variant, size }), extra)} data-slot="badge"
|
|
5577
|
+
>${content}</span
|
|
5578
|
+
>
|
|
5579
|
+
`;
|
|
5580
|
+
}
|
|
5519
5581
|
|
|
5520
5582
|
// src/browser/views/primitives/chip.ts
|
|
5521
5583
|
var CHIP_CLASS = "inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground";
|
|
@@ -6844,7 +6906,10 @@ function renderDetailSurface(surface, ctx, root) {
|
|
|
6844
6906
|
>
|
|
6845
6907
|
${surface.title}
|
|
6846
6908
|
</h2>` : import_lit_html2.nothing}
|
|
6847
|
-
<span class="ml-auto"
|
|
6909
|
+
<span class="ml-auto flex items-center gap-1">
|
|
6910
|
+
${surface.unregistered ? badgeTpl("Unregistered", { variant: "warning", size: "sm" }) : import_lit_html2.nothing}
|
|
6911
|
+
${kindBadgeTpl(surface.entityKind)}
|
|
6912
|
+
</span>
|
|
6848
6913
|
</div>
|
|
6849
6914
|
${surface.subtitle ? subtitleTpl(surface.subtitle) : import_lit_html2.nothing}
|
|
6850
6915
|
<div
|
|
@@ -9714,12 +9779,11 @@ function createEntityDetailView(config) {
|
|
|
9714
9779
|
if (!ctx.ref || ctx.ref.kind !== kind) {
|
|
9715
9780
|
return { kind: "detail", entityKind: kind };
|
|
9716
9781
|
}
|
|
9717
|
-
const
|
|
9718
|
-
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
const
|
|
9722
|
-
const meta = metaEntity.meta;
|
|
9782
|
+
const exactEntity = ctx.registry.get(kind, ctx.ref.id);
|
|
9783
|
+
const patternEntity = exactEntity ? void 0 : ctx.registry.matchPattern?.(kind, ctx.ref.id);
|
|
9784
|
+
const entity = exactEntity ?? patternEntity;
|
|
9785
|
+
const metaEntity = entity ? entity : null;
|
|
9786
|
+
const meta = metaEntity?.meta;
|
|
9723
9787
|
const actions = [];
|
|
9724
9788
|
const cloud = ctx.cloud;
|
|
9725
9789
|
actions.push({ ...reportAction(ctx.ref), group: "Report" });
|
|
@@ -9737,14 +9801,16 @@ function createEntityDetailView(config) {
|
|
|
9737
9801
|
actions.push({ ...highlightElementAction(ctx.ref), group: "Inspect" });
|
|
9738
9802
|
actions.push({ ...copyScreenshotAction(ctx.ref), group: "Inspect" });
|
|
9739
9803
|
}
|
|
9740
|
-
|
|
9741
|
-
|
|
9742
|
-
|
|
9743
|
-
|
|
9744
|
-
|
|
9745
|
-
|
|
9746
|
-
|
|
9747
|
-
|
|
9804
|
+
if (metaEntity?.loc) {
|
|
9805
|
+
actions.push({
|
|
9806
|
+
...copyPathAction(ctx.ref, metaEntity.loc),
|
|
9807
|
+
group: "Inspect"
|
|
9808
|
+
});
|
|
9809
|
+
actions.push({
|
|
9810
|
+
...copySnapshotAction(ctx.ref, metaEntity.loc),
|
|
9811
|
+
group: "Inspect"
|
|
9812
|
+
});
|
|
9813
|
+
}
|
|
9748
9814
|
const sections = [];
|
|
9749
9815
|
if (meta?.description) {
|
|
9750
9816
|
sections.push({ id: "description", text: meta.description });
|
|
@@ -9752,8 +9818,10 @@ function createEntityDetailView(config) {
|
|
|
9752
9818
|
if (offerAcceptance && meta?.acceptance?.length) {
|
|
9753
9819
|
sections.push({ id: "acceptance", items: meta.acceptance });
|
|
9754
9820
|
}
|
|
9755
|
-
|
|
9756
|
-
|
|
9821
|
+
if (entity) {
|
|
9822
|
+
for (const s of config.extraSections?.(ctx, entity) ?? []) {
|
|
9823
|
+
sections.push(s);
|
|
9824
|
+
}
|
|
9757
9825
|
}
|
|
9758
9826
|
if (!DOM_BACKED_KINDS2.has(kind)) {
|
|
9759
9827
|
sections.push({
|
|
@@ -9782,8 +9850,9 @@ function createEntityDetailView(config) {
|
|
|
9782
9850
|
return {
|
|
9783
9851
|
kind: "detail",
|
|
9784
9852
|
entityKind: kind,
|
|
9785
|
-
title: displayName(metaEntity),
|
|
9786
|
-
subtitle: config.subtitle?.(ctx,
|
|
9853
|
+
title: patternEntity ? ctx.ref.id : metaEntity ? displayName(metaEntity) : ctx.ref.id,
|
|
9854
|
+
subtitle: exactEntity ? config.subtitle?.(ctx, exactEntity) : void 0,
|
|
9855
|
+
unregistered: !entity,
|
|
9787
9856
|
actions,
|
|
9788
9857
|
sections
|
|
9789
9858
|
};
|