rip-lang 3.13.75 → 3.13.77

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.75-blue.svg" alt="Version"></a>
12
+ <a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.77-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/dist/rip.js CHANGED
@@ -4880,11 +4880,14 @@ ${blockFactoriesCode}return ${lines.join(`
4880
4880
  }
4881
4881
  } else if (arg && !childrenVar) {
4882
4882
  const textVar = this.newTextVar();
4883
- const val = typeof arg === "string" ? arg.valueOf() : null;
4884
- if (val && (val.startsWith('"') || val.startsWith("'") || val.startsWith("`"))) {
4885
- this._createLines.push(`${textVar} = document.createTextNode(${val});`);
4883
+ const exprCode = this.generateInComponent(arg, "value");
4884
+ if (this.hasReactiveDeps(arg)) {
4885
+ this._createLines.push(`${textVar} = document.createTextNode('');`);
4886
+ const body = `${textVar}.data = ${exprCode};`;
4887
+ const effect = this._factoryMode ? `disposers.push(__effect(() => { ${body} }));` : `__effect(() => { ${body} });`;
4888
+ childrenSetupLines.push(effect);
4886
4889
  } else {
4887
- this._createLines.push(`${textVar} = document.createTextNode(${this.generateInComponent(arg, "value")});`);
4890
+ this._createLines.push(`${textVar} = document.createTextNode(${exprCode});`);
4888
4891
  }
4889
4892
  childrenVar = textVar;
4890
4893
  props.push(`children: ${childrenVar}`);
@@ -5174,6 +5177,7 @@ function __handleComponentError(error, component) {
5174
5177
  class __Component {
5175
5178
  constructor(props = {}) {
5176
5179
  Object.assign(this, props);
5180
+ if (!this.app && globalThis.__ripApp) this.app = globalThis.__ripApp;
5177
5181
  const prev = __pushComponent(this);
5178
5182
  try { this._init(props); } catch (e) { __popComponent(prev); __handleComponentError(e, this); return; }
5179
5183
  __popComponent(prev);
@@ -8751,8 +8755,8 @@ globalThis.zip ??= (...a) => a[0].map((_, i) => a.map(b => b[i]));
8751
8755
  return new CodeGenerator({}).getComponentRuntime();
8752
8756
  }
8753
8757
  // src/browser.js
8754
- var VERSION = "3.13.75";
8755
- var BUILD_DATE = "2026-03-02@18:18:53GMT";
8758
+ var VERSION = "3.13.77";
8759
+ var BUILD_DATE = "2026-03-03@05:01:25GMT";
8756
8760
  if (typeof globalThis !== "undefined") {
8757
8761
  if (!globalThis.__rip)
8758
8762
  new Function(getReactiveRuntime())();
@@ -8810,6 +8814,28 @@ globalThis.zip ??= (...a) => a[0].map((_, i) => a.map(b => b[i]));
8810
8814
  console.error(`Rip compile error in ${s.url || "inline"}:`, e.message);
8811
8815
  }
8812
8816
  }
8817
+ if (!globalThis.__ripApp && runtimeTag && !document.querySelector("script[data-launch]")) {
8818
+ const stashFn = globalThis.stash;
8819
+ if (stashFn) {
8820
+ let initial = {};
8821
+ const stateAttr = runtimeTag.getAttribute("data-state");
8822
+ if (stateAttr) {
8823
+ try {
8824
+ initial = JSON.parse(stateAttr);
8825
+ } catch (e) {
8826
+ console.error("Rip: invalid data-state JSON:", e.message);
8827
+ }
8828
+ }
8829
+ const app = stashFn({ data: initial });
8830
+ globalThis.__ripApp = app;
8831
+ if (typeof window !== "undefined")
8832
+ window.app = app;
8833
+ const persistAttr = runtimeTag.getAttribute("data-persist");
8834
+ if (persistAttr != null && globalThis.persistStash) {
8835
+ globalThis.persistStash(app, { local: persistAttr === "local" });
8836
+ }
8837
+ }
8838
+ }
8813
8839
  if (compiled.length > 0) {
8814
8840
  let js = compiled.map((c) => c.js).join(`
8815
8841
  `);
@@ -8945,6 +8971,7 @@ ${indented}`);
8945
8971
  stash: () => stash,
8946
8972
  setContext: () => setContext,
8947
8973
  raw: () => raw,
8974
+ persistStash: () => persistStash,
8948
8975
  launch: () => launch,
8949
8976
  isStash: () => isStash,
8950
8977
  hold: () => hold,
@@ -8958,6 +8985,7 @@ ${indented}`);
8958
8985
  createComponents: () => createComponents
8959
8986
  });
8960
8987
  var PATH_RE;
8988
+ var PERSISTED;
8961
8989
  var PROXIES;
8962
8990
  var RAW;
8963
8991
  var SIGNALS;
@@ -9023,6 +9051,7 @@ ${indented}`);
9023
9051
  STASH = Symbol("stash");
9024
9052
  SIGNALS = Symbol("signals");
9025
9053
  RAW = Symbol("raw");
9054
+ PERSISTED = Symbol("persisted");
9026
9055
  PROXIES = new WeakMap;
9027
9056
  _keysVersion = 0;
9028
9057
  _writeVersion = __state(0);
@@ -9172,6 +9201,43 @@ ${indented}`);
9172
9201
  var isStash = function(obj) {
9173
9202
  return obj?.[STASH] === true;
9174
9203
  };
