@gtkx/react 0.1.46 → 0.1.47

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
@@ -68,7 +68,7 @@ export const App = () => {
68
68
  defaultHeight={300}
69
69
  onCloseRequest={quit}
70
70
  >
71
- <Box orientation={Orientation.VERTICAL} spacing={12} margin={20}>
71
+ <Box orientation={Orientation.VERTICAL} spacing={12} marginStart={20} marginEnd={20} marginTop={20} marginBottom={20}>
72
72
  <Label.Root label={`Count: ${count}`} />
73
73
  <Button
74
74
  label="Increment"
@@ -44,6 +44,7 @@ export declare class JsxGenerator {
44
44
  private getRequiredConstructorParams;
45
45
  private getConstructorParams;
46
46
  private generateConstructorArgsMetadata;
47
+ private generatePropSettersMap;
47
48
  private generateSetterGetterMap;
48
49
  private collectAllProperties;
49
50
  private getAncestorInterfaces;
@@ -118,6 +118,7 @@ export class JsxGenerator {
118
118
  this.generateCommonTypes(widgetClass),
119
119
  widgetPropsInterfaces,
120
120
  this.generateConstructorArgsMetadata(widgets),
121
+ this.generatePropSettersMap(widgets),
121
122
  this.generateSetterGetterMap(widgets),
122
123
  this.generateExports(widgets, containerMetadata),
123
124
  this.generateJsxNamespace(widgets, containerMetadata),
@@ -410,6 +411,28 @@ ${widgetPropsContent}
410
411
  }
411
412
  return `export const CONSTRUCTOR_PARAMS: Record<string, { name: string; hasDefault: boolean }[]> = {\n${entries.join(",\n")},\n};\n`;
412
413
  }
414
+ generatePropSettersMap(widgets) {
415
+ const widgetEntries = [];
416
+ for (const widget of widgets) {
417
+ const propSetterPairs = [];
418
+ const allProps = this.collectAllProperties(widget);
419
+ for (const prop of allProps) {
420
+ if (prop.setter) {
421
+ const propName = toCamelCase(prop.name);
422
+ const setterName = toCamelCase(prop.setter);
423
+ propSetterPairs.push(`"${propName}": "${setterName}"`);
424
+ }
425
+ }
426
+ if (propSetterPairs.length > 0) {
427
+ const widgetName = toPascalCase(widget.name);
428
+ widgetEntries.push(`\t${widgetName}: { ${propSetterPairs.join(", ")} }`);
429
+ }
430
+ }
431
+ if (widgetEntries.length === 0) {
432
+ return `export const PROP_SETTERS: Record<string, Record<string, string>> = {};\n`;
433
+ }
434
+ return `export const PROP_SETTERS: Record<string, Record<string, string>> = {\n${widgetEntries.join(",\n")},\n};\n`;
435
+ }
413
436
  generateSetterGetterMap(widgets) {
414
437
  const widgetEntries = [];
415
438
  for (const widget of widgets) {
@@ -440,7 +463,7 @@ ${widgetPropsContent}
440
463
  for (const prop of current.properties) {
441
464
  if (!seen.has(prop.name)) {
442
465
  seen.add(prop.name);
443
- props.push({ setter: prop.setter, getter: prop.getter });
466
+ props.push({ name: prop.name, setter: prop.setter, getter: prop.getter });
444
467
  }
445
468
  }
446
469
  for (const ifaceName of current.implements) {
@@ -449,7 +472,7 @@ ${widgetPropsContent}
449
472
  for (const prop of iface.properties) {
450
473
  if (!seen.has(prop.name)) {
451
474
  seen.add(prop.name);
452
- props.push({ setter: prop.setter, getter: prop.getter });
475
+ props.push({ name: prop.name, setter: prop.setter, getter: prop.getter });
453
476
  }
454
477
  }
455
478
  }
@@ -5933,6 +5933,7 @@ export declare const CONSTRUCTOR_PARAMS: Record<string, {
5933
5933
  name: string;
5934
5934
  hasDefault: boolean;
5935
5935
  }[]>;
5936
+ export declare const PROP_SETTERS: Record<string, Record<string, string>>;
5936
5937
  export declare const SETTER_GETTERS: Record<string, Record<string, string>>;
5937
5938
  /**
5938
5939
  * The base class for all widgets.