@nuraly/runtime 0.1.9 → 0.1.10
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/components/inputs/ColorPicker/colorpicker.ts +1 -7
- package/components/ui/components/inputs/Form/Form.ts +3 -11
- package/components/ui/components/inputs/RadioButton/Radio-button.ts +1 -7
- package/components/ui/components/inputs/Select/Select.ts +1 -7
- package/components/ui/components/layout/Grid/Col.ts +2 -6
- package/components/ui/components/layout/Grid/Row.ts +2 -6
- package/components/ui/components/studio/FunctionsPanel/FunctionsPanel.ts +4 -16
- package/dist/AIChat-DP3ZdLL3.js +220 -0
- package/dist/AIChat-km1IYaR-.js +260 -0
- package/dist/Badge-BR94MUt5.js +48 -0
- package/dist/Badge-DzNZFKtC.js +70 -0
- package/dist/{BaseElement-BNBn_IJk.js → BaseElement-pS6m_x6Q.js} +153 -24
- package/dist/Button-BHAN7npC.js +92 -0
- package/dist/Button-DCqgsxrL.js +80 -0
- package/dist/Card-B70c8NFb.js +150 -0
- package/dist/Card-DhOCsGKC.js +120 -0
- package/dist/Checkbox-BZTcPwew.js +59 -0
- package/dist/Checkbox-LYTIBAUV.js +65 -0
- package/dist/Code-BWbiciC8.js +123 -0
- package/dist/Code-Ds0vFclr.js +109 -0
- package/dist/{CodeEditor-B1gNuvPb.js → CodeEditor-ChuFC0ex.js} +22 -22
- package/dist/Col-B_wpWUcU.js +217 -0
- package/dist/Col-DYs8_65c.js +193 -0
- package/dist/Collapse-4kxbQ74u.js +74 -0
- package/dist/Collapse-Dkw6Ner6.js +96 -0
- package/dist/Collections-BSF-PqBz.js +122 -0
- package/dist/Collections-D5rwMFbv.js +151 -0
- package/dist/Container-DMNh5U4Y.js +204 -0
- package/dist/DatePicker-BmEOONiA.js +99 -0
- package/dist/DatePicker-VuUroOT4.js +80 -0
- package/dist/Divider-BfxR3rVl.js +86 -0
- package/dist/Divider-etMTYU3d.js +106 -0
- package/dist/Document-CHBcJciR.js +74 -0
- package/dist/Document-Cj-TmjAf.js +90 -0
- package/dist/Dropdown-BRtHvDa3.js +133 -0
- package/dist/Dropdown-C47Y11dj.js +112 -0
- package/dist/EmbedURL-BwbJRnY1.js +142 -0
- package/dist/EmbedURL-Ci5X1vQG.js +114 -0
- package/dist/FileUpload-BBgPcRag.js +54 -0
- package/dist/FileUpload-BgkhxtNe.js +47 -0
- package/dist/Form-BLq6U3In.js +339 -0
- package/dist/Form-E6zXqgsm.js +286 -0
- package/dist/Icon-CcLuhz6B.js +64 -0
- package/dist/Icon-_UiLblGb.js +74 -0
- package/dist/Image-B_VERIvH.js +111 -0
- package/dist/Image-hI8kIx8U.js +93 -0
- package/dist/Link-BVTo43Cc.js +76 -0
- package/dist/Link-xSrPxOLt.js +95 -0
- package/dist/Menu-CembLIjO.js +83 -0
- package/dist/Menu-D9ZjIOMg.js +73 -0
- package/dist/MicroApp-DI1kQwJk.js +100 -0
- package/dist/MicroApp-DJw57sLE.js +75 -0
- package/dist/NumberInput-DftAAKEs.js +84 -0
- package/dist/NumberInput-eOAk0-fb.js +95 -0
- package/dist/Panel-Bso5fv4i.js +127 -0
- package/dist/Panel-CwzW9iuA.js +161 -0
- package/dist/Radio-button-Sii5iveh.js +71 -0
- package/dist/Radio-button-YXsVqipQ.js +53 -0
- package/dist/RefComponent-Bwk_I0mK.js +79 -0
- package/dist/RefComponent-ZxafRVhZ.js +96 -0
- package/dist/RichText-CgYXXC_a.js +485 -0
- package/dist/RichText-DV46U7fI.js +449 -0
- package/dist/Row-Bb95f5DI.js +229 -0
- package/dist/Row-Dmd_61mR.js +202 -0
- package/dist/Select-Cma8JHAj.js +77 -0
- package/dist/Select-DqA08VYb.js +87 -0
- package/dist/Slider-B2_Qecjz.js +74 -0
- package/dist/Slider-DVY0N2YX.js +55 -0
- package/dist/Table-0WjrBnz-.js +159 -0
- package/dist/Table-dEma50kw.js +184 -0
- package/dist/Tabs-BDKEv1jn.js +131 -0
- package/dist/Tabs-Cvt3Q8vx.js +116 -0
- package/dist/Tag-BcZvQkE_.js +47 -0
- package/dist/Tag-DMZ0mu8y.js +61 -0
- package/dist/TextInput-KI6r9xET.js +193 -0
- package/dist/TextInput-hxK-HhJi.js +148 -0
- package/dist/TextLabel-DkV26yaL.js +102 -0
- package/dist/Textarea-Bzs3jSUm.js +117 -0
- package/dist/Textarea-CwK3SYbz.js +83 -0
- package/dist/Video-C4uBWCBb.js +100 -0
- package/dist/Video-CL1lgcvB.js +120 -0
- package/dist/aitchat-DjX5s7_8.js +23 -0
- package/dist/colorpicker-B-KETfWw.js +64 -0
- package/dist/colorpicker-DhB0AygJ.js +75 -0
- package/dist/constants-Bs_KQRi_.js +4 -0
- package/dist/constants-CXdpxgF2.js +4 -0
- package/dist/{cssMode-D82-gS78.js → cssMode-CV7QbFJv.js} +1 -1
- package/dist/{freemarker2-CYRLpyjt.js → freemarker2-CqQxSEZa.js} +1 -1
- package/dist/{handlebars-R8Efxi60.js → handlebars-a71LdN7X.js} +1 -1
- package/dist/{html-czhjovcp.js → html-D8UaB7IC.js} +1 -1
- package/dist/{htmlMode-DpyKDYYs.js → htmlMode-CqWQMFWX.js} +1 -1
- package/dist/iconbutton-DfnrRmmB.js +69 -0
- package/dist/iconbutton-DvIQHV8o.js +53 -0
- package/dist/{javascript-DwqkMEdb.js → javascript-D_jGqcRD.js} +1 -1
- package/dist/{jsonMode-Cmxxe0W9.js → jsonMode-C3-m5xts.js} +1 -1
- package/dist/{liquid-2spuEcBh.js → liquid-DLwYj6Te.js} +1 -1
- package/dist/{mdx-BjBXyEeR.js → mdx-DhYjhxkW.js} +1 -1
- package/dist/micro-app-entry-DiNqE6xi.js +12042 -0
- package/dist/micro-app.bundle.js +1 -1
- package/dist/micro-app.js +6 -4969
- package/dist/{python-DLI1ji08.js → python-B-WcGqFq.js} +1 -1
- package/dist/{razor-oAnIJsrL.js → razor-JGACy1mz.js} +1 -1
- package/dist/runtime.js +4 -2
- package/dist/{tsMode-D_PMsbjK.js → tsMode-lzBM1oT2.js} +1 -1
- package/dist/{typescript-Bu3ZbtQI.js → typescript-CuL5pdO2.js} +1 -1
- package/dist/{xml-CNSSkPqy.js → xml-D1tacAKD.js} +1 -1
- package/dist/{yaml-5RF_PGNe.js → yaml-CjPB1g7v.js} +1 -1
- package/package.json +1 -1
- package/utils/index.ts +4 -1
- package/utils/lazy-component-loader.ts +120 -0
- package/utils/register-components.ts +14 -40
- package/utils/render-util.ts +84 -0
- package/dist/micro-app-entry-DYAnCRDo.js +0 -15860
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as o } from "./CodeEditor-
|
|
1
|
+
import { m as o } from "./CodeEditor-ChuFC0ex.js";
|
|
2
2
|
/*!-----------------------------------------------------------------------------
|
|
3
3
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
4
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m } from "./CodeEditor-
|
|
1
|
+
import { m } from "./CodeEditor-ChuFC0ex.js";
|
|
2
2
|
/*!-----------------------------------------------------------------------------
|
|
3
3
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
4
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
package/dist/runtime.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { $ as $components, u as updateComponentHandler, r as removeComponentToCurrentPageAction, a as $hoveredComponent, b as $hoveredComponentId, c as $showShareApplicationModal, d as $permissionsState, e as $applicationPermission, f as $currentApplication, g as updateApplicationActionHandler, h as $showCreateApplicationModal, F as FRONT_API_URLS, i as $editorState, j as $environment, k as addPageHandler, l as $currentPageId, m as $currentPageViewPort, n as $resizing, o as $showBorder, p as $pageSize, q as $pages, s as $pageZoom } from './BaseElement-
|
|
2
|
-
export { w as $applicationComponents, a1 as $applicationPages, Y as $applications, L as $componentById, G as $componentRuntimeValueByKey, D as $componentRuntimeValuesById, A as $componentWithChildren, H as $componentsByUUIDs, a3 as $context, _ as $contextMenuEvent, y as $currentComponentId, Z as $currentPage, a6 as $debug, z as $draggingComponentInfo, a0 as $microAppCurrentPage, a7 as $providers, B as $runtimeStyles, I as $runtimeStylescomponentStyleByID, C as $runtimeValues, x as $selectedComponent, a5 as $toasts, ae as BaseElement, ae as BaseElementBlock, af as BaseElementCore, ab as ComponentRegistry,
|
|
1
|
+
import { $ as $components, u as updateComponentHandler, r as removeComponentToCurrentPageAction, a as $hoveredComponent, b as $hoveredComponentId, c as $showShareApplicationModal, d as $permissionsState, e as $applicationPermission, f as $currentApplication, g as updateApplicationActionHandler, h as $showCreateApplicationModal, F as FRONT_API_URLS, i as $editorState, j as $environment, k as addPageHandler, l as $currentPageId, m as $currentPageViewPort, n as $resizing, o as $showBorder, p as $pageSize, q as $pages, s as $pageZoom } from './BaseElement-pS6m_x6Q.js';
|
|
2
|
+
export { w as $applicationComponents, a1 as $applicationPages, Y as $applications, L as $componentById, G as $componentRuntimeValueByKey, D as $componentRuntimeValuesById, A as $componentWithChildren, H as $componentsByUUIDs, a3 as $context, _ as $contextMenuEvent, y as $currentComponentId, Z as $currentPage, a6 as $debug, z as $draggingComponentInfo, a0 as $microAppCurrentPage, a7 as $providers, B as $runtimeStyles, I as $runtimeStylescomponentStyleByID, C as $runtimeValues, x as $selectedComponent, a5 as $toasts, ae as BaseElement, ae as BaseElementBlock, af as BaseElementCore, ab as ComponentRegistry, t as Editor, E as ExecuteInstance, ba as FORBIDDEN_FUNCTIONS, b8 as FORBIDDEN_GLOBALS, b9 as FORBIDDEN_PROPERTIES, bf as GenerateName, aW as LOG_LEVELS, aS as Logger, b0 as RuntimeContextHelpers, v as RuntimeHelpers, R as RuntimeInstance, bb as VALIDATION_ERROR_MESSAGES, a4 as ViewMode, ag as addComponentAction, aA as addComponentHandler, ah as addComponentToCurrentPageAction, ar as addPageToApplicationAction, aJ as addPermission, ay as addlogDebug, S as clearAllRuntimeValues, bi as clearAllToasts, T as clearComponentRuntimeStyleAttributes, Q as clearComponentRuntimeValue, P as clearComponentRuntimeValues, av as closeCreateApplicationModalAction, aa as compileHandlerFunction, aY as copyCpmponentToClipboard, aH as createApplicationAction, aI as deleteApplicationAction, ai as deleteComponentAction, aB as deleteComponentActionHandler, ao as deletePageAction, aE as deletePageHandler, aV as enableBenchmarking, aU as enableLogging, aX as eventDispatcher, a8 as executeHandler, X as extractAllChildrenIds, W as extractChildresIds, V as fillApplicationComponents, U as fillComponentChildren, bc as formatValidationErrors, a$ as generateNuralyClipboardStructure, J as getAllChildrenRecursive, aR as getAvailableComponents, a9 as getContextFromComponent, K as getDirectChildren, b7 as getErrorMessage, bd as getNestedAttribute, be as hasOnlyEmptyObjects, bh as hideToast, aK as invokeFunctionHandler, b5 as isAllowedGlobal, aQ as isComponentLoaded, b6 as isForbiddenFunction, b3 as isForbiddenGlobal, b4 as isForbiddenProperty, aO as loadComponent, aP as loadComponents, aL as loadFunctionsHandler, aG as loadOrRefreshApplications, aj as moveDraggedComponent, aw as openEditorTab, aZ as pasteComponentFromClipboard, a2 as refreshPageStoreVar, aF as refreshPagesActionHandler, ac as registerComponent, ad as registerComponents, aM as renderComponent, aN as renderComponentAsync, az as resetComponentDebug, as as setApplication, M as setComponentRuntimeValue, N as setComponentRuntimeValues, ap as setContextMenuEvent, ak as setCurrentComponentIdAction, ax as setCurrentEditorTab, al as setDraggingComponentInfo, aT as setLogLevel, at as setPermissionMessage, O as setcomponentRuntimeStyleAttribute, bk as showError, bm as showInfo, bj as showSuccess, bg as showToast, bl as showWarning, a_ as traitCompoentFromSchema, au as updateApplication, an as updateComponentAttributes, am as updateComponentName, aq as updatePageAction, aD as updatePageHandler, aC as validateAndEmitErrors, b2 as validateComponentHandlers, b1 as validateHandlerCode } from './BaseElement-pS6m_x6Q.js';
|
|
3
3
|
import { v4 } from 'uuid';
|
|
4
4
|
import 'acorn';
|
|
5
5
|
import 'acorn-walk';
|
|
6
6
|
import 'fast-deep-equal';
|
|
7
|
+
export { b as addGeneratedComponents, a as addTempApplication } from './aitchat-DjX5s7_8.js';
|
|
8
|
+
export { E as EMPTY_STRING, N as NO_EVENT_LISTENER } from './constants-Bs_KQRi_.js';
|
|
7
9
|
|
|
8
10
|
function addComponentAsChildOf(componentId, parentComponentId, application_id) {
|
|
9
11
|
const componentsStore = $components.get();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as L, m as O } from "./CodeEditor-
|
|
1
|
+
import { t as L, m as O } from "./CodeEditor-ChuFC0ex.js";
|
|
2
2
|
/*!-----------------------------------------------------------------------------
|
|
3
3
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
4
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as s } from "./CodeEditor-
|
|
1
|
+
import { m as s } from "./CodeEditor-ChuFC0ex.js";
|
|
2
2
|
/*!-----------------------------------------------------------------------------
|
|
3
3
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
4
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as r } from "./CodeEditor-
|
|
1
|
+
import { m as r } from "./CodeEditor-ChuFC0ex.js";
|
|
2
2
|
/*!-----------------------------------------------------------------------------
|
|
3
3
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
4
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as l } from "./CodeEditor-
|
|
1
|
+
import { m as l } from "./CodeEditor-ChuFC0ex.js";
|
|
2
2
|
/*!-----------------------------------------------------------------------------
|
|
3
3
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
4
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
package/package.json
CHANGED
package/utils/index.ts
CHANGED
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
import { setupChangeDetection } from '../components/ui/components/base/BaseElement/base-change-detection';
|
|
8
8
|
|
|
9
9
|
// Component Rendering
|
|
10
|
-
export { renderComponent } from './render-util';
|
|
10
|
+
export { renderComponent, renderComponentAsync } from './render-util';
|
|
11
|
+
|
|
12
|
+
// Lazy Component Loader
|
|
13
|
+
export { loadComponent, loadComponents, isComponentLoaded, getAvailableComponents } from './lazy-component-loader';
|
|
11
14
|
|
|
12
15
|
// Component Registry
|
|
13
16
|
export {
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazy Component Loader
|
|
3
|
+
*
|
|
4
|
+
* Dynamically loads wrapper components on-demand when they are first used.
|
|
5
|
+
* This prevents loading @nuralyui packages that aren't needed by the app.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// Track which components have been loaded
|
|
9
|
+
const loadedComponents = new Set<string>();
|
|
10
|
+
const loadingPromises = new Map<string, Promise<void>>();
|
|
11
|
+
|
|
12
|
+
// Component import map - maps component tag names to their module paths
|
|
13
|
+
const componentImports: Record<string, () => Promise<any>> = {
|
|
14
|
+
// Layout components with @nuralyui dependencies
|
|
15
|
+
'grid-row-block': () => import('../components/ui/components/layout/Grid/Row'),
|
|
16
|
+
'grid-col-block': () => import('../components/ui/components/layout/Grid/Col'),
|
|
17
|
+
'panel-block': () => import('../components/ui/components/layout/Panel/Panel'),
|
|
18
|
+
'tabs-block': () => import('../components/ui/components/layout/Tabs/Tabs'),
|
|
19
|
+
'card-block': () => import('../components/ui/components/layout/Card/Card'),
|
|
20
|
+
|
|
21
|
+
// Input components with @nuralyui dependencies
|
|
22
|
+
'select-block': () => import('../components/ui/components/inputs/Select/Select'),
|
|
23
|
+
'button-block': () => import('../components/ui/components/inputs/Button/Button'),
|
|
24
|
+
'checkbox-block': () => import('../components/ui/components/inputs/Checkbox/Checkbox'),
|
|
25
|
+
'radio-button-block': () => import('../components/ui/components/inputs/RadioButton/Radio-button'),
|
|
26
|
+
'color-picker-block': () => import('../components/ui/components/inputs/ColorPicker/colorpicker'),
|
|
27
|
+
'date-picker-block': () => import('../components/ui/components/inputs/DatePicker/DatePicker'),
|
|
28
|
+
'dropdown-block': () => import('../components/ui/components/inputs/Dropdown/Dropdown'),
|
|
29
|
+
'text-input-block': () => import('../components/ui/components/inputs/TextInput/TextInput'),
|
|
30
|
+
'number-input-block': () => import('../components/ui/components/inputs/NumberInput/NumberInput'),
|
|
31
|
+
'textarea-block': () => import('../components/ui/components/inputs/Textarea/Textarea'),
|
|
32
|
+
'slider-block': () => import('../components/ui/components/inputs/Slider/Slider'),
|
|
33
|
+
'file-upload-block': () => import('../components/ui/components/inputs/FileUpload/FileUpload'),
|
|
34
|
+
'form-block': () => import('../components/ui/components/inputs/Form/Form'),
|
|
35
|
+
'icon-button-block': () => import('../components/ui/components/inputs/IconButton/iconbutton'),
|
|
36
|
+
|
|
37
|
+
// Display components with @nuralyui dependencies
|
|
38
|
+
'table-block': () => import('../components/ui/components/display/Table/Table'),
|
|
39
|
+
'icon-block': () => import('../components/ui/components/display/Icon/Icon'),
|
|
40
|
+
'image-block': () => import('../components/ui/components/display/Image/Image'),
|
|
41
|
+
'divider-block': () => import('../components/ui/components/display/Divider/Divider'),
|
|
42
|
+
'text-label-block': () => import('../components/ui/components/display/TextLabel/TextLabel'),
|
|
43
|
+
'badge-block': () => import('../components/ui/components/display/Badge/Badge'),
|
|
44
|
+
'tag-block': () => import('../components/ui/components/display/Tag/Tag'),
|
|
45
|
+
'video-block': () => import('../components/ui/components/display/Video/Video'),
|
|
46
|
+
'code-block': () => import('../components/ui/components/display/Code/Code'),
|
|
47
|
+
|
|
48
|
+
// Navigation components
|
|
49
|
+
'menu-block': () => import('../components/ui/components/navigation/Menu/Menu'),
|
|
50
|
+
'link-block': () => import('../components/ui/components/navigation/Link/Link'),
|
|
51
|
+
'embed-url-block': () => import('../components/ui/components/navigation/EmbedURL/EmbedURL'),
|
|
52
|
+
|
|
53
|
+
// Advanced components
|
|
54
|
+
'ai-chat-block': () => import('../components/ui/components/advanced/AIChat/AIChat'),
|
|
55
|
+
'collapse-block': () => import('../components/ui/components/advanced/Collapse/Collapse'),
|
|
56
|
+
'collection-viewer': () => import('../components/ui/components/advanced/Collections/Collections'),
|
|
57
|
+
'ref-component-container-block': () => import('../components/ui/components/advanced/RefComponent/RefComponent'),
|
|
58
|
+
'rich-text-block': () => import('../components/ui/components/advanced/RichText/RichText'),
|
|
59
|
+
'micro-app-block': () => import('../components/ui/components/advanced/MicroApp/MicroApp'),
|
|
60
|
+
|
|
61
|
+
// Utility components
|
|
62
|
+
'document-block': () => import('../components/ui/components/utility/Document/Document'),
|
|
63
|
+
'vertical-container-block': () => import('../components/ui/components/layout/Containers/Container'),
|
|
64
|
+
'toast-container': () => import('../components/ui/components/ToastContainer/ToastContainer'),
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Load a component by its tag name
|
|
69
|
+
*/
|
|
70
|
+
export async function loadComponent(tagName: string): Promise<void> {
|
|
71
|
+
// Already loaded
|
|
72
|
+
if (loadedComponents.has(tagName)) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Already loading - wait for it
|
|
77
|
+
if (loadingPromises.has(tagName)) {
|
|
78
|
+
return loadingPromises.get(tagName);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const importFn = componentImports[tagName];
|
|
82
|
+
if (!importFn) {
|
|
83
|
+
console.warn(`[LazyLoader] No import found for component: ${tagName}`);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const loadPromise = importFn()
|
|
88
|
+
.then(() => {
|
|
89
|
+
loadedComponents.add(tagName);
|
|
90
|
+
loadingPromises.delete(tagName);
|
|
91
|
+
})
|
|
92
|
+
.catch((error) => {
|
|
93
|
+
console.warn(`[LazyLoader] Failed to load component ${tagName}:`, error);
|
|
94
|
+
loadingPromises.delete(tagName);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
loadingPromises.set(tagName, loadPromise);
|
|
98
|
+
return loadPromise;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Load multiple components in parallel
|
|
103
|
+
*/
|
|
104
|
+
export async function loadComponents(tagNames: string[]): Promise<void> {
|
|
105
|
+
await Promise.all(tagNames.map(loadComponent));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Check if a component is loaded
|
|
110
|
+
*/
|
|
111
|
+
export function isComponentLoaded(tagName: string): boolean {
|
|
112
|
+
return loadedComponents.has(tagName);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Get all available component tag names
|
|
117
|
+
*/
|
|
118
|
+
export function getAvailableComponents(): string[] {
|
|
119
|
+
return Object.keys(componentImports);
|
|
120
|
+
}
|
|
@@ -1,41 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import "../components/ui/components/inputs/Select/Select";
|
|
16
|
-
import "../components/ui/components/inputs/Checkbox/Checkbox";
|
|
17
|
-
import "../components/ui/components/inputs/Dropdown/Dropdown";
|
|
18
|
-
import "../components/ui/components/inputs/DatePicker/DatePicker";
|
|
19
|
-
import "../components/ui/components/inputs/RadioButton/Radio-button";
|
|
20
|
-
import "../components/ui/components/inputs/Button/Button";
|
|
21
|
-
import "../components/ui/components/inputs/FileUpload/FileUpload";
|
|
22
|
-
import "../components/ui/components/inputs/Textarea/Textarea";
|
|
23
|
-
import "../components/ui/components/inputs/Slider/Slider";
|
|
24
|
-
import "../components/ui/components/inputs/Form/Form";
|
|
25
|
-
import "../components/ui/components/display/Table/Table";
|
|
26
|
-
import "../components/ui/components/display/Icon/Icon";
|
|
27
|
-
import "../components/ui/components/display/Image/Image";
|
|
28
|
-
import "../components/ui/components/display/Divider/Divider";
|
|
29
|
-
import "../components/ui/components/display/TextLabel/TextLabel";
|
|
30
|
-
import "../components/ui/components/display/Code/Code";
|
|
31
|
-
import "../components/ui/components/display/Video/Video";
|
|
32
|
-
import "../components/ui/components/display/Badge/Badge";
|
|
33
|
-
import "../components/ui/components/display/Tag/Tag";
|
|
34
|
-
import "../components/ui/components/advanced/AIChat/AIChat";
|
|
35
|
-
import "../components/ui/components/advanced/MicroApp/MicroApp";
|
|
36
|
-
import "../components/ui/components/advanced/Collapse/Collapse";
|
|
37
|
-
import "../components/ui/components/advanced/Collections/Collections";
|
|
38
|
-
import "../components/ui/components/advanced/RefComponent/RefComponent";
|
|
39
|
-
import "../components/ui/components/advanced/RichText/RichText";
|
|
40
|
-
import "../components/ui/components/utility/Document/Document";
|
|
1
|
+
/**
|
|
2
|
+
* Runtime component registration
|
|
3
|
+
*
|
|
4
|
+
* Components are now loaded lazily on-demand via lazy-component-loader.ts
|
|
5
|
+
* This file is kept for backwards compatibility and to load essential components.
|
|
6
|
+
*
|
|
7
|
+
* Components that depend on @nuralyui packages are NOT imported here.
|
|
8
|
+
* They are loaded dynamically when first used via the lazy loader.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// Only import components that DON'T have @nuralyui dependencies
|
|
12
|
+
// or are essential for the runtime to work
|
|
13
|
+
|
|
14
|
+
// Toast is needed globally
|
|
41
15
|
import "../components/ui/components/ToastContainer/ToastContainer";
|
package/utils/render-util.ts
CHANGED
|
@@ -1,6 +1,69 @@
|
|
|
1
1
|
import { type ComponentElement, ComponentType } from '../redux/store/component/component.interface';
|
|
2
2
|
import { html, type TemplateResult } from "lit";
|
|
3
3
|
import { ComponentRegistry, type ComponentRenderProps } from './component-registry';
|
|
4
|
+
import { loadComponent } from './lazy-component-loader';
|
|
5
|
+
|
|
6
|
+
// Map ComponentType to tag name for lazy loading
|
|
7
|
+
const componentTypeToTagName: Record<string, string> = {
|
|
8
|
+
[ComponentType.Select]: 'select-block',
|
|
9
|
+
[ComponentType.IconButton]: 'icon-button-block',
|
|
10
|
+
[ComponentType.ColorPicker]: 'color-picker-block',
|
|
11
|
+
[ComponentType.NumberInput]: 'number-input-block',
|
|
12
|
+
[ComponentType.TextInput]: 'text-input-block',
|
|
13
|
+
[ComponentType.TextLabel]: 'text-label-block',
|
|
14
|
+
[ComponentType.Button]: 'button-block',
|
|
15
|
+
[ComponentType.Tabs]: 'tabs-block',
|
|
16
|
+
[ComponentType.Menu]: 'menu-block',
|
|
17
|
+
[ComponentType.Table]: 'table-block',
|
|
18
|
+
[ComponentType.Container]: 'vertical-container-block',
|
|
19
|
+
[ComponentType.Collection]: 'collection-viewer',
|
|
20
|
+
[ComponentType.Checkbox]: 'checkbox-block',
|
|
21
|
+
[ComponentType.DatePicker]: 'date-picker-block',
|
|
22
|
+
[ComponentType.Divider]: 'divider-block',
|
|
23
|
+
[ComponentType.Icon]: 'icon-block',
|
|
24
|
+
[ComponentType.Image]: 'image-block',
|
|
25
|
+
[ComponentType.RadioButton]: 'radio-button-block',
|
|
26
|
+
[ComponentType.AI]: 'ai-chat-block',
|
|
27
|
+
[ComponentType.MicroApp]: 'micro-app-block',
|
|
28
|
+
[ComponentType.Collapse]: 'collapse-block',
|
|
29
|
+
[ComponentType.Dropdown]: 'dropdown-block',
|
|
30
|
+
[ComponentType.RefComponent]: 'ref-component-container-block',
|
|
31
|
+
[ComponentType.Code]: 'code-block',
|
|
32
|
+
[ComponentType.RichText]: 'rich-text-block',
|
|
33
|
+
[ComponentType.EmbedURL]: 'embed-url-block',
|
|
34
|
+
[ComponentType.Link]: 'link-block',
|
|
35
|
+
[ComponentType.FileUpload]: 'file-upload-block',
|
|
36
|
+
[ComponentType.Video]: 'video-block',
|
|
37
|
+
[ComponentType.Document]: 'document-block',
|
|
38
|
+
[ComponentType.Textarea]: 'textarea-block',
|
|
39
|
+
[ComponentType.Badge]: 'badge-block',
|
|
40
|
+
[ComponentType.Card]: 'card-block',
|
|
41
|
+
[ComponentType.Tag]: 'tag-block',
|
|
42
|
+
[ComponentType.Slider]: 'slider-block',
|
|
43
|
+
[ComponentType.Panel]: 'panel-block',
|
|
44
|
+
[ComponentType.GridRow]: 'grid-row-block',
|
|
45
|
+
[ComponentType.GridCol]: 'grid-col-block',
|
|
46
|
+
[ComponentType.Form]: 'form-block',
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// Preload components used by a component tree
|
|
50
|
+
async function preloadComponents(components: ComponentElement[]): Promise<void> {
|
|
51
|
+
const tagNames = new Set<string>();
|
|
52
|
+
|
|
53
|
+
function collectTagNames(comps: ComponentElement[]) {
|
|
54
|
+
for (const comp of comps) {
|
|
55
|
+
const tagName = componentTypeToTagName[comp?.component_type];
|
|
56
|
+
if (tagName) {
|
|
57
|
+
tagNames.add(tagName);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
collectTagNames(components);
|
|
63
|
+
|
|
64
|
+
// Load all required components in parallel
|
|
65
|
+
await Promise.all(Array.from(tagNames).map(loadComponent));
|
|
66
|
+
}
|
|
4
67
|
|
|
5
68
|
const selectTemplate = (props: any, isViewMode: boolean) => html`<select-block .isViewMode=${isViewMode} .parentcomponent=${props.parent} .item=${props.item} .component=${props.component}></select-block>`;
|
|
6
69
|
const iconButtonTemplate = (props: any, isViewMode: boolean) => html`<icon-button-block .isViewMode=${isViewMode} .parentcomponent=${props.parent} .item=${props.item} .component=${props.component}></icon-button-block>`;
|
|
@@ -143,6 +206,27 @@ function getComponentTemplate(component: ComponentElement, commonProps: any, isV
|
|
|
143
206
|
|
|
144
207
|
export function renderComponent(components: ComponentElement[], item?: any, isViewMode?: boolean, parent?:ComponentElement ): TemplateResult {
|
|
145
208
|
if (!components || !components.length) return html``;
|
|
209
|
+
|
|
210
|
+
// Trigger lazy loading for components (fire and forget - they will be defined before render completes)
|
|
211
|
+
preloadComponents(components);
|
|
212
|
+
|
|
213
|
+
return html`
|
|
214
|
+
${components.map((component: ComponentElement) => {
|
|
215
|
+
const commonProps = { item: { ...item }, component , parent : { ...parent } };
|
|
216
|
+
return renderComponentElement(component, commonProps, isViewMode );
|
|
217
|
+
})}
|
|
218
|
+
`;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Async version of renderComponent that waits for components to load
|
|
223
|
+
*/
|
|
224
|
+
export async function renderComponentAsync(components: ComponentElement[], item?: any, isViewMode?: boolean, parent?:ComponentElement ): Promise<TemplateResult> {
|
|
225
|
+
if (!components || !components.length) return html``;
|
|
226
|
+
|
|
227
|
+
// Wait for all components to load
|
|
228
|
+
await preloadComponents(components);
|
|
229
|
+
|
|
146
230
|
return html`
|
|
147
231
|
${components.map((component: ComponentElement) => {
|
|
148
232
|
const commonProps = { item: { ...item }, component , parent : { ...parent } };
|