@nuraly/runtime 0.1.7 → 0.1.9
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/README.md +83 -765
- package/components/ui/components/Event/EventValue/EventValue.ts +13 -8
- package/components/ui/components/ToastContainer/ToastContainer.ts +1 -1
- package/components/ui/components/advanced/AIChat/AIChat.ts +1 -2
- package/components/ui/components/advanced/Collapse/Collapse.ts +5 -2
- package/components/ui/components/advanced/Collections/Collections.ts +2 -2
- package/components/ui/components/advanced/MicroApp/MicroApp.ts +3 -11
- package/components/ui/components/advanced/RefComponent/RefComponent.ts +2 -2
- package/components/ui/components/advanced/RichText/RichText.ts +5 -4
- package/components/ui/components/advanced/RichText/RichTextEditor.ts +0 -167
- package/components/ui/components/base/BaseElement/base-change-detection.ts +1 -5
- package/components/ui/components/base/BaseElement.ts +229 -610
- package/components/ui/components/base/FormRegisterable.ts +83 -0
- package/components/ui/components/base/controllers/DragDropController.ts +175 -0
- package/components/ui/components/base/controllers/ErrorController.ts +180 -0
- package/components/ui/components/base/controllers/EventController.ts +112 -0
- package/components/ui/components/base/controllers/InputHandlerController.ts +298 -0
- package/components/ui/components/base/controllers/SelectionController.ts +323 -0
- package/components/ui/components/base/controllers/StyleHandlerController.ts +286 -0
- package/components/ui/components/base/controllers/index.ts +11 -0
- package/components/ui/components/base/mixins/EditorModeMixin.ts +185 -0
- package/components/ui/components/base/mixins/index.ts +6 -0
- package/components/ui/components/base/types/base-element.types.ts +138 -0
- package/components/ui/components/base/types/index.ts +21 -0
- package/components/ui/components/base/utils/event-debouncer.ts +209 -0
- package/components/ui/components/base/utils/index.ts +11 -0
- package/components/ui/components/base/utils/style-cache.ts +94 -0
- package/components/ui/components/display/BoxModel/BoxModel.ts +177 -116
- package/components/ui/components/display/Code/Code.ts +40 -26
- package/components/ui/components/display/Divider/Divider.ts +2 -2
- package/components/ui/components/display/Icon/Icon.ts +2 -3
- package/components/ui/components/display/Image/Image.ts +72 -46
- package/components/ui/components/display/Tag/Tag.ts +2 -3
- package/components/ui/components/display/Video/Video.ts +91 -31
- package/components/ui/components/inputs/Button/Button.ts +2 -2
- package/components/ui/components/inputs/Checkbox/Checkbox.ts +14 -40
- package/components/ui/components/inputs/ColorPicker/colorpicker.ts +9 -4
- package/components/ui/components/inputs/DatePicker/DatePicker.ts +47 -25
- package/components/ui/components/inputs/Dropdown/Dropdown.ts +2 -2
- package/components/ui/components/inputs/Form/Form.style.ts +26 -0
- package/components/ui/components/inputs/Form/Form.ts +360 -0
- package/components/ui/components/inputs/IconPicker/IconPicker.ts +22 -18
- package/components/ui/components/inputs/InsertDropdown/InsertDropdown.ts +0 -20
- package/components/ui/components/inputs/NumberInput/NumberInput.ts +0 -4
- package/components/ui/components/inputs/RadioButton/Radio-button.ts +17 -13
- package/components/ui/components/inputs/Select/Select.ts +44 -24
- package/components/ui/components/inputs/TextInput/TextInput.ts +15 -9
- package/components/ui/components/inputs/Textarea/Textarea.ts +30 -30
- package/components/ui/components/inputs/UsersDropdown/UsersDropdown.ts +1 -1
- package/components/ui/components/layout/Card/Card.ts +112 -10
- package/components/ui/components/layout/Containers/Container.style.ts +18 -0
- package/components/ui/components/layout/Containers/Container.ts +11 -5
- package/components/ui/components/layout/Grid/Col.style.ts +27 -0
- package/components/ui/components/layout/Grid/Col.ts +213 -0
- package/components/ui/components/layout/Grid/Row.style.ts +73 -0
- package/components/ui/components/layout/Grid/Row.ts +170 -0
- package/components/ui/components/layout/Grid/index.ts +7 -0
- package/components/ui/components/layout/Panel/Panel.ts +2 -2
- package/components/ui/components/layout/Tabs/Tabs.ts +0 -1
- package/components/ui/components/navigation/EmbedURL/EmbedURL.ts +62 -26
- package/components/ui/components/navigation/Link/Link.ts +27 -16
- package/components/ui/components/navigation/Menu/Menu.ts +26 -48
- package/components/ui/components/runtime/MicroApp/MicroApp.ts +7 -147
- package/components/ui/components/runtime/MicroApp/MicroAppDataLoader.ts +6 -2
- package/components/ui/components/studio/FunctionsPanel/FunctionsPanel.ts +484 -0
- package/components/ui/components/studio/FunctionsPanel/index.ts +1 -0
- package/components/ui/components/utility/AccessRoles/AccessRoles.style.ts +242 -0
- package/components/ui/components/utility/AccessRoles/AccessRoles.ts +476 -0
- package/components/ui/components/utility/Border/Border.ts +0 -14
- package/components/ui/components/utility/BorderManager/BorderManager.style.ts +237 -0
- package/components/ui/components/utility/BorderManager/BorderManager.ts +503 -0
- package/components/ui/components/utility/BoxShadow/BoxShadow.ts +0 -16
- package/components/ui/components/utility/Document/Document.ts +54 -25
- package/components/ui/components/utility/Export-Import/Export-Import.ts +8 -7
- package/components/ui/components/utility/Handlers/Handlers.ts +14 -17
- package/components/ui/components/utility/ValidationRules/ValidationRules.ts +440 -0
- package/components/ui/components/wrappers/GenerikWrapper/DragWrapper/DragWrapper.ts +1 -0
- package/components/ui/components/wrappers/GenerikWrapper/GenerikWrapper.ts +1 -24
- package/components/ui/nuraly-ui/src/components/badge/badge.style.ts +4 -3
- package/components/ui/nuraly-ui/src/components/datepicker/datepicker.component.ts +2 -0
- package/components/ui/nuraly-ui/src/components/radio-group/radio-group.component.ts +12 -6
- package/components/ui/nuraly-ui/src/components/radio-group/radio-group.style.ts +23 -0
- package/dist/{index-B4yIOSMd.js → BaseElement-BNBn_IJk.js} +2920 -267
- package/dist/{CodeEditor-YsOapSut.js → CodeEditor-B1gNuvPb.js} +84127 -76319
- package/dist/{CodeEditor-BiNku87K.js → CodeEditor-Cpph-xRc.js} +7 -7
- package/dist/{abap-B2diVmjb.js → abap-D0Neqhq6.js} +91 -1
- package/dist/{apex-3NuJ-nsI.js → apex-B5LhxkeG.js} +18 -1
- package/dist/assets/editor.worker-DcwbJ0PV.js +12 -0
- package/dist/assets/html.worker-BTMxskjR.js +461 -0
- package/dist/assets/json.worker-D3vTGdf_.js +49 -0
- package/dist/assets/ts.worker-BsM1BXac.js +51334 -0
- package/dist/{azcli-XGXuUsMB.js → azcli-BrBH0QTU.js} +1 -1
- package/dist/{bat-B8Vhm634.js → bat-BfzAov64.js} +12 -1
- package/dist/{bicep-Cc8X5S_k.js → bicep-C3bCSWel.js} +1 -1
- package/dist/{cameligo-Bo3wBh9T.js → cameligo-sFL5plcd.js} +13 -1
- package/dist/{clojure-CPoQlpIK.js → clojure-CfeExRz0.js} +14 -1
- package/dist/{coffee-BxvTGz39.js → coffee-Xws5K0WL.js} +11 -1
- package/dist/{cpp-5RpEV7vC.js → cpp-CqOUEpxN.js} +28 -23
- package/dist/{csharp-slXXP3fo.js → csharp-DVLiBOZb.js} +13 -1
- package/dist/{csp-B98p6-gH.js → csp-DVFp9bw5.js} +3 -1
- package/dist/{css-BDsDSAin.js → css-DwARn2R6.js} +8 -1
- package/dist/cssMode-D82-gS78.js +1577 -0
- package/dist/{cypher-Dc4IMouD.js → cypher-uY0Mffat.js} +8 -1
- package/dist/{dart-LhvE3yD2.js → dart-D27H-mX_.js} +18 -1
- package/dist/{dockerfile-CwzplJeZ.js → dockerfile-CmV85WZK.js} +5 -1
- package/dist/{ecl-DxW3FiJi.js → ecl--fKn7yzB.js} +9 -1
- package/dist/{elixir-BI40g7TU.js → elixir-DUhH17ON.js} +87 -1
- package/dist/{flow9-tR2v0bGz.js → flow9-B3Dx2LLe.js} +8 -1
- package/dist/{freemarker2-Bfqhwyij.js → freemarker2-CYRLpyjt.js} +359 -7
- package/dist/{fsharp-BLAma0OT.js → fsharp-SyqBfUAR.js} +14 -1
- package/dist/{go-nYcD3y4Z.js → go-BbMR2tdT.js} +17 -1
- package/dist/{graphql-Dp1cHWmP.js → graphql-DDJE6tIl.js} +17 -1
- package/dist/{handlebars-DCgKNBmn.js → handlebars-R8Efxi60.js} +38 -4
- package/dist/{hcl-6NT8Kbna.js → hcl-YBvpaUqf.js} +13 -1
- package/dist/{html-C6wR7sMB.js → html-czhjovcp.js} +37 -4
- package/dist/htmlMode-DpyKDYYs.js +1587 -0
- package/dist/{ini-BZCOLrEc.js → ini-Ct73dBtM.js} +10 -1
- package/dist/{java-DAMcfJbX.js → java-C_jlkwoG.js} +18 -1
- package/dist/{javascript-D1L5MTmg.js → javascript-DwqkMEdb.js} +3 -2
- package/dist/jsonMode-Cmxxe0W9.js +2002 -0
- package/dist/{julia-CQ46G71H.js → julia-D8WE5U1e.js} +22 -1
- package/dist/{kotlin-CEjVo_6E.js → kotlin-Zy9aq5yB.js} +15 -1
- package/dist/{less-DreV99nP.js → less-sZ0iHtE8.js} +1 -1
- package/dist/{lexon-DBVJhqLb.js → lexon-CsdNL29A.js} +13 -1
- package/dist/{liquid-D_pDYIs1.js → liquid-2spuEcBh.js} +12 -4
- package/dist/{lua-Dcc_j6L-.js → lua-C2YJo0zw.js} +12 -1
- package/dist/{m3-B9SlZL4n.js → m3-CPLP40SG.js} +7 -1
- package/dist/{markdown-CuGw9_MP.js → markdown-B1mf5e0R.js} +34 -1
- package/dist/{mdx-CKsJ3cF4.js → mdx-BjBXyEeR.js} +2 -2
- package/dist/{micro-app-entry-xdTX5-ut.js → micro-app-entry-DYAnCRDo.js} +8132 -9649
- package/dist/micro-app.bundle.js +3 -3
- package/dist/micro-app.js +3565 -6710
- package/dist/{mips-BUWqP-OH.js → mips-DA33BZX1.js} +11 -1
- package/dist/{msdax-DtkouYCg.js → msdax-CCYFIQsP.js} +5 -1
- package/dist/{mysql-IkAsWSmF.js → mysql-hjmIjL-D.js} +11 -3
- package/dist/{objective-c-B2-ronfg.js → objective-c-RRCpEmqC.js} +2 -1
- package/dist/{pascal-Bsnz2eJA.js → pascal-CeV8XfxB.js} +13 -1
- package/dist/{pascaligo-D_sMUn0Q.js → pascaligo-IEEGVJAJ.js} +13 -1
- package/dist/{perl-BPzHt9SS.js → perl-B5-QbHq_.js} +34 -1
- package/dist/{pgsql-DlTJB0PD.js → pgsql-s6kqEJmi.js} +14 -4
- package/dist/{php-Dmq5OjwK.js → php-CWWqzOo8.js} +36 -1
- package/dist/{pla-HJcccrBy.js → pla-FSvb_YP_.js} +13 -1
- package/dist/{postiats-OQn6DKv-.js → postiats-DQdscQXO.js} +370 -1
- package/dist/{powerquery-DKaMYC8w.js → powerquery-CtA5JA1I.js} +7 -1
- package/dist/{powershell-DWeJHik1.js → powershell-DglEq96N.js} +13 -1
- package/dist/{protobuf-CBn_IseU.js → protobuf-BSepub3e.js} +5 -1
- package/dist/{pug-BoRpCINl.js → pug-B1847F4G.js} +16 -1
- package/dist/{python-zPpZYwLF.js → python-DLI1ji08.js} +59 -11
- package/dist/{qsharp-4rGyVZOw.js → qsharp-D4i0Nqg9.js} +28 -3
- package/dist/{r-DsgLhBOb.js → r-cdRigKxa.js} +5 -1
- package/dist/{razor-B_fCUeGX.js → razor-oAnIJsrL.js} +48 -4
- package/dist/{redis-B2fdL4Bg.js → redis-D9MFxvE8.js} +16 -6
- package/dist/{redshift-DoaeyCkH.js → redshift-CmCnsvL-.js} +13 -4
- package/dist/{restructuredtext-D-6OFBY9.js → restructuredtext-CWy8J51t.js} +19 -1
- package/dist/{ruby-D1DD6baV.js → ruby-WP-c36m5.js} +76 -3
- package/dist/runtime.js +34 -45
- package/dist/{rust-DssUV39M.js → rust-Q9FLdYpu.js} +13 -1
- package/dist/{sb-Dmb6tAdv.js → sb-C54-JBGT.js} +12 -1
- package/dist/{scala-Co3ETaym.js → scala-CzbFImc5.js} +24 -1
- package/dist/{scheme-CMrqXTty.js → scheme-BhfDmYN3.js} +1 -1
- package/dist/{scss-DkGudv8Q.js → scss-CEmiBXpS.js} +25 -1
- package/dist/{shell-BHN2BI4L.js → shell-Bmc1VhG0.js} +4 -1
- package/dist/{solidity-b-R-raGB.js → solidity-C9Q2I8Hh.js} +23 -1
- package/dist/{sophia-Y4GjyxNB.js → sophia-jWa1UyKz.js} +16 -1
- package/dist/{sparql-CDAPZb88.js → sparql-CM7jctbc.js} +15 -1
- package/dist/{sql-DkkpPiUq.js → sql-WzihTkbg.js} +42 -1
- package/dist/{st-CSPV91Ej.js → st-6y7_3aup.js} +8 -1
- package/dist/style.css +1 -1
- package/dist/{swift-DdSC5O48.js → swift-k-0zxG_D.js} +4 -1
- package/dist/{systemverilog-CI03XpAv.js → systemverilog-Pnr5_rIP.js} +29 -3
- package/dist/{tcl-B8DayMSI.js → tcl-fNPXval8.js} +7 -1
- package/dist/tsMode-D_PMsbjK.js +976 -0
- package/dist/{twig-B1AUPVB_.js → twig-L2MkztkV.js} +76 -1
- package/dist/{typescript-DrlYcCUn.js → typescript-Bu3ZbtQI.js} +23 -2
- package/dist/typespec-Cqqo-3Pt.js +123 -0
- package/dist/{vb-BIC7ccdG.js → vb-B5YC2xN9.js} +15 -1
- package/dist/{wgsl-C9yjop46.js → wgsl-D9BRtftY.js} +26 -1
- package/dist/{xml-BzP9D0eZ.js → xml-CNSSkPqy.js} +8 -2
- package/dist/{yaml-CT7GOvXu.js → yaml-5RF_PGNe.js} +30 -2
- package/handlers/compiler.ts +196 -16
- package/handlers/context-setup.ts +10 -5
- package/handlers/handler-api-factory.ts +358 -0
- package/handlers/handler-api.ts +379 -0
- package/handlers/handler-executor.ts +25 -5
- package/handlers/handler-scope.ts +398 -0
- package/handlers/index.ts +34 -2
- package/handlers/runtime-api/component-properties.ts +0 -8
- package/handlers/runtime-api/index.ts +1 -1
- package/handlers/runtime-api/toast.ts +1 -1
- package/index.ts +14 -115
- package/micro-app/README.md +10 -10
- package/micro-app/state/MicroAppRuntimeContext.ts +1 -28
- package/micro-app-entry.ts +0 -5
- package/package.json +22 -1
- package/redux/actions/application/index.ts +0 -1
- package/redux/actions/component/addComponentAction.ts +15 -4
- package/redux/actions/component/moveDraggedComponent.ts +1 -2
- package/redux/actions/component/update-component-name.ts +1 -1
- package/redux/actions/component/updateComponentAttributes.ts +7 -2
- package/redux/handlers/functions/build-function-handler.ts +11 -3
- package/redux/handlers/functions/deploy-function-handler.ts +11 -3
- package/redux/handlers/functions/invoke-function-handler.ts +11 -3
- package/redux/handlers/functions/load-functions-handler.ts +2 -1
- package/redux/handlers/functions/update-function-handler.ts +2 -1
- package/redux/store/component/component.interface.ts +8 -2
- package/redux/store/component/store.ts +1 -4
- package/state/runtime-context.ts +1 -23
- package/utils/RuntimeContextHelpers.ts +221 -90
- package/utils/change-detection.ts +125 -1
- package/utils/clipboard-utils.ts +18 -8
- package/utils/component-registry.ts +118 -0
- package/utils/index.ts +14 -1
- package/utils/naming-generator.ts +3 -1
- package/utils/randomness.ts +3 -1
- package/utils/register-components.ts +21 -29
- package/utils/render-util.ts +27 -48
- package/utils/toast.ts +97 -0
- package/vite.config.ts +29 -12
- package/components/ui/components/Event/EventAttribute/EventAttribute.style.ts +0 -11
- package/components/ui/components/Event/EventAttribute/EventAttribute.ts +0 -28
- package/components/ui/components/base/BaseElement/calculateStyles.ts +0 -31
- package/components/ui/components/base/BaseElement/drag-events.helpers.ts +0 -71
- package/components/ui/components/base/BaseElement/execute-event.helpers.ts +0 -45
- package/components/ui/components/base/BaseElement/interactions.helpers.ts +0 -14
- package/components/ui/components/wrappers/ComponentTitle/ComponentTitle.ts +0 -95
- package/components/ui/components/wrappers/GenerikWrapper/ResizeWrapper/ResizeWrapper.style.ts +0 -102
- package/components/ui/components/wrappers/GenerikWrapper/ResizeWrapper/ResizeWrapper.ts +0 -258
- package/components/ui/components/wrappers/PreviewWrapper.ts +0 -28
- package/components/ui/components/wrappers/RectangleSelection/RectangleSelection.ts +0 -154
- package/components/ui/nuraly-ui/packages/common/dist/constants/index.d.ts +0 -2
- package/components/ui/nuraly-ui/packages/common/dist/constants/index.js +0 -2
- package/components/ui/nuraly-ui/packages/common/dist/constants.d.ts +0 -17
- package/components/ui/nuraly-ui/packages/common/dist/constants.js +0 -7
- package/components/ui/nuraly-ui/packages/common/dist/controllers/index.d.ts +0 -2
- package/components/ui/nuraly-ui/packages/common/dist/controllers/index.js +0 -2
- package/components/ui/nuraly-ui/packages/common/dist/controllers.d.ts +0 -21
- package/components/ui/nuraly-ui/packages/common/dist/controllers.js +0 -22
- package/components/ui/nuraly-ui/packages/common/dist/index.d.ts +0 -25
- package/components/ui/nuraly-ui/packages/common/dist/index.js +0 -27
- package/components/ui/nuraly-ui/packages/common/dist/mixins/index.d.ts +0 -2
- package/components/ui/nuraly-ui/packages/common/dist/mixins/index.js +0 -3
- package/components/ui/nuraly-ui/packages/common/dist/mixins.d.ts +0 -26
- package/components/ui/nuraly-ui/packages/common/dist/mixins.js +0 -29
- package/components/ui/nuraly-ui/packages/common/dist/shared/base-mixin.d.ts +0 -42
- package/components/ui/nuraly-ui/packages/common/dist/shared/base-mixin.js +0 -38
- package/components/ui/nuraly-ui/packages/common/dist/shared/constants.d.ts +0 -1
- package/components/ui/nuraly-ui/packages/common/dist/shared/constants.js +0 -2
- package/components/ui/nuraly-ui/packages/common/dist/shared/controllers/dropdown.controller.d.ts +0 -77
- package/components/ui/nuraly-ui/packages/common/dist/shared/controllers/dropdown.controller.js +0 -341
- package/components/ui/nuraly-ui/packages/common/dist/shared/controllers/dropdown.interface.d.ts +0 -37
- package/components/ui/nuraly-ui/packages/common/dist/shared/controllers/dropdown.interface.js +0 -2
- package/components/ui/nuraly-ui/packages/common/dist/shared/controllers/index.d.ts +0 -4
- package/components/ui/nuraly-ui/packages/common/dist/shared/controllers/index.js +0 -4
- package/components/ui/nuraly-ui/packages/common/dist/shared/controllers/theme.controller.d.ts +0 -48
- package/components/ui/nuraly-ui/packages/common/dist/shared/controllers/theme.controller.js +0 -133
- package/components/ui/nuraly-ui/packages/common/dist/shared/dependency-mixin.d.ts +0 -37
- package/components/ui/nuraly-ui/packages/common/dist/shared/dependency-mixin.js +0 -141
- package/components/ui/nuraly-ui/packages/common/dist/shared/event-handler-mixin.d.ts +0 -64
- package/components/ui/nuraly-ui/packages/common/dist/shared/event-handler-mixin.js +0 -95
- package/components/ui/nuraly-ui/packages/common/dist/shared/index.d.ts +0 -13
- package/components/ui/nuraly-ui/packages/common/dist/shared/index.js +0 -17
- package/components/ui/nuraly-ui/packages/common/dist/shared/theme-mixin.d.ts +0 -78
- package/components/ui/nuraly-ui/packages/common/dist/shared/theme-mixin.js +0 -194
- package/components/ui/nuraly-ui/packages/common/dist/shared/themes.d.ts +0 -44
- package/components/ui/nuraly-ui/packages/common/dist/shared/themes.js +0 -85
- package/components/ui/nuraly-ui/packages/common/dist/shared/utils.d.ts +0 -60
- package/components/ui/nuraly-ui/packages/common/dist/shared/utils.js +0 -85
- package/components/ui/nuraly-ui/packages/common/dist/shared/validation.types.d.ts +0 -108
- package/components/ui/nuraly-ui/packages/common/dist/shared/validation.types.js +0 -17
- package/components/ui/nuraly-ui/packages/common/dist/themes/index.d.ts +0 -2
- package/components/ui/nuraly-ui/packages/common/dist/themes/index.js +0 -2
- package/components/ui/nuraly-ui/packages/common/dist/themes.d.ts +0 -22
- package/components/ui/nuraly-ui/packages/common/dist/themes.js +0 -23
- package/components/ui/nuraly-ui/packages/common/dist/utils/index.d.ts +0 -2
- package/components/ui/nuraly-ui/packages/common/dist/utils/index.js +0 -2
- package/components/ui/nuraly-ui/packages/common/dist/utils.d.ts +0 -21
- package/components/ui/nuraly-ui/packages/common/dist/utils.js +0 -22
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/LICENSE +0 -15
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/README.md +0 -294
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/copy/copy-sync.js +0 -171
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/copy/copy.js +0 -175
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/copy/index.js +0 -7
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/empty/index.js +0 -39
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/ensure/file.js +0 -66
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/ensure/index.js +0 -23
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/ensure/link.js +0 -64
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/ensure/symlink-paths.js +0 -101
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/ensure/symlink-type.js +0 -34
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/ensure/symlink.js +0 -67
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/fs/index.js +0 -146
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/index.js +0 -16
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/json/index.js +0 -16
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/json/jsonfile.js +0 -11
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/json/output-json-sync.js +0 -12
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/json/output-json.js +0 -12
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/mkdirs/index.js +0 -14
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/mkdirs/make-dir.js +0 -27
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/mkdirs/utils.js +0 -21
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/move/index.js +0 -7
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/move/move-sync.js +0 -55
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/move/move.js +0 -59
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/output-file/index.js +0 -31
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/path-exists/index.js +0 -12
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/remove/index.js +0 -17
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/util/async.js +0 -29
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/util/stat.js +0 -159
- package/components/ui/nuraly-ui/packages/forms/node_modules/fs-extra/lib/util/utimes.js +0 -36
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/LICENSE +0 -15
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/README.md +0 -294
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/copy/copy-sync.js +0 -171
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/copy/copy.js +0 -175
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/copy/index.js +0 -7
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/empty/index.js +0 -39
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/ensure/file.js +0 -66
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/ensure/index.js +0 -23
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/ensure/link.js +0 -64
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/ensure/symlink-paths.js +0 -101
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/ensure/symlink-type.js +0 -34
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/ensure/symlink.js +0 -67
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/fs/index.js +0 -146
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/index.js +0 -16
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/json/index.js +0 -16
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/json/jsonfile.js +0 -11
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/json/output-json-sync.js +0 -12
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/json/output-json.js +0 -12
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/mkdirs/index.js +0 -14
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/mkdirs/make-dir.js +0 -27
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/mkdirs/utils.js +0 -21
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/move/index.js +0 -7
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/move/move-sync.js +0 -55
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/move/move.js +0 -59
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/output-file/index.js +0 -31
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/path-exists/index.js +0 -12
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/remove/index.js +0 -17
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/util/async.js +0 -29
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/util/stat.js +0 -159
- package/components/ui/nuraly-ui/packages/layout/node_modules/fs-extra/lib/util/utimes.js +0 -36
- package/dist/SmartAttributeHandler-C4EliaG0.js +0 -153
- package/dist/SmartAttributeHandler-u-ZHGueR.js +0 -193
- package/dist/assets/editor.worker-C_S4Avdt.js +0 -11
- package/dist/assets/html.worker-DfuQASUV.js +0 -458
- package/dist/assets/json.worker-Cucz4wxY.js +0 -42
- package/dist/assets/ts.worker-Dme6S0YK.js +0 -37021
- package/dist/cssMode-CqMQ6Xsa.js +0 -1443
- package/dist/htmlMode-KglxyZXm.js +0 -1453
- package/dist/jsonMode-B3rqxD-b.js +0 -1863
- package/dist/tsMode-DEiq8fQ0.js +0 -800
- package/redux/actions/application/loadApplicationPermissionAction.ts +0 -10
- package/utils/styleUtil.ts +0 -7
package/README.md
CHANGED
|
@@ -1,778 +1,96 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
│ (Lit-based Web Components) │
|
|
43
|
-
└─────────────────┬───────────────────────────────────────┘
|
|
44
|
-
│
|
|
45
|
-
▼
|
|
46
|
-
┌─────────────────────────────────────────────────────────┐
|
|
47
|
-
│ Runtime System │
|
|
48
|
-
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
|
|
49
|
-
│ │ Handlers │ │ State │ │ Runtime API │ │
|
|
50
|
-
│ │ │ │ │ │ │ │
|
|
51
|
-
│ │ • Compiler │ │ • Context │ │ • Variables │ │
|
|
52
|
-
│ │ • Executor │ │ • Editor │ │ • Components │ │
|
|
53
|
-
│ │ • Context │ │ • Proxies │ │ • Navigation │ │
|
|
54
|
-
│ │ Setup │ │ │ │ • Pages │ │
|
|
55
|
-
│ └──────────────┘ └──────────────┘ └──────────────┘ │
|
|
56
|
-
└─────────────────┬───────────────────────────────────────┘
|
|
57
|
-
│
|
|
58
|
-
▼
|
|
59
|
-
┌─────────────────────────────────────────────────────────┐
|
|
60
|
-
│ Store Layer │
|
|
61
|
-
│ (Nanostores - Global State Management) │
|
|
62
|
-
└─────────────────────────────────────────────────────────┘
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Core Concepts
|
|
66
|
-
|
|
67
|
-
### 1. **Handlers**
|
|
68
|
-
|
|
69
|
-
Handlers are JavaScript code strings stored in component properties that are executed at runtime. They can be attached to:
|
|
70
|
-
|
|
71
|
-
- **Input Properties**: `input.text = { type: "handler", value: "GetVar('title')" }`
|
|
72
|
-
- **Style Properties**: `style.backgroundColor = { type: "handler", value: "GetVar('theme').primaryColor" }`
|
|
73
|
-
- **Event Properties**: `event.onClick = "NavigateToPage('dashboard')"`
|
|
74
|
-
|
|
75
|
-
### 2. **Runtime Context**
|
|
76
|
-
|
|
77
|
-
The Runtime Context (`ExecuteInstance`) is a singleton that maintains:
|
|
78
|
-
|
|
79
|
-
- **Component Registry**: All loaded components indexed by application ID
|
|
80
|
-
- **Context Variables**: Scoped variables (global and per-application)
|
|
81
|
-
- **Reactive Proxies**: Proxy objects that track property access and mutations
|
|
82
|
-
- **Event System**: Component change notifications and lifecycle events
|
|
83
|
-
|
|
84
|
-
### 3. **Execution Flow**
|
|
85
|
-
|
|
86
|
-
```
|
|
87
|
-
Component Property Access
|
|
88
|
-
│
|
|
89
|
-
▼
|
|
90
|
-
Is it a handler? ────No───▶ Return static value
|
|
91
|
-
│
|
|
92
|
-
Yes
|
|
93
|
-
│
|
|
94
|
-
▼
|
|
95
|
-
Compile Handler Function (with caching)
|
|
96
|
-
│
|
|
97
|
-
▼
|
|
98
|
-
Setup Runtime Context (component, event data, item)
|
|
99
|
-
│
|
|
100
|
-
▼
|
|
101
|
-
Extract Runtime Context (Apps, Vars, Current, etc.)
|
|
102
|
-
│
|
|
103
|
-
▼
|
|
104
|
-
Create Global Functions (GetVar, SetVar, NavigateToPage, etc.)
|
|
105
|
-
│
|
|
106
|
-
▼
|
|
107
|
-
Execute Compiled Function with all parameters
|
|
108
|
-
│
|
|
109
|
-
▼
|
|
110
|
-
Return Result & Trigger Side Effects
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
## Directory Structure
|
|
114
|
-
|
|
115
|
-
```
|
|
116
|
-
runtime/
|
|
117
|
-
├── index.ts # Main entry point, exports public API
|
|
118
|
-
├── README.md # This file
|
|
119
|
-
│
|
|
120
|
-
├── handlers/ # Handler execution system
|
|
121
|
-
│ ├── index.ts # Handler module exports
|
|
122
|
-
│ ├── compiler.ts # Function compilation & caching
|
|
123
|
-
│ ├── handler-executor.ts # Main handler execution orchestrator
|
|
124
|
-
│ ├── context-setup.ts # Runtime context initialization
|
|
125
|
-
│ │
|
|
126
|
-
│ └── runtime-api/ # Global functions for handlers
|
|
127
|
-
│ ├── index.ts # API aggregator
|
|
128
|
-
│ ├── variables.ts # Variable management (GetVar, SetVar)
|
|
129
|
-
│ ├── components.ts # Component operations (GetComponent, AddComponent)
|
|
130
|
-
│ ├── component-properties.ts # Property updates (updateStyle, updateInput)
|
|
131
|
-
│ ├── pages.ts # Page operations (AddPage, UpdatePage)
|
|
132
|
-
│ ├── applications.ts # Application operations
|
|
133
|
-
│ ├── navigation.ts # Navigation (NavigateToPage, NavigateToUrl)
|
|
134
|
-
│ ├── storage.ts # File storage (UploadFile, BrowseFiles)
|
|
135
|
-
│ ├── functions.ts # Backend function invocation
|
|
136
|
-
│ └── editor.ts # Editor operations
|
|
137
|
-
│
|
|
138
|
-
└── state/ # Runtime state management
|
|
139
|
-
├── index.ts # State module exports
|
|
140
|
-
├── runtime-context.ts # Core RuntimeContext singleton
|
|
141
|
-
└── editor.ts # Editor state & platform management
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## Key Components
|
|
145
|
-
|
|
146
|
-
### RuntimeContext (ExecuteInstance)
|
|
147
|
-
|
|
148
|
-
The central state manager. Key responsibilities:
|
|
149
|
-
|
|
150
|
-
- **Component Registration**: Loads and indexes components from stores
|
|
151
|
-
- **Hierarchy Building**: Establishes parent-child relationships
|
|
152
|
-
- **Proxy Creation**: Creates reactive proxies for `Properties`, `Vars`, and component values
|
|
153
|
-
- **Change Tracking**: Monitors property access and emits change events
|
|
154
|
-
- **Values Management**: Manages component instance values with `attachValuesProperty`
|
|
155
|
-
|
|
156
|
-
```typescript
|
|
157
|
-
import { ExecuteInstance } from '@features/runtime';
|
|
158
|
-
|
|
159
|
-
// Access global variables
|
|
160
|
-
ExecuteInstance.VarsProxy.username = 'John Doe';
|
|
161
|
-
const theme = ExecuteInstance.GetVar('theme');
|
|
162
|
-
|
|
163
|
-
// Access component registry
|
|
164
|
-
const app = ExecuteInstance.Apps['MyApp'];
|
|
165
|
-
const component = ExecuteInstance.applications['app-id']['ButtonComponent'];
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### Handler Compiler
|
|
169
|
-
|
|
170
|
-
Compiles JavaScript code strings into executable functions with caching.
|
|
171
|
-
|
|
172
|
-
**Features:**
|
|
173
|
-
- Function compilation with `new Function()`
|
|
174
|
-
- Automatic caching by code string
|
|
175
|
-
- Consistent parameter order (see `HANDLER_PARAMETERS`)
|
|
176
|
-
- Cache management utilities
|
|
177
|
-
|
|
178
|
-
```typescript
|
|
179
|
-
import { compileHandlerFunction } from '@features/runtime/handlers';
|
|
180
|
-
|
|
181
|
-
const fn = compileHandlerFunction("return GetVar('username')");
|
|
182
|
-
const result = fn(...allParameters);
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
### Handler Executor
|
|
186
|
-
|
|
187
|
-
Orchestrates handler execution with full runtime context.
|
|
188
|
-
|
|
189
|
-
**Process:**
|
|
190
|
-
1. Setup runtime context (component, event, item)
|
|
191
|
-
2. Extract runtime state (Apps, Vars, Current, etc.)
|
|
192
|
-
3. Create global functions (GetVar, NavigateToPage, etc.)
|
|
193
|
-
4. Compile handler code
|
|
194
|
-
5. Execute with all parameters
|
|
195
|
-
6. Return result
|
|
196
|
-
|
|
197
|
-
```typescript
|
|
198
|
-
import { executeHandler } from '@features/runtime';
|
|
199
|
-
|
|
200
|
-
const result = executeHandler(
|
|
201
|
-
component,
|
|
202
|
-
"GetVar('username')",
|
|
203
|
-
{ event: clickEvent },
|
|
204
|
-
itemData
|
|
205
|
-
);
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
### Editor
|
|
209
|
-
|
|
210
|
-
Manages editor-specific state and platform detection.
|
|
211
|
-
|
|
212
|
-
**Features:**
|
|
213
|
-
- Platform detection (mobile, tablet, desktop)
|
|
214
|
-
- Breakpoint-aware style retrieval
|
|
215
|
-
- Component selection tracking
|
|
216
|
-
- Editor mode management
|
|
217
|
-
- Custom console for logging
|
|
218
|
-
|
|
219
|
-
```typescript
|
|
220
|
-
import Editor from '@features/runtime/state/editor';
|
|
221
|
-
|
|
222
|
-
Editor.setEditorMode(true);
|
|
223
|
-
const platform = Editor.getCurrentPlatform();
|
|
224
|
-
const styles = Editor.getComponentStyles(component);
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
## Handler Execution Flow
|
|
228
|
-
|
|
229
|
-
### Detailed Execution Process
|
|
230
|
-
|
|
231
|
-
```typescript
|
|
232
|
-
// 1. Handler is triggered (e.g., onClick event)
|
|
233
|
-
component.event.onClick = "SetVar('count', GetVar('count') + 1)";
|
|
234
|
-
|
|
235
|
-
// 2. executeHandler is called
|
|
236
|
-
executeHandler(component, component.event.onClick, { event: clickEvent });
|
|
237
|
-
|
|
238
|
-
// 3. Setup runtime context
|
|
239
|
-
setupRuntimeContext(component, EventData);
|
|
240
|
-
// - Sets ExecuteInstance.Current = component
|
|
241
|
-
// - Attaches values property
|
|
242
|
-
// - Creates style proxy
|
|
243
|
-
// - Sets event data
|
|
244
|
-
|
|
245
|
-
// 4. Extract runtime context
|
|
246
|
-
const runtimeContext = extractRuntimeContext();
|
|
247
|
-
// - context, applications, Apps, Values, Current, etc.
|
|
248
|
-
|
|
249
|
-
// 5. Create global functions
|
|
250
|
-
const globalFunctions = createGlobalHandlerFunctions(runtimeContext);
|
|
251
|
-
// - GetVar, SetVar, GetComponent, NavigateToPage, etc.
|
|
252
|
-
|
|
253
|
-
// 6. Compile handler
|
|
254
|
-
const compiledFunction = compileHandlerFunction(code);
|
|
255
|
-
// - Creates Function with HANDLER_PARAMETERS
|
|
256
|
-
// - Caches for reuse
|
|
257
|
-
|
|
258
|
-
// 7. Execute with all parameters (in exact order)
|
|
259
|
-
return compiledFunction(
|
|
260
|
-
Database,
|
|
261
|
-
eventDispatcher,
|
|
262
|
-
PropertiesProxy,
|
|
263
|
-
Editor,
|
|
264
|
-
Event,
|
|
265
|
-
Item,
|
|
266
|
-
Current,
|
|
267
|
-
currentPlatform,
|
|
268
|
-
Values,
|
|
269
|
-
Apps,
|
|
270
|
-
Vars,
|
|
271
|
-
SetVar,
|
|
272
|
-
GetContextVar,
|
|
273
|
-
UpdateApplication,
|
|
274
|
-
GetVar,
|
|
275
|
-
// ... all other parameters
|
|
276
|
-
);
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
## API Reference
|
|
280
|
-
|
|
281
|
-
### Variable Functions
|
|
282
|
-
|
|
283
|
-
Available in handler code:
|
|
284
|
-
|
|
285
|
-
#### `GetVar(symbol: string): any`
|
|
286
|
-
Gets a global variable value.
|
|
287
|
-
|
|
288
|
-
```javascript
|
|
289
|
-
const username = GetVar('username');
|
|
290
|
-
const theme = GetVar('theme');
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
#### `SetVar(symbol: string, value: any): void`
|
|
294
|
-
Sets a global variable value.
|
|
295
|
-
|
|
296
|
-
```javascript
|
|
297
|
-
SetVar('username', 'John Doe');
|
|
298
|
-
SetVar('theme', { primaryColor: '#3b82f6' });
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
#### `GetContextVar(symbol: string, customContextId: string | null, component: any): any`
|
|
302
|
-
Gets a context-scoped variable (application-specific).
|
|
303
|
-
|
|
304
|
-
```javascript
|
|
305
|
-
const appData = GetContextVar('appData', null, Current);
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
#### `SetContextVar(symbol: string, value: any, component: any): void`
|
|
309
|
-
Sets a context-scoped variable.
|
|
310
|
-
|
|
311
|
-
```javascript
|
|
312
|
-
SetContextVar('currentPage', 'dashboard', Current);
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
### Component Functions
|
|
316
|
-
|
|
317
|
-
#### `GetComponent(componentUuid: string, application_id: string): ComponentElement`
|
|
318
|
-
Retrieves a component by UUID.
|
|
319
|
-
|
|
320
|
-
```javascript
|
|
321
|
-
const button = GetComponent('comp-123-456', 'app-id');
|
|
322
|
-
button.style.backgroundColor = '#3b82f6';
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
#### `GetComponents(componentIds: string[]): ComponentElement[]`
|
|
326
|
-
Retrieves multiple components by their IDs.
|
|
327
|
-
|
|
328
|
-
```javascript
|
|
329
|
-
const buttons = GetComponents(['comp-1', 'comp-2', 'comp-3']);
|
|
330
|
-
buttons.forEach(btn => btn.style.opacity = '0.8');
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
#### `AddComponent({ application_id, pageId, componentType, additionalData }): void`
|
|
334
|
-
Adds a new component to a page.
|
|
335
|
-
|
|
336
|
-
```javascript
|
|
337
|
-
AddComponent({
|
|
338
|
-
application_id: 'app-id',
|
|
339
|
-
pageId: 'page-id',
|
|
340
|
-
componentType: 'Button',
|
|
341
|
-
additionalData: { input: { text: 'Click Me' } }
|
|
342
|
-
});
|
|
343
|
-
```
|
|
344
|
-
|
|
345
|
-
#### `DeleteComponentAction(component: ComponentElement): void`
|
|
346
|
-
Deletes a component with user confirmation.
|
|
347
|
-
|
|
348
|
-
```javascript
|
|
349
|
-
DeleteComponentAction(Current);
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
#### `CopyComponentToClipboard(component: ComponentElement): void`
|
|
353
|
-
Copies component to clipboard for pasting.
|
|
354
|
-
|
|
355
|
-
```javascript
|
|
356
|
-
CopyComponentToClipboard(Current);
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
#### `PasteComponentFromClipboard(): void`
|
|
360
|
-
Pastes component from clipboard.
|
|
361
|
-
|
|
362
|
-
```javascript
|
|
363
|
-
PasteComponentFromClipboard();
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
### Component Property Functions
|
|
367
|
-
|
|
368
|
-
#### `updateName(component: ComponentElement, componentName: string): void`
|
|
369
|
-
Updates component name.
|
|
370
|
-
|
|
371
|
-
```javascript
|
|
372
|
-
updateName(Current, 'PrimaryButton');
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
#### `updateInput(component: ComponentElement, inputName: string, handlerType: string, handlerValue: any): void`
|
|
376
|
-
Updates component input property.
|
|
377
|
-
|
|
378
|
-
```javascript
|
|
379
|
-
updateInput(Current, 'text', 'static', 'Hello World');
|
|
380
|
-
updateInput(Current, 'label', 'handler', "GetVar('username')");
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
#### `updateStyle(component: ComponentElement, symbol: string, value: any): void`
|
|
384
|
-
Updates component style property (supports pseudo-states).
|
|
385
|
-
|
|
386
|
-
```javascript
|
|
387
|
-
updateStyle(Current, 'backgroundColor', '#3b82f6');
|
|
388
|
-
updateStyle(Current, 'fontSize', '16px');
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
#### `updateEvent(component: ComponentElement, symbol: string, value: any): void`
|
|
392
|
-
Updates component event handler.
|
|
393
|
-
|
|
394
|
-
```javascript
|
|
395
|
-
updateEvent(Current, 'onClick', "NavigateToPage('dashboard')");
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
### Page Functions
|
|
399
|
-
|
|
400
|
-
#### `AddPage(page: any): Promise<any>`
|
|
401
|
-
Creates a new page.
|
|
402
|
-
|
|
403
|
-
```javascript
|
|
404
|
-
const newPage = await AddPage({
|
|
405
|
-
name: 'Dashboard',
|
|
406
|
-
application_id: 'app-id',
|
|
407
|
-
route: '/dashboard'
|
|
408
|
-
});
|
|
409
|
-
```
|
|
410
|
-
|
|
411
|
-
#### `UpdatePage(page: any): Promise<any>`
|
|
412
|
-
Updates an existing page.
|
|
413
|
-
|
|
414
|
-
```javascript
|
|
415
|
-
await UpdatePage({
|
|
416
|
-
uuid: 'page-id',
|
|
417
|
-
name: 'Updated Dashboard',
|
|
418
|
-
route: '/dashboard-v2'
|
|
419
|
-
});
|
|
420
|
-
```
|
|
421
|
-
|
|
422
|
-
#### `deletePage(page: PageElement): void`
|
|
423
|
-
Deletes a page with confirmation.
|
|
424
|
-
|
|
425
|
-
```javascript
|
|
426
|
-
deletePage(currentPage);
|
|
427
|
-
```
|
|
428
|
-
|
|
429
|
-
### Navigation Functions
|
|
430
|
-
|
|
431
|
-
#### `NavigateToUrl(url: string): void`
|
|
432
|
-
Navigates to external or internal URL.
|
|
433
|
-
|
|
434
|
-
```javascript
|
|
435
|
-
NavigateToUrl('https://example.com');
|
|
436
|
-
NavigateToUrl('/dashboard');
|
|
437
|
-
```
|
|
438
|
-
|
|
439
|
-
#### `NavigateToHash(hash: string): void`
|
|
440
|
-
Navigates to hash anchor and scrolls to element.
|
|
441
|
-
|
|
442
|
-
```javascript
|
|
443
|
-
NavigateToHash('#section-about');
|
|
444
|
-
```
|
|
445
|
-
|
|
446
|
-
#### `NavigateToPage(pageName: string): void`
|
|
447
|
-
Navigates to a page by name within the current application.
|
|
448
|
-
|
|
449
|
-
```javascript
|
|
450
|
-
NavigateToPage('Dashboard');
|
|
451
|
-
NavigateToPage('Profile');
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
### Storage Functions
|
|
455
|
-
|
|
456
|
-
#### `UploadFile(files: File | File[], folderPath: string): Promise<any>`
|
|
457
|
-
Uploads file(s) to storage.
|
|
458
|
-
|
|
459
|
-
```javascript
|
|
460
|
-
const fileInput = document.querySelector('input[type="file"]');
|
|
461
|
-
const result = await UploadFile(fileInput.files[0], 'images');
|
|
462
|
-
|
|
463
|
-
// Multiple files
|
|
464
|
-
const results = await UploadFile([...fileInput.files], 'documents');
|
|
465
|
-
```
|
|
466
|
-
|
|
467
|
-
#### `BrowseFiles(folderPath: string, options: { continuation?: string, limit?: number }): Promise<any>`
|
|
468
|
-
Lists files in a folder with pagination.
|
|
469
|
-
|
|
470
|
-
```javascript
|
|
471
|
-
const result = await BrowseFiles('images', { limit: 50 });
|
|
472
|
-
console.log(result.files);
|
|
473
|
-
|
|
474
|
-
// Load next page
|
|
475
|
-
if (result.continuation) {
|
|
476
|
-
const nextPage = await BrowseFiles('images', {
|
|
477
|
-
continuation: result.continuation
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
```
|
|
481
|
-
|
|
482
|
-
### Function Invocation
|
|
483
|
-
|
|
484
|
-
#### `InvokeFunction(name: string, payload: any): Promise<any>`
|
|
485
|
-
Invokes a backend studio function.
|
|
486
|
-
|
|
487
|
-
```javascript
|
|
488
|
-
const result = await InvokeFunction('getUserData', { userId: 123 });
|
|
489
|
-
console.log(result);
|
|
490
|
-
```
|
|
491
|
-
|
|
492
|
-
### Application Functions
|
|
493
|
-
|
|
494
|
-
#### `UpdateApplication(application: any): void`
|
|
495
|
-
Updates application properties.
|
|
496
|
-
|
|
497
|
-
```javascript
|
|
498
|
-
UpdateApplication({
|
|
499
|
-
uuid: 'app-id',
|
|
500
|
-
name: 'Updated App Name',
|
|
501
|
-
description: 'New description'
|
|
502
|
-
});
|
|
503
|
-
```
|
|
504
|
-
|
|
505
|
-
### Editor Functions
|
|
506
|
-
|
|
507
|
-
#### `openEditorTab(tab: any): void`
|
|
508
|
-
Opens a tab in the editor.
|
|
509
|
-
|
|
510
|
-
```javascript
|
|
511
|
-
openEditorTab({ type: 'component', componentId: 'comp-123' });
|
|
512
|
-
```
|
|
513
|
-
|
|
514
|
-
#### `setCurrentEditorTab(tab: any): void`
|
|
515
|
-
Sets the current active editor tab.
|
|
516
|
-
|
|
517
|
-
```javascript
|
|
518
|
-
setCurrentEditorTab({ type: 'styles' });
|
|
519
|
-
```
|
|
520
|
-
|
|
521
|
-
#### `TraitCompoentFromSchema(text: string): void`
|
|
522
|
-
Creates components from JSON schema text.
|
|
523
|
-
|
|
524
|
-
```javascript
|
|
525
|
-
TraitCompoentFromSchema(JSON.stringify({
|
|
526
|
-
component_type: 'Container',
|
|
527
|
-
children: [{ component_type: 'Text', input: { text: 'Hello' } }]
|
|
528
|
-
}));
|
|
529
|
-
```
|
|
530
|
-
|
|
531
|
-
## Usage Examples
|
|
532
|
-
|
|
533
|
-
### Example 1: Counter Component
|
|
534
|
-
|
|
535
|
-
```javascript
|
|
536
|
-
// Handler: Initialize counter
|
|
537
|
-
SetVar('count', 0);
|
|
538
|
-
|
|
539
|
-
// Handler: Increment on click
|
|
540
|
-
SetVar('count', GetVar('count') + 1);
|
|
541
|
-
|
|
542
|
-
// Handler: Display count
|
|
543
|
-
return `Count: ${GetVar('count')}`;
|
|
544
|
-
```
|
|
545
|
-
|
|
546
|
-
### Example 2: Theme Switcher
|
|
547
|
-
|
|
548
|
-
```javascript
|
|
549
|
-
// Handler: Toggle theme
|
|
550
|
-
const currentTheme = GetVar('theme') || 'light';
|
|
551
|
-
const newTheme = currentTheme === 'light' ? 'dark' : 'light';
|
|
552
|
-
SetVar('theme', newTheme);
|
|
553
|
-
|
|
554
|
-
// Update all components
|
|
555
|
-
Components.forEach(component => {
|
|
556
|
-
if (component.component_type === 'Container') {
|
|
557
|
-
updateStyle(component, 'backgroundColor',
|
|
558
|
-
newTheme === 'dark' ? '#1a1a1a' : '#ffffff'
|
|
559
|
-
);
|
|
560
|
-
}
|
|
561
|
-
});
|
|
562
|
-
```
|
|
563
|
-
|
|
564
|
-
### Example 3: Dynamic Form Submission
|
|
565
|
-
|
|
566
|
-
```javascript
|
|
567
|
-
// Handler: Form submit
|
|
568
|
-
const formData = {
|
|
569
|
-
username: GetVar('form_username'),
|
|
570
|
-
email: GetVar('form_email'),
|
|
571
|
-
message: GetVar('form_message')
|
|
572
|
-
};
|
|
573
|
-
|
|
574
|
-
const result = await InvokeFunction('submitContactForm', formData);
|
|
575
|
-
|
|
576
|
-
if (result.success) {
|
|
577
|
-
SetVar('form_submitted', true);
|
|
578
|
-
NavigateToPage('ThankYou');
|
|
579
|
-
} else {
|
|
580
|
-
SetVar('form_error', result.error);
|
|
581
|
-
}
|
|
582
|
-
```
|
|
583
|
-
|
|
584
|
-
### Example 4: File Upload with Preview
|
|
585
|
-
|
|
586
|
-
```javascript
|
|
587
|
-
// Handler: File upload
|
|
588
|
-
const fileInput = Event.target;
|
|
589
|
-
const file = fileInput.files[0];
|
|
590
|
-
|
|
591
|
-
if (file) {
|
|
592
|
-
// Show loading
|
|
593
|
-
updateInput(Current, 'loading', 'static', true);
|
|
594
|
-
|
|
595
|
-
try {
|
|
596
|
-
const result = await UploadFile(file, 'user-uploads');
|
|
597
|
-
|
|
598
|
-
// Store file URL
|
|
599
|
-
SetVar('uploaded_file_url', result.url);
|
|
600
|
-
|
|
601
|
-
// Update preview component
|
|
602
|
-
const previewImage = GetComponent('preview-img-id', Current.application_id);
|
|
603
|
-
updateInput(previewImage, 'src', 'static', result.url);
|
|
604
|
-
|
|
605
|
-
updateInput(Current, 'loading', 'static', false);
|
|
606
|
-
} catch (error) {
|
|
607
|
-
console.error('Upload failed:', error);
|
|
608
|
-
updateInput(Current, 'error', 'static', error.message);
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
```
|
|
612
|
-
|
|
613
|
-
### Example 5: Conditional Component Visibility
|
|
614
|
-
|
|
615
|
-
```javascript
|
|
616
|
-
// Handler: Check user authentication
|
|
617
|
-
const isLoggedIn = GetVar('user_authenticated');
|
|
618
|
-
|
|
619
|
-
if (isLoggedIn) {
|
|
620
|
-
// Show user dashboard components
|
|
621
|
-
const dashboardContainer = GetComponent('dashboard-id', Current.application_id);
|
|
622
|
-
updateStyle(dashboardContainer, 'display', 'flex');
|
|
623
|
-
|
|
624
|
-
// Hide login form
|
|
625
|
-
const loginForm = GetComponent('login-form-id', Current.application_id);
|
|
626
|
-
updateStyle(loginForm, 'display', 'none');
|
|
627
|
-
} else {
|
|
628
|
-
// Redirect to login
|
|
629
|
-
NavigateToPage('Login');
|
|
630
|
-
}
|
|
631
|
-
```
|
|
632
|
-
|
|
633
|
-
## Development Guide
|
|
634
|
-
|
|
635
|
-
### Adding New Runtime API Functions
|
|
636
|
-
|
|
637
|
-
1. **Choose the appropriate API module** in `handlers/runtime-api/`
|
|
638
|
-
2. **Define your function** with clear JSDoc comments
|
|
639
|
-
3. **Add to the module's export** in its `create*Functions()` function
|
|
640
|
-
4. **Update `HANDLER_PARAMETERS`** in `compiler.ts` if needed
|
|
641
|
-
5. **Pass the function** in `handler-executor.ts`
|
|
642
|
-
6. **Document in README** with examples
|
|
643
|
-
|
|
644
|
-
Example:
|
|
645
|
-
|
|
646
|
-
```typescript
|
|
647
|
-
// In handlers/runtime-api/variables.ts
|
|
648
|
-
export function createVariableFunctions(runtimeContext: any) {
|
|
649
|
-
return {
|
|
650
|
-
/**
|
|
651
|
-
* Clears all global variables
|
|
652
|
-
*/
|
|
653
|
-
ClearAllVars: (): void => {
|
|
654
|
-
// Implementation
|
|
1
|
+
# @nuraly/runtime
|
|
2
|
+
|
|
3
|
+
Standalone runtime for executing Nuraly micro-apps in any web environment.
|
|
4
|
+
|
|
5
|
+
[Documentation](https://docs.nuraly.io/architecture/micro-apps/)
|
|
6
|
+
|
|
7
|
+
## Why MicroApp?
|
|
8
|
+
|
|
9
|
+
- **Declarative** - Define your entire application as JSON object
|
|
10
|
+
- **Framework agnostic** - Web Components work everywhere
|
|
11
|
+
- **Reactive by default** - `$variables` automatically trigger UI updates
|
|
12
|
+
- **Isolated contexts** - Multiple micro-apps run independently on the same page
|
|
13
|
+
- **AI friendly** - LLMs maintain JSON structure more reliably than full implementations
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## Example
|
|
17
|
+
|
|
18
|
+
[Live Demo](https://jsfiddle.net/nuraly/cp4jxkwv/)
|
|
19
|
+
|
|
20
|
+
```javascript
|
|
21
|
+
const appComponents = [
|
|
22
|
+
{
|
|
23
|
+
uuid: "comp-001",
|
|
24
|
+
name: "Container",
|
|
25
|
+
component_type: "vertical-container-block",
|
|
26
|
+
application_id: "my-app",
|
|
27
|
+
pageId: "page-001",
|
|
28
|
+
root: true,
|
|
29
|
+
childrenIds: ["comp-002", "comp-005"],
|
|
30
|
+
style: { padding: "20px" },
|
|
31
|
+
input: {},
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
uuid: "comp-002",
|
|
35
|
+
name: "Button",
|
|
36
|
+
component_type: "button_input",
|
|
37
|
+
application_id: "my-app",
|
|
38
|
+
pageId: "page-001",
|
|
39
|
+
root: false,
|
|
40
|
+
event: {
|
|
41
|
+
onClick: `$count = ($count || 0) + 1;`,
|
|
655
42
|
},
|
|
656
|
-
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
43
|
+
input: {
|
|
44
|
+
label: { type: "string", value: "Click Me" },
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
uuid: "comp-005",
|
|
49
|
+
name: "Counter Display",
|
|
50
|
+
component_type: "text_label",
|
|
51
|
+
application_id: "my-app",
|
|
52
|
+
pageId: "page-001",
|
|
53
|
+
root: false,
|
|
54
|
+
input: {
|
|
55
|
+
value: {
|
|
56
|
+
type: "handler",
|
|
57
|
+
value: `return "Count: " + ($count || 0);`,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
];
|
|
675
62
|
|
|
676
|
-
|
|
677
|
-
|
|
63
|
+
const appPages = [
|
|
64
|
+
{
|
|
65
|
+
uuid: "page-001",
|
|
66
|
+
application_id: "my-app",
|
|
67
|
+
name: "Home",
|
|
68
|
+
url: "/home",
|
|
69
|
+
is_default: true,
|
|
70
|
+
},
|
|
71
|
+
];
|
|
678
72
|
```
|
|
679
73
|
|
|
680
|
-
|
|
681
|
-
- Property access and mutations
|
|
682
|
-
- Proxy set/get operations
|
|
683
|
-
- Component hierarchy registration
|
|
684
|
-
- Handler execution context
|
|
74
|
+
Plain HTML, no framework required:
|
|
685
75
|
|
|
686
|
-
|
|
76
|
+
```html
|
|
77
|
+
<div id="app"></div>
|
|
687
78
|
|
|
688
|
-
|
|
689
|
-
import
|
|
79
|
+
<script type="module">
|
|
80
|
+
import "@nuraly/runtime";
|
|
690
81
|
|
|
691
|
-
|
|
692
|
-
const mockComponent = {
|
|
693
|
-
uuid: 'test-comp',
|
|
694
|
-
application_id: 'test-app',
|
|
695
|
-
component_type: 'Button',
|
|
696
|
-
input: {},
|
|
697
|
-
style: {},
|
|
698
|
-
event: {}
|
|
699
|
-
};
|
|
82
|
+
await customElements.whenDefined('micro-app');
|
|
700
83
|
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
{}
|
|
707
|
-
);
|
|
84
|
+
const microApp = document.createElement('micro-app');
|
|
85
|
+
microApp.uuid = "my-app";
|
|
86
|
+
microApp.page_uuid = "page-001";
|
|
87
|
+
microApp.appComponents = appComponents;
|
|
88
|
+
microApp.appPages = appPages;
|
|
708
89
|
|
|
709
|
-
|
|
90
|
+
document.getElementById('app').appendChild(microApp);
|
|
91
|
+
</script>
|
|
710
92
|
```
|
|
711
93
|
|
|
712
|
-
### Performance Optimization
|
|
713
|
-
|
|
714
|
-
**Handler Caching**
|
|
715
|
-
- Compiled functions are automatically cached by code string
|
|
716
|
-
- Cache persists for application lifetime
|
|
717
|
-
- Clear cache with `clearHandlerCache()` if needed
|
|
718
|
-
|
|
719
|
-
**Proxy Caching**
|
|
720
|
-
- Style proxies cached in `WeakMap` to avoid recreation
|
|
721
|
-
- Values proxies cached per component
|
|
722
|
-
- Automatic garbage collection when components unmount
|
|
723
|
-
|
|
724
|
-
**Component Registration**
|
|
725
|
-
- Registration happens on store updates (debounced)
|
|
726
|
-
- Hierarchy built once per registration cycle
|
|
727
|
-
- Parent-child relationships cached
|
|
728
|
-
|
|
729
|
-
## Performance Considerations
|
|
730
|
-
|
|
731
|
-
### Best Practices
|
|
732
|
-
|
|
733
|
-
✅ **DO:**
|
|
734
|
-
- Use handlers for dynamic values only
|
|
735
|
-
- Keep handler code concise
|
|
736
|
-
- Cache computed values in variables
|
|
737
|
-
- Use context variables for app-specific state
|
|
738
|
-
- Batch style updates when possible
|
|
739
|
-
|
|
740
|
-
❌ **DON'T:**
|
|
741
|
-
- Use handlers for static values
|
|
742
|
-
- Create infinite loops (e.g., handler that triggers itself)
|
|
743
|
-
- Store large objects in variables
|
|
744
|
-
- Perform heavy computations in frequently-called handlers
|
|
745
|
-
- Mutate component properties directly without update functions
|
|
746
|
-
|
|
747
|
-
### Memory Management
|
|
748
|
-
|
|
749
|
-
- **Proxy Caching**: Uses WeakMap for automatic garbage collection
|
|
750
|
-
- **Event Listeners**: Automatically cleaned up on component unmount
|
|
751
|
-
- **Function Cache**: Cleared when necessary with `clearHandlerCache()`
|
|
752
|
-
- **Component Values**: Stored in centralized `$runtimeValues` store
|
|
753
|
-
|
|
754
|
-
### Performance Metrics
|
|
755
|
-
|
|
756
|
-
Monitor these in production:
|
|
757
|
-
- Handler execution time (should be < 10ms for most handlers)
|
|
758
|
-
- Cache hit rate (should be > 90%)
|
|
759
|
-
- Component registration time (should be < 100ms)
|
|
760
|
-
- Memory usage (should be stable, no leaks)
|
|
761
|
-
|
|
762
|
-
## Contributing
|
|
763
|
-
|
|
764
|
-
When contributing to the runtime system:
|
|
765
|
-
|
|
766
|
-
1. **Maintain backward compatibility** - existing handlers must continue to work
|
|
767
|
-
2. **Add comprehensive tests** - test new API functions thoroughly
|
|
768
|
-
3. **Update documentation** - keep README and JSDoc comments current
|
|
769
|
-
4. **Follow naming conventions** - PascalCase for functions in handler context
|
|
770
|
-
5. **Optimize for performance** - use caching, avoid unnecessary work
|
|
771
|
-
|
|
772
94
|
## License
|
|
773
95
|
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
---
|
|
777
|
-
|
|
778
|
-
**Questions?** Check the main project documentation or open an issue on GitHub.
|
|
96
|
+
MIT
|