From a23824112d530b424ed0b61ba29ee8b9dc1a2dc5 Mon Sep 17 00:00:00 2001 From: Brett Uglow Date: Wed, 27 Jun 2018 15:12:12 +1000 Subject: [PATCH] fix(component): add support for switching multiple link or style elements that match --- config/webpack/webpack.config.js | 3 +++ confit.yml | 2 ++ dist/js/component.es5.js | 2 +- dist/js/component.es5.js.map | 2 +- dist/js/component.js | 2 +- dist/js/component.js.map | 2 +- dist/js/dark.js.map | 2 +- dist/js/dark2.js | 2 ++ dist/js/dark2.js.map | 1 + dist/js/light.js | 2 +- dist/js/light.js.map | 2 +- docs/content/component-doc.js | 6 +++--- src/index-template.html | 20 +++++++++++++++++-- .../stylesheetSwitcher.html | 16 +++++++++++---- src/modules/testHarness/styles/dark2.styl | 2 ++ src/modules/testHarness/testHarness.js | 1 + 16 files changed, 51 insertions(+), 16 deletions(-) create mode 100644 dist/js/dark2.js create mode 100644 dist/js/dark2.js.map create mode 100644 src/modules/testHarness/styles/dark2.styl diff --git a/config/webpack/webpack.config.js b/config/webpack/webpack.config.js index 87a6e70..2a1055e 100644 --- a/config/webpack/webpack.config.js +++ b/config/webpack/webpack.config.js @@ -149,6 +149,9 @@ function mergeConfig(mergeOptions) { 'dark': [ './modules/testHarness/styles/dark.styl' ], + 'dark2': [ + './modules/testHarness/styles/dark2.styl' + ], 'component': [ './modules/stylesheetSwitcher/stylesheetSwitcher.html' ] diff --git a/confit.yml b/confit.yml index e2aad82..0dcc53a 100644 --- a/confit.yml +++ b/confit.yml @@ -55,6 +55,8 @@ generator-confit: - ./modules/testHarness/styles/light.styl dark: - ./modules/testHarness/styles/dark.styl + dark2: + - ./modules/testHarness/styles/dark2.styl component: - ./modules/stylesheetSwitcher/stylesheetSwitcher.html serverDev: diff --git a/dist/js/component.es5.js b/dist/js/component.es5.js index aa45135..ceb13f9 100644 --- a/dist/js/component.es5.js +++ b/dist/js/component.es5.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.StylesheetSwitcher=t():e.StylesheetSwitcher=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}({"../node_modules/svelte/shared.js":function(e,t,n){"use strict";function r(e,t){t.appendChild(e)}function i(e,t,n){t.insertBefore(e,n)}function o(e){e.parentNode.removeChild(e)}function s(e,t,n){for(var r=n;r-1});return 1===n.length?n:null}var i=new Map;return{oncreate:function(){var e=this,r=t(this.get("persistenceKeyName"));this.observe("stylesheets",function(t){var o=[].slice.call(document.querySelectorAll("style"));i.clear(),t.forEach(function(e){if(e.linkHrefContains)i.set(e.label,document.head.querySelector('link[rel="stylesheet"][href*="'+e.linkHrefContains+'"]'));else{if(!e.styleElemContains)throw new Error('StyleSheetSwitcher.sheets."'+e+'" must contain a "linkHrefContains" property or a "styleElemContains" property which identifies the link/style element to control');i.set(e.label,n(o,e.styleElemContains))}}),r&&i.has(r)?e.setSelected(r):i.size>0&&e.setSelected(i.keys().next().value,!1)})},data:function(){return{stylesheets:[],label:"Stylesheet:",id:"sss_"+(new Date).getTime(),persistenceKeyName:"__stylesheetSwitcher"}},methods:{setSelected:function(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];i.forEach(function(e,n){e&&e.length?e.forEach(function(e){return e.disabled=n!==t}):e.disabled=n!==t}),e(this.get("persistenceKeyName"),t);var o=this.refs.selectElem;this.fire("selectionChange",{value:t}),n&&[].concat(r(o.options)).forEach(function(e,n){e.value===t&&(o.selectedIndex=n)})},getSelected:function(){var e=this.refs.selectElem;return e.options[e.selectedIndex].value}}}}();n.i(l.j)(s.prototype,a.methods,l.k),s.prototype._set=function(e){var t=this._state;this._state=n.i(l.j)({},t,e),n.i(l.l)(this,this._observers.pre,e,t),this._fragment&&this._fragment.update(e,this._state),n.i(l.l)(this,this._observers.post,e,t)},s.prototype.teardown=s.prototype.destroy=function(e){this.fire("destroy"),this._fragment.destroy(!1!==e),this._fragment=null,this._state={},this._torndown=!0},t.default=s},0:function(e,t,n){e.exports=n("./modules/stylesheetSwitcher/stylesheetSwitcher.html")}})}); +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.StylesheetSwitcher=t():e.StylesheetSwitcher=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}({"../node_modules/svelte/shared.js":function(e,t,n){"use strict";function r(e,t){t.appendChild(e)}function i(e,t,n){t.insertBefore(e,n)}function o(e){e.parentNode.removeChild(e)}function s(e,t,n){for(var r=n;r-1});return n.length?n:null}var i=new Map;return window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=function(e,t){t=t||window;for(var n=0;n0&&e.setSelected(i.keys().next().value,!1)})},data:function(){return{stylesheets:[],label:"Stylesheet:",id:"sss_"+(new Date).getTime(),persistenceKeyName:"__stylesheetSwitcher"}},methods:{setSelected:function(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];i.forEach(function(e,n){e&&e.length?e.forEach(function(e){return e.disabled=n!==t}):e.disabled=n!==t}),e(this.get("persistenceKeyName"),t);var o=this.refs.selectElem;this.fire("selectionChange",{value:t}),n&&[].concat(r(o.options)).forEach(function(e,n){e.value===t&&(o.selectedIndex=n)})},getSelected:function(){var e=this.refs.selectElem;return e.options[e.selectedIndex].value}}}}();n.i(l.j)(s.prototype,a.methods,l.k),s.prototype._set=function(e){var t=this._state;this._state=n.i(l.j)({},t,e),n.i(l.l)(this,this._observers.pre,e,t),this._fragment&&this._fragment.update(e,this._state),n.i(l.l)(this,this._observers.post,e,t)},s.prototype.teardown=s.prototype.destroy=function(e){this.fire("destroy"),this._fragment.destroy(!1!==e),this._fragment=null,this._state={},this._torndown=!0},t.default=s},0:function(e,t,n){e.exports=n("./modules/stylesheetSwitcher/stylesheetSwitcher.html")}})}); //# sourceMappingURL=component.es5.js.map \ No newline at end of file diff --git a/dist/js/component.es5.js.map b/dist/js/component.es5.js.map index 86a0a8e..dbd0c6a 100644 --- a/dist/js/component.es5.js.map +++ b/dist/js/component.es5.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///js/component.es5.js","webpack:///webpack/bootstrap 4ad14a8ee89fad0521a0","webpack:///../~/svelte/shared.js","webpack:///./modules/stylesheetSwitcher/stylesheetSwitcher.html"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","value","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","../node_modules/svelte/shared.js","__webpack_exports__","appendNode","node","target","appendChild","insertNode","anchor","insertBefore","detachNode","parentNode","removeChild","destroyEach","iterations","detach","start","length","destroy","createElement","document","createText","data","createTextNode","createComment","addEventListener","event","handler","removeEventListener","assign","arguments","source","k","differs","a","b","dispatchObservers","component","group","newState","oldState","key","newValue","oldValue","callbacks","callback","__calling","_state","fire","eventName","handlers","_handlers","slice","observe","options","defer","_observers","post","pre","push","init","cancel","index","indexOf","splice","on","set","_set","_root","_flush","_renderHooks","hook","pop","fn","context","proto","./modules/stylesheetSwitcher/stylesheetSwitcher.html","_toConsumableArray","arr","Array","isArray","arr2","from","create_main_fragment","state","change_handler","setSelected","select","label_for_value","text_value","select_id_value","div","__WEBPACK_IMPORTED_MODULE_0__mydev_code_npm_stylesheet_switcher_node_modules_svelte_shared_js__","label","htmlFor","id","text","refs","selectElem","each_block_anchor","each_block_value","stylesheets","each_block_iterations","create_each_block","mount","update","changed","sheet","sheet_index","option_value_value","option","__value","StylesheetSwitcher","template","create","_yield","_torndown","_fragment","oncreate","persistSelectedStyleSheet","keyName","window","sessionStorage","setItem","retrieveSelectedStyleSheet","getItem","findStyleRuleContainingText","styleBlocksArray","searchText","matching","filter","textContent","ssMap","Map","_this","persistedValue","sheets","styleBlocksArr","querySelectorAll","clear","forEach","linkHrefContains","head","querySelector","styleElemContains","Error","has","size","keys","next","Date","getTime","persistenceKeyName","methods","selectedKey","updateUI","undefined","styleSheetOrArray","style","disabled","concat","selectedIndex","getSelected","teardown","0"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,UAAAH,GACA,gBAAAC,SACAA,QAAA,mBAAAD,IAEAD,EAAA,mBAAAC,KACCK,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAP,OAGA,IAAAC,GAAAO,EAAAD,IACAE,EAAAF,EACAG,GAAA,EACAV,WAUA,OANAK,GAAAE,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAS,GAAA,EAGAT,EAAAD,QAvBA,GAAAQ,KA+DA,OAnCAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAG,EAAA,SAAAK,GAA2C,MAAAA,IAG3CR,EAAAS,EAAA,SAAAf,EAAAgB,EAAAC,GACAX,EAAAY,EAAAlB,EAAAgB,IACAG,OAAAC,e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qB,EAAS5C,UAAQsF,QAAC,SAAO9B,EAAOhD,GAClCgD,EAAM/H,QAAgB2K,IACpBxD,EAAc+D,cAASnG,MAK9BoG,YAAA,WACT,GAAchE,GAAO7H,KAAK4H,KAAYC,UACtC,OAAiBA,GAAQ5C,QAAW4C,EAAe+D,eAAOlL,WHydlER,GAAoBG,EAAEkH,EAAgH,GAAGoB,EAAmBnH,UAAWoH,EAASwC,QAAS7D,EAA+G,GAExSoB,EAAmBnH,UAAUsE,KAAO,SAAc5B,GACjD,GAAIC,GAAWnE,KAAK0E,MACpB1E,MAAK0E,OAASxE,EAAoBG,EAAEkH,EAAgH,MAAOpD,EAAUD,GACrKhE,EAAoBG,EAAEkH,EAA2H,GAAGvH,KAAMA,KAAKmF,WAAWE,IAAKnB,EAAUC,GACrLnE,KAAKgJ,WAAWhJ,KAAKgJ,UAAUZ,OAAOlE,EAAUlE,KAAK0E,QACzDxE,EAAoBG,EAAEkH,EAA2H,GAAGvH,KAAMA,KAAKmF,WAAWC,KAAMlB,EAAUC,IAG3LwE,EAAmBnH,UAAUsK,SAAWnD,EAAmBnH,UAAUqB,QAAU,SAAiBH,GAC/F1C,KAAK2E,KAAK,WAEV3E,KAAKgJ,UAAUnG,SAAmB,IAAXH,GACvB1C,KAAKgJ,UAAY,KAEjBhJ,KAAK0E,UACL1E,KAAK+I,WAAY,GAGWlH,EAA6B,QAAI8G,GAIxDoD,EACA,SAAUlM,EAAQD,EAASM,GAEjCL,EAAOD,QAAUM,EAAoB","file":"js/component.es5.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"StylesheetSwitcher\"] = factory();\n\telse\n\t\troot[\"StylesheetSwitcher\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"StylesheetSwitcher\"] = factory();\n\telse\n\t\troot[\"StylesheetSwitcher\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 0);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ \"../node_modules/svelte/shared.js\":\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* unused harmony export noop */\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"j\", function() { return assign; });\n/* unused harmony export differs */\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"l\", function() { return dispatchObservers; });\n/* unused harmony export get */\n/* unused harmony export fire */\n/* unused harmony export observe */\n/* unused harmony export observeDev */\n/* unused harmony export on */\n/* unused harmony export onDev */\n/* unused harmony export set */\n/* unused harmony export _flush */\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"k\", function() { return proto; });\n/* unused harmony export protoDev */\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return appendNode; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"f\", function() { return insertNode; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"i\", function() { return detachNode; });\n/* unused harmony export detachBetween */\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"g\", function() { return destroyEach; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return createElement; });\n/* unused harmony export createSvgElement */\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"c\", function() { return createText; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"e\", function() { return createComment; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"d\", function() { return addEventListener; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"h\", function() { return removeEventListener; });\n/* unused harmony export setAttribute */\n/* unused harmony export setXlinkAttribute */\n/* unused harmony export getBindingGroupValue */\nfunction appendNode ( node, target ) {\n\ttarget.appendChild( node );\n}\n\nfunction insertNode ( node, target, anchor ) {\n\ttarget.insertBefore( node, anchor );\n}\n\nfunction detachNode ( node ) {\n\tnode.parentNode.removeChild( node );\n}\n\nfunction detachBetween ( before, after ) {\n\twhile ( before.nextSibling && before.nextSibling !== after ) {\n\t\tbefore.parentNode.removeChild( before.nextSibling );\n\t}\n}\n\nfunction destroyEach ( iterations, detach, start ) {\n\tfor ( var i = start; i < iterations.length; i += 1 ) {\n\t\titerations[i].destroy( detach );\n\t}\n}\n\nfunction createElement ( name ) {\n\treturn document.createElement( name );\n}\n\nfunction createSvgElement ( name ) {\n\treturn document.createElementNS( 'http://www.w3.org/2000/svg', name );\n}\n\nfunction createText ( data ) {\n\treturn document.createTextNode( data );\n}\n\nfunction createComment () {\n\treturn document.createComment( '' );\n}\n\nfunction addEventListener ( node, event, handler ) {\n\tnode.addEventListener( event, handler, false );\n}\n\nfunction removeEventListener ( node, event, handler ) {\n\tnode.removeEventListener( event, handler, false );\n}\n\nfunction setAttribute ( node, attribute, value ) {\n\tnode.setAttribute( attribute, value );\n}\n\nfunction setXlinkAttribute ( node, attribute, value ) {\n\tnode.setAttributeNS( 'http://www.w3.org/1999/xlink', attribute, value );\n}\n\nfunction getBindingGroupValue ( group ) {\n\tvar value = [];\n\tfor ( var i = 0; i < group.length; i += 1 ) {\n\t\tif ( group[i].checked ) value.push( group[i].__value );\n\t}\n\treturn value;\n}\n\nfunction noop () {}\n\nfunction assign ( target ) {\n\tfor ( var i = 1; i < arguments.length; i += 1 ) {\n\t\tvar source = arguments[i];\n\t\tfor ( var k in source ) target[k] = source[k];\n\t}\n\n\treturn target;\n}\n\nfunction differs ( a, b ) {\n\treturn ( a !== b ) || ( a && ( typeof a === 'object' ) || ( typeof a === 'function' ) );\n}\n\nfunction dispatchObservers ( component, group, newState, oldState ) {\n\tfor ( var key in group ) {\n\t\tif ( !( key in newState ) ) continue;\n\n\t\tvar newValue = newState[ key ];\n\t\tvar oldValue = oldState[ key ];\n\n\t\tif ( differs( newValue, oldValue ) ) {\n\t\t\tvar callbacks = group[ key ];\n\t\t\tif ( !callbacks ) continue;\n\n\t\t\tfor ( var i = 0; i < callbacks.length; i += 1 ) {\n\t\t\t\tvar callback = callbacks[i];\n\t\t\t\tif ( callback.__calling ) continue;\n\n\t\t\t\tcallback.__calling = true;\n\t\t\t\tcallback.call( component, newValue, oldValue );\n\t\t\t\tcallback.__calling = false;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction get ( key ) {\n\treturn key ? this._state[ key ] : this._state;\n}\n\nfunction fire ( eventName, data ) {\n\tvar handlers = eventName in this._handlers && this._handlers[ eventName ].slice();\n\tif ( !handlers ) return;\n\n\tfor ( var i = 0; i < handlers.length; i += 1 ) {\n\t\thandlers[i].call( this, data );\n\t}\n}\n\nfunction observe ( key, callback, options ) {\n\tvar group = ( options && options.defer ) ? this._observers.post : this._observers.pre;\n\n\t( group[ key ] || ( group[ key ] = [] ) ).push( callback );\n\n\tif ( !options || options.init !== false ) {\n\t\tcallback.__calling = true;\n\t\tcallback.call( this, this._state[ key ] );\n\t\tcallback.__calling = false;\n\t}\n\n\treturn {\n\t\tcancel: function () {\n\t\t\tvar index = group[ key ].indexOf( callback );\n\t\t\tif ( ~index ) group[ key ].splice( index, 1 );\n\t\t}\n\t};\n}\n\nfunction observeDev ( key, callback, options ) {\n\tvar c = ( key = '' + key ).search( /[^\\w]/ );\n\tif ( c > -1 ) {\n\t\tvar message = \"The first argument to component.observe(...) must be the name of a top-level property\";\n\t\tif ( c > 0 ) message += \", i.e. '\" + key.slice( 0, c ) + \"' rather than '\" + key + \"'\";\n\n\t\tthrow new Error( message );\n\t}\n\n\treturn observe.call( this, key, callback, options );\n}\n\nfunction on ( eventName, handler ) {\n\tif ( eventName === 'teardown' ) return this.on( 'destroy', handler );\n\n\tvar handlers = this._handlers[ eventName ] || ( this._handlers[ eventName ] = [] );\n\thandlers.push( handler );\n\n\treturn {\n\t\tcancel: function () {\n\t\t\tvar index = handlers.indexOf( handler );\n\t\t\tif ( ~index ) handlers.splice( index, 1 );\n\t\t}\n\t};\n}\n\nfunction onDev ( eventName, handler ) {\n\tif ( eventName === 'teardown' ) {\n\t\tconsole.warn( \"Use component.on('destroy', ...) instead of component.on('teardown', ...) which has been deprecated and will be unsupported in Svelte 2\" );\n\t\treturn this.on( 'destroy', handler );\n\t}\n\n\treturn on.call( this, eventName, handler );\n}\n\nfunction set ( newState ) {\n\tthis._set( assign( {}, newState ) );\n\t( this._root || this )._flush();\n}\n\nfunction _flush () {\n\tif ( !this._renderHooks ) return;\n\n\twhile ( this._renderHooks.length ) {\n\t\tvar hook = this._renderHooks.pop();\n\t\thook.fn.call( hook.context );\n\t}\n}\n\nvar proto = {\n\tget: get,\n\tfire: fire,\n\tobserve: observe,\n\ton: on,\n\tset: set,\n\t_flush: _flush\n};\n\nvar protoDev = {\n\tget: get,\n\tfire: fire,\n\tobserve: observeDev,\n\ton: onDev,\n\tset: set,\n\t_flush: _flush\n};\n\n\n\n\n/***/ }),\n\n/***/ \"./modules/stylesheetSwitcher/stylesheetSwitcher.html\":\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__mydev_code_npm_stylesheet_switcher_node_modules_svelte_shared_js__ = __webpack_require__(\"../node_modules/svelte/shared.js\");\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\n\n\nvar template = function () {\n\t// This is a test of the Svelte framework to evaluate how it can be integrated with other frameworks\n\n\t// Create a map of all the stylesheets, so we can enable one of them and disable the others\n\tvar ssMap = new Map();\n\n\tfunction persistSelectedStyleSheet(keyName, value) {\n\t\twindow.sessionStorage.setItem(keyName, value);\n\t}\n\n\tfunction retrieveSelectedStyleSheet(keyName) {\n\t\treturn window.sessionStorage.getItem(keyName);\n\t}\n\n\tfunction findStyleRuleContainingText(styleBlocksArray, searchText) {\n\t\tvar matching = styleBlocksArray.filter(function (sheet) {\n\t\t\treturn (sheet.textContent || '').indexOf(searchText) > -1;\n\t\t});\n\n\t\treturn matching.length === 1 ? matching : null; // We can match multiple - + + + + diff --git a/src/modules/stylesheetSwitcher/stylesheetSwitcher.html b/src/modules/stylesheetSwitcher/stylesheetSwitcher.html index 3df6757..88fb407 100644 --- a/src/modules/stylesheetSwitcher/stylesheetSwitcher.html +++ b/src/modules/stylesheetSwitcher/stylesheetSwitcher.html @@ -8,8 +8,6 @@