{"modulePath":"github.com/dracory/nodeadmin","version":"v0.4.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package shared\n\n## Constants\n\n```go\nconst (\n\tKeyEndpoint     = \"endpoint\"\n\tKeyAdminHomeURL = \"admin_home_url\"\n\tKeyNodeAdminURL = \"node_admin_url\"\n)\n```\ncontext keys used on the admin UI surface\n\n```go\nconst (\n\tCONTROLLER_HOME      = \"home\"\n\tCONTROLLER_WORKFLOWS = \"workflows\"\n\tCONTROLLER_NODES     = \"nodes\"\n\tCONTROLLER_MESSAGES  = \"messages\"\n\tCONTROLLER_EDITOR    = \"editor\"\n\tCONTROLLER_SETTINGS  = \"settings\"\n)\n```\n?controller= dispatch names\n\n```go\nconst SkinCSS = `:root {\n\t--na-accent: #e0452a;\n\t--na-accent-soft: rgba(224, 69, 42, .12);\n\t--na-ok: #2ea043;\n\t--na-warn: #d4a017;\n\t--na-run: #1f7aec;\n}\n[data-bs-theme=\"dark\"] {\n\t--na-accent-soft: rgba(224, 69, 42, .18);\n}\n.na-mono, .stat-number, code, .node-chip, .trace-id {\n\tfont-family: \"IBM Plex Mono\", ui-monospace, monospace;\n}\n/* top bar */\n.na-topbar { border-bottom: 1px solid var(--bs-border-color); }\n.na-brand {\n\tfont-family: \"IBM Plex Mono\", monospace;\n\tfont-weight: 600;\n\tletter-spacing: .5px;\n\ttext-decoration: none;\n}\n.na-brand .flow-dot {\n\tdisplay: inline-block;\n\twidth: .55em; height: .55em;\n\tborder-radius: 50%;\n\tbackground: var(--na-accent);\n\tmargin-right: .35em;\n\tbox-shadow: 0 0 8px var(--na-accent);\n}\n/* quick nav pill strip */\n.na-quicknav {\n\tfont-family: \"IBM Plex Mono\", monospace;\n\tfont-size: .8rem;\n\tborder: 1px solid var(--bs-border-color);\n\tborder-radius: .5rem;\n\tbackground: var(--bs-tertiary-bg);\n}\n.na-quicknav .nav-link {\n\tcolor: var(--bs-secondary-color);\n\tborder-radius: .375rem;\n\tpadding: .35rem .8rem;\n}\n.na-quicknav .nav-link.active {\n\tbackground: var(--na-accent);\n\tcolor: #fff;\n}\n.na-quicknav .nav-link.active .badge { background: rgba(255,255,255,.25); color: #fff; }\n.na-quicknav .qn-label {\n\tcolor: var(--na-accent);\n\tfont-weight: 600;\n\tpadding: .35rem .6rem;\n\tborder-right: 1px solid var(--bs-border-color);\n\tmargin-right: .5rem;\n}\n/* stat cards */\n.stat-card {\n\tborder: 1px solid var(--bs-border-color);\n\tborder-left: 3px solid var(--na-accent);\n\tborder-radius: .5rem;\n\tbackground: var(--bs-body-bg);\n\ttransition: transform .15s ease, box-shadow .15s ease;\n}\n.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,.18); }\n.stat-card.ok   { border-left-color: var(--na-ok); }\n.stat-card.run  { border-left-color: var(--na-run); }\n.stat-card.warn { border-left-color: var(--na-warn); }\n.stat-number { font-size: 2rem; font-weight: 600; line-height: 1.1; }\n/* status pills */\n.pill {\n\tfont-family: \"IBM Plex Mono\", monospace;\n\tfont-size: .7rem;\n\tpadding: .15em .55em;\n\tborder-radius: 999px;\n\ttext-transform: uppercase;\n\tletter-spacing: .04em;\n}\n.pill-deployed { background: rgba(46,160,67,.15); color: var(--na-ok); }\n.pill-draft    { background: rgba(212,160,23,.15); color: var(--na-warn); }\n.pill-stopped  { background: var(--bs-secondary-bg); color: var(--bs-secondary-color); }\n.pill-running  { background: rgba(31,122,236,.15); color: var(--na-run); }\n.pill-error    { background: rgba(224,69,42,.15); color: var(--na-accent); }\n/* workflow minimap thumbnail */\n.wf-minimap {\n\twidth: 120px; height: 44px;\n\tborder: 1px solid var(--bs-border-color);\n\tborder-radius: .375rem;\n\tbackground:\n\t\tradial-gradient(circle at 1px 1px, var(--bs-border-color) 1px, transparent 0) 0 0/12px 12px,\n\t\tvar(--bs-tertiary-bg);\n\tposition: relative;\n\toverflow: hidden;\n\tflex: none;\n}\n.wf-minimap svg { position: absolute; inset: 0; width: 100%; height: 100%; }\n/* tables */\n.na-table { font-size: .875rem; }\n.na-table thead th {\n\tfont-family: \"IBM Plex Mono\", monospace;\n\tfont-size: .7rem;\n\ttext-transform: uppercase;\n\tletter-spacing: .06em;\n\tcolor: var(--bs-secondary-color);\n\tborder-bottom-width: 1px;\n}\n.na-table tbody tr:hover { background: var(--na-accent-soft); }\n/* CSS bar chart */\n.activity-chart {\n\tdisplay: flex; align-items: flex-end; gap: 3px;\n\theight: 140px; padding-top: 1rem;\n}\n.activity-chart .bar {\n\tflex: 1;\n\tbackground: linear-gradient(to top, var(--na-accent), rgba(224,69,42,.35));\n\tborder-radius: 2px 2px 0 0;\n\tmin-height: 2px;\n}\n.activity-chart .bar.dim { background: var(--bs-border-color); }\n/* activity feed */\n.feed-item { border-left: 2px solid var(--bs-border-color); padding-left: .9rem; position: relative; }\n.feed-item::before {\n\tcontent: \"\"; position: absolute; left: -5px; top: .4rem;\n\twidth: 8px; height: 8px; border-radius: 50%;\n\tbackground: var(--bs-secondary-color);\n}\n.feed-item.deploy::before { background: var(--na-ok); }\n.feed-item.error::before  { background: var(--na-accent); }\n.feed-item.store::before  { background: var(--na-run); }\n/* node chips */\n.node-chip {\n\tfont-size: .72rem;\n\tborder: 1px solid var(--bs-border-color);\n\tborder-radius: .3rem;\n\tpadding: .1em .5em;\n\tbackground: var(--bs-tertiary-bg);\n\twhite-space: nowrap;\n}\n.node-chip .dot { display:inline-block; width:.5em; height:.5em; border-radius:2px; margin-right:.35em; background: var(--na-accent); }\n/* page heading */\n.page-head h1 { font-weight: 600; letter-spacing: -.01em; }\n.page-head .crumb {\n\tfont-family: \"IBM Plex Mono\", monospace;\n\tfont-size: .75rem;\n\tcolor: var(--bs-secondary-color);\n\ttext-transform: uppercase;\n\tletter-spacing: .1em;\n}\n/* message detail */\n.msg-json {\n\tfont-family: \"IBM Plex Mono\", monospace;\n\tfont-size: .8rem;\n\tbackground: var(--bs-tertiary-bg);\n\tborder: 1px solid var(--bs-border-color);\n\tborder-radius: .5rem;\n\tpadding: .75rem 1rem;\n\toverflow-x: auto;\n}\n.msg-hop { border-left: 3px solid var(--na-run); }\n/* settings / content sections */\n.na-section {\n\tborder: 1px solid var(--bs-border-color);\n\tborder-radius: .5rem;\n}\n.na-section \u003e .head {\n\tfont-family: \"IBM Plex Mono\", monospace;\n\tfont-size: .8rem; font-weight: 600;\n\tborder-bottom: 1px solid var(--bs-border-color);\n\tpadding: .6rem 1rem;\n\tbackground: var(--bs-tertiary-bg);\n\tborder-radius: .5rem .5rem 0 0;\n}\n.form-text { font-size: .78rem; }\n/* accent action button */\n.btn-na-accent { background: var(--na-accent); color: #fff; }\n.btn-na-accent:hover, .btn-na-accent:focus { background: #c93a22; color: #fff; }\n/* subtle page enter */\n@keyframes na-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }\nmain \u003e * { animation: na-in .25s ease both; }\nmain \u003e *:nth-child(2) { animation-delay: .04s; }\nmain \u003e *:nth-child(3) { animation-delay: .08s; }`\n```\nSkinCSS is the shared admin skin: signal-red accent on the neutral Bootstrap canvas, mono \"quick nav\" pill strip, stat cards, status pills, tables, feed, settings sections and the workflow minimap. All colors resolve against Bootstrap CSS variables so light/dark (data-bs-theme) keeps working everywhere. Exported because the editor — a standalone page that bypasses the layout — injects the same skin so the shared chrome renders consistently there.\n\n## Functions\n\n```go\nfunc Layout(w http.ResponseWriter, r *http.Request, webpageTitle, webpageHtml string, options LayoutOptions) string\n```\nLayout is the default layout renderer. It builds a complete HTML page using hb.NewWebpage() with Bootstrap CDN, matching the shopadmin pattern. If a FuncLayout is provided in Options, it takes precedence over this default.\n\n```go\nfunc Navbar(r *http.Request, store nodestore.StoreInterface) hb.TagInterface\n```\nNavbar renders the application top bar: the mono brand mark with the signal-red flow dot and, on the right, the Bootlegance theme switcher dropdown — mode (light/dark/auto), theme picker and font-size controls. Section navigation lives in SectionNav (the \"NODES ›\" pill strip emitted inside each page's \\\u003cmain\u003e). The page must include bootlegance.min.js (shared.Layout emits it in the head) for the switcher controls to wire up.\n\n```go\nfunc NodeAdminURL(r *http.Request) string\n```\nNodeAdminURL returns the nodeadmin base URL injected into the request context by Handle, defaulting to /nodes.\n\n```go\nfunc SectionNav(r *http.Request, store nodestore.StoreInterface) hb.TagInterface\n```\nSectionNav renders the node admin section navigation as the mono \"NODES ›\" pill strip. The active tab is derived from the ?controller= query parameter. Workflows, Nodes and Messages tabs show record counts as badges when the store is available.\n\n```go\nfunc ShortID(id string) string\n```\nShortID renders an entity ID in the compact form used in list columns (first 12 chars — enough to disambiguate visually).\n\n```go\nfunc WorkflowMinimap(wf nodestore.WorkflowInterface) string\n```\nWorkflowMinimap renders a scaled SVG thumbnail of the workflow topology — real node positions normalized into the 120x44 viewBox with the stored edges drawn as connectors. Empty workflows render the bare dotted thumbnail.\n\n## Types\n\n```go\ntype FuncLayout func(w http.ResponseWriter, r *http.Request, webpageTitle, webpageHtml string, options LayoutOptions) string\n```\nFuncLayout renders the admin interface inside a host-provided layout (branding, menus). It receives the request and response writer so the host project can access request context when rendering. Returning \"\" falls back to the default Layout.\n\n```go\ntype LayoutOptions struct {\n\tStyles     []string\n\tStyleURLs  []string\n\tScripts    []string\n\tScriptURLs []string\n\t// Store enables the nav badges (Workflows/Messages counts) in the\n\t// top navbar; nil renders the links badge-free.\n\tStore nodestore.StoreInterface\n}\n```\nLayoutOptions are the assets a page can inject into the layout\n\n```go\ntype UiConfig struct {\n\tStore nodestore.StoreInterface\n\t// Engine is the deployed-workflow engine the settings section\n\t// inspects/tunes — carried as any so shared stays runner-agnostic;\n\t// sections type-assert (stock engine: *noderunner.WorkflowEngine).\n\tEngine any\n\tLayout func(w http.ResponseWriter, r *http.Request, webpageTitle, webpageHtml string, options LayoutOptions) string\n}\n```\nUiConfig holds the dependencies passed to section UI factories — the shopadmin/taskadmin pattern, with nodestore as the store\n\n","path":"github.com/dracory/nodeadmin/shared","name":"shared","synopsis":"","isRedistributable":true}
