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
package/dist/headless/index.cjs
CHANGED
|
@@ -93,6 +93,7 @@ function freezeEntity(entity, flows) {
|
|
|
93
93
|
function createRegistry() {
|
|
94
94
|
const store = emptyStore();
|
|
95
95
|
let flowsCache = null;
|
|
96
|
+
const patternCache = /* @__PURE__ */ new Map();
|
|
96
97
|
const getFlows = () => {
|
|
97
98
|
if (flowsCache === null) flowsCache = Array.from(store.flow.values());
|
|
98
99
|
return flowsCache;
|
|
@@ -102,6 +103,7 @@ function createRegistry() {
|
|
|
102
103
|
const key = entityKey(entity);
|
|
103
104
|
store[entity.kind].set(key, entity);
|
|
104
105
|
flowsCache = null;
|
|
106
|
+
patternCache.delete(entity.kind);
|
|
105
107
|
};
|
|
106
108
|
const get = (kind, id) => {
|
|
107
109
|
assertEntityKind(kind);
|
|
@@ -109,6 +111,38 @@ function createRegistry() {
|
|
|
109
111
|
if (raw === void 0) return void 0;
|
|
110
112
|
return freezeEntity(raw, getFlows());
|
|
111
113
|
};
|
|
114
|
+
const getPatternsForKind = (kind) => {
|
|
115
|
+
const cached = patternCache.get(kind);
|
|
116
|
+
if (cached !== void 0)
|
|
117
|
+
return cached;
|
|
118
|
+
const patterns = [];
|
|
119
|
+
for (const [key, entity] of store[kind]) {
|
|
120
|
+
if (key.endsWith("*")) {
|
|
121
|
+
patterns.push({
|
|
122
|
+
prefix: key.slice(0, -1),
|
|
123
|
+
entity
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
patternCache.set(
|
|
128
|
+
kind,
|
|
129
|
+
patterns
|
|
130
|
+
);
|
|
131
|
+
return patterns;
|
|
132
|
+
};
|
|
133
|
+
const matchPattern = (kind, id) => {
|
|
134
|
+
assertEntityKind(kind);
|
|
135
|
+
const patterns = getPatternsForKind(kind);
|
|
136
|
+
if (patterns.length === 0) return void 0;
|
|
137
|
+
let best;
|
|
138
|
+
for (const entry of patterns) {
|
|
139
|
+
if (id.startsWith(entry.prefix) && (best === void 0 || entry.prefix.length > best.prefix.length)) {
|
|
140
|
+
best = entry;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (best === void 0) return void 0;
|
|
144
|
+
return freezeEntity(best.entity, getFlows());
|
|
145
|
+
};
|
|
112
146
|
const list = (kind) => {
|
|
113
147
|
assertEntityKind(kind);
|
|
114
148
|
const flows = getFlows();
|
|
@@ -159,6 +193,7 @@ function createRegistry() {
|
|
|
159
193
|
return {
|
|
160
194
|
add,
|
|
161
195
|
get,
|
|
196
|
+
matchPattern,
|
|
162
197
|
list,
|
|
163
198
|
query,
|
|
164
199
|
byScope,
|
|
@@ -840,6 +875,9 @@ var tailwind_built_default = `/*! tailwindcss v4.2.2 | MIT License | https://tai
|
|
|
840
875
|
.relative {
|
|
841
876
|
position: relative;
|
|
842
877
|
}
|
|
878
|
+
.static {
|
|
879
|
+
position: static;
|
|
880
|
+
}
|
|
843
881
|
.inset-0 {
|
|
844
882
|
inset: calc(var(--spacing) * 0);
|
|
845
883
|
}
|
|
@@ -3291,7 +3329,7 @@ function createCursorTooltip(deps) {
|
|
|
3291
3329
|
// src/browser/surface/inspector.ts
|
|
3292
3330
|
function entityForRef(ref, registry) {
|
|
3293
3331
|
if (registry) {
|
|
3294
|
-
const found = registry.get(ref.kind, ref.id);
|
|
3332
|
+
const found = registry.get(ref.kind, ref.id) ?? registry.matchPattern?.(ref.kind, ref.id);
|
|
3295
3333
|
if (found) return found;
|
|
3296
3334
|
}
|
|
3297
3335
|
if (ref.kind === "route") return { kind: "route", path: ref.id, page: ref.id };
|