@qoretechnologies/reqraft 0.10.67 → 0.10.68-pr.153.ge7f73b6

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.
@@ -13,7 +13,12 @@ export interface IReqraftTemplateExampleValueModalProps extends Partial<IReqoreM
13
13
  * @default 'Example value copied to clipboard'
14
14
  */
15
15
  copyNotificationContent?: string;
16
- /** Notification shown when the browser denies clipboard access. @default 'Could not copy to clipboard' */
16
+ /**
17
+ * Notification shown when the value could not be copied (the browser refused, or offers no way to copy, as on a
18
+ * page served over plain http that does not allow the copy command): what failed and what to do instead. It stays
19
+ * until it is closed.
20
+ * @default 'Could not copy the example value: the browser did not allow access to the clipboard. Select the text and copy it yourself.'
21
+ */
17
22
  copyFailedNotificationContent?: string;
18
23
  }
19
24
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ExampleValueModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/fields/template/ExampleValueModal.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAGnF,MAAM,WAAW,sCAAuC,SAAQ,OAAO,CAAC,iBAAiB,CAAC;IACxF,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,0GAA0G;IAC1G,6BAA6B,CAAC,EAAE,MAAM,CAAC;CACxC;AASD;;;;;;;;GAQG;AACH,eAAO,MAAM,gCAAgC,qIAQxC,sCAAsC,6CAmD1C,CAAC"}
1
+ {"version":3,"file":"ExampleValueModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/fields/template/ExampleValueModal.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAInF,MAAM,WAAW,sCAAuC,SAAQ,OAAO,CAAC,iBAAiB,CAAC;IACxF,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC;;;;;OAKG;IACH,6BAA6B,CAAC,EAAE,MAAM,CAAC;CACxC;AASD;;;;;;;;GAQG;AACH,eAAO,MAAM,gCAAgC,qIAQxC,sCAAsC,6CAmD1C,CAAC"}
@@ -62,6 +62,7 @@ exports.ReqraftTemplateExampleValueModal = void 0;
62
62
  var jsx_runtime_1 = require("react/jsx-runtime");
63
63
  var reqore_1 = require("@qoretechnologies/reqore");
64
64
  var react_1 = require("react");
65
+ var secureContextApis_1 = require("../../../../helpers/secureContextApis");
65
66
  /* Fill the modal's fixed-height body instead of scaling with content: a
66
67
  content-scaled textarea either stops short of the body (dead space below, a
67
68
  partial-height scrollbar) or explodes it on huge values. Filling hands the
@@ -78,32 +79,32 @@ var FILL_STYLE = { height: '100%' };
78
79
  * rendering it standalone, e.g. in a story).
79
80
  */
