@wippy-fe/webcomponent-core 0.0.21 → 0.0.23

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/css-loader.ts +19 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wippy-fe/webcomponent-core",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "description": "Framework-agnostic base class for Wippy web components — shadow DOM, CSS loading, schema-driven prop parsing, and lifecycle management.",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -11,7 +11,7 @@
11
11
  ],
12
12
  "peerDependencies": {
13
13
  "@iconify/vue": "^5.0.0",
14
- "@wippy-fe/proxy": "0.0.21"
14
+ "@wippy-fe/proxy": "0.0.23"
15
15
  },
16
16
  "license": "UNLICENSED"
17
17
  }
package/src/css-loader.ts CHANGED
@@ -14,17 +14,31 @@ const DEFAULT_HOST_CSS_KEYS: HostCssKey[] = [
14
14
  */
15
15
  export function loadHostCss(shadow: ShadowRoot, keys?: HostCssKey[]): Promise<void> {
16
16
  const cssKeys = keys ?? DEFAULT_HOST_CSS_KEYS
17
- return Promise.all(
18
- cssKeys.map(key => loadCss(hostCss[key])),
19
- ).then((cssChunks) => {
17
+ // Filter out keys whose URL is missing (e.g. removed CSS like fontCssUrl).
18
+ // Load each independently so one failure doesn't block the rest.
19
+ const jobs = cssKeys.map(async (key) => {
20
+ const url = hostCss[key]
21
+ if (!url) {
22
+ console.warn(`[wippy-fe/webcomponent-core] hostCss key "${key}" is undefined — skipping. Remove it from hostCssKeys if the CSS was removed.`)
23
+ return null
24
+ }
25
+ try {
26
+ return await loadCss(url)
27
+ }
28
+ catch (err) {
29
+ console.warn(`[wippy-fe/webcomponent-core] Failed to load hostCss "${key}" (${url}):`, err)
30
+ return null
31
+ }
32
+ })
33
+ return Promise.all(jobs).then((cssChunks) => {
20
34
  for (const css of cssChunks) {
35
+ if (!css)
36
+ continue
21
37
  const style = document.createElement('style')
22
38
  style.textContent = css
23
39
  style.setAttribute('role', '@wippy-fe/host-css')
24
40
  shadow.appendChild(style)
25
41
  }
26
- }).catch((err) => {
27
- console.warn('Failed to load host CSS:', err)
28
42
  })
29
43
  }
30
44