@-0/browser
Advanced tools
Comparing version 0.2.87 to 0.2.88
@@ -1,2 +0,2 @@ | ||
import { parse } from "@-0/utils"; | ||
import { URL2obj } from "@-0/utils"; | ||
import { DOM_NODE, URL_FULL, URL_PATH, CMD_SUB$, CMD_ARGS, CMD_WORK } from "@-0/keys"; | ||
@@ -8,3 +8,3 @@ import { registerCMD } from "@-0/spool"; | ||
const w_href = window.location.href; | ||
const parsed = parse(w_href); | ||
const parsed = URL2obj(w_href); | ||
const w_path = `/${parsed[URL_PATH].join("/")}`; | ||
@@ -44,3 +44,5 @@ if (href === w_href || href === w_path) | ||
[CMD_ARGS]: acc => ({ [URL_FULL]: acc[URL_FULL], [DOM_NODE]: acc[DOM_NODE] }), | ||
[CMD_WORK]: args => !args[DOM_NODE].document ? history.pushState(parse(args[URL_FULL]), null, args[URL_FULL]) : null | ||
[CMD_WORK]: args => !args[DOM_NODE].document | ||
? history.pushState(URL2obj(args[URL_FULL]), null, args[URL_FULL]) | ||
: null | ||
}); | ||
@@ -47,0 +49,0 @@ export const NOTIFY_PRERENDER_DOM = registerCMD({ |
@@ -1,2 +0,2 @@ | ||
import { DOM_NODE, URL_FULL, CMD_SUB$, CMD_ARGS, CMD_SRC$, CMD_WORK, } 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"; | ||
@@ -11,5 +11,5 @@ import { URL_DOM__ROUTE } from "../tasks"; | ||
[CMD_SUB$]: "_URL_NAVIGATED$_DOM", | ||
[CMD_ARGS]: (x) => x, | ||
[CMD_WORK]: (args) => run$.next(task({ [URL_FULL]: args[URL_FULL], [DOM_NODE]: args[DOM_NODE] })), | ||
[CMD_ARGS]: x => x, | ||
[CMD_WORK]: args => run$.next(task({ [URL_FULL]: args[URL_FULL], [DOM_NODE]: args[DOM_NODE] })) | ||
}); | ||
}; |
import { isObject } from "@thi.ng/checks"; | ||
import { HREF_PUSHSTATE_DOM, NOTIFY_PRERENDER_DOM, SET_LINK_ATTRS_DOM, SET_STATE } from "../commands"; | ||
import { $$_VIEW, $$_LOAD, $$_PATH, DOM_NODE, URL_FULL, URL_DATA, URL_PATH, URL_PAGE, ROUTER_PREP, ROUTER_POST, ROUTER_PRFX, CFG_RUTR, CMD_ARGS, CMD_RESO, CMD_ERRO, DOM_BODY, STATE_DATA, STATE_PATH } from "@-0/keys"; | ||
import { parse } from "@-0/utils"; | ||
import { URL2obj } from "@-0/utils"; | ||
export const URL__ROUTE = (CFG) => { | ||
@@ -36,3 +36,3 @@ let router, preroute, postroute, prefix; | ||
{ | ||
[CMD_ARGS]: prefix ? parse(acc[URL_FULL], prefix) : parse(acc[URL_FULL]) | ||
[CMD_ARGS]: prefix ? URL2obj(acc[URL_FULL], prefix) : URL2obj(acc[URL_FULL]) | ||
}, | ||
@@ -39,0 +39,0 @@ Object.assign(Object.assign({}, SET_STATE), { [CMD_ARGS]: _acc => ({ |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "0.2.87", | ||
"version": "0.2.88", | ||
"description": "Browser helpers for -0 state management, routing and the interaction between", | ||
@@ -44,5 +44,5 @@ "main": "./lib/index.js", | ||
"dependencies": { | ||
"@-0/keys": "^0.2.81", | ||
"@-0/utils": "^0.2.75", | ||
"@-0/spool": "^0.2.87" | ||
"@-0/keys": "^0.2.83", | ||
"@-0/utils": "^0.2.80", | ||
"@-0/spool": "^0.2.90" | ||
}, | ||
@@ -69,3 +69,3 @@ "devDependencies": { | ||
"prettier": "^2.2.1", | ||
"ts-jest": "^26.4.4" | ||
"ts-jest": "^26.5.0" | ||
}, | ||
@@ -72,0 +72,0 @@ "prettier": { |
@@ -483,3 +483,3 @@ # `spule` | ||
2>- |t0|---------a~~b~~~~~~~~~~~a~|--------> : task$ | ||
3>- |t1|---c-----------c------------a----c-> : command$ | ||
3>- |t1|---c-----------c------------a----c-> : cmd$ | ||
4>- ---|ps|c-----a--b--c--------a---a----c-> : out$ | ||
@@ -499,3 +499,3 @@ | ||
- `2>-`: pubsub = `false`? -> `task$` stream | ||
- `3>-`: pubsub = `true`? -> `command$` stream | ||
- `3>-`: pubsub = `true`? -> `cmd$` stream | ||
- `4>-`: pubsub emits to `registerCMD` based on `sub$` value | ||
@@ -524,3 +524,3 @@ | ||
Commands `next`ed into this stream are sent to the | ||
`command$` stream. Arrays of Commands (Tasks) are sent to | ||
`cmd$` stream. Arrays of Commands (Tasks) are sent to | ||
the `task$` stream. | ||
@@ -527,0 +527,0 @@ |
41162
30
412
Updated@-0/keys@^0.2.83
Updated@-0/spool@^0.2.90
Updated@-0/utils@^0.2.80