@gemboss/ui 0.73.0 → 0.75.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/CHANGELOG.md +45 -0
- package/README.md +42 -1
- package/catalog/editor.html +1 -1
- package/catalog/index.html +61 -61
- package/gemboss-ui.css +1 -1
- package/package.json +3 -1
- package/parts/components.css +1 -1
- package/parts/core.css +1 -1
- package/parts/shell.css +1 -1
- package/src/GemMark.tsx +9 -2
- package/src/app-nav.tsx +1 -1
- package/src/auth.tsx +7 -3
- package/src/brand-gem.tsx +10 -2
- package/src/brand.tsx +6 -3
- package/src/editor/field-frame.tsx +5 -3
- package/src/editor/inspector-frame.tsx +3 -2
- package/src/editor-inspector-frame.css +1 -1
- package/src/icons-plain.js +1 -1
- package/src/icons.tsx +2 -0
- package/src/index.ts +4 -2
- package/src/metrics.css +1 -0
- package/src/metrics.tsx +59 -0
- package/src/select-drawn.css +1 -0
- package/src/service-switcher-plain.js +1 -1
- package/src/services.ts +18 -1
- package/src/site.tsx +3 -3
package/src/metrics.tsx
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metrics — @gemboss/ui (unreleased). A row of big numbers on cards, each with its name above it and one line under it: a plugin's Home
|
|
3
|
+
* ("Live subscriptions 1,284", "Next 7 days $9,840 · 286 charges", GemLoop canvas S3MbznkcRrCMuTYeRmphwA, board Main) and a list's
|
|
4
|
+
* cards (a plan's subscribers and products, board loop-plans). The kit had these only in kit-plain.css (`ui-metric--lg` in a
|
|
5
|
+
* `ui-metrics--grid`), which the admin does not load, so each React screen drew its own tile (GemPrint's Home, GemTroop's copy of
|
|
6
|
+
* the plain rules). This is that card as a part, with the same class names, so a plain page and a React one draw one look.
|
|
7
|
+
*
|
|
8
|
+
* - `Metrics`: the grid. `auto-fit` splits the row evenly, so four never fold into three and an orphan; two columns at 520px and under.
|
|
9
|
+
* - `Metric`: one card. `label` is its name (drawn above the number), `value` the number, `foot` one muted line under it. With `href`
|
|
10
|
+
* the whole card is the link (`linkAs`: the app's Link); without, it is a plain card. A number that is not known is not drawn here:
|
|
11
|
+
* a screen leaves the card out, or says why in `foot`, and never passes a made-up figure.
|
|
12
|
+
*
|
|
13
|
+
* Server-renderable (no state, no effect). Its own entry, `@gemboss/ui/metrics.css`; the base `ui-metric` look is ui.css's.
|
|
14
|
+
*/
|
|
15
|
+
import "./metrics.css";
|
|
16
|
+
import React, { type ElementType, type ReactNode } from "react";
|
|
17
|
+
|
|
18
|
+
const cx = (...p: Array<string | false | null | undefined>) => p.filter(Boolean).join(" ");
|
|
19
|
+
|
|
20
|
+
export interface MetricsProps {
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
/** The row's name for a screen reader, when no heading names it ("Numbers"). */
|
|
23
|
+
label?: string;
|
|
24
|
+
className?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function Metrics({ children, label, className }: MetricsProps) {
|
|
28
|
+
return <section className={cx("ui-metrics ui-metrics--grid", className)} aria-label={label}>{children}</section>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface MetricProps {
|
|
32
|
+
/** Its name: "Live subscriptions". */
|
|
33
|
+
label: ReactNode;
|
|
34
|
+
/** The number, as the screen formats it: "1,284", "$41.4k". */
|
|
35
|
+
value: ReactNode;
|
|
36
|
+
/** One muted line under it: "286 charges". */
|
|
37
|
+
foot?: ReactNode;
|
|
38
|
+
/** The card is a link to where the number comes from. */
|
|
39
|
+
href?: string;
|
|
40
|
+
/** The app's link component (Next's Link); a plain `<a>` without it. */
|
|
41
|
+
linkAs?: ElementType;
|
|
42
|
+
className?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function Metric({ label, value, foot, href, linkAs, className }: MetricProps) {
|
|
46
|
+
const inner = (
|
|
47
|
+
<>
|
|
48
|
+
<span className="ui-metric__val">{value}</span>
|
|
49
|
+
<span className="ui-metric__lbl">{label}</span>
|
|
50
|
+
{foot !== undefined && foot !== null && foot !== false && foot !== "" ? <span className="ui-metric__foot">{foot}</span> : null}
|
|
51
|
+
</>
|
|
52
|
+
);
|
|
53
|
+
const cls = cx("ui-metric ui-metric--lg", className);
|
|
54
|
+
if (href) {
|
|
55
|
+
const Link: ElementType = linkAs ?? "a";
|
|
56
|
+
return <Link className={cls} href={href}>{inner}</Link>;
|
|
57
|
+
}
|
|
58
|
+
return <div className={cls}>{inner}</div>;
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@media (pointer: coarse),(max-width: 47.9975em){.ui-select.ui-select{--ui-select-band: 4px;--ui-select-line: var(--p-color-input-border, var(--gemboss-field-line));border-width:var(--ui-select-band) 0;border-color:transparent!important;border-radius:var(--ui-radius-md) / calc(var(--ui-radius-md) + var(--ui-select-band));-webkit-background-clip:padding-box!important;background-clip:padding-box!important;box-shadow:inset 0 0 0 1px var(--ui-select-line)}.ui-select--slim.ui-select--slim{--ui-select-band: 7px}.ui-select.ui-select[aria-invalid=true]{--ui-select-line: var(--gemboss-danger-strong)}.ui-select.ui-select:focus-visible:not(:disabled){--ui-select-line: var(--p-color-input-border-active, var(--gemboss-field-line-active));outline:none;box-shadow:inset 0 0 0 1px var(--ui-select-line),inset 0 0 0 3px var(--ui-focus)}}@media (pointer: coarse) and (min-width: 48em){.ui-select.ui-select:not(.ui-select--slim){--ui-select-band: 6px}}@media (hover: hover) and (max-width: 47.9975em),(hover: hover) and (pointer: coarse){.ui-select.ui-select:hover:not(:disabled):not(:focus-visible){--ui-select-line: var(--p-color-input-border-hover, var(--gemboss-field-line-hover))}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(M){"use strict";var b=M.gembossUI||(M.gembossUI={});if(b.initServiceSwitcher)return;var K=[["gemboss","GemBoss"],["build","Build the store"],["market","Read the market"],["content","Content and community"],["customers","Customers"],["team","Team and partners"]],O=[["gemboss","GemBoss","https://admin.gemboss.ai","The seller app and the ops console.","gemboss","dashboard","iris"],["gemfactory","GemFactory","https://gemfactory.ops.gemboss.ai","Review sections, elements and templates.","build","layers","blue"],["gemmedia","GemMedia","https://media.gemboss.ai","Images and videos made for stores, and their cost.","build","image","rose"],["gemform","GemForm","https://gemform.ops.gemboss.ai","Form submissions from stores.","build","document","teal"],["gemx","GemX","https://x.gemboss.ai","Tests and personalization across every store.","build","sliders","amber"],["gemwatcher","GemWatcher","https://gemwatcher.ops.gemboss.ai","Store and market intelligence.","market","eye","violet"],["gemmarket","GemMarket","https://market.gemboss.ai","Each store's market read and its competitors.","market","chart","green"],["gempixel","GemPixel","https://pixel.gemboss.ai","Events every store sends, and whether they add up.","market","activity","blue"],["gemcapture","GemCapture","https://capture.gemboss.ai/admin","Page captures and visual checks.","market","page","slate"],["search-radar","Search Radar","https://search-radar.ops.gemboss.ai","Rankings on the App Store, Google and AI answers.","market","radar","amber"],["gempress","GemPress","https://press.gemboss.ai/admin","Articles and the content store.","content","article","orange"],["content-radar","Content Radar","https://content-radar.ops.gemboss.ai","From the topics worth writing to articles.","content","radar","teal"],["gemcommunity","GemCommunity","https://community.gemboss.ai/admin","The seller community.","content","users","blue"],["gemnews","GemCommunity News","https://news.gemboss.ai/admin","News posts and how they are read.","content","megaphone","rose"],["gemcare","GemCare","https://care.gemboss.ai/inbox","The customer care inbox.","customers","chat","green"],["gemfeedback","GemFeedback","https://feedback.gemboss.ai/admin","The feedback backlog.","customers","inbox","violet"],["partner-radar","Partner Radar","https://partner-radar.ops.gemboss.ai","Partners and agencies, as a CRM.","team","link","orange"],["taskdesk","Taskdesk","https://gemlabs-taskdesk-production.up.railway.app","Every job the fleet is running.","team","list","slate"]],U={apps:'<circle cx="4.5" cy="4.5" r="1"/><circle cx="10" cy="4.5" r="1"/><circle cx="15.5" cy="4.5" r="1"/><circle cx="4.5" cy="10" r="1"/><circle cx="10" cy="10" r="1"/><circle cx="15.5" cy="10" r="1"/><circle cx="4.5" cy="15.5" r="1"/><circle cx="10" cy="15.5" r="1"/><circle cx="15.5" cy="15.5" r="1"/>',close:'<path d="M5 5l10 10M15 5 5 15"/>',search:'<circle cx="8.8" cy="8.8" r="5.3"/><path d="M12.8 12.8 17 17"/>',dashboard:'<rect x="3" y="3" width="6" height="6" rx="1.3"/><rect x="11" y="3" width="6" height="6" rx="1.3"/><rect x="3" y="11" width="6" height="6" rx="1.3"/><rect x="11" y="11" width="6" height="6" rx="1.3"/>',layers:'<path d="M10 3 17 6.8 10 10.6 3 6.8z"/><path d="M3 10.1l7 3.8 7-3.8"/><path d="M3 13.4l7 3.8 7-3.8"/>',image:'<rect x="3" y="3.5" width="14" height="13" rx="1.8"/><circle cx="7.3" cy="7.8" r="1.3"/><path d="M3.5 15l4.2-4.2 3 3 2.2-2.2 3.6 3.6"/>',document:'<path d="M5 2.8h6.8l3.2 3.2v11.2H5z"/><path d="M11.8 2.8V6H15M7.5 10h5M7.5 13h5"/>',sliders:'<path d="M3 5h14M3 10h14M3 15h14"/><circle cx="7" cy="5" r="1.6"/><circle cx="13" cy="10" r="1.6"/><circle cx="9" cy="15" r="1.6"/>',eye:'<path d="M1.8 10S4.7 4.8 10 4.8 18.2 10 18.2 10 15.3 15.2 10 15.2 1.8 10 1.8 10z"/><circle cx="10" cy="10" r="2.5"/>',chart:'<path d="M3 16.5h14"/><rect x="4.5" y="9" width="2.8" height="5.5" rx=".7"/><rect x="8.6" y="5" width="2.8" height="9.5" rx=".7"/><rect x="12.7" y="11" width="2.8" height="3.5" rx=".7"/>',activity:'<path d="M2.5 10h3l2-5 3 10 2-5h5"/>',page:'<rect x="2.5" y="3.5" width="15" height="13" rx="2"/><path d="M2.5 7.5h15M6 11h8M6 13.5h5"/>',radar:'<circle cx="10" cy="10" r="7"/><circle cx="10" cy="10" r="3.5"/><path d="M10 10l5-5"/>',article:'<rect x="3" y="3.5" width="14" height="13" rx="1.5"/><path d="M6 7h8M6 10h8M6 13h5"/>',users:'<circle cx="7.5" cy="7.3" r="2.8"/><path d="M2.5 16.3c.6-2.5 2.5-4 5-4s4.4 1.5 5 4"/><path d="M12.3 4.8a2.8 2.8 0 0 1 0 5.2M14.3 12.5c1.6.4 2.7 1.7 3.2 3.8"/>',megaphone:'<path d="M3 8v4h3l6 4V4L6 8H3z"/><path d="M15 7.5a3.5 3.5 0 0 1 0 5"/>',chat:'<path d="M3 4.5h14v9H8.5L5 16.5v-3H3z"/>',inbox:'<path d="M3 11l2-7h10l2 7v5H3z"/><path d="M3 11h4l1 2h4l1-2h4"/>',link:'<path d="M8.6 11.4a3 3 0 0 0 4.2 0l2.6-2.6a3 3 0 0 0-4.2-4.2l-1 1"/><path d="M11.4 8.6a3 3 0 0 0-4.2 0l-2.6 2.6a3 3 0 0 0 4.2 4.2l1-1"/>',list:'<path d="M8 5h9M8 10h9M8 15h9"/><circle cx="4" cy="5" r=".9"/><circle cx="4" cy="10" r=".9"/><circle cx="4" cy="15" r=".9"/>'},B={trigger:"Switch service",title:"Gem services",close:"Close",search:"Find a service",noMatch:"No service matches \u201C{query}\u201D.",all:"All services and their health"},F="https://gemfactory.ops.gemboss.ai/services",V=".gemboss-platform-topbar, header, [role='banner']",D=O.map(function(a){return{id:a[0],name:a[1],url:a[2],purpose:a[3],group:a[4],icon:a[5],tint:a[6]}}),c=function(a){return String(a).replace(/[&<>"']/g,function(r){return{"&":"&","<":"<",">":">",'"':""","'":"'"}[r]})},k=function(a,r){return'<svg viewBox="0 0 20 20" width="'+r+'" height="'+r+'" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">'+(U[a]||"")+"</g></svg>"},j=0;function W(a){return K.map(function(r){return{id:r[0],title:r[1],services:a.filter(function(l){return l.group===r[0]})}}).filter(function(r){return r.services.length>0})}function X(a,r,l){var o=a.map(function(d){return d.getBoundingClientRect()}),u=o[r],_=u.left+u.width/2,f=-1,m=0,y=0;return o.forEach(function(d,E){if(!(l>0?d.top<=u.top+1:d.top>=u.top-1)){var h=Math.abs(d.left+d.width/2-_),s=f<0||(l>0?d.top<m-1:d.top>m+1),p=f>=0&&Math.abs(d.top-m)<=1;(s||p&&h<y)&&(f=E,m=d.top,y=h)}}),f}function N(a,r){var l=a.children;l.length===r.length&&r.every(function(o,u){return l[u]===o})||a.replaceChildren.apply(a,r)}function J(a,r){var l=r.current||a.getAttribute("data-gb-service-switcher")||"",o={},u;for(u in B)o[u]=r.labels&&r.labels[u]!=null?r.labels[u]:B[u];var _=r.allHref===void 0?F:r.allHref,f=W(r.services||D),m="gb-svc"+ ++j+"-",y=m+"svc",d=m+"svc-t",E=document.createElement("template");E.innerHTML='<button type="button" class="gb-svc-trigger'+(r.className?" "+c(r.className):"")+'" aria-haspopup="dialog" aria-expanded="false" aria-controls="'+y+'" aria-label="'+c(o.trigger)+'" title="'+c(o.trigger)+'">'+k("apps",20)+'</button><dialog id="'+y+'" class="gb-svc" aria-labelledby="'+d+'"><div class="gb-svc__head"><h2 class="gb-svc__title" id="'+d+'">'+c(o.title)+'</h2><button type="button" class="ui-modal__close" aria-label="'+c(o.close)+'">'+k("close",20)+"</button></div>"+(r.search===!1?"":'<div class="gb-svc__search"><label class="gemboss-field gemboss-field--group">'+k("search",16)+'<input class="gemboss-field__bare" type="search" name="service-search" autocomplete="off" value="" placeholder="'+c(o.search)+'" aria-label="'+c(o.search)+'"></label></div>')+'<div class="gb-svc__body">'+f.map(function(e){return'<div class="gb-svc__group" role="group" aria-labelledby="'+m+"svc-"+c(e.id)+'"><h3 class="gb-svc__heading" id="'+m+"svc-"+c(e.id)+'">'+c(e.title)+'</h3><ul class="gb-svc__grid" role="list">'+e.services.map(function(t){return'<li><a class="gb-svc__tile" href="'+c(t.url)+'" data-tint="'+c(t.tint)+'"'+(t.id===l?' aria-current="page"':"")+' tabindex="-1"><span class="gb-svc__mark" aria-hidden="true">'+k(t.icon,22)+'</span><span class="gb-svc__name">'+c(t.name)+'</span><span class="gb-svc__purpose">'+c(t.purpose)+"</span></a></li>"}).join("")+"</ul></div>"}).join("")+"</div>"+(_?'<div class="gb-svc__foot"><a class="gb-svc__all" href="'+c(_)+'">'+c(o.all)+'<span aria-hidden="true">\u2192</span></a></div>':"")+"</dialog>";var h=E.content.firstChild,s=h.nextSibling,p=s.querySelector(".gb-svc__search input"),S=s.querySelector(".gb-svc__body"),G=function(){return Array.prototype.slice.call(s.querySelectorAll(".gb-svc__tile"))},Q=G(),Y=0,C=[];f.forEach(function(e,t){e.el=S.children[t],e.ul=e.el.querySelector("ul"),e.items=e.services.map(function(n){var i=Q[Y++],v={s:n,a:i,li:i.parentNode};return C.push(v),v})});var A=document.createElement("p");A.className="gb-svc__empty",A.setAttribute("role","status");var L=l,R=null,q=!1;function x(){var e=p?p.value:"",t=e.trim().toLowerCase(),n=[],i=[];f.forEach(function(g){var T=g.items.filter(function(w){return!t||(w.s.name+" "+w.s.purpose+" "+w.s.id+" "+g.title).toLowerCase().indexOf(t)>-1});T.length&&(N(g.ul,T.map(function(w){return w.li})),n.push(g.el),i=i.concat(T))}),n.length||(A.textContent=o.noMatch.replace("{query}",e.trim()),n.push(A)),N(S,n);var v=i.map(function(g){return g.s.id}),I=v.indexOf(L)>-1?L:v.indexOf(l)>-1?l:v[0];i.forEach(function(g){g.a.setAttribute("tabindex",g.s.id===I?"0":"-1")})}function H(){var e=h.previousElementSibling,t=(e&&e.tagName==="A"?e:h).getBoundingClientRect(),n=h.closest(V),i=Math.max(h.getBoundingClientRect().bottom,n?n.getBoundingClientRect().bottom:0),v=document.documentElement.clientWidth,I=Math.min(760,v-24);s.style.setProperty("--gb-svc-x",Math.round(Math.max(12,Math.min(t.left,v-I-12)))+"px"),s.style.setProperty("--gb-svc-y",Math.round(i+6)+"px")}function z(){if(!(s.open||!s.isConnected)){H(),b.closeMenus&&b.closeMenus(),R=document.activeElement,s.showModal(),h.setAttribute("aria-expanded","true"),L=l,x();var e=s.querySelector(".gb-svc__tile[aria-current]")||s.querySelector(".gb-svc__tile");e&&e.focus(),addEventListener("resize",H)}}return s.addEventListener("close",function(){removeEventListener("resize",H),h.setAttribute("aria-expanded","false"),p&&(p.value=""),x();var e=R;R=null,e&&e.focus&&e.focus({preventScroll:!0})}),h.addEventListener("click",z),s.addEventListener("pointerdown",function(e){q=e.target===s}),s.addEventListener("click",function(e){var t=e.target,n=q;if(q=!1,t===s){n&&s.close();return}(t.closest(".ui-modal__close")||t.closest(".gb-svc__tile, .gb-svc__all")&&e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey)&&s.close()}),p&&(p.addEventListener("input",x),p.addEventListener("keydown",function(e){if(!e.isComposing){var t=G()[0];e.key==="Escape"?(e.preventDefault(),s.close()):e.key==="ArrowDown"?(e.preventDefault(),t&&t.focus()):e.key==="Enter"&&p.value.trim()&&(e.preventDefault(),t&&t.click())}})),S.addEventListener("keydown",function(e){var t=G(),n=t.indexOf(document.activeElement),i;if(!(n<0||e.altKey||e.ctrlKey||e.metaKey)){if(e.key==="ArrowRight")i=Math.min(n+1,t.length-1);else if(e.key==="ArrowLeft")i=Math.max(n-1,0);else if(e.key==="Home")i=0;else if(e.key==="End")i=t.length-1;else if(e.key==="ArrowDown"||e.key==="ArrowUp"){if(i=X(t,n,e.key==="ArrowDown"?1:-1),i<0&&e.key==="ArrowUp"&&p){e.preventDefault(),p.focus();return}i<0&&(i=n)}else return;e.preventDefault(),t[i].focus()}}),S.addEventListener("focusin",function(e){for(var t=0;t<C.length;t++)if(C[t].a===e.target){L=C[t].s.id,x();return}}),x(),a.replaceWith(h,s),{button:h,dialog:s,open:z,close:function(){s.close()}}}function P(a){return a=a||{},document.readyState==="loading"?document.addEventListener("DOMContentLoaded",function(){P(a)},{once:!0}):!b.openModal&&M.console&&document.querySelector('script[src*="kit-plain"]')&&M.console.error("@gemboss/ui service-switcher-plain.js: load it after kit-plain.js (kit-plain.js defines nothing when gembossUI exists)"),Array.prototype.map.call((a.root||document).querySelectorAll("[data-gb-service-switcher]"),function(r){return J(r,a)})}b.initServiceSwitcher=P,b.GEM_SERVICES=D})(typeof globalThis<"u"?globalThis:this);
|
|
1
|
+
(function(M){"use strict";var b=M.gembossUI||(M.gembossUI={});if(b.initServiceSwitcher)return;var N=[["gemboss","GemBoss"],["build","Build the store"],["market","Read the market"],["content","Content and community"],["customers","Customers"],["team","Team and partners"]],O=[["gemboss","GemBoss","https://admin.gemboss.ai","The seller app and the ops console.","gemboss","dashboard","iris"],["gemfactory","GemFactory","https://gemfactory.ops.gemboss.ai","Review sections, elements and templates.","build","layers","blue"],["gemmedia","GemMedia","https://media.gemboss.ai","Images and videos made for stores, and their cost.","build","image","rose"],["gemform","GemForm","https://gemform.ops.gemboss.ai","Form submissions from stores.","build","document","teal"],["gemx","GemX","https://x.gemboss.ai","Tests and personalization across every store.","build","sliders","amber"],["gemwatcher","GemWatcher","https://gemwatcher.ops.gemboss.ai","Store and market intelligence.","market","eye","violet"],["gemmarket","GemMarket","https://market.gemboss.ai","Each store's market read and its competitors.","market","chart","green"],["gempixel","GemPixel","https://pixel.gemboss.ai","Events every store sends, and whether they add up.","market","activity","blue"],["gemcapture","GemCapture","https://capture.gemboss.ai/admin","Page captures and visual checks.","market","page","slate"],["search-radar","Search Radar","https://search-radar.ops.gemboss.ai","Rankings on the App Store, Google and AI answers.","market","radar","amber"],["gempress","GemPress","https://press.gemboss.ai/admin","Articles and the content store.","content","article","orange"],["content-radar","Content Radar","https://content-radar.ops.gemboss.ai","From the topics worth writing to articles.","content","radar","teal"],["gemcommunity","GemCommunity","https://community.gemboss.ai/admin","The seller community.","content","users","blue"],["gemnews","GemSpace","https://space.gemboss.ai/admin","The new-tab workspace and how its news is read.","content","megaphone","rose"],["gemcare","GemCare","https://care.gemboss.ai/inbox","The customer care inbox.","customers","chat","green"],["gemfeedback","GemFeedback","https://feedback.gemboss.ai/admin","The feedback backlog.","customers","inbox","violet"],["partner-radar","Partner Radar","https://partner-radar.ops.gemboss.ai","Partners and agencies, as a CRM.","team","link","orange"],["taskdesk","Taskdesk","https://gemlabs-taskdesk-production.up.railway.app","Every job the fleet is running.","team","list","slate"]],U={apps:'<circle cx="4.5" cy="4.5" r="1"/><circle cx="10" cy="4.5" r="1"/><circle cx="15.5" cy="4.5" r="1"/><circle cx="4.5" cy="10" r="1"/><circle cx="10" cy="10" r="1"/><circle cx="15.5" cy="10" r="1"/><circle cx="4.5" cy="15.5" r="1"/><circle cx="10" cy="15.5" r="1"/><circle cx="15.5" cy="15.5" r="1"/>',close:'<path d="M5 5l10 10M15 5 5 15"/>',search:'<circle cx="8.8" cy="8.8" r="5.3"/><path d="M12.8 12.8 17 17"/>',dashboard:'<rect x="3" y="3" width="6" height="6" rx="1.3"/><rect x="11" y="3" width="6" height="6" rx="1.3"/><rect x="3" y="11" width="6" height="6" rx="1.3"/><rect x="11" y="11" width="6" height="6" rx="1.3"/>',layers:'<path d="M10 3 17 6.8 10 10.6 3 6.8z"/><path d="M3 10.1l7 3.8 7-3.8"/><path d="M3 13.4l7 3.8 7-3.8"/>',image:'<rect x="3" y="3.5" width="14" height="13" rx="1.8"/><circle cx="7.3" cy="7.8" r="1.3"/><path d="M3.5 15l4.2-4.2 3 3 2.2-2.2 3.6 3.6"/>',document:'<path d="M5 2.8h6.8l3.2 3.2v11.2H5z"/><path d="M11.8 2.8V6H15M7.5 10h5M7.5 13h5"/>',sliders:'<path d="M3 5h14M3 10h14M3 15h14"/><circle cx="7" cy="5" r="1.6"/><circle cx="13" cy="10" r="1.6"/><circle cx="9" cy="15" r="1.6"/>',eye:'<path d="M1.8 10S4.7 4.8 10 4.8 18.2 10 18.2 10 15.3 15.2 10 15.2 1.8 10 1.8 10z"/><circle cx="10" cy="10" r="2.5"/>',chart:'<path d="M3 16.5h14"/><rect x="4.5" y="9" width="2.8" height="5.5" rx=".7"/><rect x="8.6" y="5" width="2.8" height="9.5" rx=".7"/><rect x="12.7" y="11" width="2.8" height="3.5" rx=".7"/>',activity:'<path d="M2.5 10h3l2-5 3 10 2-5h5"/>',page:'<rect x="2.5" y="3.5" width="15" height="13" rx="2"/><path d="M2.5 7.5h15M6 11h8M6 13.5h5"/>',radar:'<circle cx="10" cy="10" r="7"/><circle cx="10" cy="10" r="3.5"/><path d="M10 10l5-5"/>',article:'<rect x="3" y="3.5" width="14" height="13" rx="1.5"/><path d="M6 7h8M6 10h8M6 13h5"/>',users:'<circle cx="7.5" cy="7.3" r="2.8"/><path d="M2.5 16.3c.6-2.5 2.5-4 5-4s4.4 1.5 5 4"/><path d="M12.3 4.8a2.8 2.8 0 0 1 0 5.2M14.3 12.5c1.6.4 2.7 1.7 3.2 3.8"/>',megaphone:'<path d="M3 8v4h3l6 4V4L6 8H3z"/><path d="M15 7.5a3.5 3.5 0 0 1 0 5"/>',chat:'<path d="M3 4.5h14v9H8.5L5 16.5v-3H3z"/>',inbox:'<path d="M3 11l2-7h10l2 7v5H3z"/><path d="M3 11h4l1 2h4l1-2h4"/>',link:'<path d="M8.6 11.4a3 3 0 0 0 4.2 0l2.6-2.6a3 3 0 0 0-4.2-4.2l-1 1"/><path d="M11.4 8.6a3 3 0 0 0-4.2 0l-2.6 2.6a3 3 0 0 0 4.2 4.2l1-1"/>',list:'<path d="M8 5h9M8 10h9M8 15h9"/><circle cx="4" cy="5" r=".9"/><circle cx="4" cy="10" r=".9"/><circle cx="4" cy="15" r=".9"/>'},B={trigger:"Switch service",title:"Gem services",close:"Close",search:"Find a service",noMatch:"No service matches \u201C{query}\u201D.",all:"All services and their health"},F="https://gemfactory.ops.gemboss.ai/services",V=".gemboss-platform-topbar, header, [role='banner']",D=O.map(function(a){return{id:a[0],name:a[1],url:a[2],purpose:a[3],group:a[4],icon:a[5],tint:a[6]}}),c=function(a){return String(a).replace(/[&<>"']/g,function(r){return{"&":"&","<":"<",">":">",'"':""","'":"'"}[r]})},k=function(a,r){return'<svg viewBox="0 0 20 20" width="'+r+'" height="'+r+'" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">'+(U[a]||"")+"</g></svg>"},j=0;function W(a){return N.map(function(r){return{id:r[0],title:r[1],services:a.filter(function(l){return l.group===r[0]})}}).filter(function(r){return r.services.length>0})}function X(a,r,l){var o=a.map(function(d){return d.getBoundingClientRect()}),u=o[r],_=u.left+u.width/2,f=-1,m=0,y=0;return o.forEach(function(d,E){if(!(l>0?d.top<=u.top+1:d.top>=u.top-1)){var h=Math.abs(d.left+d.width/2-_),s=f<0||(l>0?d.top<m-1:d.top>m+1),p=f>=0&&Math.abs(d.top-m)<=1;(s||p&&h<y)&&(f=E,m=d.top,y=h)}}),f}function P(a,r){var l=a.children;l.length===r.length&&r.every(function(o,u){return l[u]===o})||a.replaceChildren.apply(a,r)}function J(a,r){var l=r.current||a.getAttribute("data-gb-service-switcher")||"",o={},u;for(u in B)o[u]=r.labels&&r.labels[u]!=null?r.labels[u]:B[u];var _=r.allHref===void 0?F:r.allHref,f=W(r.services||D),m="gb-svc"+ ++j+"-",y=m+"svc",d=m+"svc-t",E=document.createElement("template");E.innerHTML='<button type="button" class="gb-svc-trigger'+(r.className?" "+c(r.className):"")+'" aria-haspopup="dialog" aria-expanded="false" aria-controls="'+y+'" aria-label="'+c(o.trigger)+'" title="'+c(o.trigger)+'">'+k("apps",20)+'</button><dialog id="'+y+'" class="gb-svc" aria-labelledby="'+d+'"><div class="gb-svc__head"><h2 class="gb-svc__title" id="'+d+'">'+c(o.title)+'</h2><button type="button" class="ui-modal__close" aria-label="'+c(o.close)+'">'+k("close",20)+"</button></div>"+(r.search===!1?"":'<div class="gb-svc__search"><label class="gemboss-field gemboss-field--group">'+k("search",16)+'<input class="gemboss-field__bare" type="search" name="service-search" autocomplete="off" value="" placeholder="'+c(o.search)+'" aria-label="'+c(o.search)+'"></label></div>')+'<div class="gb-svc__body">'+f.map(function(e){return'<div class="gb-svc__group" role="group" aria-labelledby="'+m+"svc-"+c(e.id)+'"><h3 class="gb-svc__heading" id="'+m+"svc-"+c(e.id)+'">'+c(e.title)+'</h3><ul class="gb-svc__grid" role="list">'+e.services.map(function(t){return'<li><a class="gb-svc__tile" href="'+c(t.url)+'" data-tint="'+c(t.tint)+'"'+(t.id===l?' aria-current="page"':"")+' tabindex="-1"><span class="gb-svc__mark" aria-hidden="true">'+k(t.icon,22)+'</span><span class="gb-svc__name">'+c(t.name)+'</span><span class="gb-svc__purpose">'+c(t.purpose)+"</span></a></li>"}).join("")+"</ul></div>"}).join("")+"</div>"+(_?'<div class="gb-svc__foot"><a class="gb-svc__all" href="'+c(_)+'">'+c(o.all)+'<span aria-hidden="true">\u2192</span></a></div>':"")+"</dialog>";var h=E.content.firstChild,s=h.nextSibling,p=s.querySelector(".gb-svc__search input"),S=s.querySelector(".gb-svc__body"),G=function(){return Array.prototype.slice.call(s.querySelectorAll(".gb-svc__tile"))},Q=G(),Y=0,C=[];f.forEach(function(e,t){e.el=S.children[t],e.ul=e.el.querySelector("ul"),e.items=e.services.map(function(n){var i=Q[Y++],v={s:n,a:i,li:i.parentNode};return C.push(v),v})});var A=document.createElement("p");A.className="gb-svc__empty",A.setAttribute("role","status");var L=l,R=null,q=!1;function x(){var e=p?p.value:"",t=e.trim().toLowerCase(),n=[],i=[];f.forEach(function(g){var I=g.items.filter(function(w){return!t||(w.s.name+" "+w.s.purpose+" "+w.s.id+" "+g.title).toLowerCase().indexOf(t)>-1});I.length&&(P(g.ul,I.map(function(w){return w.li})),n.push(g.el),i=i.concat(I))}),n.length||(A.textContent=o.noMatch.replace("{query}",e.trim()),n.push(A)),P(S,n);var v=i.map(function(g){return g.s.id}),T=v.indexOf(L)>-1?L:v.indexOf(l)>-1?l:v[0];i.forEach(function(g){g.a.setAttribute("tabindex",g.s.id===T?"0":"-1")})}function H(){var e=h.previousElementSibling,t=(e&&e.tagName==="A"?e:h).getBoundingClientRect(),n=h.closest(V),i=Math.max(h.getBoundingClientRect().bottom,n?n.getBoundingClientRect().bottom:0),v=document.documentElement.clientWidth,T=Math.min(760,v-24);s.style.setProperty("--gb-svc-x",Math.round(Math.max(12,Math.min(t.left,v-T-12)))+"px"),s.style.setProperty("--gb-svc-y",Math.round(i+6)+"px")}function K(){if(!(s.open||!s.isConnected)){H(),b.closeMenus&&b.closeMenus(),R=document.activeElement,s.showModal(),h.setAttribute("aria-expanded","true"),L=l,x();var e=s.querySelector(".gb-svc__tile[aria-current]")||s.querySelector(".gb-svc__tile");e&&e.focus(),addEventListener("resize",H)}}return s.addEventListener("close",function(){removeEventListener("resize",H),h.setAttribute("aria-expanded","false"),p&&(p.value=""),x();var e=R;R=null,e&&e.focus&&e.focus({preventScroll:!0})}),h.addEventListener("click",K),s.addEventListener("pointerdown",function(e){q=e.target===s}),s.addEventListener("click",function(e){var t=e.target,n=q;if(q=!1,t===s){n&&s.close();return}(t.closest(".ui-modal__close")||t.closest(".gb-svc__tile, .gb-svc__all")&&e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey)&&s.close()}),p&&(p.addEventListener("input",x),p.addEventListener("keydown",function(e){if(!e.isComposing){var t=G()[0];e.key==="Escape"?(e.preventDefault(),s.close()):e.key==="ArrowDown"?(e.preventDefault(),t&&t.focus()):e.key==="Enter"&&p.value.trim()&&(e.preventDefault(),t&&t.click())}})),S.addEventListener("keydown",function(e){var t=G(),n=t.indexOf(document.activeElement),i;if(!(n<0||e.altKey||e.ctrlKey||e.metaKey)){if(e.key==="ArrowRight")i=Math.min(n+1,t.length-1);else if(e.key==="ArrowLeft")i=Math.max(n-1,0);else if(e.key==="Home")i=0;else if(e.key==="End")i=t.length-1;else if(e.key==="ArrowDown"||e.key==="ArrowUp"){if(i=X(t,n,e.key==="ArrowDown"?1:-1),i<0&&e.key==="ArrowUp"&&p){e.preventDefault(),p.focus();return}i<0&&(i=n)}else return;e.preventDefault(),t[i].focus()}}),S.addEventListener("focusin",function(e){for(var t=0;t<C.length;t++)if(C[t].a===e.target){L=C[t].s.id,x();return}}),x(),a.replaceWith(h,s),{button:h,dialog:s,open:K,close:function(){s.close()}}}function z(a){return a=a||{},document.readyState==="loading"?document.addEventListener("DOMContentLoaded",function(){z(a)},{once:!0}):!b.openModal&&M.console&&document.querySelector('script[src*="kit-plain"]')&&M.console.error("@gemboss/ui service-switcher-plain.js: load it after kit-plain.js (kit-plain.js defines nothing when gembossUI exists)"),Array.prototype.map.call((a.root||document).querySelectorAll("[data-gb-service-switcher]"),function(r){return J(r,a)})}b.initServiceSwitcher=z,b.GEM_SERVICES=D})(typeof globalThis<"u"?globalThis:this);
|
package/src/services.ts
CHANGED
|
@@ -25,6 +25,23 @@ export const SERVICE_GROUPS = [
|
|
|
25
25
|
] as const;
|
|
26
26
|
export type ServiceGroupId = (typeof SERVICE_GROUPS)[number]["id"];
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* The gem's table facet, by the role a Gem plays (16/11/2026; Chris 15/11: a Gem's logo is the GemBoss gem, only the
|
|
30
|
+
* facet's colour changes; the set is gembusiness strategy/2026-11-vision/logos). `BrandLockup`, `SiteBrand`, `AuthLayout`
|
|
31
|
+
* and `GemMark` take one as `facet`, or read `--gb-gem-facet` (README "The gem's facet"). `core` is the iris the lockup
|
|
32
|
+
* always drew, and stays the default. Not the switcher's tints below: those tell services apart inside one panel.
|
|
33
|
+
*/
|
|
34
|
+
export const GEM_FACETS = {
|
|
35
|
+
core: "#5661F5", // Lõi: GemBoss
|
|
36
|
+
understand: "#38A3F1", // Hiểu: GemWatcher, GemMarket
|
|
37
|
+
build: "#9B7BFF", // Dựng: GemTheme, GemFactory, GemMedia, GemCapture
|
|
38
|
+
sell: "#16B88A", // Bán: GemOffer, GemLoop, GemReview, GemTroop, GemSeel, GemPrint
|
|
39
|
+
measure: "#2CC5C5", // Đo: GemPixel, GemX
|
|
40
|
+
retain: "#F0457E", // Giữ khách: GemCare, GemReach
|
|
41
|
+
spread: "#F5A524", // Lan toả: GemSpace (tên cũ GemNews), GemCommunity, GemPress, GemAff
|
|
42
|
+
} as const;
|
|
43
|
+
export type GemFacet = keyof typeof GEM_FACETS;
|
|
44
|
+
|
|
28
45
|
/** The hues a service mark is tinted with. Each is mixed with the theme's own surface and text in service-switcher.css,
|
|
29
46
|
* so one value reads in light and in dark. */
|
|
30
47
|
export const SERVICE_TINTS = ["iris", "blue", "teal", "green", "amber", "orange", "rose", "violet", "slate"] as const;
|
|
@@ -67,7 +84,7 @@ export const GEM_SERVICES: readonly GemService[] = [
|
|
|
67
84
|
{ id: "gempress", name: "GemPress", url: "https://press.gemboss.ai/admin", purpose: "Articles and the content store.", group: "content", icon: "article", tint: "orange" },
|
|
68
85
|
{ id: "content-radar", name: "Content Radar", url: "https://content-radar.ops.gemboss.ai", purpose: "From the topics worth writing to articles.", group: "content", icon: "radar", tint: "teal" },
|
|
69
86
|
{ id: "gemcommunity", name: "GemCommunity", url: "https://community.gemboss.ai/admin", purpose: "The seller community.", group: "content", icon: "users", tint: "blue" },
|
|
70
|
-
{ id: "gemnews", name: "
|
|
87
|
+
{ id: "gemnews", name: "GemSpace", url: "https://space.gemboss.ai/admin", purpose: "The new-tab workspace and how its news is read.", group: "content", icon: "megaphone", tint: "rose" },
|
|
71
88
|
|
|
72
89
|
{ id: "gemcare", name: "GemCare", url: "https://care.gemboss.ai/inbox", purpose: "The customer care inbox.", group: "customers", icon: "chat", tint: "green" },
|
|
73
90
|
{ id: "gemfeedback", name: "GemFeedback", url: "https://feedback.gemboss.ai/admin", purpose: "The feedback backlog.", group: "customers", icon: "inbox", tint: "violet" },
|
package/src/site.tsx
CHANGED
|
@@ -21,11 +21,11 @@ import { BrandGem } from "./brand-gem";
|
|
|
21
21
|
type AnchorProps = React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
22
22
|
const cx = (...c: (string | false | null | undefined)[]) => c.filter(Boolean).join(" ");
|
|
23
23
|
|
|
24
|
-
/** The lockup at the site size: the same gem as BrandLockup, the name at 18px. */
|
|
25
|
-
export function SiteBrand({ name, href = "/", label, className, ...rest }: { name: string; label?: string } & AnchorProps) {
|
|
24
|
+
/** The lockup at the site size: the same gem as BrandLockup, the name at 18px. `facet`: as BrandLockup's (16/11/2026). */
|
|
25
|
+
export function SiteBrand({ name, href = "/", label, className, facet, ...rest }: { name: string; label?: string; facet?: string } & AnchorProps) {
|
|
26
26
|
return (
|
|
27
27
|
<a className={cx("gb-brand gb-brand--site", className)} href={href} aria-label={label ?? `${name} home`} {...rest}>
|
|
28
|
-
<BrandGem />
|
|
28
|
+
<BrandGem facet={facet} />
|
|
29
29
|
<span className="gb-brand-name">{name}</span>
|
|
30
30
|
</a>
|
|
31
31
|
);
|