code
stringlengths
28
313k
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
74
language
stringclasses
1 value
repo
stringlengths
5
60
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
function mycallback(error, object) { if (!callback) return; if (error || !object) callback(null); else callback(WebInspector.RemoteObject.fromPayload(object)); }
@param {?Protocol.Error} error @param {RuntimeAgent.RemoteObject} object
mycallback
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/RemoteObject.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/RemoteObject.js
MIT
function remoteObjectBinder(error, properties) { if (error) { callback(null); return; } var result = []; for (var i = 0; properties && i < properties.length; ++i) { var property = properties[i]; if (p...
@param {?Protocol.Error} error @param {Array.<WebInspector.RemoteObjectProperty>} properties
remoteObjectBinder
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/RemoteObject.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/RemoteObject.js
MIT
function evaluatedCallback(error, result, wasThrown) { if (error || wasThrown) { callback(error || result.description); return; } function setPropertyValue(propertyName, propertyValue) { this[propertyName] = propert...
@param {?Protocol.Error} error @param {RuntimeAgent.RemoteObject} result @param {boolean=} wasThrown
evaluatedCallback
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/RemoteObject.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/RemoteObject.js
MIT
function mycallback(error, result, wasThrown) { callback((error || wasThrown) ? null : WebInspector.RemoteObject.fromPayload(result)); }
@param {function(*)} functionDeclaration @param {Array.<RuntimeAgent.CallArgument>|undefined} args @param {function(?WebInspector.RemoteObject)} callback
mycallback
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/RemoteObject.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/RemoteObject.js
MIT
function mycallback(error, result, wasThrown) { callback((error || wasThrown) ? null : result.value); }
@param {function(*)} functionDeclaration @param {Array.<RuntimeAgent.CallArgument>|undefined} args @param {function(*)} callback
mycallback
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/RemoteObject.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/RemoteObject.js
MIT
function persist() { window.localStorage["resource-history"] = JSON.stringify(filteredRegistry); }
@param {number} type @param {WebInspector.ResourceDomainModelBinding} binding
persist
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/Resource.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/Resource.js
MIT
function parseNameValue(pair) { var parameter = {}; var splitPair = pair.split("=", 2); parameter.name = splitPair[0]; if (splitPair.length === 1) parameter.value = ""; else parameter.value = splitPair[1]; r...
@param {string} queryString @return {Array.<Object>}
parseNameValue
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/Resource.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/Resource.js
MIT
get titleText() { return this._titleText; }
@constructor @extends {TreeElement} @param {boolean=} hasChildren @param {boolean=} noIcon
titleText
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/ResourcesPanel.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/ResourcesPanel.js
MIT
get itemURL() { return "category://" + this._categoryName; }
@constructor @extends {WebInspector.BaseStorageTreeElement} @param {boolean=} noIcon
itemURL
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/ResourcesPanel.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/ResourcesPanel.js
MIT
function callback(resource) { if (resource.path === url) { resourceURL = resource.url; return true; } }
@return {?string} null if the specified resource MUST NOT have a URL (e.g. "javascript:...")
callback
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/ResourceUtils.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/ResourceUtils.js
MIT
function didEditScriptSource(error, callFrames) { if (!error) this._source = newSource; callback(error, callFrames); }
@this {WebInspector.Script} @param {?Protocol.Error} error @param {Array.<DebuggerAgent.CallFrame>|undefined} callFrames
didEditScriptSource
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/Script.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/Script.js
MIT
function typeWeight(treeElement) { if (treeElement instanceof WebInspector.NavigatorFolderTreeElement) { if (treeElement.isDomain) return 1; return 2; } return 3; }
@constructor @extends {TreeOutline} @param {Element} element
typeWeight
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/ScriptsNavigator.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/ScriptsNavigator.js
MIT
function viewGetter() { return this.visibleView; }
@constructor @implements {WebInspector.EditorContainerDelegate} @extends {WebInspector.Panel}
viewGetter
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/ScriptsPanel.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/ScriptsPanel.js
MIT
function contentCallback(mimeType, content) { if (this._outlineWorker) this._outlineWorker.terminate(); this._outlineWorker = new Worker("ScriptFormatterWorker.js"); this._outlineWorker.onmessage = this._didBuildOutlineChunk.bind(this); const metho...
@param {WebInspector.UISourceCode} uiSourceCode @return {WebInspector.SourceFrame}
contentCallback
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/ScriptsPanel.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/ScriptsPanel.js
MIT
get defaultFocusedElement() { return this._filesSelectElement; }
@implements {WebInspector.ScriptsPanel.FileSelector} @extends {WebInspector.Object} @constructor
defaultFocusedElement
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/ScriptsPanel.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/ScriptsPanel.js
MIT
function filterOutContentScripts(uiSourceCode) { return !uiSourceCode.isContentScript; }
@param {WebInspector.SearchConfig} searchConfig @param {function(Object)} searchResultCallback @param {function(boolean)} searchFinishedCallback
filterOutContentScripts
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/ScriptsSearchScope.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/ScriptsSearchScope.js
MIT
set small(x) { this._small = x; if (this._listItemNode) { if (this._small) this._listItemNode.addStyleClass("small"); else this._listItemNode.removeStyleClass("small"); } }
@constructor @extends {TreeElement} @param {string=} subtitle @param {Object=} representedObject @param {boolean=} hasChildren
small
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/SidebarTreeElement.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/SidebarTreeElement.js
MIT
function consume(e) { e.consume(true); }
@param {Function=} onmove @param {Function=} onstart @param {Function=} onstop
consume
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/Spectrum.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/Spectrum.js
MIT
get disabled() { return this._disabled; }
@extends {WebInspector.Object} @constructor @param {number=} states
disabled
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/StatusBarButton.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/StatusBarButton.js
MIT
function computedStyleCallback(computedStyle) { delete this._refreshUpdateInProgress; if (this._lastNodeForInnerRefresh) { delete this._lastNodeForInnerRefresh; this._refreshUpdate(editedSection, forceFetchComputedStyle, userCallback); ret...
@param {WebInspector.StylePropertiesSection=} editedSection @param {boolean=} forceFetchComputedStyle @param {function()=} userCallback
computedStyleCallback
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/StylesSidebarPane.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/StylesSidebarPane.js
MIT
get inherited() { return this._inherited; }
@constructor @extends {TreeElement} @param {?WebInspector.StylesSidebarPane} parentPane
inherited
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/StylesSidebarPane.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/StylesSidebarPane.js
MIT
get text() { return this._element.textContent; }
Clients should never attach any event listeners to the |element|. Instead, they should use the result of this method to attach listeners for bubbling events or the |blurListener| parameter to register a "blur" event listener on the |element| (since the "blur" event does not bubble.) @param {Element} element @param {fu...
text
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/TextPrompt.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/TextPrompt.js
MIT
get historyData() { // FIXME: do we need to copy this? return this._data; }
Whether to coalesce duplicate items in the history, default is true. @type {boolean}
historyData
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/TextPrompt.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/TextPrompt.js
MIT
function updateBoundaries(record) { this._overviewCalculator.updateBoundaries(record); return false; }
@constructor @extends {WebInspector.Object} @implements {WebInspector.TimelinePresentationModel.Filter}
updateBoundaries
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/TimelineOverviewPane.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/TimelineOverviewPane.js
MIT
function getContent(element) { if (element.tagName === "INPUT" && element.type === "text") return element.value; else return element.textContent; }
@param {Element} element @param {WebInspector.EditingConfig=} config
getContent
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/UIUtils.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/UIUtils.js
MIT
function windowLoaded() { window.addEventListener("focus", WebInspector._windowFocused, false); window.addEventListener("blur", WebInspector._windowBlurred, false); document.addEventListener("focus", WebInspector._focusChanged.bind(this), true); window.removeEventListener("DOMContentLoaded", windowLoade...
@param {WebInspector.ContextMenu} contextMenu @param {Node} contextNode @param {Event} event
windowLoaded
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/UIUtils.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/UIUtils.js
MIT
function highlightSearchResult(element, offset, length, domChanges) { var result = highlightSearchResults(element, [{offset: offset, length: length }], domChanges); return result.length ? result[0] : null; }
@param {Element} element @param {number} offset @param {number} length @param {Array.<Object>=} domChanges
highlightSearchResult
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/utilities.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/utilities.js
MIT
function highlightSearchResults(element, resultRanges, changes) { return highlightRangesWithStyleClass(element, resultRanges, "webkit-search-result", changes); }
@param {Element} element @param {Array.<Object>} resultRanges @param {Array.<Object>=} changes
highlightSearchResults
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/utilities.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/utilities.js
MIT
function highlightRangesWithStyleClass(element, resultRanges, styleClass, changes) { changes = changes || []; var highlightNodes = []; var lineText = element.textContent; var ownerDocument = element.ownerDocument; var textNodeSnapshot = ownerDocument.evaluate(".//text()", element, null, XPathResult....
@param {Element} element @param {Array.<Object>} resultRanges @param {string} styleClass @param {Array.<Object>=} changes
highlightRangesWithStyleClass
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/utilities.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/utilities.js
MIT
function createPlainTextSearchRegex(query, flags) { // This should be kept the same as the one in ContentSearchUtils.cpp. var regexSpecialCharacters = "[](){}+-*.,?\\^$|"; var regex = ""; for (var i = 0; i < query.length; ++i) { var c = query.charAt(i); if (regexSpecialCharacters.indexOf...
@param {string} query @param {string=} flags @return {RegExp}
createPlainTextSearchRegex
javascript
node-pinus/pinus
tools/pinus-admin-web/public/front/utilities.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/utilities.js
MIT
function calcLengthLength (length) { if (length >= 0 && length < 128) return 1 else if (length >= 128 && length < 16384) return 2 else if (length >= 16384 && length < 2097152) return 3 else if (length >= 2097152 && length < 268435456) return 4 else return 0 }
calcLengthLength - calculate the length of the remaining length field @api private
calcLengthLength
javascript
node-pinus/pinus
tools/pinus-admin-web/public/js/util/browserMqtt.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/js/util/browserMqtt.js
MIT
function writeLength (stream, length) { var buffer = lengthCache[length] if (!buffer) { buffer = genBufLength(length) if (length < 16384) lengthCache[length] = buffer } stream.write(buffer) }
writeLength - write an MQTT style length field to the buffer @param <Buffer> buffer - destination @param <Number> pos - offset @param <Number> length - length (>0) @returns <Number> number of bytes written @api private
writeLength
javascript
node-pinus/pinus
tools/pinus-admin-web/public/js/util/browserMqtt.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/js/util/browserMqtt.js
MIT
function writeString (stream, string) { var strlen = Buffer.byteLength(string) writeNumber(stream, strlen) stream.write(string, 'utf8') }
writeString - write a utf8 string to the buffer @param <Buffer> buffer - destination @param <Number> pos - offset @param <String> string - string to write @return <Number> number of bytes written @api private
writeString
javascript
node-pinus/pinus
tools/pinus-admin-web/public/js/util/browserMqtt.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/js/util/browserMqtt.js
MIT
function writeNumber (stream, number) { return stream.write(numCache[number]) }
writeNumber - write a two byte number to the buffer @param <Buffer> buffer - destination @param <Number> pos - offset @param <String> number - number to write @return <Number> number of bytes written @api private
writeNumber
javascript
node-pinus/pinus
tools/pinus-admin-web/public/js/util/browserMqtt.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/js/util/browserMqtt.js
MIT
function writeStringOrBuffer (stream, toWrite) { if (toWrite && typeof toWrite === 'string') writeString(stream, toWrite) else if (toWrite) { writeNumber(stream, toWrite.length) stream.write(toWrite) } else writeNumber(stream, 0) }
writeStringOrBuffer - write a String or Buffer with the its length prefix @param <Buffer> buffer - destination @param <Number> pos - offset @param <String> toWrite - String or Buffer @return <Number> number of bytes written
writeStringOrBuffer
javascript
node-pinus/pinus
tools/pinus-admin-web/public/js/util/browserMqtt.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/js/util/browserMqtt.js
MIT
function MqttClient (streamBuilder, options) { var k var that = this if (!(this instanceof MqttClient)) { return new MqttClient(streamBuilder, options) } this.options = options || {} // Defaults for (k in defaultConnectOptions) { if (typeof this.options[k] === 'undefined') { this.options[...
MqttClient constructor @param {Stream} stream - stream @param {Object} [options] - connection options (see Connection#connect)
MqttClient
javascript
node-pinus/pinus
tools/pinus-admin-web/public/js/util/browserMqtt.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/js/util/browserMqtt.js
MIT
function process () { var packet = packets.shift() var done = completeParse if (packet) { that._handlePacket(packet, process) } else { completeParse = null done() } }
setup the event handlers in the inner stream. @api private
process
javascript
node-pinus/pinus
tools/pinus-admin-web/public/js/util/browserMqtt.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/js/util/browserMqtt.js
MIT
function closeStores () { that.disconnected = true that.incomingStore.close(function () { that.outgoingStore.close(cb) }) }
end - close connection @returns {MqttClient} this - for chaining @param {Boolean} force - do not wait for all in-flight messages to be acked @param {Function} cb - called when the client has been closed @api public
closeStores
javascript
node-pinus/pinus
tools/pinus-admin-web/public/js/util/browserMqtt.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/js/util/browserMqtt.js
MIT
function Store () { if (!(this instanceof Store)) { return new Store() } this._inflights = {} }
In-memory implementation of the message store This can actually be saved into files.
Store
javascript
node-pinus/pinus
tools/pinus-admin-web/public/js/util/browserMqtt.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/js/util/browserMqtt.js
MIT
function validateTopic (topic) { var parts = topic.split('/') for (var i = 0; i < parts.length; i++) { if (parts[i] === '+') { continue } if (parts[i] === '#') { // for Rule #2 return i === parts.length - 1 } if (parts[i].indexOf('+') !== -1 || parts[i].indexOf('#') !== -1) ...
Validate a topic to see if it's valid or not. A topic is valid if it follow below rules: - Rule #1: If any part of the topic is not `+` or `#`, then it must not contain `+` and '#' - Rule #2: Part `#` must be located at the end of the mailbox @param {String} topic - A topic @returns {Boolean} If the topic is valid, re...
validateTopic
javascript
node-pinus/pinus
tools/pinus-admin-web/public/js/util/browserMqtt.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/js/util/browserMqtt.js
MIT
function validateTopics (topics) { if (topics.length === 0) { return 'empty_topic_list' } for (var i = 0; i < topics.length; i++) { if (!validateTopic(topics[i])) { return topics[i] } } return null }
Validate an array of topics to see if any of them is valid or not @param {Array} topics - Array of topics @returns {String} If the topics is valid, returns null. Otherwise, returns the invalid one
validateTopics
javascript
node-pinus/pinus
tools/pinus-admin-web/public/js/util/browserMqtt.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/js/util/browserMqtt.js
MIT
function parseAuthOptions (opts) { var matches if (opts.auth) { matches = opts.auth.match(/^(.+):(.+)$/) if (matches) { opts.username = matches[1] opts.password = matches[2] } else { opts.username = opts.auth } } }
Parse the auth attribute and merge username and password in the options object. @param {Object} [opts] option object
parseAuthOptions
javascript
node-pinus/pinus
tools/pinus-admin-web/public/js/util/browserMqtt.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/js/util/browserMqtt.js
MIT
function connect (brokerUrl, opts) { if ((typeof brokerUrl === 'object') && !opts) { opts = brokerUrl brokerUrl = null } opts = opts || {} if (brokerUrl) { opts = xtend(url.parse(brokerUrl, true), opts) if (opts.protocol === null) { throw new Error('Missing protocol') } opts.prot...
connect - connect to an MQTT broker. @param {String} [brokerUrl] - url of the broker, optional @param {Object} opts - see MqttClient#constructor
connect
javascript
node-pinus/pinus
tools/pinus-admin-web/public/js/util/browserMqtt.js
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/js/util/browserMqtt.js
MIT
function prepareMoveTransition (frags) { var transition = transitionEndEvent && // css transition supported? frags && frags.length && // has frags to be moved? frags[0].node.__v_trans // has transitions? if (transition) { var node = frags[0].node var moveClass = trans...
Check if move transitions are needed, and if so, record the bounding client rects for each item. @param {Array<Fragment>|undefined} frags @return {Boolean|undefined}
prepareMoveTransition
javascript
vuejs/vue-animated-list
vue-animated-list.js
https://github.com/vuejs/vue-animated-list/blob/master/vue-animated-list.js
MIT
function applyMoveTransition (frags) { frags.forEach(function (frag) { frag._newPos = frag.node.getBoundingClientRect() }) frags.forEach(function (frag) { var node = frag.node var oldPos = frag._oldPos if (!oldPos) return if (!frag.moved) { // transiti...
Apply move transitions. Calculate new target positions after the move, then apply the FLIP technique to trigger CSS transforms. @param {Array<Fragment>} frags
applyMoveTransition
javascript
vuejs/vue-animated-list
vue-animated-list.js
https://github.com/vuejs/vue-animated-list/blob/master/vue-animated-list.js
MIT
countObjProps = function (obj) { var k, l = 0; for (k in obj) { if (obj.hasOwnProperty(k)) { l++; } } return l; }
@name Hyphenator-docLanguages @description An object holding all languages used in the document. This is filled by {@link Hyphenator-gatherDocumentInfos} @type {Object} @private
countObjProps
javascript
cmod/bibliotype
js/Hyphenator.js
https://github.com/cmod/bibliotype/blob/master/js/Hyphenator.js
MIT
createElem = function (tagname, context) { context = context || contextWindow; if (document.createElementNS) { return context.document.createElementNS('http://www.w3.org/1999/xhtml', tagname); } else if (document.createElement) { return context.document.createElement(tagname); } }
@name Hyphenator-onHyphenationDone @description A method to be called, when the last element has been hyphenated or the hyphenation has been removed from the last element. @see Hyphenator.config @type {function()} @private
createElem
javascript
cmod/bibliotype
js/Hyphenator.js
https://github.com/cmod/bibliotype/blob/master/js/Hyphenator.js
MIT
onError = function (e) { window.alert("Hyphenator.js says:\n\nAn Error ocurred:\n" + e.message); }
@name Hyphenator-selectorFunction @description A function that has to return a HTMLNodeList of Elements to be hyphenated. By default it uses the classname ('hyphenate') to select the elements. @see Hyphenator.config @type {function()} @private
onError
javascript
cmod/bibliotype
js/Hyphenator.js
https://github.com/cmod/bibliotype/blob/master/js/Hyphenator.js
MIT
getLang = function (el, fallback) { if (!!el.getAttribute('lang')) { return el.getAttribute('lang').toLowerCase(); } // The following doesn't work in IE due to a bug when getAttribute('xml:lang') in a table /*if (!!el.getAttribute('xml:lang')) { return el.getAttribute('xml:lang').substring(0, 2); }*/ ...
@name Hyphenator-getLang @description Gets the language of an element. If no language is set, it may use the {@link Hyphenator-mainLanguage}. @param {Object} el The first parameter is an DOM-Element-Object @param {boolean} fallback The second parameter is a boolean to tell if the function should return the {@link Hyphe...
getLang
javascript
cmod/bibliotype
js/Hyphenator.js
https://github.com/cmod/bibliotype/blob/master/js/Hyphenator.js
MIT
autoSetMainLanguage = function (w) { w = w || contextWindow; var el = w.document.getElementsByTagName('html')[0], m = w.document.getElementsByTagName('meta'), i, text, e, ul; mainLanguage = getLang(el, false); if (!mainLanguage) { for (i = 0; i < m.length; i++) { //<meta http-equiv = "content-langu...
@name Hyphenator-autoSetMainLanguage @description Retrieves the language of the document from the DOM. The function looks in the following places: <ul> <li>lang-attribute in the html-tag</li> <li>&lt;meta http-equiv = "content-language" content = "xy" /&gt;</li> <li>&lt;meta name = "DC.Language" content = "xy" /&gt;</l...
autoSetMainLanguage
javascript
cmod/bibliotype
js/Hyphenator.js
https://github.com/cmod/bibliotype/blob/master/js/Hyphenator.js
MIT
gatherDocumentInfos = function () { var elToProcess, tmp, i = 0, process = function (el, hide, lang) { var n, i = 0, hyphenatorSettings = {}; if (hide && intermediateState === 'hidden') { if (!!el.getAttribute('style')) { hyphenatorSettings.hasOwnStyle = true; } else { hyphenatorSettings.has...
@name Hyphenator-gatherDocumentInfos @description This method runs through the DOM and executes the process()-function on: - every node returned by the {@link Hyphenator-selectorFunction}. The process()-function copies the element to the elements-variable, sets its visibility to intermediateState, retrieves its languag...
gatherDocumentInfos
javascript
cmod/bibliotype
js/Hyphenator.js
https://github.com/cmod/bibliotype/blob/master/js/Hyphenator.js
MIT
convertPatterns = function (lang) { var plen, anfang, ende, pats, pat, key, tmp = {}; pats = Hyphenator.languages[lang].patterns; for (plen in pats) { if (pats.hasOwnProperty(plen)) { plen = parseInt(plen, 10); anfang = 0; ende = plen; while (!!(pat = pats[plen].substring(anfang, ende))) { ...
@name Hyphenator-convertPatterns @description Converts the patterns from string '_a6' to object '_a':'_a6'. The result is stored in the {@link Hyphenator-patterns}-object. @private @param {string} lang the language whose patterns shall be converted
convertPatterns
javascript
cmod/bibliotype
js/Hyphenator.js
https://github.com/cmod/bibliotype/blob/master/js/Hyphenator.js
MIT
convertExceptionsToObject = function (exc) { var w = exc.split(', '), r = {}, i, l, key; for (i = 0, l = w.length; i < l; i++) { key = w[i].replace(/-/g, ''); if (!r.hasOwnProperty(key)) { r[key] = w[i]; } } return r; }
@name Hyphenator-convertExceptionsToObject @description Converts a list of comma seprated exceptions to an object: 'Fortran,Hy-phen-a-tion' -> {'Fortran':'Fortran','Hyphenation':'Hy-phen-a-tion'} @private @param {string} exc a comma separated string of exceptions (without spaces)
convertExceptionsToObject
javascript
cmod/bibliotype
js/Hyphenator.js
https://github.com/cmod/bibliotype/blob/master/js/Hyphenator.js
MIT
loadPatterns = function (lang) { var url, xhr, head, script; if (supportedLang[lang] && !Hyphenator.languages[lang]) { url = basePath + 'patterns/' + supportedLang[lang]; } else { return; } if (isLocal && !isBookmarklet) { //check if 'url' is available: xhr = null; if (typeof XMLHttpReque...
@name Hyphenator-loadPatterns @description Adds a &lt;script&gt;-Tag to the DOM to load an externeal .js-file containing patterns and settings for the given language. If the given language is not in the {@link Hyphenator-supportedLang}-Object it returns. One may ask why we are not using AJAX to load the patterns. The X...
loadPatterns
javascript
cmod/bibliotype
js/Hyphenator.js
https://github.com/cmod/bibliotype/blob/master/js/Hyphenator.js
MIT
prepareLanguagesObj = function (lang) { var lo = Hyphenator.languages[lang], wrd; if (!lo.prepared) { if (enableCache) { lo.cache = {}; //Export lo['cache'] = lo.cache; } if (enableReducedPatternSet) { lo.redPatSet = {}; } //add exceptions from the pattern file to the local 'exceptio...
@name Hyphenator-prepareLanguagesObj @description Adds a cache to each language and converts the exceptions-list to an object. If storage is active the object is stored there. @private @param {string} lang the language ob the lang-obj
prepareLanguagesObj
javascript
cmod/bibliotype
js/Hyphenator.js
https://github.com/cmod/bibliotype/blob/master/js/Hyphenator.js
MIT
prepare = function (callback) { var lang, interval, tmp1, tmp2; if (!enableRemoteLoading) { for (lang in Hyphenator.languages) { if (Hyphenator.languages.hasOwnProperty(lang)) { prepareLanguagesObj(lang); } } state = 2; callback(); return; } // get all languages that are used and pre...
@name Hyphenator-prepare @description This funtion prepares the Hyphenator-Object: If RemoteLoading is turned off, it assumes that the patternfiles are loaded, all conversions are made and the callback is called. If storage is active the object is retrieved there. If RemoteLoading is on (default), it loads the pattern ...
prepare
javascript
cmod/bibliotype
js/Hyphenator.js
https://github.com/cmod/bibliotype/blob/master/js/Hyphenator.js
MIT
toggleBox = function () { var myBox, bdy, myIdAttribute, myTextNode, myClassAttribute, text = (Hyphenator.doHyphenation ? 'Hy-phen-a-tion' : 'Hyphenation'); if (!!(myBox = contextWindow.document.getElementById('HyphenatorToggleBox'))) { myBox.firstChild.data = text; } else { bdy = contextWindow.document.g...
@name Hyphenator-switchToggleBox @description Creates or hides the toggleBox: a small button to turn off/on hyphenation on a page. @param {boolean} s true when hyphenation is on, false when it's off @see Hyphenator.config @private
toggleBox
javascript
cmod/bibliotype
js/Hyphenator.js
https://github.com/cmod/bibliotype/blob/master/js/Hyphenator.js
MIT
hyphenateURL = function (url) { return url.replace(/([:\/\.\?#&_,;!@]+)/gi, '$&' + urlhyphen); }
@name Hyphenator-removeHyphenationFromElement @description Removes all hyphens from the element. If there are other elements, the function is called recursively. Removing hyphens is usefull if you like to copy text. Some browsers are buggy when the copy hyphenated texts. @param {Object} el The element where to remove h...
hyphenateURL
javascript
cmod/bibliotype
js/Hyphenator.js
https://github.com/cmod/bibliotype/blob/master/js/Hyphenator.js
MIT
hyphenateElement = function (el) { var hyphenatorSettings = Expando.getDataForElem(el), lang = hyphenatorSettings.language, hyphenate, n, i, controlOrphans = function (part) { var h, r; switch (hyphen) { case '|': h = '\\|'; break; case '+': h = '\\+'; break; case '*': ...
@name Hyphenator-hyphenateElement @description Takes the content of the given element and - if there's text - replaces the words by hyphenated words. If there's another element, the function is called recursively. When all words are hyphenated, the visibility of the element is set to 'visible'. @param {Object} el The e...
hyphenateElement
javascript
cmod/bibliotype
js/Hyphenator.js
https://github.com/cmod/bibliotype/blob/master/js/Hyphenator.js
MIT
hyphenateDocument = function () { function bind(fun, arg) { return function () { return fun(arg); }; } var i = 0, el; while (!!(el = elements[i++])) { if (el.ownerDocument.location.href === contextWindow.location.href) { window.setTimeout(bind(hyphenateElement, el), 0); } } }
@name Hyphenator-removeHyphenationFromDocument @description Does what it says ;-) @private
hyphenateDocument
javascript
cmod/bibliotype
js/Hyphenator.js
https://github.com/cmod/bibliotype/blob/master/js/Hyphenator.js
MIT
removeHyphenationFromDocument = function () { var i = 0, el; while (!!(el = elements[i++])) { removeHyphenationFromElement(el); } state = 4; }
@name Hyphenator-createStorage @description inits the private var storage depending of the setting in storageType and the supported features of the system. @private
removeHyphenationFromDocument
javascript
cmod/bibliotype
js/Hyphenator.js
https://github.com/cmod/bibliotype/blob/master/js/Hyphenator.js
MIT
storeConfiguration = function () { if (!storage) { return; } var settings = { 'STORED': true, 'classname': hyphenateClass, 'donthyphenateclassname': dontHyphenateClass, 'minwordlength': min, 'hyphenchar': hyphen, 'urlhyphenchar': urlhyphen, 'togglebox': toggleBox, 'displaytogglebox': di...
@name Hyphenator-storeConfiguration @description Stores the current config-options in DOM-Storage @private
storeConfiguration
javascript
cmod/bibliotype
js/Hyphenator.js
https://github.com/cmod/bibliotype/blob/master/js/Hyphenator.js
MIT
restoreConfiguration = function () { var settings; if (storage.getItem('Hyphenator_config')) { settings = window.JSON.parse(storage.getItem('Hyphenator_config')); Hyphenator.config(settings); } }
@name Hyphenator.version @memberOf Hyphenator @description String containing the actual version of Hyphenator.js [major release].[minor releas].[bugfix release] major release: new API, new Features, big changes minor release: new languages, improvements @public
restoreConfiguration
javascript
cmod/bibliotype
js/Hyphenator.js
https://github.com/cmod/bibliotype/blob/master/js/Hyphenator.js
MIT
function createMeterValue(value): UnitValue { return { unit: 'm', value, }; }
The `type` keyword indicates that this is a flow specific declaration. These declarations are not part of the distributed code!
createMeterValue
javascript
ryyppy/flow-guide
tutorial/00-basics/05-recap.js
https://github.com/ryyppy/flow-guide/blob/master/tutorial/00-basics/05-recap.js
MIT
renderData = () => { switch (showAs) { case 'list': return this._renderList(data); case 'grid': return this._renderGrid(data); default: return null; } }
We define the structure of our props, which will usually be done during runtime via React.PropTypes
renderData
javascript
ryyppy/flow-guide
tutorial/01-react/00-intro.js
https://github.com/ryyppy/flow-guide/blob/master/tutorial/01-react/00-intro.js
MIT
performAction({ innerAccess, method, url, query, params, headers, body }) { this.app.meta.util.deprecated('ctx.performAction', 'ctx.meta.util.performAction'); return this.meta.util.performAction({ innerAccess, method, url, query, params, headers, body }); }
perform action of this or that module @param {string} options options @param {string} options.method method @param {string} options.url url @param {json} options.body body(optional) @return {promise} response.body.data or throw error
performAction
javascript
cabloy/cabloy
packages/egg-born-backend/app/extend/context.js
https://github.com/cabloy/cabloy/blob/master/packages/egg-born-backend/app/extend/context.js
MIT
function getText(locale, ...args) { const key = args[0]; if (!key) return null; // try locale let resource = ebLocales[locale] || {}; let text = resource[key]; if (text === undefined && locale !== 'en-us') { // try en-us resource = ebLocales['en-us'] || {}; text = resource[key...
based on koa-locales https://github.com/koajs/locales/blob/master/index.js
getText
javascript
cabloy/cabloy
packages/egg-born-backend/lib/module/locales.js
https://github.com/cabloy/cabloy/blob/master/packages/egg-born-backend/lib/module/locales.js
MIT
description() { return 'backend cov'; }
/dist/backend.js']; // check dev server const devServerRunning = yield utils.checkIfDevServerRunning({ warnWhenRunning: true, }); if (devServerRunning) return; yield super.run(context); } formatTestArgs({ argv, debugOptions }) { const testArgv = Object.assign({}, argv); /* istanbu...
description
javascript
cabloy/cabloy
packages/egg-born-bin/lib/cmd/backend-cov.js
https://github.com/cabloy/cabloy/blob/master/packages/egg-born-bin/lib/cmd/backend-cov.js
MIT
*curl(url, options) { return yield this.httpClient.request(url, options); }
send curl to remote server @param {String} url - target url @param {Object} [options] - request options @return {Object} response data
curl
javascript
cabloy/cabloy
packages/egg-born-bin/lib/cmd/test-update.js
https://github.com/cabloy/cabloy/blob/master/packages/egg-born-bin/lib/cmd/test-update.js
MIT
*getPackageInfo(pkgName, withFallback) { this.log(`fetching npm info of ${pkgName}`); try { const result = yield this.curl(`${this.registryUrl}/${pkgName}/latest`, { dataType: 'json', followRedirect: true, maxRedirects: 5, timeout: 20000, }); assert(result.statu...
get package info from registry @param {String} pkgName - package name @param {Boolean} [withFallback] - when http request fail, whethe to require local @return {Object} pkgInfo
getPackageInfo
javascript
cabloy/cabloy
packages/egg-born-bin/lib/cmd/test-update.js
https://github.com/cabloy/cabloy/blob/master/packages/egg-born-bin/lib/cmd/test-update.js
MIT
getRegistryByType(key) { switch (key) { case 'china': return 'https://registry.npmmirror.com'; case 'npm': return 'https://registry.npmjs.org'; default: { if (/^https?:/.test(key)) { return key.replace(/\/$/, ''); } // support .npmrc const ...
get registryUrl by short name @param {String} key - short name, support `china / npm / npmrc`, default to read from .npmrc @return {String} registryUrl
getRegistryByType
javascript
cabloy/cabloy
packages/egg-born-bin/lib/cmd/test-update.js
https://github.com/cabloy/cabloy/blob/master/packages/egg-born-bin/lib/cmd/test-update.js
MIT
get() { const loginInfo = Vue.prototype.$meta.store.getState('auth/loginInfo'); const loginConfig = loginInfo && loginInfo.config; if (!loginConfig) return config; return Vue.prototype.$utils.extend({}, config, loginConfig); }
front base config @todo welcome to pr @name config @property {object} base @property {string} base.locale='en-us' @property {boolean} base.jwt=false @property {object} nprogress @property {number} nprogress.debounce=500 @property {object} api @property {string} api.baseURL='' @property {boolean} api.debounce=200
get
javascript
cabloy/cabloy
packages/egg-born-front/src/base/mixin/config.js
https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/base/mixin/config.js
MIT
function tryStringify(arg) { try { return JSON.stringify(arg); } catch (err) { // Populate the circular error message lazily if (!CIRCULAR_ERROR_MESSAGE) { try { const a = {}; a.a = a; JSON.stringify(a); } catch (err) { CIRCULAR_ERROR_MESSAGE = err.message; ...
based on nodejs util.js https://github.com/koajs/locales/blob/master/index.js
tryStringify
javascript
cabloy/cabloy
packages/egg-born-localeutil/src/main.js
https://github.com/cabloy/cabloy/blob/master/packages/egg-born-localeutil/src/main.js
MIT
async _renderFile({ fileSrc, fileDest, fileDestAlt, data }) { // site const site = data.site; // language const language = site.language && site.language.current; // src const pathIntermediate = await this.getPathIntermediate(language); const fileName = path.join(pathIntermediate, fileSrc); ...
/*.ejs`); for (const item of indexFiles) { // data const data = await this.getData({ site }); // path const _fileSrc = item.substr(pathIntermediate.length + 1); let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', ''); if (_fileDest.indexOf('.') === -1) { ...
_renderFile
javascript
cabloy/cabloy
src/module-system/a-cms/backend/src/bean/local.build.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js
MIT
async _renderFile({ fileSrc, fileDest, fileDestAlt, data }) { // site const site = data.site; // language const language = site.language && site.language.current; // src const pathIntermediate = await this.getPathIntermediate(language); const fileName = path.join(pathIntermedia...
/*.ejs`); for (const item of indexFiles) { // data const data = await this.getData({ site }); // path const _fileSrc = item.substr(pathIntermediate.length + 1); let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', ''); if (_fileDest.indexOf('.') ===...
_renderFile
javascript
cabloy/cabloy
src/module-system/a-cms/dist/backend.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js
MIT
function updateFakeCursor(cm) { var className = 'cm-animate-fat-cursor'; var vim = cm.state.vim; var from = clipCursorToContent(cm, copyCursor(vim.sel.head)); var to = offsetCursor(from, 0, 1); clearFakeCursor(vim); // In visual mode, the cursor may be positioned over EOL. if (...
Keeps track of a fake cursor to support visual mode cursor behavior.
updateFakeCursor
javascript
cabloy/cabloy
src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/keymap/vim.js
MIT
function tokenCComment(stream, state) { var maybeEnd = false, ch; while ((ch = stream.next()) != null) { if (maybeEnd && ch == '/') { state.tokenize = tokenBase; break; } maybeEnd = ch == '*'; } return ret('comment', 'comment'); }
/ var ch = stream.next(); if (ch == '@') { stream.eatWhile(/[\w\\\-]/); return ret('meta', stream.current()); } else if (ch == '/' && stream.eat('*')) { state.tokenize = tokenCComment; return tokenCComment(stream, state); } else if (ch == '<' && stream.eat('!')) ...
tokenCComment
javascript
cabloy/cabloy
src/module-system/a-codemirror/backend/static/lib/codemirror/mode/nginx/nginx.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/nginx/nginx.js
MIT
function slideToLoop(index, speed, runCallbacks, internal) { if (index === void 0) { index = 0; } if (speed === void 0) { speed = this.params.speed; } if (runCallbacks === void 0) { runCallbacks = true; } if (typeof index === 'string') { /** * The `index` argument converted from `s...
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
slideToLoop
javascript
cabloy/cabloy
src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js
MIT
function toBeInstanceOf(actual, expected) { if (!(actual instanceof expected)) { throw new AssertionError({ message: 'Expected value to be instance:', operator: 'instanceOf', actual, expected, stackStartFn: toBeInstanceOf, }) } }
Tests that the actual object is an instance of the expected class.
toBeInstanceOf
javascript
stitchesjs/stitches
.task/internal/expect.js
https://github.com/stitchesjs/stitches/blob/master/.task/internal/expect.js
MIT
function toNotBeInstanceOf(actual, expected) { if (actual instanceof expected) { throw new AssertionError({ message: 'Expected value to be instance:', operator: 'instanceOf', actual, expected, stackStartFn: toNotBeInstanceOf, }) } }
Tests that the actual object is not an instance of the expected class.
toNotBeInstanceOf
javascript
stitchesjs/stitches
.task/internal/expect.js
https://github.com/stitchesjs/stitches/blob/master/.task/internal/expect.js
MIT
async function toThrow(actualFunction, expected) { let actual = undefined try { actual = await actualFunction() } catch (error) { // do nothing and continue return } throw new AssertionError({ message: 'Expected exception:', operator: 'throws', stackStartFn: toThrow, actual, expected, }) }
Tests that the actual function does throw when it is called.
toThrow
javascript
stitchesjs/stitches
.task/internal/expect.js
https://github.com/stitchesjs/stitches/blob/master/.task/internal/expect.js
MIT
async function toNotThrow(actualFunction, expected) { let actual = undefined try { actual = await actualFunction() // do nothing and continue return } catch (error) { throw new AssertionError({ message: 'Unexpected exception:', operator: 'doesNotThrow', stackStartFn: toThrow, actual, expecte...
Tests that the actual function does not throw when it is called.
toNotThrow
javascript
stitchesjs/stitches
.task/internal/expect.js
https://github.com/stitchesjs/stitches/blob/master/.task/internal/expect.js
MIT
copydir = async function copydir(src, dst) { let copydir = async (src, dst) => { await mkdir(dst, { recursive: true }) for (const dirent of await readdir(src, { withFileTypes: true })) { await (dirent.isDirectory() ? copydir : copyFile)( src.dir.to(dirent.name), dst.dir.to(dirent.name) ) } } co...
Asynchronously copies dir to dest. By default, dest is overwritten if it already exists.
copydir
javascript
stitchesjs/stitches
.task/internal/fs.js
https://github.com/stitchesjs/stitches/blob/master/.task/internal/fs.js
MIT
async readFileJson(/** @type {import('fs').PathLike | fs.FileHandle} */ path) { const json = await fs.readFile(path, 'utf8') /** @type {JSONValue} */ const data = JSON.parse(json) return data }
Asynchronously reads a file as parsed JSON.
readFileJson
javascript
stitchesjs/stitches
.task/internal/fs.js
https://github.com/stitchesjs/stitches/blob/master/.task/internal/fs.js
MIT
getProcessArgOf = (name) => { const lead = argv.indexOf('--' + name) + 1 const tail = lead ? argv.slice(lead).findIndex((arg) => arg.startsWith('--')) : 0 const vals = lead ? argv.slice(lead, ~tail ? lead + tail : argv.length) : [] return lead ? (vals.length ? vals : [true]) : vals }
Returns the values for a given process argument.
getProcessArgOf
javascript
stitchesjs/stitches
.task/internal/process.js
https://github.com/stitchesjs/stitches/blob/master/.task/internal/process.js
MIT
question = ( /** @type {string} */ query, /** @type {import('events').Abortable} */ opts = undefined ) => new Promise(resolver => { query = String(query).replace(/[^\s]$/, '$& ') opts = Object(opts) const int = readline.createInterface({ input: process.stdin, output: process.stdout, }) int.question(query...
Displays the query, awaits user input, and returns the provided input.
question
javascript
stitchesjs/stitches
.task/internal/readline.js
https://github.com/stitchesjs/stitches/blob/master/.task/internal/readline.js
MIT
toString = () => { const { cssRules } = groupSheet.sheet return [].map .call(cssRules, (cssRule, cssRuleIndex) => { const { cssText } = cssRule let lastRuleCssText = '' if (cssText.startsWith('--sxs')) return '' if (cssRules[cssRuleIndex - 1] && (lastRuleCssText = cssRules[cssRuleIndex - 1].cs...
@type {SheetGroup} Object hosting the hydrated stylesheet.
toString
javascript
stitchesjs/stitches
packages/core/src/sheet.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/sheet.js
MIT
createCSSMediaRule = (/** @type {string} */ sourceCssText, type) => { return /** @type {CSSMediaRule} */ ({ type, cssRules: [], insertRule(cssText, index) { this.cssRules.splice(index, 0, createCSSMediaRule(cssText, { import: 3, undefined: 1 }[(cssText.toLowerCase().match(/^...
@type {GroupName} Name of the group.
createCSSMediaRule
javascript
stitchesjs/stitches
packages/core/src/sheet.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/sheet.js
MIT
walk = ( /** @type {Style} Set of CSS styles */ style, /** @type {string[]} Selectors that define the elements to which a set of CSS styles apply. */ selectors, /** @type {string[]} Conditions that define the queries to which a set of CSS styles apply. */ conditions, ) => { /** @type {keyof style} Represents t...
Walks CSS styles and converts them into CSSOM-compatible rules.
walk
javascript
stitchesjs/stitches
packages/core/src/convert/toCssRules.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toCssRules.js
MIT
each = (style) => { for (name in style) { /** Whether the current name represents an at-rule. */ const isAtRuleLike = name.charCodeAt(0) === 64 const datas = isAtRuleLike && Array.isArray(style[name]) ? style[name] : [style[name]] for (data of datas) { const camelName = toCamelCase(name) ...
@type {style[keyof style]} Represents the right-side "data" for the property (the rule block, or declaration value).
each
javascript
stitchesjs/stitches
packages/core/src/convert/toCssRules.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toCssRules.js
MIT
toCssString = (declarations, selectors, conditions) => ( `${conditions.map((condition) => `${condition}{`).join('')}${selectors.length ? `${selectors.join(',')}{` : ''}${declarations.join(';')}${selectors.length ? `}` : ''}${Array(conditions.length ? conditions.length + 1 : 0).join('}')}` )
CSS right-hand side value, which may be a specially-formatted custom property.
toCssString
javascript
stitchesjs/stitches
packages/core/src/convert/toCssRules.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toCssRules.js
MIT
toHyphenCase = (/** @type {string} */ value) => ( // ignore kebab-like values value.includes('-') ? value // replace any upper-case letter with a dash and the lower-case variant : value.replace(/[A-Z]/g, (capital) => '-' + capital.toLowerCase()) )
Returns the given value converted to kebab-case.
toHyphenCase
javascript
stitchesjs/stitches
packages/core/src/convert/toHyphenCase.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toHyphenCase.js
MIT
toResolvedMediaQueryRanges = ( /** @type {string} */ media ) => media.replace( /\(\s*([\w-]+)\s*(=|<|<=|>|>=)\s*([\w-]+)\s*(?:(<|<=|>|>=)\s*([\w-]+)\s*)?\)/g, ( __, /** @type {string} 1st param, either the name or value in the query. */ p1, /** @type {string} 1st operator. */ o1, /** @type {string} 2nd ...
Returns a media query with polyfilled ranges.
toResolvedMediaQueryRanges
javascript
stitchesjs/stitches
packages/core/src/convert/toResolvedMediaQueryRanges.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toResolvedMediaQueryRanges.js
MIT
toResolvedSelectors = ( /** @type {string[]} Parent selectors (e.g. `["a", "button"]`). */ parentSelectors, /** @type {string[]} Nested selectors (e.g. `["&:hover", "&:focus"]`). */ nestedSelectors, ) => ( parentSelectors.length ? parentSelectors.reduce( (resolvedSelectors, parentSelector) => { resolvedSe...
Returns selectors resolved from parent selectors and nested selectors.
toResolvedSelectors
javascript
stitchesjs/stitches
packages/core/src/convert/toResolvedSelectors.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toResolvedSelectors.js
MIT
toSizingValue = (/** @type {string} */ declarationName, /** @type {string} */ declarationValue) => ( declarationName in sizeProps && typeof declarationValue === 'string' ? declarationValue.replace( /^((?:[^]*[^\w-])?)(fit-content|stretch)((?:[^\w-][^]*)?)$/, (data, lead, main, tail) => ( lead + ( main...
Returns a declaration sizing value with polyfilled sizing keywords.
toSizingValue
javascript
stitchesjs/stitches
packages/core/src/convert/toSizingValue.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toSizingValue.js
MIT
toTokenizedValue = ( /** @type {string} */ value, /** @type {string} */ prefix, /** @type {string} */ scale, ) => value.replace( /([+-])?((?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?)?(\$|--)([$\w-]+)/g, ($0, direction, multiplier, separator, token) => ( separator == "$" == !!multiplier ? $0 : ( direction...
Returns a declaration value with transformed token values.
toTokenizedValue
javascript
stitchesjs/stitches
packages/core/src/convert/toTokenizedValue.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toTokenizedValue.js
MIT
createCreateThemeFunction = ( config, sheet ) => ( createCreateThemeFunctionMap(config, () => (className, style) => { // theme is the first argument if it is an object, otherwise the second argument as an object style = typeof className === 'object' && className || Object(style) // class name is the first arg...
Returns a function that applies a theme and returns tokens of that theme.
createCreateThemeFunction
javascript
stitchesjs/stitches
packages/core/src/features/createTheme.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/createTheme.js
MIT
createCssFunction = (config, sheet) => createCssFunctionMap(config, () => { const _css = (args, componentConfig = {}) => { let internals = { type: null, composers: new Set(), } for (const arg of args) { // skip any void argument if (arg == null) continue ...
Returns a function that applies component styles.
createCssFunction
javascript
stitchesjs/stitches
packages/core/src/features/css.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/css.js
MIT
createRenderer = (config, internals, sheet, { shouldForwardStitchesProp }) => { const [ baseClassName, baseClassNames, prefilledVariants, undefinedVariants ] = getPreparedDataFromComposers(internals.composers) const deferredInjector = typeof internals.type === 'function' || !!internals.type.$$typeof ? creat...
@type {string} Composer Unique Identifier. @see `{CONFIG_PREFIX}-?c-{STYLE_HASH}`
createRenderer
javascript
stitchesjs/stitches
packages/core/src/features/css.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/css.js
MIT
toString = () => { if (!sheet.rules.styled.cache.has(baseClassName)) render() return baseClassName }
@type {string} Inline Class Unique Identifier. @see `{COMPOSER_UUID}-i{VARIANT_UUID}-css`
toString
javascript
stitchesjs/stitches
packages/core/src/features/css.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/css.js
MIT