rip-lang 3.13.90 → 3.13.92

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.90-blue.svg" alt="Version"></a>
12
+ <a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.92-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%2C436%2F1%2C436-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/RIP-LANG.md CHANGED
@@ -100,6 +100,8 @@ binary = 0b1010
100
100
  # Arrays
101
101
  items = [1, 2, 3]
102
102
  matrix = [[1, 2], [3, 4]]
103
+ words = %w[foo bar baz] # ["foo", "bar", "baz"]
104
+ colors = %w(red green blue) # any delimiter: [] () {} <> || !! etc.
103
105
 
104
106
  # Objects
105
107
  user = {name: "Alice", age: 30}
@@ -1480,6 +1482,10 @@ App = component
1480
1482
  name := "world"
1481
1483
  render
1482
1484
  div.card # element with class
1485
+ .card # implicit div with class
1486
+ .card.active # multiple static classes
1487
+ .("flex-1 p-4") # dynamic classes (Tailwind etc.)
1488
+ .card.("flex-1 p-4") # static + dynamic combined
1483
1489
  h1#title "Hello" # element with id
1484
1490
  span name # reactive text
1485
1491
  input value <=> name # two-way binding
@@ -2062,6 +2068,9 @@ a[/pat/, 1] # regex extract
2062
2068
  a? # existence check (a != null)
2063
2069
  a ?? b # nullish coalescing
2064
2070
 
2071
+ # Word arrays
2072
+ %w[foo bar baz] # ["foo", "bar", "baz"] — Ruby-style word literal
2073
+
2065
2074
  # Two-way binding (render blocks)
2066
2075
  input value <=> @name # bidirectional reactive binding
2067
2076
  Dialog open <=> @show # works with components too
package/docs/dist/rip.js CHANGED
@@ -1903,7 +1903,54 @@
1903
1903
  this.emit("JS", script, { len, data: { here: match[0].startsWith("```") } });
1904
1904
  return len;
1905
1905
  }
