rip-lang 3.13.75 → 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.75-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);
@@ -8752,7 +8753,7 @@ globalThis.zip ??= (...a) => a[0].map((_, i) => a.map(b => b[i]));
8752
8753
  }
8753
8754
  // src/browser.js
8754
8755
  var VERSION = "3.13.75";
8755
- var BUILD_DATE = "2026-03-02@18:18:53GMT";
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
  `);
@@ -8945,6 +8968,7 @@ ${indented}`);
8945
8968
  stash: () => stash,
8946
8969
  setContext: () => setContext,
8947
8970
  raw: () => raw,
8971
+ persistStash: () => persistStash,
8948
8972
  launch: () => launch,
8949
8973
  isStash: () => isStash,
8950
8974
  hold: () => hold,
@@ -8958,6 +8982,7 @@ ${indented}`);
8958
8982
  createComponents: () => createComponents
8959
8983
  });
8960
8984
  var PATH_RE;
8985
+ var PERSISTED;
8961
8986
  var PROXIES;
8962
8987
  var RAW;
8963
8988
  var SIGNALS;
@@ -9023,6 +9048,7 @@ ${indented}`);
9023
9048
  STASH = Symbol("stash");
9024
9049
  SIGNALS = Symbol("signals");
9025
9050
  RAW = Symbol("raw");
9051
+ PERSISTED = Symbol("persisted");
9026
9052
  PROXIES = new WeakMap;
9027
9053
  _keysVersion = 0;
9028
9054
  _writeVersion = __state(0);
@@ -9172,6 +9198,43 @@ ${indented}`);
9172
9198
  var isStash = function(obj) {
9173
9199
  return obj?.[STASH] === true;
9174
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
+ };
9175
9238
  var createResource = function(fn, opts = {}) {
9176
9239
  let _data, _error, _loading, load, resource;
9177
9240
  _data = __state(opts.initial || null);
@@ -9956,7 +10019,7 @@ ${indented}`);
9956
10019
  return connect();
9957
10020
  };
9958
10021
  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;
10022
+ let app, appComponents, bundle, cached, classesKey, compile2, el, etag, etagKey, hash, headers, persist, renderer, res, resolver, router, target;
9960
10023
  globalThis.__ripLaunched = true;
9961
10024
  if (typeof appBase === "object") {
9962
10025
  opts = appBase;
@@ -10000,42 +10063,14 @@ ${indented}`);
10000
10063
  throw new Error("launch: no bundle or bundleUrl provided");
10001
10064
  }
10002
10065
  app = stash({ components: {}, routes: {}, data: {} });
10066
+ globalThis.__ripApp = app;
10003
10067
  if (bundle.data)
10004
10068
  app.data = bundle.data;
10005
10069
  if (bundle.routes) {
10006
10070
  app.routes = bundle.routes;
10007
10071
  }
10008
10072
  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);
10073
+ persistStash(app, { local: persist === "local", key: `__rip_${appBase}` });
10039
10074
  }
10040
10075
  appComponents = createComponents();
10041
10076
  if (bundle.components)