@kbach/core-engine 1.0.0-beta.1 → 1.0.0-beta.10

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
@@ -7,12 +7,19 @@ The Rust/WASM utility-resolution engine that powers
7
7
  > web package — this build is the browser/Node WASM target). If you're
8
8
  > building a React web app, install `@kbach/react` instead — it re-exports
9
9
  > everything you need and pulls this package in automatically.
10
- > `@kbach/react-native` does NOT depend on this package directly: on
11
- > Android the same Rust source (`src/jni_bridge.rs`) is instead
12
- > cross-compiled ahead of time to a native `.so` (JNI, not WASM) and shipped
13
- > prebuilt inside `@kbach/react-native`'s own `android/` folder — see
14
- > `scripts/build-android.mjs` in this package for how that binary gets
15
- > (re)generated.
10
+ > `@kbach/react-native` does NOT depend on this package directly, on
11
+ > either of the two platforms it supports: on Android the same Rust source
12
+ > (`src/jni_bridge.rs`) is instead cross-compiled ahead of time to a native
13
+ > `.so` (JNI, not WASM) and shipped prebuilt inside `@kbach/react-native`'s
14
+ > own `android/` folder — see `scripts/build-android.mjs` in this package
15
+ > for how that binary gets (re)generated. On Expo Web / react-native-web,
16
+ > `@kbach/react-native` vendors a trimmed copy of this package's own
17
+ > web-target WASM glue directly into its own source (generated via
18
+ > `scripts/generate-web-glue.mjs` and `scripts/generate-wasm-base64.mjs`)
19
+ > rather than importing this package at runtime — see that script's own
20
+ > doc comment for why (short version: this package's unused async `init()`
21
+ > export references `import.meta.url`, which breaks under some bundler
22
+ > targets even when never called).
16
23
 
17
24
  ## What this is
18
25
 
package/dist/README.md CHANGED
@@ -7,12 +7,19 @@ The Rust/WASM utility-resolution engine that powers
7
7
  > web package — this build is the browser/Node WASM target). If you're
8
8
  > building a React web app, install `@kbach/react` instead — it re-exports
9
9
  > everything you need and pulls this package in automatically.
10
- > `@kbach/react-native` does NOT depend on this package directly: on
11
- > Android the same Rust source (`src/jni_bridge.rs`) is instead
12
- > cross-compiled ahead of time to a native `.so` (JNI, not WASM) and shipped
13
- > prebuilt inside `@kbach/react-native`'s own `android/` folder — see
14
- > `scripts/build-android.mjs` in this package for how that binary gets
15
- > (re)generated.
10
+ > `@kbach/react-native` does NOT depend on this package directly, on
11
+ > either of the two platforms it supports: on Android the same Rust source
12
+ > (`src/jni_bridge.rs`) is instead cross-compiled ahead of time to a native
13
+ > `.so` (JNI, not WASM) and shipped prebuilt inside `@kbach/react-native`'s
14
+ > own `android/` folder — see `scripts/build-android.mjs` in this package
15
+ > for how that binary gets (re)generated. On Expo Web / react-native-web,
16
+ > `@kbach/react-native` vendors a trimmed copy of this package's own
17
+ > web-target WASM glue directly into its own source (generated via
18
+ > `scripts/generate-web-glue.mjs` and `scripts/generate-wasm-base64.mjs`)
19
+ > rather than importing this package at runtime — see that script's own
20
+ > doc comment for why (short version: this package's unused async `init()`
21
+ > export references `import.meta.url`, which breaks under some bundler
22
+ > targets even when never called).
16
23
 
17
24
  ## What this is
18
25
 
@@ -14,6 +14,8 @@ export function default_colors_json(): string;
14
14
 
15
15
  export function generate_css(class_string: string, theme_json: string): string;
16
16
 
