Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
db30d30
feat: Add and register the runtime-deploy toolbar
littla2liyou Sep 29, 2025
31c6165
feat: Add the runtime-renderer package
littla2liyou Sep 29, 2025
912c023
feat: Enable to start runtime-renderer from runtime-deploy button
littla2liyou Sep 29, 2025
2d70094
feat: Add type definitions for config and schema
littla2liyou Sep 30, 2025
6174c0d
feat: Provide some utils for runtime-renderer
littla2liyou Sep 30, 2025
7fdc46c
feat: Provide builtin component
littla2liyou Sep 30, 2025
bafceda
feat: Core of page renderer
littla2liyou Sep 30, 2025
e35bd65
feat: Part of lifecycle support
littla2liyou Sep 30, 2025
7b73cea
feat: Add vue-router based routing capability for application schema
littla2liyou Sep 30, 2025
fe14595
feat: Add Pinia-based stores capability
littla2liyou Sep 30, 2025
44ffc60
feat: Add data source capability
littla2liyou Sep 30, 2025
0b65946
feat: Support using user-added utils in applications
littla2liyou Sep 30, 2025
ebbe375
feat: Support internationalization, default to Chinese display
littla2liyou Sep 30, 2025
e7212cd
test: Mock data for test
littla2liyou Sep 30, 2025
8a2db0b
fix: update axios and vite dependencies
littla2liyou Oct 4, 2025
3dc9565
fix: fix the async function issue
littla2liyou Oct 5, 2025
8c49f97
fix: fix package name usage in CDN URL construction
littla2liyou Oct 5, 2025
9ef991b
fix: add error handling
littla2liyou Oct 5, 2025
57ca2bb
fix: move app.provide call before app.use chain
littla2liyou Oct 6, 2025
4b9f208
fix: improve query parameter handling in deploy script
littla2liyou Oct 6, 2025
d93124c
fix: change getBlockContext to synchronous function
littla2liyou Oct 6, 2025
c44e187
fix: remove unused styles and comments
littla2liyou Oct 7, 2025
325e9d8
fix: add error logging for missing parent routes
littla2liyou Oct 7, 2025
23bed27
fix: improve schema handling
littla2liyou Oct 9, 2025
ebfb795
fix: handle orphaned child routes as top-level routes
littla2liyou Oct 9, 2025
515191b
fix: add global error handler to runtime renderer
littla2liyou Oct 9, 2025
e23c648
feat: improve native component loading
littla2liyou Oct 12, 2025
6f9eec4
feat: improve initUtils to parallelize npm util loading
littla2liyou Oct 12, 2025
62c1efd
feat: add global Window type declarations in types.d.ts
littla2liyou Oct 12, 2025
f7ee10f
fix: add error notification for failed runtime window open
littla2liyou Oct 12, 2025
bafb6ec
fix: refactor PageRenderer from Vue SFC to TypeScript HOC
littla2liyou Oct 19, 2025
61d5fa0
fix: move lifecycle handling into renderer component
littla2liyou Oct 19, 2025
417d5f5
fix: change CanvasBox component to div
littla2liyou Oct 19, 2025
e1827ce
fix: update package dependencies
littla2liyou Oct 20, 2025
eba84d5
fix: remove debug code from router initialization
littla2liyou Oct 20, 2025
6128c9a
Refactor data source initialization and exports
littla2liyou Oct 20, 2025
0992421
feat: remove focus logic for existing runtime window
littla2liyou Oct 20, 2025
1fab0a6
fix: refactor CSS scoping with PostCSS and selector parser
littla2liyou Oct 22, 2025
0a9658b
fix: refactor AppSchema to IAppSchema and update usage
littla2liyou Oct 22, 2025
90d54aa
fix: refactor page property access
littla2liyou Oct 22, 2025
b89cea9
feat: add dynamic import map initialization for runtime
littla2liyou Oct 22, 2025
a06d7e3
fix: fix incorrect property name in route path assignment
littla2liyou Oct 24, 2025
6902bec
fix: change pageId type and build route configuration using recursive…
littla2liyou Oct 24, 2025
451e32a
fix: load bundle.json dynamically via fetch
littla2liyou Oct 24, 2025
c6e7f39
fix: fix pageId type to string and improve schema handling
littla2liyou Oct 24, 2025
c879ef5
feat: load global state by channel from designer
littla2liyou Oct 24, 2025
2ed2cfa
fix: fix incorrect response variable in error handling
littla2liyou Oct 25, 2025
19e88f3
fix: improve origin checks in postMessage event handlers
littla2liyou Oct 25, 2025
7ac1142
feat: refactor runtime-deploy to send deps and globalState via postMe…
littla2liyou Oct 25, 2025
ee09657
fix: insure string page IDs with JAVA backend
littla2liyou Oct 25, 2025
3b04ef0
fix: fix handshake race and ensure timeout cleanup; restrict postMess…
littla2liyou Oct 26, 2025
c743944
fix: add importMap
littla2liyou Oct 26, 2025
3435dab
fix: fix inverted logic in global state initialization.
littla2liyou Oct 26, 2025
c80c24d
fix: refactor import map handling and cleanup package imports
littla2liyou Oct 26, 2025
d6c2e56
fix: update CDN config and clean up import map and types
littla2liyou Oct 26, 2025
a0a10cf
feat: sync router with designer page and expose navigation promise
littla2liyou Oct 26, 2025
827bd7e
Revert "feat: sync router with designer page and expose navigation pr…
littla2liyou Oct 26, 2025
6f8c9d4
feat: sync router with designer page and expose navigation promise
littla2liyou Oct 26, 2025
e7b38db
fix: fix CSS scope handling for page and blocks
littla2liyou Oct 27, 2025
6c5b9cc
fix: lodad packages from bundle.json
littla2liyou Oct 28, 2025
940c819
fix: delete window communication
littla2liyou Oct 28, 2025
df3d66e
refactor: refactor router config generation and types
littla2liyou Oct 28, 2025
414278e
feat: enhance deployPage to support page route in URL hash
littla2liyou Oct 28, 2025
37ca81a
fix: fix default child route redirect path construction
littla2liyou Oct 28, 2025
e7be125
fix: update favicon to use new OpenTiny TinyEngine logo
littla2liyou Oct 28, 2025
3d83aec
fix: remove unused cssScopeId props from PageRenderer and RenderMain
littla2liyou Oct 28, 2025
03b474e
fix: refactor generateFunction implementation, remove the dependency …
littla2liyou Oct 29, 2025
a705f91
fix: add runtime.html to Vite input configuration
littla2liyou Oct 29, 2025
476dfdf
fix: update Vite externals in runtime-renderer config
littla2liyou Oct 29, 2025
4444078
fix: delete unused mock data
littla2liyou Oct 29, 2025
9ba03dd
fix: add getters and actions function error handling
littla2liyou Oct 29, 2025
eb35611
fix: fix componentsMap initialization with fallback
littla2liyou Oct 29, 2025
6356131
fix: fix routes generation with undefined pages
littla2liyou Oct 29, 2025
0bca76a
fix: fix error handling in HTTP response interceptor
littla2liyou Oct 29, 2025
c4f516b
fix: guard access to n.nodes
littla2liyou Oct 29, 2025
f048a74
fix: parse data handlers once outside the closure.
littla2liyou Oct 29, 2025
af351a4
Merge branch 'ospp-2025/runtime-rendering' of https://github.com/litt…
littla2liyou Oct 29, 2025
fbd31ed
fix: apply data handler to static data sources
littla2liyou Oct 29, 2025
c2332f8
fix: unify data structure in dataHandler output
littla2liyou Oct 29, 2025
fd871d2
fix: refactor static data handling in dataSource load
littla2liyou Oct 29, 2025
34e099c
fix: complete ParseJSSlot
littla2liyou Oct 29, 2025
81979a8
fix: refactor renderDefault to accept renderComponent callback and av…
littla2liyou Oct 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions designer-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"dependencies": {
"@opentiny/tiny-engine": "workspace:^",
"@opentiny/tiny-engine-meta-register": "workspace:^",
"@opentiny/tiny-engine-runtime-renderer": "workspace:*",
"@opentiny/tiny-engine-utils": "workspace:*",
"@opentiny/vue": "~3.20.0",
"@opentiny/vue-design-smb": "~3.20.0",
Expand Down
18 changes: 18 additions & 0 deletions designer-demo/public/opentiny-tinyengine-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions designer-demo/runtime.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/opentiny-tinyengine-logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Runtime Render</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/runtime.js"></script>
</body>
</html>
24 changes: 24 additions & 0 deletions designer-demo/src/runtime.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Copyright (c) 2023 - present TinyEngine Authors.
* Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
import { initRuntimeRenderer } from '@opentiny/tiny-engine-runtime-renderer'

async function startApp() {
try {
await initRuntimeRenderer()
}
catch (error) {
//eslint-disable-next-line no-console
console.error('Failed to initialize runtime renderer:',error)
}
}

startApp()
3 changes: 2 additions & 1 deletion packages/build/vite-config/src/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ const getDefaultConfig = (engineConfig) => {
plugins: [nodePolyfill({ include: null })], // 使用@rollup/plugin-inject的默认值{include: null}, 即在所有代码中生效
input: {
index: path.resolve(process.cwd(), './index.html'),
preview: path.resolve(process.cwd(), './preview.html')
preview: path.resolve(process.cwd(), './preview.html'),
runtime: path.resolve(process.cwd(), './runtime.html')
},
output: {
manualChunks: (id) => {
Expand Down
2 changes: 2 additions & 0 deletions packages/build/vite-config/src/vite-plugins/devAliasPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ const getDevAlias = (useSourceAlias) => {
'@opentiny/tiny-engine-toolbar-logo': path.resolve(basePath, 'packages/toolbars/logo/index.ts'),
'@opentiny/tiny-engine-toolbar-media': path.resolve(basePath, 'packages/toolbars/media/index.ts'),
'@opentiny/tiny-engine-toolbar-preview': path.resolve(basePath, 'packages/toolbars/preview/index.ts'),
'@opentiny/tiny-engine-runtime-renderer': path.resolve(basePath, 'packages/runtime-renderer/index.ts'),
'@opentiny/tiny-engine-toolbar-generate-code': path.resolve(basePath, 'packages/toolbars/generate-code/index.ts'),
'@opentiny/tiny-engine-toolbar-refresh': path.resolve(basePath, 'packages/toolbars/refresh/index.ts'),
'@opentiny/tiny-engine-toolbar-redoundo': path.resolve(basePath, 'packages/toolbars/redoundo/index.ts'),
'@opentiny/tiny-engine-toolbar-clean': path.resolve(basePath, 'packages/toolbars/clean/index.ts'),
'@opentiny/tiny-engine-toolbar-theme-switch': path.resolve(basePath, 'packages/toolbars/themeSwitch/index.ts'),
'@opentiny/tiny-engine-toolbar-runtime-deploy': path.resolve(basePath, 'packages/toolbars/runtime-deploy/index.ts'),
'@opentiny/tiny-engine-toolbar-save': path.resolve(basePath, 'packages/toolbars/save/index.ts'),
'@opentiny/tiny-engine-toolbar-setting': path.resolve(basePath, 'packages/toolbars/setting/index.ts'),
'@opentiny/tiny-engine-toolbar-collaboration': path.resolve(basePath, 'packages/toolbars/collaboration/index.ts'),
Expand Down
85 changes: 85 additions & 0 deletions packages/common/js/runtime-deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/**
* Copyright (c) 2023 - present TinyEngine Authors.
* Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/

import { getMergeMeta, useNotify, usePage } from '@opentiny/tiny-engine-meta-register'
import { isDevelopEnv } from './environments'

let runtimeWindow = null

const getRuntimeLocation = async () => {
const paramsMap = new URLSearchParams(location.search)
const tenant = paramsMap.get('tenant') || ''
const platform = getMergeMeta('engine.config')?.platformId
const appId = paramsMap.get('id')
const queryPageId = paramsMap.get('pageId') || paramsMap.get('pageid') || ''

const { pageSettingState, getAncestors } = usePage()

const activePageId = queryPageId
let routeSegment = ''
if (activePageId) {
const chain = ((await getAncestors(String(activePageId), true)) || [])
.concat(String(activePageId))
.map((id) => String(id))
routeSegment = chain
.map((id) => pageSettingState.treeDataMapping[id]?.route || '')
.filter(Boolean)
.map((segment) => segment.replace(/^\/+|\/+$/g, ''))
.join('/')
}

const params = new URLSearchParams()
if (appId) params.set('id', appId)
if (tenant) params.set('tenant', tenant)
if (platform) params.set('platform', platform)

return {
query: params.toString(),
hash: routeSegment ? `#/${routeSegment}` : ''
}
}

export const deployPage = async () => {
const href = window.location.href.split('?')[0] || './'
const { query, hash } = await getRuntimeLocation()

const customDeployUrl = getMergeMeta('engine.toolbars.runtimeDeploy')?.options?.deployUrl
const defaultDeployUrl = isDevelopEnv ? `./runtime.html` : `${href.endsWith('/') ? href : `${href}/`}runtime`
const querySuffix = query ? `?${query}` : ''

const appendHash = (url) => {
if (!hash) return url
return url.includes('#') ? url : `${url}${hash}`
}

const buildUrl = (base) => appendHash(`${base}${querySuffix}`)

let openUrl = ''
openUrl = customDeployUrl
? typeof customDeployUrl === 'function'
? appendHash(String(customDeployUrl(defaultDeployUrl, query, hash) || defaultDeployUrl))
: buildUrl(customDeployUrl)
: buildUrl(defaultDeployUrl)
return { openUrl }
}
export const runtimeDeploy = async () => {
const { openUrl } = await deployPage()

runtimeWindow = window.open(openUrl, 'tiny-engine-runtime')
if (!runtimeWindow) {
useNotify({
type: 'error',
title: '运行时窗口打开失败',
message: '请检查浏览器是否允许新窗口打开'
})
}
}
2 changes: 2 additions & 0 deletions packages/design-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,14 @@
"@opentiny/tiny-engine-toolbar-logo": "workspace:*",
"@opentiny/tiny-engine-toolbar-media": "workspace:*",
"@opentiny/tiny-engine-toolbar-preview": "workspace:*",
"@opentiny/tiny-engine-toolbar-runtime-deploy": "workspace:*",
"@opentiny/tiny-engine-toolbar-redoundo": "workspace:*",
"@opentiny/tiny-engine-toolbar-refresh": "workspace:*",
"@opentiny/tiny-engine-toolbar-save": "workspace:*",
"@opentiny/tiny-engine-toolbar-setting": "workspace:*",
"@opentiny/tiny-engine-toolbar-theme-switch": "workspace:*",
"@opentiny/tiny-engine-toolbar-view-setting": "workspace:*",
"@opentiny/tiny-engine-runtime-renderer": "workspace:*",
"@opentiny/tiny-engine-utils": "workspace:*",
"@opentiny/tiny-engine-vite-plugin-meta-comments": "workspace:*",
"@vue/babel-plugin-jsx": "^1.2.5",
Expand Down
1 change: 1 addition & 0 deletions packages/design-core/re-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export { default as Save } from '@opentiny/tiny-engine-toolbar-save'
export { default as Clean } from '@opentiny/tiny-engine-toolbar-clean'
export { default as ThemeSwitch, ThemeSwitchService } from '@opentiny/tiny-engine-toolbar-theme-switch'
export { default as Preview } from '@opentiny/tiny-engine-toolbar-preview'
export { default as RuntimeDeploy } from '@opentiny/tiny-engine-toolbar-runtime-deploy'
export { default as GenerateCode, SaveLocalService } from '@opentiny/tiny-engine-toolbar-generate-code'
export { default as Refresh } from '@opentiny/tiny-engine-toolbar-refresh'
export { default as Collaboration } from '@opentiny/tiny-engine-toolbar-collaboration'
Expand Down
2 changes: 2 additions & 0 deletions packages/design-core/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
Clean,
ThemeSwitch,
Preview,
RuntimeDeploy,
GenerateCode,
Refresh,
Collaboration,
Expand Down Expand Up @@ -140,6 +141,7 @@ export default {
__TINY_ENGINE_REMOVED_REGISTRY['engine.toolbars.collaboration'] === false ? null : Collaboration,
__TINY_ENGINE_REMOVED_REGISTRY['engine.toolbars.clean'] === false ? null : Clean,
__TINY_ENGINE_REMOVED_REGISTRY['engine.toolbars.preview'] === false ? null : Preview,
__TINY_ENGINE_REMOVED_REGISTRY['engine.toolbars.runtime-deploy'] === false ? null : RuntimeDeploy,
__TINY_ENGINE_REMOVED_REGISTRY['engine.toolbars.refresh'] === false ? null : Refresh,
__TINY_ENGINE_REMOVED_REGISTRY['engine.toolbars.generate-code'] === false ? null : GenerateCode,
__TINY_ENGINE_REMOVED_REGISTRY['engine.toolbars.save'] === false ? null : Save,
Expand Down
1 change: 1 addition & 0 deletions packages/layout/src/defaultLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default {
right: [
[META_APP.ThemeSwitch, META_APP.RedoUndo, META_APP.Clean],
[META_APP.Preview],
[META_APP.RuntimeDeploy],
[META_APP.GenerateCode, META_APP.Save]
],
collapse: [
Expand Down
1 change: 1 addition & 0 deletions packages/register/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const META_APP = {
Save: 'engine.toolbars.save',
GenerateCode: 'engine.toolbars.generate-code',
Preview: 'engine.toolbars.preview',
RuntimeDeploy: 'engine.toolbars.runtime-deploy',
RedoUndo: 'engine.toolbars.redoundo',
Fullscreen: 'engine.toolbars.fullscreen',
Lock: 'engine.toolbars.lock',
Expand Down
55 changes: 55 additions & 0 deletions packages/runtime-renderer/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* Copyright (c) 2023 - present TinyEngine Authors.
* Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/

import { createApp } from 'vue'
import { useAppSchema } from './src/composables/useAppSchema'
import { createAppRouter } from './src/router'
import { createPinia } from 'pinia'
import { createStores, generateStoresConfig } from './src/stores'
import App from './src/App.vue'
import i18n from '@opentiny/tiny-engine-i18n-host'

// 初始化运行时渲染器
export const initRuntimeRenderer = async () => {
const searchParams = new URLSearchParams(location.search)
const appId = searchParams.get('id')

if (!appId) {
throw new Error('Missing required "id" query parameter')
}

const { fetchAppSchema, fetchBlocks } = useAppSchema()
await fetchAppSchema(appId)
await fetchBlocks()
const router = await createAppRouter()

const pinia = createPinia()
const storesConfig = generateStoresConfig()
const stores = createStores(storesConfig, pinia)

const app = createApp(App)
app.provide('stores', stores)

// 全局错误处理(防止 scheduler 被打断)
app.config.errorHandler = (err, instance, info) => {
// eslint-disable-next-line no-console
console.error('[GlobalErrorHandler]', err, info)
if ((err as any)?.stack) {
// eslint-disable-next-line no-console
console.error('[GlobalErrorHandler stack]', (err as any).stack)
}
}

app.use(pinia).use(router).use(i18n).mount('#app')

return app
}
42 changes: 42 additions & 0 deletions packages/runtime-renderer/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "@opentiny/tiny-engine-runtime-renderer",
"version": "1.0.0",
"description": "TinyEngine Runtime Renderer Package",
"type": "module",
"main": "dist/index.js",
"module": "dist/index.js",
"files": [
"dist"
],
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"@opentiny/tiny-engine-builtin-component": "workspace:*",
"@opentiny/tiny-engine-i18n-host": "workspace:*",
"@vue/babel-plugin-jsx": "^1.2.5",
"@babel/core": "^7.18.13",
"@vue/shared": "^3.3.4",
"axios": "^1.10.0",
"axios-mock-adapter": "^1.19.0",
"pinia": "^2.1.0",
"vue-router": "^4.2.0",
"postcss": "^8.4.31",
"postcss-selector-parser": "^7.0.0"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.1.2",
"typescript": "^5.4.2",
"vite": "^5.4.2"
},
"peerDependencies": {
"@opentiny/vue": "^3.20.0",
"@opentiny/vue-icon": "^3.20.0",
"@opentiny/vue-locale": "~3.20.0",
"@opentiny/vue-theme": "~3.20.0",
"vue": "^3.4.15",
"vue-i18n": "^9.9.0"
}
}
3 changes: 3 additions & 0 deletions packages/runtime-renderer/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<router-view :key="$route.fullPath" />
</template>
Loading