taffy-layout 1.1.0 → 1.2.0

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taffy-layout",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "WebAssembly bindings for Taffy layout library",
5
5
  "keywords": [
6
6
  "layout",
@@ -549,7 +549,7 @@ export type GridTemplateArea = {
549
549
  };
550
550
 
551
551
  /**
552
- * Valid property paths for Style.get() method.
552
+ * Valid property keys for Style.get() method.
553
553
  *
554
554
  * Supports both object properties and individual flat properties.
555
555
  *
@@ -647,6 +647,8 @@ declare module "./taffy_wasm" {
647
647
  *
648
648
  * @returns Single value for one key, tuple for 2-3 keys, array for 4+ keys
649
649
  *
650
+ * @throws Error if any property key is unknown.
651
+ *
650
652
  * @remarks
651
653
  * - Single property: returns exact value type (including `undefined` for optional properties)
652
654
  * - 2-3 properties: returns typed tuple for destructuring
@@ -690,11 +692,12 @@ declare module "./taffy_wasm" {
690
692
  * Sets multiple style properties in a single WASM call.
691
693
  * Supports both object properties and individual flat properties.
692
694
  *
693
- * @param props - Object mapping property paths to their values
695
+ * @param props - Object mapping property keys to their values
694
696
  *
695
697
  * @remarks
696
- * Only accepts valid property paths with their corresponding value types.
697
- * Invalid properties will be ignored at runtime.
698
+ * Only accepts valid property keys with their corresponding value types.
699
+ *
700
+ * @throws Error if any property key is unknown.
698
701
  *
699
702
  * @example
700
703
  * ```typescript
@@ -712,7 +715,7 @@ declare module "./taffy_wasm" {
712
715
  }
713
716
 
714
717
  /**
715
- * Helper type to convert an array of property paths to an array of their value types.
718
+ * Helper type to convert an array of property keys to an array of their value types.
716
719
  * Unlike `TupleToStyleValues`, this returns an array type instead of a tuple.
717
720
  */
718
721
  type StylePropertyArrayValues<Keys extends StyleProperty[]> = {
@@ -1352,31 +1355,6 @@ export enum Position {
1352
1355
  export class Style {
1353
1356
  free(): void;
1354
1357
  [Symbol.dispose](): void;
1355
- /**
1356
- * Reads multiple style properties in a single WASM call.
1357
- *
1358
- * Supports dot notation for nested properties (e.g., `"size.width"`, `"margin.left"`).
1359
- *
1360
- * @param keys - Property paths to read
1361
- * @returns - Single value if one key, array of values if multiple keys
1362
- *
1363
- * @example
1364
- * ```typescript
1365
- * const style = new Style();
1366
- * style.display = Display.Flex;
1367
- * style.size = { width: 100, height: "50%" };
1368
- *
1369
- * // Read single property
1370
- * const d = style.get("display");
1371
- *
1372
- * // Read nested property
1373
- * const w = style.get("size.width");
1374
- *
1375
- * // Read multiple properties with destructuring
1376
- * const [display, width, margin] = style.get("display", "size.width", "margin.left");
1377
- * ```
1378
- */
1379
- get(...keys: string[]): any;
1380
1358
  /**
1381
1359
  * Creates a new Style instance with default values
1382
1360
  *
@@ -1393,36 +1371,12 @@ export class Style {
1393
1371
  * const style2 = new Style({
1394
1372
  * display: Display.Flex,
1395
1373
  * flexDirection: FlexDirection.Column,
1396
- * "size.width": 200,
1397
- * "margin.left": 10
1374
+ * width: 200,
1375
+ * marginLeft: 10
1398
1376
  * });
1399
1377
  * ```
1400
1378
  */
1401
1379
  constructor(props?: any | null);
1402
- /**
1403
- * Sets multiple style properties in a single WASM call.
1404
- *
1405
- * Accepts an object where keys are property paths (supporting dot notation)
1406
- * and values are the new property values.
1407
- *
1408
- * @param props - Object with property paths as keys and values to set
1409
- *
1410
- * @example
1411
- * ```typescript
1412
- * const style = new Style();
1413
- *
1414
- * // Set multiple properties at once
1415
- * style.set({
1416
- * display: Display.Flex,
1417
- * flexDirection: FlexDirection.Column,
1418
- * "size.width": 200,
1419
- * "size.height": "50%",
1420
- * "margin.left": 10,
1421
- * "margin.right": "auto"
1422
- * });
1423
- * ```
1424
- */
1425
- set(props: any): void;
1426
1380
  /**
1427
1381
  * Gets the align-self property
1428
1382
  *
package/pkg/taffy_wasm.js CHANGED
@@ -2486,9 +2486,11 @@ export class Style {
2486
2486
  /**
2487
2487
  * Reads multiple style properties in a single WASM call.
2488
2488
  *
2489
- * Supports dot notation for nested properties (e.g., `"size.width"`, `"margin.left"`).
2489
+ * Supports flattened property keys (e.g., `"width"`, `"marginLeft"`).
2490
2490
  *
2491
- * @param keys - Property paths to read
2491
+ * @throws Error if any property key is unknown.
2492
+ *
2493
+ * @param keys - Property keys to read
2492
2494
  * @returns - Single value if one key, array of values if multiple keys
2493
2495
  *
2494
2496
  * @example
@@ -2501,10 +2503,10 @@ export class Style {
2501
2503
  * const d = style.get("display");
2502
2504
  *
2503
2505
  * // Read nested property
2504
- * const w = style.get("size.width");
2506
+ * const w = style.get("width");
2505
2507
  *
2506
2508
  * // Read multiple properties with destructuring
2507
- * const [display, width, margin] = style.get("display", "size.width", "margin.left");
2509
+ * const [display, width, margin] = style.get("display", "width", "marginLeft");
2508
2510
  * ```
2509
2511
  * @param {...string[]} keys
2510
2512
  * @returns {any}
@@ -2531,8 +2533,8 @@ export class Style {
2531
2533
  * const style2 = new Style({
2532
2534
  * display: Display.Flex,
2533
2535
  * flexDirection: FlexDirection.Column,
2534
- * "size.width": 200,
2535
- * "margin.left": 10
2536
+ * width: 200,
2537
+ * marginLeft: 10
2536
2538
  * });
2537
2539
  * ```
2538
2540
  * @param {any | null} [props]
@@ -2546,10 +2548,11 @@ export class Style {
2546
2548
  /**
2547
2549
  * Sets multiple style properties in a single WASM call.
2548
2550
  *
2549
- * Accepts an object where keys are property paths (supporting dot notation)
2550
- * and values are the new property values.
2551
+ * Accepts an object where keys are property keys.
2552
+ *
2553
+ * @throws Error if any property key is unknown.
2551
2554
  *
2552
- * @param props - Object with property paths as keys and values to set
2555
+ * @param props - Object with property keys as keys and values to set
2553
2556
  *
2554
2557
  * @example
2555
2558
  * ```typescript
@@ -2559,10 +2562,10 @@ export class Style {
2559
2562
  * style.set({
2560
2563
  * display: Display.Flex,
2561
2564
  * flexDirection: FlexDirection.Column,
2562
- * "size.width": 200,
2563
- * "size.height": "50%",
2564
- * "margin.left": 10,
2565
- * "margin.right": "auto"
2565
+ * width: 200,
2566
+ * height: "50%",
2567
+ * marginLeft: 10,
2568
+ * marginRight: "auto"
2566
2569
  * });
2567
2570
  * ```
2568
2571
  * @param {any} props
Binary file