uidex 0.5.2 → 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 +39 -1
- 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 +39 -1
- package/dist/headless/index.js.map +1 -1
- package/dist/index.cjs +73 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +73 -20
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +73 -20
- 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 +73 -20
- 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
|
}
|
|
@@ -3274,7 +3312,7 @@ function createCursorTooltip(deps) {
|
|
|
3274
3312
|
// src/browser/surface/inspector.ts
|
|
3275
3313
|
function entityForRef(ref, registry) {
|
|
3276
3314
|
if (registry) {
|
|
3277
|
-
const found = registry.get(ref.kind, ref.id);
|
|
3315
|
+
const found = registry.get(ref.kind, ref.id) ?? registry.matchPattern?.(ref.kind, ref.id);
|
|
3278
3316
|
if (found) return found;
|
|
3279
3317
|
}
|
|
3280
3318
|
if (ref.kind === "route") return { kind: "route", path: ref.id, page: ref.id };
|