@nuraly/runtime 0.1.4 → 0.1.5
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/components/ui/nuraly-ui/packages/common/dist/shared/controllers/dropdown.controller.d.ts +0 -1
- package/components/ui/nuraly-ui/packages/common/dist/shared/controllers/dropdown.interface.d.ts +0 -2
- package/components/ui/nuraly-ui/packages/common/dist/shared/controllers/theme.controller.d.ts +0 -1
- package/components/ui/nuraly-ui/packages/common/dist/shared/event-handler-mixin.d.ts +0 -1
- package/components/ui/nuraly-ui/packages/common/dist/shared/theme-mixin.d.ts +0 -1
- package/components/ui/nuraly-ui/packages/common/dist/shared/themes.d.ts +0 -1
- package/components/ui/nuraly-ui/packages/common/dist/shared/utils.d.ts +60 -0
- package/components/ui/nuraly-ui/packages/common/dist/shared/validation.types.d.ts +108 -0
- package/components/ui/nuraly-ui/src/components/radio-group/radio-group.component.ts +1 -1
- package/components/ui/nuraly-ui/src/components/radio-group/radio-group.types.ts +1 -0
- package/dist/CodeEditor-BiNku87K.js +808 -0
- package/dist/{CodeEditor-Ch2tv9BE.js → CodeEditor-G6E8PUI7.js} +14593 -14607
- package/dist/{SmartAttributeHandler-hoSLpm1Y.js → SmartAttributeHandler-C9vS-cHW.js} +1 -1
- package/dist/SmartAttributeHandler-u-ZHGueR.js +193 -0
- package/dist/assets/editor.worker-C_S4Avdt.js +11 -0
- package/dist/assets/{html.worker-BSmGlhXp.js → html.worker-DfuQASUV.js} +18 -18
- package/dist/assets/json.worker-Cucz4wxY.js +42 -0
- package/dist/assets/{ts.worker-DyHHPhrh.js → ts.worker-Dme6S0YK.js} +78 -78
- package/dist/cssMode-B7NVlrDV.js +1443 -0
- package/dist/{freemarker2-DNc2IxPf.js → freemarker2-DS_7G9b8.js} +1 -1
- package/dist/{handlebars-CIbFckEw.js → handlebars-BDyyLkzw.js} +1 -1
- package/dist/{html-nRs_fneU.js → html-DphGFjig.js} +1 -1
- package/dist/{htmlMode-BjehA1YF.js → htmlMode-4zNnSWFo.js} +278 -281
- package/dist/index-B4yIOSMd.js +3847 -0
- package/dist/{javascript-Bn0HduZA.js → javascript-CC1jWyQy.js} +1 -1
- package/dist/{jsonMode-CfGfcJRX.js → jsonMode-Bfzb6wZf.js} +369 -372
- package/dist/{liquid-m4D_LCnC.js → liquid-lTBpqagR.js} +1 -1
- package/dist/{mdx-CakMRbCr.js → mdx-DX66Bp07.js} +1 -1
- package/dist/{micro-app-entry-CI1Rupdh.js → micro-app-entry-DDsAWUJh.js} +5138 -5322
- package/dist/micro-app.bundle.js +1 -1
- package/dist/micro-app.js +9775 -0
- package/dist/{python-oJwaiPUY.js → python-BGUhyO4G.js} +1 -1
- package/dist/{razor-u_dd4rqc.js → razor-DEVWQFSa.js} +1 -1
- package/dist/runtime.js +401 -0
- package/dist/style.css +1 -1
- package/dist/tsMode-CYFi80Jf.js +800 -0
- package/dist/{typescript-Bjs2N5Be.js → typescript-B1xIbH_T.js} +1 -1
- package/dist/{wgsl-Bv2xeo60.js → wgsl-C9yjop46.js} +1 -1
- package/dist/{xml-BCveATLl.js → xml-DmdvyqrE.js} +1 -1
- package/dist/{yaml-BfWQPJQi.js → yaml-LGNo48fy.js} +1 -1
- package/package.json +2 -2
- package/vite.config.ts +8 -8
- package/dist/.claude/settings.local.json +0 -9
- package/dist/assets/editor.worker-vBWydyGC.js +0 -11
- package/dist/assets/json.worker-Dqnoedz4.js +0 -42
- package/dist/cssMode-Bt2uK8XM.js +0 -1446
- package/dist/micro-app.bundle.umd.cjs +0 -5051
- package/dist/tsMode-DlZ38d3D.js +0 -813
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as i } from "./CodeEditor-
|
|
1
|
+
import { m as i } from "./CodeEditor-G6E8PUI7.js";
|
|
2
2
|
/*!-----------------------------------------------------------------------------
|
|
3
3
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
4
|
* Version: 0.45.0(5e5af013f8d295555a7210df0d5f2cea0bf5dd56)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m } from "./CodeEditor-
|
|
1
|
+
import { m } from "./CodeEditor-G6E8PUI7.js";
|
|
2
2
|
/*!-----------------------------------------------------------------------------
|
|
3
3
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
4
|
* Version: 0.45.0(5e5af013f8d295555a7210df0d5f2cea0bf5dd56)
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import { $ as $components, u as updateComponentHandler, r as removeComponentToCurrentPageAction, a as $hoveredComponentId, b as $showShareApplicationModal, A as APIS_URL, c as $applicationPermission, d as $permissionsState, e as $currentApplication, f as updateApplicationActionHandler, g as $showCreateApplicationModal, F as FRONT_API_URLS, h as $editorState, i as $environment, j as addPageHandler, k as $currentPageId, l as $currentPageViewPort, m as $showBorder, n as $pageSize, o as $pages, p as $pageZoom } from './index-B4yIOSMd.js';
|
|
2
|
+
export { t as $applicationComponents, a2 as $applicationPages, Y as $applications, L as $componentById, G as $componentRuntimeValueByKey, D as $componentRuntimeValuesById, z as $componentWithChildren, H as $componentsByUUIDs, a4 as $context, a0 as $contextMenuEvent, w as $currentComponentId, _ as $currentPage, a7 as $debug, y as $draggingComponentInfo, x as $hoveredComponent, a1 as $microAppCurrentPage, a8 as $providers, Z as $resizing, B as $runtimeStyles, I as $runtimeStylescomponentStyleByID, C as $runtimeValues, v as $selectedComponent, a6 as $toasts, bc as EMPTY_STRING, q as Editor, E as ExecuteInstance, b5 as FORBIDDEN_FUNCTIONS, b3 as FORBIDDEN_GLOBALS, b4 as FORBIDDEN_PROPERTIES, ba as GenerateName, aR as LOG_LEVELS, aN as Logger, bb as NO_EVENT_LISTENER, aX as RuntimeContextHelpers, s as RuntimeHelpers, R as RuntimeInstance, b6 as VALIDATION_ERROR_MESSAGES, a5 as ViewMode, ac as addComponentAction, aA as addComponentHandler, ad as addComponentToCurrentPageAction, ax as addGeneratedComponents, ap as addPageToApplicationAction, aJ as addPermission, aq as addTempApplication, ay as addlogDebug, S as clearAllRuntimeValues, T as clearComponentRuntimeStyleAttributes, Q as clearComponentRuntimeValue, P as clearComponentRuntimeValues, au as closeCreateApplicationModalAction, ab as compileHandlerFunction, aT as copyCpmponentToClipboard, aH as createApplicationAction, aI as deleteApplicationAction, ae as deleteComponentAction, aB as deleteComponentActionHandler, al as deletePageAction, aE as deletePageHandler, aQ as enableBenchmarking, aP as enableLogging, aS as eventDispatcher, a9 as executeHandler, X as extractAllChildrenIds, W as extractChildresIds, V as fillApplicationComponents, U as fillComponentChildren, b7 as formatValidationErrors, aW as generateNuralyClipboardStructure, J as getAllChildrenRecursive, aa as getContextFromComponent, K as getDirectChildren, b2 as getErrorMessage, b8 as getNestedAttribute, b9 as hasOnlyEmptyObjects, aK as invokeFunctionHandler, b0 as isAllowedGlobal, b1 as isForbiddenFunction, a_ as isForbiddenGlobal, a$ as isForbiddenProperty, aL as loadFunctionsHandler, aG as loadOrRefreshApplications, af as moveDraggedComponent, av as openEditorTab, aU as pasteComponentFromClipboard, a3 as refreshPageStoreVar, aF as refreshPagesActionHandler, aM as renderComponent, az as resetComponentDebug, ar as setApplication, M as setComponentRuntimeValue, N as setComponentRuntimeValues, am as setContextMenuEvent, ag as setCurrentComponentIdAction, aw as setCurrentEditorTab, ah as setDraggingComponentInfo, ai as setHoveredComponentAction, aO as setLogLevel, as as setPermissionMessage, an as setResizing, O as setcomponentRuntimeStyleAttribute, aV as traitCompoentFromSchema, at as updateApplication, ak as updateComponentAttributes, aj as updateComponentName, ao as updatePageAction, aD as updatePageHandler, aC as validateAndEmitErrors, aZ as validateComponentHandlers, aY as validateHandlerCode } from './index-B4yIOSMd.js';
|
|
3
|
+
import { v4 } from 'uuid';
|
|
4
|
+
import 'acorn';
|
|
5
|
+
import 'acorn-walk';
|
|
6
|
+
import 'fast-deep-equal';
|
|
7
|
+
|
|
8
|
+
function addComponentAsChildOf(componentId, parentComponentId, application_id) {
|
|
9
|
+
const componentsStore = $components.get();
|
|
10
|
+
const components = componentsStore[application_id] || [];
|
|
11
|
+
const parentComponent = components.find((component) => component.uuid === parentComponentId);
|
|
12
|
+
if (parentComponent) {
|
|
13
|
+
if (!parentComponent.childrenIds) {
|
|
14
|
+
parentComponent.childrenIds = [];
|
|
15
|
+
}
|
|
16
|
+
parentComponent.childrenIds.push(componentId);
|
|
17
|
+
setTimeout(() => {
|
|
18
|
+
updateComponentHandler(parentComponent, application_id);
|
|
19
|
+
}, 0);
|
|
20
|
+
componentsStore[application_id] = [...components];
|
|
21
|
+
$components.set(componentsStore);
|
|
22
|
+
} else {
|
|
23
|
+
console.error(`Parent component with ID ${parentComponentId} not found.`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function copyComponentAction(componentId) {
|
|
28
|
+
const components = $components.get();
|
|
29
|
+
const componentToCopy = components.find((component) => component.uuid === componentId);
|
|
30
|
+
if (componentToCopy) {
|
|
31
|
+
clipboardComponent = { ...componentToCopy, id: v4() };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function moveDraggedComponentInside(dropInComponentId, draggedComponentId) {
|
|
36
|
+
let components = $components.get();
|
|
37
|
+
let draggedComponent;
|
|
38
|
+
let parentDraggedComponent;
|
|
39
|
+
let dropInComponent;
|
|
40
|
+
function findComponentsRecursively(component) {
|
|
41
|
+
if (component.uuid === draggedComponentId) {
|
|
42
|
+
draggedComponent = component;
|
|
43
|
+
}
|
|
44
|
+
if (component.uuid === dropInComponentId) {
|
|
45
|
+
dropInComponent = component;
|
|
46
|
+
}
|
|
47
|
+
parentDraggedComponent = components.find((c) => c.childrenIds?.includes(draggedComponentId));
|
|
48
|
+
if (!draggedComponent || !dropInComponent) {
|
|
49
|
+
if (component.childrenIds) {
|
|
50
|
+
for (const childId of component.childrenIds) {
|
|
51
|
+
const child = components.find((c) => c.id === childId);
|
|
52
|
+
if (child) {
|
|
53
|
+
findComponentsRecursively(child);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
for (const component of components) {
|
|
60
|
+
findComponentsRecursively(component);
|
|
61
|
+
}
|
|
62
|
+
if (draggedComponent && dropInComponent && draggedComponent !== dropInComponent) {
|
|
63
|
+
if (!dropInComponent.childrenIds) {
|
|
64
|
+
dropInComponent.childrenIds = [];
|
|
65
|
+
}
|
|
66
|
+
if (!dropInComponent.childrenIds.includes(draggedComponentId)) {
|
|
67
|
+
dropInComponent.childrenIds.push(draggedComponentId);
|
|
68
|
+
removeComponentToCurrentPageAction(draggedComponentId);
|
|
69
|
+
if (parentDraggedComponent && parentDraggedComponent.childrenIds) {
|
|
70
|
+
parentDraggedComponent.childrenIds = parentDraggedComponent.childrenIds.filter(
|
|
71
|
+
(childId) => childId !== draggedComponentId
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
$components.set([...components]);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function moveDraggedComponentIntoCurrentPageRoot(draggedComponentId) {
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function setHoveredComponentIdAction(componentId) {
|
|
83
|
+
$hoveredComponentId.set(componentId);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
let clipboardComponent$1 = null;
|
|
87
|
+
|
|
88
|
+
function closeShareApplicationModalAction() {
|
|
89
|
+
$showShareApplicationModal.set(false);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async function fetchApplicationPermission(id, resourceId) {
|
|
93
|
+
try {
|
|
94
|
+
const response = await fetch(APIS_URL.getApplicationPermission(id, resourceId));
|
|
95
|
+
if (!response.ok) {
|
|
96
|
+
throw new Error(`Failed to fetch permission: ${response.statusText}`);
|
|
97
|
+
}
|
|
98
|
+
const data = await response.json();
|
|
99
|
+
return {
|
|
100
|
+
status: "OK",
|
|
101
|
+
data
|
|
102
|
+
};
|
|
103
|
+
} catch (error) {
|
|
104
|
+
return {
|
|
105
|
+
status: "ERROR",
|
|
106
|
+
error
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function setApplicationPermissionAction(permission) {
|
|
112
|
+
$applicationPermission.set(permission);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async function loadApplicationPermissionAction(id, resource_id) {
|
|
116
|
+
const permission = await fetchApplicationPermission(id, resource_id);
|
|
117
|
+
if (permission.data) {
|
|
118
|
+
setApplicationPermissionAction(permission.data);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function resetPermissionMessage() {
|
|
123
|
+
$permissionsState.set({
|
|
124
|
+
...$permissionsState.get(),
|
|
125
|
+
message: ""
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function setDefaultApplicationPageIfNotSet(uuid) {
|
|
130
|
+
if (!$currentApplication.get().default_page_uuid) {
|
|
131
|
+
$currentApplication.set({
|
|
132
|
+
...$currentApplication.get(),
|
|
133
|
+
default_page_uuid: uuid
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
updateApplicationActionHandler($currentApplication.get());
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function showCreateApplicationModalAction() {
|
|
140
|
+
$showCreateApplicationModal.set(true);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function showShareApplicationModalAction() {
|
|
144
|
+
$showShareApplicationModal.set(true);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const buildFunctionHandler = (functionId) => {
|
|
148
|
+
return fetch(`${FRONT_API_URLS.FUNCTIONS}/build/${functionId}`, {
|
|
149
|
+
method: "POST",
|
|
150
|
+
headers: {
|
|
151
|
+
"Content-Type": "application/json"
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const deployFunctionHandler = (functionId) => {
|
|
157
|
+
return fetch(`${FRONT_API_URLS.FUNCTIONS}/deploy/${functionId}`, {
|
|
158
|
+
method: "POST",
|
|
159
|
+
headers: {
|
|
160
|
+
"Content-Type": "application/json"
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const updateFunctionHandler = (functionElement) => {
|
|
166
|
+
return fetch(`${FRONT_API_URLS.FUNCTIONS}/${functionElement.id}`, {
|
|
167
|
+
method: "PUT",
|
|
168
|
+
headers: {
|
|
169
|
+
"Content-Type": "application/json"
|
|
170
|
+
},
|
|
171
|
+
body: JSON.stringify({
|
|
172
|
+
...functionElement
|
|
173
|
+
})
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
function closeEditorTab(tab) {
|
|
178
|
+
$editorState.set({
|
|
179
|
+
...$editorState.get(),
|
|
180
|
+
tabs: $editorState.get().tabs.filter((t) => t.id !== tab.id)
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function setEnvirementMode(mode) {
|
|
185
|
+
$environment.set({
|
|
186
|
+
mode
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function addPageAction(page) {
|
|
191
|
+
addPageHandler(page);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function setCurrentPageAction(pageId) {
|
|
195
|
+
$currentPageId("1").set(pageId);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function setCurrentPageViewPort(viewPort) {
|
|
199
|
+
$currentPageViewPort.set(viewPort);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function setShowBorder(showBorder) {
|
|
203
|
+
$showBorder.set(showBorder);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function updatePageInfo(pageInfo) {
|
|
207
|
+
$pageSize.set(pageInfo);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function updatePageStyleAttributes(pageId, style) {
|
|
211
|
+
$pages.set([
|
|
212
|
+
...$pages.get().map((page) => {
|
|
213
|
+
if (page.uuid === pageId) {
|
|
214
|
+
page = { ...page, style };
|
|
215
|
+
}
|
|
216
|
+
return page;
|
|
217
|
+
})
|
|
218
|
+
]);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function updatePageZoom(pageZoom) {
|
|
222
|
+
$pageZoom.set(String(pageZoom));
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function setEnvironmentMode(mode) {
|
|
226
|
+
$environment.set({ ...$environment.get(), mode });
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const refreshComponentActionHandler = async (uuid) => {
|
|
230
|
+
try {
|
|
231
|
+
const response = await fetch(`${FRONT_API_URLS.REFRESH_COMPONENTS}/${uuid}`, {
|
|
232
|
+
method: "GET",
|
|
233
|
+
headers: {
|
|
234
|
+
"Content-Type": "application/json"
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
if (!response.ok) {
|
|
238
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
239
|
+
}
|
|
240
|
+
const components = await response.json();
|
|
241
|
+
$components.set(
|
|
242
|
+
{ ...$components.get(), [uuid]: components }
|
|
243
|
+
);
|
|
244
|
+
} catch (err) {
|
|
245
|
+
console.error(err);
|
|
246
|
+
throw err;
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
class LocalStorage {
|
|
251
|
+
static get(key, defaultValue) {
|
|
252
|
+
const stored = localStorage.getItem(key);
|
|
253
|
+
try {
|
|
254
|
+
return stored ? JSON.parse(stored) : defaultValue;
|
|
255
|
+
} catch {
|
|
256
|
+
return defaultValue;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
static set(key, value) {
|
|
260
|
+
localStorage.setItem(key, JSON.stringify(value));
|
|
261
|
+
}
|
|
262
|
+
static remove(key) {
|
|
263
|
+
localStorage.removeItem(key);
|
|
264
|
+
}
|
|
265
|
+
static clear() {
|
|
266
|
+
localStorage.clear();
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function processHeaders(astroHeaders) {
|
|
271
|
+
const headers = {};
|
|
272
|
+
astroHeaders.forEach((value, key) => {
|
|
273
|
+
headers[key] = value;
|
|
274
|
+
});
|
|
275
|
+
delete headers["connection"];
|
|
276
|
+
return headers;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function getStyleFronmAttribute(attributes) {
|
|
280
|
+
Object.keys(attributes).map((attribute) => {
|
|
281
|
+
return;
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function debounce(fn, delay, options = {}) {
|
|
286
|
+
const { leading = false, trailing = true, maxWait } = options;
|
|
287
|
+
let timeoutId = null;
|
|
288
|
+
let maxWaitTimeoutId = null;
|
|
289
|
+
let lastCallTime = null;
|
|
290
|
+
let lastInvokeTime = 0;
|
|
291
|
+
let lastArgs = null;
|
|
292
|
+
let lastThis = null;
|
|
293
|
+
let result;
|
|
294
|
+
const invokeFunc = (time) => {
|
|
295
|
+
const args = lastArgs;
|
|
296
|
+
const thisArg = lastThis;
|
|
297
|
+
lastArgs = null;
|
|
298
|
+
lastThis = null;
|
|
299
|
+
lastInvokeTime = time;
|
|
300
|
+
result = fn.apply(thisArg, args);
|
|
301
|
+
return result;
|
|
302
|
+
};
|
|
303
|
+
const startTimer = (pendingFunc, wait) => {
|
|
304
|
+
return setTimeout(pendingFunc, wait);
|
|
305
|
+
};
|
|
306
|
+
const cancelTimer = (id) => {
|
|
307
|
+
clearTimeout(id);
|
|
308
|
+
};
|
|
309
|
+
const leadingEdge = (time) => {
|
|
310
|
+
lastInvokeTime = time;
|
|
311
|
+
timeoutId = startTimer(timerExpired, delay);
|
|
312
|
+
return leading ? invokeFunc(time) : result;
|
|
313
|
+
};
|
|
314
|
+
const remainingWait = (time) => {
|
|
315
|
+
const timeSinceLastCall = time - lastCallTime;
|
|
316
|
+
const timeSinceLastInvoke = time - lastInvokeTime;
|
|
317
|
+
const timeWaiting = delay - timeSinceLastCall;
|
|
318
|
+
return maxWait !== void 0 ? Math.min(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
|
|
319
|
+
};
|
|
320
|
+
const shouldInvoke = (time) => {
|
|
321
|
+
const timeSinceLastCall = time - lastCallTime;
|
|
322
|
+
const timeSinceLastInvoke = time - lastInvokeTime;
|
|
323
|
+
return lastCallTime === null || timeSinceLastCall >= delay || timeSinceLastCall < 0 || maxWait !== void 0 && timeSinceLastInvoke >= maxWait;
|
|
324
|
+
};
|
|
325
|
+
const timerExpired = () => {
|
|
326
|
+
const time = Date.now();
|
|
327
|
+
if (shouldInvoke(time)) {
|
|
328
|
+
return trailingEdge(time);
|
|
329
|
+
}
|
|
330
|
+
timeoutId = startTimer(timerExpired, remainingWait(time));
|
|
331
|
+
};
|
|
332
|
+
const trailingEdge = (time) => {
|
|
333
|
+
timeoutId = null;
|
|
334
|
+
if (maxWaitTimeoutId) {
|
|
335
|
+
cancelTimer(maxWaitTimeoutId);
|
|
336
|
+
maxWaitTimeoutId = null;
|
|
337
|
+
}
|
|
338
|
+
if (trailing && lastArgs) {
|
|
339
|
+
return invokeFunc(time);
|
|
340
|
+
}
|
|
341
|
+
lastArgs = null;
|
|
342
|
+
lastThis = null;
|
|
343
|
+
return result;
|
|
344
|
+
};
|
|
345
|
+
const cancel = () => {
|
|
346
|
+
if (timeoutId !== null) {
|
|
347
|
+
cancelTimer(timeoutId);
|
|
348
|
+
timeoutId = null;
|
|
349
|
+
}
|
|
350
|
+
if (maxWaitTimeoutId !== null) {
|
|
351
|
+
cancelTimer(maxWaitTimeoutId);
|
|
352
|
+
maxWaitTimeoutId = null;
|
|
353
|
+
}
|
|
354
|
+
lastInvokeTime = 0;
|
|
355
|
+
lastArgs = null;
|
|
356
|
+
lastCallTime = null;
|
|
357
|
+
lastThis = null;
|
|
358
|
+
};
|
|
359
|
+
const flush = () => {
|
|
360
|
+
if (timeoutId === null && maxWaitTimeoutId === null) {
|
|
361
|
+
return result;
|
|
362
|
+
}
|
|
363
|
+
const time = Date.now();
|
|
364
|
+
return trailingEdge(time);
|
|
365
|
+
};
|
|
366
|
+
const pending = () => {
|
|
367
|
+
return timeoutId !== null || maxWaitTimeoutId !== null;
|
|
368
|
+
};
|
|
369
|
+
const debounced = function(...args) {
|
|
370
|
+
const time = Date.now();
|
|
371
|
+
const isInvoking = shouldInvoke(time);
|
|
372
|
+
lastArgs = args;
|
|
373
|
+
lastThis = this;
|
|
374
|
+
lastCallTime = time;
|
|
375
|
+
if (isInvoking) {
|
|
376
|
+
if (timeoutId === null) {
|
|
377
|
+
return leadingEdge(lastCallTime);
|
|
378
|
+
}
|
|
379
|
+
if (maxWait !== void 0) {
|
|
380
|
+
timeoutId = startTimer(timerExpired, delay);
|
|
381
|
+
return invokeFunc(lastCallTime);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if (timeoutId === null) {
|
|
385
|
+
timeoutId = startTimer(timerExpired, delay);
|
|
386
|
+
}
|
|
387
|
+
if (maxWait !== void 0 && maxWaitTimeoutId === null) {
|
|
388
|
+
maxWaitTimeoutId = startTimer(() => {
|
|
389
|
+
const time2 = Date.now();
|
|
390
|
+
invokeFunc(time2);
|
|
391
|
+
}, maxWait);
|
|
392
|
+
}
|
|
393
|
+
return result;
|
|
394
|
+
};
|
|
395
|
+
debounced.cancel = cancel;
|
|
396
|
+
debounced.flush = flush;
|
|
397
|
+
debounced.pending = pending;
|
|
398
|
+
return debounced;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
export { $components, $currentApplication, $currentPageId, $currentPageViewPort, $editorState, $environment, $hoveredComponentId, $pageSize, $pageZoom, $pages, $showBorder, FRONT_API_URLS, LocalStorage, addComponentAsChildOf, addPageAction, addPageHandler, buildFunctionHandler, clipboardComponent$1 as clipboardComponent, closeEditorTab, closeShareApplicationModalAction, copyComponentAction, debounce, deployFunctionHandler, getStyleFronmAttribute, loadApplicationPermissionAction, moveDraggedComponentInside, moveDraggedComponentIntoCurrentPageRoot, processHeaders, refreshComponentActionHandler, removeComponentToCurrentPageAction, resetPermissionMessage, setApplicationPermissionAction, setCurrentPageAction, setCurrentPageViewPort, setDefaultApplicationPageIfNotSet, setEnvirementMode, setEnvironmentMode, setHoveredComponentIdAction, setShowBorder, showCreateApplicationModalAction, showShareApplicationModalAction, updateApplicationActionHandler, updateComponentHandler, updateFunctionHandler, updatePageInfo, updatePageStyleAttributes, updatePageZoom };
|