@wippy-fe/webcomponent-core 0.0.20 → 0.0.22

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/README.md CHANGED
@@ -46,7 +46,6 @@ Shared **platform CSS** loaded at runtime from the Wippy host into the shadow ro
46
46
 
47
47
  | Key | What it provides | When to include |
48
48
  |-----|-----------------|-----------------|
49
- | `fontCssUrl` | Platform font definitions | Almost always — skip only if using fully custom fonts |
50
49
  | `themeConfigUrl` | CSS custom properties (color scales, spacing, radii, etc.) matching the host theme | **Recommended for all components.** This is what makes your component look consistent with the host. At dev time, a local `theme-config.css` provides fallback values; at runtime the host injects the real theme. |
51
50
  | `primeVueCssUrl` | PrimeVue component classes (`p-button`, `p-input`, etc.) in unstyled mode, styled to match the host | **Include if using any PrimeVue components** (buttons, forms, tables, etc.). Skip only for fully custom UI with zero PrimeVue usage. |
52
51
  | `markdownCssUrl` | Styles for rendered markdown blocks | **Include only if rendering markdown.** |
@@ -56,19 +55,19 @@ Shared **platform CSS** loaded at runtime from the Wippy host into the shadow ro
56
55
 
57
56
  ```ts
58
57
  // Standard component using PrimeVue UI (most common)
59
- hostCssKeys: ['fontCssUrl', 'themeConfigUrl', 'primeVueCssUrl', 'iframeCssUrl']
58
+ hostCssKeys: ['themeConfigUrl', 'primeVueCssUrl', 'iframeCssUrl']
60
59
 
61
60
  // Also renders markdown content
62
- hostCssKeys: ['fontCssUrl', 'themeConfigUrl', 'primeVueCssUrl', 'markdownCssUrl', 'iframeCssUrl']
61
+ hostCssKeys: ['themeConfigUrl', 'primeVueCssUrl', 'markdownCssUrl', 'iframeCssUrl']
63
62
 
64
63
  // Minimal: just theme variables, no PrimeVue
65
- hostCssKeys: ['fontCssUrl', 'themeConfigUrl', 'iframeCssUrl']
64
+ hostCssKeys: ['themeConfigUrl', 'iframeCssUrl']
66
65
 
67
66
  // Fully self-styled, no host inheritance
68
67
  hostCssKeys: []
69
68
  ```
70
69
 
71
- Default (when omitted): all five keys.
70
+ Default (when omitted): all four keys.
72
71
 
73
72
  > **Note on dev-time duplication:** Your component's `styles.css` may import `theme-config.css` for local dev (so Tailwind/PostCSS can resolve theme variables). At runtime, the host provides the real theme via `themeConfigUrl`. This duplication is a known trade-off — the host's runtime values take precedence.
74
73
 
@@ -173,7 +172,7 @@ interface WippyPropDefinition {
173
172
  items?: { type: string }
174
173
  }
175
174
 
