{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./srcjs/input.js","webpack:///./srcjs/react-tools.js","webpack:///./srcjs/widget.js","webpack:///external \"window.jQuery\"","webpack:///external \"window.React\"","webpack:///external \"window.ReactDOM\"","webpack:///external \"window.Shiny\""],"names":["defaultReceiveMessage","el","configuration","value","dirty","undefined","setInputConfiguration","setInputValue","getCallback","render","defaultOptions","receiveMessage","type","ratePolicy","reactShinyInput","selector","name","component","options","Object","assign","Shiny","inputBindings","register","scope","$","find","getInputValue","rateLimited","data","JSON","parse","next","text","callback","ReactDOM","call","Error","element","React","createElement","getInputConfiguration","getValue","setValue","bind","InputBinding","window","reactR","reactWidget","hydrate","components","tag","toUpperCase","hasOwnProperty","elem","args","attribs","i","children","length","push","apply","widthProperty","heightProperty","appendPx","renderOnResize","mergeOptions","merged","k","formatDimension","dim","isTag","actualOptions","HTMLWidgets","widget","factory","width","height","lastValue","instance","renderValue","resize","newWidth","newHeight"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AClFA;AACA;AACA;AACA;AAEA;;;;;;;;;AAQA,SAASA,qBAAT,CAA+BC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CAAX;AACH;AACJ;AATE,OAAP;AAWH;AA/BqB,GAA1B;AAiCH,C;;;;;;;;;;;AC9GD,+B;;;;;;;;;;;ACAA,8B;;;;;;;;;;;ACAA,iC;;;;;;;;;;;ACAA,8B","file":"react-tools.js","sourcesContent":[" \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 \t\t}\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// 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, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\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\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./srcjs/react-tools.js\");\n","import React from 'react';\r\nimport ReactDOM from 'react-dom';\r\nimport Shiny from 'shiny';\r\nimport $ from 'jquery';\r\n\r\n/*\r\n * This default receiveMessage implementation expects data to contain whole\r\n * configuration and value properties. If either is present, it will be set and\r\n * the component will be re-rendered. Because receiveMessage is typically used\r\n * by input authors to perform incremental updates, this default implementation\r\n * can be overriden by the user with the receiveMessage arguments to\r\n * reactShinyInput.\r\n */\r\nfunction defaultReceiveMessage(el, { configuration, value }) {\r\n let dirty = false;\r\n if (configuration !== undefined) {\r\n this.setInputConfiguration(el, configuration);\r\n dirty = true;\r\n }\r\n if (value !== undefined) {\r\n this.setInputValue(el, value);\r\n dirty = true;\r\n }\r\n if (dirty) {\r\n this.getCallback(el)();\r\n this.render(el);\r\n }\r\n}\r\n\r\nconst defaultOptions = {\r\n receiveMessage: defaultReceiveMessage,\r\n type: false,\r\n ratePolicy: null\r\n};\r\n\r\n/**\r\n * Installs a new Shiny input binding based on a React component.\r\n *\r\n * @param {string} selector - jQuery selector that should identify the set of\r\n * container elements within the scope argument of Shiny.InputBinding.find.\r\n * @param {string} name - A name such as 'acme.FooInput' that should uniquely\r\n * identify the component.\r\n * @param {Object} component - React Component, either class or function.\r\n * @param {Object} options - Additional configuration options. Supported\r\n * options are:\r\n * - receiveMessage: Implementation of Shiny.InputBinding to use in place of\r\n * the default. Typically overridden as an optimization to perform\r\n * incremental value updates.\r\n * - type: `false`, a string, or a function.\r\n * - `false` (the default): denotes that the value produced by this input\r\n * should not be intercepted by any handlers registered in R on the\r\n * server using shiny::registerInputHandler().\r\n * - string: denotes the input's *type* and should correspond to the\r\n * type parameter of shiny::registerInputHandler().\r\n * - function: A function called with `this` bound to the InputBinding\r\n * instance and passed a single argument, the input's containing DOM\r\n * element. The function should return either `false` or a string\r\n * corresponding to the type parameter of shiny::registerInputHandler().\r\n * - ratePolicy: A rate policy object as defined in the documentation for\r\n * getRatePolicy(): https://shiny.rstudio.com/articles/building-inputs.html\r\n * A rate policy object has two members:\r\n * - `policy`: Valid values are the strings \"direct\", \"debounce\", and\r\n * \"throttle\". \"direct\" means that all events are sent immediately.\r\n * - `delay`: Number indicating the number of milliseconds that should be\r\n * used when debouncing or throttling. Has no effect if the policy is\r\n * direct.\r\n * The specified rate policy is only applied when `true` is passed as the\r\n * second argument to the `setValue` function passed as a prop to the\r\n * input component.\r\n *\r\n */\r\nexport function reactShinyInput(selector,\r\n name,\r\n component,\r\n options) {\r\n options = Object.assign({}, defaultOptions, options);\r\n Shiny.inputBindings.register(new class extends Shiny.InputBinding {\r\n\r\n /*\r\n * Methods override those in Shiny.InputBinding\r\n */\r\n\r\n find(scope) {\r\n return $(scope).find(selector);\r\n }\r\n getValue(el) {\r\n return this.getInputValue(el);\r\n }\r\n setValue(el, value, rateLimited = false) {\r\n /*\r\n * We have to check whether $(el).data('callback') is undefined here\r\n * in case shiny::renderUI() is involved. If an input is contained in a\r\n * shiny::uiOutput(), the following strange thing happens occasionally:\r\n *\r\n * 1. setValue() is bound to an el in this.render(), below\r\n * 2. An event that will call setValue() is enqueued\r\n * 3. While the event is still enqueued, el is unbound and removed\r\n * from the DOM by the JS code associated with shiny::uiOutput()\r\n * - That code uses jQuery .html() in output_binding_html.js\r\n * - .html() removes el from the DOM and clears ist data and events\r\n * 4. By the time the setValue() bound to the original el is invoked,\r\n * el has been unbound and its data cleared.\r\n *\r\n * Since the original input is gone along with its callback, it\r\n * seems to make the most sense to do nothing.\r\n */\r\n if ($(el).data('callback') !== undefined) {\r\n this.setInputValue(el, value);\r\n this.getCallback(el)(rateLimited);\r\n this.render(el);\r\n }\r\n }\r\n initialize(el) {\r\n $(el).data('value', JSON.parse($(el).next().text()));\r\n $(el).data('configuration', JSON.parse($(el).next().next().text()));\r\n }\r\n subscribe(el, callback) {\r\n $(el).data('callback', callback);\r\n this.render(el);\r\n }\r\n unsubscribe(el) {\r\n ReactDOM.render(null, el);\r\n }\r\n receiveMessage(el, data) {\r\n options.receiveMessage.call(this, el, data);\r\n }\r\n getType(el) {\r\n if (typeof options.type === 'function') {\r\n return options.type.call(this, el);\r\n } else if (options.type === false || typeof options.type === 'string') {\r\n return options.type;\r\n } else {\r\n throw new Error('options.type must be false, a string, or a function');\r\n }\r\n }\r\n getRatePolicy() {\r\n return options.ratePolicy;\r\n }\r\n\r\n /*\r\n * Methods not present in Shiny.InputBinding but accessible to users\r\n * through `this` in receiveMessage\r\n */\r\n\r\n getInputValue(el) {\r\n return $(el).data('value');\r\n }\r\n setInputValue(el, value) {\r\n $(el).data('value', value);\r\n }\r\n getInputConfiguration(el) {\r\n return $(el).data('configuration');\r\n }\r\n setInputConfiguration(el, configuration) {\r\n $(el).data('configuration', configuration);\r\n }\r\n getCallback(el) {\r\n return $(el).data('callback');\r\n }\r\n render(el) {\r\n const element = React.createElement(component, {\r\n configuration: this.getInputConfiguration(el),\r\n value: this.getValue(el),\r\n setValue: this.setValue.bind(this, el),\r\n el: el\r\n });\r\n ReactDOM.render(element, el);\r\n }\r\n }, name);\r\n}\r\n\r\n","import { reactWidget, hydrate } from './widget';\r\nimport { reactShinyInput } from './input';\r\n\r\nwindow.reactR = {\r\n reactShinyInput: reactShinyInput,\r\n reactWidget: reactWidget,\r\n hydrate: hydrate\r\n};\r\n","/**\r\n * Recursively transforms tag, a JSON representation of an instance of a\r\n * React component and its children, into a React element suitable for\r\n * passing to ReactDOM.render.\r\n * @param {Object} components\r\n * @param {Object} tag\r\n */\r\nexport function hydrate(components, tag) {\r\n if (typeof tag === 'string') return tag;\r\n if (tag.name[0] === tag.name[0].toUpperCase()\r\n && !components.hasOwnProperty(tag.name)) {\r\n throw new Error(\"Unknown component: \" + tag.name);\r\n }\r\n var elem = components.hasOwnProperty(tag.name) ? components[tag.name] : tag.name,\r\n args = [elem, tag.attribs];\r\n for (var i = 0; i < tag.children.length; i++) {\r\n args.push(hydrate(components, tag.children[i]));\r\n }\r\n return React.createElement.apply(React, args);\r\n}\r\n\r\nexport const defaultOptions = {\r\n // The name of the property on the root tag to use for the width, if\r\n // it's updated.\r\n widthProperty: \"width\",\r\n // The name of the property on the root tag to use for the height, if\r\n // it's updated.\r\n heightProperty: \"height\",\r\n // Whether or not to append the string 'px' to the width and height\r\n // properties when they change.\r\n appendPx: false,\r\n // Whether or not to dynamically update the width and height properties\r\n // of the last known tag when the computed width and height change in\r\n // the browser.\r\n renderOnResize: false\r\n};\r\n\r\nexport function mergeOptions(options) {\r\n var merged = {};\r\n for (var k in defaultOptions) {\r\n merged[k] = defaultOptions[k];\r\n }\r\n for (var k in options) {\r\n if (!defaultOptions.hasOwnProperty(k)) {\r\n throw new Error(\"Unrecognized option: \" + k);\r\n }\r\n merged[k] = options[k];\r\n }\r\n return merged;\r\n}\r\n\r\nexport function formatDimension(dim, options) {\r\n if (options.appendPx) {\r\n return dim + 'px';\r\n } else {\r\n return dim;\r\n }\r\n}\r\n\r\nexport function isTag(value) {\r\n return (typeof value === 'object')\r\n && value.hasOwnProperty('name')\r\n && value.hasOwnProperty('attribs')\r\n && value.hasOwnProperty('children');\r\n}\r\n\r\n/**\r\n * Creates an HTMLWidget that is updated by rendering a React component.\r\n * React component constructors are made available by specifying them by\r\n * name in the components object.\r\n * @param {string} name\r\n * @param {string} type\r\n * @param {Object} components\r\n * @param {Object} options\r\n */\r\nexport function reactWidget(name, type, components, options) {\r\n var actualOptions = mergeOptions(options);\r\n window.HTMLWidgets.widget({\r\n name: name,\r\n type: type,\r\n factory: function (el, width, height) {\r\n var lastValue,\r\n instance = {},\r\n renderValue = (function (value) {\r\n if (actualOptions.renderOnResize) {\r\n // value.tag might be a primitive string, in which\r\n // case there is no attribs property.\r\n if (typeof value.tag === 'object') {\r\n value.tag.attribs[actualOptions[\"widthProperty\"]] = formatDimension(width);\r\n value.tag.attribs[actualOptions[\"heightProperty\"]] = formatDimension(height);\r\n }\r\n lastValue = value;\r\n }\r\n // with functional stateless components this will be null\r\n // see https://reactjs.org/docs/react-dom.html#render for more details\r\n this.instance.component = ReactDOM.render(hydrate(components, value.tag), el);\r\n });\r\n return {\r\n instance: instance,\r\n renderValue: renderValue,\r\n resize: function (newWidth, newHeight) {\r\n if (actualOptions.renderOnResize) {\r\n width = newWidth;\r\n height = newHeight;\r\n renderValue(lastValue);\r\n }\r\n }\r\n };\r\n }\r\n })\r\n}\r\n\r\n","module.exports = window.jQuery;","module.exports = window.React;","module.exports = window.ReactDOM;","module.exports = window.Shiny;"],"sourceRoot":""}