import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import "react";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_client__ from "@tachybase/client";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
const mySchemaSetting = new __WEBPACK_EXTERNAL_MODULE__tachybase_client__.SchemaSettings({
    name: 'MySchemaSetting',
    items: [
        {
            name: 'demo1',
            type: 'item',
            componentProps: {
                title: 'DEMO'
            }
        }
    ]
});
const DemoDesigner = ()=>{
    const filedSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
    const { exists, render } = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_client__.useSchemaSettingsRender)(filedSchema['x-settings'], filedSchema['x-settings-props']);
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
        style: {
            border: '1px solid red',
            padding: 50
        },
        children: exists && render()
    });
};
const Page = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.observer)((props)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
        children: [
            props.children,
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(DemoDesigner, {})
        ]
    }), {
    displayName: 'Page'
});
const Root = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_client__.SchemaComponentProvider, {
        designable: true,
        children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_client__.SchemaComponent, {
            components: {
                Page
            },
            schema: {
                type: 'void',
                name: 'page',
                'x-component': 'Page',
                'x-setting': 'MySchemaSetting'
            }
        })
    });
class MyPlugin extends __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Plugin {
    async load() {
        this.app.schemaSettingsManager.add(mySchemaSetting);
    }
}
const app = new __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Application({
    plugins: [
        MyPlugin
    ],
    providers: [
        Root
    ]
});
const schema_basic_rslib_entry_ = app.getRootComponent();
export { schema_basic_rslib_entry_ as default };
