@uniweb/runtime 0.2.8 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/runtime",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "description": "Minimal runtime for loading Uniweb foundations",
5
5
  "type": "module",
6
6
  "exports": {
@@ -29,7 +29,7 @@
29
29
  "node": ">=20.19"
30
30
  },
31
31
  "dependencies": {
32
- "@uniweb/core": "0.1.7"
32
+ "@uniweb/core": "0.1.8"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "react": "^18.0.0 || ^19.0.0",
@@ -12,10 +12,10 @@
12
12
  * - right: Right sidebar/panel (from @right page)
13
13
  *
14
14
  * Custom Layouts:
15
- * Foundations can provide a custom Layout via src/runtime.js:
15
+ * Foundations can provide a custom Layout via src/exports.js:
16
16
  *
17
17
  * ```jsx
18
- * // src/runtime.js
18
+ * // src/exports.js
19
19
  * import Layout from './components/Layout'
20
20
  *
21
21
  * export default {
package/src/index.jsx CHANGED
@@ -107,10 +107,10 @@ async function loadFoundation(source) {
107
107
  import(/* @vite-ignore */ url)
108
108
  ])
109
109
 
110
- console.log(
111
- '[Runtime] Foundation loaded. Available components:',
112
- typeof foundation.listComponents === 'function' ? foundation.listComponents() : 'unknown'
113
- )
110
+ const componentNames = foundation.components
111
+ ? Object.keys(foundation.components)
112
+ : 'unknown'
113
+ console.log('[Runtime] Foundation loaded. Available components:', componentNames)
114
114
 
115
115
  return foundation
116
116
  } catch (error) {
@@ -212,10 +212,9 @@ async function initRuntime(foundationSource, options = {}) {
212
212
  const remoteModule = await foundationSource
213
213
  // Handle double default wrapping
214
214
  const innerModule = remoteModule?.default?.default ? remoteModule.default : remoteModule
215
- // Convert to foundation interface
215
+ // Convert to foundation interface with components object
216
216
  foundation = {
217
- getComponent: (name) => innerModule.default?.[name],
218
- listComponents: () => Object.keys(innerModule.default || {}),
217
+ components: innerModule.default || {},
219
218
  ...innerModule
220
219
  }
221
220
  } else if (foundationSource && typeof foundationSource === 'object') {
@@ -230,9 +229,9 @@ async function initRuntime(foundationSource, options = {}) {
230
229
  // Set the foundation on the runtime
231
230
  uniwebInstance.setFoundation(foundation)
232
231
 
233
- // Set foundation config if provided (runtime is the new name, config/site are legacy)
234
- if (foundation.runtime || foundation.config || foundation.site) {
235
- uniwebInstance.setFoundationConfig(foundation.runtime || foundation.config || foundation.site)
232
+ // Set foundation capabilities (Layout, props, etc.) if provided
233
+ if (foundation.capabilities) {
234
+ uniwebInstance.setFoundationConfig(foundation.capabilities)
236
235
  }
237
236
 
238
237
  // Render the app