New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@-0/browser

Package Overview
Dependencies
Maintainers
1
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@-0/browser - npm Package Compare versions

Comparing version 0.3.50 to 0.3.51

10

lib/commands/routing.js
import { URL2obj, Err_missing_props } from "@-0/utils";
import { DOM_NODE, URL_FULL, URL_PATH, CMD_SUB$, CMD_ARGS, CMD_WORK, SCROLL_Y, SCROLL_X, PUSH_STATE, } from "@-0/keys";
import { DOM_NODE, URL_FULL, URL_PATH, CMD_SUB$, CMD_ARGS, CMD_WORK, SCROLL_Y, SCROLL_X, } from "@-0/keys";
import { DOMnavigated$ } from "../core/stream$";

@@ -56,2 +56,3 @@ import { registerCMD } from "@-0/spool";

});
const POP_STATE = "POP_STATE";
export const _HREF_PUSHSTATE_DOM = registerCMD({

@@ -63,10 +64,9 @@ [CMD_SUB$]: "_HREF_PUSHSTATE_DOM",

const node = acc[DOM_NODE];
const state = acc[PUSH_STATE];
const pop = acc[POP_STATE];
const props = {
[URL_FULL]: url,
[DOM_NODE]: node,
[PUSH_STATE]: state,
};
if (url && node && !node.document) {
return history.pushState(state, document.title, url);
if (url && node && !node.document && !pop) {
return history.pushState(getScrollPos(), document.title, url);
}

@@ -73,0 +73,0 @@ if (!url || !node) {

@@ -24,3 +24,3 @@ import { ISubscribable } from "@thi.ng/rstream";

_NODE: HTMLElement | Document;
PUSH_STATE: Record<string, unknown>;
POP_STATE: Record<string, unknown>;
}>;
import { fromDOMEvent, merge } from "@thi.ng/rstream";
import { map } from "@thi.ng/transducers";
import { URL_FULL, DOM_NODE, PUSH_STATE } from "@-0/keys";
import { URL_FULL, DOM_NODE } from "@-0/keys";
export const popstate$ = fromDOMEvent(window, "popstate");
export const DOMContentLoaded$ = fromDOMEvent(window, "DOMContentLoaded");
const POP_STATE = "POP_STATE";
export const DOMnavigated$ = merge({

@@ -10,2 +11,3 @@ src: [popstate$, DOMContentLoaded$],

xform: map((e) => {
console.log("DOMnavigated$ state?:", e.state);
if (e.target.location.href && e.currentTarget) {

@@ -15,3 +17,3 @@ return {

[DOM_NODE]: e.currentTarget,
[PUSH_STATE]: e.state || null,
[POP_STATE]: e.state || null,
};

@@ -18,0 +20,0 @@ }

@@ -1,2 +0,2 @@

import { DOM_NODE, URL_FULL, CMD_SUB$, CMD_ARGS, CMD_SRC$, CMD_WORK, PUSH_STATE, } from "@-0/keys";
import { DOM_NODE, URL_FULL, CMD_SUB$, CMD_ARGS, CMD_SRC$, CMD_WORK, } from "@-0/keys";
import { run$, registerCMD } from "@-0/spool";

@@ -7,2 +7,3 @@ import { Err_missing_props } from "@-0/utils";

import { SET_STATE } from "../commands";
const POP_STATE = "POP_STATE";
export const registerRouterDOM = (CFG, setStateCMD = SET_STATE) => {

@@ -14,9 +15,9 @@ console.log("DOM Router Registered");

[CMD_SUB$]: "_NAVIGATE",
[CMD_ARGS]: ({ [URL_FULL]: url, [DOM_NODE]: node, [PUSH_STATE]: state }) => ({
[CMD_ARGS]: ({ [URL_FULL]: url, [DOM_NODE]: node, [POP_STATE]: state }) => ({
[URL_FULL]: url,
[DOM_NODE]: node,
[PUSH_STATE]: state,
[POP_STATE]: state,
}),
[CMD_WORK]: ({ [URL_FULL]: url, [DOM_NODE]: node = document, [PUSH_STATE]: state }) => {
const props = { [URL_FULL]: url, [DOM_NODE]: node, [PUSH_STATE]: state };
[CMD_WORK]: ({ [URL_FULL]: url, [DOM_NODE]: node = document, [POP_STATE]: state }) => {
const props = { [URL_FULL]: url, [DOM_NODE]: node, [POP_STATE]: state };
if (url)

@@ -23,0 +24,0 @@ return run$.next(ROUTE_HOT(props));

@@ -50,6 +50,7 @@ import { isPlainObject } from "@thi.ng/checks";

const _SET_ROUTE_LOADING_FALSE = Object.assign(Object.assign({}, SET_STATE), { [CMD_ARGS]: { [STATE_PATH]: [_, $$_LOAD], [STATE_DATA]: false } });
const POP_STATE = "POP_STATE";
const ROUTE_HOT = (ACC) => [
..._PREP,
_SET_ROUTE_LOADING_TRUE,
Object.assign(Object.assign({}, _HREF_PUSHSTATE_DOM), { [CMD_ARGS]: { [URL_FULL]: ACC[URL_FULL], [DOM_NODE]: ACC[DOM_NODE] } }),
Object.assign(Object.assign({}, _HREF_PUSHSTATE_DOM), { [CMD_ARGS]: { [URL_FULL]: ACC[URL_FULL], [DOM_NODE]: ACC[DOM_NODE], [POP_STATE]: ACC[POP_STATE] } }),
ACC => UNIVERSAL_ROUTING_SUBTASK({ [URL_FULL]: ACC[URL_FULL] }),

@@ -56,0 +57,0 @@ { [CMD_ARGS]: acc => (Object.assign(Object.assign({}, ACC), acc)) },

@@ -5,3 +5,3 @@ {

"license": "MIT",
"version": "0.3.50",
"version": "0.3.51",
"description": "Browser helpers for -0 state management, routing and the interaction between",

@@ -8,0 +8,0 @@ "main": "./lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc