parent
9823e17172
commit
61ea80b269
@ -1,42 +0,0 @@ |
||||
'use strict' |
||||
|
||||
// Allowing window to be overriden for testing
|
||||
function QueryParams (_window) { |
||||
if (_window === undefined) _window = window |
||||
|
||||
this.get = function () { |
||||
var qs = _window.location.hash.substr(1) |
||||
|
||||
if (_window.location.search.length > 0) { |
||||
// use legacy query params instead of hash
|
||||
_window.location.hash = _window.location.search.substr(1) |
||||
_window.location.search = '' |
||||
} |
||||
|
||||
var params = {} |
||||
var parts = qs.split('&') |
||||
for (var x in parts) { |
||||
var keyValue = parts[x].split('=') |
||||
if (keyValue[0] !== '') { |
||||
params[keyValue[0]] = keyValue[1] |
||||
} |
||||
} |
||||
return params |
||||
} |
||||
|
||||
this.update = function (params) { |
||||
var currentParams = this.get() |
||||
var keys = Object.keys(params) |
||||
for (var x in keys) { |
||||
currentParams[keys[x]] = params[keys[x]] |
||||
} |
||||
var queryString = '#' |
||||
var updatedKeys = Object.keys(currentParams) |
||||
for (var y in updatedKeys) { |
||||
queryString += updatedKeys[y] + '=' + currentParams[updatedKeys[y]] + '&' |
||||
} |
||||
_window.location.hash = queryString.slice(0, -1) |
||||
} |
||||
} |
||||
|
||||
module.exports = QueryParams |
@ -1,16 +1,17 @@ |
||||
{ |
||||
"extends": "./tsconfig.json", |
||||
"compilerOptions": { |
||||
"module": "commonjs", |
||||
"outDir": "../../dist/out-tsc", |
||||
"declaration": true, |
||||
"rootDir": "./src", |
||||
"types": ["node"] |
||||
}, |
||||
"exclude": [ |
||||
"**/*.spec.ts", |
||||
"tests/" |
||||
], |
||||
"include": ["**/*.ts"] |
||||
} |
||||
|
||||
"extends": "./tsconfig.json", |
||||
"compilerOptions": { |
||||
"module": "commonjs", |
||||
"outDir": "../../dist/out-tsc", |
||||
"allowSyntheticDefaultImports": true, |
||||
"esModuleInterop": true, |
||||
"declaration": true, |
||||
"rootDir": "./src", |
||||
"types": ["node"] |
||||
}, |
||||
"exclude": [ |
||||
"**/*.spec.ts", |
||||
"tests/" |
||||
], |
||||
"include": ["**/*.ts"] |
||||
} |
||||
|
@ -0,0 +1,38 @@ |
||||
'use strict' |
||||
|
||||
export class QueryParams { |
||||
|
||||
update (params) { |
||||
const currentParams = this.get() |
||||
const keys = Object.keys(params) |
||||
for (const x in keys) { |
||||
currentParams[keys[x]] = params[keys[x]] |
||||
} |
||||
let queryString = '#' |
||||
const updatedKeys = Object.keys(currentParams) |
||||
for (const y in updatedKeys) { |
||||
queryString += updatedKeys[y] + '=' + currentParams[updatedKeys[y]] + '&' |
||||
} |
||||
window.location.hash = queryString.slice(0, -1) |
||||
} |
||||
|
||||
get () { |
||||
const qs = window.location.hash.substr(1) |
||||
|
||||
if (window.location.search.length > 0) { |
||||
// use legacy query params instead of hash
|
||||
window.location.hash = window.location.search.substr(1) |
||||
window.location.search = '' |
||||
} |
||||
|
||||
const params = {} |
||||
const parts = qs.split('&') |
||||
for (const x in parts) { |
||||
const keyValue = parts[x].split('=') |
||||
if (keyValue[0] !== '') { |
||||
params[keyValue[0]] = keyValue[1] |
||||
} |
||||
} |
||||
return params |
||||
} |
||||
} |
@ -1,2 +1,3 @@ |
||||
export * from './lib/modal-dialog-custom' |
||||
export * from './lib/remix-ui-modal-dialog' |
||||
export * from './lib/types/index' |
||||
|
@ -1 +1,2 @@ |
||||
export * from './lib/remix-ui-theme-module'; |
||||
export * from '../types/theme-module' |
||||
|
@ -1,10 +1,10 @@ |
||||
import { Plugin } from "@remixproject/engine/lib/abstract"; |
||||
import { EventEmitter } from "events"; |
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export class ThemeModule extends Plugin<any, any> { |
||||
export interface ThemeModule extends Plugin<any, any> { |
||||
currentThemeState: Record<string, unknown>; |
||||
constructor(registry: any): any; |
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
constructor(registry: any); |
||||
events: EventEmitter; |
||||
_deps: { |
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
Loading…
Reference in new issue