@sero-ai/ui 0.4.0 → 0.4.2
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/.turbo/turbo-build.log +628 -628
- package/.turbo/turbo-test.log +18 -0
- package/.turbo/turbo-typecheck.log +1 -1
- package/CHANGELOG.md +22 -2
- package/LICENSE +201 -0
- package/dist/components/ai-elements/agent.cjs +6 -6
- package/dist/components/ai-elements/agent.js +6 -6
- package/dist/components/ai-elements/artifact.cjs +2 -2
- package/dist/components/ai-elements/artifact.js +2 -2
- package/dist/components/ai-elements/attachments.cjs +2 -2
- package/dist/components/ai-elements/attachments.js +2 -2
- package/dist/components/ai-elements/chain-of-thought.cjs +2 -2
- package/dist/components/ai-elements/chain-of-thought.js +2 -2
- package/dist/components/ai-elements/code-block.cjs +7 -5
- package/dist/components/ai-elements/code-block.d.cts +2 -1
- package/dist/components/ai-elements/code-block.d.ts +2 -1
- package/dist/components/ai-elements/code-block.js +7 -5
- package/dist/components/ai-elements/commit.cjs +2 -2
- package/dist/components/ai-elements/commit.js +2 -2
- package/dist/components/ai-elements/confirmation.cjs +1 -1
- package/dist/components/ai-elements/confirmation.js +1 -1
- package/dist/components/ai-elements/conversation.cjs +2 -2
- package/dist/components/ai-elements/conversation.js +2 -2
- package/dist/components/ai-elements/environment-variables.cjs +3 -3
- package/dist/components/ai-elements/environment-variables.js +3 -3
- package/dist/components/ai-elements/file-tree.cjs +1 -1
- package/dist/components/ai-elements/file-tree.js +1 -1
- package/dist/components/ai-elements/inline-citation.cjs +3 -3
- package/dist/components/ai-elements/inline-citation.js +3 -3
- package/dist/components/ai-elements/jsx-preview.cjs +1 -1
- package/dist/components/ai-elements/jsx-preview.js +1 -1
- package/dist/components/ai-elements/message.cjs +1 -1
- package/dist/components/ai-elements/message.js +1 -1
- package/dist/components/ai-elements/package-info.cjs +4 -4
- package/dist/components/ai-elements/package-info.js +4 -4
- package/dist/components/ai-elements/prompt-input-context.cjs +2 -3
- package/dist/components/ai-elements/prompt-input-context.js +2 -3
- package/dist/components/ai-elements/queue.cjs +2 -2
- package/dist/components/ai-elements/queue.js +2 -2
- package/dist/components/ai-elements/reasoning.cjs +2 -2
- package/dist/components/ai-elements/reasoning.js +2 -2
- package/dist/components/ai-elements/sandbox.cjs +3 -3
- package/dist/components/ai-elements/sandbox.js +3 -3
- package/dist/components/ai-elements/schema-display.cjs +12 -12
- package/dist/components/ai-elements/schema-display.js +12 -12
- package/dist/components/ai-elements/speech-input.cjs +18 -2
- package/dist/components/ai-elements/speech-input.js +16 -0
- package/dist/components/ai-elements/stack-trace.cjs +1 -1
- package/dist/components/ai-elements/stack-trace.js +1 -1
- package/dist/components/ai-elements/task.cjs +3 -3
- package/dist/components/ai-elements/task.js +3 -3
- package/dist/components/ai-elements/terminal.cjs +2 -2
- package/dist/components/ai-elements/terminal.js +2 -2
- package/dist/components/ai-elements/test-results.cjs +4 -4
- package/dist/components/ai-elements/test-results.js +4 -4
- package/dist/components/ai-elements/tool.cjs +4 -4
- package/dist/components/ai-elements/tool.js +4 -4
- package/dist/components/ai-elements/transcription.cjs +1 -1
- package/dist/components/ai-elements/transcription.js +1 -1
- package/dist/components/ai-elements/web-preview.cjs +2 -2
- package/dist/components/ai-elements/web-preview.js +2 -2
- package/dist/components/context-editor/CapabilitySection.cjs +2 -2
- package/dist/components/context-editor/CapabilitySection.js +2 -2
- package/dist/components/context-editor/ContextEditor.cjs +2 -2
- package/dist/components/context-editor/ContextEditor.js +2 -2
- package/dist/components/context-editor/PresetBar.cjs +3 -3
- package/dist/components/context-editor/PresetBar.js +3 -3
- package/dist/components/context-editor/SystemPromptSection.cjs +4 -4
- package/dist/components/context-editor/SystemPromptSection.js +4 -4
- package/dist/components/context-editor/parts.cjs +6 -6
- package/dist/components/context-editor/parts.js +6 -6
- package/dist/components/dashboard/activity-list.cjs +2 -2
- package/dist/components/dashboard/activity-list.js +2 -2
- package/dist/components/dashboard/catalog.cjs +1 -322
- package/dist/components/dashboard/catalog.d.cts +1 -2
- package/dist/components/dashboard/catalog.d.ts +1 -2
- package/dist/components/dashboard/catalog.js +0 -322
- package/dist/components/dashboard/catalog.json +312 -0
- package/dist/components/dashboard/empty-state.cjs +1 -1
- package/dist/components/dashboard/empty-state.js +1 -1
- package/dist/components/dashboard/index.d.cts +1 -1
- package/dist/components/dashboard/index.d.ts +1 -1
- package/dist/components/dashboard/item-list.cjs +2 -2
- package/dist/components/dashboard/item-list.js +2 -2
- package/dist/components/dashboard/layout.cjs +1 -1
- package/dist/components/dashboard/layout.js +1 -1
- package/dist/components/dashboard/metric.cjs +1 -1
- package/dist/components/dashboard/metric.js +1 -1
- package/dist/components/dashboard/stale-indicator.cjs +1 -1
- package/dist/components/dashboard/stale-indicator.js +1 -1
- package/dist/components/dashboard/status.cjs +6 -2
- package/dist/components/dashboard/status.js +7 -3
- package/dist/components/dashboard/tone.cjs +9 -1
- package/dist/components/dashboard/tone.d.cts +7 -1
- package/dist/components/dashboard/tone.d.ts +7 -1
- package/dist/components/dashboard/tone.js +8 -0
- package/dist/components/dashboard/typography.cjs +4 -4
- package/dist/components/dashboard/typography.d.cts +1 -1
- package/dist/components/dashboard/typography.d.ts +1 -1
- package/dist/components/dashboard/typography.js +4 -4
- package/dist/components/model-selection/available-model-picker.cjs +6 -6
- package/dist/components/model-selection/available-model-picker.js +6 -6
- package/dist/components/model-selection/thinking-level-picker.cjs +1 -1
- package/dist/components/model-selection/thinking-level-picker.js +1 -1
- package/dist/components/model-selection/thinking-picker.cjs +70 -0
- package/dist/components/model-selection/thinking-picker.d.cts +12 -0
- package/dist/components/model-selection/thinking-picker.d.ts +12 -0
- package/dist/components/model-selection/thinking-picker.js +70 -0
- package/dist/components/ui/accordion.cjs +2 -2
- package/dist/components/ui/accordion.js +2 -2
- package/dist/components/ui/alert-dialog.cjs +4 -2
- package/dist/components/ui/alert-dialog.js +4 -2
- package/dist/components/ui/alert.cjs +2 -2
- package/dist/components/ui/alert.js +2 -2
- package/dist/components/ui/avatar.cjs +2 -2
- package/dist/components/ui/avatar.js +2 -2
- package/dist/components/ui/breadcrumb.cjs +1 -1
- package/dist/components/ui/breadcrumb.js +1 -1
- package/dist/components/ui/button-group.cjs +1 -1
- package/dist/components/ui/button-group.js +1 -1
- package/dist/components/ui/button.cjs +1 -1
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/calendar.cjs +2 -2
- package/dist/components/ui/calendar.js +2 -2
- package/dist/components/ui/card.cjs +1 -1
- package/dist/components/ui/card.js +1 -1
- package/dist/components/ui/carousel.cjs +3 -2
- package/dist/components/ui/carousel.js +2 -1
- package/dist/components/ui/chart.cjs +36 -27
- package/dist/components/ui/chart.d.cts +21 -17
- package/dist/components/ui/chart.d.ts +21 -17
- package/dist/components/ui/chart.js +30 -21
- package/dist/components/ui/combobox.cjs +7 -5
- package/dist/components/ui/combobox.js +7 -5
- package/dist/components/ui/command.cjs +3 -3
- package/dist/components/ui/command.js +3 -3
- package/dist/components/ui/context-menu.cjs +10 -7
- package/dist/components/ui/context-menu.js +10 -7
- package/dist/components/ui/dialog.cjs +4 -2
- package/dist/components/ui/dialog.js +4 -2
- package/dist/components/ui/drawer.cjs +4 -2
- package/dist/components/ui/drawer.js +4 -2
- package/dist/components/ui/dropdown-menu.cjs +10 -7
- package/dist/components/ui/dropdown-menu.js +10 -7
- package/dist/components/ui/empty.cjs +2 -2
- package/dist/components/ui/empty.js +2 -2
- package/dist/components/ui/field.cjs +5 -5
- package/dist/components/ui/field.js +5 -5
- package/dist/components/ui/form.cjs +2 -2
- package/dist/components/ui/form.js +2 -2
- package/dist/components/ui/hover-card.cjs +3 -1
- package/dist/components/ui/hover-card.js +3 -1
- package/dist/components/ui/input-group.cjs +3 -3
- package/dist/components/ui/input-group.js +3 -3
- package/dist/components/ui/input-otp.cjs +1 -1
- package/dist/components/ui/input-otp.js +1 -1
- package/dist/components/ui/input.cjs +1 -1
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/item.cjs +3 -3
- package/dist/components/ui/item.js +3 -3
- package/dist/components/ui/label.cjs +1 -1
- package/dist/components/ui/label.js +1 -1
- package/dist/components/ui/menubar.cjs +9 -7
- package/dist/components/ui/menubar.js +9 -7
- package/dist/components/ui/native-select.cjs +1 -1
- package/dist/components/ui/native-select.js +1 -1
- package/dist/components/ui/navigation-menu.cjs +2 -2
- package/dist/components/ui/navigation-menu.js +2 -2
- package/dist/components/ui/plugin-safety-disclaimer.cjs +1 -1
- package/dist/components/ui/plugin-safety-disclaimer.js +1 -1
- package/dist/components/ui/popover.cjs +4 -2
- package/dist/components/ui/popover.js +4 -2
- package/dist/components/ui/select.cjs +5 -3
- package/dist/components/ui/select.js +5 -3
- package/dist/components/ui/sheet.cjs +4 -2
- package/dist/components/ui/sheet.js +4 -2
- package/dist/components/ui/sidebar.cjs +5 -5
- package/dist/components/ui/sidebar.js +5 -5
- package/dist/components/ui/table.cjs +2 -2
- package/dist/components/ui/table.js +2 -2
- package/dist/components/ui/tabs.cjs +1 -1
- package/dist/components/ui/tabs.js +1 -1
- package/dist/components/ui/textarea.cjs +1 -1
- package/dist/components/ui/textarea.js +1 -1
- package/dist/components/ui/toggle.cjs +1 -1
- package/dist/components/ui/toggle.js +1 -1
- package/dist/components/ui/tooltip.cjs +3 -1
- package/dist/components/ui/tooltip.js +3 -1
- package/dist/index.cjs +5 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +5 -1
- package/dist/plugin-style-scope-context.cjs +10 -0
- package/dist/plugin-style-scope-context.d.cts +13 -0
- package/dist/plugin-style-scope-context.d.ts +13 -0
- package/dist/plugin-style-scope-context.js +10 -0
- package/dist/plugin-style-scope.cjs +25 -0
- package/dist/plugin-style-scope.d.cts +11 -0
- package/dist/plugin-style-scope.d.ts +11 -0
- package/dist/plugin-style-scope.js +25 -0
- package/dist/reference.cjs +1251 -3
- package/dist/reference.d.cts +11 -5
- package/dist/reference.d.ts +11 -5
- package/dist/reference.js +1224 -6
- package/dist/styles/globals.css +22 -3
- package/dist/styles/plugin-theme.css +80 -0
- package/dist/styles/plugin.css +14 -2
- package/package.json +53 -70
- package/scripts/ensure-pnpm-publish.mjs +23 -0
- package/scripts/smoke-dist.mjs +68 -0
- package/src/components/ai-elements/agent.tsx +6 -6
- package/src/components/ai-elements/artifact.tsx +2 -2
- package/src/components/ai-elements/attachments.tsx +2 -2
- package/src/components/ai-elements/chain-of-thought.tsx +2 -2
- package/src/components/ai-elements/code-block.tsx +6 -3
- package/src/components/ai-elements/commit.tsx +2 -2
- package/src/components/ai-elements/confirmation.tsx +1 -1
- package/src/components/ai-elements/conversation.tsx +2 -2
- package/src/components/ai-elements/environment-variables.tsx +3 -3
- package/src/components/ai-elements/file-tree.tsx +1 -1
- package/src/components/ai-elements/inline-citation.tsx +3 -3
- package/src/components/ai-elements/jsx-preview.tsx +1 -1
- package/src/components/ai-elements/message.tsx +1 -1
- package/src/components/ai-elements/package-info.tsx +4 -4
- package/src/components/ai-elements/prompt-input-context.tsx +3 -2
- package/src/components/ai-elements/queue.tsx +2 -2
- package/src/components/ai-elements/reasoning.tsx +2 -2
- package/src/components/ai-elements/sandbox.tsx +3 -3
- package/src/components/ai-elements/schema-display.tsx +12 -12
- package/src/components/ai-elements/speech-input.tsx +17 -0
- package/src/components/ai-elements/stack-trace.tsx +1 -1
- package/src/components/ai-elements/task.tsx +3 -3
- package/src/components/ai-elements/terminal.tsx +2 -2
- package/src/components/ai-elements/test-results.tsx +4 -4
- package/src/components/ai-elements/tool.tsx +4 -4
- package/src/components/ai-elements/transcription.tsx +1 -1
- package/src/components/ai-elements/web-preview.tsx +2 -2
- package/src/components/context-editor/CapabilitySection.tsx +2 -2
- package/src/components/context-editor/ContextEditor.tsx +2 -2
- package/src/components/context-editor/PresetBar.tsx +3 -3
- package/src/components/context-editor/SystemPromptSection.tsx +4 -4
- package/src/components/context-editor/parts.tsx +6 -6
- package/src/components/dashboard/__tests__/catalog.test.ts +7 -2
- package/src/components/dashboard/__tests__/state.test.tsx +19 -2
- package/src/components/dashboard/activity-list.tsx +2 -2
- package/src/components/dashboard/catalog.json +312 -0
- package/src/components/dashboard/catalog.ts +6 -328
- package/src/components/dashboard/empty-state.tsx +1 -1
- package/src/components/dashboard/index.ts +2 -2
- package/src/components/dashboard/item-list.tsx +2 -2
- package/src/components/dashboard/layout.tsx +1 -1
- package/src/components/dashboard/metric.tsx +1 -1
- package/src/components/dashboard/stale-indicator.tsx +1 -1
- package/src/components/dashboard/status.tsx +15 -2
- package/src/components/dashboard/tone.ts +13 -0
- package/src/components/dashboard/typography.tsx +5 -5
- package/src/components/model-selection/available-model-picker.tsx +7 -7
- package/src/components/model-selection/thinking-level-picker.tsx +1 -1
- package/src/components/model-selection/thinking-picker.tsx +90 -0
- package/src/components/ui/accordion.tsx +2 -2
- package/src/components/ui/alert-dialog.tsx +4 -2
- package/src/components/ui/alert.tsx +2 -2
- package/src/components/ui/avatar.tsx +2 -2
- package/src/components/ui/breadcrumb.tsx +1 -1
- package/src/components/ui/button-group.tsx +1 -1
- package/src/components/ui/button.tsx +1 -1
- package/src/components/ui/calendar.tsx +3 -3
- package/src/components/ui/card.tsx +1 -1
- package/src/components/ui/carousel.tsx +2 -1
- package/src/components/ui/chart.tsx +54 -36
- package/src/components/ui/combobox.tsx +7 -5
- package/src/components/ui/command.tsx +3 -3
- package/src/components/ui/context-menu.tsx +10 -7
- package/src/components/ui/dialog.tsx +4 -2
- package/src/components/ui/drawer.tsx +4 -2
- package/src/components/ui/dropdown-menu.tsx +10 -7
- package/src/components/ui/empty.tsx +2 -2
- package/src/components/ui/field.tsx +5 -5
- package/src/components/ui/form.tsx +2 -2
- package/src/components/ui/hover-card.tsx +3 -1
- package/src/components/ui/input-group.tsx +3 -3
- package/src/components/ui/input-otp.tsx +1 -1
- package/src/components/ui/input.tsx +1 -1
- package/src/components/ui/item.tsx +3 -3
- package/src/components/ui/label.tsx +1 -1
- package/src/components/ui/menubar.tsx +9 -7
- package/src/components/ui/native-select.tsx +1 -1
- package/src/components/ui/navigation-menu.tsx +2 -2
- package/src/components/ui/plugin-safety-disclaimer.tsx +1 -1
- package/src/components/ui/popover.tsx +4 -2
- package/src/components/ui/select.tsx +5 -3
- package/src/components/ui/sheet.tsx +4 -2
- package/src/components/ui/sidebar.tsx +5 -5
- package/src/components/ui/table.tsx +2 -2
- package/src/components/ui/tabs.tsx +1 -1
- package/src/components/ui/textarea.tsx +1 -1
- package/src/components/ui/toggle.tsx +1 -1
- package/src/components/ui/tooltip.tsx +3 -1
- package/src/index.ts +5 -1
- package/src/plugin-style-scope-context.ts +21 -0
- package/src/plugin-style-scope.test.tsx +38 -0
- package/src/plugin-style-scope.tsx +35 -0
- package/src/styles/globals.css +22 -3
- package/src/styles/plugin-theme.css +80 -0
- package/src/styles/plugin.css +14 -2
- package/tsup.config.ts +13 -3
- package/tsup.reference.config.ts +15 -0
- package/dist/components/reference/ActivityExample.cjs +0 -47
- package/dist/components/reference/ActivityExample.d.cts +0 -5
- package/dist/components/reference/ActivityExample.d.ts +0 -5
- package/dist/components/reference/ActivityExample.js +0 -47
- package/dist/components/reference/ResourceExample.cjs +0 -54
- package/dist/components/reference/ResourceExample.d.cts +0 -5
- package/dist/components/reference/ResourceExample.d.ts +0 -5
- package/dist/components/reference/ResourceExample.js +0 -54
- package/dist/components/reference/SchedulerExample.cjs +0 -68
- package/dist/components/reference/SchedulerExample.d.cts +0 -5
- package/dist/components/reference/SchedulerExample.d.ts +0 -5
- package/dist/components/reference/SchedulerExample.js +0 -68
- package/dist/components/reference/StarterExample.cjs +0 -34
- package/dist/components/reference/StarterExample.d.cts +0 -5
- package/dist/components/reference/StarterExample.d.ts +0 -5
- package/dist/components/reference/StarterExample.js +0 -34
- package/dist/components/reference/index.cjs +0 -10
- package/dist/components/reference/index.d.cts +0 -5
- package/dist/components/reference/index.d.ts +0 -5
- package/dist/components/reference/index.js +0 -10
- package/dist/dashboard-catalog.cjs +0 -8
- package/dist/dashboard-catalog.d.cts +0 -1
- package/dist/dashboard-catalog.d.ts +0 -1
- package/dist/dashboard-catalog.js +0 -8
- package/src/dashboard-catalog.ts +0 -13
|
@@ -4,6 +4,7 @@ import * as React from "react"
|
|
|
4
4
|
import { Tooltip as TooltipPrimitive } from "radix-ui"
|
|
5
5
|
|
|
6
6
|
import { cn } from "../../lib/utils"
|
|
7
|
+
import { usePluginPortalContainer } from "../../plugin-style-scope-context"
|
|
7
8
|
|
|
8
9
|
function TooltipProvider({
|
|
9
10
|
delayDuration = 0,
|
|
@@ -36,8 +37,9 @@ function TooltipContent({
|
|
|
36
37
|
children,
|
|
37
38
|
...props
|
|
38
39
|
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
|
40
|
+
const container = usePluginPortalContainer()
|
|
39
41
|
return (
|
|
40
|
-
<TooltipPrimitive.Portal>
|
|
42
|
+
<TooltipPrimitive.Portal container={container}>
|
|
41
43
|
<TooltipPrimitive.Content
|
|
42
44
|
data-slot="tooltip-content"
|
|
43
45
|
sideOffset={sideOffset}
|
package/src/index.ts
CHANGED
|
@@ -133,10 +133,14 @@ export * from "./components/ai-elements/web-preview";
|
|
|
133
133
|
|
|
134
134
|
// ── Dashboard Components ──
|
|
135
135
|
// Compact presentation components for dashboard widgets and full plugin views.
|
|
136
|
-
// The discovery catalogue is
|
|
136
|
+
// The discovery catalogue is plain data at "@sero-ai/ui/dashboard-catalog.json";
|
|
137
|
+
// its entry type is re-exported here for callers that type the parsed JSON.
|
|
137
138
|
export * from "./components/dashboard";
|
|
139
|
+
export type { DashboardComponentCatalogEntry } from "./components/dashboard/catalog";
|
|
138
140
|
|
|
139
141
|
// ── Model Selection Components ──
|
|
140
142
|
export * from "./components/model-selection/available-model-picker";
|
|
141
143
|
export * from "./components/model-selection/model-warning-list";
|
|
142
144
|
export * from "./components/model-selection/thinking-level-picker";
|
|
145
|
+
export { PluginStyleScope, type PluginStyleScopeProps } from './plugin-style-scope';
|
|
146
|
+
export { usePluginPortalContainer } from './plugin-style-scope-context';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createContext, useContext, type Context } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface PluginStyleScopeValue {
|
|
4
|
+
pluginId: string;
|
|
5
|
+
portalContainer: HTMLDivElement | null;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
declare global {
|
|
9
|
+
var __sero_plugin_style_scope_context__: Context<PluginStyleScopeValue | null> | undefined;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// A single shared context instance across every federated copy of @sero-ai/ui,
|
|
13
|
+
// so a plugin's portal primitives read the container the host provider set.
|
|
14
|
+
export const PluginStyleScopeContext = globalThis.__sero_plugin_style_scope_context__
|
|
15
|
+
?? createContext<PluginStyleScopeValue | null>(null);
|
|
16
|
+
|
|
17
|
+
globalThis.__sero_plugin_style_scope_context__ = PluginStyleScopeContext;
|
|
18
|
+
|
|
19
|
+
export function usePluginPortalContainer(): HTMLElement | undefined {
|
|
20
|
+
return useContext(PluginStyleScopeContext)?.portalContainer ?? undefined;
|
|
21
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { act } from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
|
+
import { afterEach, describe, expect, it } from 'vitest';
|
|
4
|
+
import { PluginStyleScope } from './plugin-style-scope';
|
|
5
|
+
import { usePluginPortalContainer } from './plugin-style-scope-context';
|
|
6
|
+
|
|
7
|
+
(globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT: boolean })
|
|
8
|
+
.IS_REACT_ACT_ENVIRONMENT = true;
|
|
9
|
+
|
|
10
|
+
afterEach(() => {
|
|
11
|
+
document.body.replaceChildren();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
describe('PluginStyleScope', () => {
|
|
15
|
+
it('owns and removes an independent body portal container', () => {
|
|
16
|
+
const mount = document.createElement('div');
|
|
17
|
+
document.body.append(mount);
|
|
18
|
+
const root = createRoot(mount);
|
|
19
|
+
|
|
20
|
+
function Probe() {
|
|
21
|
+
const container = usePluginPortalContainer();
|
|
22
|
+
return <span data-container={container?.dataset.seroPluginPortals} />;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
act(() => root.render(
|
|
26
|
+
<PluginStyleScope pluginId="admin" surfaceId="surface-1">
|
|
27
|
+
<Probe />
|
|
28
|
+
</PluginStyleScope>,
|
|
29
|
+
));
|
|
30
|
+
|
|
31
|
+
const portal = document.body.querySelector('[data-sero-plugin-portals="surface-1"]');
|
|
32
|
+
expect(portal?.getAttribute('data-sero-plugin')).toBe('admin');
|
|
33
|
+
expect(mount.querySelector('span')?.getAttribute('data-container')).toBe('surface-1');
|
|
34
|
+
|
|
35
|
+
act(() => root.unmount());
|
|
36
|
+
expect(portal?.isConnected).toBe(false);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useInsertionEffect, useMemo, type ReactNode } from 'react';
|
|
2
|
+
import { PluginStyleScopeContext } from './plugin-style-scope-context';
|
|
3
|
+
|
|
4
|
+
export interface PluginStyleScopeProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
pluginId: string;
|
|
7
|
+
surfaceId: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function PluginStyleScope({ children, pluginId, surfaceId }: PluginStyleScopeProps) {
|
|
11
|
+
const portalContainer = useMemo(() => {
|
|
12
|
+
if (typeof document === 'undefined') return null;
|
|
13
|
+
const container = document.createElement('div');
|
|
14
|
+
container.dataset.seroPlugin = pluginId;
|
|
15
|
+
container.dataset.seroPluginPortals = surfaceId;
|
|
16
|
+
return container;
|
|
17
|
+
}, [pluginId, surfaceId]);
|
|
18
|
+
|
|
19
|
+
useInsertionEffect(() => {
|
|
20
|
+
if (!portalContainer) return undefined;
|
|
21
|
+
document.body.append(portalContainer);
|
|
22
|
+
return () => portalContainer.remove();
|
|
23
|
+
}, [portalContainer]);
|
|
24
|
+
|
|
25
|
+
const value = useMemo(
|
|
26
|
+
() => ({ pluginId, portalContainer }),
|
|
27
|
+
[pluginId, portalContainer],
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<PluginStyleScopeContext.Provider value={value}>
|
|
32
|
+
{children}
|
|
33
|
+
</PluginStyleScopeContext.Provider>
|
|
34
|
+
);
|
|
35
|
+
}
|
package/src/styles/globals.css
CHANGED
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
/* Typography (themeable) */
|
|
117
117
|
--font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
118
118
|
--font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', Menlo, monospace;
|
|
119
|
-
--font-size-base:
|
|
119
|
+
--font-size-base: 13px;
|
|
120
120
|
|
|
121
121
|
/* Spacing */
|
|
122
122
|
--space-xs: 4px;
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
|
|
133
133
|
/* Sero font sizes (legacy — use Tailwind text-* for new components) */
|
|
134
134
|
--sero-text-xs: 12px;
|
|
135
|
-
--sero-text-
|
|
135
|
+
--sero-text-base: 13px;
|
|
136
136
|
--sero-text-base: 14px;
|
|
137
137
|
--sero-text-lg: 15px;
|
|
138
138
|
--sero-text-xl: 16px;
|
|
@@ -236,6 +236,14 @@
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
@theme inline {
|
|
239
|
+
--text-xs: 0.8rem;
|
|
240
|
+
--text-xs--line-height: 1rem;
|
|
241
|
+
|
|
242
|
+
--text-sm: 0.9rem;
|
|
243
|
+
--text-sm--line-height: 1.2rem;
|
|
244
|
+
|
|
245
|
+
--text-base--line-height: 1.4rem;
|
|
246
|
+
|
|
239
247
|
--radius-sm: calc(var(--radius) - 4px);
|
|
240
248
|
--radius-md: calc(var(--radius) - 2px);
|
|
241
249
|
--radius-lg: var(--radius);
|
|
@@ -483,7 +491,7 @@
|
|
|
483
491
|
}
|
|
484
492
|
|
|
485
493
|
html {
|
|
486
|
-
font-size: var(--font-size-base,
|
|
494
|
+
font-size: var(--font-size-base, 13px);
|
|
487
495
|
font-family: var(--font-sans);
|
|
488
496
|
}
|
|
489
497
|
|
|
@@ -495,3 +503,14 @@ html {
|
|
|
495
503
|
@apply bg-background text-foreground;
|
|
496
504
|
}
|
|
497
505
|
}
|
|
506
|
+
|
|
507
|
+
@media (prefers-reduced-motion: reduce) {
|
|
508
|
+
*,
|
|
509
|
+
*::before,
|
|
510
|
+
*::after {
|
|
511
|
+
animation-duration: 0.01ms !important;
|
|
512
|
+
animation-iteration-count: 1 !important;
|
|
513
|
+
scroll-behavior: auto !important;
|
|
514
|
+
transition-duration: 0.01ms !important;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
@theme inline {
|
|
2
|
+
--text-xs: 0.8rem;
|
|
3
|
+
--text-xs--line-height: 1rem;
|
|
4
|
+
|
|
5
|
+
--text-sm: 0.9rem;
|
|
6
|
+
--text-sm--line-height: 1.2rem;
|
|
7
|
+
|
|
8
|
+
--text-base--line-height: 1.4rem;
|
|
9
|
+
|
|
10
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
11
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
12
|
+
--radius-lg: var(--radius);
|
|
13
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
14
|
+
--radius-2xl: calc(var(--radius) + 8px);
|
|
15
|
+
--radius-3xl: calc(var(--radius) + 12px);
|
|
16
|
+
--radius-4xl: calc(var(--radius) + 16px);
|
|
17
|
+
--color-background: var(--background);
|
|
18
|
+
--color-foreground: var(--foreground);
|
|
19
|
+
--color-brand-primary: var(--brand-primary);
|
|
20
|
+
--color-brand-primary-foreground: var(--brand-primary-foreground);
|
|
21
|
+
--color-brand-primary-muted: var(--brand-primary-muted);
|
|
22
|
+
--color-brand-primary-subtle: var(--brand-primary-subtle);
|
|
23
|
+
--color-brand-primary-faint: var(--brand-primary-faint);
|
|
24
|
+
--color-brand-primary-border: var(--brand-primary-border);
|
|
25
|
+
--color-brand-secondary: var(--brand-secondary);
|
|
26
|
+
--color-brand-secondary-foreground: var(--brand-secondary-foreground);
|
|
27
|
+
--color-brand-secondary-muted: var(--brand-secondary-muted);
|
|
28
|
+
--color-brand-secondary-subtle: var(--brand-secondary-subtle);
|
|
29
|
+
--color-brand-secondary-faint: var(--brand-secondary-faint);
|
|
30
|
+
--color-brand-secondary-border: var(--brand-secondary-border);
|
|
31
|
+
--color-status-success: var(--status-success);
|
|
32
|
+
--color-status-success-muted: var(--status-success-muted);
|
|
33
|
+
--color-status-success-subtle: var(--status-success-subtle);
|
|
34
|
+
--color-status-success-faint: var(--status-success-faint);
|
|
35
|
+
--color-status-success-border: var(--status-success-border);
|
|
36
|
+
--color-status-warning: var(--status-warning);
|
|
37
|
+
--color-status-warning-muted: var(--status-warning-muted);
|
|
38
|
+
--color-status-warning-subtle: var(--status-warning-subtle);
|
|
39
|
+
--color-status-warning-faint: var(--status-warning-faint);
|
|
40
|
+
--color-status-warning-border: var(--status-warning-border);
|
|
41
|
+
--color-status-error: var(--status-error);
|
|
42
|
+
--color-status-error-muted: var(--status-error-muted);
|
|
43
|
+
--color-status-error-subtle: var(--status-error-subtle);
|
|
44
|
+
--color-status-error-faint: var(--status-error-faint);
|
|
45
|
+
--color-status-error-border: var(--status-error-border);
|
|
46
|
+
--color-status-info: var(--status-info);
|
|
47
|
+
--color-status-info-muted: var(--status-info-muted);
|
|
48
|
+
--color-status-info-subtle: var(--status-info-subtle);
|
|
49
|
+
--color-status-info-faint: var(--status-info-faint);
|
|
50
|
+
--color-status-info-border: var(--status-info-border);
|
|
51
|
+
--color-card: var(--card);
|
|
52
|
+
--color-card-foreground: var(--card-foreground);
|
|
53
|
+
--color-popover: var(--popover);
|
|
54
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
55
|
+
--color-primary: var(--primary);
|
|
56
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
57
|
+
--color-secondary: var(--secondary);
|
|
58
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
59
|
+
--color-muted: var(--muted);
|
|
60
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
61
|
+
--color-accent: var(--accent);
|
|
62
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
63
|
+
--color-destructive: var(--destructive);
|
|
64
|
+
--color-border: var(--border);
|
|
65
|
+
--color-input: var(--input);
|
|
66
|
+
--color-ring: var(--ring);
|
|
67
|
+
--color-chart-1: var(--chart-1);
|
|
68
|
+
--color-chart-2: var(--chart-2);
|
|
69
|
+
--color-chart-3: var(--chart-3);
|
|
70
|
+
--color-chart-4: var(--chart-4);
|
|
71
|
+
--color-chart-5: var(--chart-5);
|
|
72
|
+
--color-sidebar: var(--sidebar);
|
|
73
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
74
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
75
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
76
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
77
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
78
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
79
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
80
|
+
}
|
package/src/styles/plugin.css
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
@import "
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
@import "tw-animate-css";
|
|
3
|
+
@import "shadcn/tailwind.css";
|
|
4
|
+
@import "./plugin-theme.css";
|
|
5
|
+
|
|
6
|
+
@source "../components";
|
|
7
|
+
|
|
8
|
+
@custom-variant dark (&:is(.dark *));
|
|
2
9
|
|
|
3
10
|
/* Federated Sero plugins should import this file, then add plugin-local
|
|
4
|
-
@source directives.
|
|
11
|
+
@source directives. The seroPluginCssScope Vite helper rewrites this file's
|
|
12
|
+
document-level selectors (:root/:host theme blocks, html/body preflight) to
|
|
13
|
+
:scope, so a plugin's default Tailwind theme and resets are self-contained on
|
|
14
|
+
its own scope root. Sero design tokens (--background, --brand-*, …) are still
|
|
15
|
+
owned by the host: plugin-theme.css references them via @theme inline, so
|
|
16
|
+
they inherit from the host document root. */
|
package/tsup.config.ts
CHANGED
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
import { defineConfig } from "tsup";
|
|
2
2
|
import { cpSync } from "node:fs";
|
|
3
3
|
|
|
4
|
+
// Mirror the source tree 1:1 (bundle: false) so deep imports keep working.
|
|
5
|
+
// The reference entry is bundled separately in tsup.reference.config.ts, which
|
|
6
|
+
// the build script runs *after* this pass (this one cleans; that one does not).
|
|
4
7
|
export default defineConfig({
|
|
5
|
-
// Tells tsup to grab everything in your src directory, except tests.
|
|
6
8
|
entry: [
|
|
7
9
|
"src/**/*.{ts,tsx}",
|
|
8
10
|
"!src/**/*.test.{ts,tsx}",
|
|
9
11
|
"!src/**/__tests__/**",
|
|
12
|
+
"!src/reference.ts",
|
|
13
|
+
"!src/components/reference/**",
|
|
10
14
|
],
|
|
11
15
|
format: ["esm", "cjs"],
|
|
12
16
|
dts: true,
|
|
13
17
|
clean: true,
|
|
14
18
|
splitting: true,
|
|
15
|
-
|
|
16
|
-
// This is the golden key: it stops esbuild from merging everything
|
|
19
|
+
|
|
20
|
+
// This is the golden key: it stops esbuild from merging everything
|
|
17
21
|
// into index.js and forces it to mirror your exact folder structure.
|
|
18
22
|
bundle: false,
|
|
19
23
|
onSuccess: () => {
|
|
20
24
|
cpSync("src/styles", "dist/styles", { recursive: true });
|
|
25
|
+
// The catalogue is plain data served as @sero-ai/ui/dashboard-catalog.json;
|
|
26
|
+
// the mirror pass only emits .ts/.tsx, so copy the JSON across by hand.
|
|
27
|
+
cpSync(
|
|
28
|
+
"src/components/dashboard/catalog.json",
|
|
29
|
+
"dist/components/dashboard/catalog.json",
|
|
30
|
+
);
|
|
21
31
|
},
|
|
22
32
|
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineConfig } from "tsup";
|
|
2
|
+
|
|
3
|
+
// Reference examples are a public entrypoint, so bundle them into a single
|
|
4
|
+
// self-contained file that resolves under Node ESM (the rest of the package is
|
|
5
|
+
// bundler-resolved). Runtime deps stay external; only local component code is
|
|
6
|
+
// inlined. Runs after the mirror pass (tsup.config.ts) with `clean: false`, so
|
|
7
|
+
// it adds dist/reference.* without wiping the mirrored output.
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
entry: ["src/reference.ts"],
|
|
10
|
+
format: ["esm", "cjs"],
|
|
11
|
+
dts: true,
|
|
12
|
+
clean: false,
|
|
13
|
+
splitting: false,
|
|
14
|
+
bundle: true,
|
|
15
|
+
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _jsxruntime = require('react/jsx-runtime');
|
|
2
|
-
var _lucidereact = require('lucide-react');
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _dashboard = require('../dashboard');
|
|
13
|
-
var _badge = require('../ui/badge');
|
|
14
|
-
const ITEMS = [
|
|
15
|
-
{ id: "1", title: "quarterly-report.pdf", meta: "2h", badge: "PDF" },
|
|
16
|
-
{ id: "2", title: "design-tokens.json", meta: "5h", badge: "JSON" },
|
|
17
|
-
{ id: "3", title: "release-notes.md", meta: "1d", badge: "MD" }
|
|
18
|
-
];
|
|
19
|
-
function ActivityExample() {
|
|
20
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.WidgetContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dashboard.Stack, { gap: "sm", fill: true, children: [
|
|
21
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Inline, { justify: "between", align: "center", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dashboard.Inline, { gap: "xs", align: "center", children: [
|
|
22
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Text, { variant: "label", children: "Recent files" }),
|
|
23
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _badge.Badge, { variant: "info", children: ITEMS.length })
|
|
24
|
-
] }) }),
|
|
25
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Stack, { gap: "none", scroll: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.ItemList, { children: ITEMS.map((f) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
26
|
-
_dashboard.ItemListItem,
|
|
27
|
-
{
|
|
28
|
-
leading: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.FileText, { className: "size-4 text-[var(--text-muted)]" }),
|
|
29
|
-
primary: f.title,
|
|
30
|
-
trailing: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dashboard.Inline, { gap: "xs", align: "center", children: [
|
|
31
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _badge.Badge, { variant: "secondary", children: f.badge }),
|
|
32
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: f.meta })
|
|
33
|
-
] })
|
|
34
|
-
},
|
|
35
|
-
f.id
|
|
36
|
-
)) }) }),
|
|
37
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dashboard.Inline, { justify: "between", align: "center", children: [
|
|
38
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Status, { tone: "info", variant: "pill", children: "Synced" }),
|
|
39
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.StaleIndicator, { lastUpdated: "Synced 30s ago" })
|
|
40
|
-
] })
|
|
41
|
-
] }) });
|
|
42
|
-
}
|
|
43
|
-
var ActivityExample_default = ActivityExample;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
exports.ActivityExample = ActivityExample; exports.default = ActivityExample_default;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { FileText } from "lucide-react";
|
|
3
|
-
import {
|
|
4
|
-
Inline,
|
|
5
|
-
ItemList,
|
|
6
|
-
ItemListItem,
|
|
7
|
-
Stack,
|
|
8
|
-
StaleIndicator,
|
|
9
|
-
Status,
|
|
10
|
-
Text,
|
|
11
|
-
WidgetContent
|
|
12
|
-
} from "../dashboard";
|
|
13
|
-
import { Badge } from "../ui/badge";
|
|
14
|
-
const ITEMS = [
|
|
15
|
-
{ id: "1", title: "quarterly-report.pdf", meta: "2h", badge: "PDF" },
|
|
16
|
-
{ id: "2", title: "design-tokens.json", meta: "5h", badge: "JSON" },
|
|
17
|
-
{ id: "3", title: "release-notes.md", meta: "1d", badge: "MD" }
|
|
18
|
-
];
|
|
19
|
-
function ActivityExample() {
|
|
20
|
-
return /* @__PURE__ */ jsx(WidgetContent, { children: /* @__PURE__ */ jsxs(Stack, { gap: "sm", fill: true, children: [
|
|
21
|
-
/* @__PURE__ */ jsx(Inline, { justify: "between", align: "center", children: /* @__PURE__ */ jsxs(Inline, { gap: "xs", align: "center", children: [
|
|
22
|
-
/* @__PURE__ */ jsx(Text, { variant: "label", children: "Recent files" }),
|
|
23
|
-
/* @__PURE__ */ jsx(Badge, { variant: "info", children: ITEMS.length })
|
|
24
|
-
] }) }),
|
|
25
|
-
/* @__PURE__ */ jsx(Stack, { gap: "none", scroll: true, children: /* @__PURE__ */ jsx(ItemList, { children: ITEMS.map((f) => /* @__PURE__ */ jsx(
|
|
26
|
-
ItemListItem,
|
|
27
|
-
{
|
|
28
|
-
leading: /* @__PURE__ */ jsx(FileText, { className: "size-4 text-[var(--text-muted)]" }),
|
|
29
|
-
primary: f.title,
|
|
30
|
-
trailing: /* @__PURE__ */ jsxs(Inline, { gap: "xs", align: "center", children: [
|
|
31
|
-
/* @__PURE__ */ jsx(Badge, { variant: "secondary", children: f.badge }),
|
|
32
|
-
/* @__PURE__ */ jsx("span", { children: f.meta })
|
|
33
|
-
] })
|
|
34
|
-
},
|
|
35
|
-
f.id
|
|
36
|
-
)) }) }),
|
|
37
|
-
/* @__PURE__ */ jsxs(Inline, { justify: "between", align: "center", children: [
|
|
38
|
-
/* @__PURE__ */ jsx(Status, { tone: "info", variant: "pill", children: "Synced" }),
|
|
39
|
-
/* @__PURE__ */ jsx(StaleIndicator, { lastUpdated: "Synced 30s ago" })
|
|
40
|
-
] })
|
|
41
|
-
] }) });
|
|
42
|
-
}
|
|
43
|
-
var ActivityExample_default = ActivityExample;
|
|
44
|
-
export {
|
|
45
|
-
ActivityExample,
|
|
46
|
-
ActivityExample_default as default
|
|
47
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _jsxruntime = require('react/jsx-runtime');
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var _dashboard = require('../dashboard');
|
|
17
|
-
function Ring({
|
|
18
|
-
value,
|
|
19
|
-
label,
|
|
20
|
-
tone
|
|
21
|
-
}) {
|
|
22
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dashboard.Stack, { gap: "xs", align: "center", children: [
|
|
23
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.ProgressRing, { value, label, tone }),
|
|
24
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Text, { variant: "muted", children: label })
|
|
25
|
-
] });
|
|
26
|
-
}
|
|
27
|
-
function ResourceExample() {
|
|
28
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.WidgetContent, { scroll: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dashboard.Stack, { gap: "sm", children: [
|
|
29
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Heading, { level: 2, size: "md", children: "Resources" }),
|
|
30
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dashboard.MetricGroup, { children: [
|
|
31
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Metric, { label: "CPU", value: "42%", tone: "success" }),
|
|
32
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Metric, { label: "Memory", value: "6.1 GB" }),
|
|
33
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Metric, { label: "Disk", value: "71%", tone: "warning" })
|
|
34
|
-
] }),
|
|
35
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Divider, {}),
|
|
36
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Section, { heading: "Usage", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dashboard.Grid, { columns: 3, gap: "sm", children: [
|
|
37
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Ring, { value: 42, label: "CPU", tone: "success" }),
|
|
38
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Ring, { value: 61, label: "Memory", tone: "info" }),
|
|
39
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Ring, { value: 71, label: "Disk", tone: "warning" })
|
|
40
|
-
] }) }),
|
|
41
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Divider, {}),
|
|
42
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Section, { heading: "Host", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dashboard.KeyValueList, { children: [
|
|
43
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.KeyValue, { label: "Region", value: "eu-west-1", mono: true }),
|
|
44
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.KeyValue, { label: "Instance", value: "c7g.xlarge", mono: true }),
|
|
45
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.KeyValue, { label: "Uptime", value: "14d 6h", mono: true }),
|
|
46
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.KeyValue, { label: "Status", value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Status, { tone: "success", children: "Healthy" }) })
|
|
47
|
-
] }) })
|
|
48
|
-
] }) });
|
|
49
|
-
}
|
|
50
|
-
var ResourceExample_default = ResourceExample;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
exports.ResourceExample = ResourceExample; exports.default = ResourceExample_default;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
Divider,
|
|
4
|
-
Grid,
|
|
5
|
-
Heading,
|
|
6
|
-
KeyValue,
|
|
7
|
-
KeyValueList,
|
|
8
|
-
Metric,
|
|
9
|
-
MetricGroup,
|
|
10
|
-
ProgressRing,
|
|
11
|
-
Section,
|
|
12
|
-
Stack,
|
|
13
|
-
Status,
|
|
14
|
-
Text,
|
|
15
|
-
WidgetContent
|
|
16
|
-
} from "../dashboard";
|
|
17
|
-
function Ring({
|
|
18
|
-
value,
|
|
19
|
-
label,
|
|
20
|
-
tone
|
|
21
|
-
}) {
|
|
22
|
-
return /* @__PURE__ */ jsxs(Stack, { gap: "xs", align: "center", children: [
|
|
23
|
-
/* @__PURE__ */ jsx(ProgressRing, { value, label, tone }),
|
|
24
|
-
/* @__PURE__ */ jsx(Text, { variant: "muted", children: label })
|
|
25
|
-
] });
|
|
26
|
-
}
|
|
27
|
-
function ResourceExample() {
|
|
28
|
-
return /* @__PURE__ */ jsx(WidgetContent, { scroll: true, children: /* @__PURE__ */ jsxs(Stack, { gap: "sm", children: [
|
|
29
|
-
/* @__PURE__ */ jsx(Heading, { level: 2, size: "md", children: "Resources" }),
|
|
30
|
-
/* @__PURE__ */ jsxs(MetricGroup, { children: [
|
|
31
|
-
/* @__PURE__ */ jsx(Metric, { label: "CPU", value: "42%", tone: "success" }),
|
|
32
|
-
/* @__PURE__ */ jsx(Metric, { label: "Memory", value: "6.1 GB" }),
|
|
33
|
-
/* @__PURE__ */ jsx(Metric, { label: "Disk", value: "71%", tone: "warning" })
|
|
34
|
-
] }),
|
|
35
|
-
/* @__PURE__ */ jsx(Divider, {}),
|
|
36
|
-
/* @__PURE__ */ jsx(Section, { heading: "Usage", children: /* @__PURE__ */ jsxs(Grid, { columns: 3, gap: "sm", children: [
|
|
37
|
-
/* @__PURE__ */ jsx(Ring, { value: 42, label: "CPU", tone: "success" }),
|
|
38
|
-
/* @__PURE__ */ jsx(Ring, { value: 61, label: "Memory", tone: "info" }),
|
|
39
|
-
/* @__PURE__ */ jsx(Ring, { value: 71, label: "Disk", tone: "warning" })
|
|
40
|
-
] }) }),
|
|
41
|
-
/* @__PURE__ */ jsx(Divider, {}),
|
|
42
|
-
/* @__PURE__ */ jsx(Section, { heading: "Host", children: /* @__PURE__ */ jsxs(KeyValueList, { children: [
|
|
43
|
-
/* @__PURE__ */ jsx(KeyValue, { label: "Region", value: "eu-west-1", mono: true }),
|
|
44
|
-
/* @__PURE__ */ jsx(KeyValue, { label: "Instance", value: "c7g.xlarge", mono: true }),
|
|
45
|
-
/* @__PURE__ */ jsx(KeyValue, { label: "Uptime", value: "14d 6h", mono: true }),
|
|
46
|
-
/* @__PURE__ */ jsx(KeyValue, { label: "Status", value: /* @__PURE__ */ jsx(Status, { tone: "success", children: "Healthy" }) })
|
|
47
|
-
] }) })
|
|
48
|
-
] }) });
|
|
49
|
-
}
|
|
50
|
-
var ResourceExample_default = ResourceExample;
|
|
51
|
-
export {
|
|
52
|
-
ResourceExample,
|
|
53
|
-
ResourceExample_default as default
|
|
54
|
-
};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _jsxruntime = require('react/jsx-runtime');
|
|
2
|
-
var _lucidereact = require('lucide-react');
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var _dashboard = require('../dashboard');
|
|
18
|
-
var _button = require('../ui/button');
|
|
19
|
-
const UPCOMING = [
|
|
20
|
-
{ id: "a", label: "Daily backup", timestamp: "08:00", tone: "success" },
|
|
21
|
-
{ id: "b", label: "Publish report", timestamp: "in 2h", tone: "info" },
|
|
22
|
-
{ id: "c", label: "Rotate API keys", timestamp: "tomorrow", tone: "warning" }
|
|
23
|
-
];
|
|
24
|
-
function SchedulerExample() {
|
|
25
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.WidgetContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dashboard.Stack, { gap: "sm", children: [
|
|
26
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dashboard.Inline, { justify: "between", align: "center", children: [
|
|
27
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Status, { tone: "success", pulse: true, children: "Scheduler active" }),
|
|
28
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.ProgressRing, { value: 92, label: "Success rate", tone: "success", size: 40 })
|
|
29
|
-
] }),
|
|
30
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Section, { heading: "Summary", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dashboard.Inline, { gap: "sm", wrap: true, children: [
|
|
31
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.MetricCard, { className: "flex-1", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Metric, { label: "Jobs", value: 6 }) }),
|
|
32
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.MetricCard, { className: "flex-1", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
33
|
-
_dashboard.Metric,
|
|
34
|
-
{
|
|
35
|
-
label: "Runs today",
|
|
36
|
-
value: 18,
|
|
37
|
-
trend: { direction: "up", value: "+4", tone: "success" }
|
|
38
|
-
}
|
|
39
|
-
) })
|
|
40
|
-
] }) }),
|
|
41
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Divider, {}),
|
|
42
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
43
|
-
_dashboard.Section,
|
|
44
|
-
{
|
|
45
|
-
heading: "Next up",
|
|
46
|
-
action: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _button.Button, { size: "xs", variant: "ghost", children: [
|
|
47
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "size-3" }),
|
|
48
|
-
"All"
|
|
49
|
-
] }),
|
|
50
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.DataBoundary, { state: "ready", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.ActivityList, { children: UPCOMING.map((e) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
51
|
-
_dashboard.ActivityListItem,
|
|
52
|
-
{
|
|
53
|
-
tone: e.tone,
|
|
54
|
-
label: e.label,
|
|
55
|
-
timestamp: e.timestamp
|
|
56
|
-
},
|
|
57
|
-
e.id
|
|
58
|
-
)) }) })
|
|
59
|
-
}
|
|
60
|
-
),
|
|
61
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.StaleIndicator, { lastUpdated: "Updated 2m ago" })
|
|
62
|
-
] }) });
|
|
63
|
-
}
|
|
64
|
-
var SchedulerExample_default = SchedulerExample;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
exports.SchedulerExample = SchedulerExample; exports.default = SchedulerExample_default;
|