@inventreedb/ui 0.11.2 → 0.11.3

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/.vite/manifest.json +86 -0
  3. package/dist/components/Boundary.js +16 -7
  4. package/dist/components/Boundary.js.map +1 -1
  5. package/dist/components/StylishText.d.ts +6 -0
  6. package/dist/components/StylishText.js +36 -0
  7. package/dist/components/StylishText.js.map +1 -0
  8. package/dist/components/nav/DetailDrawer.css.d.ts +1 -0
  9. package/dist/components/nav/DetailDrawer.css.js +6 -0
  10. package/dist/components/nav/DetailDrawer.css.js.map +1 -0
  11. package/dist/components/nav/DetailDrawer.d.ts +21 -0
  12. package/dist/components/nav/DetailDrawer.js +65 -0
  13. package/dist/components/nav/DetailDrawer.js.map +1 -0
  14. package/dist/enums/ApiEndpoints.d.ts +1 -0
  15. package/dist/enums/ApiEndpoints.js +1 -0
  16. package/dist/enums/ApiEndpoints.js.map +1 -1
  17. package/dist/enums/ModelType.d.ts +9 -0
  18. package/dist/enums/ModelType.js.map +1 -1
  19. package/dist/enums/Roles.d.ts +1 -0
  20. package/dist/enums/Roles.js +1 -0
  21. package/dist/enums/Roles.js.map +1 -1
  22. package/dist/index.d.ts +3 -1
  23. package/dist/index.js +5 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/node_modules/@remix-run/router/dist/router.js +448 -0
  26. package/dist/node_modules/@remix-run/router/dist/router.js.map +1 -0
  27. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js +8 -0
  28. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.js.map +1 -0
  29. package/dist/node_modules/react-router/dist/index.js +704 -0
  30. package/dist/node_modules/react-router/dist/index.js.map +1 -0
  31. package/dist/node_modules/react-router-dom/dist/index.js +526 -0
  32. package/dist/node_modules/react-router-dom/dist/index.js.map +1 -0
  33. package/dist/node_modules/zustand/esm/react/shallow.js +13 -0
  34. package/dist/node_modules/zustand/esm/react/shallow.js.map +1 -0
  35. package/dist/node_modules/zustand/esm/vanilla/shallow.js +57 -0
  36. package/dist/node_modules/zustand/esm/vanilla/shallow.js.map +1 -0
  37. package/dist/states/LocalLibState.d.ts +17 -0
  38. package/dist/states/LocalLibState.js +16 -0
  39. package/dist/states/LocalLibState.js.map +1 -0
  40. package/dist/types/Forms.d.ts +11 -6
  41. package/dist/types/Plugins.js +1 -1
  42. package/dist/types/Tables.d.ts +2 -0
  43. package/dist/ui.css +4 -0
  44. package/lib/components/Boundary.tsx +6 -3
  45. package/lib/components/StylishText.tsx +46 -0
  46. package/lib/components/nav/DetailDrawer.css.ts +6 -0
  47. package/lib/components/nav/DetailDrawer.tsx +108 -0
  48. package/lib/enums/ApiEndpoints.tsx +1 -0
  49. package/lib/enums/ModelType.tsx +13 -0
  50. package/lib/enums/Roles.tsx +1 -0
  51. package/lib/index.ts +8 -0
  52. package/lib/states/LocalLibState.tsx +23 -0
  53. package/lib/types/Forms.tsx +11 -6
  54. package/lib/types/Tables.tsx +2 -0
  55. package/package.json +4 -2
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,448 @@
1
+ function _extends() {
2
+ _extends = Object.assign ? Object.assign.bind() : function(target) {
3
+ for (var i = 1; i < arguments.length; i++) {
4
+ var source = arguments[i];
5
+ for (var key in source) {
6
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
7
+ target[key] = source[key];
8
+ }
9
+ }
10
+ }
11
+ return target;
12
+ };
13
+ return _extends.apply(this, arguments);
14
+ }
15
+ var Action;
16
+ (function(Action2) {
17
+ Action2["Pop"] = "POP";
18
+ Action2["Push"] = "PUSH";
19
+ Action2["Replace"] = "REPLACE";
20
+ })(Action || (Action = {}));
21
+ function invariant(value, message) {
22
+ if (value === false || value === null || typeof value === "undefined") {
23
+ throw new Error(message);
24
+ }
25
+ }
26
+ function warning(cond, message) {
27
+ if (!cond) {
28
+ if (typeof console !== "undefined") console.warn(message);
29
+ try {
30
+ throw new Error(message);
31
+ } catch (e) {
32
+ }
33
+ }
34
+ }
35
+ function createPath(_ref) {
36
+ let {
37
+ pathname = "/",
38
+ search = "",
39
+ hash = ""
40
+ } = _ref;
41
+ if (search && search !== "?") pathname += search.charAt(0) === "?" ? search : "?" + search;
42
+ if (hash && hash !== "#") pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
43
+ return pathname;
44
+ }
45
+ function parsePath(path) {
46
+ let parsedPath = {};
47
+ if (path) {
48
+ let hashIndex = path.indexOf("#");
49
+ if (hashIndex >= 0) {
50
+ parsedPath.hash = path.substr(hashIndex);
51
+ path = path.substr(0, hashIndex);
52
+ }
53
+ let searchIndex = path.indexOf("?");
54
+ if (searchIndex >= 0) {
55
+ parsedPath.search = path.substr(searchIndex);
56
+ path = path.substr(0, searchIndex);
57
+ }
58
+ if (path) {
59
+ parsedPath.pathname = path;
60
+ }
61
+ }
62
+ return parsedPath;
63
+ }
64
+ var ResultType;
65
+ (function(ResultType2) {
66
+ ResultType2["data"] = "data";
67
+ ResultType2["deferred"] = "deferred";
68
+ ResultType2["redirect"] = "redirect";
69
+ ResultType2["error"] = "error";
70
+ })(ResultType || (ResultType = {}));
71
+ function matchRoutes(routes, locationArg, basename) {
72
+ if (basename === void 0) {
73
+ basename = "/";
74
+ }
75
+ return matchRoutesImpl(routes, locationArg, basename);
76
+ }
77
+ function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
78
+ let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
79
+ let pathname = stripBasename(location.pathname || "/", basename);
80
+ if (pathname == null) {
81
+ return null;
82
+ }
83
+ let branches = flattenRoutes(routes);
84
+ rankRouteBranches(branches);
85
+ let matches = null;
86
+ for (let i = 0; matches == null && i < branches.length; ++i) {
87
+ let decoded = decodePath(pathname);
88
+ matches = matchRouteBranch(branches[i], decoded);
89
+ }
90
+ return matches;
91
+ }
92
+ function flattenRoutes(routes, branches, parentsMeta, parentPath) {
93
+ if (branches === void 0) {
94
+ branches = [];
95
+ }
96
+ if (parentsMeta === void 0) {
97
+ parentsMeta = [];
98
+ }
99
+ if (parentPath === void 0) {
100
+ parentPath = "";
101
+ }
102
+ let flattenRoute = (route, index, relativePath) => {
103
+ let meta = {
104
+ relativePath: relativePath === void 0 ? route.path || "" : relativePath,
105
+ caseSensitive: route.caseSensitive === true,
106
+ childrenIndex: index,
107
+ route
108
+ };
109
+ if (meta.relativePath.startsWith("/")) {
110
+ invariant(meta.relativePath.startsWith(parentPath), 'Absolute route path "' + meta.relativePath + '" nested under path ' + ('"' + parentPath + '" is not valid. An absolute child route path ') + "must start with the combined path of all its parent routes.");
111
+ meta.relativePath = meta.relativePath.slice(parentPath.length);
112
+ }
113
+ let path = joinPaths([parentPath, meta.relativePath]);
114
+ let routesMeta = parentsMeta.concat(meta);
115
+ if (route.children && route.children.length > 0) {
116
+ invariant(
117
+ // Our types know better, but runtime JS may not!
118
+ // @ts-expect-error
119
+ route.index !== true,
120
+ "Index routes must not have child routes. Please remove " + ('all child routes from route path "' + path + '".')
121
+ );
122
+ flattenRoutes(route.children, branches, routesMeta, path);
123
+ }
124
+ if (route.path == null && !route.index) {
125
+ return;
126
+ }
127
+ branches.push({
128
+ path,
129
+ score: computeScore(path, route.index),
130
+ routesMeta
131
+ });
132
+ };
133
+ routes.forEach((route, index) => {
134
+ var _route$path;
135
+ if (route.path === "" || !((_route$path = route.path) != null && _route$path.includes("?"))) {
136
+ flattenRoute(route, index);
137
+ } else {
138
+ for (let exploded of explodeOptionalSegments(route.path)) {
139
+ flattenRoute(route, index, exploded);
140
+ }
141
+ }
142
+ });
143
+ return branches;
144
+ }
145
+ function explodeOptionalSegments(path) {
146
+ let segments = path.split("/");
147
+ if (segments.length === 0) return [];
148
+ let [first, ...rest] = segments;
149
+ let isOptional = first.endsWith("?");
150
+ let required = first.replace(/\?$/, "");
151
+ if (rest.length === 0) {
152
+ return isOptional ? [required, ""] : [required];
153
+ }
154
+ let restExploded = explodeOptionalSegments(rest.join("/"));
155
+ let result = [];
156
+ result.push(...restExploded.map((subpath) => subpath === "" ? required : [required, subpath].join("/")));
157
+ if (isOptional) {
158
+ result.push(...restExploded);
159
+ }
160
+ return result.map((exploded) => path.startsWith("/") && exploded === "" ? "/" : exploded);
161
+ }
162
+ function rankRouteBranches(branches) {
163
+ branches.sort((a, b) => a.score !== b.score ? b.score - a.score : compareIndexes(a.routesMeta.map((meta) => meta.childrenIndex), b.routesMeta.map((meta) => meta.childrenIndex)));
164
+ }
165
+ const paramRe = /^:[\w-]+$/;
166
+ const dynamicSegmentValue = 3;
167
+ const indexRouteValue = 2;
168
+ const emptySegmentValue = 1;
169
+ const staticSegmentValue = 10;
170
+ const splatPenalty = -2;
171
+ const isSplat = (s) => s === "*";
172
+ function computeScore(path, index) {
173
+ let segments = path.split("/");
174
+ let initialScore = segments.length;
175
+ if (segments.some(isSplat)) {
176
+ initialScore += splatPenalty;
177
+ }
178
+ if (index) {
179
+ initialScore += indexRouteValue;
180
+ }
181
+ return segments.filter((s) => !isSplat(s)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue), initialScore);
182
+ }
183
+ function compareIndexes(a, b) {
184
+ let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);
185
+ return siblings ? (
186
+ // If two routes are siblings, we should try to match the earlier sibling
187
+ // first. This allows people to have fine-grained control over the matching
188
+ // behavior by simply putting routes with identical paths in the order they
189
+ // want them tried.
190
+ a[a.length - 1] - b[b.length - 1]
191
+ ) : (
192
+ // Otherwise, it doesn't really make sense to rank non-siblings by index,
193
+ // so they sort equally.
194
+ 0
195
+ );
196
+ }
197
+ function matchRouteBranch(branch, pathname, allowPartial) {
198
+ let {
199
+ routesMeta
200
+ } = branch;
201
+ let matchedParams = {};
202
+ let matchedPathname = "/";
203
+ let matches = [];
204
+ for (let i = 0; i < routesMeta.length; ++i) {
205
+ let meta = routesMeta[i];
206
+ let end = i === routesMeta.length - 1;
207
+ let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
208
+ let match = matchPath({
209
+ path: meta.relativePath,
210
+ caseSensitive: meta.caseSensitive,
211
+ end
212
+ }, remainingPathname);
213
+ let route = meta.route;
214
+ if (!match) {
215
+ return null;
216
+ }
217
+ Object.assign(matchedParams, match.params);
218
+ matches.push({
219
+ // TODO: Can this as be avoided?
220
+ params: matchedParams,
221
+ pathname: joinPaths([matchedPathname, match.pathname]),
222
+ pathnameBase: normalizePathname(joinPaths([matchedPathname, match.pathnameBase])),
223
+ route
224
+ });
225
+ if (match.pathnameBase !== "/") {
226
+ matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);
227
+ }
228
+ }
229
+ return matches;
230
+ }
231
+ function matchPath(pattern, pathname) {
232
+ if (typeof pattern === "string") {
233
+ pattern = {
234
+ path: pattern,
235
+ caseSensitive: false,
236
+ end: true
237
+ };
238
+ }
239
+ let [matcher, compiledParams] = compilePath(pattern.path, pattern.caseSensitive, pattern.end);
240
+ let match = pathname.match(matcher);
241
+ if (!match) return null;
242
+ let matchedPathname = match[0];
243
+ let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
244
+ let captureGroups = match.slice(1);
245
+ let params = compiledParams.reduce((memo, _ref, index) => {
246
+ let {
247
+ paramName,
248
+ isOptional
249
+ } = _ref;
250
+ if (paramName === "*") {
251
+ let splatValue = captureGroups[index] || "";
252
+ pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
253
+ }
254
+ const value = captureGroups[index];
255
+ if (isOptional && !value) {
256
+ memo[paramName] = void 0;
257
+ } else {
258
+ memo[paramName] = (value || "").replace(/%2F/g, "/");
259
+ }
260
+ return memo;
261
+ }, {});
262
+ return {
263
+ params,
264
+ pathname: matchedPathname,
265
+ pathnameBase,
266
+ pattern
267
+ };
268
+ }
269
+ function compilePath(path, caseSensitive, end) {
270
+ if (caseSensitive === void 0) {
271
+ caseSensitive = false;
272
+ }
273
+ if (end === void 0) {
274
+ end = true;
275
+ }
276
+ warning(path === "*" || !path.endsWith("*") || path.endsWith("/*"), 'Route path "' + path + '" will be treated as if it were ' + ('"' + path.replace(/\*$/, "/*") + '" because the `*` character must ') + "always follow a `/` in the pattern. To get rid of this warning, " + ('please change the route path to "' + path.replace(/\*$/, "/*") + '".'));
277
+ let params = [];
278
+ let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(/\/:([\w-]+)(\?)?/g, (_, paramName, isOptional) => {
279
+ params.push({
280
+ paramName,
281
+ isOptional: isOptional != null
282
+ });
283
+ return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
284
+ });
285
+ if (path.endsWith("*")) {
286
+ params.push({
287
+ paramName: "*"
288
+ });
289
+ regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
290
+ } else if (end) {
291
+ regexpSource += "\\/*$";
292
+ } else if (path !== "" && path !== "/") {
293
+ regexpSource += "(?:(?=\\/|$))";
294
+ } else ;
295
+ let matcher = new RegExp(regexpSource, caseSensitive ? void 0 : "i");
296
+ return [matcher, params];
297
+ }
298
+ function decodePath(value) {
299
+ try {
300
+ return value.split("/").map((v) => decodeURIComponent(v).replace(/\//g, "%2F")).join("/");
301
+ } catch (error) {
302
+ warning(false, 'The URL path "' + value + '" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent ' + ("encoding (" + error + ")."));
303
+ return value;
304
+ }
305
+ }
306
+ function stripBasename(pathname, basename) {
307
+ if (basename === "/") return pathname;
308
+ if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
309
+ return null;
310
+ }
311
+ let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
312
+ let nextChar = pathname.charAt(startIndex);
313
+ if (nextChar && nextChar !== "/") {
314
+ return null;
315
+ }
316
+ return pathname.slice(startIndex) || "/";
317
+ }
318
+ const ABSOLUTE_URL_REGEX$1 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
319
+ const isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX$1.test(url);
320
+ function resolvePath(to, fromPathname) {
321
+ if (fromPathname === void 0) {
322
+ fromPathname = "/";
323
+ }
324
+ let {
325
+ pathname: toPathname,
326
+ search = "",
327
+ hash = ""
328
+ } = typeof to === "string" ? parsePath(to) : to;
329
+ let pathname;
330
+ if (toPathname) {
331
+ if (isAbsoluteUrl(toPathname)) {
332
+ pathname = toPathname;
333
+ } else {
334
+ if (toPathname.includes("//")) {
335
+ let oldPathname = toPathname;
336
+ toPathname = toPathname.replace(/\/\/+/g, "/");
337
+ warning(false, "Pathnames cannot have embedded double slashes - normalizing " + (oldPathname + " -> " + toPathname));
338
+ }
339
+ if (toPathname.startsWith("/")) {
340
+ pathname = resolvePathname(toPathname.substring(1), "/");
341
+ } else {
342
+ pathname = resolvePathname(toPathname, fromPathname);
343
+ }
344
+ }
345
+ } else {
346
+ pathname = fromPathname;
347
+ }
348
+ return {
349
+ pathname,
350
+ search: normalizeSearch(search),
351
+ hash: normalizeHash(hash)
352
+ };
353
+ }
354
+ function resolvePathname(relativePath, fromPathname) {
355
+ let segments = fromPathname.replace(/\/+$/, "").split("/");
356
+ let relativeSegments = relativePath.split("/");
357
+ relativeSegments.forEach((segment) => {
358
+ if (segment === "..") {
359
+ if (segments.length > 1) segments.pop();
360
+ } else if (segment !== ".") {
361
+ segments.push(segment);
362
+ }
363
+ });
364
+ return segments.length > 1 ? segments.join("/") : "/";
365
+ }
366
+ function getInvalidPathError(char, field, dest, path) {
367
+ return "Cannot include a '" + char + "' character in a manually specified " + ("`to." + field + "` field [" + JSON.stringify(path) + "]. Please separate it out to the ") + ("`to." + dest + "` field. Alternatively you may provide the full path as ") + 'a string in <Link to="..."> and the router will parse it for you.';
368
+ }
369
+ function getPathContributingMatches(matches) {
370
+ return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0);
371
+ }
372
+ function getResolveToMatches(matches, v7_relativeSplatPath) {
373
+ let pathMatches = getPathContributingMatches(matches);
374
+ if (v7_relativeSplatPath) {
375
+ return pathMatches.map((match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase);
376
+ }
377
+ return pathMatches.map((match) => match.pathnameBase);
378
+ }
379
+ function resolveTo(toArg, routePathnames, locationPathname, isPathRelative) {
380
+ if (isPathRelative === void 0) {
381
+ isPathRelative = false;
382
+ }
383
+ let to;
384
+ if (typeof toArg === "string") {
385
+ to = parsePath(toArg);
386
+ } else {
387
+ to = _extends({}, toArg);
388
+ invariant(!to.pathname || !to.pathname.includes("?"), getInvalidPathError("?", "pathname", "search", to));
389
+ invariant(!to.pathname || !to.pathname.includes("#"), getInvalidPathError("#", "pathname", "hash", to));
390
+ invariant(!to.search || !to.search.includes("#"), getInvalidPathError("#", "search", "hash", to));
391
+ }
392
+ let isEmptyPath = toArg === "" || to.pathname === "";
393
+ let toPathname = isEmptyPath ? "/" : to.pathname;
394
+ let from;
395
+ if (toPathname == null) {
396
+ from = locationPathname;
397
+ } else {
398
+ let routePathnameIndex = routePathnames.length - 1;
399
+ if (!isPathRelative && toPathname.startsWith("..")) {
400
+ let toSegments = toPathname.split("/");
401
+ while (toSegments[0] === "..") {
402
+ toSegments.shift();
403
+ routePathnameIndex -= 1;
404
+ }
405
+ to.pathname = toSegments.join("/");
406
+ }
407
+ from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
408
+ }
409
+ let path = resolvePath(to, from);
410
+ let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
411
+ let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/");
412
+ if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {
413
+ path.pathname += "/";
414
+ }
415
+ return path;
416
+ }
417
+ const joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
418
+ const normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
419
+ const normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
420
+ const normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
421
+ class AbortedDeferredError extends Error {
422
+ }
423
+ function isRouteErrorResponse(error) {
424
+ return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
425
+ }
426
+ const validMutationMethodsArr = ["post", "put", "patch", "delete"];
427
+ new Set(validMutationMethodsArr);
428
+ const validRequestMethodsArr = ["get", ...validMutationMethodsArr];
429
+ new Set(validRequestMethodsArr);
430
+ export {
431
+ AbortedDeferredError,
432
+ Action,
433
+ decodePath as UNSAFE_decodePath,
434
+ getResolveToMatches as UNSAFE_getResolveToMatches,
435
+ invariant as UNSAFE_invariant,
436
+ warning as UNSAFE_warning,
437
+ createPath,
438
+ isRouteErrorResponse,
439
+ joinPaths,
440
+ matchPath,
441
+ matchRoutes,
442
+ normalizePathname,
443
+ parsePath,
444
+ resolvePath,
445
+ resolveTo,
446
+ stripBasename
447
+ };
448
+ //# sourceMappingURL=router.js.map