80
81
  exports.ReqraftTemplateExampleValueModal = (0, react_1.memo)(function (_a) {
81
- var label = _a.label, value = _a.value, _b = _a.copyLabel, copyLabel = _b === void 0 ? 'Copy' : _b, _c = _a.copyNotificationContent, copyNotificationContent = _c === void 0 ? 'Example value copied to clipboard' : _c, _d = _a.copyFailedNotificationContent, copyFailedNotificationContent = _d === void 0 ? 'Could not copy to clipboard' : _d, rest = __rest(_a, ["label", "value", "copyLabel", "copyNotificationContent", "copyFailedNotificationContent"]);
82
+ var label = _a.label, value = _a.value, _b = _a.copyLabel, copyLabel = _b === void 0 ? 'Copy' : _b, _c = _a.copyNotificationContent, copyNotificationContent = _c === void 0 ? 'Example value copied to clipboard' : _c, _d = _a.copyFailedNotificationContent, copyFailedNotificationContent = _d === void 0 ? 'Could not copy the example value: the browser did not allow access to the clipboard. Select the text and copy it yourself.' : _d, rest = __rest(_a, ["label", "value", "copyLabel", "copyNotificationContent", "copyFailedNotificationContent"]);
82
83
  var addNotification = (0, reqore_1.useReqoreProperty)('addNotification');
83
84
  var handleCopyClick = (0, react_1.useCallback)(function () { return __awaiter(void 0, void 0, void 0, function () {
84
- var error_1;
85
- return __generator(this, function (_a) {
86
- switch (_a.label) {
85
+ var _a;
86
+ return __generator(this, function (_b) {
87
+ switch (_b.label) {
87
88
  case 0:
88
- _a.trys.push([0, 2, , 3]);
89
- return [4 /*yield*/, navigator.clipboard.writeText(value)];
89
+ _b.trys.push([0, 2, , 3]);
90
+ return [4 /*yield*/, (0, secureContextApis_1.copyText)(value)];
90
91
  case 1:
91
- _a.sent();
92
- addNotification({
93
- content: copyNotificationContent,
94
- intent: 'success',
95
- duration: 3000,
96
- });
92
+ _b.sent();
97
93
  return [3 /*break*/, 3];
98
94
  case 2:
99
- error_1 = _a.sent();
95
+ _a = _b.sent();
100
96
  addNotification({
101
97
  content: copyFailedNotificationContent,
102
98
  intent: 'danger',
99
+ });
100
+ return [2 /*return*/];
101
+ case 3:
102
+ addNotification({
103
+ content: copyNotificationContent,
104
+ intent: 'success',
103
105
  duration: 3000,
104
106
  });
105
- return [3 /*break*/, 3];
106
- case 3: return [2 /*return*/];
107
+ return [2 /*return*/];
107
108
  }
108
109
  });
109
110
  }); }, [value, addNotification, copyNotificationContent, copyFailedNotificationContent]);
@@ -1 +1 @@
1
- {"version":3,"file":"ExampleValueModal.js","sourceRoot":"","sources":["../../../../../src/components/form/fields/template/ExampleValueModal.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAA0F;AAE1F,+BAAyD;AAmBzD;;;;gCAIgC;AAChC,IAAM,UAAU,GAAkB,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAErD;;;;;;;;GA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EACjB,YAAY,EAAE,UAAU,GACxB,IACU,CACf,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,wCAAgC,CAAC,WAAW,GAAG,kCAAkC,CAAC"}
1
+ {"version":3,"file":"ExampleValueModal.js","sourceRoot":"","sources":["../../../../../src/components/form/fields/template/ExampleValueModal.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAA0F;AAE1F,+BAAyD;AACzD,2EAAiE;AAwBjE;;;;gCAIgC;AAChC,IAAM,UAAU,GAAkB,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAErD;;;;;;;;GAQG;AACU,QAAA,gCAAgC,GAAG,IAAA,YAAI,EAClD,UAAC,EAOwC;IANvC,IAAA,KAAK,WAAA,EACL,KAAK,WAAA,EACL,iBAAkB,EAAlB,SAAS,mBAAG,MAAM,KAAA,EAClB,+BAA6D,EAA7D,uBAAuB,mBAAG,mCAAmC,KAAA,EAC7D,qCAA4J,EAA5J,6BAA6B,mBAAG,4HAA4H,KAAA,EACzJ,IAAI,cANR,2FAOA,CADQ;IAEP,IAAM,eAAe,GAAG,IAAA,0BAAiB,EAAC,iBAAiB,CAAC,CAAC;IAE7D,IAAM,eAAe,GAAG,IAAA,mBAAW,EAAC;;;;;;oBAIhC,qBAAM,IAAA,4BAAQ,EAAC,KAAK,CAAC,EAAA;;oBAArB,SAAqB,CAAC;;;;oBAEtB,eAAe,CAAC;wBACd,OAAO,EAAE,6BAA6B;wBACtC,MAAM,EAAE,QAAQ;qBACjB,CAAC,CAAC;oBACH,sBAAO;;oBAET,eAAe,CAAC;wBACd,OAAO,EAAE,uBAAuB;wBAChC,MAAM,EAAE,SAAS;wBACjB,QAAQ,EAAE,IAAI;qBACf,CAAC,CAAC;;;;SACJ,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAE,6BAA6B,CAAC,CAAC,CAAC;IAErF,OAAO,CACL,uBAAC,oBAAW,aACV,KAAK,EAAE,KAAK,IAAI,eAAe,EAC/B,IAAI,EAAC,cAAc,EACnB,MAAM,EAAC,MAAM,EACb,SAAS,EAAC,sCAAsC,EAChD,aAAa,EAAE;YACb;gBACE,QAAQ,EAAE,OAAO;gBACjB,KAAK,EAAE,SAAS;gBAChB,IAAI,EAAE,eAAe;gBACrB,OAAO,EAAE;oBACP,eAAe,EAAE,CAAC;gBACpB,CAAC;aACF;SACF,IACG,IAAI,cAER,uBAAC,uBAAc,IACb,QAAQ,QACR,KAAK,EAAE,KAAK,EACZ,OAAO,QACP,KAAK,QACL,KAAK,EAAE,UAAU,EACjB,YAAY,EAAE,UAAU,GACxB,IACU,CACf,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,wCAAgC,CAAC,WAAW,GAAG,kCAAkC,CAAC"}
@@ -12,6 +12,15 @@ export interface IReqraftLogProps extends IReqorePanelProps {
12
12
  autoScroll?: boolean;
13
13
  allowMessageDeletion?: boolean;
14
14
  allowMessageCopy?: boolean;
15
+ /** Notification shown after a message was copied. @default 'Log message copied to clipboard' */
16
+ copyMessageNotificationContent?: string;
17
+ /**
18
+ * Notification shown when a message could not be copied (the browser refused, or offers no way to copy, as on a
19
+ * page served over plain http that does not allow the copy command): what failed and what to do instead. It stays
20
+ * until it is closed.
21
+ * @default 'Could not copy the log message: the browser did not allow access to the clipboard. Select the message and copy it yourself.'
22
+ */
23
+ copyMessageFailedNotificationContent?: string;
15
24
  showTimestamps?: boolean;
16
25
  defaultMessages?: IReqraftWebSocketMessage[];
17
26
  canSendMessages?: boolean;
@@ -27,5 +36,5 @@ export interface IReqraftLogProps extends IReqorePanelProps {
27
36
  messageFormatter?: (message: IReqraftWebSocketMessage) => IReqraftLogMessage;
28
37
  socketOptions?: Omit<IUseReqraftWebSocketOptions, 'url'>;
29
38
  }
30
- export declare const ReqraftLog: ({ url, defaultMessages, autoScroll, allowMessageDeletion, allowMessageCopy, filterable, filterProps, showTimestamps, canSendMessages, sendMessageProps, sendButtonProps, onConnect, onMessage, onMessageClick, onDisconnect, onConnectionError, messageFormatter, socketOptions, size, ...panelProps }: IReqraftLogProps) => import("react/jsx-runtime").JSX.Element;
39
+ export declare const ReqraftLog: ({ url, defaultMessages, autoScroll, allowMessageDeletion, allowMessageCopy, copyMessageNotificationContent, copyMessageFailedNotificationContent, filterable, filterProps, showTimestamps, canSendMessages, sendMessageProps, sendButtonProps, onConnect, onMessage, onMessageClick, onDisconnect, onConnectionError, messageFormatter, socketOptions, size, ...panelProps }: IReqraftLogProps) => import("react/jsx-runtime").JSX.Element;
31
40
  //# sourceMappingURL=Log.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Log.d.ts","sourceRoot":"","sources":["../../../src/components/log/Log.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAe,MAAM,gDAAgD,CAAC;AAChG,OAAO,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAU3F,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAE5B,MAAM,uCAAuC,CAAC;AAE/C,MAAM,WAAW,kBAAmB,SAAQ,qBAAqB;IAC/D,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACzD,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,eAAe,CAAC,EAAE,wBAAwB,EAAE,CAAC;IAC7C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,iBAAiB,CAAC;IAC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C;IAC/B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gGAAgG;IAChG,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC;;;;;OAKG;IACH,oCAAoC,CAAC,EAAE,MAAM,CAAC;IAE9C,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,eAAe,CAAC,EAAE,wBAAwB,EAAE,CAAC;IAC7C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,iBAAiB,CAAC;IACrC,eAAe,CAAC,EAAE,kBAAkB,CAAC;IAErC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAEhC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACxC,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAE3C,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,kBAAkB,CAAC;IAE7E,aAAa,CAAC,EAAE,IAAI,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;CAC1D;AAED,eAAO,MAAM,UAAU,iXAuBpB,gBAAgB,4CAoPlB,CAAC"}
@@ -10,6 +10,42 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
13
49
  var __rest = (this && this.__rest) || function (s, e) {
14
50
  var t = {};
15
51
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -33,24 +69,25 @@ var size_1 = __importDefault(require("lodash/size"));
33
69
  var react_1 = require("react");
34
70
  var react_use_1 = require("react-use");
35
71
  var readableColors_1 = require("../../helpers/readableColors");
72
+ var secureContextApis_1 = require("../../helpers/secureContextApis");
36
73
  var useReadableIntentShade_1 = require("../../hooks/useReadableIntentShade");
37
74
  var useReadableOpacity_1 = require("../../hooks/useReadableOpacity");
38
75
  /** How faded reqore draws a panel's title icon. */
39
76
  var PANEL_TITLE_ICON_ALPHA = 0.7;
40
77
  var useWebSocket_1 = require("../../hooks/useWebSocket/useWebSocket");
41
78
  var ReqraftLog = function (_a) {
42
- var url = _a.url, defaultMessages = _a.defaultMessages, autoScroll = _a.autoScroll, allowMessageDeletion = _a.allowMessageDeletion, allowMessageCopy = _a.allowMessageCopy, filterable = _a.filterable, filterProps = _a.filterProps, showTimestamps = _a.showTimestamps, canSendMessages = _a.canSendMessages, sendMessageProps = _a.sendMessageProps, sendButtonProps = _a.sendButtonProps, onConnect = _a.onConnect, onMessage = _a.onMessage, onMessageClick = _a.onMessageClick, onDisconnect = _a.onDisconnect, onConnectionError = _a.onConnectionError, _b = _a.messageFormatter, messageFormatter = _b === void 0 ? function (message) { return message; } : _b, socketOptions = _a.socketOptions, _c = _a.size, size = _c === void 0 ? 'small' : _c, panelProps = __rest(_a, ["url", "defaultMessages", "autoScroll", "allowMessageDeletion", "allowMessageCopy", "filterable", "filterProps", "showTimestamps", "canSendMessages", "sendMessageProps", "sendButtonProps", "onConnect", "onMessage", "onMessageClick", "onDisconnect", "onConnectionError", "messageFormatter", "socketOptions", "size"]);
79
+ var url = _a.url, defaultMessages = _a.defaultMessages, autoScroll = _a.autoScroll, allowMessageDeletion = _a.allowMessageDeletion, allowMessageCopy = _a.allowMessageCopy, _b = _a.copyMessageNotificationContent, copyMessageNotificationContent = _b === void 0 ? 'Log message copied to clipboard' : _b, _c = _a.copyMessageFailedNotificationContent, copyMessageFailedNotificationContent = _c === void 0 ? 'Could not copy the log message: the browser did not allow access to the clipboard. Select the message and copy it yourself.' : _c, filterable = _a.filterable, filterProps = _a.filterProps, showTimestamps = _a.showTimestamps, canSendMessages = _a.canSendMessages, sendMessageProps = _a.sendMessageProps, sendButtonProps = _a.sendButtonProps, onConnect = _a.onConnect, onMessage = _a.onMessage, onMessageClick = _a.onMessageClick, onDisconnect = _a.onDisconnect, onConnectionError = _a.onConnectionError, _d = _a.messageFormatter, messageFormatter = _d === void 0 ? function (message) { return message; } : _d, socketOptions = _a.socketOptions, _e = _a.size, size = _e === void 0 ? 'small' : _e, panelProps = __rest(_a, ["url", "defaultMessages", "autoScroll", "allowMessageDeletion", "allowMessageCopy", "copyMessageNotificationContent", "copyMessageFailedNotificationContent", "filterable", "filterProps", "showTimestamps", "canSendMessages", "sendMessageProps", "sendButtonProps", "onConnect", "onMessage", "onMessageClick", "onDisconnect", "onConnectionError", "messageFormatter", "socketOptions", "size"]);
43
80
  // a message's time, softer than the message: as soft as it still reads (main:lighten:8 was 2.6:1; qorus#646)
44
81
  var timestampOpacity = (0, useReadableOpacity_1.useReadableOpacity)(0.35);
45
- var _d = (0, react_1.useState)(''), query = _d[0], setQuery = _d[1];
46
- var _e = (0, react_1.useState)(''), message = _e[0], setMessage = _e[1];
47
- var _f = (0, react_1.useState)(null), contentRef = _f[0], setContentRef = _f[1];
48
- var _g = (0, react_1.useState)(autoScroll), shouldAutoScroll = _g[0], setShouldAutoScroll = _g[1];
82
+ var _f = (0, react_1.useState)(''), query = _f[0], setQuery = _f[1];
83
+ var _g = (0, react_1.useState)(''), message = _g[0], setMessage = _g[1];
84
+ var _h = (0, react_1.useState)(null), contentRef = _h[0], setContentRef = _h[1];
85
+ var _j = (0, react_1.useState)(autoScroll), shouldAutoScroll = _j[0], setShouldAutoScroll = _j[1];
49
86
  react_use_1.useScroll;
50
87
  var handleMessage = (0, react_1.useCallback)(function (event) {
51
88
  onMessage === null || onMessage === void 0 ? void 0 : onMessage(event.data);
52
89
  }, [onMessage]);
53
- var _h = (0, useWebSocket_1.useReqraftWebSocket)(__assign({ url: url, onOpen: onConnect, onMessage: handleMessage, onClose: onDisconnect, onError: onConnectionError, useState: true, includeLogMessagesInState: true, includeSentMessagesInState: true }, socketOptions), defaultMessages), messages = _h.messages, status = _h.status, clear = _h.clear, removeMessage = _h.removeMessage, pause = _h.pause, resume = _h.resume, send = _h.send;
90
+ var _k = (0, useWebSocket_1.useReqraftWebSocket)(__assign({ url: url, onOpen: onConnect, onMessage: handleMessage, onClose: onDisconnect, onError: onConnectionError, useState: true, includeLogMessagesInState: true, includeSentMessagesInState: true }, socketOptions), defaultMessages), messages = _k.messages, status = _k.status, clear = _k.clear, removeMessage = _k.removeMessage, pause = _k.pause, resume = _k.resume, send = _k.send;
54
91
  /* the connection's state, as a dot in the title: its intent in a shade that stands out where reqore draws a
55
92
  panel's title icon, at 70% (the success green was 2.1:1) */
56
93
  var statusColor = (0, useReadableIntentShade_1.useReadableIntentShade)(status === 'CLOSED' ? 'danger'
@@ -88,6 +125,36 @@ var ReqraftLog = function (_a) {
88
125
  var handleMessageClick = function (message) {
89
126
  onMessageClick === null || onMessageClick === void 0 ? void 0 : onMessageClick(message);
90
127
  };
128
+ var addNotification = (0, reqore_1.useReqoreProperty)('addNotification');
129
+ // Copying can be refused (permissions, a page served over plain http): the
130
+ // failure is shown, and says what to do, instead of an unhandled rejection.
131
+ var handleCopyClick = (0, react_1.useCallback)(function (text) { return __awaiter(void 0, void 0, void 0, function () {
132
+ var _a;
133
+ return __generator(this, function (_b) {
134
+ switch (_b.label) {
135
+ case 0:
136
+ _b.trys.push([0, 2, , 3]);
137
+ return [4 /*yield*/, (0, secureContextApis_1.copyText)(text)];
138
+ case 1:
139
+ _b.sent();
140
+ return [3 /*break*/, 3];
141
+ case 2:
142
+ _a = _b.sent();
143
+ addNotification({
144
+ content: copyMessageFailedNotificationContent,
145
+ intent: 'danger',
146
+ });
147
+ return [2 /*return*/];
148
+ case 3:
149
+ addNotification({
150
+ content: copyMessageNotificationContent,
151
+ intent: 'success',
152
+ duration: 3000,
153
+ });
154
+ return [2 /*return*/];
155
+ }
156
+ });
157
+ }); }, [addNotification, copyMessageNotificationContent, copyMessageFailedNotificationContent]);
91
158
  return ((0, jsx_runtime_1.jsx)(Panel_1.ReqorePanel, __assign({ size: size, flat: true, getContentRef: setContentRef,
92
159
  /* The filter, Pause and Clear stay in the title bar at every width. Responsive, the bar folded
93
160
  whatever did not fit into a menu: on a phone that was the filter, which no one would look for
@@ -127,7 +194,7 @@ var ReqraftLog = function (_a) {
127
194
  : null, filteredMessages.map(function (_a, index) {
128
195
  var message = _a.message, timestamp = _a.timestamp, paragraphProps = __rest(_a, ["message", "timestamp"]);
129
196
  return ((0, jsx_runtime_1.jsxs)(reqore_1.ReqoreControlGroup, { spaceBetween: true, children: [(0, jsx_runtime_1.jsxs)(reqore_1.ReqoreControlGroup, { children: [showTimestamps && ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreParagraph, { size: size, style: { fontFamily: reqore_1.ReqoreFonts.mono, flexShrink: 0 }, effect: { opacity: timestampOpacity }, children: timestamp })), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreParagraph, __assign({ size: size, onClick: onMessageClick ? function () { return handleMessageClick(message); } : undefined, style: { fontFamily: reqore_1.ReqoreFonts.mono }, className: 'reqraft-log-message' }, paragraphProps, { children: message }), index)] }), (0, jsx_runtime_1.jsxs)(reqore_1.ReqoreControlGroup, { stack: true, fixed: true, children: [allowMessageCopy && ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreButton, { compact: true, onClick: function () {
130
- navigator.clipboard.writeText(message);
197
+ handleCopyClick(message);
131
198
  }, icon: 'FileCopyLine', className: 'reqraft-log-copy-message', fixed: true, minimal: true, size: size, flat: true })), allowMessageDeletion && ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreButton, { compact: true, onClick: function () { return removeMessage(index); }, icon: 'DeleteBinLine', className: 'reqraft-log-delete-message', fixed: true, minimal: true, size: size, flat: true }))] })] }, index));
132
199
  }), canSendMessages && status === 'OPEN' ?
133
200
  (0, jsx_runtime_1.jsxs)(reqore_1.ReqoreControlGroup, { children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreInput, __assign({ size: size, placeholder: 'Send a message', icon: 'SendPlaneLine' }, sendMessageProps, { value: message, onChange: function (e) { return setMessage(e.target.value); } })), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreButton, __assign({ fixed: true, disabled: !message, onClick: function () {
@@ -1 +1 @@
1
- {"version":3,"file":"Log.js","sourceRoot":"","sources":["../../../src/components/log/Log.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAMkC;AAGlC,wEAAgG;AAEhG,qDAAgC;AAChC,+BAAkE;AAClE,uCAAsC;AACtC,+DAA6D;AAC7D,6EAA4E;AAC5E,qEAAoE;AAEpE,mDAAmD;AACnD,IAAM,sBAAsB,GAAG,GAAG,CAAC;AACnC,sEAI+C;AAmCxC,IAAM,UAAU,GAAG,UAAC,EAqBR;IApBjB,IAAA,GAAG,SAAA,EACH,eAAe,qBAAA,EACf,UAAU,gBAAA,EACV,oBAAoB,0BAAA,EACpB,gBAAgB,sBAAA,EAChB,UAAU,gBAAA,EACV,WAAW,iBAAA,EACX,cAAc,oBAAA,EACd,eAAe,qBAAA,EACf,gBAAgB,sBAAA,EAChB,eAAe,qBAAA,EACf,SAAS,eAAA,EACT,SAAS,eAAA,EACT,cAAc,oBAAA,EACd,YAAY,kBAAA,EACZ,iBAAiB,uBAAA,EACjB,wBAAuC,EAAvC,gBAAgB,mBAAG,UAAC,OAAO,IAAK,OAAA,OAAO,EAAP,CAAO,KAAA,EACvC,aAAa,mBAAA,EACb,YAAc,EAAd,IAAI,mBAAG,OAAO,KAAA,EACX,UAAU,cApBY,2TAqB1B,CADc;IAEb,6GAA6G;IAC7G,IAAM,gBAAgB,GAAG,IAAA,uCAAkB,EAAC,IAAI,CAA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AO,EACd,QAAQ,EAAE,UAAC,CAAC,IAAK,OAAA,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAA1B,CAA0B,IAC3C,EACF,uBAAC,qBAAY,aACX,KAAK,QACL,QAAQ,EAAE,CAAC,OAAO,EAClB,OAAO,EAAE;oCACP,IAAI,CAAC,OAAO,CAAC,CAAC;oCACd,UAAU,CAAC,EAAE,CAAC,CAAC;gCACjB,CAAC,EACD,IAAI,EAAC,eAAe,EACpB,MAAM,EAAC,SAAS,IACZ,eAAe,EACnB,IACiB;oBACvB,CAAC,CAAC,IAAI,IACa,IACT,CACf,CAAC;AACJ,CAAC,CAAC;AA3QW,QAAA,UAAU,cA2QrB"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Browser APIs that exist only in a secure context (https, or localhost), with what to do where they do not.
3
+ *
4
+ * Reqraft's components are also served over plain http by address or host name, as a review Storybook or a Qorus
5
+ * instance on a LAN is. There `navigator.clipboard`, `crypto.randomUUID` and `crypto.subtle` are undefined: a copy
6
+ * button that called `navigator.clipboard.writeText` directly threw, and the user was told nothing. Everything in
7
+ * reqraft goes through this module instead; `__tests__/secureContextApisOnlyThroughTheHelper.test.ts` refuses a
8
+ * direct use anywhere else.
9
+ */
10
+ /**
11
+ * A random UUID (version 4): `crypto.randomUUID()` where the browser has it, and otherwise one built from
12
+ * `crypto.getRandomValues()`, which every browser has in any context.
13
+ *
14
+ * It is the tracking module's event id, so there is one implementation: the tracking module imports nothing outside
15
+ * `src/tracking/`, so it cannot take it from here.
16
+ */
17
+ export { eventId as randomUuid } from '../tracking/core/ids';
18
+ /** Thrown when no way of copying worked, so a caller can show that the copy did not happen. */
19
+ export declare class ClipboardUnavailableError extends Error {
20
+ constructor();
21
+ }
22
+ /**
23
+ * Copy text to the clipboard.
24
+ *
25
+ * The Clipboard API where the browser offers it (a secure context), and the browser's copy command where it does not
26
+ * or refuses. Resolves when the text was copied; rejects with {@link ClipboardUnavailableError} when nothing worked,
27
+ * so the caller can say so. It never throws synchronously.
28
+ */
29
+ export declare const copyText: (text: string) => Promise<void>;
30
+ //# sourceMappingURL=secureContextApis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secureContextApis.d.ts","sourceRoot":"","sources":["../../src/helpers/secureContextApis.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH;;;;;;GAMG;AACH,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE7D,+FAA+F;AAC/F,qBAAa,yBAA0B,SAAQ,KAAK;;CAKnD;AA4CD;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,SAAgB,MAAM,KAAG,QAAQ,IAAI,CAczD,CAAC"}
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ // Copyright 2026 Qore Technologies, s.r.o.
3
+ var __extends = (this && this.__extends) || (function () {
4
+ var extendStatics = function (d, b) {
5
+ extendStatics = Object.setPrototypeOf ||
6
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
8
+ return extendStatics(d, b);
9
+ };
10
+ return function (d, b) {
11
+ if (typeof b !== "function" && b !== null)
12
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
13
+ extendStatics(d, b);
14
+ function __() { this.constructor = d; }
15
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
16
+ };
17
+ })();
18
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
19
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
20
+ return new (P || (P = Promise))(function (resolve, reject) {
21
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
22
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
23
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
24
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
25
+ });
26
+ };
27
+ var __generator = (this && this.__generator) || function (thisArg, body) {
28
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
29
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
30
+ function verb(n) { return function (v) { return step([n, v]); }; }
31
+ function step(op) {
32
+ if (f) throw new TypeError("Generator is already executing.");
33
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
34
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
35
+ if (y = 0, t) op = [op[0] & 2, t.value];
36
+ switch (op[0]) {
37
+ case 0: case 1: t = op; break;
38
+ case 4: _.label++; return { value: op[1], done: false };
39
+ case 5: _.label++; y = op[1]; op = [0]; continue;
40
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
41
+ default:
42
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
43
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
44
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
45
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
46
+ if (t[2]) _.ops.pop();
47
+ _.trys.pop(); continue;
48
+ }
49
+ op = body.call(thisArg, _);
50
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
51
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
52
+ }
53
+ };
54
+ Object.defineProperty(exports, "__esModule", { value: true });
55
+ exports.copyText = exports.ClipboardUnavailableError = exports.randomUuid = void 0;
56
+ /**
57
+ * Browser APIs that exist only in a secure context (https, or localhost), with what to do where they do not.
58
+ *
59
+ * Reqraft's components are also served over plain http by address or host name, as a review Storybook or a Qorus
60
+ * instance on a LAN is. There `navigator.clipboard`, `crypto.randomUUID` and `crypto.subtle` are undefined: a copy
61
+ * button that called `navigator.clipboard.writeText` directly threw, and the user was told nothing. Everything in
62
+ * reqraft goes through this module instead; `__tests__/secureContextApisOnlyThroughTheHelper.test.ts` refuses a
63
+ * direct use anywhere else.
64
+ */
65
+ /**
66
+ * A random UUID (version 4): `crypto.randomUUID()` where the browser has it, and otherwise one built from
67
+ * `crypto.getRandomValues()`, which every browser has in any context.
68
+ *
69
+ * It is the tracking module's event id, so there is one implementation: the tracking module imports nothing outside
70
+ * `src/tracking/`, so it cannot take it from here.
71
+ */
72
+ var ids_1 = require("../tracking/core/ids");
73
+ Object.defineProperty(exports, "randomUuid", { enumerable: true, get: function () { return ids_1.eventId; } });
74
+ /** Thrown when no way of copying worked, so a caller can show that the copy did not happen. */
75
+ var ClipboardUnavailableError = /** @class */ (function (_super) {
76
+ __extends(ClipboardUnavailableError, _super);
77
+ function ClipboardUnavailableError() {
78
+ var _this = _super.call(this, 'The browser did not allow copying to the clipboard.') || this;
79
+ _this.name = 'ClipboardUnavailableError';
80
+ return _this;
81
+ }
82
+ return ClipboardUnavailableError;
83
+ }(Error));
84
+ exports.ClipboardUnavailableError = ClipboardUnavailableError;
85
+ /**
86
+ * Copy with a selected, off-screen text area and the browser's copy command: what works where the Clipboard API is
87
+ * not offered. The focus and the selection the user had are put back afterwards.
88
+ */
89
+ var copyWithSelection = function (text) {
90
+ var _a;
91
+ if (typeof document === 'undefined' ||
92
+ typeof document.execCommand !== 'function' ||
93
+ !document.body) {
94
+ return false;
95
+ }
96
+ var active = document.activeElement;
97
+ var selection = document.getSelection();
98
+ var ranges = selection && selection.rangeCount ?
99
+ Array.from({ length: selection.rangeCount }, function (_, index) { return selection.getRangeAt(index); })
100
+ : [];
101
+ var area = document.createElement('textarea');
102
+ area.value = text;
103
+ area.setAttribute('readonly', '');
104
+ area.setAttribute('aria-hidden', 'true');
105
+ area.style.position = 'fixed';
106
+ area.style.top = '0';
107
+ area.style.left = '-9999px';
108
+ area.style.opacity = '0';
109
+ document.body.appendChild(area);
110
+ try {
111
+ area.select();
112
+ return document.execCommand('copy');
113
+ }
114
+ catch (_b) {
115
+ return false;
116
+ }
117
+ finally {
118
+ area.remove();
119
+ if (selection) {
120
+ selection.removeAllRanges();
121
+ ranges.forEach(function (range) { return selection.addRange(range); });
122
+ }
123
+ (_a = active === null || active === void 0 ? void 0 : active.focus) === null || _a === void 0 ? void 0 : _a.call(active, { preventScroll: true });
124
+ }
125
+ };
126
+ /**
127
+ * Copy text to the clipboard.
128
+ *
129
+ * The Clipboard API where the browser offers it (a secure context), and the browser's copy command where it does not
130
+ * or refuses. Resolves when the text was copied; rejects with {@link ClipboardUnavailableError} when nothing worked,
131
+ * so the caller can say so. It never throws synchronously.
132
+ */
133
+ var copyText = function (text) { return __awaiter(void 0, void 0, void 0, function () {
134
+ var clipboard, _a;
135
+ return __generator(this, function (_b) {
136
+ switch (_b.label) {
137
+ case 0:
138
+ clipboard = typeof navigator !== 'undefined' ? navigator.clipboard : undefined;
139
+ if (!(typeof (clipboard === null || clipboard === void 0 ? void 0 : clipboard.writeText) === 'function')) return [3 /*break*/, 4];
140
+ _b.label = 1;
141
+ case 1:
142
+ _b.trys.push([1, 3, , 4]);
143
+ return [4 /*yield*/, clipboard.writeText(text)];
144
+ case 2:
145
+ _b.sent();
146
+ return [2 /*return*/];
147
+ case 3:
148
+ _a = _b.sent();
149
+ return [3 /*break*/, 4];
150
+ case 4:
151
+ if (copyWithSelection(text)) {
152
+ return [2 /*return*/];
153
+ }
154
+ throw new ClipboardUnavailableError();
155
+ }
156
+ });
157
+ }); };
158
+ exports.copyText = copyText;
159
+ //# sourceMappingURL=secureContextApis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secureContextApis.js","sourceRoot":"","sources":["../../src/helpers/secureContextApis.ts"],"names":[],"mappings":";AAAA,2CAA2C;;;;;;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yBAAyB,EAAE,CAAC;;;KACvC,CAAC;AAdW,QAAA,QAAQ,YAcnB"}
@@ -1,6 +1,14 @@
1
1
  /** Random ids from the platform CSPRNG (never Math.random: ids must not collide or be guessable). */
2
2
  /** `bytes` random bytes as base64url: 16 bytes = 128 bits = 22 characters. */
3
3
  export declare const randomId: (bytes?: number) => string;
4
- /** Event id (a UUID v4). */
4
+ /**
5
+ * Event id (a UUID v4).
6
+ *
7
+ * `crypto.randomUUID` exists only in a secure context (https, or localhost), so on a page served over plain http it
8
+ * is built from `crypto.getRandomValues`, which every browser has in any context: 16 random bytes with the version
9
+ * (4) and the variant (10xx) bits set, as RFC 9562 defines a version 4 UUID. The rest of reqraft takes it as
10
+ * `randomUuid` from `src/helpers/secureContextApis.ts`; it lives here because the tracking module imports nothing
11
+ * outside `src/tracking/`.
12
+ */
5
13
  export declare const eventId: () => string;
6
14
  //# sourceMappingURL=ids.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../../src/tracking/core/ids.ts"],"names":[],"mappings":"AAAA,qGAAqG;AAQrG,8EAA8E;AAC9E,eAAO,MAAM,QAAQ,sBAAiB,MAIrC,CAAC;AAEF,4BAA4B;AAC5B,eAAO,MAAM,OAAO,QAAO,MAQ1B,CAAC"}
1
+ {"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../../src/tracking/core/ids.ts"],"names":[],"mappings":"AAAA,qGAAqG;AAQrG,8EAA8E;AAC9E,eAAO,MAAM,QAAQ,sBAAiB,MAIrC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,QAAO,MAQ1B,CAAC"}
@@ -15,7 +15,15 @@ var randomId = function (bytes) {
15
15
  return toBase64Url(buf);
16
16
  };
17
17
  exports.randomId = randomId;
18
- /** Event id (a UUID v4). */
18
+ /**
19
+ * Event id (a UUID v4).
20
+ *
21
+ * `crypto.randomUUID` exists only in a secure context (https, or localhost), so on a page served over plain http it
22
+ * is built from `crypto.getRandomValues`, which every browser has in any context: 16 random bytes with the version
23
+ * (4) and the variant (10xx) bits set, as RFC 9562 defines a version 4 UUID. The rest of reqraft takes it as
24
+ * `randomUuid` from `src/helpers/secureContextApis.ts`; it lives here because the tracking module imports nothing
25
+ * outside `src/tracking/`.
26
+ */
19
27
  var eventId = function () {
20
28
  var _a;
21
29
  if (typeof ((_a = globalThis.crypto) === null || _a === void 0 ? void 0 : _a.randomUUID) === 'function')
@@ -1 +1 @@
1
- {"version":3,"file":"ids.js","sourceRoot":"","sources":["../../../src/tracking/core/ids.ts"],"names":[],"mappings":";AAAA,qGAAqG;;;AAErG,IAAM,WAAW,GAAG,UAAC,KAAiB;IACpC,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,CAAC,OAAO,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAA/B,CAA+B,CAAC,CAAC;IACtD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAC9E,CAAC,CAAC;AAEF,8EAA8E;AACvE,IAAM,QAAQ,GAAG,UAAC,KAAU;IAAV,sBAAA,EAAA,UAAU;IACjC,IAAM,GAAG,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IAClC,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;IACvC,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC,CAAC;AAJW,QAAA,QAAQ,YAInB;AAEF,4BAA4B;AACrB,IAAM,OAAO,GAAG;;IACrB,IAAI,OAAO,CAAA,MAAA,UAAU,CAAC,MAAM,0CAAE,UAAU,CAAA,KAAK,UAAU;QAAE,OAAO,UAAU,CAAC,MAAM,CAAC,UAAU,E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AK,CAAC,CAAC,EAAE,CAAC,CAAC,cAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,cAAI,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,cAAI,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,cAAI,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAE,CAAC;AACnG,CAAC,CAAC;AARW,QAAA,OAAO,WAQlB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qoretechnologies/reqraft",
3
- "version": "0.10.67",
3
+ "version": "0.10.68-pr.153.ge7f73b6",
4
4
  "description": "ReQraft is a collection of React components and hooks that are used across Qore Technologies' products made using the ReQore component library from Qore.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",