176
- type HostCssKey = 'fontCssUrl' | 'themeConfigUrl' | 'primeVueCssUrl' | 'markdownCssUrl' | 'iframeCssUrl'
175
+ type HostCssKey = 'themeConfigUrl' | 'primeVueCssUrl' | 'markdownCssUrl' | 'iframeCssUrl'
177
176
  ```
178
177
 
179
178
  ## Migration from monolithic pattern
@@ -191,7 +190,7 @@ class MyElement extends WippyElement {
191
190
  static get wippyConfig() {
192
191
  return {
193
192
  propsSchema: pkg.wippy.props,
194
- hostCssKeys: ['fontCssUrl', 'themeConfigUrl', 'primeVueCssUrl', 'iframeCssUrl'],
193
+ hostCssKeys: ['themeConfigUrl', 'primeVueCssUrl', 'iframeCssUrl'],
195
194
  containerClasses: ['h-full'],
196
195
  inlineCss: stylesText,
197
196
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wippy-fe/webcomponent-core",
3
- "version": "0.0.20",
3
+ "version": "0.0.22",
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",
@@ -10,8 +10,8 @@
10
10
  "package.json"
11
11
  ],
12
12
  "peerDependencies": {
13
- "@wippy-fe/proxy": "^0.0.20",
14
- "@iconify/vue": "^5.0.0"
13
+ "@iconify/vue": "^5.0.0",
14
+ "@wippy-fe/proxy": "0.0.22"
15
15
  },
16
16
  "license": "UNLICENSED"
17
- }
17
+ }
package/src/css-loader.ts CHANGED
@@ -2,7 +2,6 @@ import type { HostCssKey } from './types.ts'
2
2
  import { hostCss, loadCss } from '@wippy-fe/proxy'
3
3
 
4
4
  const DEFAULT_HOST_CSS_KEYS: HostCssKey[] = [
5
- 'fontCssUrl',
6
5
  'themeConfigUrl',
7
6
  'primeVueCssUrl',
8
7
  'markdownCssUrl',
@@ -15,17 +14,31 @@ const DEFAULT_HOST_CSS_KEYS: HostCssKey[] = [
15
14
  */
16
15
  export function loadHostCss(shadow: ShadowRoot, keys?: HostCssKey[]): Promise<void> {
17
16
  const cssKeys = keys ?? DEFAULT_HOST_CSS_KEYS
18
- return Promise.all(
19
- cssKeys.map(key => loadCss(hostCss[key])),
20
- ).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) => {
21
34
  for (const css of cssChunks) {
35
+ if (!css)
36
+ continue
22
37
  const style = document.createElement('style')
23
38
  style.textContent = css
24
39
  style.setAttribute('role', '@wippy-fe/host-css')
25
40
  shadow.appendChild(style)
26
41
  }
27
- }).catch((err) => {
28
- console.warn('Failed to load host CSS:', err)
29
42
  })
30
43
  }
31
44
 
package/src/types.ts CHANGED
@@ -31,7 +31,7 @@ export interface WippyPropsSchema {
31
31
  * Keys that map to CSS URLs exposed by `@wippy-fe/proxy`'s `hostCss` object.
32
32
  * Pass a subset to `hostCssKeys` in config to load only what you need.
33
33
  */
34
- export type HostCssKey = 'fontCssUrl' | 'themeConfigUrl' | 'primeVueCssUrl' | 'markdownCssUrl' | 'iframeCssUrl'
34
+ export type HostCssKey = 'themeConfigUrl' | 'primeVueCssUrl' | 'markdownCssUrl' | 'iframeCssUrl'
35
35
 
36
36
  /**
37
37
  * Configuration object returned by `static get wippyConfig()`.
@@ -57,7 +57,6 @@ export interface WippyElementConfig<Props = Record<string, unknown>> {
57
57
  * The host app provides these CSS assets at runtime via `@wippy-fe/proxy`.
58
58
  *
59
59
  * Available keys:
60
- * - `fontCssUrl` — Platform font definitions. Include unless using fully custom fonts.
61
60
  * - `themeConfigUrl` — CSS custom properties (color scales, spacing, etc.) matching the
62
61
  * host theme. **Recommended for all components** — gives your component the same look
63
62
  * as the host app. At dev time, a local copy (`theme-config.css`) provides fallback
@@ -71,7 +70,7 @@ export interface WippyElementConfig<Props = Record<string, unknown>> {
71
70
  * components** so scrollbars look identical to the host app.
72
71
  *
73
72
  * Pass `[]` to skip host CSS entirely (fully self-styled component).
74
- * Defaults to `['fontCssUrl', 'themeConfigUrl', 'primeVueCssUrl', 'markdownCssUrl', 'iframeCssUrl']`.
73
+ * Defaults to `['themeConfigUrl', 'primeVueCssUrl', 'markdownCssUrl', 'iframeCssUrl']`.
75
74
  */
76
75
  hostCssKeys?: HostCssKey[]
77
76
  /**