@protobase/ui 0.64.0 → 0.65.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.
@@ -1,5 +1,4 @@
1
- import { iconFor } from "./icons.js";
2
- import { menuIcon } from "./menu-icons.js";
1
+ import { menuIcon, resourceIcon } from "./menu-icons.js";
3
2
  import { ExternalLink, LayoutDashboard } from "lucide-react";
4
3
  import { appPath } from "@protobase/schema";
5
4
  //#region src/app/bottom-bar-from-meta.ts
@@ -25,7 +24,7 @@ const bottomBarFromMeta = (meta, basePath, activeResource) => (meta.bottomBar?.i
25
24
  return {
26
25
  id: item.resource,
27
26
  label: item.label,
28
- icon: menuIcon(item.icon, iconFor(item.resource)),
27
+ icon: menuIcon(item.icon, resourceIcon(meta, item.resource)),
29
28
  href: appPath({
30
29
  kind: "list",
31
30
  resource: item.resource
@@ -1,4 +1,4 @@
1
- import { Bell, BookOpen, Bookmark, Building2, CreditCard, ExternalLink, FileText, Heart, KeyRound, LayoutDashboard, LifeBuoy, Mail, Receipt, Settings, ShieldCheck, Users } from "lucide-react";
1
+ import { Bell, BookOpen, Bookmark, Building2, CreditCard, ExternalLink, FileText, Globe2, Heart, KeyRound, LayoutDashboard, LifeBuoy, Mail, Package, Receipt, Settings, ShieldCheck, ShoppingCart, Table2, Tags, Users, Warehouse } from "lucide-react";
2
2
  //#region src/app/menu-icons.ts
3
3
  const byName = {
4
4
  bell: Bell,
@@ -8,17 +8,24 @@ const byName = {
8
8
  "credit-card": CreditCard,
9
9
  "external-link": ExternalLink,
10
10
  "file-text": FileText,
11
+ globe: Globe2,
11
12
  heart: Heart,
12
13
  key: KeyRound,
13
14
  "layout-dashboard": LayoutDashboard,
14
15
  "life-buoy": LifeBuoy,
15
16
  mail: Mail,
17
+ package: Package,
16
18
  receipt: Receipt,
17
19
  settings: Settings,
18
20
  shield: ShieldCheck,
19
- users: Users
21
+ "shopping-cart": ShoppingCart,
22
+ tags: Tags,
23
+ users: Users,
24
+ warehouse: Warehouse
20
25
  };
21
26
  Object.keys(byName);
22
27
  const menuIcon = (name, fallback) => name ? byName[name] ?? fallback : fallback;
28
+ /** A resource's icon in the sidebar, bottom bar and user menu: the one its view names, or a visitor's sign-in prompt's view, else a table. */
29
+ const resourceIcon = (meta, resource) => menuIcon(meta.views[resource]?.icon ?? meta.signIn?.[resource]?.icon, Table2);
23
30
  //#endregion
24
- export { menuIcon };
31
+ export { menuIcon, resourceIcon };
@@ -2,11 +2,10 @@ import { allowEverything } from "../data/meta-data.js";
2
2
  import { humanize } from "../live/naming.js";
3
3
  import { text } from "./messages.js";
4
4
  import { text as text$1 } from "./create/messages.js";
5
- import { iconFor } from "./icons.js";
6
- import { menuIcon } from "./menu-icons.js";
5
+ import { menuIcon, resourceIcon } from "./menu-icons.js";
7
6
  import { createOffered } from "./create/create-offered.js";
8
7
  import { userMenuResources } from "./user-menu-from-meta.js";
9
- import { LayoutDashboard } from "lucide-react";
8
+ import { LayoutDashboard, Table2 } from "lucide-react";
10
9
  import { appPath } from "@protobase/schema";
11
10
  //#region src/app/nav-from-meta.ts
12
11
  /** The sidebar item of a resource's list, or of one of its named lists. */
@@ -82,7 +81,7 @@ const navFromMeta = (meta, basePath = "", recent = {}) => {
82
81
  if (!view.nav?.hidden) add(defaultGroup, {
83
82
  id: navItemId(model.name),
84
83
  label: view.names?.plural ?? humanize(model.name),
85
- icon: iconFor(model.name),
84
+ icon: resourceIcon(meta, model.name),
86
85
  href: appPath({
87
86
  kind: "list",
88
87
  resource: model.name
@@ -95,7 +94,7 @@ const navFromMeta = (meta, basePath = "", recent = {}) => {
95
94
  add(named.nav?.group ?? defaultGroup, {
96
95
  id: navItemId(model.name, named.name),
97
96
  label: named.names.plural,
98
- icon: iconFor(model.name),
97
+ icon: resourceIcon(meta, model.name),
99
98
  href: appPath({
100
99
  kind: "list",
101
100
  resource: model.name,
@@ -115,7 +114,7 @@ const navFromMeta = (meta, basePath = "", recent = {}) => {
115
114
  group.items.push({
116
115
  id: entry.resource,
117
116
  label: entry.names?.plural ?? humanize(entry.resource),
118
- icon: iconFor(entry.resource),
117
+ icon: resourceIcon(meta, entry.resource),
119
118
  href: appPath({
120
119
  kind: "list",
121
120
  resource: entry.resource
@@ -133,7 +132,7 @@ const navFromMeta = (meta, basePath = "", recent = {}) => {
133
132
  for (const resource of status.source.resources) group.items.push({
134
133
  id: resource,
135
134
  label: humanize(resource),
136
- icon: iconFor(resource),
135
+ icon: Table2,
137
136
  href: appPath({
138
137
  kind: "list",
139
138
  resource
@@ -1,6 +1,5 @@
1
1
  import { humanize } from "../live/naming.js";
2
- import { iconFor } from "./icons.js";
3
- import { menuIcon } from "./menu-icons.js";
2
+ import { menuIcon, resourceIcon } from "./menu-icons.js";
4
3
  import { ExternalLink, LayoutDashboard } from "lucide-react";
5
4
  import { appPath } from "@protobase/schema";
6
5
  //#region src/app/user-menu-from-meta.ts
@@ -31,7 +30,7 @@ const userMenuFromMeta = (meta, basePath, activeResource) => (meta.userMenu?.ite
31
30
  return {
32
31
  id: item.resource,
33
32
  label: item.label ?? meta.views[item.resource]?.names?.plural ?? humanize(item.resource),
34
- icon: menuIcon(item.icon, iconFor(item.resource)),
33
+ icon: menuIcon(item.icon, resourceIcon(meta, item.resource)),
35
34
  href: appPath({
36
35
  kind: "list",
37
36
  resource: item.resource
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.64.0";
2
+ var version = "0.65.0";
3
3
  var protobase = { "pluginApi": 1 };
4
4
  //#endregion
5
5
  export { protobase, version };