@rainbow-robotics/plugin-ui 0.1.2-dev.6 → 0.1.2-dev.7
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/build-browser.mjs +1 -39
- package/dist/connect.d.ts.map +1 -1
- package/dist/connect.js +7 -7
- package/dist/connect.js.map +2 -2
- package/dist/sdk.d.ts +1 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js.map +1 -1
- package/dist/ws.d.ts +20 -0
- package/dist/ws.d.ts.map +1 -0
- package/dist-browser/@rainbow-robotics/plugin-ui/chunks/chunk-37HVFFJB.js +1 -0
- package/dist-browser/@rainbow-robotics/plugin-ui/chunks/{chunk-3DOWEHFU.js → chunk-4MGSRUAS.js} +1 -1
- package/dist-browser/@rainbow-robotics/plugin-ui/connect.js +1 -1
- package/dist-browser/@rainbow-robotics/plugin-ui/elements.js +1 -1
- package/dist-browser/@rainbow-robotics/plugin-ui/react.js +1 -1
- package/dist-browser/@rainbow-robotics/plugin-ui/sdk.js +1 -1
- package/package.json +4 -9
- package/src/connect.ts +11 -13
- package/src/host.tsx +29 -16
- package/src/sdk.ts +1 -1
- package/src/ws.ts +120 -0
- package/dist/zenoh.d.ts +0 -29
- package/dist/zenoh.d.ts.map +0 -1
- package/dist-browser/@rainbow-robotics/plugin-ui/chunks/chunk-HJVATDC6.js +0 -1
- package/src/zenoh.ts +0 -122
package/build-browser.mjs
CHANGED
|
@@ -8,47 +8,10 @@
|
|
|
8
8
|
//
|
|
9
9
|
// Run: node libraries/plugin-ui/build-browser.mjs
|
|
10
10
|
import { build } from "esbuild";
|
|
11
|
-
import { mkdirSync,
|
|
11
|
+
import { mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
12
12
|
import { dirname, resolve } from "node:path";
|
|
13
13
|
import { fileURLToPath } from "node:url";
|
|
14
14
|
|
|
15
|
-
// esbuild plugin: handle wasm-bindgen "bundler" target .wasm ESM imports.
|
|
16
|
-
// These are `import * as wasm from "./foo_bg.wasm"` patterns generated by wasm-bindgen.
|
|
17
|
-
// esbuild has no native WASM loader for this pattern; we inline the binary as base64
|
|
18
|
-
// and synchronously instantiate it with the _bg.js imports at module evaluation time.
|
|
19
|
-
const wasmBindgenPlugin = {
|
|
20
|
-
name: "wasm-bindgen",
|
|
21
|
-
setup(build) {
|
|
22
|
-
build.onResolve({ filter: /\.wasm$/ }, (args) => ({
|
|
23
|
-
path: resolve(args.resolveDir, args.path),
|
|
24
|
-
namespace: "wasm-bindgen",
|
|
25
|
-
}));
|
|
26
|
-
|
|
27
|
-
build.onLoad({ filter: /.*/, namespace: "wasm-bindgen" }, (args) => {
|
|
28
|
-
const bytes = readFileSync(args.path);
|
|
29
|
-
const mod = new WebAssembly.Module(bytes);
|
|
30
|
-
|
|
31
|
-
const importMods = [...new Set(WebAssembly.Module.imports(mod).map((i) => i.module))];
|
|
32
|
-
const exportNames = WebAssembly.Module.exports(mod).map((e) => e.name);
|
|
33
|
-
const b64 = bytes.toString("base64");
|
|
34
|
-
|
|
35
|
-
const lines = [
|
|
36
|
-
// Import JS glue modules that the WASM binary needs
|
|
37
|
-
...importMods.map((m, i) => `import * as __wimp${i} from ${JSON.stringify(m)};`),
|
|
38
|
-
// Inline the WASM binary as base64 and instantiate synchronously
|
|
39
|
-
`const __wb64=${JSON.stringify(b64)};`,
|
|
40
|
-
`const __wbytes=Uint8Array.from(atob(__wb64),c=>c.charCodeAt(0));`,
|
|
41
|
-
`const __wbmod=new WebAssembly.Module(__wbytes);`,
|
|
42
|
-
`const __wbinst=new WebAssembly.Instance(__wbmod,{${importMods.map((m, i) => `${JSON.stringify(m)}:__wimp${i}`).join(",")}});`,
|
|
43
|
-
// Named-export every WASM export so `import * as wasm` gets the right shape
|
|
44
|
-
...exportNames.map((n) => `export const ${n}=__wbinst.exports[${JSON.stringify(n)}];`),
|
|
45
|
-
];
|
|
46
|
-
|
|
47
|
-
return { contents: lines.join("\n"), loader: "js", resolveDir: dirname(args.path) };
|
|
48
|
-
});
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
15
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
53
16
|
const src = resolve(here, "src");
|
|
54
17
|
const out = resolve(here, "dist-browser");
|
|
@@ -84,7 +47,6 @@ await build({
|
|
|
84
47
|
chunkNames: "chunks/[name]-[hash]",
|
|
85
48
|
splitting: true,
|
|
86
49
|
external: ["react", "react-dom/client"],
|
|
87
|
-
plugins: [wasmBindgenPlugin],
|
|
88
50
|
});
|
|
89
51
|
|
|
90
52
|
// Single vendor bundle: React + ReactDOM (sandbox loads this once via import map)
|
package/dist/connect.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AAUA,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAe1D;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CA4BhD"}
|
package/dist/connect.js
CHANGED
|
@@ -4,19 +4,19 @@ import { createElement } from "react";
|
|
|
4
4
|
import { createRoot } from "react-dom/client";
|
|
5
5
|
import { defineElements } from "./elements";
|
|
6
6
|
import { RbContext } from "./sdk";
|
|
7
|
-
import {
|
|
7
|
+
import { RbWs } from "./ws";
|
|
8
8
|
function connect(App) {
|
|
9
9
|
defineElements();
|
|
10
10
|
const host = ThreadWindow.parent.import({
|
|
11
11
|
targetOrigin: "*"
|
|
12
12
|
});
|
|
13
|
-
void host.connect().then(async ({ connection, toast,
|
|
14
|
-
const
|
|
13
|
+
void host.connect().then(async ({ connection, toast, socketUrl, pluginId }) => {
|
|
14
|
+
const ws = await RbWs.connect(socketUrl, pluginId);
|
|
15
15
|
const rb = {
|
|
16
|
-
pub: (topic, payload) =>
|
|
17
|
-
sub: (topic, handler) =>
|
|
18
|
-
action: (topic, payload) =>
|
|
19
|
-
serve: (topic, handler) =>
|
|
16
|
+
pub: (topic, payload) => ws.pub(topic, payload),
|
|
17
|
+
sub: (topic, handler) => ws.sub(topic, handler),
|
|
18
|
+
action: (topic, payload) => ws.action(topic, payload),
|
|
19
|
+
serve: (topic, handler) => ws.serve(topic, handler),
|
|
20
20
|
toast: (message, type) => toast(message, type)
|
|
21
21
|
};
|
|
22
22
|
const root = document.createElement("remote-root");
|
package/dist/connect.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/connect.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Sandbox bootstrap \u2014 runs *inside* the plugin iframe.\n *\n * The sandbox initiates the handshake: imports the host's `connect()` and calls\n * it. The host responds with the RemoteConnection, toast(), and
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * Sandbox bootstrap \u2014 runs *inside* the plugin iframe.\n *\n * The sandbox initiates the handshake: imports the host's `connect()` and calls\n * it. The host responds with the RemoteConnection, toast(), and Socket.IO config\n * (socketUrl + pluginId). We open a Socket.IO connection and wire up the rb object.\n */\nimport { RemoteMutationObserver } from \"@remote-dom/core/elements\";\nimport type { RemoteConnection } from \"@remote-dom/core\";\nimport { ThreadWindow } from \"@quilted/threads\";\nimport { createElement, type ComponentType } from \"react\";\nimport { createRoot } from \"react-dom/client\";\nimport { defineElements } from \"./elements\";\nimport { RbContext, type RbSdk } from \"./sdk\";\nimport { RbWs } from \"./ws\";\n\ninterface HostExports {\n connect: () => Promise<{\n connection: RemoteConnection;\n toast: (message: string, type?: string) => void;\n socketUrl: string;\n pluginId: string;\n }>;\n}\n\n/**\n * Mount a plugin. Call this once from the sandbox entry (content.tsx).\n *\n * @example\n * import { connect } from \"@rainbow-robotics/plugin-ui/connect\";\n * import App from \"./App\";\n * connect(App);\n */\nexport function connect(App: ComponentType): void {\n defineElements();\n\n const host = ThreadWindow.parent.import<HostExports>({\n targetOrigin: \"*\",\n });\n\n void host.connect().then(async ({ connection, toast, socketUrl, pluginId }) => {\n const ws = await RbWs.connect(socketUrl, pluginId);\n\n const rb: RbSdk = {\n pub: (topic, payload) => ws.pub(topic, payload),\n sub: (topic, handler) => ws.sub(topic, handler),\n action: (topic, payload) => ws.action(topic, payload),\n serve: (topic, handler) => ws.serve(topic, handler),\n toast: (message, type) => toast(message, type),\n };\n\n const root = document.createElement(\"remote-root\");\n document.body.append(root);\n\n const observer = new RemoteMutationObserver(connection);\n observer.observe(root);\n\n createRoot(root).render(\n createElement(RbContext.Provider, { value: rb }, createElement(App)),\n );\n });\n}\n"],
|
|
5
|
+
"mappings": "AAOA,SAAS,8BAA8B;AAEvC,SAAS,oBAAoB;AAC7B,SAAS,qBAAyC;AAClD,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B,SAAS,iBAA6B;AACtC,SAAS,YAAY;AAmBd,SAAS,QAAQ,KAA0B;AAChD,iBAAe;AAEf,QAAM,OAAO,aAAa,OAAO,OAAoB;AAAA,IACnD,cAAc;AAAA,EAChB,CAAC;AAED,OAAK,KAAK,QAAQ,EAAE,KAAK,OAAO,EAAE,YAAY,OAAO,WAAW,SAAS,MAAM;AAC7E,UAAM,KAAK,MAAM,KAAK,QAAQ,WAAW,QAAQ;AAEjD,UAAM,KAAY;AAAA,MAChB,KAAQ,CAAC,OAAO,YAAY,GAAG,IAAI,OAAO,OAAO;AAAA,MACjD,KAAQ,CAAC,OAAO,YAAY,GAAG,IAAI,OAAO,OAAO;AAAA,MACjD,QAAQ,CAAC,OAAO,YAAY,GAAG,OAAO,OAAO,OAAO;AAAA,MACpD,OAAQ,CAAC,OAAO,YAAY,GAAG,MAAM,OAAO,OAAO;AAAA,MACnD,OAAQ,CAAC,SAAS,SAAU,MAAM,SAAS,IAAI;AAAA,IACjD;AAEA,UAAM,OAAO,SAAS,cAAc,aAAa;AACjD,aAAS,KAAK,OAAO,IAAI;AAEzB,UAAM,WAAW,IAAI,uBAAuB,UAAU;AACtD,aAAS,QAAQ,IAAI;AAErB,eAAW,IAAI,EAAE;AAAA,MACf,cAAc,UAAU,UAAU,EAAE,OAAO,GAAG,GAAG,cAAc,GAAG,CAAC;AAAA,IACrE;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/sdk.d.ts
CHANGED
package/dist/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,IAAI,UAAU,EAAE,WAAW,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjF,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,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAErE;;;OAGG;IACH,KAAK,EAAE,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EACtB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,KACrC,OAAO,CAAC,SAAS,CAAC,CAAC;IAExB,qEAAqE;IACrE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;CACvD;AAuBD,eAAO,MAAM,SAAS,gCAAgC,CAAC;AAEvD,0DAA0D;AAC1D,wBAAgB,KAAK,IAAI,KAAK,CAE7B"}
|
package/dist/sdk.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/sdk.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Plugin runtime SDK \u2014 the surface a plugin author calls from inside the sandbox.\n *\n * Zenoh methods (pub/sub/action/serve) talk directly to the Zenoh router via\n * WebSocket. Topics are auto-namespaced to plugin/{pluginId}/... to prevent\n * cross-plugin collisions. A leading \"/\" bypasses namespacing (absolute path).\n *\n * notify() is still host-mediated (goes through the Muscat shell).\n */\nimport { createContext, useContext } from \"react\";\nimport type { Subscriber, Queryable } from \"./
|
|
4
|
+
"sourcesContent": ["/**\n * Plugin runtime SDK \u2014 the surface a plugin author calls from inside the sandbox.\n *\n * Zenoh methods (pub/sub/action/serve) talk directly to the Zenoh router via\n * WebSocket. Topics are auto-namespaced to plugin/{pluginId}/... to prevent\n * cross-plugin collisions. A leading \"/\" bypasses namespacing (absolute path).\n *\n * notify() is still host-mediated (goes through the Muscat shell).\n */\nimport { createContext, useContext } from \"react\";\nimport type { WsSubscriber as Subscriber, WsQueryable as Queryable } from \"./ws\";\n\nexport type RbNotifyType = \"info\" | \"success\" | \"warning\" | \"error\";\n\nexport interface RbSdk {\n /**\n * Publish JSON payload to a topic.\n * \"sensor/data\" \u2192 plugin/{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: (message: string, type?: RbNotifyType) => 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>(_topic?: string, _handler?: (payload?: P) => R) => {\n console.warn(\"[plugin-ui] rb.serve called outside of a host context\");\n return { undeclare: async () => {} } as unknown as Queryable;\n },\n toast: (message) => {\n console.warn(\"[plugin-ui] rb.toast (no host):\", message);\n },\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"],
|
|
5
5
|
"mappings": "AASA,SAAS,eAAe,kBAAkB;AAsC1C,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,OAAyB,QAAiB,aAAkC;AACjF,YAAQ,KAAK,uDAAuD;AACpE,WAAO,EAAE,WAAW,YAAY;AAAA,IAAC,EAAE;AAAA,EACrC;AAAA,EACA,OAAO,CAAC,YAAY;AAClB,YAAQ,KAAK,mCAAmC,OAAO;AAAA,EACzD;AACF;AAEO,MAAM,YAAY,cAAqB,OAAO;AAG9C,SAAS,QAAe;AAC7B,SAAO,WAAW,SAAS;AAC7B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/ws.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface WsHandle {
|
|
2
|
+
undeclare(): void;
|
|
3
|
+
}
|
|
4
|
+
export type WsSubscriber = WsHandle;
|
|
5
|
+
export type WsQueryable = WsHandle;
|
|
6
|
+
export declare class RbWs {
|
|
7
|
+
private readonly _socket;
|
|
8
|
+
private readonly _pluginId;
|
|
9
|
+
private readonly _subHandlers;
|
|
10
|
+
private readonly _serveHandlers;
|
|
11
|
+
private constructor();
|
|
12
|
+
static connect(url: string, pluginId: string): Promise<RbWs>;
|
|
13
|
+
private _key;
|
|
14
|
+
pub<P = any>(topic: string, payload: P): Promise<void>;
|
|
15
|
+
sub<P = any>(topic: string, handler: (payload: P) => void): Promise<WsSubscriber>;
|
|
16
|
+
action<R = any, P = any>(topic: string, payload?: P): Promise<R>;
|
|
17
|
+
serve<P = any, R = any>(topic: string, handler: (payload?: P) => R | Promise<R>): Promise<WsQueryable>;
|
|
18
|
+
close(): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=ws.d.ts.map
|
package/dist/ws.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../src/ws.ts"],"names":[],"mappings":"AAaA,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,CAAsD;IACnF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAwE;IAEvG,OAAO;IAiBP,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW5D,OAAO,CAAC,IAAI;IAKN,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAKtD,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC;IAsBjF,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAWhE,KAAK,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAC1B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GACvC,OAAO,CAAC,WAAW,CAAC;IAYvB,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var f=Object.defineProperty;var g=a=>{throw TypeError(a)};var h=(a,b,c)=>b in a?f(a,b,{enumerable:!0,configurable:!0,writable:!0,value:c}):a[b]=c;var i=(a,b)=>{for(var c in b)f(a,c,{get:b[c],enumerable:!0})};var j=(a,b,c)=>h(a,typeof b!="symbol"?b+"":b,c),d=(a,b,c)=>b.has(a)||g("Cannot "+c);var k=(a,b,c)=>(d(a,b,"read from private field"),c?c.call(a):b.get(a)),l=(a,b,c)=>b.has(a)?g("Cannot add the same private member more than once"):b instanceof WeakSet?b.add(a):b.set(a,c),m=(a,b,c,e)=>(d(a,b,"write to private field"),e?e.call(a,c):b.set(a,c),c),n=(a,b,c)=>(d(a,b,"access private method"),c);export{i as a,j as b,k as c,l as d,m as e,n as f};
|
package/dist-browser/@rainbow-robotics/plugin-ui/chunks/{chunk-3DOWEHFU.js → chunk-4MGSRUAS.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as v,e as P,f as Q,g as ee}from"./chunk-HJVATDC6.js";var M=class extends CustomEvent{respondWith(t){this.response=t}};var g=new WeakMap;var B=new WeakMap,ce=0;function y(e){let t=B.get(e);return t==null&&(t=String(ce++),k(e,t)),t}function k(e,t){B.set(e,t)}var L=new WeakMap;function S(e){return L.get(e)}var I=new WeakMap;function ae(e){let t=I.get(e);if(t!=null)return t;if(!(!(e instanceof Element)||e.tagName.includes("-"))){t={};for(let{name:r,value:n}of e.attributes)t[r]=n;return t}}var z=new WeakMap;function Y(e){return z.get(e)}function _(e,t,r){let n=L.get(e);if(n==null&&(n={},L.set(e,n)),n[t]===r)return;n[t]=r;let o=g.get(e);o?.mutate([[3,y(e),t,r,1]])}function A(e,t,r){let n=I.get(e);if(n==null&&(n={},I.set(e,n)),n[t]===r)return;r==null?delete n[t]:n[t]=String(r);let o=g.get(e);o?.mutate([[3,y(e),t,r,2]])}function j(e,t,r){let n=z.get(e);if(n==null&&(n={},z.set(e,n)),n[t]===r)return;r==null?delete n[t]:n[t]=r;let o=g.get(e);o?.mutate([[3,y(e),t,r,3]])}function D(e,t){if(g.get(e)!==t&&(g.set(e,t),e.childNodes))for(let n=0;n<e.childNodes.length;n++)D(e.childNodes[n],t)}function O(e){if(g.get(e)!=null&&(g.delete(e),e.childNodes))for(let r=0;r<e.childNodes.length;r++)O(e.childNodes[r])}function T(e){let{nodeType:t}=e;switch(t){case 1:return{id:y(e),type:t,element:e.localName,properties:w(S(e)),attributes:w(ae(e)),eventListeners:w(Y(e)),children:Array.from(e.childNodes).map(T)};case 3:case 8:return{id:y(e),type:t,data:e.data};default:throw new Error(`Cannot serialize node of type ${e.nodeType} (${typeof e.nodeType})`)}}function w(e){return e?{...e}:void 0}function te(e,t,...r){let n=B.get(e),o=g.get(e);if(n==null||o==null)throw new Error(`Cannot call method ${t} on an unconnected node`);return o.call(n,t,...r)}var U=Object.freeze({});var p=class extends HTMLElement{static get observedAttributes(){return this.finalize().__observedAttributes}static get remotePropertyDefinitions(){return this.finalize().__remotePropertyDefinitions}static get remoteAttributeDefinitions(){return this.finalize().__remoteAttributeDefinitions}static get remoteEventDefinitions(){return this.finalize().__remoteEventDefinitions}static get remoteSlotDefinitions(){return this.finalize().__remoteSlotDefinitions}static createProperty(t,r){F(t,r,this.observedAttributes,this.remotePropertyDefinitions,this.__attributeToPropertyMap,this.__eventToPropertyMap)}static finalize(){if(this.hasOwnProperty("__finalized"))return this;this.__finalized=!0;let{slottable:t,remoteSlots:r,remoteProperties:n,remoteAttributes:o,remoteEvents:i,remoteMethods:s}=this,c=Object.getPrototypeOf(this),a=new Set;t&&a.add("slot");let u=new Map,d=new Map,f=new Map,h=new Map,b=new Map,E=new Map;if(typeof c.finalize=="function"&&(c.finalize(),c.observedAttributes.forEach(l=>{a.add(l)}),c.remotePropertyDefinitions.forEach((l,m)=>{h.set(m,l)}),c.remoteAttributeDefinitions.forEach((l,m)=>{b.set(m,l)}),c.remoteEventDefinitions.forEach((l,m)=>{E.set(m,l)}),c.remoteSlotDefinitions.forEach((l,m)=>{f.set(m,l)})),r!=null&&(Array.isArray(r)?r:Object.keys(r)).forEach(m=>{f.set(m,U)}),n!=null&&(Array.isArray(n)?n.forEach(l=>{F(l,void 0,a,h,u,d)}):Object.keys(n).forEach(l=>{F(l,n[l],a,h,u,d)})),o?.forEach(l=>{b.set(l,U),a.add(l)}),i!=null&&(Array.isArray(i)?i.forEach(l=>{E.set(l,U)}):Object.keys(i).forEach(l=>{E.set(l,i[l])})),s!=null)if(Array.isArray(s))for(let l of s)this.prototype[l]=function(...m){return this.callRemoteMethod(l,...m)};else Object.assign(this,s);return Object.defineProperties(this,{__observedAttributes:{value:[...a],enumerable:!1},__remoteSlotDefinitions:{value:f,enumerable:!1},__remotePropertyDefinitions:{value:h,enumerable:!1},__remoteAttributeDefinitions:{value:b,enumerable:!1},__remoteEventDefinitions:{value:E,enumerable:!1},__attributeToPropertyMap:{value:u,enumerable:!1},__eventToPropertyMap:{value:d,enumerable:!1}}),this}constructor(){super(),this.constructor.finalize();let t={},r={},n=Object.getPrototypeOf(this),o=this.constructor;for(let[i,s]of o.remotePropertyDefinitions.entries()){let c=s.name;if(n.hasOwnProperty(i))continue;i===c&&(r[i]=s.default);let a={configurable:!0,enumerable:i===c,get:()=>S(this)?.[c],set:u=>{_(this,c,u)}};t[i]=a}for(let[i,s]of o.remoteEventDefinitions.entries()){let c=s.property??!0;if(!c)continue;let a=c===!0?`on${i}`:c;t[a]={configurable:!0,enumerable:!0,get:()=>N(this).properties.get(a)??null,set:u=>{let d=N(this),f=d.properties.get(a);if(typeof u=="function"){let h=function(...b){return u.call(this,...b)};d.properties.set(a,h),this.addEventListener(i,h)}else d.properties.delete(a);f&&this.removeEventListener(i,f)}}}Object.defineProperties(this,t),Object.assign(this,r)}attributeChangedCallback(t,r,n){if(t==="slot"&&this.constructor.slottable){A(this,t,n?String(n):void 0);return}let{remotePropertyDefinitions:o,remoteAttributeDefinitions:i,__attributeToPropertyMap:s}=this.constructor;if(i.has(t)){A(this,t,n);return}let c=s.get(t),a=c==null?c:o.get(c);a!=null&&(this[c]=ue(n,a.type))}connectedCallback(){for(let[t,r]of this.constructor.remoteEventDefinitions.entries())r.bubbles&&this.addEventListener(t,ne)}disconnectedCallback(){for(let[t,r]of this.constructor.remoteEventDefinitions.entries())r.bubbles&&this.removeEventListener(t,ne)}addEventListener(t,r,n){let{remoteEventDefinitions:o,__eventToPropertyMap:i}=this.constructor,s=o.get(t),c=i.get(t);if(s==null&&c==null)return super.addEventListener(t,r,n);let a=N(this),u=le.call(this,t,{property:c,definition:s}),d=typeof n=="object"&&n?.once?(...h)=>{let b=typeof r=="object"?r.handleEvent(...h):r.call(this,...h);return W.call(this,t,r,f),b}:r,f=[d,u];u.listeners.add(r),a.listeners.set(r,f),super.addEventListener(t,d,n),typeof n=="object"&&n.signal&&n.signal.addEventListener("abort",()=>{W.call(this,t,r,f)},{once:!0}),s?j(this,t,u.dispatch):_(this,c,u.dispatch)}removeEventListener(t,r,n){let o=$.get(this)?.listeners.get(r),i=o?o[0]:r;super.removeEventListener(t,i,n),o!=null&&W.call(this,t,r,o)}updateRemoteProperty(t,r){_(this,t,r)}updateRemoteAttribute(t,r){A(this,t,r)}callRemoteMethod(t,...r){return te(this,t,...r)}};v(p,"slottable",!0),v(p,"__finalized",!0),v(p,"__observedAttributes",[]),v(p,"__attributeToPropertyMap",new Map),v(p,"__eventToPropertyMap",new Map),v(p,"__remotePropertyDefinitions",new Map),v(p,"__remoteAttributeDefinitions",new Map),v(p,"__remoteEventDefinitions",new Map),v(p,"__remoteSlotDefinitions",new Map);var $=new WeakMap;function N(e){let t=$.get(e);return t||(t={events:new Map,properties:new Map,listeners:new WeakMap},$.set(e,t),t)}function le(e,{property:t,definition:r}){let n=N(this),o=n.events.get(e);return o==null&&(o={name:e,property:t,definition:r,listeners:new Set,dispatch:(...i)=>{let s=r?.dispatchEvent?.apply(this,i)??new M(e,{detail:i[0],bubbles:r?.bubbles});return this.dispatchEvent(s),s.response}},n.events.set(e,o)),o}function W(e,t,r){let n=N(this),o=r[1];o.listeners.delete(t),n.listeners.delete(t),!(o.listeners.size>0)&&(n.events.delete(e),o.property?S(this)?.[o.property]===o.dispatch&&_(this,o.property,void 0):Y(this)?.[e]===o.dispatch&&j(this,e,void 0))}function F(e,t,r,n,o,i){if(n.has(e))return n.get(e);let s=e[0]==="o"&&e[1]==="n",c=t??{},{alias:a}=c,{type:u=s?Function:String,attribute:d=u!==Function,event:f=s,default:h=u===Boolean?!1:void 0}=c;if(a==null){let m=e.toLowerCase();m!==e&&(a=[m]),s&&(a??(a=[]),a.unshift(`_${e}`))}let b;d===!0?b=re(e):typeof d=="string"&&(b=d),b&&(Array.isArray(r)?r.push(b):r.add(b),o.set(b,e));let E;f===!0?E=re(s?e.slice(2):e):typeof f=="string"&&(E=f),E&&i.set(E,e);let l={name:e,type:u,alias:a,event:E,attribute:b,default:h};if(n.set(e,l),a)for(let m of a)n.set(m,l);return l}function ue(e,t){if(e!=null)switch(t){case Boolean:return e!=null&&e!=="false";case Object:case Array:try{return JSON.parse(e)}catch{return}case String:return String(e);case Number:return Number.parseFloat(e);case Function:return;default:return t.parse?.(e)}}function re(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function ne(){}var R,H=class extends MutationObserver{constructor(r){super(n=>{let o=[],i=[];for(let s of n){let c=y(s.target);if(s.type==="childList"){let a=s.previousSibling?pe(s.previousSibling,s.target.childNodes)+1:0;s.removedNodes.forEach(u=>{O(u),i.push([1,c,a])}),s.addedNodes.forEach((u,d)=>{o.some(f=>f===u||f.contains(u))||(o.push(u),D(u,r),i.push([0,c,T(u),a+d]))})}else s.type==="characterData"?i.push([2,c,s.target.textContent??""]):s.type==="attributes"&&s.attributeName!=null&&s.target instanceof Element&&!s.target.tagName.includes("-")&&i.push([3,c,s.attributeName,s.target.getAttribute(s.attributeName)])}r.mutate(i)});Q(this,R);this.connection=r,ee(this,R,new Set)}observe(r,n){let o=n?.id??"~";if(k(r,o),P(this,R).add(r),n?.initial!==!1&&r.childNodes.length>0){if(o!=="~")this.connection.mutate([[0,"~",T(r),P(this,R).size-1]]);else if(r.childNodes.length>0){let i=[];for(let s=0;s<r.childNodes.length;s++){let c=r.childNodes[s];D(c,this.connection),i.push([0,"~",T(c),s])}this.connection.mutate(i)}}super.observe(r,{subtree:!0,childList:!0,attributes:!0,characterData:!0,...n})}disconnect({empty:r=!1}={}){if(r&&P(this,R).size>0){let n=[];for(let o of P(this,R)){O(o);let i=y(o);if(i==="~")for(let s=0;s<o.childNodes.length;s++)n.push([1,i,0]);else n.push([1,"~",0])}this.connection.mutate(n)}P(this,R).clear(),super.disconnect()}};R=new WeakMap;function pe(e,t){for(let r=0;r<t.length;r++)if(t[r]===e)return r;return-1}var V=class extends p{static get remoteProperties(){return{value:{type:Number},min:{type:Number},max:{type:Number},step:{type:Number},disabled:{type:Boolean}}}static get remoteEvents(){return["change"]}},J=class extends p{static get remoteProperties(){return{label:{type:String},variant:{type:String},size:{type:String},disabled:{type:Boolean}}}static get remoteEvents(){return["press"]}},K=class extends p{static get remoteProperties(){return{icon:{type:String},variant:{type:String},size:{type:String},disabled:{type:Boolean}}}static get remoteEvents(){return["press"]}},X=class extends p{static get remoteProperties(){return{}}},Z=class extends p{static get remoteProperties(){return{value:{type:String},placeholder:{type:String},disabled:{type:Boolean}}}static get remoteEvents(){return["input"]}},q=class extends p{static get remoteProperties(){return{checked:{type:Boolean},disabled:{type:Boolean}}}static get remoteEvents(){return["change"]}},G=class extends p{static get remoteProperties(){return{value:{type:String},options:{type:Array},placeholder:{type:String},disabled:{type:Boolean}}}static get remoteEvents(){return["change"]}},De=["rb-slider","rb-button","rb-icon-button","rb-text","rb-text-input","rb-switch","rb-select"],ie=!1;function Oe(){ie||typeof customElements>"u"||(ie=!0,customElements.define("rb-slider",V),customElements.define("rb-button",J),customElements.define("rb-icon-button",K),customElements.define("rb-text",X),customElements.define("rb-text-input",Z),customElements.define("rb-switch",q),customElements.define("rb-select",G))}export{H as a,V as b,J as c,K as d,X as e,Z as f,q as g,G as h,De as i,Oe as j};
|
|
1
|
+
import{b as v,c as P,d as Q,e as ee}from"./chunk-37HVFFJB.js";var M=class extends CustomEvent{respondWith(t){this.response=t}};var g=new WeakMap;var B=new WeakMap,ce=0;function y(e){let t=B.get(e);return t==null&&(t=String(ce++),k(e,t)),t}function k(e,t){B.set(e,t)}var L=new WeakMap;function S(e){return L.get(e)}var I=new WeakMap;function ae(e){let t=I.get(e);if(t!=null)return t;if(!(!(e instanceof Element)||e.tagName.includes("-"))){t={};for(let{name:r,value:n}of e.attributes)t[r]=n;return t}}var z=new WeakMap;function Y(e){return z.get(e)}function _(e,t,r){let n=L.get(e);if(n==null&&(n={},L.set(e,n)),n[t]===r)return;n[t]=r;let o=g.get(e);o?.mutate([[3,y(e),t,r,1]])}function A(e,t,r){let n=I.get(e);if(n==null&&(n={},I.set(e,n)),n[t]===r)return;r==null?delete n[t]:n[t]=String(r);let o=g.get(e);o?.mutate([[3,y(e),t,r,2]])}function j(e,t,r){let n=z.get(e);if(n==null&&(n={},z.set(e,n)),n[t]===r)return;r==null?delete n[t]:n[t]=r;let o=g.get(e);o?.mutate([[3,y(e),t,r,3]])}function D(e,t){if(g.get(e)!==t&&(g.set(e,t),e.childNodes))for(let n=0;n<e.childNodes.length;n++)D(e.childNodes[n],t)}function O(e){if(g.get(e)!=null&&(g.delete(e),e.childNodes))for(let r=0;r<e.childNodes.length;r++)O(e.childNodes[r])}function T(e){let{nodeType:t}=e;switch(t){case 1:return{id:y(e),type:t,element:e.localName,properties:w(S(e)),attributes:w(ae(e)),eventListeners:w(Y(e)),children:Array.from(e.childNodes).map(T)};case 3:case 8:return{id:y(e),type:t,data:e.data};default:throw new Error(`Cannot serialize node of type ${e.nodeType} (${typeof e.nodeType})`)}}function w(e){return e?{...e}:void 0}function te(e,t,...r){let n=B.get(e),o=g.get(e);if(n==null||o==null)throw new Error(`Cannot call method ${t} on an unconnected node`);return o.call(n,t,...r)}var U=Object.freeze({});var p=class extends HTMLElement{static get observedAttributes(){return this.finalize().__observedAttributes}static get remotePropertyDefinitions(){return this.finalize().__remotePropertyDefinitions}static get remoteAttributeDefinitions(){return this.finalize().__remoteAttributeDefinitions}static get remoteEventDefinitions(){return this.finalize().__remoteEventDefinitions}static get remoteSlotDefinitions(){return this.finalize().__remoteSlotDefinitions}static createProperty(t,r){F(t,r,this.observedAttributes,this.remotePropertyDefinitions,this.__attributeToPropertyMap,this.__eventToPropertyMap)}static finalize(){if(this.hasOwnProperty("__finalized"))return this;this.__finalized=!0;let{slottable:t,remoteSlots:r,remoteProperties:n,remoteAttributes:o,remoteEvents:i,remoteMethods:s}=this,c=Object.getPrototypeOf(this),a=new Set;t&&a.add("slot");let u=new Map,d=new Map,f=new Map,h=new Map,b=new Map,E=new Map;if(typeof c.finalize=="function"&&(c.finalize(),c.observedAttributes.forEach(l=>{a.add(l)}),c.remotePropertyDefinitions.forEach((l,m)=>{h.set(m,l)}),c.remoteAttributeDefinitions.forEach((l,m)=>{b.set(m,l)}),c.remoteEventDefinitions.forEach((l,m)=>{E.set(m,l)}),c.remoteSlotDefinitions.forEach((l,m)=>{f.set(m,l)})),r!=null&&(Array.isArray(r)?r:Object.keys(r)).forEach(m=>{f.set(m,U)}),n!=null&&(Array.isArray(n)?n.forEach(l=>{F(l,void 0,a,h,u,d)}):Object.keys(n).forEach(l=>{F(l,n[l],a,h,u,d)})),o?.forEach(l=>{b.set(l,U),a.add(l)}),i!=null&&(Array.isArray(i)?i.forEach(l=>{E.set(l,U)}):Object.keys(i).forEach(l=>{E.set(l,i[l])})),s!=null)if(Array.isArray(s))for(let l of s)this.prototype[l]=function(...m){return this.callRemoteMethod(l,...m)};else Object.assign(this,s);return Object.defineProperties(this,{__observedAttributes:{value:[...a],enumerable:!1},__remoteSlotDefinitions:{value:f,enumerable:!1},__remotePropertyDefinitions:{value:h,enumerable:!1},__remoteAttributeDefinitions:{value:b,enumerable:!1},__remoteEventDefinitions:{value:E,enumerable:!1},__attributeToPropertyMap:{value:u,enumerable:!1},__eventToPropertyMap:{value:d,enumerable:!1}}),this}constructor(){super(),this.constructor.finalize();let t={},r={},n=Object.getPrototypeOf(this),o=this.constructor;for(let[i,s]of o.remotePropertyDefinitions.entries()){let c=s.name;if(n.hasOwnProperty(i))continue;i===c&&(r[i]=s.default);let a={configurable:!0,enumerable:i===c,get:()=>S(this)?.[c],set:u=>{_(this,c,u)}};t[i]=a}for(let[i,s]of o.remoteEventDefinitions.entries()){let c=s.property??!0;if(!c)continue;let a=c===!0?`on${i}`:c;t[a]={configurable:!0,enumerable:!0,get:()=>N(this).properties.get(a)??null,set:u=>{let d=N(this),f=d.properties.get(a);if(typeof u=="function"){let h=function(...b){return u.call(this,...b)};d.properties.set(a,h),this.addEventListener(i,h)}else d.properties.delete(a);f&&this.removeEventListener(i,f)}}}Object.defineProperties(this,t),Object.assign(this,r)}attributeChangedCallback(t,r,n){if(t==="slot"&&this.constructor.slottable){A(this,t,n?String(n):void 0);return}let{remotePropertyDefinitions:o,remoteAttributeDefinitions:i,__attributeToPropertyMap:s}=this.constructor;if(i.has(t)){A(this,t,n);return}let c=s.get(t),a=c==null?c:o.get(c);a!=null&&(this[c]=ue(n,a.type))}connectedCallback(){for(let[t,r]of this.constructor.remoteEventDefinitions.entries())r.bubbles&&this.addEventListener(t,ne)}disconnectedCallback(){for(let[t,r]of this.constructor.remoteEventDefinitions.entries())r.bubbles&&this.removeEventListener(t,ne)}addEventListener(t,r,n){let{remoteEventDefinitions:o,__eventToPropertyMap:i}=this.constructor,s=o.get(t),c=i.get(t);if(s==null&&c==null)return super.addEventListener(t,r,n);let a=N(this),u=le.call(this,t,{property:c,definition:s}),d=typeof n=="object"&&n?.once?(...h)=>{let b=typeof r=="object"?r.handleEvent(...h):r.call(this,...h);return W.call(this,t,r,f),b}:r,f=[d,u];u.listeners.add(r),a.listeners.set(r,f),super.addEventListener(t,d,n),typeof n=="object"&&n.signal&&n.signal.addEventListener("abort",()=>{W.call(this,t,r,f)},{once:!0}),s?j(this,t,u.dispatch):_(this,c,u.dispatch)}removeEventListener(t,r,n){let o=$.get(this)?.listeners.get(r),i=o?o[0]:r;super.removeEventListener(t,i,n),o!=null&&W.call(this,t,r,o)}updateRemoteProperty(t,r){_(this,t,r)}updateRemoteAttribute(t,r){A(this,t,r)}callRemoteMethod(t,...r){return te(this,t,...r)}};v(p,"slottable",!0),v(p,"__finalized",!0),v(p,"__observedAttributes",[]),v(p,"__attributeToPropertyMap",new Map),v(p,"__eventToPropertyMap",new Map),v(p,"__remotePropertyDefinitions",new Map),v(p,"__remoteAttributeDefinitions",new Map),v(p,"__remoteEventDefinitions",new Map),v(p,"__remoteSlotDefinitions",new Map);var $=new WeakMap;function N(e){let t=$.get(e);return t||(t={events:new Map,properties:new Map,listeners:new WeakMap},$.set(e,t),t)}function le(e,{property:t,definition:r}){let n=N(this),o=n.events.get(e);return o==null&&(o={name:e,property:t,definition:r,listeners:new Set,dispatch:(...i)=>{let s=r?.dispatchEvent?.apply(this,i)??new M(e,{detail:i[0],bubbles:r?.bubbles});return this.dispatchEvent(s),s.response}},n.events.set(e,o)),o}function W(e,t,r){let n=N(this),o=r[1];o.listeners.delete(t),n.listeners.delete(t),!(o.listeners.size>0)&&(n.events.delete(e),o.property?S(this)?.[o.property]===o.dispatch&&_(this,o.property,void 0):Y(this)?.[e]===o.dispatch&&j(this,e,void 0))}function F(e,t,r,n,o,i){if(n.has(e))return n.get(e);let s=e[0]==="o"&&e[1]==="n",c=t??{},{alias:a}=c,{type:u=s?Function:String,attribute:d=u!==Function,event:f=s,default:h=u===Boolean?!1:void 0}=c;if(a==null){let m=e.toLowerCase();m!==e&&(a=[m]),s&&(a??(a=[]),a.unshift(`_${e}`))}let b;d===!0?b=re(e):typeof d=="string"&&(b=d),b&&(Array.isArray(r)?r.push(b):r.add(b),o.set(b,e));let E;f===!0?E=re(s?e.slice(2):e):typeof f=="string"&&(E=f),E&&i.set(E,e);let l={name:e,type:u,alias:a,event:E,attribute:b,default:h};if(n.set(e,l),a)for(let m of a)n.set(m,l);return l}function ue(e,t){if(e!=null)switch(t){case Boolean:return e!=null&&e!=="false";case Object:case Array:try{return JSON.parse(e)}catch{return}case String:return String(e);case Number:return Number.parseFloat(e);case Function:return;default:return t.parse?.(e)}}function re(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function ne(){}var R,H=class extends MutationObserver{constructor(r){super(n=>{let o=[],i=[];for(let s of n){let c=y(s.target);if(s.type==="childList"){let a=s.previousSibling?pe(s.previousSibling,s.target.childNodes)+1:0;s.removedNodes.forEach(u=>{O(u),i.push([1,c,a])}),s.addedNodes.forEach((u,d)=>{o.some(f=>f===u||f.contains(u))||(o.push(u),D(u,r),i.push([0,c,T(u),a+d]))})}else s.type==="characterData"?i.push([2,c,s.target.textContent??""]):s.type==="attributes"&&s.attributeName!=null&&s.target instanceof Element&&!s.target.tagName.includes("-")&&i.push([3,c,s.attributeName,s.target.getAttribute(s.attributeName)])}r.mutate(i)});Q(this,R);this.connection=r,ee(this,R,new Set)}observe(r,n){let o=n?.id??"~";if(k(r,o),P(this,R).add(r),n?.initial!==!1&&r.childNodes.length>0){if(o!=="~")this.connection.mutate([[0,"~",T(r),P(this,R).size-1]]);else if(r.childNodes.length>0){let i=[];for(let s=0;s<r.childNodes.length;s++){let c=r.childNodes[s];D(c,this.connection),i.push([0,"~",T(c),s])}this.connection.mutate(i)}}super.observe(r,{subtree:!0,childList:!0,attributes:!0,characterData:!0,...n})}disconnect({empty:r=!1}={}){if(r&&P(this,R).size>0){let n=[];for(let o of P(this,R)){O(o);let i=y(o);if(i==="~")for(let s=0;s<o.childNodes.length;s++)n.push([1,i,0]);else n.push([1,"~",0])}this.connection.mutate(n)}P(this,R).clear(),super.disconnect()}};R=new WeakMap;function pe(e,t){for(let r=0;r<t.length;r++)if(t[r]===e)return r;return-1}var V=class extends p{static get remoteProperties(){return{value:{type:Number},min:{type:Number},max:{type:Number},step:{type:Number},disabled:{type:Boolean}}}static get remoteEvents(){return["change"]}},J=class extends p{static get remoteProperties(){return{label:{type:String},variant:{type:String},size:{type:String},disabled:{type:Boolean}}}static get remoteEvents(){return["press"]}},K=class extends p{static get remoteProperties(){return{icon:{type:String},variant:{type:String},size:{type:String},disabled:{type:Boolean}}}static get remoteEvents(){return["press"]}},X=class extends p{static get remoteProperties(){return{}}},Z=class extends p{static get remoteProperties(){return{value:{type:String},placeholder:{type:String},disabled:{type:Boolean}}}static get remoteEvents(){return["input"]}},q=class extends p{static get remoteProperties(){return{checked:{type:Boolean},disabled:{type:Boolean}}}static get remoteEvents(){return["change"]}},G=class extends p{static get remoteProperties(){return{value:{type:String},options:{type:Array},placeholder:{type:String},disabled:{type:Boolean}}}static get remoteEvents(){return["change"]}},De=["rb-slider","rb-button","rb-icon-button","rb-text","rb-text-input","rb-switch","rb-select"],ie=!1;function Oe(){ie||typeof customElements>"u"||(ie=!0,customElements.define("rb-slider",V),customElements.define("rb-button",J),customElements.define("rb-icon-button",K),customElements.define("rb-text",X),customElements.define("rb-text-input",Z),customElements.define("rb-switch",q),customElements.define("rb-select",G))}export{H as a,V as b,J as c,K as d,X as e,Z as f,q as g,G as h,De as i,Oe as j};
|