rip-lang 3.13.74 → 3.13.76

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.74-blue.svg" alt="Version"></a>
12
+ <a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.76-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
@@ -5174,6 +5174,7 @@ function __handleComponentError(error, component) {
5174
5174
  class __Component {
5175
5175
  constructor(props = {}) {
5176
5176
  Object.assign(this, props);
5177
+ if (!this.app && globalThis.__ripApp) this.app = globalThis.__ripApp;
5177
5178
  const prev = __pushComponent(this);
5178
5179
  try { this._init(props); } catch (e) { __popComponent(prev); __handleComponentError(e, this); return; }
5179
5180
  __popComponent(prev);
@@ -8751,8 +8752,8 @@ globalThis.zip ??= (...a) => a[0].map((_, i) => a.map(b => b[i]));
8751
8752
  return new CodeGenerator({}).getComponentRuntime();
8752
8753
  }
8753
8754
  // src/browser.js
8754
- var VERSION = "3.13.72";
8755
- var BUILD_DATE = "2026-03-02@17:47:10GMT";
8755
+ var VERSION = "3.13.75";
8756
+ var BUILD_DATE = "2026-03-03@00:02:43GMT";
8756
8757
  if (typeof globalThis !== "undefined") {
8757
8758
  if (!globalThis.__rip)
8758
8759
  new Function(getReactiveRuntime())();
@@ -8810,6 +8811,28 @@ globalThis.zip ??= (...a) => a[0].map((_, i) => a.map(b => b[i]));
8810
8811
  console.error(`Rip compile error in ${s.url || "inline"}:`, e.message);
8811
8812
  }
8812
8813
  }
8814
+ if (!globalThis.__ripApp && runtimeTag && !document.querySelector("script[data-launch]")) {
8815
+ const stashFn = globalThis.stash;
8816
+ if (stashFn) {
8817
+ let initial = {};
8818
+ const stateAttr = runtimeTag.getAttribute("data-state");
8819
+ if (stateAttr) {
8820
+ try {
8821
+ initial = JSON.parse(stateAttr);
8822
+ } catch (e) {
8823
+ console.error("Rip: invalid data-state JSON:", e.message);
8824
+ }
8825
+ }
8826
+ const app = stashFn({ data: initial });
8827
+ globalThis.__ripApp = app;
8828
+ if (typeof window !== "undefined")
8829
+ window.app = app;
8830
+ const persistAttr = runtimeTag.getAttribute("data-persist");
8831
+ if (persistAttr != null && globalThis.persistStash) {
8832
+ globalThis.persistStash(app, { local: persistAttr === "local" });
8833
+ }
8834
+ }
8835
+ }
8813
8836
  if (compiled.length > 0) {
8814
8837
  let js = compiled.map((c) => c.js).join(`
8815
8838
  `);
@@ -8823,6 +8846,7 @@ ${mount}.mount(${JSON.stringify(target)});`;
8823
8846
  await (0, eval)(`(async()=>{
8824
8847
  ${js}
8825
8848
  })()`);
8849
+ document.body.classList.add("ready");
8826
8850
  } catch (e) {
8827
8851
  if (e instanceof SyntaxError) {
8828
8852
  console.error(`Rip syntax error in combined output: ${e.message}`);
@@ -8944,6 +8968,7 @@ ${indented}`);
8944
8968
  stash: () => stash,
8945
8969
  setContext: () => setContext,
8946
8970
  raw: () => raw,
8971
+ persistStash: () => persistStash,
8947
8972
  launch: () => launch,
8948
8973
  isStash: () => isStash,
8949
8974
  hold: () => hold,
@@ -8957,6 +8982,7 @@ ${indented}`);
8957
8982
  createComponents: () => createComponents
8958
8983
  });
8959
8984
  var PATH_RE;
8985
+ var PERSISTED;
8960
8986
  var PROXIES;
8961
8987
  var RAW;
8962
8988
  var SIGNALS;
@@ -9022,6 +9048,7 @@ ${indented}`);
9022
9048
  STASH = Symbol("stash");
9023
9049
  SIGNALS = Symbol("signals");
9024
9050
  RAW = Symbol("raw");
9051
+ PERSISTED = Symbol("persisted");
9025
9052
  PROXIES = new WeakMap;
