@stackable-labs/sdk-extension-react 1.35.0 → 1.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +49 -76
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,20 +1,16 @@
1
+ import { createRoot } from 'react-dom/client';
2
+ import React, { createContext, useContext, useCallback, useSyncExternalStore, useState, useRef, useEffect } from 'react';
3
+ import { WebCrypto } from '@agnostack/verifyd/esm';
4
+ import { jsx } from 'react/jsx-runtime';
5
+
1
6
  var __defProp = Object.defineProperty;
2
7
  var __export = (target, all) => {
3
8
  for (var name in all)
4
9
  __defProp(target, name, { get: all[name], enumerable: true });
5
10
  };
6
-
7
- // src/createExtension.tsx
8
- import { createRoot } from "react-dom/client";
9
-
10
- // src/context.ts
11
- import { createContext } from "react";
12
11
  var SurfaceContext = createContext(null);
13
12
  var ExtensionContext = createContext(null);
14
13
 
15
- // src/rpc-client.ts
16
- import { WebCrypto } from "@agnostack/verifyd/esm";
17
-
18
14
  // ../../../lib/utils-js/src/crypto.ts
19
15
  var base64ToBytes = (base64) => Uint8Array.from(atob(base64), (c) => c.charCodeAt(0));
20
16
 
@@ -90,9 +86,6 @@ var callCapability = async (capability, payload) => {
90
86
  }
91
87
  return result;
92
88
  };
93
-
94
- // src/createExtension.tsx
95
- import { jsx } from "react/jsx-runtime";
96
89
  var createExtension = (factory, options) => {
97
90
  const injectedId = window.__STACKABLE_EXTENSION_ID__ ?? new URLSearchParams(window.location.search).get("__extensionId") ?? void 0;
98
91
  const extensionId = injectedId ?? options?.extensionId ?? "unknown";
@@ -127,9 +120,6 @@ var createStore = (initialState) => {
127
120
  }
128
121
  };
129
122
  };
