rip-lang 3.13.31 → 3.13.32

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
@@ -9,7 +9,7 @@
9
9
  </p>
10
10
 
11
11
  <p align="center">
12
- <a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.31-blue.svg" alt="Version"></a>
12
+ <a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.32-blue.svg" alt="Version"></a>
13
13
  <a href="#zero-dependencies"><img src="https://img.shields.io/badge/dependencies-ZERO-brightgreen.svg" alt="Dependencies"></a>
14
14
  <a href="#"><img src="https://img.shields.io/badge/tests-1%2C300%2F1%2C300-brightgreen.svg" alt="Tests"></a>
15
15
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License"></a>
package/docs/dist/rip.js CHANGED
@@ -3934,7 +3934,7 @@ Expecting ${expected.join(", ")}, got '${this.tokenNames[symbol] || symbol}'`;
3934
3934
  }
3935
3935
  for (const { name, value, isPublic } of stateVars) {
3936
3936
  const val = this.generateInComponent(value, "value");
3937
- lines.push(isPublic ? ` this.${name} = __state(props.${name} ?? ${val});` : ` this.${name} = __state(${val});`);
3937
+ lines.push(isPublic ? ` this.${name} = __state(props.__bind_${name}__ ?? props.${name} ?? ${val});` : ` this.${name} = __state(${val});`);
3938
3938
  }
3939
3939
  for (const { name, expr } of derivedVars) {
3940
3940
  if (this.is(expr, "block") && expr.length > 2) {
@@ -4135,6 +4135,12 @@ ${blockFactoriesCode}return ${lines.join(`
4135
4135
  if (headStr && this.isComponent(headStr)) {
4136
4136
  return this.generateChildComponent(headStr, rest);
4137
4137
  }
4138
+ if (headStr === "slot" && this.componentMembers) {
4139
+ const s = this._self;
4140
+ const slotVar = this.newElementVar("slot");
4141
+ this._createLines.push(`${slotVar} = ${s}.children instanceof Node ? ${s}.children : (${s}.children != null ? document.createTextNode(String(${s}.children)) : document.createComment(''));`);
4142
+ return slotVar;
4143
+ }
4138
4144
  if (headStr && this.isHtmlTag(headStr)) {
4139
4145
  let [tagName, id] = headStr.split("#");
4140
4146
  return this.generateTag(tagName || "div", [], rest, id);
@@ -4661,11 +4667,15 @@ ${blockFactoriesCode}return ${lines.join(`
4661
4667
  this._pendingAutoWire = false;
4662
4668
  const instVar = this.newElementVar("inst");
4663
4669
  const elVar = this.newElementVar("el");
4664
- const { propsCode, reactiveProps, childrenSetupLines } = this.buildComponentProps(args);
4670
+ const { propsCode, reactiveProps, eventBindings, childrenSetupLines } = this.buildComponentProps(args);
4665
4671
  const s = this._self;
4666
4672
  this._createLines.push(`${instVar} = new ${componentName}(${propsCode});`);
4667
4673
  this._createLines.push(`${elVar} = ${instVar}._root = ${instVar}._create();`);
4668
4674
  this._createLines.push(`(${s}._children || (${s}._children = [])).push(${instVar});`);
4675
+ for (const { event, value } of eventBindings) {
4676
+ const handlerCode = this.generateInComponent(value, "value");
4677
+ this._createLines.push(`${elVar}.addEventListener('${event}', (e) => __batch(() => (${handlerCode})(e)));`);
4678
+ }
4669
4679
  this._setupLines.push(`try { if (${instVar}._setup) ${instVar}._setup(); if (${instVar}.mounted) ${instVar}.mounted(); } catch (__e) { __handleComponentError(__e, ${instVar}); }`);
4670
4680
  for (const { key, valueCode } of reactiveProps) {
4671
4681
  this._pushEffect(`if (${instVar}.${key}) ${instVar}.${key}.value = ${valueCode};`);
@@ -4678,9 +4688,14 @@ ${blockFactoriesCode}return ${lines.join(`
4678
4688
  proto.buildComponentProps = function(args) {
4679
4689
  const props = [];
4680
4690
  const reactiveProps = [];
4691
+ const eventBindings = [];
4681
4692
  let childrenVar = null;
4682
4693
  const childrenSetupLines = [];
4683
4694
  const addProp = (key, value) => {
4695
+ if (key.startsWith("@")) {
4696
+ eventBindings.push({ event: key.slice(1).split(".")[0], value });
4697
+ return;
4698
+ }
4684
4699
  const isDirectSignal = this.reactiveMembers && (typeof value === "string" && this.reactiveMembers.has(value) || Array.isArray(value) && value[0] === "." && value[1] === "this" && typeof value[2] === "string" && this.reactiveMembers.has(value[2]));
4685
4700
  if (isDirectSignal) {
4686
4701
  const member = typeof value === "string" ? value : value[2];
@@ -4696,8 +4711,11 @@ ${blockFactoriesCode}return ${lines.join(`
4696
4711
  const addObjectProps = (objExpr) => {
4697
4712
  for (let i = 1;i < objExpr.length; i++) {
4698
4713
  const [key, value] = objExpr[i];
4699
- if (typeof key === "string")
4714
+ if (typeof key === "string") {
4700
4715
  addProp(key, value);
4716
+ } else if (Array.isArray(key) && key[0] === "." && key[1] === "this" && typeof key[2] === "string") {
4717
+ eventBindings.push({ event: key[2], value });
4718
+ }
4701
4719
  }
4702
4720
  };
4703
4721
  for (const arg of args) {
@@ -4737,7 +4755,7 @@ ${blockFactoriesCode}return ${lines.join(`
4737
4755
  }
4738
4756
  }
4739
4757
  const propsCode = props.length > 0 ? `{ ${props.join(", ")} }` : "{}";
4740
- return { propsCode, reactiveProps, childrenSetupLines };
4758
+ return { propsCode, reactiveProps, eventBindings, childrenSetupLines };
4741
4759
  };
4742
4760
  proto.hasReactiveDeps = function(sexpr) {
4743
4761
  if (typeof sexpr === "string") {
@@ -8575,8 +8593,8 @@ globalThis.zip ??= (...a) => a[0].map((_, i) => a.map(b => b[i]));
8575
8593
  return new CodeGenerator({}).getComponentRuntime();
8576
8594
  }
8577
8595
  // src/browser.js
8578
- var VERSION = "3.13.31";
8579
- var BUILD_DATE = "2026-02-26@09:14:06GMT";
8596
+ var VERSION = "3.13.32";
8597
+ var BUILD_DATE = "2026-02-26@09:33:18GMT";
8580
8598
  if (typeof globalThis !== "undefined") {
8581
8599
  if (!globalThis.__rip)
8582
8600
  new Function(getReactiveRuntime())();