17
+ export function generate_css_attr(class_string: string, theme_json: string): string;
18
+
17
19
  /**
18
20
  * WASM counterpart to the Android JNI bridge's `resolveStyle` — resolves
19
21
  * `class_string` to a flat, RN-`StyleSheet`-shaped JSON style object
@@ -35,6 +37,7 @@ export interface InitOutput {
35
37
  readonly memory: WebAssembly.Memory;
36
38
  readonly default_colors_json: () => [number, number];
37
39
  readonly generate_css: (a: number, b: number, c: number, d: number) => [number, number];
40
+ readonly generate_css_attr: (a: number, b: number, c: number, d: number) => [number, number];
38
41
  readonly resolve_style_json: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
39
42
  readonly __wbindgen_externrefs: WebAssembly.Table;
40
43
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
@@ -45,6 +45,28 @@ export function generate_css(class_string, theme_json) {
45
45
  }
46
46
  }
47
47
 
48
+ /**
49
+ * @param {string} class_string
50
+ * @param {string} theme_json
51
+ * @returns {string}
52
+ */
53
+ export function generate_css_attr(class_string, theme_json) {
54
+ let deferred3_0;
55
+ let deferred3_1;
56
+ try {
57
+ const ptr0 = passStringToWasm0(class_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
58
+ const len0 = WASM_VECTOR_LEN;
59
+ const ptr1 = passStringToWasm0(theme_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
60
+ const len1 = WASM_VECTOR_LEN;
61
+ const ret = wasm.generate_css_attr(ptr0, len0, ptr1, len1);
62
+ deferred3_0 = ret[0];
63
+ deferred3_1 = ret[1];
64
+ return getStringFromWasm0(ret[0], ret[1]);
65
+ } finally {
66
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
67
+ }
68
+ }
69
+
48
70
  /**
49
71
  * WASM counterpart to the Android JNI bridge's `resolveStyle` — resolves
50
72
  * `class_string` to a flat, RN-`StyleSheet`-shaped JSON style object
Binary file
@@ -3,6 +3,7 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const default_colors_json: () => [number, number];
5
5
  export const generate_css: (a: number, b: number, c: number, d: number) => [number, number];
6
+ export const generate_css_attr: (a: number, b: number, c: number, d: number) => [number, number];
6
7
  export const resolve_style_json: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
7
8
  export const __wbindgen_externrefs: WebAssembly.Table;
8
9
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
@@ -7,12 +7,19 @@ The Rust/WASM utility-resolution engine that powers
7
7
  > web package — this build is the browser/Node WASM target). If you're
8
8
  > building a React web app, install `@kbach/react` instead — it re-exports
9
9
  > everything you need and pulls this package in automatically.
10
- > `@kbach/react-native` does NOT depend on this package directly: on
11
- > Android the same Rust source (`src/jni_bridge.rs`) is instead
12
- > cross-compiled ahead of time to a native `.so` (JNI, not WASM) and shipped
13
- > prebuilt inside `@kbach/react-native`'s own `android/` folder — see
14
- > `scripts/build-android.mjs` in this package for how that binary gets
15
- > (re)generated.
10
+ > `@kbach/react-native` does NOT depend on this package directly, on
11
+ > either of the two platforms it supports: on Android the same Rust source
12
+ > (`src/jni_bridge.rs`) is instead cross-compiled ahead of time to a native
13
+ > `.so` (JNI, not WASM) and shipped prebuilt inside `@kbach/react-native`'s
14
+ > own `android/` folder — see `scripts/build-android.mjs` in this package
15
+ > for how that binary gets (re)generated. On Expo Web / react-native-web,
16
+ > `@kbach/react-native` vendors a trimmed copy of this package's own
17
+ > web-target WASM glue directly into its own source (generated via
18
+ > `scripts/generate-web-glue.mjs` and `scripts/generate-wasm-base64.mjs`)
19
+ > rather than importing this package at runtime — see that script's own
20
+ > doc comment for why (short version: this package's unused async `init()`
21
+ > export references `import.meta.url`, which breaks under some bundler
22
+ > targets even when never called).
16
23
 
17
24
  ## What this is
18
25
 
@@ -14,6 +14,8 @@ export function default_colors_json(): string;
14
14
 
15
15
  export function generate_css(class_string: string, theme_json: string): string;
16
16
 
17
+ export function generate_css_attr(class_string: string, theme_json: string): string;
18
+
17
19
  /**
18
20
  * WASM counterpart to the Android JNI bridge's `resolveStyle` — resolves
19
21
  * `class_string` to a flat, RN-`StyleSheet`-shaped JSON style object
@@ -47,6 +47,29 @@ function generate_css(class_string, theme_json) {
47
47
  }
48
48
  exports.generate_css = generate_css;
49
49
 
50
+ /**
51
+ * @param {string} class_string
52
+ * @param {string} theme_json
53
+ * @returns {string}
54
+ */
55
+ function generate_css_attr(class_string, theme_json) {
56
+ let deferred3_0;
57
+ let deferred3_1;
58
+ try {
59
+ const ptr0 = passStringToWasm0(class_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
60
+ const len0 = WASM_VECTOR_LEN;
61
+ const ptr1 = passStringToWasm0(theme_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
62
+ const len1 = WASM_VECTOR_LEN;
63
+ const ret = wasm.generate_css_attr(ptr0, len0, ptr1, len1);
64
+ deferred3_0 = ret[0];
65
+ deferred3_1 = ret[1];
66
+ return getStringFromWasm0(ret[0], ret[1]);
67
+ } finally {
68
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
69
+ }
70
+ }
71
+ exports.generate_css_attr = generate_css_attr;
72
+
50
73
  /**
51
74
  * WASM counterpart to the Android JNI bridge's `resolveStyle` — resolves
52
75
  * `class_string` to a flat, RN-`StyleSheet`-shaped JSON style object
Binary file
@@ -3,6 +3,7 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const default_colors_json: () => [number, number];
5
5
  export const generate_css: (a: number, b: number, c: number, d: number) => [number, number];
6
+ export const generate_css_attr: (a: number, b: number, c: number, d: number) => [number, number];
6
7
  export const resolve_style_json: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
7
8
  export const __wbindgen_externrefs: WebAssembly.Table;
8
9
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
package/package.json CHANGED
@@ -1,8 +1,15 @@
1
1
  {
2
2
  "name": "@kbach/core-engine",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.10",
4
4
  "description": "Rust/WASM utility-class resolution engine powering @kbach/react and @kbach/react-native.",
5
- "keywords": ["css", "wasm", "rust", "tailwind", "utility-first", "styling"],
5
+ "keywords": [
6
+ "css",
7
+ "wasm",
8
+ "rust",
9
+ "tailwind",
10
+ "utility-first",
11
+ "styling"
12
+ ],
6
13
  "license": "MIT",
7
14
  "author": "semsakadanupol",
8
15
  "repository": {
@@ -30,12 +37,16 @@
30
37
  "default": "./dist-node/kbach_core_engine.js"
31
38
  }
32
39
  },
33
- "files": ["dist", "dist-node"],
40
+ "files": [
41
+ "dist",
42
+ "dist-node"
43
+ ],
34
44
  "scripts": {
35
- "build": "wasm-pack build --target web --out-dir dist && wasm-pack build --target nodejs --out-dir dist-node && node -e \"require('fs').rmSync('dist/.gitignore',{force:true});require('fs').rmSync('dist-node/.gitignore',{force:true})\"",
45
+ "build": "wasm-pack build --target web --out-dir dist && wasm-pack build --target nodejs --out-dir dist-node && node -e \"require('fs').rmSync('dist/.gitignore',{force:true});require('fs').rmSync('dist-node/.gitignore',{force:true})\" && node scripts/build-android-if-available.mjs",
36
46
  "build:android": "node scripts/build-android.mjs",
37
47
  "test": "cargo test",
38
- "lint": "cargo check",
48
+ "test:coverage": "cargo llvm-cov --all-features --html --output-dir coverage",
49
+ "lint": "cargo check && cargo clippy --all-targets --all-features -- -D warnings",
39
50
  "clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true});require('fs').rmSync('dist-node',{recursive:true,force:true});require('fs').rmSync('target',{recursive:true,force:true})\""
40
51
  }
41
52
  }