@rainbow-robotics/plugin-ui 1.3.6-dev.7 → 1.3.6-dev.8
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/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +0 -2
- package/dist/manifest.js.map +2 -2
- package/dist/react.d.ts +37 -100
- package/dist/sdk.d.ts +0 -10
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +0 -10
- package/dist/sdk.js.map +2 -2
- package/dist/ws.d.ts +0 -5
- package/dist/ws.d.ts.map +1 -1
- package/dist/ws.js +0 -21
- package/dist/ws.js.map +2 -2
- package/package.json +2 -2
- package/src/manifest.ts +0 -2
- package/src/sdk.ts +0 -21
- package/src/ws.ts +0 -28
package/dist/manifest.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAEH,sDAAsD;AACtD,eAAO,MAAM,mBAAmB,4DAKtB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,4DAA4D;AAC5D,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAE7D,MAAM,WAAW,kBAAkB;IACjC,sCAAsC;IACtC,KAAK,EAAE,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IACzC,gFAAgF;IAChF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,sEAAsE;IACtE,IAAI,CAAC,EACD,MAAM,GACN;QACE,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACN,qBAAqB;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MA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M,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC/B,CAAC;AAEN,MAAM,WAAW,cAAc;IAC7B,8DAA8D;IAC9D,EAAE,EAAE,MAAM,CAAC;IACX,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yCAAyC;IACzC,KAAK,EACD,MAAM,GACN;QACE,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACN,iCAAiC;IACjC,WAAW,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACnC,0CAA0C;IAC1C,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;IAC7B,oCAAoC;IACpC,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAmBzD"}
|
package/dist/manifest.js
CHANGED
|
@@ -13,8 +13,6 @@ function validateManifest(value) {
|
|
|
13
13
|
const m = value;
|
|
14
14
|
if (typeof m.id !== "string" || m.id.length === 0)
|
|
15
15
|
errors.push("manifest.id is required (string)");
|
|
16
|
-
else if (!/^[a-z][a-z0-9]*(-[a-z0-9]+)*(\.[a-z][a-z0-9]*(-[a-z0-9]+)*)*$/.test(m.id))
|
|
17
|
-
errors.push('manifest.id must be "."-separated parts of lowercase letters/digits and single "-", each starting with a letter (e.g. com.example.my-plugin)');
|
|
18
16
|
if (typeof m.name !== "string" || m.name.length === 0)
|
|
19
17
|
errors.push("manifest.name is required (string)");
|
|
20
18
|
if (typeof m.version !== "string" || m.version.length === 0)
|
package/dist/manifest.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/manifest.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * Plugin manifest schema \u2014 the single source of truth shared by the front end\n * (nexus reads it) and the back end (rby2 mirrors it for validation).\n *\n * Evolve additively only.\n */\n\n/** Known contribution points the host understands. */\nexport const CONTRIBUTION_POINTS = [\n \"toolbar\",\n \"lnb\",\n \"move.panel\",\n \"program.panel\",\n] as const;\n\nexport type ContributionPoint = (typeof CONTRIBUTION_POINTS)[number];\n\n/** How a header.toolbar contribution opens when clicked. */\nexport type ContributionOpens = \"popover\" | \"panel\" | \"page\";\n\nexport interface PluginContribution {\n /** Where this contribution mounts. */\n point: ContributionPoint | (string & {});\n /** UI entry name relative to ui/ (without extension). Defaults to \"content\". */\n ui?: string;\n /** Icon path relative to the plugin root (e.g. \"assets/icon.svg\"). */\n icon?:\n | string\n | {\n \"16\"?: string;\n \"48\"?: string;\n \"126\"?: string;\n };\n /** Display label. */\n label?: string | Record<string, string>;\n /** For header.toolbar: how the contribution surfaces. */\n opens?: ContributionOpens;\n commandInfo?: {\n name: string;\n icon: string;\n funcName: string;\n args?: Record<string, any>;\n };\n}\n\nexport interface PluginAction {\n /** Action id referenced by `rb.action(id, payload)`. */\n id: string;\n /** Transport topic (Zenoh / ROS2) the back end routes to. */\n topic: string;\n /** Optional payload schema hint (field \u2192 type name). */\n schema?: Record<string, string>;\n}\n\n/** Allowed variable value types exposed to pyfm. */\nexport const VARIABLE_TYPES = [\"number\", \"string\", \"boolean\", \"array\"] as const;\n\nexport type PluginVariableType = (typeof VARIABLE_TYPES)[number];\n\n/** A variable the plugin pre-declares for use in pyfm programs. */\nexport interface PluginVariable {\n /** Identifier, must start with \"RBP_\" (then letters, digits, underscore). Unique per plugin. */\n name: `RBP_${string}`;\n type: PluginVariableType;\n /** Initial value \u2014 must match `type`. */\n init: number | string | boolean | any[];\n /** Optional. Without it the UI cannot explain what the variable is for. */\n description?: string | Record<string, string>;\n}\n\nexport type PluginRuntime =\n | { type: \"none\" }\n | { type: \"python\"; entry: string }\n | {\n type: \"ros2\";\n package: string;\n launch: string;\n rosClient: \"rclpy\" | \"rclcpp\";\n };\n\nexport interface PluginManifest {\n /** Reverse-DNS unique id, e.g. \"com.rainbow.gripper-tool\". */\n id: string;\n /** Human-readable name. */\n name: string;\n /** Plugin version (semver). */\n version: string;\n /** Minimum host (Muscat) version this plugin supports. */\n minAppVersion?: string;\n /** Icon path relative to plugin root. */\n icons:\n | string\n | {\n \"16\"?: string;\n \"48\"?: string;\n \"128\"?: string;\n };\n /** UI / chrome contributions. */\n contributes?: PluginContribution[];\n /** Host actions the plugin can invoke. */\n actions?: PluginAction[];\n /** Variables pre-declared for pyfm; the variable picker UI lists these. */\n variables?: PluginVariable[];\n /** Back-end runtime declaration. */\n runtime?: PluginRuntime;\n}\n\n/**\n * Lightweight structural check. Returns the list of problems (empty = valid).\n * Kept dependency-free so both front and back ends can reuse it; richer\n * validation (zod) can layer on top later without breaking this contract.\n */\nexport function validateManifest(value: unknown): string[] {\n const errors: string[] = [];\n if (typeof value !== \"object\" || value === null) {\n return [\"manifest must be an object\"];\n }\n const m = value as Record<string, unknown>;\n if (typeof m.id !== \"string\" || m.id.length === 0)\n errors.push(\"manifest.id is required (string)\");\n
|
|
5
|
-
"mappings": "AASO,MAAM,sBAAsB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AA0CO,MAAM,iBAAiB,CAAC,UAAU,UAAU,WAAW,OAAO;AAyD9D,SAAS,iBAAiB,OAA0B;AACzD,QAAM,SAAmB,CAAC;AAC1B,MAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAC/C,WAAO,CAAC,4BAA4B;AAAA,EACtC;AACA,QAAM,IAAI;AACV,MAAI,OAAO,EAAE,OAAO,YAAY,EAAE,GAAG,WAAW;AAC9C,WAAO,KAAK,kCAAkC;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * Plugin manifest schema \u2014 the single source of truth shared by the front end\n * (nexus reads it) and the back end (rby2 mirrors it for validation).\n *\n * Evolve additively only.\n */\n\n/** Known contribution points the host understands. */\nexport const CONTRIBUTION_POINTS = [\n \"toolbar\",\n \"lnb\",\n \"move.panel\",\n \"program.panel\",\n] as const;\n\nexport type ContributionPoint = (typeof CONTRIBUTION_POINTS)[number];\n\n/** How a header.toolbar contribution opens when clicked. */\nexport type ContributionOpens = \"popover\" | \"panel\" | \"page\";\n\nexport interface PluginContribution {\n /** Where this contribution mounts. */\n point: ContributionPoint | (string & {});\n /** UI entry name relative to ui/ (without extension). Defaults to \"content\". */\n ui?: string;\n /** Icon path relative to the plugin root (e.g. \"assets/icon.svg\"). */\n icon?:\n | string\n | {\n \"16\"?: string;\n \"48\"?: string;\n \"126\"?: string;\n };\n /** Display label. */\n label?: string | Record<string, string>;\n /** For header.toolbar: how the contribution surfaces. */\n opens?: ContributionOpens;\n commandInfo?: {\n name: string;\n icon: string;\n funcName: string;\n args?: Record<string, any>;\n };\n}\n\nexport interface PluginAction {\n /** Action id referenced by `rb.action(id, payload)`. */\n id: string;\n /** Transport topic (Zenoh / ROS2) the back end routes to. */\n topic: string;\n /** Optional payload schema hint (field \u2192 type name). */\n schema?: Record<string, string>;\n}\n\n/** Allowed variable value types exposed to pyfm. */\nexport const VARIABLE_TYPES = [\"number\", \"string\", \"boolean\", \"array\"] as const;\n\nexport type PluginVariableType = (typeof VARIABLE_TYPES)[number];\n\n/** A variable the plugin pre-declares for use in pyfm programs. */\nexport interface PluginVariable {\n /** Identifier, must start with \"RBP_\" (then letters, digits, underscore). Unique per plugin. */\n name: `RBP_${string}`;\n type: PluginVariableType;\n /** Initial value \u2014 must match `type`. */\n init: number | string | boolean | any[];\n /** Optional. Without it the UI cannot explain what the variable is for. */\n description?: string | Record<string, string>;\n}\n\nexport type PluginRuntime =\n | { type: \"none\" }\n | { type: \"python\"; entry: string }\n | {\n type: \"ros2\";\n package: string;\n launch: string;\n rosClient: \"rclpy\" | \"rclcpp\";\n };\n\nexport interface PluginManifest {\n /** Reverse-DNS unique id, e.g. \"com.rainbow.gripper-tool\". */\n id: string;\n /** Human-readable name. */\n name: string;\n /** Plugin version (semver). */\n version: string;\n /** Minimum host (Muscat) version this plugin supports. */\n minAppVersion?: string;\n /** Icon path relative to plugin root. */\n icons:\n | string\n | {\n \"16\"?: string;\n \"48\"?: string;\n \"128\"?: string;\n };\n /** UI / chrome contributions. */\n contributes?: PluginContribution[];\n /** Host actions the plugin can invoke. */\n actions?: PluginAction[];\n /** Variables pre-declared for pyfm; the variable picker UI lists these. */\n variables?: PluginVariable[];\n /** Back-end runtime declaration. */\n runtime?: PluginRuntime;\n}\n\n/**\n * Lightweight structural check. Returns the list of problems (empty = valid).\n * Kept dependency-free so both front and back ends can reuse it; richer\n * validation (zod) can layer on top later without breaking this contract.\n */\nexport function validateManifest(value: unknown): string[] {\n const errors: string[] = [];\n if (typeof value !== \"object\" || value === null) {\n return [\"manifest must be an object\"];\n }\n const m = value as Record<string, unknown>;\n if (typeof m.id !== \"string\" || m.id.length === 0)\n errors.push(\"manifest.id is required (string)\");\n if (typeof m.name !== \"string\" || m.name.length === 0)\n errors.push(\"manifest.name is required (string)\");\n if (typeof m.version !== \"string\" || m.version.length === 0)\n errors.push(\"manifest.version is required (string)\");\n if (m.contributes !== undefined && !Array.isArray(m.contributes))\n errors.push(\"manifest.contributes must be an array\");\n if (m.actions !== undefined && !Array.isArray(m.actions))\n errors.push(\"manifest.actions must be an array\");\n if (m.variables !== undefined && !Array.isArray(m.variables))\n errors.push(\"manifest.variables must be an array\");\n return errors;\n}\n"],
|
|
5
|
+
"mappings": "AASO,MAAM,sBAAsB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AA0CO,MAAM,iBAAiB,CAAC,UAAU,UAAU,WAAW,OAAO;AAyD9D,SAAS,iBAAiB,OAA0B;AACzD,QAAM,SAAmB,CAAC;AAC1B,MAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAC/C,WAAO,CAAC,4BAA4B;AAAA,EACtC;AACA,QAAM,IAAI;AACV,MAAI,OAAO,EAAE,OAAO,YAAY,EAAE,GAAG,WAAW;AAC9C,WAAO,KAAK,kCAAkC;AAChD,MAAI,OAAO,EAAE,SAAS,YAAY,EAAE,KAAK,WAAW;AAClD,WAAO,KAAK,oCAAoC;AAClD,MAAI,OAAO,EAAE,YAAY,YAAY,EAAE,QAAQ,WAAW;AACxD,WAAO,KAAK,uCAAuC;AACrD,MAAI,EAAE,gBAAgB,UAAa,CAAC,MAAM,QAAQ,EAAE,WAAW;AAC7D,WAAO,KAAK,uCAAuC;AACrD,MAAI,EAAE,YAAY,UAAa,CAAC,MAAM,QAAQ,EAAE,OAAO;AACrD,WAAO,KAAK,mCAAmC;AACjD,MAAI,EAAE,cAAc,UAAa,CAAC,MAAM,QAAQ,EAAE,SAAS;AACzD,WAAO,KAAK,qCAAqC;AACnD,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/react.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
import * as React$1 from 'react';
|
|
5
|
-
import React__default, { ReactNode, MouseEvent, InputHTMLAttributes, MouseEventHandler, ReactElement, ChangeEvent, CSSProperties, TextareaHTMLAttributes, ComponentType, ComponentProps, Dispatch, SetStateAction, HTMLInputAutoCompleteAttribute, RefObject,
|
|
5
|
+
import React__default, { ReactNode, MouseEvent, InputHTMLAttributes, MouseEventHandler, ReactElement, ChangeEvent, CSSProperties, TextareaHTMLAttributes, ComponentType, ComponentProps, Dispatch, SetStateAction, HTMLInputAutoCompleteAttribute, RefObject, HTMLAttributes } from 'react';
|
|
6
6
|
import { Matcher, DayPicker } from 'react-day-picker';
|
|
7
7
|
import * as ShadDialogPrimitive from '@radix-ui/react-dialog';
|
|
8
8
|
import { Command } from 'cmdk';
|
|
@@ -65,7 +65,7 @@ interface RippleOption {
|
|
|
65
65
|
declare const labelButtonSizes: readonly ["3xs", "2xs", "xs", "xs2", "sm", "md"];
|
|
66
66
|
type LabelButtonSizeType = (typeof labelButtonSizes)[number];
|
|
67
67
|
declare const labelButtonVariants: (props?: {
|
|
68
|
-
size?: "
|
|
68
|
+
size?: "3xs" | "2xs" | "xs" | "xs2" | "sm" | "md";
|
|
69
69
|
variant?: "transparent" | "outlined" | "soft" | "solid" | "inverse" | "inverseSoft" | "brand" | "brandSoft" | "danger" | "dangerSoft" | "success" | "successSoft";
|
|
70
70
|
disabled?: boolean;
|
|
71
71
|
} & class_variance_authority_types.ClassProp) => string;
|
|
@@ -136,7 +136,7 @@ declare const RBLabelButton: React$1.ForwardRefExoticComponent<Omit<Omit<React$1
|
|
|
136
136
|
declare const iconButtonSizes: readonly ["3xs", "2xs", "xs", "xs2", "sm", "md"];
|
|
137
137
|
type IconButtonSizeType = (typeof iconButtonSizes)[number];
|
|
138
138
|
declare const iconButtonVariants: (props?: {
|
|
139
|
-
size?: "
|
|
139
|
+
size?: "3xs" | "2xs" | "xs" | "xs2" | "sm" | "md";
|
|
140
140
|
variant?: "circle" | "transparent" | "outlined" | "soft" | "solid" | "inverse" | "inverseSoft" | "brand";
|
|
141
141
|
disabled?: boolean;
|
|
142
142
|
} & class_variance_authority_types.ClassProp) => string;
|
|
@@ -293,7 +293,7 @@ declare function RBInlineLabelButton({ className, size, variant, type, leadingIc
|
|
|
293
293
|
declare const accordionTypes: readonly ["fill", "transparent"];
|
|
294
294
|
type AccordionType = (typeof accordionTypes)[number];
|
|
295
295
|
declare const accordionVariants: (props?: {
|
|
296
|
-
type?: "
|
|
296
|
+
type?: "transparent" | "fill";
|
|
297
297
|
} & class_variance_authority_types.ClassProp) => string;
|
|
298
298
|
type AccordionVariantProps = VariantProps<typeof accordionVariants>;
|
|
299
299
|
|
|
@@ -541,14 +541,6 @@ interface ModalPropsType<T = AllowAny> {
|
|
|
541
541
|
hideCloseButton?: boolean;
|
|
542
542
|
}
|
|
543
543
|
|
|
544
|
-
type KeypadOption = {
|
|
545
|
-
initTab?: string;
|
|
546
|
-
};
|
|
547
|
-
type VariableModalProps = ModalPropsType<string> & {
|
|
548
|
-
keypadOption?: KeypadOption;
|
|
549
|
-
byKeypad?: boolean;
|
|
550
|
-
};
|
|
551
|
-
|
|
552
544
|
interface Props$e extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
553
545
|
className?: string;
|
|
554
546
|
type?: "text" | "program";
|
|
@@ -558,7 +550,7 @@ interface Props$e extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
|
558
550
|
readOnly?: boolean;
|
|
559
551
|
maxLength?: number;
|
|
560
552
|
error?: boolean;
|
|
561
|
-
variableModal?: ComponentType<
|
|
553
|
+
variableModal?: ComponentType<ModalPropsType<string>>;
|
|
562
554
|
handleChange?: (value: string, name?: string) => void;
|
|
563
555
|
}
|
|
564
556
|
/**
|
|
@@ -582,7 +574,7 @@ type Props$d = {
|
|
|
582
574
|
/**
|
|
583
575
|
* 선택된 날짜 값
|
|
584
576
|
*/
|
|
585
|
-
value?:
|
|
577
|
+
value?: number | [number | undefined, number | undefined];
|
|
586
578
|
/**
|
|
587
579
|
* 날짜 입력 필드의 이름
|
|
588
580
|
*/
|
|
@@ -615,35 +607,13 @@ type Props$d = {
|
|
|
615
607
|
/**
|
|
616
608
|
* 날짜 값 변경 함수
|
|
617
609
|
*/
|
|
618
|
-
handleChange?: (startValue:
|
|
610
|
+
handleChange?: (startValue: number | undefined, endValue: number | undefined, name: string) => void;
|
|
619
611
|
};
|
|
620
612
|
/**
|
|
621
613
|
* 날짜 입력 컴포넌트 입니다.
|
|
622
614
|
*/
|
|
623
615
|
declare const DateInput: ({ className, showType, value, name, disabled, readOnly, size, variant, error, showPresets, showFooter, placeholder, handleChange, }: Props$d) => react_jsx_runtime.JSX.Element;
|
|
624
616
|
|
|
625
|
-
declare const RANGE_DATE_PRESETS: readonly [{
|
|
626
|
-
readonly key: "last-24-hours";
|
|
627
|
-
readonly label: "Last 24 hours";
|
|
628
|
-
}, {
|
|
629
|
-
readonly key: "last-3-days";
|
|
630
|
-
readonly label: "Last 3 days";
|
|
631
|
-
}, {
|
|
632
|
-
readonly key: "last-week";
|
|
633
|
-
readonly label: "Last week";
|
|
634
|
-
}, {
|
|
635
|
-
readonly key: "last-month";
|
|
636
|
-
readonly label: "Last month";
|
|
637
|
-
}, {
|
|
638
|
-
readonly key: "last-3-month";
|
|
639
|
-
readonly label: "Last 3 month";
|
|
640
|
-
}];
|
|
641
|
-
type RangePresetKey = (typeof RANGE_DATE_PRESETS)[number]["key"];
|
|
642
|
-
declare const getRangePresetDates: (key: RangePresetKey, now?: Date) => {
|
|
643
|
-
from: Date;
|
|
644
|
-
to: Date;
|
|
645
|
-
};
|
|
646
|
-
|
|
647
617
|
type Props$c = {
|
|
648
618
|
className?: string;
|
|
649
619
|
calendarPanelClassName?: string;
|
|
@@ -654,7 +624,7 @@ type Props$c = {
|
|
|
654
624
|
/**
|
|
655
625
|
* 선택된 날짜 값
|
|
656
626
|
*/
|
|
657
|
-
value?: [
|
|
627
|
+
value?: [number | undefined, number | undefined];
|
|
658
628
|
/**
|
|
659
629
|
* 날짜 입력 필드의 이름
|
|
660
630
|
*/
|
|
@@ -662,15 +632,11 @@ type Props$c = {
|
|
|
662
632
|
/**
|
|
663
633
|
* 최소 날짜 값
|
|
664
634
|
*/
|
|
665
|
-
min?:
|
|
635
|
+
min?: number;
|
|
666
636
|
/**
|
|
667
637
|
* 최대 날짜 값
|
|
668
638
|
*/
|
|
669
|
-
max?:
|
|
670
|
-
/**
|
|
671
|
-
* 선택 가능한 최대 일수
|
|
672
|
-
*/
|
|
673
|
-
maxDays?: number;
|
|
639
|
+
max?: number;
|
|
674
640
|
/**
|
|
675
641
|
* 날짜 입력 필드의 플레이스홀더
|
|
676
642
|
*/
|
|
@@ -706,16 +672,17 @@ type Props$c = {
|
|
|
706
672
|
/**
|
|
707
673
|
* 날짜 값 변경 함수
|
|
708
674
|
*/
|
|
709
|
-
handleChange?: (startValue:
|
|
675
|
+
handleChange?: (startValue: number | undefined, endValue: number | undefined, name: string) => void;
|
|
710
676
|
/**
|
|
711
677
|
* 표시할 프리셋 키 목록. 미지정 시 전체 표시.
|
|
712
678
|
*/
|
|
713
679
|
presets?: RangePresetKey[];
|
|
714
680
|
};
|
|
681
|
+
type RangePresetKey = "last-24-hours" | "last-3-days" | "last-week" | "last-month" | "last-3-month";
|
|
715
682
|
/**
|
|
716
683
|
* 범위 날짜 입력 컴포넌트 입니다.
|
|
717
684
|
*/
|
|
718
|
-
declare const RangeDateInput: ({ className, calendarPanelClassName, showType, value, name, min, max,
|
|
685
|
+
declare const RangeDateInput: ({ className, calendarPanelClassName, showType, value, name, min, max, placeholder, disabled, disabledDates, readOnly, size, variant, error, showPresets, showFooter, handleChange, presets, }: Props$c) => react_jsx_runtime.JSX.Element;
|
|
719
686
|
|
|
720
687
|
interface Props$b extends ModalPropsType<boolean> {
|
|
721
688
|
className?: string;
|
|
@@ -753,7 +720,7 @@ declare const RBAlert: ({ className, containerId, open, onOpenChange, title, con
|
|
|
753
720
|
interface Props$a extends ModalPropsType<boolean> {
|
|
754
721
|
className?: string;
|
|
755
722
|
/** confirm 타이틀 */
|
|
756
|
-
title?: string
|
|
723
|
+
title?: string;
|
|
757
724
|
/** confirm 설명 */
|
|
758
725
|
description?: string | ReactElement;
|
|
759
726
|
/** confirm 내용 */
|
|
@@ -776,7 +743,7 @@ interface Props$a extends ModalPropsType<boolean> {
|
|
|
776
743
|
/** 모달 dialog일때 컨테이너 id */
|
|
777
744
|
containerId?: string;
|
|
778
745
|
/** 확인 버튼 클릭 시 실행할 함수 */
|
|
779
|
-
onConfirm?: () =>
|
|
746
|
+
onConfirm?: () => void;
|
|
780
747
|
/** 취소 버튼 클릭 시 실행할 함수 */
|
|
781
748
|
onCancel?: () => void;
|
|
782
749
|
}
|
|
@@ -984,10 +951,6 @@ interface PropsType$p extends Pick<InputHTMLAttributes<HTMLInputElement>, "name"
|
|
|
984
951
|
* SelectBox의 크기
|
|
985
952
|
*/
|
|
986
953
|
size?: SelectSize;
|
|
987
|
-
/**
|
|
988
|
-
* SelectBox DropBox의 최대 높이
|
|
989
|
-
*/
|
|
990
|
-
maxDropBoxHeight?: number;
|
|
991
954
|
/**
|
|
992
955
|
* option list를 찾는 search 기능 활성화 여부
|
|
993
956
|
*/
|
|
@@ -2055,8 +2018,6 @@ type Props$3 = {
|
|
|
2055
2018
|
stickColor?: string;
|
|
2056
2019
|
/** 조이스틱 영역의 색상 */
|
|
2057
2020
|
stickAreaColor?: string;
|
|
2058
|
-
/** 방향 아크·아이콘 강조 색상 */
|
|
2059
|
-
arcColor?: string;
|
|
2060
2021
|
/**
|
|
2061
2022
|
* 스로틀 임계치
|
|
2062
2023
|
* (이동 비율 차이가 throttleThreshold 이상일 때 onMove 호출)
|
|
@@ -2089,7 +2050,7 @@ type Props$3 = {
|
|
|
2089
2050
|
/** 조이스틱 종료 시 호출 */
|
|
2090
2051
|
onEnd?: (data: RbJoyStickEventData) => void;
|
|
2091
2052
|
};
|
|
2092
|
-
declare const RBJoyStick: ({ className, type, size, stickColor,
|
|
2053
|
+
declare const RBJoyStick: ({ className, type, size, stickColor, stickAreaColor, throttleThreshold, throttleDuration, xOnly, yOnly, disableDiagonal, disabled, keepMoveEventInterval, paddingSize, style, onStart, onMove, onEnd, }: Props$3) => react_jsx_runtime.JSX.Element;
|
|
2093
2054
|
|
|
2094
2055
|
type PlaceType = "top" | "right" | "bottom" | "left";
|
|
2095
2056
|
interface PropsType$6 {
|
|
@@ -2212,8 +2173,6 @@ declare function RBCardFooter({ className, size, ...props }: RBCardFooterProps):
|
|
|
2212
2173
|
|
|
2213
2174
|
declare function ShadDialog({ ...props }: React$1.ComponentProps<typeof ShadDialogPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
2214
2175
|
|
|
2215
|
-
declare function Calendar$1({ className, classNames, showOutsideDays, ...props }: React$1.ComponentProps<typeof DayPicker>): react_jsx_runtime.JSX.Element;
|
|
2216
|
-
|
|
2217
2176
|
declare function RBCommand({ className, ...props }: React.ComponentProps<typeof Command>): react_jsx_runtime.JSX.Element;
|
|
2218
2177
|
declare function RBCommandDialog({ title, description, children, ...props }: React.ComponentProps<typeof ShadDialog> & {
|
|
2219
2178
|
title?: string;
|
|
@@ -2377,7 +2336,7 @@ declare function RBResizable({ className, direction, ...props }: RBResizableProp
|
|
|
2377
2336
|
declare function RBResizablePanel({ className, unstyled, ...props }: RBResizablePanelProps): react_jsx_runtime.JSX.Element;
|
|
2378
2337
|
declare function RBResizableHandle({ className, hideThumb, onPointerDownCapture, onPointerUpCapture, onPointerCancelCapture, ...props }: RBResizableHandleProps): react_jsx_runtime.JSX.Element;
|
|
2379
2338
|
|
|
2380
|
-
declare function Calendar({
|
|
2339
|
+
declare function Calendar({ classNames, showOutsideDays, ...props }: React.ComponentProps<typeof DayPicker>): react_jsx_runtime.JSX.Element;
|
|
2381
2340
|
|
|
2382
2341
|
interface PropsType$4 {
|
|
2383
2342
|
label: string;
|
|
@@ -2389,22 +2348,32 @@ interface DatePickerTimeValue {
|
|
|
2389
2348
|
hour: string;
|
|
2390
2349
|
minute: string;
|
|
2391
2350
|
}
|
|
2392
|
-
interface DatePickerValue {
|
|
2393
|
-
from: Date | undefined;
|
|
2394
|
-
to: Date | undefined;
|
|
2395
|
-
timeEnabled: boolean;
|
|
2396
|
-
}
|
|
2397
2351
|
interface PropsType$3 {
|
|
2398
2352
|
pickerType?: DatePickerType;
|
|
2399
|
-
|
|
2400
|
-
|
|
2353
|
+
setTimeEnabled?: boolean;
|
|
2354
|
+
startTime?: DatePickerTimeValue;
|
|
2355
|
+
endTime?: DatePickerTimeValue;
|
|
2356
|
+
onEndTimeChange?: (nextValue: DatePickerTimeValue) => void;
|
|
2357
|
+
onSetTimeChange?: (checked: boolean) => void;
|
|
2358
|
+
onStartTimeChange?: (nextValue: DatePickerTimeValue) => void;
|
|
2359
|
+
selectedDate?: {
|
|
2360
|
+
from: Date | undefined;
|
|
2361
|
+
to: Date | undefined;
|
|
2362
|
+
};
|
|
2363
|
+
setSelectedDate?: (nextValue: {
|
|
2364
|
+
from: Date | undefined;
|
|
2365
|
+
to: Date | undefined;
|
|
2366
|
+
}) => void;
|
|
2367
|
+
enforceTimeOrder?: boolean;
|
|
2368
|
+
min?: number;
|
|
2369
|
+
max?: number;
|
|
2401
2370
|
labels?: {
|
|
2402
2371
|
from?: string;
|
|
2403
2372
|
to?: string;
|
|
2404
2373
|
setTime?: string;
|
|
2405
2374
|
};
|
|
2406
2375
|
}
|
|
2407
|
-
declare function RBDatePickerFooterTime({ pickerType, selectedDate,
|
|
2376
|
+
declare function RBDatePickerFooterTime({ pickerType, setTimeEnabled, startTime, endTime, onEndTimeChange, onSetTimeChange, onStartTimeChange, selectedDate, setSelectedDate, enforceTimeOrder, labels, }: PropsType$3): react_jsx_runtime.JSX.Element;
|
|
2408
2377
|
|
|
2409
2378
|
interface PropsType$2 {
|
|
2410
2379
|
className?: string;
|
|
@@ -2429,10 +2398,6 @@ declare const checkIconButtonVariants: (props?: {
|
|
|
2429
2398
|
disabled?: boolean;
|
|
2430
2399
|
} & class_variance_authority_types.ClassProp) => string;
|
|
2431
2400
|
|
|
2432
|
-
declare const Svg25DBold: (props?: React__default.SVGAttributes<SVGSVGElement> & {
|
|
2433
|
-
title?: string;
|
|
2434
|
-
description?: string;
|
|
2435
|
-
}) => react_jsx_runtime.JSX.Element;
|
|
2436
2401
|
declare const SvgAMR: (props?: React__default.SVGAttributes<SVGSVGElement> & {
|
|
2437
2402
|
title?: string;
|
|
2438
2403
|
description?: string;
|
|
@@ -2501,10 +2466,6 @@ declare const SvgBulletSolid: (props?: React__default.SVGAttributes<SVGSVGElemen
|
|
|
2501
2466
|
title?: string;
|
|
2502
2467
|
description?: string;
|
|
2503
2468
|
}) => react_jsx_runtime.JSX.Element;
|
|
2504
|
-
declare const SvgCANBus: (props?: React__default.SVGAttributes<SVGSVGElement> & {
|
|
2505
|
-
title?: string;
|
|
2506
|
-
description?: string;
|
|
2507
|
-
}) => react_jsx_runtime.JSX.Element;
|
|
2508
2469
|
declare const SvgCalendarBlankBold: (props?: React__default.SVGAttributes<SVGSVGElement> & {
|
|
2509
2470
|
title?: string;
|
|
2510
2471
|
description?: string;
|
|
@@ -3006,7 +2967,6 @@ declare const SvgWifiCog: (props?: React__default.SVGAttributes<SVGSVGElement> &
|
|
|
3006
2967
|
description?: string;
|
|
3007
2968
|
}) => react_jsx_runtime.JSX.Element;
|
|
3008
2969
|
|
|
3009
|
-
declare const index_Svg25DBold: typeof Svg25DBold;
|
|
3010
2970
|
declare const index_SvgAMR: typeof SvgAMR;
|
|
3011
2971
|
declare const index_SvgArrowArcLeftBold: typeof SvgArrowArcLeftBold;
|
|
3012
2972
|
declare const index_SvgArrowArcRightBold: typeof SvgArrowArcRightBold;
|
|
@@ -3025,7 +2985,6 @@ declare const index_SvgBot: typeof SvgBot;
|
|
|
3025
2985
|
declare const index_SvgBox3D: typeof SvgBox3D;
|
|
3026
2986
|
declare const index_SvgBugBeetleSolid: typeof SvgBugBeetleSolid;
|
|
3027
2987
|
declare const index_SvgBulletSolid: typeof SvgBulletSolid;
|
|
3028
|
-
declare const index_SvgCANBus: typeof SvgCANBus;
|
|
3029
2988
|
declare const index_SvgCalendarBlankBold: typeof SvgCalendarBlankBold;
|
|
3030
2989
|
declare const index_SvgCameraBold: typeof SvgCameraBold;
|
|
3031
2990
|
declare const index_SvgCameraResetBold: typeof SvgCameraResetBold;
|
|
@@ -3152,7 +3111,6 @@ declare const index_SvgWifiNone: typeof SvgWifiNone;
|
|
|
3152
3111
|
declare const index_SvgXBold: typeof SvgXBold;
|
|
3153
3112
|
declare namespace index {
|
|
3154
3113
|
export {
|
|
3155
|
-
index_Svg25DBold as Svg25DBold,
|
|
3156
3114
|
index_SvgAMR as SvgAMR,
|
|
3157
3115
|
index_SvgArrowArcLeftBold as SvgArrowArcLeftBold,
|
|
3158
3116
|
index_SvgArrowArcRightBold as SvgArrowArcRightBold,
|
|
@@ -3171,7 +3129,6 @@ declare namespace index {
|
|
|
3171
3129
|
index_SvgBox3D as SvgBox3D,
|
|
3172
3130
|
index_SvgBugBeetleSolid as SvgBugBeetleSolid,
|
|
3173
3131
|
index_SvgBulletSolid as SvgBulletSolid,
|
|
3174
|
-
index_SvgCANBus as SvgCANBus,
|
|
3175
3132
|
index_SvgCalendarBlankBold as SvgCalendarBlankBold,
|
|
3176
3133
|
index_SvgCameraBold as SvgCameraBold,
|
|
3177
3134
|
index_SvgCameraResetBold as SvgCameraResetBold,
|
|
@@ -3299,16 +3256,6 @@ declare namespace index {
|
|
|
3299
3256
|
};
|
|
3300
3257
|
}
|
|
3301
3258
|
|
|
3302
|
-
type StatusIconProps = SVGAttributes<SVGSVGElement>;
|
|
3303
|
-
/**
|
|
3304
|
-
* 채워진 원 + 흰색 글리프로 상태를 나타내는 아이콘 한 쌍이다. 이 폴더의
|
|
3305
|
-
* 나머지 아이콘(`index.tsx`)은 auto-svg-component-generator가 `.svg`
|
|
3306
|
-
* 소스로부터 자동 생성하므로, 손으로 그린 이 두 아이콘은 별도 파일로 둔다
|
|
3307
|
-
* — index.tsx는 빌드/dev 스크립트가 돌 때마다 통째로 덮어써진다.
|
|
3308
|
-
*/
|
|
3309
|
-
declare const GreenCheckCircleIcon: ({ className, ...props }: StatusIconProps) => react_jsx_runtime.JSX.Element;
|
|
3310
|
-
declare const AmberWarningCircleIcon: ({ className, ...props }: StatusIconProps) => react_jsx_runtime.JSX.Element;
|
|
3311
|
-
|
|
3312
3259
|
declare const lightColors: readonly ["red", "gray", "blue", "green", "orange", "yellow"];
|
|
3313
3260
|
type LightColor = (typeof lightColors)[number];
|
|
3314
3261
|
declare const lightSizes: readonly ["sm", "md", "lg"];
|
|
@@ -3628,16 +3575,6 @@ interface RbSdk {
|
|
|
3628
3575
|
* unregister fn. Prefer the `useRbSave()` hook.
|
|
3629
3576
|
*/
|
|
3630
3577
|
onSave: (getPayload: () => unknown) => () => void;
|
|
3631
|
-
/**
|
|
3632
|
-
* PCs allowed to talk to this plugin's ROS 2 nodes. ROS discovery is robot-local
|
|
3633
|
-
* (ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST); Muscat keeps this list per plugin, starts
|
|
3634
|
-
* the plugin with ROS_STATIC_PEERS set to it, and restarts the plugin when it changes.
|
|
3635
|
-
*/
|
|
3636
|
-
rosPeers: {
|
|
3637
|
-
get: () => Promise<string[]>;
|
|
3638
|
-
/** Saves the list and restarts the plugin backend. Rejects on an invalid IP. */
|
|
3639
|
-
set: (peers: string[]) => Promise<string[]>;
|
|
3640
|
-
};
|
|
3641
3578
|
}
|
|
3642
3579
|
/** Access the host SDK from within a plugin component. */
|
|
3643
3580
|
declare function useRb(): RbSdk;
|
|
@@ -3658,5 +3595,5 @@ declare function useRbFormData<T = unknown>(): T | undefined;
|
|
|
3658
3595
|
*/
|
|
3659
3596
|
declare function useRbSave<T = unknown>(getPayload: () => T): void;
|
|
3660
3597
|
|
|
3661
|
-
export {
|
|
3662
|
-
export type { PropsType$t as AccordionProps, AccordionVariantProps, PropsType$a as BadgeProps, BadgeVariantProps, BatteryProps, BatteryVariantProps, CardVariantProps, Props$h as CheckBoxProps, CheckBoxVariantProps, Props$g as CheckIconButtonProps, PropsType$h as ChipItemProps, PropsType$i as ChipTabProps, ChipVariantProps, PropsType$f as ChipsBoxItemProps, PropsType$g as ChipsBoxTabProps, Props$d as DateInputProps, PropsType$2 as DatePickerFooterButtonProps, PropsType$4 as DatePickerPresetProps, DatePickerTimeValue,
|
|
3598
|
+
export { HStack, RBSelectOption as Option, Accordion as RBAccordion, AccordionGroup as RBAccordionGroup, RBAlert, RBBadge, RBBattery, Calendar as RBCalendar, RBCard, RBCardAction, RBCardContent, RBCardDescription, RBCardFooter, RBCardHeader, RBCardHeaderText, RBCardPreviewSlot, RBCardTitle, CheckBox as RBCheckBox, RBCheckIconButton, RBCheckLabelButton, RBChipItem, RBChipTab, RBChipsBoxItem, RBChipsBoxTab, RBCommand, RBCommandDialog, RBCommandEmpty, RBCommandGroup, RBCommandInput, RBCommandItem, RBCommandList, RBCommandSelected, RBCommandSeparator, RBCommandShortcut, RBConfirm, DateInput as RBDateInput, RBDatePickerFooterButton, RBDatePickerFooterTime, RBDatePickerPreset, RBDialog, RBDialogClose, RBDialogContent, RBDialogDescription, RBDialogFooter, RBDialogHeader, RBDialogOverlay, RBDialogPortal, RBDialogTitle, RBDialogTrigger, RBDim, RBDivider, RBDrawer, RBDrawerBody, RBDrawerClose, RBDrawerContent, RBDrawerDescription, RBDrawerFooter, RBDrawerHeader, RBDrawerOverlay, RBDrawerPortal, RBDrawerTitle, RBDrawerTrigger, RBDropdownMenu, RBDropdownMenuCheckboxItem, RBDropdownMenuContent, RBDropdownMenuGroup, RBDropdownMenuItem, RBDropdownMenuLabel, RBDropdownMenuPortal, RBDropdownMenuRadioGroup, RBDropdownMenuRadioItem, RBDropdownMenuSeparator, RBDropdownMenuShortcut, RBDropdownMenuSub, RBDropdownMenuSubContent, RBDropdownMenuSubTrigger, RBDropdownMenuTrigger, RBEmptyView, RBIconButton, index as RBIcons, RBInlineLabelButton, RBJoyStick, RBLabelButton, RBLight, RBMenubar, RBMenubarCheckboxItem, RBMenubarContent, RBMenubarGroup, RBMenubarItem, RBMenubarLabel, RBMenubarMenu, RBMenubarPortal, RBMenubarRadioGroup, RBMenubarRadioItem, RBMenubarSeparator, RBMenubarShortcut, RBMenubarSub, RBMenubarSubContent, RBMenubarSubTrigger, RBMenubarTrigger, RBModal, MultiRangeInput as RBMultiRangeInput, RBNoData, RBPagination, RBPopover, RBPopoverAnchor, RBPopoverContent, RBPopoverPlacements, RBPopoverTrigger, RBPrompt, RBQrBarCodeGuideModal, RBRadioBox, RBRadioButton, RangeDateInput as RBRangeDateInput, RBResizable, RBResizableHandle, RBResizablePanel, RBResizable as RBResizablePanelGroup, RBSelectBox, RBSelectDropBox, RBSelectOption, RBSheet, RBSheetClose, RBSheetContent, RBSheetDescription, RBSheetFooter, RBSheetHeader, RBSheetOverlay, RBSheetPortal, RBSheetTitle, RBSheetTrigger, SideNumberInput as RBSideNumberInput, RBSimpleToast, RBSlider, RBSpinner, RBSwitch, RBSwitchField, RBTab, RBTabItem, RBTable, RBTableRow, RBTabs, RBTabsContent, RBTabsList, RBTabsTrigger, RBTdColumn, RBTdExpend, RBTextArea, RBTextField, RBTextHelperText, RBTextInput, RBTextLabel, RBToggle, RBToggleGroup, RBToggleGroupItem, RBTooltip, VStack, accordionVariants, badgeRootVariants, batteryFillVariants, cardRootVariants, checkBoxRootVariants, checkIconButtonVariants, checkLabelButtonVariants, chipRootVariants, dividerVariants, emptyViewRootVariants, iconButtonVariants, inlineLabelButtonVariants, labelButtonVariants, lightColors, lightSizes, radioRootVariants, selectTriggerVariants, sideNumberInputVariants, tabRootVariants, textAreaVariants, textInputVariants, useRb, useRbFormData, useRbSave };
|
|
3599
|
+
export type { PropsType$t as AccordionProps, AccordionVariantProps, PropsType$a as BadgeProps, BadgeVariantProps, BatteryProps, BatteryVariantProps, CardVariantProps, Props$h as CheckBoxProps, CheckBoxVariantProps, Props$g as CheckIconButtonProps, PropsType$h as ChipItemProps, PropsType$i as ChipTabProps, ChipVariantProps, PropsType$f as ChipsBoxItemProps, PropsType$g as ChipsBoxTabProps, Props$d as DateInputProps, PropsType$2 as DatePickerFooterButtonProps, PropsType$4 as DatePickerPresetProps, DatePickerTimeValue, PropsType$q as DimProps, DividerProps, DividerVariantProps, DrawerSide, DropdownItemVariant, PropsType$9 as EmptyViewProps, EmptyViewVariantProps, PropsType$b as ExpendProps, PropsType$1 as HStackProps, HelperTone, IconButtonProps, IconButtonVariantProps, InlineLabelButtonProps, InlineLabelButtonVariantProps, Props$3 as JoyStickProps, LabelButtonProps, LabelButtonVariantProps, LightProps, LightVariantProps, MenubarItemVariant, Props$4 as MultiRangeInputProps, Props$7 as PaginationProps, Props$b as RBAlertProps, RBCardContentProps, RBCardFooterProps, RBCardHeaderProps, RBCardHeaderTextProps, RBCardPreviewSlotProps, RBCardProps, RBCardTitleProps, Props$a as RBConfirmProps, RBDialogContentProps, RBDrawerContentProps, RBDrawerProps, RBPopoverContentProps, RBPopoverPlacement, Props$9 as RBPromptProps, PropsType$l as RBRadioBoxProps, RBResizableHandleProps, RBResizablePanelProps, RBResizableProps, PropsType$p as RBSelectBoxProps, RBSelectBoxRef, RBSheetContentProps, Props$1 as RBSimpleToastProps, RBSliderProps, PropsType$5 as RBSwitchFieldProps, RBSwitchProps, RBTabsContentProps, RBTabsListProps, RBTabsProps, RBTabsTriggerProps, Props$e as RBTextAreaProps, RBToggleGroupItemProps, RBToggleGroupProps, RBToggleProps, Props$5 as RadioButtonProps, RadioVariantProps, Props$c as RangeDateInputProps, RbJoyStickEventData, RbSdk, PropsType$o as SelectOptionProps, SelectTriggerVariantProps, SheetSide, Props$6 as SideNumberInputProps, SideNumberInputVariantProps, SwitchControlPlacement, SwitchSize, SwitchTone, SwitchType, PropsType$j as TabItemProps, PropsType$k as TabProps, TabVariantProps, PropsType$e as TableProps, PropsType$d as TableRowProps, TabsSize, TabsVariant, PropsType$c as TdColumnProps, TextAreaVariantProps, PropsType$7 as TextFieldProps, PropsType$r as TextHelperTextProps, PropsType$s as TextInputProps, TextInputVariantProps, PropsType$8 as TextLabelProps, ToggleGroupOrientation, ToggleVariantProps, PropsType$6 as TooltipProps, PropsType as VStackProps };
|
package/dist/sdk.d.ts
CHANGED
|
@@ -41,16 +41,6 @@ export interface RbSdk {
|
|
|
41
41
|
* unregister fn. Prefer the `useRbSave()` hook.
|
|
42
42
|
*/
|
|
43
43
|
onSave: (getPayload: () => unknown) => () => void;
|
|
44
|
-
/**
|
|
45
|
-
* PCs allowed to talk to this plugin's ROS 2 nodes. ROS discovery is robot-local
|
|
46
|
-
* (ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST); Muscat keeps this list per plugin, starts
|
|
47
|
-
* the plugin with ROS_STATIC_PEERS set to it, and restarts the plugin when it changes.
|
|
48
|
-
*/
|
|
49
|
-
rosPeers: {
|
|
50
|
-
get: () => Promise<string[]>;
|
|
51
|
-
/** Saves the list and restarts the plugin backend. Rejects on an invalid IP. */
|
|
52
|
-
set: (peers: string[]) => Promise<string[]>;
|
|
53
|
-
};
|
|
54
44
|
}
|
|
55
45
|
export declare const RbContext: import("react").Context<RbSdk>;
|
|
56
46
|
/** Access the host SDK from within a plugin component. */
|
package/dist/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,YAAY,IAAI,UAAU,EAC1B,WAAW,IAAI,SAAS,EACzB,MAAM,MAAM,CAAC;AAGd,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAEpE,MAAM,WAAW,KAAK;IACpB;;;;OAIG;IACH,GAAG,EAAE,CAAC,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3D,+DAA+D;IAC/D,GAAG,EAAE,CAAC,CAAC,GAAG,GAAG,EACX,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,KAC1B,OAAO,CAAC,UAAU,CAAC,CAAC;IAEzB;;;OAGG;IACH,MAAM,EAAE,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,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package/dist/sdk.js
CHANGED
|
@@ -33,16 +33,6 @@ const noopSdk = {
|
|
|
33
33
|
},
|
|
34
34
|
data: void 0,
|
|
35
35
|
onSave: () => () => {
|
|
36
|
-
},
|
|
37
|
-
rosPeers: {
|
|
38
|
-
get: async () => {
|
|
39
|
-
console.warn("[plugin-ui] rb.rosPeers called outside of a host context");
|
|
40
|
-
return [];
|
|
41
|
-
},
|
|
42
|
-
set: async () => {
|
|
43
|
-
console.warn("[plugin-ui] rb.rosPeers called outside of a host context");
|
|
44
|
-
return [];
|
|
45
|
-
}
|
|
46
36
|
}
|
|
47
37
|
};
|
|
48
38
|
const RbContext = createContext(noopSdk);
|
package/dist/sdk.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/sdk.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * Plugin runtime SDK (`useRb()`).\n *\n * pub/sub/action/serve talk to the Zenoh router over WebSocket. Topics are\n * namespaced to {pluginId}/... ; a leading \"/\" makes the path absolute.\n * alert/confirm/prompt/toast delegate to the host.\n */\nimport { createContext, useContext, useEffect, useRef } from \"react\";\nimport type {\n WsSubscriber as Subscriber,\n WsQueryable as Queryable,\n} from \"./ws\";\n// Type-only import \u2014 no runtime coupling to host-ui.ts (which itself has no\n// dependency back on sdk.ts, so this stays one-directional).\nimport type { PluginUIServices } from \"./host-ui\";\n\nexport type RbNotifyType = \"info\" | \"success\" | \"warning\" | \"error\";\n\nexport interface RbSdk {\n /**\n * Publish JSON payload to a topic.\n * \"sensor/data\" \u2192 {pluginId}/sensor/data\n * \"/broadcast/x\" \u2192 broadcast/x (absolute)\n */\n pub: <P = any>(topic: string, payload: P) => Promise<void>;\n\n /** Subscribe to a topic. Returns a handle with undeclare(). */\n sub: <P = any>(\n topic: string,\n handler: (payload: P) => void,\n ) => Promise<Subscriber>;\n\n /**\n * Send a request and await the first reply (Zenoh query).\n * Use this to call a backend handler registered with rb.serve() / ZenohRouter.\n */\n action: <R = any, P = any>(topic: string, payload?: P) => Promise<R>;\n\n /**\n * Register a queryable \u2014 the frontend responds to backend queries.\n * Mirror of rb.action() on the other side.\n */\n serve: <P = any, R = any>(\n topic: string,\n handler: (payload?: P) => R | Promise<R>,\n ) => Promise<Queryable>;\n\n /** Show a transient notification through the host's toast system. */\n toast: PluginUIServices[\"toast\"];\n\n /** Show a host alert dialog. */\n alert: PluginUIServices[\"alert\"];\n /** Show a host confirm dialog. Resolves true/false. */\n confirm: PluginUIServices[\"confirm\"];\n /** Show a host prompt dialog. Resolves the entered value, or undefined if cancelled. */\n prompt: PluginUIServices[\"prompt\"];\n\n /**\n * Host-provided initial data for this mount \u2014 e.g. the previously-saved\n * values when the host re-opens a form. `undefined` for a fresh mount.\n * Prefer the `useRbFormData()` hook over reading this directly.\n */\n data?: unknown;\n\n /**\n * Register a getter the host calls (synchronously) to collect this plugin's\n * save payload \u2014 e.g. when the host's Save button is clicked. The returned\n * value must be JSON-serialisable (the host persists it). Returns an\n * unregister fn. Prefer the `useRbSave()` hook.\n */\n onSave: (getPayload: () => unknown) => () => void;\n
|
|
5
|
-
"mappings": "AAQA,SAAS,eAAe,YAAY,WAAW,cAAc;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * Plugin runtime SDK (`useRb()`).\n *\n * pub/sub/action/serve talk to the Zenoh router over WebSocket. Topics are\n * namespaced to {pluginId}/... ; a leading \"/\" makes the path absolute.\n * alert/confirm/prompt/toast delegate to the host.\n */\nimport { createContext, useContext, useEffect, useRef } from \"react\";\nimport type {\n WsSubscriber as Subscriber,\n WsQueryable as Queryable,\n} from \"./ws\";\n// Type-only import \u2014 no runtime coupling to host-ui.ts (which itself has no\n// dependency back on sdk.ts, so this stays one-directional).\nimport type { PluginUIServices } from \"./host-ui\";\n\nexport type RbNotifyType = \"info\" | \"success\" | \"warning\" | \"error\";\n\nexport interface RbSdk {\n /**\n * Publish JSON payload to a topic.\n * \"sensor/data\" \u2192 {pluginId}/sensor/data\n * \"/broadcast/x\" \u2192 broadcast/x (absolute)\n */\n pub: <P = any>(topic: string, payload: P) => Promise<void>;\n\n /** Subscribe to a topic. Returns a handle with undeclare(). */\n sub: <P = any>(\n topic: string,\n handler: (payload: P) => void,\n ) => Promise<Subscriber>;\n\n /**\n * Send a request and await the first reply (Zenoh query).\n * Use this to call a backend handler registered with rb.serve() / ZenohRouter.\n */\n action: <R = any, P = any>(topic: string, payload?: P) => Promise<R>;\n\n /**\n * Register a queryable \u2014 the frontend responds to backend queries.\n * Mirror of rb.action() on the other side.\n */\n serve: <P = any, R = any>(\n topic: string,\n handler: (payload?: P) => R | Promise<R>,\n ) => Promise<Queryable>;\n\n /** Show a transient notification through the host's toast system. */\n toast: PluginUIServices[\"toast\"];\n\n /** Show a host alert dialog. */\n alert: PluginUIServices[\"alert\"];\n /** Show a host confirm dialog. Resolves true/false. */\n confirm: PluginUIServices[\"confirm\"];\n /** Show a host prompt dialog. Resolves the entered value, or undefined if cancelled. */\n prompt: PluginUIServices[\"prompt\"];\n\n /**\n * Host-provided initial data for this mount \u2014 e.g. the previously-saved\n * values when the host re-opens a form. `undefined` for a fresh mount.\n * Prefer the `useRbFormData()` hook over reading this directly.\n */\n data?: unknown;\n\n /**\n * Register a getter the host calls (synchronously) to collect this plugin's\n * save payload \u2014 e.g. when the host's Save button is clicked. The returned\n * value must be JSON-serialisable (the host persists it). Returns an\n * unregister fn. Prefer the `useRbSave()` hook.\n */\n onSave: (getPayload: () => unknown) => () => void;\n}\n\nconst noopSdk: RbSdk = {\n pub: async <P = any>(_topic?: string, _payload?: P) => {\n console.warn(\"[plugin-ui] rb.pub called outside of a host context\");\n },\n sub: async <P = any>(_topic?: string, _handler?: (payload: P) => void) => {\n console.warn(\"[plugin-ui] rb.sub called outside of a host context\");\n return { undeclare: async () => {} } as unknown as Subscriber;\n },\n action: async <R = any, P = any>(_topic?: string, _payload?: P) => {\n console.warn(\"[plugin-ui] rb.action called outside of a host context\");\n return undefined as R;\n },\n serve: async <P = any, R = any>(\n _topic?: string,\n _handler?: (payload?: P) => R,\n ) => {\n console.warn(\"[plugin-ui] rb.serve called outside of a host context\");\n return { undeclare: async () => {} } as unknown as Queryable;\n },\n toast: (params) => {\n console.warn(\"[plugin-ui] rb.toast (no host):\", params);\n },\n alert: async (_) => {\n console.warn(\"[plugin-ui] rb.alert called outside of a host context\");\n },\n confirm: async (_) => {\n console.warn(\"[plugin-ui] rb.confirm called outside of a host context\");\n return false;\n },\n prompt: async (_) => {\n console.warn(\"[plugin-ui] rb.prompt called outside of a host context\");\n return undefined;\n },\n data: undefined,\n onSave: () => () => {},\n};\n\nexport const RbContext = createContext<RbSdk>(noopSdk);\n\n/** Access the host SDK from within a plugin component. */\nexport function useRb(): RbSdk {\n return useContext(RbContext);\n}\n\n/**\n * Read the host-provided initial data for this mount (e.g. previously-saved\n * form values). `undefined` for a fresh mount.\n *\n * const saved = useRbFormData<MyArgs>();\n * const methods = useForm({ defaultValues: saved ?? DEFAULTS });\n */\nexport function useRbFormData<T = unknown>(): T | undefined {\n return useRb().data as T | undefined;\n}\n\n/**\n * Register a getter the host calls to collect this plugin's save payload when\n * the host's Save is clicked. The latest `getPayload` is always used, so it can\n * close over current state. The returned value must be JSON-serialisable.\n *\n * useRbSave(() => ({ args: getValues(), summary: buildSummary() }));\n */\nexport function useRbSave<T = unknown>(getPayload: () => T): void {\n const rb = useRb();\n const ref = useRef(getPayload);\n ref.current = getPayload;\n useEffect(() => rb.onSave(() => ref.current()), [rb]);\n}\n"],
|
|
5
|
+
"mappings": "AAQA,SAAS,eAAe,YAAY,WAAW,cAAc;AAkE7D,MAAM,UAAiB;AAAA,EACrB,KAAK,OAAgB,QAAiB,aAAiB;AACrD,YAAQ,KAAK,qDAAqD;AAAA,EACpE;AAAA,EACA,KAAK,OAAgB,QAAiB,aAAoC;AACxE,YAAQ,KAAK,qDAAqD;AAClE,WAAO,EAAE,WAAW,YAAY;AAAA,IAAC,EAAE;AAAA,EACrC;AAAA,EACA,QAAQ,OAAyB,QAAiB,aAAiB;AACjE,YAAQ,KAAK,wDAAwD;AACrE,WAAO;AAAA,EACT;AAAA,EACA,OAAO,OACL,QACA,aACG;AACH,YAAQ,KAAK,uDAAuD;AACpE,WAAO,EAAE,WAAW,YAAY;AAAA,IAAC,EAAE;AAAA,EACrC;AAAA,EACA,OAAO,CAAC,WAAW;AACjB,YAAQ,KAAK,mCAAmC,MAAM;AAAA,EACxD;AAAA,EACA,OAAO,OAAO,MAAM;AAClB,YAAQ,KAAK,uDAAuD;AAAA,EACtE;AAAA,EACA,SAAS,OAAO,MAAM;AACpB,YAAQ,KAAK,yDAAyD;AACtE,WAAO;AAAA,EACT;AAAA,EACA,QAAQ,OAAO,MAAM;AACnB,YAAQ,KAAK,wDAAwD;AACrE,WAAO;AAAA,EACT;AAAA,EACA,MAAM;AAAA,EACN,QAAQ,MAAM,MAAM;AAAA,EAAC;AACvB;AAEO,MAAM,YAAY,cAAqB,OAAO;AAG9C,SAAS,QAAe;AAC7B,SAAO,WAAW,SAAS;AAC7B;AASO,SAAS,gBAA4C;AAC1D,SAAO,MAAM,EAAE;AACjB;AASO,SAAS,UAAuB,YAA2B;AAChE,QAAM,KAAK,MAAM;AACjB,QAAM,MAAM,OAAO,UAAU;AAC7B,MAAI,UAAU;AACd,YAAU,MAAM,GAAG,OAAO,MAAM,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;AACtD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/ws.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ export declare class RbWs {
|
|
|
10
10
|
private readonly _subHandlers;
|
|
11
11
|
private readonly _serveHandlers;
|
|
12
12
|
private constructor();
|
|
13
|
-
get pluginId(): string;
|
|
14
13
|
static connect(url: string, pluginId: string): Promise<RbWs>;
|
|
15
14
|
private _key;
|
|
16
15
|
pub<P = any>(topic: string, payload: P): Promise<void>;
|
|
@@ -70,9 +69,5 @@ export declare function createLazyRbSdk(wsPromise: Promise<RbWs>, services: Plug
|
|
|
70
69
|
}) => Promise<string | undefined>;
|
|
71
70
|
data: unknown;
|
|
72
71
|
onSave: (getPayload: () => unknown) => () => void;
|
|
73
|
-
rosPeers: {
|
|
74
|
-
get: () => Promise<string[]>;
|
|
75
|
-
set: (peers: string[]) => Promise<string[]>;
|
|
76
|
-
};
|
|
77
72
|
};
|
|
78
73
|
//# sourceMappingURL=ws.d.ts.map
|
package/dist/ws.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../src/ws.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,MAAM,WAAW,QAAQ;IACvB,SAAS,IAAI,IAAI,CAAC;CACnB;AAED,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;AACpC,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;AAMnC,qBAAa,IAAI;IACf,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAGzB;IACJ,OAAO,CAAC,QAAQ,CAAC,cAAc,CAG3B;IAEJ,OAAO;
|
|
1
|
+
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../src/ws.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,MAAM,WAAW,QAAQ;IACvB,SAAS,IAAI,IAAI,CAAC;CACnB;AAED,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;AACpC,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;AAMnC,qBAAa,IAAI;IACf,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,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AGX,MAAM,YAAY,GAAG;mBAGlC,MAAM,WAEJ,CAAC,OAAO,CAAC,EAAE,GAAG,KAAK,GAAG;;aA1MtB,CAAC;;YAIE,CAAC;mBAGF,CAAC;yBAA+B,CAAC;0BAC7B,CAAC;gBAAuB,CAAC;eAAqB,CAAC;;;aApB1B,CAAA;;kBAC9B,CAAC;;;aACgB,CAAC;;kBAExB,CAAC;;;;;;aAEF,CAAD;;aAED,CAAC;mBAAyB,CAAC;kBAC3B,CAAA;;;;;;yBA2LuB,MAAM,OAAO,KAAK,MAAM,IAAI;EA2BrD"}
|
package/dist/ws.js
CHANGED
|
@@ -10,10 +10,6 @@ class RbWs {
|
|
|
10
10
|
constructor(socket, pluginId) {
|
|
11
11
|
this._socket = socket;
|
|
12
12
|
this._pluginId = pluginId;
|
|
13
|
-
socket.io.on("reconnect", () => {
|
|
14
|
-
for (const topic of this._subHandlers.keys()) socket.emit("sub", { topic });
|
|
15
|
-
for (const topic of this._serveHandlers.keys()) socket.emit("serve_register", { topic });
|
|
16
|
-
});
|
|
17
13
|
socket.on(
|
|
18
14
|
"msg",
|
|
19
15
|
({ topic, payload }) => {
|
|
@@ -33,9 +29,6 @@ class RbWs {
|
|
|
33
29
|
}
|
|
34
30
|
);
|
|
35
31
|
}
|
|
36
|
-
get pluginId() {
|
|
37
|
-
return this._pluginId;
|
|
38
|
-
}
|
|
39
32
|
static connect(url, pluginId) {
|
|
40
33
|
return new Promise((resolve, reject) => {
|
|
41
34
|
const socket = io(url, { transports: ["websocket"] });
|
|
@@ -138,23 +131,9 @@ function createLazyRbSdk(wsPromise, services, mount) {
|
|
|
138
131
|
prompt: services.prompt,
|
|
139
132
|
data: mount?.data,
|
|
140
133
|
onSave: mount?.onSave ?? (() => () => {
|
|
141
|
-
}),
|
|
142
|
-
rosPeers: rosPeersApi(async (op, payload) => {
|
|
143
|
-
const ws = await wsPromise;
|
|
144
|
-
return ws.action(`/muscat/plugin/${ws.pluginId}/ros_peers/${op}`, payload);
|
|
145
134
|
})
|
|
146
135
|
};
|
|
147
136
|
}
|
|
148
|
-
function rosPeersApi(call) {
|
|
149
|
-
return {
|
|
150
|
-
get: async () => (await call("get"))?.peers ?? [],
|
|
151
|
-
set: async (peers) => {
|
|
152
|
-
const r = await call("set", { peers });
|
|
153
|
-
if (!r?.ok) throw new Error(r?.error ?? "rb.rosPeers.set failed");
|
|
154
|
-
return r.peers;
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
137
|
export {
|
|
159
138
|
RbWs,
|
|
160
139
|
createLazyRbSdk
|
package/dist/ws.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/ws.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Socket.IO communication client for plugin frontends.\n *\n * Topics are automatically namespaced to prevent cross-plugin collisions:\n * \"sensor/data\" \u2192 \"{pluginId}/sensor/data\"\n * \"/broadcast/x\" \u2192 \"broadcast/x\" (leading slash = absolute)\n *\n * Browser \u2190\u2192 Python backend protocol:\n * browser emits : sub, unsub, pub, action (with ack), serve_reply\n * server emits : msg, serve_call\n */\nimport { io, type Socket } from \"socket.io-client\";\n// Type-only \u2014 no runtime coupling to host-ui.ts.\nimport type { PluginUIServices } from \"./host-ui\";\n\nexport interface WsHandle {\n undeclare(): void;\n}\n\nexport type WsSubscriber = WsHandle;\nexport type WsQueryable = WsHandle;\n\nfunction resolveTopic(pluginId: string, topic: string): string {\n return topic.startsWith(\"/\") ? topic.slice(1) : `${pluginId}/${topic}`;\n}\n\nexport class RbWs {\n private readonly _socket: Socket;\n private readonly _pluginId: string;\n private readonly _subHandlers = new Map<\n string,\n Set<(payload: unknown) => void>\n >();\n private readonly _serveHandlers = new Map<\n string,\n (payload?: unknown) => unknown | Promise<unknown>\n >();\n\n private constructor(socket: Socket, pluginId: string) {\n this._socket = socket;\n this._pluginId = pluginId;\n\n //
|
|
5
|
-
"mappings": "AAWA,SAAS,UAAuB;AAWhC,SAAS,aAAa,UAAkB,OAAuB;AAC7D,SAAO,MAAM,WAAW,GAAG,IAAI,MAAM,MAAM,CAAC,IAAI,GAAG,QAAQ,IAAI,KAAK;AACtE;AAEO,MAAM,KAAK;AAAA,EACC;AAAA,EACA;AAAA,EACA,eAAe,oBAAI,IAGlC;AAAA,EACe,iBAAiB,oBAAI,IAGpC;AAAA,EAEM,YAAY,QAAgB,UAAkB;AACpD,SAAK,UAAU;AACf,SAAK,YAAY;
|
|
4
|
+
"sourcesContent": ["/**\n * Socket.IO communication client for plugin frontends.\n *\n * Topics are automatically namespaced to prevent cross-plugin collisions:\n * \"sensor/data\" \u2192 \"{pluginId}/sensor/data\"\n * \"/broadcast/x\" \u2192 \"broadcast/x\" (leading slash = absolute)\n *\n * Browser \u2190\u2192 Python backend protocol:\n * browser emits : sub, unsub, pub, action (with ack), serve_reply\n * server emits : msg, serve_call\n */\nimport { io, type Socket } from \"socket.io-client\";\n// Type-only \u2014 no runtime coupling to host-ui.ts.\nimport type { PluginUIServices } from \"./host-ui\";\n\nexport interface WsHandle {\n undeclare(): void;\n}\n\nexport type WsSubscriber = WsHandle;\nexport type WsQueryable = WsHandle;\n\nfunction resolveTopic(pluginId: string, topic: string): string {\n return topic.startsWith(\"/\") ? topic.slice(1) : `${pluginId}/${topic}`;\n}\n\nexport class RbWs {\n private readonly _socket: Socket;\n private readonly _pluginId: string;\n private readonly _subHandlers = new Map<\n string,\n Set<(payload: unknown) => void>\n >();\n private readonly _serveHandlers = new Map<\n string,\n (payload?: unknown) => unknown | Promise<unknown>\n >();\n\n private constructor(socket: Socket, pluginId: string) {\n this._socket = socket;\n this._pluginId = pluginId;\n\n // Deliver incoming pub/sub messages to registered handlers\n socket.on(\n \"msg\",\n ({ topic, payload }: { topic: string; payload: unknown }) => {\n this._subHandlers.get(topic)?.forEach((h) => h(payload));\n },\n );\n\n // Python calls a browser-side serve handler\n socket.on(\n \"serve_call\",\n async ({\n id,\n topic,\n payload,\n }: {\n id: string;\n topic: string;\n payload: unknown;\n }) => {\n const handler = this._serveHandlers.get(topic);\n const result = handler ? await handler(payload) : undefined;\n socket.emit(\"serve_reply\", { id, payload: result });\n },\n );\n }\n\n static connect(url: string, pluginId: string): Promise<RbWs> {\n return new Promise((resolve, reject) => {\n const socket = io(url, { transports: [\"websocket\"] });\n const onConnect = () => {\n cleanup();\n resolve(new RbWs(socket, pluginId));\n };\n const onError = (err: Error) => {\n cleanup();\n reject(err);\n };\n const cleanup = () => {\n socket.off(\"connect\", onConnect);\n socket.off(\"connect_error\", onError);\n };\n socket.once(\"connect\", onConnect);\n socket.once(\"connect_error\", onError);\n });\n }\n\n private _key(topic: string): string {\n return resolveTopic(this._pluginId, topic);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async pub<P = any>(topic: string, payload: P): Promise<void> {\n this._socket.emit(\"pub\", { topic: this._key(topic), payload });\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async sub<P = any>(\n topic: string,\n handler: (payload: P) => void,\n ): Promise<WsSubscriber> {\n const key = this._key(topic);\n if (!this._subHandlers.has(key)) {\n this._subHandlers.set(key, new Set());\n this._socket.emit(\"sub\", { topic: key });\n }\n const h = handler as (payload: unknown) => void;\n this._subHandlers.get(key)!.add(h);\n return {\n undeclare: () => {\n const set = this._subHandlers.get(key);\n if (!set) return;\n set.delete(h);\n if (set.size === 0) {\n this._subHandlers.delete(key);\n this._socket.emit(\"unsub\", { topic: key });\n }\n },\n };\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async action<R = any, P = any>(topic: string, payload?: P): Promise<R> {\n const key = this._key(topic);\n return new Promise((resolve, reject) => {\n this._socket\n .timeout(10_000)\n .emit(\n \"action\",\n { topic: key, payload },\n (err: Error | null, result: R) => {\n if (err) {\n // socket.io ack timeout \u2014 the bridge itself never answered.\n reject(new Error(`action \"${key}\": no ack from bridge (${err.message})`));\n } else if (\n result &&\n typeof result === \"object\" &&\n \"error\" in result &&\n typeof result.error === \"string\"\n ) {\n // Backend handler returned an error payload \u2014 surface it verbatim.\n reject(new Error(result.error));\n } else if (result === undefined || result === null) {\n // The bridge acked but with no payload: the backend handler is\n // registered yet didn't reply in time (hung inside the handler,\n // e.g. a blocked SDK call) or returned nothing. Distinct from a\n // \"No handler registered\" error, which comes back as result.error.\n reject(\n new Error(\n `action \"${key}\": no reply from plugin backend \u2014 the handler was reached but didn't return in time (check the backend's stdout on the robot).`,\n ),\n );\n } else {\n resolve(result);\n }\n },\n );\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async serve<P = any, R = any>(\n topic: string,\n handler: (payload?: P) => R | Promise<R>,\n ): Promise<WsQueryable> {\n const key = this._key(topic);\n this._serveHandlers.set(key, handler as (payload?: unknown) => unknown);\n this._socket.emit(\"serve_register\", { topic: key });\n return {\n undeclare: () => {\n this._serveHandlers.delete(key);\n this._socket.emit(\"serve_unregister\", { topic: key });\n },\n };\n }\n\n close(): void {\n this._socket.disconnect();\n }\n}\n\n/**\n * Builds an rb-sdk-shaped object (pub/sub/action/serve + the passed-through\n * toast/alert/confirm/prompt) that lazily awaits a not-yet-connected `RbWs` \u2014\n * so callers don't block their first render on the WebSocket handshake (there\n * may be no backend reachable yet). Shared by both host mount paths (see\n * ./host.tsx and muscat-plugin-kit's dev bootstrap), which otherwise\n * duplicate this wiring.\n */\nexport function createLazyRbSdk(\n wsPromise: Promise<RbWs>,\n services: PluginUIServices,\n // Per-mount, host-provided (unlike `services`, which is a global singleton):\n // initial `data` and the `onSave` registration the host reads back. Plain\n // values/closures, so they cross the dev React-instance boundary safely.\n mount?: {\n data?: unknown;\n onSave?: (getPayload: () => unknown) => () => void;\n },\n) {\n return {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n pub: async (topic: string, payload: any) =>\n (await wsPromise).pub(topic, payload),\n sub: async (\n topic: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n handler: (payload: any) => void,\n ) => (await wsPromise).sub(topic, handler),\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n action: async (topic: string, payload?: any) =>\n (await wsPromise).action(topic, payload),\n serve: async (\n topic: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n handler: (payload?: any) => any,\n ) => (await wsPromise).serve(topic, handler),\n toast: services.toast,\n alert: services.alert,\n confirm: services.confirm,\n prompt: services.prompt,\n data: mount?.data,\n onSave: mount?.onSave ?? (() => () => {}),\n };\n}\n"],
|
|
5
|
+
"mappings": "AAWA,SAAS,UAAuB;AAWhC,SAAS,aAAa,UAAkB,OAAuB;AAC7D,SAAO,MAAM,WAAW,GAAG,IAAI,MAAM,MAAM,CAAC,IAAI,GAAG,QAAQ,IAAI,KAAK;AACtE;AAEO,MAAM,KAAK;AAAA,EACC;AAAA,EACA;AAAA,EACA,eAAe,oBAAI,IAGlC;AAAA,EACe,iBAAiB,oBAAI,IAGpC;AAAA,EAEM,YAAY,QAAgB,UAAkB;AACpD,SAAK,UAAU;AACf,SAAK,YAAY;AAGjB,WAAO;AAAA,MACL;AAAA,MACA,CAAC,EAAE,OAAO,QAAQ,MAA2C;AAC3D,aAAK,aAAa,IAAI,KAAK,GAAG,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;AAAA,MACzD;AAAA,IACF;AAGA,WAAO;AAAA,MACL;AAAA,MACA,OAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACF,MAIM;AACJ,cAAM,UAAU,KAAK,eAAe,IAAI,KAAK;AAC7C,cAAM,SAAS,UAAU,MAAM,QAAQ,OAAO,IAAI;AAClD,eAAO,KAAK,eAAe,EAAE,IAAI,SAAS,OAAO,CAAC;AAAA,MACpD;AAAA,IACF;AAAA,EACF;AAAA,EAEA,OAAO,QAAQ,KAAa,UAAiC;AAC3D,WAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,YAAM,SAAS,GAAG,KAAK,EAAE,YAAY,CAAC,WAAW,EAAE,CAAC;AACpD,YAAM,YAAY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C,OAAO,OACL,OAEA,aACI,MAAM,WAAW,MAAM,OAAO,OAAO;AAAA,IAC3C,OAAO,SAAS;AAAA,IAChB,OAAO,SAAS;AAAA,IAChB,SAAS,SAAS;AAAA,IAClB,QAAQ,SAAS;AAAA,IACjB,MAAM,OAAO;AAAA,IACb,QAAQ,OAAO,WAAW,MAAM,MAAM;AAAA,IAAC;AAAA,EACzC;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rainbow-robotics/plugin-ui",
|
|
3
|
-
"version": "1.3.6-dev.
|
|
3
|
+
"version": "1.3.6-dev.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"build": "node build-dist.mjs",
|
|
48
48
|
"build-plugin-ui": "node build-dist.mjs",
|
|
49
49
|
"lint": "node ../../node_modules/eslint/bin/eslint.js .",
|
|
50
|
-
"check-types": "tsc --noEmit
|
|
50
|
+
"check-types": "tsc --noEmit"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@repo/eslint-config": "*",
|
package/src/manifest.ts
CHANGED
|
@@ -119,8 +119,6 @@ export function validateManifest(value: unknown): string[] {
|
|
|
119
119
|
const m = value as Record<string, unknown>;
|
|
120
120
|
if (typeof m.id !== "string" || m.id.length === 0)
|
|
121
121
|
errors.push("manifest.id is required (string)");
|
|
122
|
-
else if (!/^[a-z][a-z0-9]*(-[a-z0-9]+)*(\.[a-z][a-z0-9]*(-[a-z0-9]+)*)*$/.test(m.id))
|
|
123
|
-
errors.push('manifest.id must be "."-separated parts of lowercase letters/digits and single "-", each starting with a letter (e.g. com.example.my-plugin)');
|
|
124
122
|
if (typeof m.name !== "string" || m.name.length === 0)
|
|
125
123
|
errors.push("manifest.name is required (string)");
|
|
126
124
|
if (typeof m.version !== "string" || m.version.length === 0)
|
package/src/sdk.ts
CHANGED
|
@@ -70,17 +70,6 @@ export interface RbSdk {
|
|
|
70
70
|
* unregister fn. Prefer the `useRbSave()` hook.
|
|
71
71
|
*/
|
|
72
72
|
onSave: (getPayload: () => unknown) => () => void;
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* PCs allowed to talk to this plugin's ROS 2 nodes. ROS discovery is robot-local
|
|
76
|
-
* (ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST); Muscat keeps this list per plugin, starts
|
|
77
|
-
* the plugin with ROS_STATIC_PEERS set to it, and restarts the plugin when it changes.
|
|
78
|
-
*/
|
|
79
|
-
rosPeers: {
|
|
80
|
-
get: () => Promise<string[]>;
|
|
81
|
-
/** Saves the list and restarts the plugin backend. Rejects on an invalid IP. */
|
|
82
|
-
set: (peers: string[]) => Promise<string[]>;
|
|
83
|
-
};
|
|
84
73
|
}
|
|
85
74
|
|
|
86
75
|
const noopSdk: RbSdk = {
|
|
@@ -118,16 +107,6 @@ const noopSdk: RbSdk = {
|
|
|
118
107
|
},
|
|
119
108
|
data: undefined,
|
|
120
109
|
onSave: () => () => {},
|
|
121
|
-
rosPeers: {
|
|
122
|
-
get: async () => {
|
|
123
|
-
console.warn("[plugin-ui] rb.rosPeers called outside of a host context");
|
|
124
|
-
return [];
|
|
125
|
-
},
|
|
126
|
-
set: async () => {
|
|
127
|
-
console.warn("[plugin-ui] rb.rosPeers called outside of a host context");
|
|
128
|
-
return [];
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
110
|
};
|
|
132
111
|
|
|
133
112
|
export const RbContext = createContext<RbSdk>(noopSdk);
|
package/src/ws.ts
CHANGED
|
@@ -40,13 +40,6 @@ export class RbWs {
|
|
|
40
40
|
this._socket = socket;
|
|
41
41
|
this._pluginId = pluginId;
|
|
42
42
|
|
|
43
|
-
// The gateway keeps subscriptions/serve registrations in memory — re-send them after
|
|
44
|
-
// a reconnect (e.g. the gateway restarted), or they silently stop working.
|
|
45
|
-
socket.io.on("reconnect", () => {
|
|
46
|
-
for (const topic of this._subHandlers.keys()) socket.emit("sub", { topic });
|
|
47
|
-
for (const topic of this._serveHandlers.keys()) socket.emit("serve_register", { topic });
|
|
48
|
-
});
|
|
49
|
-
|
|
50
43
|
// Deliver incoming pub/sub messages to registered handlers
|
|
51
44
|
socket.on(
|
|
52
45
|
"msg",
|
|
@@ -74,10 +67,6 @@ export class RbWs {
|
|
|
74
67
|
);
|
|
75
68
|
}
|
|
76
69
|
|
|
77
|
-
get pluginId(): string {
|
|
78
|
-
return this._pluginId;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
70
|
static connect(url: string, pluginId: string): Promise<RbWs> {
|
|
82
71
|
return new Promise((resolve, reject) => {
|
|
83
72
|
const socket = io(url, { transports: ["websocket"] });
|
|
@@ -234,22 +223,5 @@ export function createLazyRbSdk(
|
|
|
234
223
|
prompt: services.prompt,
|
|
235
224
|
data: mount?.data,
|
|
236
225
|
onSave: mount?.onSave ?? (() => () => {}),
|
|
237
|
-
rosPeers: rosPeersApi(async (op, payload) => {
|
|
238
|
-
const ws = await wsPromise;
|
|
239
|
-
return ws.action(`/muscat/plugin/${ws.pluginId}/ros_peers/${op}`, payload);
|
|
240
|
-
}),
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// Answered by Muscat (common) on the robot and by `muscat-pk dev` locally.
|
|
245
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
246
|
-
function rosPeersApi(call: (op: "get" | "set", payload?: any) => Promise<any>) {
|
|
247
|
-
return {
|
|
248
|
-
get: async (): Promise<string[]> => (await call("get"))?.peers ?? [],
|
|
249
|
-
set: async (peers: string[]): Promise<string[]> => {
|
|
250
|
-
const r = await call("set", { peers });
|
|
251
|
-
if (!r?.ok) throw new Error(r?.error ?? "rb.rosPeers.set failed");
|
|
252
|
-
return r.peers;
|
|
253
|
-
},
|
|
254
226
|
};
|
|
255
227
|
}
|