9026
9053
  _keysVersion = 0;
9027
9054
  _writeVersion = __state(0);
@@ -9171,6 +9198,43 @@ ${indented}`);
9171
9198
  var isStash = function(obj) {
9172
9199
  return obj?.[STASH] === true;
9173
9200
  };
9201
+ var persistStash = function(app, opts = {}) {
9202
+ let _save, saved, savedData, storage, storageKey, target;
9203
+ target = raw(app) || app;
9204
+ if (target[PERSISTED])
9205
+ return;
9206
+ target[PERSISTED] = true;
9207
+ storage = opts.local ? localStorage : sessionStorage;
9208
+ storageKey = opts.key || "__rip_app";
9209
+ try {
9210
+ saved = storage.getItem(storageKey);
9211
+ if (saved) {
9212
+ savedData = JSON.parse(saved);
9213
+ for (const k in savedData) {
9214
+ const v = savedData[k];
9215
+ app.data[k] = v;
9216
+ }
9217
+ }
9218
+ } catch {}
9219
+ _save = function() {
9220
+ return (() => {
9221
+ try {
9222
+ return storage.setItem(storageKey, JSON.stringify(raw(app.data)));
9223
+ } catch {
9224
+ return null;
9225
+ }
9226
+ })();
9227
+ };
9228
+ __effect(function() {
9229
+ let t;
9230
+ _writeVersion.value;
9231
+ t = setTimeout(_save, 2000);
9232
+ return function() {
9233
+ return clearTimeout(t);
9234
+ };
9235
+ });
9236
+ return window.addEventListener("beforeunload", _save);
9237
+ };
9174
9238
  var createResource = function(fn, opts = {}) {
9175
9239
  let _data, _error, _loading, load, resource;
9176
9240
  _data = __state(opts.initial || null);
@@ -9955,7 +10019,7 @@ ${indented}`);
9955
10019
  return connect();
9956
10020
  };
9957
10021
  var launch = async function(appBase = "", opts = {}) {
9958
- let _save, _storage, _storageKey, app, appComponents, bundle, cached, classesKey, compile2, el, etag, etagKey, hash, headers, persist, renderer, res, resolver, router, saved, savedData, target;
10022
+ let app, appComponents, bundle, cached, classesKey, compile2, el, etag, etagKey, hash, headers, persist, renderer, res, resolver, router, target;
9959
10023
  globalThis.__ripLaunched = true;
9960
10024
  if (typeof appBase === "object") {
9961
10025
  opts = appBase;
@@ -9999,42 +10063,14 @@ ${indented}`);
9999
10063
  throw new Error("launch: no bundle or bundleUrl provided");
10000
10064
  }
10001
10065
  app = stash({ components: {}, routes: {}, data: {} });
10066
+ globalThis.__ripApp = app;
10002
10067
  if (bundle.data)
10003
10068
  app.data = bundle.data;
10004
10069
  if (bundle.routes) {
10005
10070
  app.routes = bundle.routes;
10006
10071
  }
10007
10072
  if (persist && typeof sessionStorage !== "undefined") {
10008
- _storageKey = `__rip_${appBase}`;
10009
- _storage = persist === "local" ? localStorage : sessionStorage;
10010
- try {
10011
- saved = _storage.getItem(_storageKey);
10012
- if (saved) {
10013
- savedData = JSON.parse(saved);
10014
- for (const k in savedData) {
10015
- const v = savedData[k];
10016
- app.data[k] = v;
10017
- }
10018
- }
10019
- } catch {}
10020
- _save = function() {
10021
- return (() => {
10022
- try {
10023
- return _storage.setItem(_storageKey, JSON.stringify(raw(app.data)));
10024
- } catch {
10025
- return null;
10026
- }
10027
- })();
10028
- };
10029
- __effect(function() {
10030
- let t;
10031
- _writeVersion.value;
10032
- t = setTimeout(_save, 2000);
10033
- return function() {
10034
- return clearTimeout(t);
10035
- };
10036
- });
10037
- window.addEventListener("beforeunload", _save);
10073
+ persistStash(app, { local: persist === "local", key: `__rip_${appBase}` });
10038
10074
  }
10039
10075
  appComponents = createComponents();
10040
10076
  if (bundle.components)