9204
+ var persistStash = function(app, opts = {}) {
9205
+ let _save, saved, savedData, storage, storageKey, target;
9206
+ target = raw(app) || app;
9207
+ if (target[PERSISTED])
9208
+ return;
9209
+ target[PERSISTED] = true;
9210
+ storage = opts.local ? localStorage : sessionStorage;
9211
+ storageKey = opts.key || "__rip_app";
9212
+ try {
9213
+ saved = storage.getItem(storageKey);
9214
+ if (saved) {
9215
+ savedData = JSON.parse(saved);
9216
+ for (const k in savedData) {
9217
+ const v = savedData[k];
9218
+ app.data[k] = v;
9219
+ }
9220
+ }
9221
+ } catch {}
9222
+ _save = function() {
9223
+ return (() => {
9224
+ try {
9225
+ return storage.setItem(storageKey, JSON.stringify(raw(app.data)));
9226
+ } catch {
9227
+ return null;
9228
+ }
9229
+ })();
9230
+ };
9231
+ __effect(function() {
9232
+ let t;
9233
+ _writeVersion.value;
9234
+ t = setTimeout(_save, 2000);
9235
+ return function() {
9236
+ return clearTimeout(t);
9237
+ };
9238
+ });
9239
+ return window.addEventListener("beforeunload", _save);
9240
+ };
9175
9241
  var createResource = function(fn, opts = {}) {
9176
9242
  let _data, _error, _loading, load, resource;
9177
9243
  _data = __state(opts.initial || null);
@@ -9956,7 +10022,7 @@ ${indented}`);
9956
10022
  return connect();
9957
10023
  };
9958
10024
  var launch = async function(appBase = "", opts = {}) {
9959
- let _save, _storage, _storageKey, app, appComponents, bundle, cached, classesKey, compile2, el, etag, etagKey, hash, headers, persist, renderer, res, resolver, router, saved, savedData, target;
10025
+ let app, appComponents, bundle, cached, classesKey, compile2, el, etag, etagKey, hash, headers, persist, renderer, res, resolver, router, target;
9960
10026
  globalThis.__ripLaunched = true;
9961
10027
  if (typeof appBase === "object") {
9962
10028
  opts = appBase;
@@ -10000,42 +10066,14 @@ ${indented}`);
10000
10066
  throw new Error("launch: no bundle or bundleUrl provided");
10001
10067
  }
10002
10068
  app = stash({ components: {}, routes: {}, data: {} });
10069
+ globalThis.__ripApp = app;
10003
10070
  if (bundle.data)
10004
10071
  app.data = bundle.data;
10005
10072
  if (bundle.routes) {
10006
10073
  app.routes = bundle.routes;
10007
10074
  }
10008
10075
  if (persist && typeof sessionStorage !== "undefined") {
10009
- _storageKey = `__rip_${appBase}`;
10010
- _storage = persist === "local" ? localStorage : sessionStorage;
10011
- try {
10012
- saved = _storage.getItem(_storageKey);
10013
- if (saved) {
10014
- savedData = JSON.parse(saved);
10015
- for (const k in savedData) {
10016
- const v = savedData[k];
10017
- app.data[k] = v;
10018
- }
10019
- }
10020
- } catch {}
10021
- _save = function() {
10022
- return (() => {
10023
- try {
10024
- return _storage.setItem(_storageKey, JSON.stringify(raw(app.data)));
10025
- } catch {
10026
- return null;
10027
- }
10028
- })();
10029
- };
10030
- __effect(function() {
10031
- let t;
10032
- _writeVersion.value;
10033
- t = setTimeout(_save, 2000);
10034
- return function() {
10035
- return clearTimeout(t);
10036
- };
10037
- });
10038
- window.addEventListener("beforeunload", _save);
10076
+ persistStash(app, { local: persist === "local", key: `__rip_${appBase}` });
10039
10077
  }
10040
10078
  appComponents = createComponents();
10041
10079
  if (bundle.components)