@sirenodeck/sirenodeck 0.1.1-alpha.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/LICENSE +21 -0
- package/README.md +69 -0
- package/bin/_wrapper-shared.js +42 -0
- package/bin/dev.js +95 -0
- package/bin/sirenodeck.js +42 -0
- package/config/default-config.yml +117 -0
- package/config/starter-config.yml +54 -0
- package/dist/main.mjs +64702 -0
- package/package.json +140 -0
- package/src/action/executor.ts +156 -0
- package/src/action/index.ts +7 -0
- package/src/addon/api-types.ts +15 -0
- package/src/addon/api.ts +461 -0
- package/src/addon/check-runner.ts +84 -0
- package/src/addon/index.ts +5 -0
- package/src/addon/loader.ts +441 -0
- package/src/addon/registry.ts +230 -0
- package/src/addon/spec.ts +69 -0
- package/src/api/addon.ts +33 -0
- package/src/api/asset-url.ts +24 -0
- package/src/api/index.ts +50 -0
- package/src/api/protocol-internal.ts +656 -0
- package/src/api/protocol.ts +2 -0
- package/src/api/react/index.ts +11 -0
- package/src/api/react/registry.ts +91 -0
- package/src/api/react/use-addon-channel.ts +26 -0
- package/src/api/react/use-button-state.tsx +23 -0
- package/src/api/react/use-deck.ts +24 -0
- package/src/assets/logo.png +0 -0
- package/src/assets/logo72x72.png +0 -0
- package/src/assets/logoFull.png +0 -0
- package/src/builtin-addons/brightness/README.md +51 -0
- package/src/builtin-addons/brightness/buttons/brightness/backend.ts +13 -0
- package/src/builtin-addons/brightness/buttons/brightness/config.ts +10 -0
- package/src/builtin-addons/brightness/buttons/brightness/frontend.tsx +50 -0
- package/src/builtin-addons/brightness/domain/macos.ts +46 -0
- package/src/builtin-addons/brightness/index.d.ts +5 -0
- package/src/builtin-addons/brightness/index.ts +20 -0
- package/src/builtin-addons/brightness/poller.ts +27 -0
- package/src/builtin-addons/brightness/providers/darwin.ts +107 -0
- package/src/builtin-addons/brightness/providers/index.ts +81 -0
- package/src/builtin-addons/brightness/providers/linux.ts +108 -0
- package/src/builtin-addons/brightness/providers/windows.ts +77 -0
- package/src/builtin-addons/brightness/sirenodeck.json +6 -0
- package/src/builtin-addons/coding-agents/assets/claude-code.svg +1 -0
- package/src/builtin-addons/coding-agents/assets/opencode-dark-square.svg +1 -0
- package/src/builtin-addons/coding-agents/buttons/agent/backend.ts +82 -0
- package/src/builtin-addons/coding-agents/buttons/agent/config.ts +13 -0
- package/src/builtin-addons/coding-agents/buttons/agent/frontend.tsx +130 -0
- package/src/builtin-addons/coding-agents/buttons/agent/pages.tsx +150 -0
- package/src/builtin-addons/coding-agents/buttons/summary/backend.ts +48 -0
- package/src/builtin-addons/coding-agents/buttons/summary/config.ts +11 -0
- package/src/builtin-addons/coding-agents/buttons/summary/frontend.tsx +254 -0
- package/src/builtin-addons/coding-agents/decks/agents.ts +69 -0
- package/src/builtin-addons/coding-agents/global/backend.ts +402 -0
- package/src/builtin-addons/coding-agents/global-entry.ts +7 -0
- package/src/builtin-addons/coding-agents/hook/script.ts +123 -0
- package/src/builtin-addons/coding-agents/index.ts +15 -0
- package/src/builtin-addons/coding-agents/manifest.ts +115 -0
- package/src/builtin-addons/coding-agents/providers/claude-code.ts +470 -0
- package/src/builtin-addons/coding-agents/providers/claude-instances.ts +184 -0
- package/src/builtin-addons/coding-agents/providers/opencode-instances.ts +108 -0
- package/src/builtin-addons/coding-agents/providers/opencode.ts +636 -0
- package/src/builtin-addons/coding-agents/providers/registry.ts +120 -0
- package/src/builtin-addons/coding-agents/providers/spawn.ts +112 -0
- package/src/builtin-addons/coding-agents/shared/claude-hook-events.ts +55 -0
- package/src/builtin-addons/coding-agents/shared/claude-status.ts +236 -0
- package/src/builtin-addons/coding-agents/shared/live-count.ts +39 -0
- package/src/builtin-addons/coding-agents/shared/notifier.ts +58 -0
- package/src/builtin-addons/coding-agents/shared/opencode-status.ts +82 -0
- package/src/builtin-addons/coding-agents/shared/snapshot.ts +66 -0
- package/src/builtin-addons/coding-agents/shared/state.ts +72 -0
- package/src/builtin-addons/coding-agents/sirenodeck.json +6 -0
- package/src/builtin-addons/coding-agents/types/types.ts +33 -0
- package/src/builtin-addons/core/README.md +89 -0
- package/src/builtin-addons/core/buttons/action/backend.ts +7 -0
- package/src/builtin-addons/core/buttons/action/config.ts +13 -0
- package/src/builtin-addons/core/buttons/action/frontend.tsx +16 -0
- package/src/builtin-addons/core/buttons/change-deck/backend.ts +18 -0
- package/src/builtin-addons/core/buttons/change-deck/config.ts +15 -0
- package/src/builtin-addons/core/buttons/change-deck/frontend.tsx +18 -0
- package/src/builtin-addons/core/buttons/media-sample/backend.ts +8 -0
- package/src/builtin-addons/core/buttons/media-sample/config.ts +7 -0
- package/src/builtin-addons/core/buttons/media-sample/frontend.tsx +2 -0
- package/src/builtin-addons/core/buttons/page-nav/backend.ts +28 -0
- package/src/builtin-addons/core/buttons/page-nav/config.ts +9 -0
- package/src/builtin-addons/core/buttons/page-nav/frontend.tsx +68 -0
- package/src/builtin-addons/core/buttons/toggle/backend.ts +119 -0
- package/src/builtin-addons/core/buttons/toggle/config.ts +57 -0
- package/src/builtin-addons/core/buttons/toggle/frontend.tsx +57 -0
- package/src/builtin-addons/core/buttons/toggle/global-service.ts +174 -0
- package/src/builtin-addons/core/index.ts +120 -0
- package/src/builtin-addons/core/sirenodeck.json +6 -0
- package/src/builtin-addons/date-time/README.md +73 -0
- package/src/builtin-addons/date-time/buttons/analog-clock/backend.ts +10 -0
- package/src/builtin-addons/date-time/buttons/analog-clock/config.ts +4 -0
- package/src/builtin-addons/date-time/buttons/analog-clock/frontend.tsx +88 -0
- package/src/builtin-addons/date-time/buttons/custom/backend.ts +10 -0
- package/src/builtin-addons/date-time/buttons/custom/config.ts +9 -0
- package/src/builtin-addons/date-time/buttons/custom/frontend.tsx +26 -0
- package/src/builtin-addons/date-time/buttons/date/backend.ts +10 -0
- package/src/builtin-addons/date-time/buttons/date/config.ts +10 -0
- package/src/builtin-addons/date-time/buttons/date/frontend.tsx +42 -0
- package/src/builtin-addons/date-time/buttons/time/backend.ts +10 -0
- package/src/builtin-addons/date-time/buttons/time/config.ts +9 -0
- package/src/builtin-addons/date-time/buttons/time/frontend.tsx +29 -0
- package/src/builtin-addons/date-time/index.d.ts +5 -0
- package/src/builtin-addons/date-time/index.ts +30 -0
- package/src/builtin-addons/date-time/poller.ts +11 -0
- package/src/builtin-addons/date-time/shared/format-date.ts +36 -0
- package/src/builtin-addons/date-time/shared/format.ts +105 -0
- package/src/builtin-addons/date-time/shared/use-now.ts +10 -0
- package/src/builtin-addons/date-time/sirenodeck.json +6 -0
- package/src/builtin-addons/emoji-selector/README.md +45 -0
- package/src/builtin-addons/emoji-selector/assets/launcher.svg +10 -0
- package/src/builtin-addons/emoji-selector/assets/smileys.svg +8 -0
- package/src/builtin-addons/emoji-selector/buttons/category/backend.ts +14 -0
- package/src/builtin-addons/emoji-selector/buttons/category/config.ts +8 -0
- package/src/builtin-addons/emoji-selector/buttons/category/frontend.tsx +19 -0
- package/src/builtin-addons/emoji-selector/buttons/emoji/backend.ts +7 -0
- package/src/builtin-addons/emoji-selector/buttons/emoji/config.ts +9 -0
- package/src/builtin-addons/emoji-selector/buttons/emoji/frontend.tsx +11 -0
- package/src/builtin-addons/emoji-selector/buttons/launcher/backend.ts +13 -0
- package/src/builtin-addons/emoji-selector/buttons/launcher/config.ts +6 -0
- package/src/builtin-addons/emoji-selector/buttons/launcher/frontend.tsx +31 -0
- package/src/builtin-addons/emoji-selector/data/categories.ts +1084 -0
- package/src/builtin-addons/emoji-selector/decks/index.ts +137 -0
- package/src/builtin-addons/emoji-selector/index.d.ts +5 -0
- package/src/builtin-addons/emoji-selector/index.ts +29 -0
- package/src/builtin-addons/emoji-selector/sirenodeck.json +6 -0
- package/src/builtin-addons/emoji-selector/support.ts +49 -0
- package/src/builtin-addons/index.ts +13 -0
- package/src/builtin-addons/internal-settings/README.md +26 -0
- package/src/builtin-addons/internal-settings/backend.ts +58 -0
- package/src/builtin-addons/internal-settings/buttons/app-info/backend.ts +7 -0
- package/src/builtin-addons/internal-settings/buttons/app-info/config.ts +13 -0
- package/src/builtin-addons/internal-settings/buttons/app-info/frontend.tsx +18 -0
- package/src/builtin-addons/internal-settings/buttons/brightness/common/frontend.tsx +50 -0
- package/src/builtin-addons/internal-settings/buttons/brightness-down/backend.ts +16 -0
- package/src/builtin-addons/internal-settings/buttons/brightness-down/config.ts +6 -0
- package/src/builtin-addons/internal-settings/buttons/brightness-down/frontend.tsx +8 -0
- package/src/builtin-addons/internal-settings/buttons/brightness-up/backend.ts +16 -0
- package/src/builtin-addons/internal-settings/buttons/brightness-up/config.ts +6 -0
- package/src/builtin-addons/internal-settings/buttons/brightness-up/frontend.tsx +8 -0
- package/src/builtin-addons/internal-settings/decks/settings.ts +25 -0
- package/src/builtin-addons/internal-settings/index.d.ts +4 -0
- package/src/builtin-addons/internal-settings/index.ts +53 -0
- package/src/builtin-addons/internal-settings/logo72x72.png +0 -0
- package/src/builtin-addons/internal-settings/sirenodeck.json +6 -0
- package/src/builtin-addons/media/README.md +45 -0
- package/src/builtin-addons/media/backend.ts +143 -0
- package/src/builtin-addons/media/buttons/media-player/backend.ts +19 -0
- package/src/builtin-addons/media/buttons/media-player/components/MediaStatus.tsx +25 -0
- package/src/builtin-addons/media/buttons/media-player/components/MediaSurface.tsx +52 -0
- package/src/builtin-addons/media/buttons/media-player/components/ProgressBar.tsx +21 -0
- package/src/builtin-addons/media/buttons/media-player/components/status-meta.ts +36 -0
- package/src/builtin-addons/media/buttons/media-player/config.ts +4 -0
- package/src/builtin-addons/media/buttons/media-player/frontend.tsx +29 -0
- package/src/builtin-addons/media/buttons/volume/common/frontend.tsx +52 -0
- package/src/builtin-addons/media/buttons/volume/mute/backend.ts +13 -0
- package/src/builtin-addons/media/buttons/volume/mute/config.ts +4 -0
- package/src/builtin-addons/media/buttons/volume/mute/frontend.tsx +26 -0
- package/src/builtin-addons/media/buttons/volume/volume-down/backend.ts +14 -0
- package/src/builtin-addons/media/buttons/volume/volume-down/config.ts +6 -0
- package/src/builtin-addons/media/buttons/volume/volume-down/frontend.tsx +10 -0
- package/src/builtin-addons/media/buttons/volume/volume-up/backend.ts +14 -0
- package/src/builtin-addons/media/buttons/volume/volume-up/config.ts +6 -0
- package/src/builtin-addons/media/buttons/volume/volume-up/frontend.tsx +8 -0
- package/src/builtin-addons/media/checks.ts +104 -0
- package/src/builtin-addons/media/executor.ts +36 -0
- package/src/builtin-addons/media/index.d.ts +5 -0
- package/src/builtin-addons/media/index.ts +53 -0
- package/src/builtin-addons/media/progress.ts +16 -0
- package/src/builtin-addons/media/providers/darwin.ts +391 -0
- package/src/builtin-addons/media/providers/index.ts +27 -0
- package/src/builtin-addons/media/providers/linux.ts +196 -0
- package/src/builtin-addons/media/providers/types.ts +48 -0
- package/src/builtin-addons/media/providers/windows.ts +121 -0
- package/src/builtin-addons/media/sirenodeck.json +6 -0
- package/src/builtin-addons/media/state.ts +19 -0
- package/src/builtin-addons/register-builtins.ts +65 -0
- package/src/builtin-addons/session/README.md +14 -0
- package/src/builtin-addons/session/buttons/session-info/backend.ts +8 -0
- package/src/builtin-addons/session/buttons/session-info/config.ts +4 -0
- package/src/builtin-addons/session/buttons/session-info/frontend.tsx +2 -0
- package/src/builtin-addons/session/buttons/time/backend.ts +7 -0
- package/src/builtin-addons/session/buttons/time/config.ts +6 -0
- package/src/builtin-addons/session/buttons/time/frontend.tsx +2 -0
- package/src/builtin-addons/session/index.d.ts +5 -0
- package/src/builtin-addons/session/index.ts +18 -0
- package/src/builtin-addons/session/sirenodeck.json +6 -0
- package/src/builtin-addons/system-status/README.md +169 -0
- package/src/builtin-addons/system-status/buttons/_shared.ts +131 -0
- package/src/builtin-addons/system-status/buttons/system-status/frontend.tsx +224 -0
- package/src/builtin-addons/system-status/buttons/system-status/schemas.ts +67 -0
- package/src/builtin-addons/system-status/domain/catalog.ts +53 -0
- package/src/builtin-addons/system-status/domain/chart-sampler.ts +58 -0
- package/src/builtin-addons/system-status/domain/display-metrics.ts +128 -0
- package/src/builtin-addons/system-status/domain/index.ts +10 -0
- package/src/builtin-addons/system-status/domain/live-metrics.ts +1021 -0
- package/src/builtin-addons/system-status/domain/metric-ids.ts +0 -0
- package/src/builtin-addons/system-status/index.ts +16 -0
- package/src/builtin-addons/system-status/manifest.ts +105 -0
- package/src/builtin-addons/system-status/shared/metrics-catalog.ts +316 -0
- package/src/builtin-addons/system-status/sirenodeck.json +6 -0
- package/src/builtin-addons/test-buildin/decks/action-buttons-test.ts +56 -0
- package/src/builtin-addons/test-buildin/index.d.ts +5 -0
- package/src/builtin-addons/test-buildin/index.ts +16 -0
- package/src/builtin-addons/value-display/README.md +59 -0
- package/src/builtin-addons/value-display/backend.ts +86 -0
- package/src/builtin-addons/value-display/buttons/value-display/backend.ts +17 -0
- package/src/builtin-addons/value-display/buttons/value-display/config.ts +36 -0
- package/src/builtin-addons/value-display/buttons/value-display/frontend.tsx +54 -0
- package/src/builtin-addons/value-display/index.d.ts +5 -0
- package/src/builtin-addons/value-display/index.ts +23 -0
- package/src/builtin-addons/value-display/sirenodeck.json +6 -0
- package/src/builtin-addons/weather/README.md +46 -0
- package/src/builtin-addons/weather/backend.ts +121 -0
- package/src/builtin-addons/weather/buttons/weather/backend.ts +27 -0
- package/src/builtin-addons/weather/buttons/weather/config.ts +29 -0
- package/src/builtin-addons/weather/buttons/weather/frontend.tsx +63 -0
- package/src/builtin-addons/weather/buttons/weather/icons.tsx +88 -0
- package/src/builtin-addons/weather/buttons/weather/pages.tsx +109 -0
- package/src/builtin-addons/weather/domain/codes.ts +35 -0
- package/src/builtin-addons/weather/domain/fetch.ts +47 -0
- package/src/builtin-addons/weather/index.d.ts +5 -0
- package/src/builtin-addons/weather/index.ts +23 -0
- package/src/builtin-addons/weather/poller.ts +70 -0
- package/src/builtin-addons/weather/provider/city-key.ts +9 -0
- package/src/builtin-addons/weather/provider/codes.ts +35 -0
- package/src/builtin-addons/weather/provider/fetch.ts +97 -0
- package/src/builtin-addons/weather/provider/geocode.ts +67 -0
- package/src/builtin-addons/weather/provider/types.ts +42 -0
- package/src/builtin-addons/weather/sirenodeck.json +6 -0
- package/src/cli/coding-agents-onboarding.ts +434 -0
- package/src/cli/commands/addon-decks.ts +441 -0
- package/src/cli/commands/addon-registry.ts +639 -0
- package/src/cli/commands/emulator-mode.ts +289 -0
- package/src/cli/commands/install.ts +128 -0
- package/src/cli/commands/logs.ts +74 -0
- package/src/cli/commands/network-bind.ts +111 -0
- package/src/cli/commands/pipeline/helpers.ts +75 -0
- package/src/cli/commands/pipeline/preflight.ts +20 -0
- package/src/cli/commands/port-identity.ts +152 -0
- package/src/cli/commands/reload.ts +37 -0
- package/src/cli/commands/restart.ts +139 -0
- package/src/cli/commands/run.ts +2270 -0
- package/src/cli/commands/service/install.ts +121 -0
- package/src/cli/commands/service/render-template.ts +158 -0
- package/src/cli/commands/service-manager.ts +184 -0
- package/src/cli/commands/spawn-daemon.ts +251 -0
- package/src/cli/commands/start.ts +1061 -0
- package/src/cli/commands/status.ts +110 -0
- package/src/cli/commands/stop.ts +121 -0
- package/src/cli/commands/subprocess-supervisor.ts +203 -0
- package/src/cli/commands/system-requirements.ts +699 -0
- package/src/cli/cwd.ts +28 -0
- package/src/cli/first-run.ts +149 -0
- package/src/cli/http-server.ts +244 -0
- package/src/cli/index.ts +355 -0
- package/src/cli/install-root.ts +26 -0
- package/src/cli/main.ts +194 -0
- package/src/cli/package-manager.ts +175 -0
- package/src/cli/probe-deps.ts +45 -0
- package/src/cli/prompt.ts +22 -0
- package/src/cli/startup-display.ts +452 -0
- package/src/config/builtin-icons.ts +57 -0
- package/src/config/config-diff.ts +54 -0
- package/src/config/discovery.ts +64 -0
- package/src/config/icon-resolver.ts +90 -0
- package/src/config/include-resolver.ts +202 -0
- package/src/config/index.ts +9 -0
- package/src/config/loader.ts +187 -0
- package/src/config/mutation.ts +514 -0
- package/src/config/reference-expander.ts +84 -0
- package/src/config/schemas.ts +223 -0
- package/src/config/validation.ts +254 -0
- package/src/core/asset-id.ts +21 -0
- package/src/core/gesture-state.ts +344 -0
- package/src/core/icon-asset-registry.ts +127 -0
- package/src/core/icon-source.ts +86 -0
- package/src/core/index.ts +30 -0
- package/src/core/mime.ts +16 -0
- package/src/core/pagination.ts +90 -0
- package/src/core/pub-sub.ts +126 -0
- package/src/core/settings.ts +153 -0
- package/src/core/store.ts +88 -0
- package/src/core/watcher.ts +73 -0
- package/src/deck/addon-handler-bridge.ts +516 -0
- package/src/deck/deck-config.ts +271 -0
- package/src/deck/editor-surfaces.ts +87 -0
- package/src/deck/host-context.ts +18 -0
- package/src/deck/index.ts +102 -0
- package/src/deck/macro-parse.ts +182 -0
- package/src/deck/methods.ts +348 -0
- package/src/deck/paginate-deck.ts +98 -0
- package/src/deck/position-buttons.ts +57 -0
- package/src/deck/runtime/index.ts +5 -0
- package/src/deck/runtime/runtime.ts +1060 -0
- package/src/deck/runtime-subscriptions.ts +45 -0
- package/src/deck/system-back-injection.ts +62 -0
- package/src/deck/system-buttons/registry.tsx +97 -0
- package/src/deck/system-buttons/types.ts +14 -0
- package/src/device/black-frame.ts +73 -0
- package/src/device/index.ts +13 -0
- package/src/device/linux-udev.ts +36 -0
- package/src/device/models.ts +89 -0
- package/src/device/reconnecting.ts +193 -0
- package/src/device/registry.ts +38 -0
- package/src/device/stream-deck.ts +155 -0
- package/src/index.ts +74 -0
- package/src/outputClient/emulator.ts +357 -0
- package/src/outputClient/index.ts +26 -0
- package/src/outputClient/open-browser.ts +26 -0
- package/src/outputClient/real.ts +393 -0
- package/src/outputClient/types.ts +83 -0
- package/src/render/browser-renderer.ts +240 -0
- package/src/render/buffer-hash.ts +20 -0
- package/src/render/editor-handler.ts +197 -0
- package/src/render/emulator-server.ts +128 -0
- package/src/render/icon-source-resolver.ts +69 -0
- package/src/render/index.ts +16 -0
- package/src/render/protocol.ts +61 -0
- package/src/render/push-raw-image.ts +100 -0
- package/src/render/screenshot-cadence.ts +87 -0
- package/src/render/state-publisher.ts +110 -0
- package/src/render/vite-server.ts +138 -0
- package/src/render/ws-bridge.ts +315 -0
- package/src/system/device-selection.ts +80 -0
- package/src/system/glob-match.ts +74 -0
- package/src/system/providers/active-app/darwin.ts +117 -0
- package/src/system/providers/active-app/linux.ts +245 -0
- package/src/system/providers/active-app/wayland-gnome.ts +303 -0
- package/src/system/providers/active-app/windows.ts +94 -0
- package/src/system/providers/active-app.ts +97 -0
- package/src/system/providers/clipboard/darwin.ts +65 -0
- package/src/system/providers/clipboard/linux.ts +163 -0
- package/src/system/providers/clipboard/windows.ts +94 -0
- package/src/system/providers/clipboard.ts +84 -0
- package/src/system/providers/error.ts +16 -0
- package/src/system/providers/key-macro/darwin.ts +221 -0
- package/src/system/providers/key-macro/linux.ts +651 -0
- package/src/system/providers/key-macro/parser.ts +215 -0
- package/src/system/providers/key-macro/windows.ts +476 -0
- package/src/system/providers/key-macro.ts +79 -0
- package/src/system/providers/notification/darwin.ts +36 -0
- package/src/system/providers/notification/linux.ts +115 -0
- package/src/system/providers/notification/windows.ts +72 -0
- package/src/system/providers/notification.ts +75 -0
- package/src/system/providers/session/darwin.ts +82 -0
- package/src/system/providers/session/linux.ts +175 -0
- package/src/system/providers/session/windows.ts +73 -0
- package/src/system/providers/session.ts +89 -0
- package/src/system/providers/shared.ts +65 -0
- package/src/system/requirements.ts +235 -0
- package/src/system/setup-wizard/config-seed.ts +30 -0
- package/src/system/setup-wizard/format.ts +275 -0
- package/src/system/setup-wizard/index.ts +45 -0
- package/src/system/setup-wizard/open-settings.ts +26 -0
- package/src/system/setup-wizard/plan.ts +230 -0
- package/src/system/setup-wizard/probe-cache.ts +34 -0
- package/src/system/setup-wizard/probe.ts +486 -0
- package/src/system/setup-wizard/runtime-features.ts +85 -0
- package/src/system/setup-wizard/sudo.ts +178 -0
- package/src/system/setup-wizard/types.ts +133 -0
- package/src/system/virtual-stream-deck.ts +67 -0
- package/src/themes/css.ts +210 -0
- package/src/themes/default/assets/IBMPlexSans-Italic-VariableFont_wdth,wght.ttf +0 -0
- package/src/themes/default/assets/IBMPlexSans-VariableFont_wdth,wght.ttf +0 -0
- package/src/themes/default/assets/IBM_Plex_Mono/IBMPlexMono-Bold.ttf +0 -0
- package/src/themes/default/assets/IBM_Plex_Mono/IBMPlexMono-BoldItalic.ttf +0 -0
- package/src/themes/default/assets/IBM_Plex_Mono/IBMPlexMono-ExtraLight.ttf +0 -0
- package/src/themes/default/assets/IBM_Plex_Mono/IBMPlexMono-ExtraLightItalic.ttf +0 -0
- package/src/themes/default/assets/IBM_Plex_Mono/IBMPlexMono-Italic.ttf +0 -0
- package/src/themes/default/assets/IBM_Plex_Mono/IBMPlexMono-Light.ttf +0 -0
- package/src/themes/default/assets/IBM_Plex_Mono/IBMPlexMono-LightItalic.ttf +0 -0
- package/src/themes/default/assets/IBM_Plex_Mono/IBMPlexMono-Medium.ttf +0 -0
- package/src/themes/default/assets/IBM_Plex_Mono/IBMPlexMono-MediumItalic.ttf +0 -0
- package/src/themes/default/assets/IBM_Plex_Mono/IBMPlexMono-Regular.ttf +0 -0
- package/src/themes/default/assets/IBM_Plex_Mono/IBMPlexMono-SemiBold.ttf +0 -0
- package/src/themes/default/assets/IBM_Plex_Mono/IBMPlexMono-SemiBoldItalic.ttf +0 -0
- package/src/themes/default/assets/IBM_Plex_Mono/IBMPlexMono-Thin.ttf +0 -0
- package/src/themes/default/assets/IBM_Plex_Mono/IBMPlexMono-ThinItalic.ttf +0 -0
- package/src/themes/default/assets/IBM_Plex_Mono/OFL.txt +93 -0
- package/src/themes/default/assets/OFL.txt +93 -0
- package/src/themes/default/assets/README.txt +106 -0
- package/src/themes/default/assets/static/IBMPlexSans-Bold.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans-BoldItalic.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans-ExtraLight.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans-ExtraLightItalic.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans-Italic.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans-Light.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans-LightItalic.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans-Medium.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans-MediumItalic.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans-Regular.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans-SemiBold.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans-SemiBoldItalic.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans-Thin.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans-ThinItalic.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_Condensed-Bold.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_Condensed-BoldItalic.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_Condensed-ExtraLight.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_Condensed-ExtraLightItalic.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_Condensed-Italic.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_Condensed-Light.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_Condensed-LightItalic.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_Condensed-Medium.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_Condensed-MediumItalic.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_Condensed-Regular.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_Condensed-SemiBold.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_Condensed-SemiBoldItalic.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_Condensed-Thin.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_Condensed-ThinItalic.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_SemiCondensed-Bold.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_SemiCondensed-BoldItalic.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_SemiCondensed-ExtraLight.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_SemiCondensed-ExtraLightItalic.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_SemiCondensed-Italic.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_SemiCondensed-Light.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_SemiCondensed-LightItalic.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_SemiCondensed-Medium.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_SemiCondensed-MediumItalic.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_SemiCondensed-Regular.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_SemiCondensed-SemiBold.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_SemiCondensed-SemiBoldItalic.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_SemiCondensed-Thin.ttf +0 -0
- package/src/themes/default/assets/static/IBMPlexSans_SemiCondensed-ThinItalic.ttf +0 -0
- package/src/themes/default/components.css +81 -0
- package/src/themes/default/sirenodeck.json +170 -0
- package/src/themes/index.ts +14 -0
- package/src/themes/light/assets/IBMPlexSans-Italic-VariableFont_wdth,wght.ttf +0 -0
- package/src/themes/light/assets/IBMPlexSans-VariableFont_wdth,wght.ttf +0 -0
- package/src/themes/light/assets/IBM_Plex_Mono/IBMPlexMono-Bold.ttf +0 -0
- package/src/themes/light/assets/IBM_Plex_Mono/IBMPlexMono-Medium.ttf +0 -0
- package/src/themes/light/assets/IBM_Plex_Mono/IBMPlexMono-Regular.ttf +0 -0
- package/src/themes/light/assets/IBM_Plex_Mono/OFL.txt +93 -0
- package/src/themes/light/assets/OFL.txt +93 -0
- package/src/themes/light/assets/README.txt +106 -0
- package/src/themes/light/assets/static/IBMPlexSans-Light.ttf +0 -0
- package/src/themes/light/assets/static/IBMPlexSans-LightItalic.ttf +0 -0
- package/src/themes/light/assets/static/IBMPlexSans-Thin.ttf +0 -0
- package/src/themes/light/components.css +70 -0
- package/src/themes/light/sirenodeck.json +170 -0
- package/src/themes/loader.ts +343 -0
- package/src/themes/manifest.ts +164 -0
- package/src/themes/use-resolved-theme.tsx +32 -0
- package/src/ui/ButtonFrame.tsx +230 -0
- package/src/ui/contexts/AssetCacheContext.tsx +43 -0
- package/src/ui/index.ts +20 -0
- package/src/ui/primitives/Chip.tsx +53 -0
- package/src/ui/primitives/Icon.tsx +209 -0
- package/src/ui/primitives/Label.tsx +82 -0
- package/src/ui/primitives/ProgressBar.tsx +38 -0
- package/src/ui/primitives/TapIndicator.tsx +67 -0
- package/src/ui/primitives/Text.tsx +810 -0
- package/src/ui/primitives/index.ts +6 -0
- package/src/ui/surfaces/BarsSurface.tsx +211 -0
- package/src/ui/surfaces/IconLabelProgressSurface.tsx +133 -0
- package/src/ui/surfaces/IconLabelSurface.tsx +59 -0
- package/src/ui/surfaces/LabelValueListSurface.tsx +202 -0
- package/src/ui/surfaces/PaginatedSurface.tsx +164 -0
- package/src/ui/surfaces/SplitActionSurface.tsx +98 -0
- package/src/ui/surfaces/TemporaryErrorSurface.tsx +68 -0
- package/src/ui/surfaces/ValueChart.tsx +218 -0
- package/src/ui/surfaces/index.ts +32 -0
- package/src/ui/surfaces/paginated-schema.ts +22 -0
- package/src/ui/theme-presentation-builder.ts +184 -0
- package/src/ui/theme-presentation.tsx +146 -0
- package/src/ui/utils/cn.ts +12 -0
- package/src/util/cache-paths.ts +38 -0
- package/src/util/config-diff.ts +16 -0
- package/src/util/daemon-control.ts +85 -0
- package/src/util/daemon.ts +575 -0
- package/src/util/device-config.ts +56 -0
- package/src/util/errors.ts +13 -0
- package/src/util/log-reader.ts +114 -0
- package/src/util/log-tail.ts +103 -0
- package/src/util/logger.ts +417 -0
- package/src/util/process-title.ts +79 -0
- package/src/util/single-instance.ts +202 -0
- package/src/version.ts +10 -0
- package/src/vite/index.ts +6 -0
- package/src/vite/virtual-modules.ts +631 -0
- package/src/vite-env.d.ts +1 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useCallback,
|
|
3
|
+
useEffect,
|
|
4
|
+
useRef,
|
|
5
|
+
useState,
|
|
6
|
+
type CSSProperties,
|
|
7
|
+
type ReactElement,
|
|
8
|
+
} from "react"
|
|
9
|
+
|
|
10
|
+
import { cn } from "../utils/cn"
|
|
11
|
+
import { useThemeUiPresentation } from "../theme-presentation"
|
|
12
|
+
|
|
13
|
+
export interface PaginatedGestureEvent {
|
|
14
|
+
gesture: "tap" | "dbl-tap" | "hold"
|
|
15
|
+
at: number
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface PaginatedPage<T> {
|
|
19
|
+
render: (props: T) => ReactElement
|
|
20
|
+
config: T
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface PaginatedSurfaceProps<T> {
|
|
24
|
+
pages: PaginatedPage<T> | PaginatedPage<T>[]
|
|
25
|
+
gesture?: PaginatedGestureEvent | null
|
|
26
|
+
intervalMs?: number
|
|
27
|
+
autoReturnMs?: number
|
|
28
|
+
className?: string
|
|
29
|
+
style?: CSSProperties
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function normalizePages<T>(
|
|
33
|
+
pages: PaginatedPage<T> | PaginatedPage<T>[],
|
|
34
|
+
): PaginatedPage<T>[] {
|
|
35
|
+
return Array.isArray(pages) ? pages : [pages]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const DOT_ACTIVE = "bg-white"
|
|
39
|
+
const DOT_INACTIVE = "bg-white/30"
|
|
40
|
+
|
|
41
|
+
export function PaginatedSurface<T>({
|
|
42
|
+
pages,
|
|
43
|
+
gesture,
|
|
44
|
+
intervalMs,
|
|
45
|
+
autoReturnMs,
|
|
46
|
+
className,
|
|
47
|
+
style,
|
|
48
|
+
}: PaginatedSurfaceProps<T>): ReactElement {
|
|
49
|
+
const themeUi = useThemeUiPresentation()
|
|
50
|
+
|
|
51
|
+
if (themeUi?.surfaces?.paginated) {
|
|
52
|
+
return themeUi.surfaces.paginated(
|
|
53
|
+
{
|
|
54
|
+
pages,
|
|
55
|
+
gesture,
|
|
56
|
+
intervalMs,
|
|
57
|
+
autoReturnMs,
|
|
58
|
+
className,
|
|
59
|
+
style,
|
|
60
|
+
} as PaginatedSurfaceProps<unknown>,
|
|
61
|
+
undefined,
|
|
62
|
+
paginatedSurfaceBase,
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return paginatedSurfaceBase({
|
|
67
|
+
pages,
|
|
68
|
+
gesture,
|
|
69
|
+
intervalMs,
|
|
70
|
+
autoReturnMs,
|
|
71
|
+
className,
|
|
72
|
+
style,
|
|
73
|
+
} as PaginatedSurfaceProps<T>)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function paginatedSurfaceBase<T>({
|
|
77
|
+
pages,
|
|
78
|
+
gesture,
|
|
79
|
+
intervalMs,
|
|
80
|
+
autoReturnMs,
|
|
81
|
+
className,
|
|
82
|
+
style,
|
|
83
|
+
}: PaginatedSurfaceProps<T>): ReactElement {
|
|
84
|
+
const allPages = normalizePages(pages)
|
|
85
|
+
const count = allPages.length
|
|
86
|
+
const [current, setCurrent] = useState(0)
|
|
87
|
+
const lastGestureAt = useRef(0)
|
|
88
|
+
const timerRef = useRef<number | null>(null)
|
|
89
|
+
const autoReturnTimerRef = useRef<number | null>(null)
|
|
90
|
+
|
|
91
|
+
const clearTimer = useCallback(() => {
|
|
92
|
+
if (timerRef.current !== null) {
|
|
93
|
+
window.clearInterval(timerRef.current)
|
|
94
|
+
timerRef.current = null
|
|
95
|
+
}
|
|
96
|
+
}, [])
|
|
97
|
+
|
|
98
|
+
const clearAutoReturnTimer = useCallback(() => {
|
|
99
|
+
if (autoReturnTimerRef.current !== null) {
|
|
100
|
+
window.clearTimeout(autoReturnTimerRef.current)
|
|
101
|
+
autoReturnTimerRef.current = null
|
|
102
|
+
}
|
|
103
|
+
}, [])
|
|
104
|
+
|
|
105
|
+
const advance = useCallback(() => {
|
|
106
|
+
setCurrent((p) => (p + 1) % count)
|
|
107
|
+
}, [count])
|
|
108
|
+
|
|
109
|
+
// gesture-driven cycling
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
if (gesture?.gesture === "tap" && gesture.at !== lastGestureAt.current) {
|
|
112
|
+
lastGestureAt.current = gesture.at
|
|
113
|
+
clearTimer()
|
|
114
|
+
advance()
|
|
115
|
+
}
|
|
116
|
+
}, [gesture, advance, clearTimer])
|
|
117
|
+
|
|
118
|
+
// auto-advance timer
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (intervalMs === undefined || count <= 1) return
|
|
121
|
+
clearTimer()
|
|
122
|
+
timerRef.current = window.setInterval(advance, intervalMs)
|
|
123
|
+
return clearTimer
|
|
124
|
+
}, [intervalMs, count, advance, clearTimer])
|
|
125
|
+
|
|
126
|
+
// auto-return to page 0
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
clearAutoReturnTimer()
|
|
129
|
+
if (autoReturnMs === undefined || current === 0) return
|
|
130
|
+
autoReturnTimerRef.current = window.setTimeout(() => {
|
|
131
|
+
setCurrent(0)
|
|
132
|
+
}, autoReturnMs)
|
|
133
|
+
return clearAutoReturnTimer
|
|
134
|
+
}, [current, autoReturnMs, clearAutoReturnTimer])
|
|
135
|
+
|
|
136
|
+
// reset current page when pages array changes length
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
setCurrent((p) => (p >= count ? 0 : p))
|
|
139
|
+
}, [count])
|
|
140
|
+
|
|
141
|
+
const page = allPages[current]!
|
|
142
|
+
|
|
143
|
+
return (
|
|
144
|
+
<div
|
|
145
|
+
className={cn("relative flex h-full w-full flex-col", className)}
|
|
146
|
+
style={style}
|
|
147
|
+
>
|
|
148
|
+
<div className="min-h-0 flex-1">{page.render(page.config as T)}</div>
|
|
149
|
+
{count > 1 && (
|
|
150
|
+
<div className="absolute bottom-[-4px] left-0 right-0 flex items-center justify-center gap-1">
|
|
151
|
+
{allPages.map((_, i) => (
|
|
152
|
+
<div
|
|
153
|
+
key={i}
|
|
154
|
+
className={cn(
|
|
155
|
+
"h-1 w-1 rounded-full",
|
|
156
|
+
i === current ? DOT_ACTIVE : DOT_INACTIVE,
|
|
157
|
+
)}
|
|
158
|
+
/>
|
|
159
|
+
))}
|
|
160
|
+
</div>
|
|
161
|
+
)}
|
|
162
|
+
</div>
|
|
163
|
+
)
|
|
164
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { ReactNode, type ReactElement } from "react"
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
TapIndicator,
|
|
5
|
+
TapIndicatorType,
|
|
6
|
+
type TapIndicatorProps,
|
|
7
|
+
} from "../primitives/TapIndicator"
|
|
8
|
+
import { useThemeUiPresentation } from "../theme-presentation"
|
|
9
|
+
import { cn } from "../utils/cn"
|
|
10
|
+
|
|
11
|
+
type ActionProps = {
|
|
12
|
+
children: ReactNode
|
|
13
|
+
tapType: TapIndicatorType
|
|
14
|
+
className?: string
|
|
15
|
+
position: "bottom-right" | "top-left"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const Action = ({ tapType, children, className, position }: ActionProps) => {
|
|
19
|
+
return (
|
|
20
|
+
<div className={cn("w-full", className)}>
|
|
21
|
+
<div
|
|
22
|
+
className={cn(
|
|
23
|
+
"absolute z-10",
|
|
24
|
+
position === "bottom-right" ? "bottom-0 left-1" : "top-1 right-1",
|
|
25
|
+
)}
|
|
26
|
+
>
|
|
27
|
+
<TapIndicator type={tapType} size="xs" />
|
|
28
|
+
</div>
|
|
29
|
+
<div
|
|
30
|
+
className={cn([
|
|
31
|
+
"flex",
|
|
32
|
+
position === "bottom-right" ? "justify-end" : "justify-start",
|
|
33
|
+
])}
|
|
34
|
+
>
|
|
35
|
+
<div
|
|
36
|
+
className={cn([
|
|
37
|
+
"scale-[0.62]",
|
|
38
|
+
position === "bottom-right"
|
|
39
|
+
? "origin-bottom-right"
|
|
40
|
+
: "origin-top-left",
|
|
41
|
+
])}
|
|
42
|
+
>
|
|
43
|
+
{children}
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface SplitActionSurfaceProps {
|
|
51
|
+
primary: ReactElement
|
|
52
|
+
secondary?: ReactElement
|
|
53
|
+
secondaryIndicatorType?: NonNullable<TapIndicatorProps["type"]>
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function SplitActionSurface(
|
|
57
|
+
props: SplitActionSurfaceProps,
|
|
58
|
+
): ReactElement {
|
|
59
|
+
const themeUi = useThemeUiPresentation()
|
|
60
|
+
|
|
61
|
+
if (themeUi?.surfaces?.splitAction) {
|
|
62
|
+
return themeUi.surfaces.splitAction(
|
|
63
|
+
props,
|
|
64
|
+
undefined,
|
|
65
|
+
splitActionSurfaceBase,
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return splitActionSurfaceBase(props)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function splitActionSurfaceBase(
|
|
73
|
+
props: SplitActionSurfaceProps,
|
|
74
|
+
): ReactElement {
|
|
75
|
+
if (!props.secondary) {
|
|
76
|
+
return <div className="contents">{props.primary}</div>
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<div className="relative size-full flex flex-col">
|
|
81
|
+
<hr className="absolute w-10 border-none h-px background-accent top-1/2 left-1/2 bg-accent -ml-5 -rotate-45" />
|
|
82
|
+
<Action
|
|
83
|
+
className="absolute top-0 left-0 z-10"
|
|
84
|
+
tapType="tap"
|
|
85
|
+
position="top-left"
|
|
86
|
+
>
|
|
87
|
+
{props.primary}
|
|
88
|
+
</Action>
|
|
89
|
+
<Action
|
|
90
|
+
className="absolute bottom-0 right-0 z-10"
|
|
91
|
+
tapType={props.secondaryIndicatorType ?? "dbltap"}
|
|
92
|
+
position="bottom-right"
|
|
93
|
+
>
|
|
94
|
+
{props.secondary}
|
|
95
|
+
</Action>
|
|
96
|
+
</div>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactElement } from "react"
|
|
2
|
+
|
|
3
|
+
import { Icon } from "../primitives/Icon"
|
|
4
|
+
import { Label } from "../primitives/Label"
|
|
5
|
+
import { useThemeUiPresentation } from "../theme-presentation"
|
|
6
|
+
|
|
7
|
+
export interface TemporaryErrorSurfaceProps extends Omit<
|
|
8
|
+
HTMLAttributes<HTMLDivElement>,
|
|
9
|
+
"children"
|
|
10
|
+
> {
|
|
11
|
+
source?: string
|
|
12
|
+
label?: string
|
|
13
|
+
details: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const FALLBACK_LABEL = "Error"
|
|
17
|
+
const FALLBACK_DETAILS = "check logs"
|
|
18
|
+
|
|
19
|
+
export function TemporaryErrorSurface(
|
|
20
|
+
props: TemporaryErrorSurfaceProps,
|
|
21
|
+
): ReactElement {
|
|
22
|
+
const themeUi = useThemeUiPresentation()
|
|
23
|
+
|
|
24
|
+
if (themeUi?.surfaces?.temporaryError) {
|
|
25
|
+
return themeUi.surfaces.temporaryError(
|
|
26
|
+
props,
|
|
27
|
+
undefined,
|
|
28
|
+
temporaryErrorSurfaceBase,
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return temporaryErrorSurfaceBase(props)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function temporaryErrorSurfaceBase(
|
|
36
|
+
props: TemporaryErrorSurfaceProps,
|
|
37
|
+
): ReactElement {
|
|
38
|
+
const {
|
|
39
|
+
className: consumerClassName,
|
|
40
|
+
source,
|
|
41
|
+
label: labelProp,
|
|
42
|
+
details: detailsProp,
|
|
43
|
+
...rest
|
|
44
|
+
} = props
|
|
45
|
+
const layoutClassName =
|
|
46
|
+
"flex h-full w-full flex-col items-center justify-center gap-1"
|
|
47
|
+
const mergedClassName = consumerClassName
|
|
48
|
+
? `${layoutClassName} ${consumerClassName}`
|
|
49
|
+
: layoutClassName
|
|
50
|
+
|
|
51
|
+
const label = labelProp ?? FALLBACK_LABEL
|
|
52
|
+
const details =
|
|
53
|
+
(detailsProp ?? "").length > 0 ? detailsProp : FALLBACK_DETAILS
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<div
|
|
57
|
+
className={mergedClassName}
|
|
58
|
+
data-sireno-surface="temporary-error"
|
|
59
|
+
{...rest}
|
|
60
|
+
>
|
|
61
|
+
<div className="flex items-center justify-center gap-1">
|
|
62
|
+
<Icon source={source} size={16} tone="danger" />
|
|
63
|
+
<Label text={label} variant="secondary" />
|
|
64
|
+
</div>
|
|
65
|
+
<Label text={details} variant="small" lines={3} />
|
|
66
|
+
</div>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactElement } from "react"
|
|
2
|
+
|
|
3
|
+
import { Icon } from "../primitives/Icon"
|
|
4
|
+
import { useThemeUiPresentation } from "../theme-presentation"
|
|
5
|
+
import { cn } from "../utils/cn"
|
|
6
|
+
|
|
7
|
+
export interface ValueChartPoint {
|
|
8
|
+
at: number
|
|
9
|
+
value: number
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ValueChartSeries {
|
|
13
|
+
id: string
|
|
14
|
+
color: string
|
|
15
|
+
icon: string
|
|
16
|
+
label?: string
|
|
17
|
+
unit?: string
|
|
18
|
+
points: ReadonlyArray<ValueChartPoint>
|
|
19
|
+
yMax: number
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type ValueChartSeriesTuple =
|
|
23
|
+
| readonly [ValueChartSeries]
|
|
24
|
+
| readonly [ValueChartSeries, ValueChartSeries]
|
|
25
|
+
|
|
26
|
+
export interface ValueChartProps {
|
|
27
|
+
series: ValueChartSeriesTuple
|
|
28
|
+
windowSeconds: number
|
|
29
|
+
resolution?: number
|
|
30
|
+
className?: string
|
|
31
|
+
style?: CSSProperties
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const CHART_VIEWBOX_SIZE = 100
|
|
35
|
+
|
|
36
|
+
function clipPoints(
|
|
37
|
+
points: ReadonlyArray<ValueChartPoint>,
|
|
38
|
+
windowSeconds: number,
|
|
39
|
+
): ValueChartPoint[] {
|
|
40
|
+
const cutoff = Date.now() - windowSeconds * 1000
|
|
41
|
+
return points.filter((p) => p.at >= cutoff)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function downsample(
|
|
45
|
+
points: ReadonlyArray<ValueChartPoint>,
|
|
46
|
+
maxPoints: number,
|
|
47
|
+
): ValueChartPoint[] {
|
|
48
|
+
if (points.length <= maxPoints) return [...points]
|
|
49
|
+
const bucketSize = Math.ceil(points.length / maxPoints)
|
|
50
|
+
const result: ValueChartPoint[] = []
|
|
51
|
+
for (let i = 0; i < points.length; i += bucketSize) {
|
|
52
|
+
const bucket = points.slice(i, i + bucketSize)
|
|
53
|
+
const maxP = bucket.reduce((a, b) => (a.value > b.value ? a : b))
|
|
54
|
+
result.push(maxP)
|
|
55
|
+
}
|
|
56
|
+
const last = points[points.length - 1]
|
|
57
|
+
if (last && result[result.length - 1] !== last) result.push(last)
|
|
58
|
+
return result
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function buildAreaPath(
|
|
62
|
+
points: ReadonlyArray<ValueChartPoint>,
|
|
63
|
+
yMax: number,
|
|
64
|
+
): string {
|
|
65
|
+
if (points.length === 0) return ""
|
|
66
|
+
|
|
67
|
+
const minX = points[0]!.at
|
|
68
|
+
const maxX = points[points.length - 1]!.at
|
|
69
|
+
const rangeX = Math.max(maxX - minX, 1)
|
|
70
|
+
const size = CHART_VIEWBOX_SIZE
|
|
71
|
+
const normalY = (v: number) => ((1 - v / Math.max(yMax, 1)) * size).toFixed(1)
|
|
72
|
+
|
|
73
|
+
const parts: string[] = []
|
|
74
|
+
for (let i = 0; i < points.length; i++) {
|
|
75
|
+
const x = (((points[i]!.at - minX) / rangeX) * size).toFixed(1)
|
|
76
|
+
const y = normalY(points[i]!.value)
|
|
77
|
+
parts.push(`${i === 0 ? "M" : "L"}${x},${y}`)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const lastX = (
|
|
81
|
+
((points[points.length - 1]!.at - minX) / rangeX) *
|
|
82
|
+
size
|
|
83
|
+
).toFixed(1)
|
|
84
|
+
parts.push(`L${lastX},${size} L0,${size} Z`)
|
|
85
|
+
return parts.join(" ")
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function LegendSwatch({
|
|
89
|
+
color,
|
|
90
|
+
variant,
|
|
91
|
+
}: {
|
|
92
|
+
color: string
|
|
93
|
+
variant: "solid" | "dashed"
|
|
94
|
+
}): ReactElement {
|
|
95
|
+
return (
|
|
96
|
+
<svg
|
|
97
|
+
width={14}
|
|
98
|
+
height={4}
|
|
99
|
+
viewBox="0 0 14 4"
|
|
100
|
+
preserveAspectRatio="none"
|
|
101
|
+
aria-hidden
|
|
102
|
+
data-variant={variant}
|
|
103
|
+
>
|
|
104
|
+
<line
|
|
105
|
+
x1="0"
|
|
106
|
+
y1="2"
|
|
107
|
+
x2="14"
|
|
108
|
+
y2="2"
|
|
109
|
+
stroke={color}
|
|
110
|
+
strokeWidth={2}
|
|
111
|
+
strokeLinecap="round"
|
|
112
|
+
{...(variant === "dashed" ? { strokeDasharray: "3 2" } : {})}
|
|
113
|
+
/>
|
|
114
|
+
</svg>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function ValueChart(props: ValueChartProps): ReactElement {
|
|
119
|
+
if (props.series.length < 1 || props.series.length > 2) {
|
|
120
|
+
throw new Error(
|
|
121
|
+
`ValueChart supports 1-2 series. Received ${props.series.length}.`,
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const themeUi = useThemeUiPresentation()
|
|
126
|
+
if (themeUi?.surfaces?.valueChart) {
|
|
127
|
+
return themeUi.surfaces.valueChart(props, undefined, valueChartBase)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return valueChartBase(props)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function valueChartBase(props: ValueChartProps): ReactElement {
|
|
134
|
+
if (props.series.length < 1 || props.series.length > 2) {
|
|
135
|
+
throw new Error(
|
|
136
|
+
`ValueChart supports 1-2 series. Received ${props.series.length}.`,
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const clipped = props.series.map((s) => ({
|
|
141
|
+
...s,
|
|
142
|
+
clipped: clipPoints(s.points, props.windowSeconds),
|
|
143
|
+
}))
|
|
144
|
+
|
|
145
|
+
const resolution = props.resolution ?? 120
|
|
146
|
+
const variantFor = (index: number): "solid" | "dashed" =>
|
|
147
|
+
index === 0 ? "solid" : "dashed"
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<div
|
|
151
|
+
className={cn(
|
|
152
|
+
"flex h-full min-h-6 min-w-0 w-full flex-col",
|
|
153
|
+
props.className,
|
|
154
|
+
)}
|
|
155
|
+
data-sireno-ui-valuechart="true"
|
|
156
|
+
style={props.style}
|
|
157
|
+
>
|
|
158
|
+
<div className="flex shrink-0 items-center justify-center gap-2">
|
|
159
|
+
{clipped.map((s, index) => {
|
|
160
|
+
const variant = variantFor(index)
|
|
161
|
+
return (
|
|
162
|
+
<div
|
|
163
|
+
className="flex items-center gap-1 whitespace-nowrap"
|
|
164
|
+
key={s.id}
|
|
165
|
+
data-series-id={s.id}
|
|
166
|
+
data-variant={variant}
|
|
167
|
+
>
|
|
168
|
+
<Icon source={s.icon} size={10} />
|
|
169
|
+
<LegendSwatch color={s.color} variant={variant} />
|
|
170
|
+
</div>
|
|
171
|
+
)
|
|
172
|
+
})}
|
|
173
|
+
</div>
|
|
174
|
+
|
|
175
|
+
<div className="relative flex-1 min-w-0">
|
|
176
|
+
<svg
|
|
177
|
+
className="h-full w-full"
|
|
178
|
+
preserveAspectRatio="none"
|
|
179
|
+
viewBox={`0 0 ${CHART_VIEWBOX_SIZE} ${CHART_VIEWBOX_SIZE}`}
|
|
180
|
+
data-sireno-chart-svg="true"
|
|
181
|
+
>
|
|
182
|
+
{clipped.map((s, index) => {
|
|
183
|
+
const variant = variantFor(index)
|
|
184
|
+
const downsampled = downsample(s.clipped, resolution)
|
|
185
|
+
if (downsampled.length === 0) {
|
|
186
|
+
return (
|
|
187
|
+
<line
|
|
188
|
+
key={s.id}
|
|
189
|
+
x1="0"
|
|
190
|
+
y1={CHART_VIEWBOX_SIZE}
|
|
191
|
+
x2={CHART_VIEWBOX_SIZE}
|
|
192
|
+
y2={CHART_VIEWBOX_SIZE}
|
|
193
|
+
stroke={s.color}
|
|
194
|
+
strokeWidth={1.5}
|
|
195
|
+
opacity={0.3}
|
|
196
|
+
{...(variant === "dashed" ? { strokeDasharray: "4 3" } : {})}
|
|
197
|
+
/>
|
|
198
|
+
)
|
|
199
|
+
}
|
|
200
|
+
return (
|
|
201
|
+
<path
|
|
202
|
+
key={s.id}
|
|
203
|
+
d={buildAreaPath(downsampled, s.yMax)}
|
|
204
|
+
fill={s.color}
|
|
205
|
+
fillOpacity={0.5}
|
|
206
|
+
stroke={s.color}
|
|
207
|
+
strokeWidth={1.5}
|
|
208
|
+
strokeLinejoin="round"
|
|
209
|
+
strokeLinecap="round"
|
|
210
|
+
{...(variant === "dashed" ? { strokeDasharray: "4 3" } : {})}
|
|
211
|
+
/>
|
|
212
|
+
)
|
|
213
|
+
})}
|
|
214
|
+
</svg>
|
|
215
|
+
</div>
|
|
216
|
+
</div>
|
|
217
|
+
)
|
|
218
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export * from "./BarsSurface"
|
|
2
|
+
export * from "./IconLabelProgressSurface"
|
|
3
|
+
export * from "./IconLabelSurface"
|
|
4
|
+
export * from "./LabelValueListSurface"
|
|
5
|
+
export * from "./TemporaryErrorSurface"
|
|
6
|
+
export * from "./ValueChart"
|
|
7
|
+
|
|
8
|
+
export { BarsSurface } from "./BarsSurface"
|
|
9
|
+
export type { BarsItem, BarsSurfaceProps as BarsProps } from "./BarsSurface"
|
|
10
|
+
export { IconLabelProgressSurface } from "./IconLabelProgressSurface"
|
|
11
|
+
export type { IconLabelProgressSurfaceProps } from "./IconLabelProgressSurface"
|
|
12
|
+
export { IconLabelSurface } from "./IconLabelSurface"
|
|
13
|
+
export type { IconLabelSurfaceProps } from "./IconLabelSurface"
|
|
14
|
+
|
|
15
|
+
export { PaginatedSurface } from "./PaginatedSurface"
|
|
16
|
+
export type {
|
|
17
|
+
PaginatedGestureEvent,
|
|
18
|
+
PaginatedPage,
|
|
19
|
+
PaginatedSurfaceProps,
|
|
20
|
+
} from "./PaginatedSurface"
|
|
21
|
+
export { pagesSchema } from "./paginated-schema"
|
|
22
|
+
|
|
23
|
+
export { SplitActionSurface } from "./SplitActionSurface"
|
|
24
|
+
export type { SplitActionSurfaceProps } from "./SplitActionSurface"
|
|
25
|
+
export { TemporaryErrorSurface } from "./TemporaryErrorSurface"
|
|
26
|
+
export type { TemporaryErrorSurfaceProps } from "./TemporaryErrorSurface"
|
|
27
|
+
export { ValueChart } from "./ValueChart"
|
|
28
|
+
export type {
|
|
29
|
+
ValueChartPoint,
|
|
30
|
+
ValueChartProps,
|
|
31
|
+
ValueChartSeries,
|
|
32
|
+
} from "./ValueChart"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Wraps a page schema to accept either a single page object or an array.
|
|
5
|
+
* Normalizes to `{ pages: [...] }`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const Config = pagesSchema(z.discriminatedUnion("type", [BarPage, ChartPage]))
|
|
9
|
+
* // single: { type: "bars", metrics: ["cpu"] } → { pages: [{ type: "bars", metrics: [...] }] }
|
|
10
|
+
* // array: [{ type: "bars", ... }, { type: "chart", ... }] → { pages: [...] }
|
|
11
|
+
*/
|
|
12
|
+
export function pagesSchema<T extends z.ZodTypeAny>(page: T) {
|
|
13
|
+
return z.preprocess(
|
|
14
|
+
(input) => {
|
|
15
|
+
if (Array.isArray(input)) return { pages: input }
|
|
16
|
+
if (input && typeof input === "object" && !("pages" in input))
|
|
17
|
+
return { pages: [input] }
|
|
18
|
+
return input
|
|
19
|
+
},
|
|
20
|
+
z.object({ pages: z.array(page).min(1).max(5) }).strict(),
|
|
21
|
+
)
|
|
22
|
+
}
|