1906
+ wordLiteral() {
1907
+ if (this.chunk[0] !== "%" || this.chunk[1] !== "w")
1908
+ return 0;
1909
+ let opener = this.chunk[2];
1910
+ if (!opener || /\s/.test(opener))
1911
+ return 0;
1912
+ let PAIRS = { "[": "]", "(": ")", "{": "}", "<": ">" };
1913
+ let closer = PAIRS[opener] || opener;
1914
+ let paired = closer !== opener;
1915
+ let depth = 1;
1916
+ let i = 3;
1917
+ while (i < this.chunk.length && depth > 0) {
1918
+ let ch = this.chunk[i];
1919
+ if (ch === "\\") {
1920
+ i += 2;
1921
+ continue;
1922
+ }
1923
+ if (paired && ch === opener)
1924
+ depth++;
1925
+ if (ch === closer)
1926
+ depth--;
1927
+ if (depth > 0)
1928
+ i++;
1929
+ }
1930
+ if (depth !== 0)
1931
+ return 0;
1932
+ let content = this.chunk.slice(3, i);
1933
+ let total = i + 1;
1934
+ let words = [];
1935
+ if (content.trim()) {
1936
+ let raw = content.trim().split(/(?<!\\)\s+/);
1937
+ for (let w of raw) {
1938
+ words.push(w.replace(/\\ /g, " "));
1939
+ }
1940
+ }
1941
+ this.emit("[", "[", { len: total });
1942
+ for (let j = 0;j < words.length; j++) {
1943
+ if (j > 0)
1944
+ this.emit(",", ",");
1945
+ this.emit("STRING", `"${words[j]}"`);
1946
+ }
1947
+ this.emit("]", "]");
1948
+ return total;
1949
+ }
1906
1950
  literalToken() {
1951
+ let wl = this.wordLiteral();
1952
+ if (wl)
1953
+ return wl;
1907
1954
  let match = OPERATOR_RE.exec(this.chunk);
1908
1955
  let val = match ? match[0] : this.chunk.charAt(0);
1909
1956
  let tag = val;
@@ -4294,14 +4341,24 @@ ${blockFactoriesCode}return ${lines.join(`
4294
4341
  }
4295
4342
  if (Array.isArray(head)) {
4296
4343
  if (Array.isArray(head[0]) && head[0][0] === "." && (head[0][2] === "__clsx" || head[0][2] instanceof String && head[0][2].valueOf() === "__clsx")) {
4297
- const tag2 = typeof head[0][1] === "string" ? head[0][1] : head[0][1].valueOf();
4344
+ const tagExpr = head[0][1];
4298
4345
  const classExprs = head.slice(1);
4346
+ if (Array.isArray(tagExpr)) {
4347
+ const { tag: tag3, classes: classes2, id: id2 } = this.collectTemplateClasses(tagExpr);
4348
+ if (tag3) {
4349
+ const staticArgs = classes2.map((c) => `"${c}"`);
4350
+ return this.generateDynamicTag(tag3, classExprs, rest, staticArgs, id2);
4351
+ }
4352
+ }
4353
+ const tag2 = typeof tagExpr === "string" ? tagExpr : tagExpr.valueOf();
4299
4354
  return this.generateDynamicTag(tag2, classExprs, rest);
4300
4355
  }
4301
4356
  const { tag, classes, id } = this.collectTemplateClasses(head);
4302
4357
  if (tag && this.isHtmlTag(tag)) {
4303
- if (classes.length === 1 && classes[0] === "__clsx") {
4304
- return this.generateDynamicTag(tag, rest, []);
4358
+ if (classes.length > 0 && classes[classes.length - 1] === "__clsx") {
4359
+ const staticClasses = classes.slice(0, -1);
4360
+ const staticArgs = staticClasses.map((c) => `"${c}"`);
4361
+ return this.generateDynamicTag(tag, rest, [], staticArgs, id);
4305
4362
  }
4306
4363
  return this.generateTag(tag, classes, rest, id);
4307
4364
  }
@@ -4436,15 +4493,17 @@ ${blockFactoriesCode}return ${lines.join(`
4436
4493
  this._emitAutoWire(elVar, autoWireClaimed);
4437
4494
  return elVar;
4438
4495
  };
4439
- proto.generateDynamicTag = function(tag, classExprs, children) {
4496
+ proto.generateDynamicTag = function(tag, classExprs, children, staticClassArgs, id) {
4440
4497
  const elVar = this.newElementVar();
4441
4498
  if (SVG_TAGS.has(tag) || this._svgDepth > 0) {
4442
4499
  this._createLines.push(`${elVar} = document.createElementNS('${SVG_NS}', '${tag}');`);
4443
4500
  } else {
4444
4501
  this._createLines.push(`${elVar} = document.createElement('${tag}');`);
4445
4502
  }
4503
+ if (id)
4504
+ this._createLines.push(`${elVar}.id = '${id}';`);
4446
4505
  const autoWireClaimed = this._claimAutoWire(elVar);
4447
- const classArgs = classExprs.map((e) => this.generateInComponent(e, "value"));
4506
+ const classArgs = [...staticClassArgs || [], ...classExprs.map((e) => this.generateInComponent(e, "value"))];
4448
4507
  const prevClassArgs = this._pendingClassArgs;
4449
4508
  const prevClassEl = this._pendingClassEl;
4450
4509
  this._pendingClassArgs = classArgs;
@@ -8785,8 +8844,8 @@ globalThis.zip ??= (...a) => a[0].map((_, i) => a.map(b => b[i]));
8785
8844
  return new CodeGenerator({}).getComponentRuntime();
8786
8845
  }
8787
8846
  // src/browser.js
8788
- var VERSION = "3.13.90";
8789
- var BUILD_DATE = "2026-03-04@06:22:39GMT";
8847
+ var VERSION = "3.13.91";
8848
+ var BUILD_DATE = "2026-03-04@21:40:01GMT";
8790
8849
  if (typeof globalThis !== "undefined") {
8791
8850
  if (!globalThis.__rip)
8792
8851
  new Function(getReactiveRuntime())();