react-dialogger 1.1.71 → 1.1.73

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/LICENCE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 [Süleyman Topaloglu]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,15 +1,4 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  Object.defineProperty(exports, "__esModule", { value: true });
14
3
  exports.Actions = void 0;
15
4
  var jsx_runtime_1 = require("react/jsx-runtime");
@@ -18,7 +7,6 @@ var Actions = function (_a) {
18
7
  var actions = _a.actions, dialog = _a.dialog;
19
8
  var dialogOptions = dialog.dialogOptions;
20
9
  return (0, jsx_runtime_1.jsx)("div", { style: { position: 'relative', display: 'flex', flexDirection: 'row', columnGap: 10, alignItems: 'center' }, children: actions.map(function (action, index) {
21
- console.log('Actions_action', __assign(__assign({}, action.options), action.intent));
22
10
  var referencedAction = dialog.initializeActionRef(action.name);
23
11
  action._actionComponent = referencedAction;
24
12
  return (0, jsx_runtime_1.jsx)(_components_1.DialogActionBase, { name: action.name, ref: referencedAction, dialogBaseComponent: dialog,
@@ -105,7 +105,6 @@ var DialogBase = /** @class */ (function (_super) {
105
105
  var action = _this._actionRefs[actionKey];
106
106
  // Save the current disabled state before changing it
107
107
  var currentDisabled = (_d = (_c = action.current) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.disabled;
108
- console.log('this._actions', currentDisabled, process);
109
108
  // Set the options with prevDisabled as the current disabled state
110
109
  if (currentDisabled !== process) {
111
110
  action.current
@@ -175,7 +174,6 @@ var DialogBase = /** @class */ (function (_super) {
175
174
  return _this.props.dom;
176
175
  };
177
176
  _this.render = function () {
178
- console.log('this._prevDialogRect', _this.state.prevDialogRect);
179
177
  return (0, jsx_runtime_1.jsx)(_context_1.DialogContentContextProvider
180
178
  // 1️⃣initialValues={this.props.initialValues}
181
179
  , {
@@ -221,7 +219,6 @@ var DialogBase = /** @class */ (function (_super) {
221
219
  size: _this._dialogSize
222
220
  }
223
221
  }, _this._dialogOptions);
224
- console.log('Dialog_Base_Options', defaultOptions, window["dialogOptions"], props.initialOptions);
225
222
  _this._dialogOptions = (0, lodash_1.merge)({}, defaultOptions, window["dialogOptions"], props.initialOptions);
226
223
  _this._header = props.header;
227
224
  _this._body = props.body;
@@ -239,7 +236,6 @@ var DialogBase = /** @class */ (function (_super) {
239
236
  _this._parent = props.parent;
240
237
  _this._processingListeners = (_a = props.processingListeners) !== null && _a !== void 0 ? _a : [];
241
238
  _this._features = [];
242
- console.log('this._dialogOptions', _this._dialogOptions);
243
239
  return _this;
244
240
  }
245
241
  DialogBase.prototype.addFeature = function (key, value) {
@@ -365,7 +361,7 @@ var DialogBase = /** @class */ (function (_super) {
365
361
  if (typeof ((_c = this.props) === null || _c === void 0 ? void 0 : _c.didMountCallback) === "function") {
366
362
  setTimeout(function () {
367
363
  _this.props.didMountCallback(_this);
368
- }, this.dialogOptions.animate === "jumper" ? 500 : 100);
364
+ }, this.dialogOptions.animate === "jumper" ? 300 : 100);
369
365
  }
370
366
  // accessFrom Property of Parent object Internal->External
371
367
  this.accessFrom = "internal";
@@ -70,6 +70,7 @@ var _1 = require("./");
70
70
  var react_1 = require("react");
71
71
  var jumper_animate_1 = require("../utils/effects/jumper-animate");
72
72
  var _context_1 = require("../context/index.js");
73
+ var appLogger_1 = require("../helpers/appLogger");
73
74
  var DialogContent = function (props) {
74
75
  var _a, _b, _c, _d, _e;
75
76
  var firstUpdate = React.useRef(true);
@@ -100,13 +101,12 @@ var DialogContent = function (props) {
100
101
  if (typeof dialog.props.stateListener === "function") {
101
102
  dialog.props.stateListener(dialog.values, dialog);
102
103
  }
103
- // console.log('DialogContent_actions_refs', dialog._actionRefs);
104
104
  // State Listener Actions
105
105
  for (var actionKey in dialog._actionRefs) {
106
106
  // const action = dialog._actionRefs[actionKey];
107
107
  var actionRef = dialog.initializeActionRef(actionKey);
108
108
  if (typeof actionRef.current._stateListener === "function") {
109
- console.log('DialogContent_actions_ref', actionRef.current._stateListener);
109
+ (0, appLogger_1.appLog)('DialogContent_actions_ref', actionRef.current._stateListener);
110
110
  actionRef.current._stateListener(dialog.values, actionRef === null || actionRef === void 0 ? void 0 : actionRef.current, dialog);
111
111
  }
112
112
  }
@@ -127,14 +127,14 @@ var DialogContent = function (props) {
127
127
  (0, react_1.useEffect)(function () {
128
128
  // Register Dialog Bounds
129
129
  setTimeout(function () {
130
- var _a, _b;
130
+ var _a, _b, _c;
131
131
  if ((_a = dialog.dialogOptions.base) === null || _a === void 0 ? void 0 : _a.memoBounds) {
132
132
  if (!_helpers_1.InitDialogMemoizeBoundsDeclared) {
133
133
  throw new Error('InitDialogMemoizeBounds is not defined. Please make sure to declare it only once, at the top‑level of your module—outside of App or its render logic.\n' +
134
134
  'InitDialogMemoizeBounds()\n' +
135
135
  'const App() => {...');
136
136
  }
137
- var _c = (_b = dialogRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect(), width = _c.width, height = _c.height, x = _c.x, y = _c.y;
137
+ var _d = (_c = (_b = dialogRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect()) !== null && _c !== void 0 ? _c : {}, width = _d.width, height = _d.height, x = _d.x, y = _d.y;
138
138
  (0, _helpers_1.dialogRegister)(dialog.dialogOptions.base.id, {
139
139
  width: width,
140
140
  height: height,
@@ -144,8 +144,11 @@ var DialogContent = function (props) {
144
144
  });
145
145
  }
146
146
  }, 1000);
147
+ return function () {
148
+ dialogRef.current = null;
149
+ };
147
150
  }, []);
148
- return (0, jsx_runtime_1.jsx)(react_draggable_1.default, { disabled: !baseOptions.draggable || fullscreenMode, axis: 'both', handle: baseOptions.draggable ? '.drag-handle' : '', scale: 1, ref: backdropRef, onDrag: function (event, data) {
151
+ return (0, jsx_runtime_1.jsx)(react_draggable_1.default, { disabled: !baseOptions.draggable || fullscreenMode, axis: 'both', handle: baseOptions.draggable ? '.drag-handle' : '', scale: 1, nodeRef: dialogRef, onDrag: function (event, data) {
149
152
  event.stopPropagation();
150
153
  dialog._dialogTranslate = { lastX: data.lastX, lastY: data.lastY };
151
154
  }, onStop: function (event, data) {
@@ -153,7 +156,7 @@ var DialogContent = function (props) {
153
156
  event.stopPropagation();
154
157
  event.preventDefault();
155
158
  var _c = (_a = dialogRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect(), width = _c.width, height = _c.height, x = _c.x, y = _c.y;
156
- console.log('onDragStop', 'fired', (_b = dialogRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect());
159
+ (0, appLogger_1.appLog)('onDragStop', 'fired', (_b = dialogRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect());
157
160
  (0, _helpers_1.setDialogBounds)(dialogOptions.base.id, {
158
161
  width: width,
159
162
  height: height,
@@ -48,6 +48,7 @@ var jsx_runtime_1 = require("react/jsx-runtime");
48
48
  var React = __importStar(require("react"));
49
49
  var react_1 = require("react");
50
50
  var Colorify_1 = require("../helpers/Colorify");
51
+ var appLogger_1 = require("../helpers/appLogger");
51
52
  exports.default = React.forwardRef(function (_a, ref) {
52
53
  var variant = _a.variant, color = _a.color, children = _a.children, disabled = _a.disabled, onClick = _a.onClick, style = _a.style, baseStyle = _a.baseStyle, innerRef = _a.innerRef, fontFamily = _a.fontFamily;
53
54
  var _b = React.useState({ x: -1, y: -1 }), coords = _b[0], setCoords = _b[1];
@@ -87,7 +88,7 @@ exports.default = React.forwardRef(function (_a, ref) {
87
88
  hexedColor = (0, Colorify_1.colorNameToHex)(hexedColor);
88
89
  }
89
90
  exclusive = (0, Colorify_1.getButtonColors)(hexedColor);
90
- console.log('Button_variant', variant);
91
+ (0, appLogger_1.appLog)('Button_variant', variant);
91
92
  if (variant === 'text') {
92
93
  exclusive.backgroundColor = 'inherit';
93
94
  exclusive.color = color; // exclusive.backgroundColor;
@@ -44,6 +44,12 @@ var _icons_1 = require("../icons/index.js");
44
44
  var package_json_1 = __importDefault(require("../package.json"));
45
45
  var _context_1 = require("../context/index.js");
46
46
  var _models_1 = __importStar(require("../models/index.js"));
47
+ // const packageJSon = {
48
+ // author: 'Suleyman Topaloglu',
49
+ // version: '1.1.67',
50
+ // name: 'react-dialogger',
51
+ //
52
+ // }
47
53
  // const DialogFullscreenAction = ({dialog}:{dialog: React.RefObject<IDialogRef> | undefined}) => {
48
54
  var DialogInfoAction = function () {
49
55
  var _a, _b, _c, _d;
@@ -80,7 +86,7 @@ var DialogInfoAction = function () {
80
86
  });
81
87
  dialog
82
88
  .setHeader(function (dialog1) { return 'Info'; })
83
- .setBody(function (dialog1) { return (0, jsx_runtime_1.jsx)("table", { children: (0, jsx_runtime_1.jsxs)("tbody", { children: [(0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: "Name" }), (0, jsx_runtime_1.jsx)("td", { children: package_json_1.default.name })] }), (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: "Varsion" }), (0, jsx_runtime_1.jsx)("td", { children: package_json_1.default.version })] }), (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: "Author" }), (0, jsx_runtime_1.jsx)("td", { children: package_json_1.default.author })] })] }) }); })
89
+ .setBody(function (dialog1) { return (0, jsx_runtime_1.jsx)("table", { children: (0, jsx_runtime_1.jsxs)("tbody", { children: [(0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: "Name" }), (0, jsx_runtime_1.jsx)("td", { children: package_json_1.default === null || package_json_1.default === void 0 ? void 0 : package_json_1.default.name })] }), (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: "Version" }), (0, jsx_runtime_1.jsx)("td", { children: package_json_1.default === null || package_json_1.default === void 0 ? void 0 : package_json_1.default.version })] }), (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: "Author" }), (0, jsx_runtime_1.jsx)("td", { children: package_json_1.default === null || package_json_1.default === void 0 ? void 0 : package_json_1.default.author })] })] }) }); })
84
90
  .addActions([
85
91
  closeAction
86
92
  ])
@@ -13,6 +13,7 @@ var __assign = (this && this.__assign) || function () {
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.Resizeable = void 0;
15
15
  var _helpers_1 = require("./index.js");
16
+ var appLogger_1 = require("./appLogger");
16
17
  var Resizeable = /** @class */ (function () {
17
18
  function Resizeable() {
18
19
  var _this = this;
@@ -30,7 +31,7 @@ var Resizeable = /** @class */ (function () {
30
31
  // Bounds case
31
32
  var container = _this._container.current;
32
33
  var _d = (_c = container === null || container === void 0 ? void 0 : container.getBoundingClientRect()) !== null && _c !== void 0 ? _c : {}, width = _d.width, height = _d.height, x = _d.x, y = _d.y;
33
- console.log('resizeHandleMouseUp', container === null || container === void 0 ? void 0 : container.getBoundingClientRect().toJSON());
34
+ (0, appLogger_1.appLog)('resizeHandleMouseUp', container === null || container === void 0 ? void 0 : container.getBoundingClientRect().toJSON());
34
35
  // setDialogBounds( this._dialogOptions.base.id, {width, height, x, y, fullscreen: false}, this._container );
35
36
  (0, _helpers_1.setDialogBounds)(_this._dialogOptions.base.id, __assign(__assign({}, container === null || container === void 0 ? void 0 : container.getBoundingClientRect().toJSON()), { fullscreen: false }), _this._container);
36
37
  };
@@ -0,0 +1 @@
1
+ export declare const appLog: (...args: any[]) => void;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.appLog = void 0;
4
+ // require('dotenv').config();
5
+ // const isProd = process.env.NODE_ENV === 'production';
6
+ var appLog = function () {
7
+ var args = [];
8
+ for (var _i = 0; _i < arguments.length; _i++) {
9
+ args[_i] = arguments[_i];
10
+ }
11
+ // if (isProd) {
12
+ //
13
+ // }
14
+ // console.log(...args);
15
+ };
16
+ exports.appLog = appLog;
@@ -14,6 +14,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.setDialogBound = exports.setDialogBounds = exports.getDialogBounds = exports.dialogRegister = void 0;
15
15
  // import {registeredDialogs} from "../hooks/initDialogMemoizeBounds";
16
16
  var initDialogMemoizeBounds_1 = require("./initDialogMemoizeBounds");
17
+ var appLogger_1 = require("./appLogger");
17
18
  /**
18
19
  * Read from RAM...
19
20
  * */
@@ -46,7 +47,7 @@ var dialogRegister = function (dialogId, initialBounds) {
46
47
  };
47
48
  // To RAM
48
49
  initDialogMemoizeBounds_1.registeredDialogs.set(combined.join('-'), newDialogBounds);
49
- console.log('dialogRegister_combined', initialBounds, newDialogBounds, combined.join('-'), initDialogMemoizeBounds_1.registeredDialogs, Array.from(initDialogMemoizeBounds_1.registeredDialogs));
50
+ (0, appLogger_1.appLog)('dialogRegister_combined', initialBounds, newDialogBounds, combined.join('-'), initDialogMemoizeBounds_1.registeredDialogs, Array.from(initDialogMemoizeBounds_1.registeredDialogs));
50
51
  // To Store
51
52
  try {
52
53
  window.localStorage.setItem(initDialogMemoizeBounds_1.BOUNDS_STORE_KEY, JSON.stringify(Array.from(initDialogMemoizeBounds_1.registeredDialogs)));
@@ -62,7 +63,7 @@ var getDialogBounds = function (dialogId) {
62
63
  throw new Error('Dialog bounds can not be memoized. Dialog id is required.');
63
64
  }
64
65
  var dialog = dialogInStore(dialogId);
65
- console.log('getDialogBounds_dialog', initDialogMemoizeBounds_1.registeredDialogs, dialog);
66
+ (0, appLogger_1.appLog)('getDialogBounds_dialog', initDialogMemoizeBounds_1.registeredDialogs, dialog);
66
67
  if (dialog) {
67
68
  return dialog.bounds;
68
69
  }
@@ -72,7 +73,7 @@ exports.getDialogBounds = getDialogBounds;
72
73
  var setDialogBounds = function (dialogId, bounds, dialogRef) {
73
74
  var combined = ['guzzle', dialogId];
74
75
  var foundedDialog = initDialogMemoizeBounds_1.registeredDialogs.get(combined.join('-'));
75
- console.log('setDialogBounds_combined', combined, combined.join('-'), bounds, foundedDialog);
76
+ (0, appLogger_1.appLog)('setDialogBounds_combined', combined, combined.join('-'), bounds, foundedDialog);
76
77
  if (foundedDialog) {
77
78
  // Save to RAM
78
79
  initDialogMemoizeBounds_1.registeredDialogs.set(combined.join('-'), {
@@ -91,7 +92,7 @@ var setDialogBounds = function (dialogId, bounds, dialogRef) {
91
92
  *
92
93
  * */
93
94
  // Save to Store
94
- console.log('registeredDialogs', initDialogMemoizeBounds_1.registeredDialogs);
95
+ (0, appLogger_1.appLog)('registeredDialogs', initDialogMemoizeBounds_1.registeredDialogs);
95
96
  try {
96
97
  window.localStorage.setItem(initDialogMemoizeBounds_1.BOUNDS_STORE_KEY, JSON.stringify(Array.from(initDialogMemoizeBounds_1.registeredDialogs)));
97
98
  }
@@ -7,8 +7,6 @@ var formInputKeyListeners = function (wrapperEl) {
7
7
  var inputElements = wrapperEl.querySelectorAll("input");
8
8
  // Tüm input elemanlarını döngüye al
9
9
  inputElements.forEach(function (input) {
10
- console.log(input); // Her bir input elemanını burada işleyebilirsiniz
11
- // Örneğin, input değerini okuma veya ayarlama
12
10
  input.addEventListener('keydown', function (e) { return e.key === "Enter" && e.preventDefault(); }); // Değerini boşaltmak için örnek
13
11
  input.addEventListener('keyup', function (e) { return e.key === "Enter" && e.preventDefault(); }); // Değerini boşaltmak için örnek
14
12
  input.addEventListener('keypress', function (e) { return e.key === "Enter" && e.preventDefault(); }); // Değerini boşaltmak için örnek
@@ -32,12 +32,9 @@ var InitDialogMemoizeBounds = function () {
32
32
  createBoundStore();
33
33
  }
34
34
  var boundsRaw = window.localStorage.getItem(exports.BOUNDS_STORE_KEY);
35
- // console.log('boundsRaw', boundStoreExists, JSON.parse(boundsRaw));
36
35
  var boundsArray = boundsRaw ? JSON.parse(boundsRaw) : [];
37
- console.log('readFromStore-0', boundsArray);
38
36
  return new Map(boundsArray.map(function (d) { return [d[0], d[1]]; }));
39
37
  };
40
- console.log('readFromStore', window.localStorage.getItem(exports.BOUNDS_STORE_KEY), readFromStore());
41
38
  // Set this on App level
42
39
  exports.registeredDialogs = readFromStore();
43
40
  exports.InitDialogMemoizeBoundsDeclared = true;
@@ -1,10 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { DialogAction } from "./DialogAction";
3
3
  import { TInitialHolder, DialogValues, IDialogSize, TDialogStateListenerCallbackType, DialogOptionsType, IDialogApiDef, TDialogCallbackVoidFn, TDialogCallbackFn } from "../types/index.js";
4
- interface DialogProps {
5
- setHeader(header: TDialogCallbackFn): Dialog;
6
- }
7
- declare class Dialog implements DialogProps {
4
+ declare class Dialog {
8
5
  private _processingListeners;
9
6
  private _stateListener;
10
7
  private _keyboardListener;
package/models/Dialog.js CHANGED
@@ -50,6 +50,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
50
50
  var React = __importStar(require("react"));
51
51
  var DialogBase_1 = __importDefault(require("../components/DialogBase"));
52
52
  var client_1 = require("react-dom/client");
53
+ var appLogger_1 = require("../helpers/appLogger");
53
54
  var Dialog = /** @class */ (function () {
54
55
  function Dialog(dialogRef, options) {
55
56
  var _this = this;
@@ -66,7 +67,7 @@ var Dialog = /** @class */ (function () {
66
67
  return highest + 1;
67
68
  };
68
69
  this.createDom = function () {
69
- console.log('this._actions', _this._actions);
70
+ (0, appLogger_1.appLog)('this._actions', _this._actions);
70
71
  var dom = document.createElement('div');
71
72
  dom.setAttribute('role', 'presentation');
72
73
  dom.setAttribute('data-type', 'dialog');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-dialogger",
3
- "version": "1.1.71",
3
+ "version": "1.1.73",
4
4
  "description": "This package is a continuation of the react-araci package. Due to an error, react-araci was removed, and it has been decided to continue under the new package name react-dialogger",
5
5
  "main": "index.js",
6
6
  "author": "Sueleyman Topaloglu",
@@ -20,15 +20,14 @@
20
20
  "email": "developer@appinsource.eu"
21
21
  }
22
22
  ],
23
- "scripts": {
24
- "pb": "npm version patch && npm publish && cp ./package.json ../src/dist.package.json"
25
- },
26
23
  "keywords": [
27
24
  "react",
28
25
  "dialog",
29
26
  "dynamic",
30
27
  "component",
31
28
  "ui",
32
- "react-component"
29
+ "react-component",
30
+ "dynamic dialog",
31
+ "react-dialogger"
33
32
  ]
34
33
  }
@@ -257,4 +257,7 @@ export interface ICoords {
257
257
  x: number;
258
258
  y: number;
259
259
  }
260
+ export interface DialogProps {
261
+ setHeader(header: TDialogCallbackFn): Dialog;
262
+ }
260
263
  export {};