pinstripe 0.26.0 → 0.27.0

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/lib/component.js CHANGED
@@ -17,7 +17,7 @@ export const Component = Class.extend().include({
17
17
  if(!node._component){
18
18
  node._component = Component.new(node, true);
19
19
  node._component = Component.create(
20
- node._component.attributes['data-component'] || node._component.type,
20
+ node._component.attributes['data-component'] || (node._component.type == '#document' ? 'pinstripe-document' : node._component.type),
21
21
  node
22
22
  );
23
23
  if(node.isConnected) node._component.trigger('init', { bubbles: false });
@@ -626,6 +626,13 @@ function insert(virtualNode, referenceChild, returnComponent = true){
626
626
  }
627
627
  }
628
628
 
629
+ const COMPONENT_MAP = {
630
+ a: 'pinstripe-anchor',
631
+ body: 'pinstripe-body',
632
+ form: 'pinstripe-body',
633
+
634
+ };
635
+
629
636
  function normalizeVirtualNode(){
630
637
  if(!this.parent && this.children.some(child => child.type == 'html')){
631
638
  this.children = [
@@ -645,6 +652,24 @@ function normalizeVirtualNode(){
645
652
  if(this.parent && this.parent.type == 'textarea' && this.type == '#text'){
646
653
  this.attributes.value = this.attributes.value.replace(/^\n/, '');
647
654
  }
655
+
656
+ if(!this.attributes['data-component']){
657
+ if(this.type == 'a'){
658
+ this.attributes['data-component'] = 'pinstripe-anchor';
659
+ }
660
+
661
+ if(this.type == 'body'){
662
+ this.attributes['data-component'] = 'pinstripe-body';
663
+ }
664
+
665
+ if(this.type == 'form'){
666
+ this.attributes['data-component'] = 'pinstripe-form';
667
+ }
668
+
669
+ if(this.type == 'script' && this.attributes.type == 'pinstripe'){
670
+ this.attributes['data-component'] = 'pinstripe-script';
671
+ }
672
+ }
648
673
  }
649
674
 
650
675
  ComponentEvent.Component = Component;
@@ -47,7 +47,7 @@ export default {
47
47
  this.abort();
48
48
  const { method = 'GET', placeholderUrl } = options;
49
49
  const cachedHtml = method == 'GET' ? loadCache.get(url.toString()) : undefined;
50
- const out = cachedHtml ? this.patch(cachedHtml) : undefined;
50
+ if(cachedHtml) this.patch(cachedHtml);
51
51
  let minimumDelay = 0;
52
52
  if(!cachedHtml && placeholderUrl){
53
53
  const placeholderHtml = loadCache.get(placeholderUrl.toString());
@@ -3,8 +3,6 @@
3
3
  export default {
4
4
  initialize(...args){
5
5
  this.constructor.parent.prototype.initialize.call(this, ...args);
6
-
7
- if(this.params.type != 'pinstripe') return;
8
6
 
9
7
  this.setTimeout(() => (new Function(this.text)).call(this));
10
8
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "name": "pinstripe",
4
4
  "description": "Surgically updates your app's DOM when a page changes.",
5
- "version": "0.26.0",
5
+ "version": "0.27.0",
6
6
  "author": "Jody Salt",
7
7
  "license": "MIT",
8
8
  "exports": {
@@ -13,12 +13,12 @@
13
13
  "clean": "rm -rf ./node_modules"
14
14
  },
15
15
  "dependencies": {
16
- "@blognami/util": "^0.26.0"
16
+ "@blognami/util": "^0.27.0"
17
17
  },
18
18
  "repository": {
19
19
  "type": "git",
20
20
  "url": "git://github.com/blognami/blognami.git",
21
21
  "directory": "packages/pinstripe"
22
22
  },
23
- "gitHead": "981a4f7fdb5c28e6255a80e6a3cf1d3e4c8fc971"
23
+ "gitHead": "4dfbb8d6cf08202165ebbc34dfef42e718a0d9e5"
24
24
  }
File without changes
File without changes
File without changes