taffy-js 0.2.1 → 0.2.2

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
@@ -229,6 +229,7 @@ const style = new Style();
229
229
  | `min_size` | `{ width, height }` | Minimum size constraints |
230
230
  | `max_size` | `{ width, height }` | Maximum size constraints |
231
231
  | `aspect_ratio` | `number?` | Width-to-height ratio |
232
+ | `box_sizing` | `BoxSizing` | Size calculation mode |
232
233
 
233
234
  #### Spacing
234
235
 
@@ -416,6 +417,13 @@ Overflow.Scroll; // Always show scrollbars
416
417
  Overflow.Auto; // Show scrollbars when needed
417
418
  ```
418
419
 
420
+ #### BoxSizing
421
+
422
+ ```typescript
423
+ BoxSizing.BorderBox; // Include padding/border in size (default)
424
+ BoxSizing.ContentBox; // Size is content only
425
+ ```
426
+
419
427
  ---
420
428
 
421
429
  ## 📏 Custom Measurement
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "ByteLandTechnology <github@byteland.app>"
6
6
  ],
7
7
  "description": "WebAssembly bindings for Taffy layout library",
8
- "version": "0.2.1",
8
+ "version": "0.2.2",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
package/taffy_js.d.ts CHANGED
@@ -66,6 +66,20 @@ export enum AlignSelf {
66
66
  Stretch = 7,
67
67
  }
68
68
 
69
+ /**
70
+ * Box sizing enum
71
+ *
72
+ * Controls how the total width and height of an element is calculated.
73
+ *
74
+ * # Variants
75
+ * - `BorderBox`: Width and height include content, padding, and border (default)
76
+ * - `ContentBox`: Width and height include only the content
77
+ */
78
+ export enum BoxSizing {
79
+ BorderBox = 0,
80
+ ContentBox = 1,
81
+ }
82
+
69
83
  /**
70
84
  * Display mode enum
71
85
  *
@@ -209,6 +223,10 @@ export class Style {
209
223
  * Sets the align-self property. Use AlignSelf.Auto to inherit from parent.
210
224
  */
211
225
  set align_self(value: AlignSelf | null | undefined);
226
+ /**
227
+ * Gets the box sizing mode (BorderBox or ContentBox).
228
+ */
229
+ box_sizing: BoxSizing;
212
230
  /**
213
231
  * Gets the flex-basis as a JsDimension (Length, Percent, or Auto).
214
232
  * Flex-basis defines the initial main size before grow/shrink.
@@ -720,6 +738,7 @@ export interface InitOutput {
720
738
  readonly style_align_self: (a: number) => number;
721
739
  readonly style_aspect_ratio: (a: number) => number;
722
740
  readonly style_border: (a: number) => any;
741
+ readonly style_box_sizing: (a: number) => number;
723
742
  readonly style_display: (a: number) => number;
724
743
  readonly style_flex_basis: (a: number) => any;
725
744
  readonly style_flex_direction: (a: number) => number;
@@ -741,6 +760,7 @@ export interface InitOutput {
741
760
  readonly style_set_align_self: (a: number, b: number) => void;
742
761
  readonly style_set_aspect_ratio: (a: number, b: number) => void;
743
762
  readonly style_set_border: (a: number, b: any) => void;
763
+ readonly style_set_box_sizing: (a: number, b: number) => void;
744
764
  readonly style_set_display: (a: number, b: number) => void;
745
765
  readonly style_set_flex_basis: (a: number, b: any) => void;
746
766
  readonly style_set_flex_direction: (a: number, b: number) => void;
package/taffy_js.js CHANGED
@@ -295,6 +295,21 @@ export const AlignSelf = Object.freeze({
295
295
  Stretch: 7, "7": "Stretch",
296
296
  });
297
297
 
298
+ /**
299
+ * Box sizing enum
300
+ *
301
+ * Controls how the total width and height of an element is calculated.
302
+ *
303
+ * # Variants
304
+ * - `BorderBox`: Width and height include content, padding, and border (default)
305
+ * - `ContentBox`: Width and height include only the content
306
+ * @enum {0 | 1}
307
+ */
308
+ export const BoxSizing = Object.freeze({
309
+ BorderBox: 0, "0": "BorderBox",
310
+ ContentBox: 1, "1": "ContentBox",
311
+ });
312
+
298
313
  /**
299
314
  * Display mode enum
300
315
  *
@@ -471,6 +486,14 @@ export class Style {
471
486
  const ret = wasm.style_align_self(this.__wbg_ptr);
472
487
  return ret === 8 ? undefined : ret;
473
488
  }
489
+ /**
490
+ * Gets the box sizing mode (BorderBox or ContentBox).
491
+ * @returns {BoxSizing}
492
+ */
493
+ get box_sizing() {
494
+ const ret = wasm.style_box_sizing(this.__wbg_ptr);
495
+ return ret;
496
+ }
474
497
  /**
475
498
  * Gets the flex-basis as a JsDimension (Length, Percent, or Auto).
476
499
  * Flex-basis defines the initial main size before grow/shrink.
@@ -607,6 +630,15 @@ export class Style {
607
630
  set align_self(val) {
608
631
  wasm.style_set_align_self(this.__wbg_ptr, isLikeNone(val) ? 8 : val);
609
632
  }
633
+ /**
634
+ * Sets the box sizing mode.
635
+ * - `BoxSizing.BorderBox`: Width and height include content, padding, and border (default)
636
+ * - `BoxSizing.ContentBox`: Width and height include only the content
637
+ * @param {BoxSizing} val
638
+ */
639
+ set box_sizing(val) {
640
+ wasm.style_set_box_sizing(this.__wbg_ptr, val);
641
+ }
610
642
  /**
611
643
  * Sets the flex-basis. Accepts { Length: number } | { Percent: number } | "Auto".
612
644
  * @param {any} val
@@ -1664,7 +1696,7 @@ function __wbg_get_imports() {
1664
1696
  const ret = arg0.length;
1665
1697
  return ret;
1666
1698
  };
1667
- imports.wbg.__wbg_log_730ba2e365bddb50 = function(arg0, arg1) {
1699
+ imports.wbg.__wbg_log_bcf7aace84648c95 = function(arg0, arg1) {
1668
1700
  console.log(getStringFromWasm0(arg0, arg1));
1669
1701
  };
1670
1702
  imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
package/taffy_js_bg.wasm CHANGED
Binary file