130
-
131
- // src/hooks.ts
132
- import { useContext, useSyncExternalStore, useCallback } from "react";
133
123
  var useSurfaceContext = () => {
134
124
  const ctx = useContext(SurfaceContext);
135
125
  if (!ctx) {
@@ -166,10 +156,6 @@ var useExtension = () => {
166
156
  }
167
157
  return ctx;
168
158
  };
169
-
170
- // src/Surface.tsx
171
- import React, { useEffect, useRef, useState, useCallback as useCallback2 } from "react";
172
- import { jsx as jsx2 } from "react/jsx-runtime";
173
159
  var useExtensionId = () => {
174
160
  const ctx = React.useContext(ExtensionContext);
175
161
  return ctx?.extensionId ?? "unknown";
@@ -230,7 +216,7 @@ var Surface = ({ id, children }) => {
230
216
  const [context, setContext] = useState({});
231
217
  const prevTreeRef = useRef("");
232
218
  const containerRef = useRef(null);
233
- const serializeAndSend = useCallback2(() => {
219
+ const serializeAndSend = useCallback(() => {
234
220
  const container = containerRef.current;
235
221
  if (!container) return;
236
222
  const registry = getSurfaceRegistry(id);
@@ -299,7 +285,7 @@ var Surface = ({ id, children }) => {
299
285
  window.removeEventListener("message", handleMessage);
300
286
  };
301
287
  }, [id, extId, serializeAndSend]);
302
- return /* @__PURE__ */ jsx2(SurfaceContext.Provider, { value: context, children: /* @__PURE__ */ jsx2("div", { ref: containerRef, "data-surface-id": id, style: { display: "none" }, children }) });
288
+ return /* @__PURE__ */ jsx(SurfaceContext.Provider, { value: context, children: /* @__PURE__ */ jsx("div", { ref: containerRef, "data-surface-id": id, style: { display: "none" }, children }) });
303
289
  };
304
290
 
305
291
  // src/ui.tsx
@@ -343,42 +329,41 @@ __export(ui_exports, {
343
329
  Textarea: () => Textarea,
344
330
  Tooltip: () => Tooltip
345
331
  });
346
- import { jsx as jsx3 } from "react/jsx-runtime";
347
- var Card = (props) => /* @__PURE__ */ jsx3("ui-card", { ...props, children: props.children });
348
- var CardContent = (props) => /* @__PURE__ */ jsx3("ui-card-content", { ...props, children: props.children });
349
- var CardHeader = (props) => /* @__PURE__ */ jsx3("ui-card-header", { ...props, children: props.children });
350
- var Stack = (props) => /* @__PURE__ */ jsx3("ui-stack", { ...props, children: props.children });
351
- var Inline = (props) => /* @__PURE__ */ jsx3("ui-inline", { ...props, children: props.children });
352
- var Text = (props) => /* @__PURE__ */ jsx3("ui-text", { ...props, children: props.children });
353
- var Heading = (props) => /* @__PURE__ */ jsx3("ui-heading", { ...props, children: props.children });
354
- var Badge = (props) => /* @__PURE__ */ jsx3("ui-badge", { ...props, children: props.children });
355
- var Button = (props) => /* @__PURE__ */ jsx3("ui-button", { ...props, children: props.children });
356
- var Input = (props) => /* @__PURE__ */ jsx3("ui-input", { ...props });
357
- var Textarea = (props) => /* @__PURE__ */ jsx3("ui-textarea", { ...props });
358
- var Select = (props) => /* @__PURE__ */ jsx3("ui-select", { ...props, children: props.children });
359
- var SelectOption = (props) => /* @__PURE__ */ jsx3("ui-select-option", { ...props, children: props.children });
360
- var Checkbox = (props) => /* @__PURE__ */ jsx3("ui-checkbox", { ...props });
361
- var Switch = (props) => /* @__PURE__ */ jsx3("ui-switch", { ...props });
362
- var Label = (props) => /* @__PURE__ */ jsx3("ui-label", { ...props, children: props.children });
363
- var RadioGroup = (props) => /* @__PURE__ */ jsx3("ui-radio-group", { ...props, children: props.children });
364
- var RadioGroupItem = (props) => /* @__PURE__ */ jsx3("ui-radio-group-item", { ...props });
365
- var Separator = (props) => /* @__PURE__ */ jsx3("ui-separator", { ...props });
366
- var Tabs = (props) => /* @__PURE__ */ jsx3("ui-tabs", { ...props, children: props.children });
367
- var TabsList = (props) => /* @__PURE__ */ jsx3("ui-tabs-list", { ...props, children: props.children });
368
- var TabsTrigger = (props) => /* @__PURE__ */ jsx3("ui-tabs-trigger", { ...props, children: props.children });
369
- var TabsContent = (props) => /* @__PURE__ */ jsx3("ui-tabs-content", { ...props, children: props.children });
370
- var ScrollArea = (props) => /* @__PURE__ */ jsx3("ui-scroll-area", { ...props, children: props.children });
371
- var Skeleton = (props) => /* @__PURE__ */ jsx3("ui-skeleton", { ...props });
372
- var Tooltip = (props) => /* @__PURE__ */ jsx3("ui-tooltip", { ...props, children: props.children });
373
- var Progress = (props) => /* @__PURE__ */ jsx3("ui-progress", { ...props });
374
- var Alert = (props) => /* @__PURE__ */ jsx3("ui-alert", { ...props, children: props.children });
375
- var Collapsible = (props) => /* @__PURE__ */ jsx3("ui-collapsible", { ...props, children: props.children });
376
- var CollapsibleTrigger = (props) => /* @__PURE__ */ jsx3("ui-collapsible-trigger", { ...props, children: props.children });
377
- var CollapsibleContent = (props) => /* @__PURE__ */ jsx3("ui-collapsible-content", { ...props, children: props.children });
378
- var Avatar = (props) => /* @__PURE__ */ jsx3("ui-avatar", { ...props });
379
- var Icon = (props) => /* @__PURE__ */ jsx3("ui-icon", { ...props });
380
- var Link = (props) => /* @__PURE__ */ jsx3("ui-link", { ...props, children: props.children });
381
- var FooterLink = (props) => /* @__PURE__ */ jsx3(
332
+ var Card = (props) => /* @__PURE__ */ jsx("ui-card", { ...props, children: props.children });
333
+ var CardContent = (props) => /* @__PURE__ */ jsx("ui-card-content", { ...props, children: props.children });
334
+ var CardHeader = (props) => /* @__PURE__ */ jsx("ui-card-header", { ...props, children: props.children });
335
+ var Stack = (props) => /* @__PURE__ */ jsx("ui-stack", { ...props, children: props.children });
336
+ var Inline = (props) => /* @__PURE__ */ jsx("ui-inline", { ...props, children: props.children });
337
+ var Text = (props) => /* @__PURE__ */ jsx("ui-text", { ...props, children: props.children });
338
+ var Heading = (props) => /* @__PURE__ */ jsx("ui-heading", { ...props, children: props.children });
339
+ var Badge = (props) => /* @__PURE__ */ jsx("ui-badge", { ...props, children: props.children });
340
+ var Button = (props) => /* @__PURE__ */ jsx("ui-button", { ...props, children: props.children });
341
+ var Input = (props) => /* @__PURE__ */ jsx("ui-input", { ...props });
342
+ var Textarea = (props) => /* @__PURE__ */ jsx("ui-textarea", { ...props });
343
+ var Select = (props) => /* @__PURE__ */ jsx("ui-select", { ...props, children: props.children });
344
+ var SelectOption = (props) => /* @__PURE__ */ jsx("ui-select-option", { ...props, children: props.children });
345
+ var Checkbox = (props) => /* @__PURE__ */ jsx("ui-checkbox", { ...props });
346
+ var Switch = (props) => /* @__PURE__ */ jsx("ui-switch", { ...props });
347
+ var Label = (props) => /* @__PURE__ */ jsx("ui-label", { ...props, children: props.children });
348
+ var RadioGroup = (props) => /* @__PURE__ */ jsx("ui-radio-group", { ...props, children: props.children });
349
+ var RadioGroupItem = (props) => /* @__PURE__ */ jsx("ui-radio-group-item", { ...props });
350
+ var Separator = (props) => /* @__PURE__ */ jsx("ui-separator", { ...props });
351
+ var Tabs = (props) => /* @__PURE__ */ jsx("ui-tabs", { ...props, children: props.children });
352
+ var TabsList = (props) => /* @__PURE__ */ jsx("ui-tabs-list", { ...props, children: props.children });
353
+ var TabsTrigger = (props) => /* @__PURE__ */ jsx("ui-tabs-trigger", { ...props, children: props.children });
354
+ var TabsContent = (props) => /* @__PURE__ */ jsx("ui-tabs-content", { ...props, children: props.children });
355
+ var ScrollArea = (props) => /* @__PURE__ */ jsx("ui-scroll-area", { ...props, children: props.children });
356
+ var Skeleton = (props) => /* @__PURE__ */ jsx("ui-skeleton", { ...props });
357
+ var Tooltip = (props) => /* @__PURE__ */ jsx("ui-tooltip", { ...props, children: props.children });
358
+ var Progress = (props) => /* @__PURE__ */ jsx("ui-progress", { ...props });
359
+ var Alert = (props) => /* @__PURE__ */ jsx("ui-alert", { ...props, children: props.children });
360
+ var Collapsible = (props) => /* @__PURE__ */ jsx("ui-collapsible", { ...props, children: props.children });
361
+ var CollapsibleTrigger = (props) => /* @__PURE__ */ jsx("ui-collapsible-trigger", { ...props, children: props.children });
362
+ var CollapsibleContent = (props) => /* @__PURE__ */ jsx("ui-collapsible-content", { ...props, children: props.children });
363
+ var Avatar = (props) => /* @__PURE__ */ jsx("ui-avatar", { ...props });
364
+ var Icon = (props) => /* @__PURE__ */ jsx("ui-icon", { ...props });
365
+ var Link = (props) => /* @__PURE__ */ jsx("ui-link", { ...props, children: props.children });
366
+ var FooterLink = (props) => /* @__PURE__ */ jsx(
382
367
  "ui-link",
383
368
  {
384
369
  ...props,
@@ -388,16 +373,13 @@ var FooterLink = (props) => /* @__PURE__ */ jsx3(
388
373
  children: props.children
389
374
  }
390
375
  );
391
- var Menu = (props) => /* @__PURE__ */ jsx3("ui-menu", { ...props, children: props.children });
392
- var MenuItem = (props) => /* @__PURE__ */ jsx3("ui-menu-item", { ...props });
393
-
394
- // src/useContextData.ts
395
- import { useState as useState2, useEffect as useEffect2 } from "react";
376
+ var Menu = (props) => /* @__PURE__ */ jsx("ui-menu", { ...props, children: props.children });
377
+ var MenuItem = (props) => /* @__PURE__ */ jsx("ui-menu-item", { ...props });
396
378
  var useContextData = () => {
397
379
  const capabilities = useCapabilities();
398
- const [contextData, setContextData] = useState2({});
399
- const [loading, setLoading] = useState2(true);
400
- useEffect2(() => {
380
+ const [contextData, setContextData] = useState({});
381
+ const [loading, setLoading] = useState(true);
382
+ useEffect(() => {
401
383
  const loadContext = async () => {
402
384
  try {
403
385
  const ctx = await capabilities.context.read();
@@ -412,14 +394,5 @@ var useContextData = () => {
412
394
  }, []);
413
395
  return { ...contextData, loading };
414
396
  };
415
- export {
416
- Surface,
417
- createExtension,
418
- createStore,
419
- ui_exports as ui,
420
- useCapabilities,
421
- useContextData,
422
- useExtension,
423
- useStore,
424
- useSurfaceContext
425
- };
397
+
398
+ export { Surface, createExtension, createStore, ui_exports as ui, useCapabilities, useContextData, useExtension, useStore, useSurfaceContext };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackable-labs/sdk-extension-react",
3
- "version": "1.35.0",
3
+ "version": "1.36.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -15,7 +15,7 @@
15
15
  "@agnostack/verifyd": "alpha",
16
16
  "@remote-dom/core": "1.x",
17
17
  "@remote-dom/react": "1.x",
18
- "@stackable-labs/sdk-extension-contracts": "1.35.0"
18
+ "@stackable-labs/sdk-extension-contracts": "1.36.0"
19
19
  },
20
20
  "peerDependencies": {
21
21
  "react": ">=18.0.0 <19.0.0",