halfcab 15.0.2 → 15.0.4
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/halfcab.mjs +2 -43
- package/package.json +1 -3
package/halfcab.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import hrefModule from 'shifty-router/href.js'
|
|
|
3
3
|
import historyModule from 'shifty-router/history.js'
|
|
4
4
|
import createLocation from 'shifty-router/create-location.js'
|
|
5
5
|
import { html as litHtml, render } from 'lit'
|
|
6
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js'
|
|
6
7
|
import { render as renderSSR } from '@lit-labs/ssr'
|
|
7
8
|
import { hydrate } from '@lit-labs/ssr-client'
|
|
8
9
|
import axios from 'axios'
|
|
@@ -12,12 +13,6 @@ import marked from 'marked'
|
|
|
12
13
|
import { decode } from 'html-entities'
|
|
13
14
|
import eventEmitter from './eventEmitter/index.mjs'
|
|
14
15
|
import qs from 'qs'
|
|
15
|
-
import LRU from 'nanolru'
|
|
16
|
-
import Component from 'nanocomponent'
|
|
17
|
-
import * as deepDiff from 'deep-object-diff'
|
|
18
|
-
import clone from 'fast-clone'
|
|
19
|
-
|
|
20
|
-
const cache = LRU(5000)
|
|
21
16
|
|
|
22
17
|
let cssTag = cssInject
|
|
23
18
|
let componentCSSString = ''
|
|
@@ -513,39 +508,6 @@ function rerender () {
|
|
|
513
508
|
debounce(stateUpdated)
|
|
514
509
|
}
|
|
515
510
|
|
|
516
|
-
class PureComponent extends Component {
|
|
517
|
-
createElement (args) {
|
|
518
|
-
this.args = clone(args)
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
update (args) {
|
|
522
|
-
let diff = deepDiff.diff(this.args, args)
|
|
523
|
-
Object.keys(diff).forEach(key => {
|
|
524
|
-
if (typeof diff[key] === 'function') {
|
|
525
|
-
this[key] = args[key]
|
|
526
|
-
}
|
|
527
|
-
})
|
|
528
|
-
return !!Object.keys(diff).find(key => typeof diff[key] !== 'function')
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
function cachedComponent (Class, args, id) {
|
|
533
|
-
let instance
|
|
534
|
-
if (id) {
|
|
535
|
-
let found = cache.get(id)
|
|
536
|
-
if (found) {
|
|
537
|
-
instance = found
|
|
538
|
-
} else {
|
|
539
|
-
instance = new Class()
|
|
540
|
-
cache.set(id, instance)
|
|
541
|
-
}
|
|
542
|
-
return instance.render(args)
|
|
543
|
-
} else {
|
|
544
|
-
instance = new Class()
|
|
545
|
-
return instance.createElement(args)
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
|
|
549
511
|
export {
|
|
550
512
|
getRouteComponent,
|
|
551
513
|
rerender,
|
|
@@ -568,8 +530,5 @@ export {
|
|
|
568
530
|
nextTick,
|
|
569
531
|
addToHoldingPen,
|
|
570
532
|
removeFromHoldingPen,
|
|
571
|
-
|
|
572
|
-
LRU,
|
|
573
|
-
cachedComponent,
|
|
574
|
-
PureComponent
|
|
533
|
+
unsafeHTML
|
|
575
534
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "halfcab",
|
|
3
|
-
"version": "15.0.
|
|
3
|
+
"version": "15.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A simple universal JavaScript framework focused on making use of es2015 template strings to build components.",
|
|
6
6
|
"main": "halfcab.mjs",
|
|
@@ -59,8 +59,6 @@
|
|
|
59
59
|
"html-entities": "^2.3.2",
|
|
60
60
|
"lit": "^3.3.2",
|
|
61
61
|
"marked": "^0.7.0",
|
|
62
|
-
"nanocomponent": "^6.5.2",
|
|
63
|
-
"nanolru": "^1.0.0",
|
|
64
62
|
"qs": "^6.5.2",
|
|
65
63
|
"shifty-router": "^0.1.1"
|
|
66
64
|
},
|