@devup-ui/wasm 1.0.53 → 1.0.55

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/package.json CHANGED
@@ -17,7 +17,11 @@
17
17
  "react",
18
18
  "wasm"
19
19
  ],
20
- "version": "1.0.53",
20
+ "version": "1.0.55",
21
+ "scripts": {
22
+ "build": "wasm-pack build --target nodejs --out-dir ./pkg --out-name index && node script.js",
23
+ "test": "wasm-pack test --node"
24
+ },
21
25
  "publishConfig": {
22
26
  "access": "public"
23
27
  },
@@ -34,14 +38,10 @@
34
38
  "type": "module",
35
39
  "exports": {
36
40
  ".": {
41
+ "types": "./pkg/index.d.ts",
37
42
  "import": "./pkg/index.js",
38
- "require": "./pkg/index.js",
39
- "types": "./pkg/index.d.ts"
43
+ "require": "./pkg/index.js"
40
44
  }
41
45
  },
42
- "types": "./pkg/index.d.ts",
43
- "scripts": {
44
- "build": "wasm-pack build --target nodejs --out-dir ./pkg --out-name index && node script.js",
45
- "test": "wasm-pack test --node"
46
- }
47
- }
46
+ "types": "./pkg/index.d.ts"
47
+ }
package/pkg/index.d.ts CHANGED
@@ -30,8 +30,12 @@ export function getCss(file_num: number | null | undefined, import_main_css: boo
30
30
 
31
31
  export function getDefaultTheme(): string | undefined;
32
32
 
33
+ export function getPrefix(): string | undefined;
34
+
33
35
  export function getThemeInterface(package_name: string, color_interface_name: string, typography_interface_name: string, theme_interface_name: string): string;
34
36
 
37
+ export function hasDevupUI(filename: string, code: string, _package: string): boolean;
38
+
35
39
  export function importClassMap(sheet_object: any): void;
36
40
 
37
41
  export function importFileMap(sheet_object: any): void;
@@ -43,3 +47,47 @@ export function isDebug(): boolean;
43
47
  export function registerTheme(theme_object: any): void;
44
48
 
45
49
  export function setDebug(debug: boolean): void;
50
+
51
+ /**
52
+ * Set the CSS class name prefix
53
+ *
54
+ * # Example (Vite Config)
55
+ * ```javascript
56
+ * import init, { setPrefix, codeExtract } from 'devup-ui-wasm';
57
+ *
58
+ * export default {
59
+ * plugins: [
60
+ * {
61
+ * name: 'devup-ui',
62
+ * apply: 'pre',
63
+ * async configResolved() {
64
+ * await init();
65
+ * setPrefix('du-'); // Set prefix to 'du-'
66
+ * },
67
+ * // ... other plugin code
68
+ * }
69
+ * ]
70
+ * }
71
+ * ```
72
+ *
73
+ * # Example (Next.js Plugin)
74
+ * ```typescript
75
+ * import init, { setPrefix } from 'devup-ui-wasm';
76
+ *
77
+ * const withDevupUI = (nextConfig) => {
78
+ * return {
79
+ * ...nextConfig,
80
+ * webpack: (config, options) => {
81
+ * if (!options.isServer && !global.devupUIInitialized) {
82
+ * init().then(() => {
83
+ * setPrefix('du-');
84
+ * global.devupUIInitialized = true;
85
+ * });
86
+ * }
87
+ * return config;
88
+ * }
89
+ * };
90
+ * };
91
+ * ```
92
+ */
93
+ export function setPrefix(prefix?: string | null): void;
package/pkg/index.js CHANGED
@@ -400,6 +400,20 @@ function getDefaultTheme() {
400
400
  }
401
401
  exports.getDefaultTheme = getDefaultTheme;
402
402
 
403
+ /**
404
+ * @returns {string | undefined}
405
+ */
406
+ function getPrefix() {
407
+ const ret = wasm.getPrefix();
408
+ let v1;
409
+ if (ret[0] !== 0) {
410
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
411
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
412
+ }
413
+ return v1;
414
+ }
415
+ exports.getPrefix = getPrefix;
416
+
403
417
  /**
404
418
  * @param {string} package_name
405
419
  * @param {string} color_interface_name
@@ -429,6 +443,24 @@ function getThemeInterface(package_name, color_interface_name, typography_interf
429
443
  }
430
444
  exports.getThemeInterface = getThemeInterface;
431
445
 
446
+ /**
447
+ * @param {string} filename
448
+ * @param {string} code
449
+ * @param {string} _package
450
+ * @returns {boolean}
451
+ */
452
+ function hasDevupUI(filename, code, _package) {
453
+ const ptr0 = passStringToWasm0(filename, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
454
+ const len0 = WASM_VECTOR_LEN;
455
+ const ptr1 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
456
+ const len1 = WASM_VECTOR_LEN;
457
+ const ptr2 = passStringToWasm0(_package, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
458
+ const len2 = WASM_VECTOR_LEN;
459
+ const ret = wasm.hasDevupUI(ptr0, len0, ptr1, len1, ptr2, len2);
460
+ return ret !== 0;
461
+ }
462
+ exports.hasDevupUI = hasDevupUI;
463
+
432
464
  /**
433
465
  * @param {any} sheet_object
434
466
  */
@@ -490,6 +522,56 @@ function setDebug(debug) {
490
522
  }
491
523
  exports.setDebug = setDebug;
492
524
 
525
+ /**
526
+ * Set the CSS class name prefix
527
+ *
528
+ * # Example (Vite Config)
529
+ * ```javascript
530
+ * import init, { setPrefix, codeExtract } from 'devup-ui-wasm';
531
+ *
532
+ * export default {
533
+ * plugins: [
534
+ * {
535
+ * name: 'devup-ui',
536
+ * apply: 'pre',
537
+ * async configResolved() {
538
+ * await init();
539
+ * setPrefix('du-'); // Set prefix to 'du-'
540
+ * },
541
+ * // ... other plugin code
542
+ * }
543
+ * ]
544
+ * }
545
+ * ```
546
+ *
547
+ * # Example (Next.js Plugin)
548
+ * ```typescript
549
+ * import init, { setPrefix } from 'devup-ui-wasm';
550
+ *
551
+ * const withDevupUI = (nextConfig) => {
552
+ * return {
553
+ * ...nextConfig,
554
+ * webpack: (config, options) => {
555
+ * if (!options.isServer && !global.devupUIInitialized) {
556
+ * init().then(() => {
557
+ * setPrefix('du-');
558
+ * global.devupUIInitialized = true;
559
+ * });
560
+ * }
561
+ * return config;
562
+ * }
563
+ * };
564
+ * };
565
+ * ```
566
+ * @param {string | null} [prefix]
567
+ */
568
+ function setPrefix(prefix) {
569
+ var ptr0 = isLikeNone(prefix) ? 0 : passStringToWasm0(prefix, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
570
+ var len0 = WASM_VECTOR_LEN;
571
+ wasm.setPrefix(ptr0, len0);
572
+ }
573
+ exports.setPrefix = setPrefix;
574
+
493
575
  exports.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
494
576
  const ret = Error(getStringFromWasm0(arg0, arg1));
495
577
  return ret;
package/pkg/index_bg.wasm CHANGED
Binary file
@@ -8,7 +8,9 @@ export const exportFileMap: () => [number, number, number, number];
8
8
  export const exportSheet: () => [number, number, number, number];
9
9
  export const getCss: (a: number, b: number) => [number, number, number, number];
10
10
  export const getDefaultTheme: () => [number, number, number, number];
11
+ export const getPrefix: () => [number, number];
11
12
  export const getThemeInterface: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
13
+ export const hasDevupUI: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
12
14
  export const importClassMap: (a: any) => [number, number];
13
15
  export const importFileMap: (a: any) => [number, number];
14
16
  export const importSheet: (a: any) => [number, number];
@@ -20,6 +22,7 @@ export const output_map: (a: number) => [number, number];
20
22
  export const output_updatedBaseStyle: (a: number) => number;
21
23
  export const registerTheme: (a: any) => [number, number];
22
24
  export const setDebug: (a: number) => void;
25
+ export const setPrefix: (a: number, b: number) => void;
23
26
  export const __wbindgen_malloc: (a: number, b: number) => number;
24
27
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
25
28
  export const __wbindgen_exn_store: (a: number) => void;