@colletdev/core 0.1.5 → 0.1.7

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.
@@ -23,7 +23,7 @@
23
23
  import { initWasm, loadSharedStyles, loadInlineSharedStyles, loadMotionStyles, loadInlineMotionStyles, injectTokensToHead, injectFoucPrevention, CxElement, CxFormElement } from '../src/runtime.js';
24
24
 
25
25
  // Package version — used for CDN fallback URL
26
- const PKG_VERSION = '0.1.4';
26
+ const PKG_VERSION = '0.1.6';
27
27
 
28
28
  // ─── Lazy WASM + CSS ───
29
29
  // WASM glue and CSS strings are NOT imported at module level.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colletdev/core",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Rust/WASM Custom Elements — 48 production-grade UI components",
5
5
  "type": "module",
6
6
  "main": "generated/index.js",
package/src/runtime.js CHANGED
@@ -785,9 +785,11 @@ export class CxFormElement extends CxElement {
785
785
  get value() { return this.getAttribute?.('value') ?? ''; }
786
786
  set value(v) { if (v == null) this.removeAttribute('value'); else this.setAttribute('value', String(v)); }
787
787
  get disabled() { return this.hasAttribute('disabled'); }
788
- set disabled(v) { if (v) this.setAttribute('disabled', ''); else this.removeAttribute('disabled'); }
788
+ // React 19 sets boolean DOM properties directly (element.disabled = "").
789
+ // Empty string "" is falsy — must check explicitly for false/null/undefined.
790
+ set disabled(v) { if (v === false || v == null) this.removeAttribute('disabled'); else this.setAttribute('disabled', ''); }
789
791
  get required() { return this.hasAttribute('required'); }
790
- set required(v) { if (v) this.setAttribute('required', ''); else this.removeAttribute('required'); }
792
+ set required(v) { if (v === false || v == null) this.removeAttribute('required'); else this.setAttribute('required', ''); }
791
793
  get validity() { return this.#internals?.validity ?? null; }
792
794
  get validationMessage() { return this.#internals?.validationMessage ?? ''; }
793
795
  get willValidate() { return this.#internals?.willValidate ?? false; }
@@ -17,7 +17,7 @@
17
17
  // preload: true, // Inject <link rel="preload"> for WASM
18
18
  // })
19
19
 
20
- import { existsSync, copyFileSync, mkdirSync, readFileSync } from 'fs';
20
+ import { existsSync, copyFileSync, mkdirSync, readFileSync, statSync } from 'fs';
21
21
  import { dirname, join, resolve } from 'path';
22
22
  import { fileURLToPath } from 'url';
23
23
  import { UTILITIES_CSS, TOKENS_SHADOW_CSS } from '../generated/styles.js';
@@ -72,13 +72,19 @@ export function colletPlugin(options = {}) {
72
72
  // 2. Copy WASM to public/ if missing
73
73
  // 3. Serve CSS assets for DSD <link> refs
74
74
  configureServer(server) {
75
- // Copy WASM to public/ if not already there (one-time, idempotent)
75
+ // Always copy WASM to public/ overwrites stale binaries from previous
76
+ // package versions. Without this, upgrading @colletdev/core leaves the old
77
+ // WASM in public/ and new components fail with "Unknown component" errors.
76
78
  const wasmSrc = join(PKG_ROOT, 'wasm', 'wasm_api_bg.wasm');
77
79
  const wasmDest = join(publicDir, 'wasm_api_bg.wasm');
78
- if (existsSync(wasmSrc) && !existsSync(wasmDest)) {
79
- mkdirSync(publicDir, { recursive: true });
80
- copyFileSync(wasmSrc, wasmDest);
81
- server.config.logger.info('[collet] Copied wasm_api_bg.wasm → public/');
80
+ if (existsSync(wasmSrc)) {
81
+ const srcSize = statSync(wasmSrc).size;
82
+ const destSize = existsSync(wasmDest) ? statSync(wasmDest).size : 0;
83
+ if (srcSize !== destSize) {
84
+ mkdirSync(publicDir, { recursive: true });
85
+ copyFileSync(wasmSrc, wasmDest);
86
+ server.config.logger.info('[collet] Updated wasm_api_bg.wasm in public/ (new version)');
87
+ }
82
88
  }
83
89
 
84
90
  server.middlewares.use((req, res, next) => {