@uniweb/core 0.5.0 → 0.5.1
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 +1 -1
- package/src/uniweb.js +12 -14
package/package.json
CHANGED
package/src/uniweb.js
CHANGED
|
@@ -62,9 +62,9 @@ export default class Uniweb {
|
|
|
62
62
|
setFoundation(foundation) {
|
|
63
63
|
this.foundation = foundation
|
|
64
64
|
|
|
65
|
-
// Store per-component metadata if present
|
|
66
|
-
if (foundation.meta) {
|
|
67
|
-
this.meta = foundation.meta
|
|
65
|
+
// Store per-component metadata if present (lives under default export)
|
|
66
|
+
if (foundation.default?.meta) {
|
|
67
|
+
this.meta = foundation.default.meta
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
@@ -73,7 +73,7 @@ export default class Uniweb {
|
|
|
73
73
|
* @param {Object} foundation - The loaded ESM extension module
|
|
74
74
|
*/
|
|
75
75
|
registerExtension(foundation) {
|
|
76
|
-
const meta = foundation.meta || {}
|
|
76
|
+
const meta = foundation.default?.meta || {}
|
|
77
77
|
this.extensions.push({ foundation, meta })
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -114,13 +114,13 @@ export default class Uniweb {
|
|
|
114
114
|
return undefined
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
// Primary foundation first
|
|
118
|
-
const primary = this.foundation
|
|
117
|
+
// Primary foundation first (components are named exports)
|
|
118
|
+
const primary = this.foundation[name]
|
|
119
119
|
if (primary) return primary
|
|
120
120
|
|
|
121
121
|
// Fall through to extensions (declared order)
|
|
122
122
|
for (const ext of this.extensions) {
|
|
123
|
-
const component = ext.foundation
|
|
123
|
+
const component = ext.foundation[name]
|
|
124
124
|
if (component) return component
|
|
125
125
|
}
|
|
126
126
|
|
|
@@ -134,17 +134,15 @@ export default class Uniweb {
|
|
|
134
134
|
listComponents() {
|
|
135
135
|
const names = new Set()
|
|
136
136
|
|
|
137
|
-
if (this.foundation
|
|
138
|
-
for (const name of Object.keys(this.foundation
|
|
139
|
-
names.add(name)
|
|
137
|
+
if (this.foundation) {
|
|
138
|
+
for (const name of Object.keys(this.foundation)) {
|
|
139
|
+
if (name !== 'default') names.add(name)
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
for (const ext of this.extensions) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
names.add(name)
|
|
147
|
-
}
|
|
144
|
+
for (const name of Object.keys(ext.foundation)) {
|
|
145
|
+
if (name !== 'default') names.add(name)
|
|
148
146
|
}
|
|
149
147
|
}
|
|
150
148
|
|