@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.
- package/generated/index.js +1 -1
- package/package.json +1 -1
- package/src/runtime.js +4 -2
- package/src/vite-plugin.js +12 -6
package/generated/index.js
CHANGED
|
@@ -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.
|
|
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
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
|
-
|
|
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.
|
|
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; }
|
package/src/vite-plugin.js
CHANGED
|
@@ -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
|
-
//
|
|
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)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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) => {
|