gobstones-blockly 0.6.0 → 0.8.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -791,7 +791,7 @@ default:
791
791
  return value != null ? value : undefined;
792
792
  }
793
793
  }
794
- });Polymer.version = "1.11.0";Polymer.Base._addFeature({
794
+ });Polymer.version = "1.11.3";Polymer.Base._addFeature({
795
795
  _registerFeatures: function () {
796
796
  this._prepIs();
797
797
  this._prepBehaviors();
@@ -572,7 +572,10 @@ window.removeEventListener('test', null, opts);
572
572
  } catch (e) {
573
573
  }
574
574
  }());
575
- function PASSIVE_TOUCH() {
575
+ function PASSIVE_TOUCH(eventName) {
576
+ if (isMouseEvent(eventName) || eventName === 'touchend') {
577
+ return;
578
+ }
576
579
  if (HAS_NATIVE_TA && SUPPORTS_PASSIVE && Polymer.Settings.passiveTouchGestures) {
577
580
  return { passive: true };
578
581
  }
@@ -586,11 +589,13 @@ return;
586
589
  mouseEvent[HANDLED_OBJ] = { skip: true };
587
590
  if (mouseEvent.type === 'click') {
588
591
  var path = Polymer.dom(mouseEvent).path;
592
+ if (path) {
589
593
  for (var i = 0; i < path.length; i++) {
590
594
  if (path[i] === POINTERSTATE.mouse.target) {
591
595
  return;
592
596
  }
593
597
  }
598
+ }
594
599
  mouseEvent.preventDefault();
595
600
  mouseEvent.stopPropagation();
596
601
  }
@@ -805,8 +810,7 @@ if (!gd) {
805
810
  gobj[dep] = gd = { _count: 0 };
806
811
  }
807
812
  if (gd._count === 0) {
808
- var options = !isMouseEvent(dep) && PASSIVE_TOUCH();
809
- node.addEventListener(dep, this.handleNative, options);
813
+ node.addEventListener(dep, this.handleNative, PASSIVE_TOUCH(dep));
810
814
  }
811
815
  gd[name] = (gd[name] || 0) + 1;
812
816
  gd._count = (gd._count || 0) + 1;
@@ -830,8 +834,7 @@ if (gd && gd[name]) {
830
834
  gd[name] = (gd[name] || 1) - 1;
831
835
  gd._count = (gd._count || 1) - 1;
832
836
  if (gd._count === 0) {
833
- var options = !isMouseEvent(dep) && PASSIVE_TOUCH();
834
- node.removeEventListener(dep, this.handleNative, options);
837
+ node.removeEventListener(dep, this.handleNative, PASSIVE_TOUCH(dep));
835
838
  }
836
839
  }
837
840
  }
@@ -2525,7 +2528,7 @@ MIXIN_RULE: 1000
2525
2528
  OPEN_BRACE: '{',
2526
2529
  CLOSE_BRACE: '}',
2527
2530
  _rx: {
2528
- comments: /\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,
2531
+ comments: /\/\*[^*]*\*+([^\/*][^*]*\*+)*\//gim,
2529
2532
  port: /@import[^;]*;/gim,
2530
2533
  customProp: /(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,
2531
2534
  mixinProp: /(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,
@@ -2541,6 +2544,8 @@ AT_START: '@'
2541
2544
  }();Polymer.StyleUtil = function () {
2542
2545
  var settings = Polymer.Settings;
2543
2546
  return {
2547
+ unscopedStyleImports: new WeakMap(),
2548
+ SHADY_UNSCOPED_ATTR: 'shady-unscoped',
2544
2549
  NATIVE_VARIABLES: Polymer.Settings.useNativeCSSProperties,
2545
2550
  MODULE_STYLES_SELECTOR: 'style, link[rel=import][type~=css], template',
2546
2551
  INCLUDE_ATTR: 'include',
@@ -2648,7 +2653,7 @@ this.__lastHeadApplyNode = placeHolder;
2648
2653
  return placeHolder;
2649
2654
  },
2650
2655
  cssFromModules: function (moduleIds, warnIfNotFound) {
2651
- var modules = moduleIds.trim().split(' ');
2656
+ var modules = moduleIds.trim().split(/\s+/);
2652
2657
  var cssText = '';
2653
2658
  for (var i = 0; i < modules.length; i++) {
2654
2659
  cssText += this.cssFromModule(modules[i], warnIfNotFound);
@@ -2683,9 +2688,26 @@ cssText += this.cssFromModules(include, true);
2683
2688
  }
2684
2689
  e = e.__appliedElement || e;
2685
2690
  e.parentNode.removeChild(e);
2686
- cssText += this.resolveCss(e.textContent, element.ownerDocument);
2691
+ var css = this.resolveCss(e.textContent, element.ownerDocument);
2692
+ if (!settings.useNativeShadow && e.hasAttribute(this.SHADY_UNSCOPED_ATTR)) {
2693
+ e.textContent = css;
2694
+ document.head.insertBefore(e, document.head.firstChild);
2695
+ } else {
2696
+ cssText += css;
2697
+ }
2687
2698
  } else if (e.import && e.import.body) {
2688
- cssText += this.resolveCss(e.import.body.textContent, e.import);
2699
+ var importCss = this.resolveCss(e.import.body.textContent, e.import);
2700
+ if (!settings.useNativeShadow && e.hasAttribute(this.SHADY_UNSCOPED_ATTR)) {
2701
+ if (!this.unscopedStyleImports.has(e.import)) {
2702
+ this.unscopedStyleImports.set(e.import, true);
2703
+ var importStyle = document.createElement('style');
2704
+ importStyle.setAttribute(this.SHADY_UNSCOPED_ATTR, '');
2705
+ importStyle.textContent = importCss;
2706
+ document.head.insertBefore(importStyle, document.head.firstChild);
2707
+ }
2708
+ } else {
2709
+ cssText += importCss;
2710
+ }
2689
2711
  }
2690
2712
  }
2691
2713
  }
@@ -2881,8 +2903,31 @@ this._transformRule(rule, this._transformComplexSelector, scope, hostScope);
2881
2903
  _transformRule: function (rule, transformer, scope, hostScope) {
2882
2904
  rule.selector = rule.transformedSelector = this._transformRuleCss(rule, transformer, scope, hostScope);
2883
2905
  },
2906
+ _splitSelectorList: function (selector) {
2907
+ var parts = [];
2908
+ var part = '';
2909
+ for (var i = 0; i >= 0 && i < selector.length; i++) {
2910
+ if (selector[i] === '(') {
2911
+ var end = styleUtil._findMatchingParen(selector, i);
2912
+ part += selector.slice(i, end + 1);
2913
+ i = end;
2914
+ } else if (selector[i] === COMPLEX_SELECTOR_SEP) {
2915
+ parts.push(part);
2916
+ part = '';
2917
+ } else {
2918
+ part += selector[i];
2919
+ }
2920
+ }
2921
+ if (part) {
2922
+ parts.push(part);
2923
+ }
2924
+ if (parts.length === 0) {
2925
+ parts.push(selector);
2926
+ }
2927
+ return parts;
2928
+ },
2884
2929
  _transformRuleCss: function (rule, transformer, scope, hostScope) {
2885
- var p$ = rule.selector.split(COMPLEX_SELECTOR_SEP);
2930
+ var p$ = this._splitSelectorList(rule.selector);
2886
2931
  if (!styleUtil.isKeyframesSelector(rule)) {
2887
2932
  for (var i = 0, l = p$.length, p; i < l && (p = p$[i]); i++) {
2888
2933
  p$[i] = transformer.call(this, p, scope, hostScope);
@@ -2890,19 +2935,36 @@ p$[i] = transformer.call(this, p, scope, hostScope);
2890
2935
  }
2891
2936
  return p$.join(COMPLEX_SELECTOR_SEP);
2892
2937
  },
2938
+ _ensureScopedDir: function (s) {
2939
+ var m = s.match(DIR_PAREN);
2940
+ if (m && m[1] === '' && m[0].length === s.length) {
2941
+ s = '*' + s;
2942
+ }
2943
+ return s;
2944
+ },
2945
+ _additionalDirSelectors: function (dir, after, prefix) {
2946
+ if (!dir || !after) {
2947
+ return '';
2948
+ }
2949
+ prefix = prefix || '';
2950
+ return COMPLEX_SELECTOR_SEP + prefix + ' ' + dir + ' ' + after;
2951
+ },
2893
2952
  _transformComplexSelector: function (selector, scope, hostScope) {
2894
2953
  var stop = false;
2895
2954
  var hostContext = false;
2955
+ var dir = false;
2896
2956
  var self = this;
2897
2957
  selector = selector.trim();
2898
2958
  selector = this._slottedToContent(selector);
2899
2959
  selector = selector.replace(ROOT, ':host > *');
2900
2960
  selector = selector.replace(CONTENT_START, HOST + ' $1');
2961
+ selector = this._ensureScopedDir(selector);
2901
2962
  selector = selector.replace(SIMPLE_SELECTOR_SEP, function (m, c, s) {
2902
2963
  if (!stop) {
2903
2964
  var info = self._transformCompoundSelector(s, c, scope, hostScope);
2904
2965
  stop = stop || info.stop;
2905
2966
  hostContext = hostContext || info.hostContext;
2967
+ dir = dir || info.dir;
2906
2968
  c = info.combinator;
2907
2969
  s = info.value;
2908
2970
  } else {
@@ -2912,14 +2974,28 @@ return c + s;
2912
2974
  });
2913
2975
  if (hostContext) {
2914
2976
  selector = selector.replace(HOST_CONTEXT_PAREN, function (m, pre, paren, post) {
2915
- return pre + paren + ' ' + hostScope + post + COMPLEX_SELECTOR_SEP + ' ' + pre + hostScope + paren + post;
2977
+ var replacement = pre + paren + ' ' + hostScope + post + COMPLEX_SELECTOR_SEP + ' ' + pre + hostScope + paren + post;
2978
+ if (dir) {
2979
+ replacement += self._additionalDirSelectors(paren, post, hostScope);
2980
+ }
2981
+ return replacement;
2916
2982
  });
2917
2983
  }
2918
2984
  return selector;
2919
2985
  },
2986
+ _transformDir: function (s) {
2987
+ s = s.replace(HOST_DIR, HOST_DIR_REPLACE);
2988
+ s = s.replace(DIR_PAREN, DIR_REPLACE);
2989
+ return s;
2990
+ },
2920
2991
  _transformCompoundSelector: function (selector, combinator, scope, hostScope) {
2921
2992
  var jumpIndex = selector.search(SCOPE_JUMP);
2922
2993
  var hostContext = false;
2994
+ var dir = false;
2995
+ if (selector.match(DIR_PAREN)) {
2996
+ selector = this._transformDir(selector);
2997
+ dir = true;
2998
+ }
2923
2999
  if (selector.indexOf(HOST_CONTEXT) >= 0) {
2924
3000
  hostContext = true;
2925
3001
  } else if (selector.indexOf(HOST) >= 0) {
@@ -2935,12 +3011,12 @@ if (jumpIndex >= 0) {
2935
3011
  selector = selector.replace(SCOPE_JUMP, ' ');
2936
3012
  stop = true;
2937
3013
  }
2938
- selector = selector.replace(DIR_PAREN, DIR_REPLACE);
2939
3014
  return {
2940
3015
  value: selector,
2941
3016
  combinator: combinator,
2942
3017
  stop: stop,
2943
- hostContext: hostContext
3018
+ hostContext: hostContext,
3019
+ dir: dir
2944
3020
  };
2945
3021
  },
2946
3022
  _transformSimpleSelector: function (selector, scope) {
@@ -2977,7 +3053,7 @@ this._transformRule(rule, this._transformDocumentSelector);
2977
3053
  },
2978
3054
  normalizeRootSelector: function (rule) {
2979
3055
  rule.selector = rule.selector.replace(ROOT, 'html');
2980
- var parts = rule.selector.split(COMPLEX_SELECTOR_SEP);
3056
+ var parts = this._splitSelectorList(rule.selector);
2981
3057
  parts = parts.filter(function (part) {
2982
3058
  return !part.match(HOST_OR_HOST_GT_STAR);
2983
3059
  });
@@ -2990,11 +3066,18 @@ _slottedToContent: function (cssText) {
2990
3066
  return cssText.replace(SLOTTED_PAREN, CONTENT + '> $1');
2991
3067
  },
2992
3068
  _dirShadowTransform: function (selector) {
2993
- return selector.split(',').map(function (s) {
2994
- s = s.replace(HOST_DIR, HOST_DIR_REPLACE);
2995
- s = s.replace(DIR_PAREN, SHADOW_DIR_REPLACE);
3069
+ if (!selector.match(/:dir\(/)) {
3070
+ return selector;
3071
+ }
3072
+ return this._splitSelectorList(selector).map(function (s) {
3073
+ s = this._ensureScopedDir(s);
3074
+ s = this._transformDir(s);
3075
+ var m = HOST_CONTEXT_PAREN.exec(s);
3076
+ if (m) {
3077
+ s += this._additionalDirSelectors(m[2], m[3], '');
3078
+ }
2996
3079
  return s;
2997
- }).join(',');
3080
+ }, this).join(COMPLEX_SELECTOR_SEP);
2998
3081
  },
2999
3082
  SCOPE_NAME: 'style-scope'
3000
3083
  };
@@ -3019,9 +3102,8 @@ var CONTENT_START = new RegExp('^(' + CONTENT + ')');
3019
3102
  var SELECTOR_NO_MATCH = 'should_not_match';
3020
3103
  var SLOTTED_PAREN = /(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g;
3021
3104
  var HOST_OR_HOST_GT_STAR = /:host(?:\s*>\s*\*)?/;
3022
- var DIR_PAREN = /(.*):dir\((ltr|rtl)\)/g;
3023
- var DIR_REPLACE = '[dir="$2"] $1, $1[dir="$2"]';
3024
- var SHADOW_DIR_REPLACE = ':host-context([dir="$2"]) $1';
3105
+ var DIR_PAREN = /(.*):dir\((ltr|rtl)\)/;
3106
+ var DIR_REPLACE = ':host-context([dir="$2"]) $1';
3025
3107
  var HOST_DIR = /:host\(:dir\((rtl|ltr)\)\)/g;
3026
3108
  var HOST_DIR_REPLACE = ':host-context([dir="$1"])';
3027
3109
  return api;
@@ -3699,18 +3781,23 @@ return cssText.replace(keyframesRule.keyframesNameRx, keyframesRule.transformedK
3699
3781
  };
3700
3782
  },
3701
3783
  _scopeKeyframes: function (rule, scopeId) {
3702
- rule.keyframesNameRx = new RegExp(rule.keyframesName, 'g');
3784
+ rule.keyframesNameRx = new RegExp('\\b' + rule.keyframesName + '(?!\\B|-)', 'g');
3703
3785
  rule.transformedKeyframesName = rule.keyframesName + '-' + scopeId;
3704
3786
  rule.transformedSelector = rule.transformedSelector || rule.selector;
3705
3787
  rule.selector = rule.transformedSelector.replace(rule.keyframesName, rule.transformedKeyframesName);
3706
3788
  },
3789
+ _hasDirOrHostContext: function (parsedSelector) {
3790
+ return /:host-context|:dir/.test(parsedSelector);
3791
+ },
3707
3792
  _scopeSelector: function (rule, hostRx, hostSelector, viaAttr, scopeId) {
3708
3793
  rule.transformedSelector = rule.transformedSelector || rule.selector;
3709
3794
  var selector = rule.transformedSelector;
3710
- var scope = viaAttr ? '[' + styleTransformer.SCOPE_NAME + '~=' + scopeId + ']' : '.' + scopeId;
3795
+ var scope = styleTransformer._calcElementScope(scopeId, viaAttr);
3796
+ var hostScope = styleTransformer._calcElementScope(hostSelector, viaAttr);
3711
3797
  var parts = selector.split(',');
3798
+ var isDirOrHostContextSelector = this._hasDirOrHostContext(rule.parsedSelector);
3712
3799
  for (var i = 0, l = parts.length, p; i < l && (p = parts[i]); i++) {
3713
- parts[i] = p.match(hostRx) ? p.replace(hostSelector, scope) : scope + ' ' + p;
3800
+ parts[i] = p.match(hostRx) ? p.replace(hostSelector, scope) : isDirOrHostContextSelector ? p.replace(hostScope, scope + ' ' + hostScope) : scope + ' ' + p;
3714
3801
  }
3715
3802
  rule.selector = parts.join(',');
3716
3803
  },
@@ -4340,8 +4427,8 @@ archetype._addPropertyEffect(prop, 'function', this._createInstancePropEffector(
4340
4427
  }
4341
4428
  },
4342
4429
  _customPrepAnnotations: function (archetype, template) {
4343
- archetype._template = template;
4344
- var c = template._content;
4430
+ var t = archetype._template = document.createElement('template');
4431
+ var c = t._content = template._content;
4345
4432
  if (!c._notes) {
4346
4433
  var rootDataHost = archetype._rootDataHost;
4347
4434
  if (rootDataHost) {
@@ -1,5 +1,5 @@
1
1
  module Gobstones
2
- module Board
3
- VERSION = "0.6.0"
2
+ module Blockly
3
+ VERSION = "0.8.5"
4
4
  end
5
- end
5
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gobstones-blockly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Alfonso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-16 00:00:00.000000000 Z
11
+ date: 2018-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -68,7 +68,7 @@ files:
68
68
  - app/assets/javascripts/vendor/webcomponents.min.js
69
69
  - lib/gobstones/blockly.rb
70
70
  - lib/gobstones/blockly/version.rb
71
- homepage: https://github.com/program-ar/gs-element-blockly
71
+ homepage: https://github.com/Program-AR/gs-element-blockly
72
72
  licenses:
73
73
  - MIT
74
74
  metadata: {}
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  version: '0'
89
89
  requirements: []
90
90
  rubyforge_project:
91
- rubygems_version: 2.5.1
91
+ rubygems_version: 2.7.6
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: Gobstones Blockly