@koeroesi86/canvas-grid 26.11.3 → 26.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/types/text/index.d.ts +12 -4
- package/build/types/utils/column-store.d.ts +2 -0
- package/build/types/utils/data-store.d.ts +3 -0
- package/build/types/utils/fit-text.d.ts +6 -0
- package/build/web-component.js +1 -1
- package/build/web-component.js.map +1 -1
- package/build/web-component.mjs +125 -160
- package/build/web-component.mjs.map +1 -1
- package/package.json +2 -5
- package/build/types/character/index.d.ts +0 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-component.mjs","names":["styles","throttle","debounce","__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__commonJSMin","mod","cb","__copyProps","from","keys","i","n","key","to","except","k","desc","__toESM","isNodeMode","target","require_lodash_throttle","FUNC_ERROR_TEXT","NAN","reTrim","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","freeGlobal","freeSelf","root","objectToString","nativeMax","nativeMin","now","debounce","lastArgs","lastThis","maxWait","result","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","func","toNumber","wait","isObject","options","invokeFunc","args","thisArg","time","leadingEdge","timerExpired","remainingWait","timeSinceLastCall","timeSinceLastInvoke","shouldInvoke","trailingEdge","cancel","flush","debounced","isInvoking","throttle","\"leading\"","\"maxWait\"","\"trailing\"","type","value","isObjectLike","isSymbol","other","isBinary","require_lodash_debounce","import_lodash_throttle","import_lodash_debounce","Collection","entry","existing","matcher","id","fn","ColumnStore","length","slot","updatedAt","slots","MIN_HOLES_TO_COMPACT","RowStore","row","index","offset","low","high","middle","previous","replacement","added","removed","ids","indexes","a","b","holes","live","renumbered","rank","compare","moving","oldIndexes","inserts","positions","settledLength","end","at","items","write","read","removedIndex","rows","top","getNow","getRowId","collator","INCREMENTAL_SORT_RATIO","typeRank","compareValues","createDefaultKey","ranks","values","texts","position","sorted","text","DataStore","environment","model","rowId","columnKey","data","changes","removals","moved","applyRemovals","column","kept","rowData","columnId","sign","direction","precompute","sortKeys","order","changed","LruCache","limit","oldest","component_default","isNode","child","primitive","paint","ctx","props","x","y","Group","children","originX","originY","React","component","Renderer","CanvasRenderer","bitmap","canvas","getContext2d","Loading","Layer","name","width","height","pixelRatio","RendererRegistry","renderer","ref","Rect","w","h","color","alpha","CellBackground","age","flashInDuration","flashOutDuration","flash","background","flashRGB","borderRightWidth","borderRightColor","borderBottomWidth","borderBottomColor","CharacterRenderer","font","cached","character","TextRenderer","totalWidth","ellipsisWidth","verticalPadding","availableWidth","left","maxHeight","currentXOffset","currentWidth","characterWidth","HeaderRenderer","formatted","CellValueRenderer","valueChanged","forced","classes","builtIn","STYLE_ELEMENT_ID","injectStyles","style","CanvasGridComponent","prevSize","getId","layer","next","before","candidate","scrollArea","debounceAfterScroll","throttledUpdate","scrollXOffset","scrollYOffset","scrollTop","scrollLeft","overrides","refs","redrawAll","keepDrawing","fakeRowIndex","header","xOffset","firstRow","visibleColumns","rowIndex","currentY","entries","cellRow","store","animating","visible","currentX","add","update","remove","columns","defaults","v"],"sources":["../node_modules/lodash.throttle/index.js","../node_modules/lodash.debounce/index.js","../components/utils/collection.ts","../components/utils/column-store.ts","../components/utils/row-store.ts","../components/utils/selectors.ts","../components/utils/data-store.ts","../components/utils/lru-cache.ts","../components/component.css?inline","../components/utils/jsx.ts","../components/utils/renderer.ts","../components/utils/canvas.ts","../components/utils/loading.ts","../components/utils/layer.ts","../components/utils/renderer-registry.ts","../components/rectangle/index.ts","../components/cell-background/index.tsx","../components/character/index.ts","../components/text/index.ts","../components/header/index.tsx","../components/cell-value/index.tsx","../components/web-component.ts"],"sourcesContent":["/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n result = wait - timeSinceLastCall;\n\n return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = throttle;\n","/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n result = wait - timeSinceLastCall;\n\n return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = debounce;\n","import type { Key } from '../types';\n\ninterface Entry<T> {\n key: Key;\n value: T;\n}\n\n/**\n * Insertion-ordered map. Keys are compared as strings (1 and '1' are the same entry),\n * and every operation is O(1) apart from iteration.\n */\nclass Collection<T> {\n private entries = new Map<string, Entry<T>>();\n\n constructor() {\n this.get = this.get.bind(this);\n this.set = this.set.bind(this);\n this.clear = this.clear.bind(this);\n this.forEach = this.forEach.bind(this);\n }\n\n get keys(): Key[] {\n return Array.from(this.entries.values(), entry => entry.key);\n }\n\n get(key: Key): T | undefined {\n return this.entries.get(String(key))?.value;\n }\n\n set(key: Key, value: T) {\n const existing = this.entries.get(String(key));\n if (existing) {\n existing.value = value;\n return;\n }\n this.entries.set(String(key), { key, value });\n }\n\n add(value: T) {\n this.set(this.entries.size, value);\n }\n\n delete(key: Key) {\n this.entries.delete(String(key));\n }\n\n clear(matcher?: (item: T, key: Key) => boolean) {\n if (typeof matcher !== 'function') {\n this.entries.clear();\n return;\n }\n this.entries.forEach(({ key, value }, id) => {\n if (matcher(value, key)) this.entries.delete(id);\n });\n }\n\n forEach(fn: (item: T, key: Key) => void) {\n this.entries.forEach(({ key, value }) => fn(value, key));\n }\n\n get length() {\n return this.entries.size;\n }\n}\n\nexport default Collection;\n","/**\n * Values of one column for all rows, indexed by row slot. Two flat arrays instead of an object per cell.\n * `undefined` means the row has no value in this column.\n */\nclass ColumnStore {\n values: unknown[];\n\n /** When each value last changed, 0 when unknown; only allocated once a value changes after loading. */\n private updatedAt: number[] | undefined = undefined;\n\n constructor(length = 0) {\n this.values = new Array(length).fill(undefined);\n }\n\n get(slot: number) {\n return this.values[slot];\n }\n\n getUpdatedAt(slot: number): number | undefined {\n return this.updatedAt?.[slot] || undefined;\n }\n\n set(slot: number, value: unknown, updatedAt?: number) {\n while (this.values.length < slot) this.values.push(undefined);\n this.values[slot] = value;\n if (updatedAt === undefined && this.updatedAt === undefined) return;\n\n this.updatedAt ??= new Array(this.values.length).fill(0);\n while (this.updatedAt.length < this.values.length) this.updatedAt.push(0);\n this.updatedAt[slot] = updatedAt ?? 0;\n }\n\n /** Empties the given slots, leaving holes; the other slots keep their place. */\n clearSlots(slots: readonly number[]) {\n slots.forEach(slot => {\n if (slot < this.values.length) this.values[slot] = undefined;\n if (this.updatedAt && slot < this.updatedAt.length) this.updatedAt[slot] = 0;\n });\n }\n\n /** Keeps only the given slots (ascending), renumbering them 0, 1, 2... in that order. */\n compact(slots: ArrayLike<number>) {\n this.values = Array.from(slots, slot => this.values[slot]);\n const { updatedAt } = this;\n if (updatedAt) this.updatedAt = Array.from(slots, slot => updatedAt[slot] ?? 0);\n }\n}\n\nexport default ColumnStore;\n","import type { Key, RowData, RowId } from '../types';\n\nexport type Row = RowData;\n\n/** Holes below this are not worth a pass over every column. */\nconst MIN_HOLES_TO_COMPACT = 1024;\n\n/**\n * Rows in display order: a dense array with an id lookup and each row's top offset,\n * so appends, lookups and finding the row at a scroll offset never scan every row.\n * Removing rows renumbers the positions after the first removed one (once per call).\n * Rows keep a `slot` into the column stores that does not change when the rows are sorted or others removed;\n * removed rows leave holes, which are closed when they outnumber the rows.\n */\nclass RowStore {\n private items: Row[] = [];\n\n private readonly byId = new Map<string, Row>();\n\n /** `tops[i]` is the offset of row `i` from the top of the first row. */\n private tops: number[] = [];\n\n private end = 0;\n\n /** Slots handed out so far, including holes left by removed rows. */\n private nextSlot = 0;\n\n get length() {\n return this.items.length;\n }\n\n /** Sum of all row heights. */\n get totalHeight() {\n return this.end;\n }\n\n /** Number of slots in use or left as holes; the length the column stores need. */\n get slotCount() {\n return this.nextSlot;\n }\n\n get keys(): RowId[] {\n return this.items.map(row => row.id);\n }\n\n get(id: Key): Row | undefined {\n return this.byId.get(String(id));\n }\n\n at(index: number): Row | undefined {\n return this.items[index];\n }\n\n topOf(index: number) {\n return this.tops[index] ?? this.end;\n }\n\n /** Index of the first row that ends below `offset`; `length` when the offset is past the last row. */\n indexAt(offset: number) {\n if (offset <= 0) return 0;\n if (offset >= this.end) return this.length;\n\n let low = 0;\n let high = this.items.length - 1;\n while (low < high) {\n const middle = Math.ceil((low + high) / 2);\n if (this.tops[middle] <= offset) low = middle;\n else high = middle - 1;\n }\n return low;\n }\n\n /** Appends the row, or replaces the row with the same id in place; returns the stored row. */\n set(row: Omit<Row, 'index' | 'slot'>): Row {\n const key = String(row.id);\n const previous = this.byId.get(key);\n if (previous) {\n const replacement = { id: row.id, height: row.height, index: previous.index, slot: previous.slot };\n this.items[previous.index] = replacement;\n this.byId.set(key, replacement);\n this.reindexFrom(previous.index);\n return replacement;\n }\n\n const index = this.items.length;\n const added = { id: row.id, height: row.height, index, slot: this.nextSlot++ };\n this.items.push(added);\n this.byId.set(key, added);\n this.tops.push(this.end);\n this.end += Math.round(row.height);\n return added;\n }\n\n /**\n * Removes the rows with the given ids, ignoring unknown ones.\n * Returns the slots of the removed rows in ascending order, which the column stores must clear.\n * Other rows keep their slots, so removing costs nothing per column; see `compactSlots`.\n */\n removeMany(ids: Key[]): number[] {\n const removed = new Set<Row>();\n ids.forEach(id => {\n const row = this.get(id);\n if (row) removed.add(row);\n });\n if (removed.size === 0) return [];\n\n removed.forEach(row => this.byId.delete(String(row.id)));\n const indexes = Array.from(removed, row => row.index).sort((a, b) => a - b);\n\n this.closeGaps(indexes);\n this.reindexFrom(indexes[0]);\n return Array.from(removed, row => row.slot).sort((a, b) => a - b);\n }\n\n /**\n * Renumbers the slots densely once more than half of them are holes left by removed rows.\n * Returns the previous slots of the remaining rows in ascending order (the column stores keep exactly those),\n * or undefined when nothing was renumbered. Doing this rarely keeps removal cheap for streams that drop old rows.\n */\n compactSlots(): Int32Array | undefined {\n const holes = this.nextSlot - this.items.length;\n if (holes < MIN_HOLES_TO_COMPACT || holes <= this.items.length) return undefined;\n\n const live = Int32Array.from(this.items, row => row.slot).sort();\n const renumbered = new Int32Array(this.nextSlot);\n live.forEach((slot, rank) => { renumbered[slot] = rank; });\n this.items.forEach(row => { row.slot = renumbered[row.slot]; });\n this.nextSlot = this.items.length;\n return live;\n }\n\n /** Reorders the rows; the sort is stable, so equal rows keep their relative order. */\n sort(compare: (a: Row, b: Row) => number) {\n this.items.sort(compare);\n this.reindexFrom(0);\n }\n\n /**\n * Puts the given rows back in order, assuming every other row is already ordered.\n * `compare` must be a total order (no ties), which a slot tiebreak provides. Costs one comparison pass per\n * moved row (a binary search) plus a copy, instead of sorting every row.\n */\n resort(ids: Iterable<Key>, compare: (a: Row, b: Row) => number) {\n const moving = new Set<Row>();\n for (const id of ids) {\n const row = this.get(id);\n if (row) moving.add(row);\n }\n if (moving.size === 0) return;\n\n const oldIndexes = Array.from(moving, row => row.index).sort((a, b) => a - b);\n this.closeGaps(oldIndexes);\n\n // only the moving rows are compared; the rest is moved around with memmoves, never visited one by one\n const inserts = Array.from(moving).sort(compare);\n const positions = inserts.map(row => this.lowerBound(this.items, row, compare));\n const settledLength = this.items.length;\n inserts.forEach(row => this.items.push(row));\n\n // from the back, so every settled row moves once, past the inserts that end up before it\n const { items } = this;\n let end = settledLength;\n for (let at = inserts.length - 1; at >= 0; at--) {\n for (let from = end - 1; from >= positions[at]; from--) items[from + at + 1] = items[from];\n items[positions[at] + at] = inserts[at];\n end = positions[at];\n }\n\n this.reindexFrom(Math.min(oldIndexes[0], positions[0]));\n }\n\n clear() {\n this.items = [];\n this.byId.clear();\n this.tops = [];\n this.end = 0;\n this.nextSlot = 0;\n }\n\n /** Removes the items at the given ascending indexes in place, moving the others down in runs. */\n private closeGaps(indexes: readonly number[]) {\n const { items } = this;\n let write = indexes[0];\n indexes.forEach((removedIndex, at) => {\n const end = indexes[at + 1] ?? items.length;\n // a plain loop: Array.prototype.copyWithin is much slower than this on arrays of objects\n for (let read = removedIndex + 1; read < end; read++) items[write++] = items[read];\n });\n items.length = write;\n }\n\n /** Index of the first row in `rows` that is not ordered before `row`. */\n private lowerBound(rows: Row[], row: Row, compare: (a: Row, b: Row) => number) {\n let low = 0;\n let high = rows.length;\n while (low < high) {\n const middle = (low + high) >>> 1;\n if (compare(rows[middle], row) < 0) low = middle + 1;\n else high = middle;\n }\n return low;\n }\n\n /** Recomputes positions and offsets from `from` onwards. */\n private reindexFrom(from: number) {\n this.tops.length = this.items.length;\n let top = from === 0 ? 0 : this.tops[from - 1] + Math.round(this.items[from - 1].height);\n for (let index = from; index < this.items.length; index++) {\n const row = this.items[index];\n row.index = index;\n this.tops[index] = top;\n top += Math.round(row.height);\n }\n this.end = top;\n }\n}\n\nexport default RowStore;\n","import type { RowId, RowInput } from '../types';\n\nexport const getNow = () => new Date().valueOf();\n\nexport const getRowId = (row: RowInput, _index?: number): RowId => row.id;\n","import ColumnStore from './column-store';\nimport RowStore from './row-store';\nimport { getNow } from './selectors';\nimport type { Row } from './row-store';\nimport type { Key, RowId, RowInput, SortKey } from '../types';\n\nexport type RowIdGetter = (row: RowInput, index?: number) => RowId;\n\nexport interface DataStoreEnvironment {\n getRowId: RowIdGetter;\n getCellHeight: () => number;\n}\n\ninterface PendingChange {\n type: 'update' | 'remove';\n row: RowInput;\n}\n\nconst collator = new Intl.Collator();\n\n/** Fewer changed rows than this fraction of all rows are moved one by one; more are cheaper to sort together. */\nconst INCREMENTAL_SORT_RATIO = 8;\n\nconst typeRank = (value: unknown) => {\n if (value === undefined || value === null) return 3;\n if (typeof value === 'number' || typeof value === 'bigint') return 0;\n return typeof value === 'string' ? 1 : 2;\n};\n\n/** Numbers numerically, then text, then anything else as text; empty values sort last. */\nexport const compareValues = (a: unknown, b: unknown) => {\n const rank = typeRank(a) - typeRank(b);\n if (rank !== 0) return rank;\n if (typeRank(a) === 3) return 0;\n if (typeRank(a) === 0) return Number(a) - Number(b);\n return collator.compare(String(a), String(b));\n};\n\n/**\n * Sort keys for the default ordering of a column, computed once so comparing two rows is two array reads:\n * a type rank, and within it a number (the value, or the position of its text among all the column's texts).\n */\nconst createDefaultKey = (values: readonly unknown[]) => {\n const ranks = new Uint8Array(values.length);\n const keys = new Float64Array(values.length);\n const texts = new Map<string, number>();\n values.forEach((value, slot) => {\n ranks[slot] = typeRank(value);\n if (ranks[slot] === 0) keys[slot] = Number(value);\n if (ranks[slot] === 1 || ranks[slot] === 2) texts.set(String(value), 0);\n });\n\n // equal texts (as the collator sees them) share a position, so they tie and fall through to the next key\n let position = 0;\n const sorted = Array.from(texts.keys()).sort(collator.compare);\n sorted.forEach((text, index) => {\n if (index > 0 && collator.compare(sorted[index - 1], text) !== 0) position++;\n texts.set(text, position);\n });\n values.forEach((value, slot) => {\n if (ranks[slot] === 1 || ranks[slot] === 2) keys[slot] = texts.get(String(value)) ?? 0;\n });\n return { ranks, keys };\n};\n\n/**\n * Cell values stored by column (one array per column, addressed by the row's slot) plus the row order,\n * with the queued add/update/remove handling and the sort model. Independent of the DOM.\n */\nclass DataStore {\n rows = new RowStore();\n columns = new Map<string, ColumnStore>();\n\n /** Queued changes, applied in the order they were made. */\n private pending: PendingChange[] = [];\n private sortModel: readonly SortKey[] = [];\n private sortDirty = false;\n /** Ids of the rows changed since the last sort; only those have to move when few changed. */\n private sortChanged = new Set<string>();\n\n private environment: DataStoreEnvironment;\n\n constructor(environment: DataStoreEnvironment) {\n this.environment = environment;\n }\n\n get hasPending() {\n return this.pending.length > 0;\n }\n\n getSortModel() {\n return this.sortModel;\n }\n\n /** Orders the rows by the given columns, in priority order; an empty model restores the insertion order. */\n setSortModel(model: readonly SortKey[]) {\n this.sortModel = [...model];\n this.sort();\n }\n\n /** Value of a cell, `undefined` when the row has none. */\n getValue(rowId: RowId, columnKey: Key) {\n const row = this.rows.get(rowId);\n return row ? this.columns.get(String(columnKey))?.get(row.slot) : undefined;\n }\n\n getUpdatedAt(rowId: RowId, columnKey: Key) {\n const row = this.rows.get(rowId);\n return row ? this.columns.get(String(columnKey))?.getUpdatedAt(row.slot) : undefined;\n }\n\n queueUpdate(row: RowInput) {\n this.pending.push({ type: 'update', row });\n }\n\n queueRemove(row: RowInput) {\n this.pending.push({ type: 'remove', row });\n }\n\n clear() {\n this.rows.clear();\n this.columns.clear();\n }\n\n /** Replaces everything, dropping any queued changes. */\n setRows(data: RowInput[]) {\n this.pending = [];\n this.clear();\n this.sortChanged.clear();\n // size the columns of the first row up front instead of growing them one value at a time\n Object.keys(data[0] ?? {}).forEach(key => this.columns.set(key, new ColumnStore(data.length)));\n data.forEach((row, index) => this.addRow(this.environment.getRowId(row, index), row, undefined));\n // rows were added in insertion order, which is the order without a sort model\n if (this.sortModel.length > 0) this.sort();\n }\n\n /**\n * Applies the queued changes in the order they were queued; consecutive removals are applied together.\n * Returns whether rows changed position (removed or re-sorted), which needs the whole grid to be redrawn.\n */\n flush(now = getNow()) {\n const changes = this.pending;\n this.pending = [];\n const removals: Key[] = [];\n let moved = false;\n const applyRemovals = () => {\n moved = this.removeRows(removals) || moved;\n removals.length = 0;\n };\n\n changes.forEach(({ type, row }) => {\n if (type === 'remove') {\n removals.push(this.environment.getRowId(row));\n return;\n }\n applyRemovals();\n this.applyUpdate(row, now);\n });\n applyRemovals();\n\n if (!this.sortDirty) return moved;\n this.sortChanges();\n return true;\n }\n\n private column(key: string) {\n let column = this.columns.get(key);\n if (!column) {\n column = new ColumnStore(this.rows.slotCount);\n this.columns.set(key, column);\n }\n return column;\n }\n\n private addRow(id: RowId, row: RowInput, updatedAt: number | undefined) {\n const { slot } = this.rows.set({ id, height: this.environment.getCellHeight() });\n const keys = Object.keys(row);\n for (const key of keys) this.column(key).set(slot, row[key], updatedAt);\n this.markSortDirty(id, keys);\n }\n\n private removeRows(ids: Key[]) {\n if (ids.length === 0) return false;\n\n const slots = this.rows.removeMany(ids);\n this.columns.forEach(column => column.clearSlots(slots));\n const kept = this.rows.compactSlots();\n if (kept) this.columns.forEach(column => column.compact(kept));\n return slots.length > 0;\n }\n\n private applyUpdate(row: RowInput, now: number) {\n const rowId = this.environment.getRowId(row);\n const rowData = this.rows.get(rowId);\n if (!rowData) {\n this.addRow(rowId, row, now);\n return;\n }\n Object.keys(row).forEach(key => this.applyValue(rowData.id, rowData.slot, key, row[key], now));\n }\n\n private applyValue(rowId: RowId, slot: number, key: string, value: unknown, now: number) {\n const column = this.column(key);\n const previous = column.get(slot);\n if (previous === value) return;\n // a value appearing in a column the row did not have yet is not an update worth flashing\n column.set(slot, value, previous === undefined ? undefined : now);\n this.markSortDirty(rowId, [key]);\n }\n\n private markSortDirty(rowId: RowId, keys: string[]) {\n if (!this.sortModel.some(({ columnId }) => keys.includes(String(columnId)))) return;\n this.sortDirty = true;\n this.sortChanged.add(String(rowId));\n }\n\n /** Orders two rows by the sort model, ties by slot so the order is total. */\n private createComparator(precompute: boolean) {\n const keys = this.sortModel.map(({ columnId, direction = 'asc', compare }) => {\n const values = this.columns.get(String(columnId))?.values;\n const sign = direction === 'desc' ? -1 : 1;\n if (!values) return { order: () => 0, sign };\n if (compare) return { order: (a: Row, b: Row) => compare(values[a.slot], values[b.slot]), sign };\n if (!precompute) return { order: (a: Row, b: Row) => compareValues(values[a.slot], values[b.slot]), sign };\n\n const { ranks, keys: sortKeys } = createDefaultKey(values);\n return {\n order: (a: Row, b: Row) => ranks[a.slot] - ranks[b.slot] || (ranks[a.slot] === 3 ? 0 : sortKeys[a.slot] - sortKeys[b.slot]) || 0,\n sign,\n };\n });\n\n return (a: Row, b: Row) => {\n for (const { order, sign } of keys) {\n const result = order(a, b);\n if (result !== 0) return result * sign;\n }\n return a.slot - b.slot;\n };\n }\n\n private sort() {\n this.sortDirty = false;\n this.sortChanged.clear();\n this.rows.sort(this.createComparator(true));\n }\n\n /** Re-sorts after a flush: moves only the changed rows when they are few, otherwise sorts everything. */\n private sortChanges() {\n const changed = this.sortChanged;\n if (changed.size * INCREMENTAL_SORT_RATIO >= this.rows.length) {\n this.sort();\n return;\n }\n\n this.sortDirty = false;\n this.sortChanged = new Set();\n this.rows.resort(changed, this.createComparator(false));\n }\n}\n\nexport default DataStore;\n","/** Size-bounded map that evicts the least recently used entry first. */\nclass LruCache<T> {\n private readonly entries = new Map<string, T>();\n\n private readonly limit: number;\n\n constructor(limit: number) {\n this.limit = limit;\n }\n\n get(key: string): T | undefined {\n const value = this.entries.get(key);\n if (value === undefined) return undefined;\n // re-insert so iteration order tracks recency\n this.entries.delete(key);\n this.entries.set(key, value);\n return value;\n }\n\n set(key: string, value: T) {\n this.entries.delete(key);\n this.entries.set(key, value);\n const [oldest] = this.entries.keys();\n if (this.entries.size > this.limit && oldest !== undefined) this.entries.delete(oldest);\n }\n\n clear() {\n this.entries.clear();\n }\n\n get size() {\n return this.entries.size;\n }\n}\n\nexport default LruCache;\n","canvas-grid {\n position: relative;\n display: block;\n /* keeps the layers' z-indexes inside the grid, so it cannot paint over page content such as sticky headers */\n isolation: isolate;\n\n &, & * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n }\n\n & .drawingLayer {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n /* the canvas is a fixed-size box, so layout and paint never depend on or leak into the rest of the page */\n contain: strict;\n\n &.background {\n /* z-index: 1; */\n /* background-color: #333; */\n }\n\n &.content {\n /* z-index: 2; */\n }\n\n &.header {\n /* z-index: 3; */\n }\n }\n\n & .scrollArea {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow: auto;\n z-index: 10;\n backface-visibility: hidden;\n will-change: transform;\n\n & > div {\n will-change: scroll-position, transform;\n }\n }\n}\n","/**\n * Minimal declarative layer over the canvas 2D API.\n *\n * `<Group>` and friends do not draw when evaluated. They build a light tree of nodes, and calling\n * `node.draw(ctx, x, y)` paints it, with `(x, y)` as the origin that child positions are relative to.\n * Nothing is rasterized to an intermediate canvas unless a component opts into bitmap caching.\n */\nexport interface VNode {\n draw(ctx: CanvasRenderingContext2D, x: number, y: number): void;\n}\n\n/** `false`, `null` and `undefined` are skipped, so `{condition && <Rect />}` works. */\nexport type Child = VNode | false | null | undefined;\n\nexport type Children = Child | readonly Child[];\n\nexport interface ChildrenProps {\n /** A single child, an array of them, or the mix of both that JSX produces for several children. */\n children?: Children | readonly Children[];\n}\n\nexport type Component<Props extends object> = (props: Props) => VNode;\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n type Element = VNode;\n interface ElementChildrenAttribute {\n children: unknown;\n }\n interface IntrinsicElements {}\n }\n}\n\nconst isNode = (child: Child): child is VNode => !!child;\n\n/** Wraps a paint function into a leaf component; positions in `props` are relative to the draw origin. */\nexport const primitive = <Props extends object>(\n paint: (ctx: CanvasRenderingContext2D, props: Props, x: number, y: number) => void,\n): Component<Props> => props => ({\n draw: (ctx, x, y) => paint(ctx, props, x, y),\n});\n\nexport interface GroupProps extends ChildrenProps {\n x?: number;\n y?: number;\n}\n\n/** Draws its children relative to its own offset. */\nexport const Group: Component<GroupProps> = ({ x = 0, y = 0, children }) => ({\n draw: (ctx, originX, originY) => [children]\n .flat(2)\n .filter(isNode)\n .forEach(child => child.draw(ctx, originX + x, originY + y)),\n});\n\nconst React = {\n createElement<Props extends object>(\n component: Component<Props & ChildrenProps>,\n props: Props | null,\n ...children: Children[]\n ): VNode {\n return component(Object.assign({}, props, { children }));\n },\n};\n\nexport default React;\n","import LruCache from './lru-cache';\nimport { primitive } from './jsx';\nimport type { RenderProps } from '../types';\n\nabstract class Renderer<Options extends object> {\n readonly options: Options;\n\n protected constructor(options: Options) {\n this.options = { ...options };\n }\n\n /** Applies the given options and notifies `optionsUpdated` with the previous ones. */\n update(options: Partial<Options>) {\n const previous = { ...this.options };\n Object.assign(this.options, options);\n this.optionsUpdated(previous);\n }\n\n optionsUpdated(_previous: Options) {}\n\n clearCache() {}\n}\n\n/**\n * Renderer producing a bitmap from props; usable as a JSX tag through `element`.\n * Bitmaps are reused through a bounded LRU cache whenever `cacheKey` returns a key.\n */\nexport abstract class CanvasRenderer<Options extends object> extends Renderer<Options> {\n private readonly bitmaps = new LruCache<HTMLCanvasElement>(4096);\n\n abstract render(props: RenderProps): HTMLCanvasElement;\n\n /** Props with the same key must render the same pixels. Undefined disables caching. */\n protected cacheKey(_props: RenderProps): string | undefined {\n return undefined;\n }\n\n /** Device pixels per CSS pixel of the layer being drawn to; bitmaps are rendered at this scale to stay sharp. */\n pixelRatio = 1;\n\n clearCache() {\n this.bitmaps.clear();\n }\n\n paint(ctx: CanvasRenderingContext2D, props: RenderProps, x: number, y: number) {\n const key = this.cacheKey(props);\n const bitmap = (key === undefined ? undefined : this.bitmaps.get(key)) ?? this.renderBitmap(props, key);\n if (bitmap.width <= 0 || bitmap.height <= 0) return;\n ctx.drawImage(bitmap, x + (props.x ?? 0), y + (props.y ?? 0), bitmap.width / this.pixelRatio, bitmap.height / this.pixelRatio);\n }\n\n readonly element = primitive<RenderProps>((ctx, props, x, y) => this.paint(ctx, props, x, y));\n\n private renderBitmap(props: RenderProps, key: string | undefined) {\n const canvas = this.render(props);\n if (key === undefined || canvas.width <= 0 || canvas.height <= 0) return canvas;\n\n const bitmap = document.createElement('canvas');\n bitmap.width = canvas.width;\n bitmap.height = canvas.height;\n bitmap.getContext('2d')?.drawImage(canvas, 0, 0);\n this.bitmaps.set(key, bitmap);\n return bitmap;\n }\n}\n\nexport default Renderer;\n","export const getContext2d = (canvas: HTMLCanvasElement, options?: CanvasRenderingContext2DSettings) => {\n const ctx = canvas.getContext('2d', options);\n if (!ctx) throw new Error('2D canvas context is not available');\n return ctx;\n};\n","import Renderer from './renderer';\nimport { getContext2d } from './canvas';\n\ninterface LoadingOptions {\n ctx: CanvasRenderingContext2D;\n}\n\nclass Loading extends Renderer<LoadingOptions> {\n private readonly ctx: CanvasRenderingContext2D;\n\n private readonly offCanvas = document.createElement('canvas');\n\n private readonly offCtx: CanvasRenderingContext2D;\n\n private rotation = 270 * (Math.PI / 180);\n\n private readonly speed = 6;\n\n private readonly count = 75;\n\n constructor(options: LoadingOptions) {\n super(options);\n\n this.ctx = this.options.ctx;\n\n this.offCanvas.width = 250;\n this.offCanvas.height = 250;\n this.offCtx = getContext2d(this.offCanvas);\n this.offCtx.lineWidth = 0.5;\n this.offCtx.strokeStyle = 'rgba(255, 255, 255, 0.75)';\n }\n\n updateLoader() {\n this.rotation += this.speed / 100;\n }\n\n renderLoader() {\n this.offCtx.save();\n this.offCtx.globalCompositeOperation = 'source-over';\n this.offCtx.translate(125, 125);\n this.offCtx.rotate(this.rotation);\n let i = this.count;\n while (i--) {\n this.offCtx.beginPath();\n this.offCtx.arc(0, 0, i + (Math.random() * 35), Math.random(), Math.PI / 3 + (Math.random() / 12), false);\n this.offCtx.stroke();\n }\n this.offCtx.restore();\n }\n\n render() {\n this.offCtx.globalCompositeOperation = 'destination-out';\n this.offCtx.fillStyle = 'rgba(255, 255, 255, 0.03)';\n this.offCtx.fillRect(0, 0, 250, 250);\n this.updateLoader();\n this.renderLoader();\n\n const x = Math.round((this.ctx.canvas.width - this.offCanvas.width) / 2);\n const y = Math.round((this.ctx.canvas.height - this.offCanvas.height) / 2);\n this.ctx.clearRect(x, y, 250, 250);\n this.ctx.drawImage(this.offCanvas, x, y);\n\n return this.offCanvas;\n }\n}\n\nexport default Loading;\n","import { getContext2d } from './canvas';\n\nexport interface LayerOptions {\n /** Transparent canvas. Opaque layers (`false`) draw faster; keep the bottom layer opaque. */\n alpha?: boolean;\n /** Lets the browser present frames without syncing to the compositor: lower latency, but may tear. Off by default. */\n desynchronized?: boolean;\n /** Name of an existing layer to stack this one below; defaults to the top. */\n before?: string;\n}\n\n/** A named canvas stacked in the grid; renderers draw into its context. */\nclass Layer {\n readonly name: string;\n\n readonly canvas = document.createElement('canvas');\n\n readonly ctx: CanvasRenderingContext2D;\n\n constructor(name: string, { alpha = true, desynchronized = false }: Pick<LayerOptions, 'alpha' | 'desynchronized'> = {}) {\n this.name = name;\n this.canvas.className = `drawingLayer ${name}`;\n this.ctx = getContext2d(this.canvas, { alpha, desynchronized });\n }\n\n /** Size in CSS pixels; the backing store is `pixelRatio` times larger. */\n width = 0;\n\n height = 0;\n\n pixelRatio = 1;\n\n /**\n * Resizes the canvas, scaling the context so renderers keep drawing in CSS pixels.\n * Returns false, leaving the canvas untouched, when nothing changed (assigning a size clears the canvas).\n */\n resize(width: number, height: number, pixelRatio = 1) {\n if (width === this.width && height === this.height && pixelRatio === this.pixelRatio) return false;\n\n this.width = width;\n this.height = height;\n this.pixelRatio = pixelRatio;\n this.canvas.width = Math.round(width * pixelRatio);\n this.canvas.height = Math.round(height * pixelRatio);\n this.ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\n return true;\n }\n\n clear() {\n this.ctx.clearRect(0, 0, this.width, this.height);\n }\n}\n\nexport default Layer;\n","import type { CellRenderer, RendererRef } from '../types';\n\n/** Named renderers; columns refer to them by name or hand over a renderer directly. */\nclass RendererRegistry {\n private readonly renderers = new Map<string, CellRenderer>();\n\n private readonly warned = new Set<string>();\n\n register(name: string, renderer: CellRenderer) {\n this.renderers.set(name, renderer);\n this.warned.delete(name);\n }\n\n unregister(name: string) {\n this.renderers.delete(name);\n }\n\n get(name: string) {\n return this.renderers.get(name);\n }\n\n /** Resolves a reference without allocating; unknown names are reported once and yield undefined. */\n resolve(ref: RendererRef): CellRenderer | undefined {\n if (typeof ref !== 'string') return ref;\n\n const renderer = this.renderers.get(ref);\n if (!renderer && !this.warned.has(ref)) {\n this.warned.add(ref);\n console.warn(`canvas-grid: no renderer registered as \"${ref}\"`);\n }\n return renderer;\n }\n\n clearCaches() {\n this.renderers.forEach(renderer => renderer.clearCache?.());\n }\n}\n\nexport default RendererRegistry;\n","import { primitive } from '../utils/jsx';\n\nexport interface RectProps {\n x?: number;\n y?: number;\n width: number;\n height: number;\n color: string;\n /** Opacity from 0 to 1, applied on top of the color. */\n alpha?: number;\n}\n\n/** Solid rectangle, filled straight onto the target context. */\nconst Rect = primitive<RectProps>((ctx, { x = 0, y = 0, width, height, color, alpha = 1 }, originX, originY) => {\n const w = Math.trunc(width);\n const h = Math.trunc(height);\n if (!color || w <= 0 || h <= 0 || alpha <= 0) return;\n\n ctx.fillStyle = color;\n if (alpha >= 1) {\n ctx.fillRect(originX + x, originY + y, w, h);\n return;\n }\n ctx.globalAlpha = alpha;\n ctx.fillRect(originX + x, originY + y, w, h);\n ctx.globalAlpha = 1;\n});\n\nexport default Rect;\n","import React, { Group } from '../utils/jsx';\nimport Renderer from '../utils/renderer';\nimport Rect from '../rectangle';\nimport type { CellContext, CellRenderer } from '../types';\n\nexport interface CellBackgroundOptions {\n layer: string;\n enableFlashing: boolean;\n background: string;\n flashInDuration: number;\n flashOutDuration: number;\n flashRGB: string;\n borderRightWidth: number;\n borderRightColor: string;\n borderBottomWidth: number;\n borderBottomColor: string;\n}\n\nclass CellBackground extends Renderer<CellBackgroundOptions> implements CellRenderer {\n static readonly defaultOptions: CellBackgroundOptions = {\n layer: 'background',\n enableFlashing: true,\n background: '#333',\n flashInDuration: 200,\n flashOutDuration: 400,\n flashRGB: '214, 144, 13',\n borderRightWidth: 0,\n borderRightColor: '#fff',\n borderBottomWidth: 0,\n borderBottomColor: '#fff',\n };\n\n constructor(options: Partial<CellBackgroundOptions> = {}) {\n super({ ...CellBackground.defaultOptions, ...options });\n }\n\n get layer() {\n return this.options.layer;\n }\n\n /** Cells flash after their value changed, until the flash has faded out. */\n isAnimating({ age }: Readonly<CellContext>) {\n return this.options.enableFlashing && age <= this.options.flashInDuration + this.options.flashOutDuration;\n }\n\n /** Flash opacity for a cell updated `age` ms ago: fades in, then out, then 0. */\n private getFlashAlpha(age: number) {\n if (!this.options.enableFlashing) return 0;\n\n const { flashInDuration, flashOutDuration } = this.options;\n const alpha = age < flashInDuration\n ? age / flashInDuration\n : (flashInDuration + flashOutDuration - age) / flashOutDuration;\n return Math.max(0, Math.round(alpha * 1000) / 1000);\n }\n\n draw({ ctx, x, y, width, height, age }: Readonly<CellContext>) {\n const { background, flashRGB, borderRightWidth, borderRightColor, borderBottomWidth, borderBottomColor } = this.options;\n const flash = this.getFlashAlpha(age);\n\n (\n <Group>\n <Rect width={width} height={height} color={background} />\n {flash > 0 && <Rect width={width} height={height} color={`rgb(${flashRGB})`} alpha={flash} />}\n {borderRightWidth > 0 && <Rect x={width - borderRightWidth} width={borderRightWidth} height={height} color={borderRightColor} />}\n {borderBottomWidth > 0 && <Rect y={height - borderBottomWidth} width={width} height={borderBottomWidth} color={borderBottomColor} />}\n </Group>\n ).draw(ctx, x, y);\n }\n}\n\nexport default CellBackground;\n","import Collection from '../utils/collection';\nimport { CanvasRenderer } from '../utils/renderer';\nimport { getContext2d } from '../utils/canvas';\nimport type { RenderProps } from '../types';\n\nexport interface CharacterOptions {\n font: string;\n color: string;\n alpha: boolean;\n clearBeforeRender: boolean;\n}\n\nexport default class CharacterRenderer extends CanvasRenderer<CharacterOptions> {\n static readonly defaultOptions: CharacterOptions = {\n font: '12px monospace',\n color: '#fff',\n alpha: true,\n clearBeforeRender: true,\n };\n\n private readonly charWidthCache = new Collection<number>();\n\n private readonly canvas = document.createElement('canvas');\n\n private readonly ctx: CanvasRenderingContext2D;\n\n constructor(options: Partial<CharacterOptions> = {}) {\n super({ ...CharacterRenderer.defaultOptions, ...options });\n\n this.ctx = getContext2d(this.canvas, { alpha: this.options.alpha });\n this.ctx.textAlign = 'left';\n this.ctx.textBaseline = 'top';\n }\n\n set font(font: string) {\n if (this.options.font !== font) {\n this.options.font = font;\n }\n }\n\n set color(color: string) {\n this.options.color = color;\n }\n\n clearCache() {\n super.clearCache();\n this.charWidthCache.clear();\n }\n\n protected cacheKey({ value = '', height = 0 }: RenderProps) {\n return `${this.options.font}|${this.options.color}|${this.pixelRatio}|${height}|${value}`;\n }\n\n getCharacterWidth(character = '') {\n const cached = this.charWidthCache.get(character);\n if (cached) {\n return cached;\n }\n if (this.ctx.font !== this.options.font) {\n this.ctx.font = this.options.font;\n this.ctx.textAlign = 'left';\n this.ctx.textBaseline = 'top';\n }\n const width = Math.ceil(this.ctx.measureText(character).width);\n this.charWidthCache.set(character, width);\n return width;\n }\n\n render({ value = '', height = 0 }: RenderProps) {\n const { pixelRatio } = this;\n this.canvas.width = Math.round(this.getCharacterWidth(value) * pixelRatio);\n this.canvas.height = Math.round(height * pixelRatio);\n // sizing the canvas reset the context, so the state is set up again below\n this.ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\n\n this.ctx.font = this.options.font;\n this.ctx.textAlign = 'left';\n this.ctx.textBaseline = 'top';\n if (this.ctx.fillStyle !== this.options.color) {\n this.ctx.fillStyle = this.options.color;\n }\n\n this.ctx.fillText(value, 0, 0);\n\n return this.canvas;\n }\n}\n","import Renderer from '../utils/renderer';\nimport { primitive } from '../utils/jsx';\nimport CharacterRenderer from '../character';\nimport type { RenderProps } from '../types';\n\nexport interface TextOptions {\n ellipsis: string;\n cellPadding: {\n top: number;\n right: number;\n bottom: number;\n left: number;\n };\n font: string;\n color: string;\n isEllipsisRight: boolean;\n}\n\nclass TextRenderer extends Renderer<TextOptions> {\n static readonly defaultOptions: TextOptions = {\n ellipsis: '…',\n cellPadding: {\n top: 3,\n right: 3,\n bottom: 3,\n left: 3,\n },\n font: '12px monospace',\n color: '#fff',\n isEllipsisRight: true,\n };\n\n private readonly characterRenderer: CharacterRenderer;\n\n constructor(options: Partial<TextOptions> = {}) {\n super({ ...TextRenderer.defaultOptions, ...options });\n\n this.characterRenderer = new CharacterRenderer({\n font: this.options.font,\n color: this.options.color,\n });\n }\n\n set font(font: string) {\n if (this.options.font !== font) {\n this.options.font = font;\n this.characterRenderer.font = font;\n this.clearCache();\n }\n }\n\n get font() {\n return this.options.font;\n }\n\n set color(color: string) {\n this.options.color = color;\n this.characterRenderer.color = color;\n }\n\n get color() {\n return this.options.color;\n }\n\n set pixelRatio(pixelRatio: number) {\n this.characterRenderer.pixelRatio = pixelRatio;\n }\n\n get pixelRatio() {\n return this.characterRenderer.pixelRatio;\n }\n\n clearCache() {\n this.characterRenderer.clearCache();\n }\n\n getTextWidth(text: string) {\n let totalWidth = 0;\n for (let i = 0; i < text.length; i++) {\n const character = text.charAt(i);\n totalWidth += this.characterRenderer.getCharacterWidth(character);\n }\n return totalWidth;\n }\n\n /** Draws the text clipped with an ellipsis; `(x, y)` is the offset of the text box from `(originX, originY)`. */\n paint(ctx: CanvasRenderingContext2D, { value = '', x = 0, y = 0, width = 0, height = 0 }: RenderProps, originX: number, originY: number) {\n const ellipsisWidth = this.characterRenderer.getCharacterWidth(this.options.ellipsis);\n const verticalPadding = this.options.cellPadding.left + this.options.cellPadding.right;\n const availableWidth = width - ellipsisWidth - verticalPadding;\n const left = originX + x;\n const top = originY + y + this.options.cellPadding.top;\n const maxHeight = height - this.options.cellPadding.top - this.options.cellPadding.bottom;\n let currentXOffset = this.options.cellPadding.left;\n let currentWidth = 0;\n\n // break down to character for better caching; characters are drawn directly, no per-glyph elements\n for (let i = 0; i < value.length; i++) {\n const character = value.charAt(i);\n const characterWidth = Math.round(this.characterRenderer.getCharacterWidth(character));\n\n if (Math.ceil(currentWidth + characterWidth) >= availableWidth) {\n this.characterRenderer.paint(ctx, { value: this.options.ellipsis, height: maxHeight }, left + currentXOffset, top);\n break;\n }\n this.characterRenderer.paint(ctx, { value: character, height: maxHeight }, left + currentXOffset, top);\n currentWidth += characterWidth;\n currentXOffset += characterWidth;\n }\n }\n\n readonly element = primitive<RenderProps>((ctx, props, x, y) => this.paint(ctx, props, x, y));\n}\n\nexport default TextRenderer;\n","import React, { Group } from '../utils/jsx';\nimport Renderer from '../utils/renderer';\nimport Rect from '../rectangle';\nimport TextRenderer from '../text';\nimport type { CellContext, CellRenderer } from '../types';\n\nexport interface HeaderOptions {\n layer: string;\n background: string;\n font: string;\n color: string;\n borderRightWidth: number;\n borderRightColor: string;\n borderBottomWidth: number;\n borderBottomColor: string;\n}\n\nclass HeaderRenderer extends Renderer<HeaderOptions> implements CellRenderer {\n static readonly defaultOptions: HeaderOptions = {\n layer: 'header',\n background: '#333',\n font: '13px monospace',\n color: '#fff',\n borderRightWidth: 1,\n borderRightColor: '#fff',\n borderBottomWidth: 1,\n borderBottomColor: '#fff',\n };\n\n private readonly textRenderer: TextRenderer;\n\n constructor(options: Partial<HeaderOptions> = {}) {\n super({ ...HeaderRenderer.defaultOptions, ...options });\n\n this.textRenderer = new TextRenderer({\n font: this.options.font,\n color: this.options.color,\n });\n }\n\n get layer() {\n return this.options.layer;\n }\n\n set font(font: string) {\n this.options.font = font;\n this.textRenderer.font = font;\n }\n\n get font() {\n return this.textRenderer.font;\n }\n\n set pixelRatio(pixelRatio: number) {\n this.textRenderer.pixelRatio = pixelRatio;\n }\n\n get pixelRatio() {\n return this.textRenderer.pixelRatio;\n }\n\n clearCache() {\n this.textRenderer.clearCache();\n }\n\n draw({ ctx, x, y, width, height, formatted }: Readonly<CellContext>) {\n if (width === 0 || height === 0) return;\n\n const { background, borderRightWidth, borderRightColor, borderBottomWidth, borderBottomColor } = this.options;\n\n (\n <Group>\n <Rect width={width} height={height} color={background} />\n {borderRightWidth > 0 && <Rect x={width - borderRightWidth} width={borderRightWidth} height={height} color={borderRightColor} />}\n {borderBottomWidth > 0 && <Rect y={height - borderBottomWidth} width={width} height={borderBottomWidth} color={borderBottomColor} />}\n <this.textRenderer.element value={formatted} width={width} height={height} />\n </Group>\n ).draw(ctx, x, y);\n }\n}\n\nexport default HeaderRenderer;\n","import React from '../utils/jsx';\nimport Renderer from '../utils/renderer';\nimport TextRenderer from '../text';\nimport type { CellContext, CellRenderer } from '../types';\n\nexport interface CellValueOptions {\n layer: string;\n font: string;\n color: string;\n}\n\nexport default class CellValueRenderer extends Renderer<CellValueOptions> implements CellRenderer {\n static readonly defaultOptions: CellValueOptions = {\n layer: 'content',\n font: '12px monospace',\n color: '#fff',\n };\n\n private readonly renderer: TextRenderer;\n\n constructor(options: Partial<CellValueOptions> = {}) {\n super({ ...CellValueRenderer.defaultOptions, ...options });\n\n this.renderer = new TextRenderer({\n font: this.options.font,\n color: this.options.color,\n });\n }\n\n get layer() {\n return this.options.layer;\n }\n\n set font(font: string) {\n this.options.font = font;\n this.renderer.font = font;\n }\n\n get font() {\n return this.options.font;\n }\n\n set color(color: string) {\n this.options.color = color;\n this.renderer.color = color;\n }\n\n get color() {\n return this.options.color;\n }\n\n set pixelRatio(pixelRatio: number) {\n this.renderer.pixelRatio = pixelRatio;\n }\n\n get pixelRatio() {\n return this.renderer.pixelRatio;\n }\n\n clearCache() {\n this.renderer.clearCache();\n }\n\n draw({ ctx, x, y, width, height, formatted, valueChanged, forced }: Readonly<CellContext>) {\n if (!valueChanged && !forced) return;\n\n ctx.clearRect(x, y, width, height);\n (<this.renderer.element value={formatted} width={width} height={height} />).draw(ctx, x, y);\n }\n}\n","import throttle from 'lodash.throttle';\nimport debounce from 'lodash.debounce';\nimport Collection from './utils/collection';\nimport ColumnStore from './utils/column-store';\nimport DataStore from './utils/data-store';\nimport LruCache from './utils/lru-cache';\nimport { getRowId } from './utils/selectors';\nimport styles from './component.css?inline';\nimport Loading from './utils/loading';\nimport Layer from './utils/layer';\nimport RendererRegistry from './utils/renderer-registry';\nimport CellBackground from './cell-background';\nimport HeaderRenderer from './header';\nimport CellValueRenderer from './cell-value';\nimport type { LayerOptions } from './utils/layer';\nimport type { CellContext, CellRenderer, CellState, Key, RendererRef, RowId, RowInput, SortDirection, SortKey } from './types';\nimport type { RowIdGetter } from './utils/data-store';\n\nconst classes = {\n scrollArea: 'scrollArea',\n};\n\n/** Layers and renderers every grid starts with. */\nconst builtIn = {\n background: 'background',\n content: 'content',\n header: 'header',\n backgroundRenderer: 'background',\n valueRenderer: 'value',\n headerRenderer: 'header',\n};\n\n/** What the grid remembers about a cell between frames. */\ninterface CellEntry {\n /** The raw value last drawn, and its formatted text; formatting only runs when the value differs. */\n value: unknown;\n formatted: string | undefined;\n animating: boolean;\n state: CellState;\n}\n\nconst STYLE_ELEMENT_ID = 'canvas-grid-styles';\n\nconst injectStyles = () => {\n if (document.getElementById(STYLE_ELEMENT_ID)) return;\n const style = document.createElement('style');\n style.id = STYLE_ELEMENT_ID;\n style.textContent = styles;\n document.head.appendChild(style);\n};\n\nexport interface ColumnHeader {\n index: number;\n id: Key;\n displayName?: string;\n width: number;\n /** Renderers drawing a cell of this column, in order. Defaults to the grid's `cellRenderers`. */\n renderers?: RendererRef[];\n valueFormatter: (value: unknown) => string;\n /** Renderer drawing the header of this column. */\n headerRenderer: RendererRef;\n}\n\nexport type ColumnDefinition = Key | (Partial<ColumnHeader> & { id: Key });\n\nexport interface Transaction {\n add?: RowInput[];\n remove?: RowInput[];\n update?: RowInput[];\n}\n\ninterface AgApi {\n setRowData: (data: RowInput[]) => void;\n updateRowData: (transaction: Transaction) => void;\n setColumnDefs: (columns: ColumnDefinition[]) => void;\n getRowNodeId: RowIdGetter;\n}\n\nexport type { CellContext, CellRenderer, CellState, LayerOptions, RendererRef, SortDirection, SortKey };\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'canvas-grid': CanvasGridComponent;\n }\n}\n\nclass CanvasGridComponent extends HTMLElement {\n fps = 30;\n _font = '12px monospace';\n _headerFont = '13px monospace';\n headerHeight = 30;\n cellHeight = 20;\n cellPadding = {\n top: 3,\n right: 3,\n bottom: 3,\n left: 3,\n };\n showRowNumbers = true;\n showHeaders = true;\n rowNumbersWidth = 30;\n ellipsis = '…';\n _backgroundColor = '#333';\n _headerBackgroundColor = '#222';\n textColor = '#efefef';\n dataStore = new DataStore({\n getRowId: (row, index) => this.getRowId(row, index),\n getCellHeight: () => this.cellHeight,\n });\n _dataCollection = this.dataStore.rows;\n /** Per-cell memory of the rows drawn recently; bounded, since only the rows in view need it. */\n cellEntries = new LruCache<Record<string, CellEntry>>(2048);\n getRowId: RowIdGetter = getRowId;\n headers = new Collection<ColumnHeader>();\n animationFrame: number | undefined = undefined;\n scrollYOffset = 0;\n prevScrollYOffset = 0;\n scrollXOffset = 0;\n prevScrollXOffset = 0;\n lastRender = new Date().valueOf();\n lastDraw = this.lastRender;\n isScrolling = false;\n scrollHelper = document.createElement('div');\n scrollArea = this.createScrollArea();\n\n /** Canvases from bottom to top. */\n layers: Layer[] = [];\n private readonly layersByName = new Map<string, Layer>();\n private readonly warnedLayers = new Set<string>();\n renderers = new RendererRegistry();\n /** Renderers drawing a cell when its column does not name its own. */\n cellRenderers: RendererRef[] = [builtIn.backgroundRenderer, builtIn.valueRenderer];\n\n cellBackgroundRenderer = new CellBackground({\n layer: builtIn.background,\n background: this._backgroundColor,\n enableFlashing: true,\n flashInDuration: 200,\n flashOutDuration: 400,\n flashRGB: '214, 144, 13',\n borderRightWidth: 1,\n borderRightColor: '#3f3f3f',\n borderBottomWidth: 1,\n borderBottomColor: '#3f3f3f',\n });\n\n cellValueRenderer = new CellValueRenderer({\n layer: builtIn.content,\n font: this._font,\n color: this.textColor,\n });\n\n headerCellRenderer = new HeaderRenderer({\n layer: builtIn.header,\n font: this._headerFont,\n color: this.textColor,\n background: '#222',\n borderRightWidth: 1,\n borderRightColor: '#2f2f2f',\n borderBottomWidth: 1,\n borderBottomColor: '#2f2f2f',\n });\n\n loadingIndicator: Loading;\n /** Reused for every cell drawn; see CellContext. */\n private readonly cell: CellContext;\n private readonly placeholderState: CellState = {};\n throttleTransation = throttle(() => {\n const prevSize = this.totalHeight;\n const moved = this.dataStore.flush();\n if (prevSize !== this.totalHeight) {\n this.refreshScrollbar();\n }\n // rows that were removed or re-sorted changed position, and a normal draw only repaints cells whose value changed\n if (moved) this.forceDraw();\n this.requestRender();\n }, 50);\n\n agApi: AgApi;\n\n constructor() {\n super();\n\n this.resize = this.resize.bind(this);\n this.setValues = this.setValues.bind(this);\n this.setColumns = this.setColumns.bind(this);\n this.clearValues = this.clearValues.bind(this);\n this.updateLastRender = this.updateLastRender.bind(this);\n this.transaction = this.transaction.bind(this);\n this.queueUpdate = this.queueUpdate.bind(this);\n\n this.addLayer(builtIn.background, { alpha: false });\n this.addLayer(builtIn.content);\n this.addLayer(builtIn.header);\n this.registerRenderer(builtIn.backgroundRenderer, this.cellBackgroundRenderer);\n this.registerRenderer(builtIn.valueRenderer, this.cellValueRenderer);\n this.registerRenderer(builtIn.headerRenderer, this.headerCellRenderer);\n this.loadingIndicator = new Loading({ ctx: this.requireLayer(builtIn.header).ctx });\n this.cell = {\n ctx: this.requireLayer(builtIn.content).ctx,\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n row: undefined,\n column: undefined,\n value: undefined,\n formatted: '',\n updatedAt: undefined,\n age: Infinity,\n now: 0,\n dt: 0,\n valueChanged: false,\n forced: false,\n isScrolling: false,\n state: {},\n };\n\n const component = this;\n this.agApi = {\n setRowData: this.setValues,\n updateRowData: this.transaction,\n setColumnDefs: this.setColumns,\n get getRowNodeId() {\n return component.getRowId;\n },\n set getRowNodeId(getId) {\n if (typeof getId === 'function') component.getRowId = getId;\n },\n };\n }\n\n /** Canvas of the content layer, which also defines the viewport size. */\n get canvas() {\n return this.requireLayer(builtIn.content).canvas;\n }\n\n get flashInDuration() {\n return this.cellBackgroundRenderer.options.flashInDuration;\n }\n\n set flashInDuration(flashInDuration: number) {\n this.cellBackgroundRenderer.update({ flashInDuration });\n }\n\n get flashOutDuration() {\n return this.cellBackgroundRenderer.options.flashOutDuration;\n }\n\n set flashOutDuration(flashOutDuration: number) {\n this.cellBackgroundRenderer.update({ flashOutDuration });\n }\n\n getLayer(name: string) {\n return this.layersByName.get(name);\n }\n\n private requireLayer(name: string) {\n const layer = this.getLayer(name);\n if (!layer) throw new Error(`canvas-grid: no layer named \"${name}\"`);\n return layer;\n }\n\n /** Adds a canvas on top of the existing layers, or below the layer named in `before`. */\n addLayer(name: string, { alpha = true, desynchronized = false, before }: LayerOptions = {}) {\n if (this.getLayer(name)) throw new Error(`canvas-grid: layer \"${name}\" already exists`);\n\n const layer = new Layer(name, { alpha, desynchronized });\n const next = before === undefined ? undefined : this.requireLayer(before);\n this.layers.splice(next ? this.layers.indexOf(next) : this.layers.length, 0, layer);\n this.layersByName.set(name, layer);\n // the constructor already runs on elements that are in the document, before connectedCallback mounted anything\n if (this.scrollArea.parentElement === this) {\n this.insertBefore(layer.canvas, next?.canvas ?? this.scrollArea);\n layer.resize(this.clientWidth, this.clientHeight, this.pixelRatio);\n this.forceDraw();\n }\n return layer;\n }\n\n removeLayer(name: string) {\n const layer = this.requireLayer(name);\n this.layers = this.layers.filter(candidate => candidate !== layer);\n this.layersByName.delete(name);\n layer.canvas.remove();\n }\n\n /** Makes a renderer available to columns under `name`; registering an existing name replaces it. */\n registerRenderer(name: string, renderer: CellRenderer) {\n this.renderers.register(name, renderer);\n }\n\n unregisterRenderer(name: string) {\n this.renderers.unregister(name);\n }\n\n createScrollArea() {\n const scrollArea = document.createElement('div');\n scrollArea.className = classes.scrollArea;\n scrollArea.appendChild(this.scrollHelper);\n return scrollArea;\n }\n\n set font(font: string) {\n if (this._font !== font) {\n this._font = font;\n this.cellValueRenderer.font = font;\n }\n }\n\n get font() {\n return this._font;\n }\n\n set headerFont(font: string) {\n if (this._headerFont !== font) {\n this._headerFont = font;\n this.headerCellRenderer.font = font;\n }\n }\n\n get headerFont() {\n return this._headerFont;\n }\n\n connectedCallback() {\n this.layers.forEach(layer => this.appendChild(layer.canvas));\n this.appendChild(this.scrollArea);\n\n this.updateLastRender();\n this.resize();\n if (this.headers.length === 0) this.setColumns(Array(50).fill(1).map((_, index) => index));\n\n document.addEventListener('visibilitychange', this.onVisibilityChange);\n this.observeSize();\n this.pixelRatioQuery = window.matchMedia(`(resolution: ${this.pixelRatio}dppx)`);\n this.pixelRatioQuery.addEventListener('change', this.watchPixelRatio, { once: true });\n\n if (document.fonts) {\n document.fonts.addEventListener('loadingdone', this.onFontsLoaded);\n } else {\n this.fontsTimeout = setTimeout(this.onFontsLoaded, 2000);\n }\n\n const debounceAfterScroll = debounce(() => {\n this.isScrolling = false;\n }, 200);\n const throttledUpdate = throttle((scrollYOffset: number, scrollXOffset: number) => {\n this.scrollXOffset = Math.round(scrollXOffset);\n this.scrollYOffset = Math.round(scrollYOffset);\n debounceAfterScroll();\n this.requestRender();\n }, 10);\n this.scrollArea.addEventListener('scroll', () => {\n const { scrollTop, scrollLeft } = this.scrollArea;\n this.isScrolling = true;\n throttledUpdate(scrollTop, scrollLeft);\n });\n }\n\n private fontsTimeout: ReturnType<typeof setTimeout> | undefined = undefined;\n\n private readonly onVisibilityChange = () => {\n if (document.visibilityState === 'hidden') {\n this.cancelRender();\n return;\n }\n this.resize();\n };\n\n private readonly onFontsLoaded = () => {\n this.renderers.clearCaches();\n this.resize();\n };\n\n cancelRender() {\n if (this.animationFrame !== undefined) cancelAnimationFrame(this.animationFrame);\n this.animationFrame = undefined;\n }\n\n /**\n * Schedules a draw for the next animation frame. Nothing is drawn while the grid is idle:\n * scrolling, data changes and resizes request a draw, and `draw` requests the next one itself while a cell animates.\n */\n requestRender() {\n this.animationFrame ??= requestAnimationFrame(() => this.render());\n }\n\n updateLastRender() {\n this.lastRender = new Date().valueOf();\n }\n\n render() {\n this.animationFrame = undefined;\n const delta = new Date().valueOf() - this.lastRender;\n if (delta < (1000 / this.fps)) {\n this.requestRender();\n return;\n }\n this.draw();\n this.updateLastRender();\n }\n\n hasScrolled() {\n return this.hasXScrolled() || this.hasYScrolled();\n }\n\n hasYScrolled() {\n return this.prevScrollYOffset !== this.scrollYOffset;\n }\n\n hasXScrolled() {\n return this.prevScrollXOffset !== this.scrollXOffset;\n }\n\n isInViewport(x = 0, y = 0, width = 0, height = 0) {\n if (x > this.viewportWidth) return false;\n if (y > this.viewportHeight) return false;\n if (x + width < 0) return false;\n if (y + height < 0) return false;\n\n return true;\n }\n\n /** Fills the shared context for something that is not a data cell: a header, row number or placeholder. */\n private describe(x: number, y: number, width: number, height: number, overrides: Partial<CellContext>) {\n return Object.assign(this.cell, {\n x,\n y,\n width,\n height,\n row: undefined,\n column: undefined,\n value: undefined,\n formatted: '',\n updatedAt: undefined,\n age: Infinity,\n valueChanged: true,\n forced: true,\n state: this.placeholderState,\n }, overrides);\n }\n\n private paint(ref: RendererRef) {\n const renderer = this.renderers.resolve(ref);\n const layer = renderer && this.layersByName.get(renderer.layer);\n if (renderer && !layer && !this.warnedLayers.has(renderer.layer)) {\n this.warnedLayers.add(renderer.layer);\n console.warn(`canvas-grid: renderer draws on missing layer \"${renderer.layer}\"`);\n }\n if (!renderer || !layer) return;\n\n this.cell.ctx = layer.ctx;\n renderer.draw(this.cell);\n }\n\n private paintAll(refs: readonly RendererRef[]) {\n refs.forEach(ref => this.paint(ref));\n }\n\n private isAnimating(refs: readonly RendererRef[]) {\n return refs.some(ref => this.renderers.resolve(ref)?.isAnimating?.(this.cell) === true);\n }\n\n draw(forced = false) {\n const now = new Date().valueOf();\n const redrawAll = forced || this.hasScrolled();\n this.cell.now = now;\n this.cell.dt = now - this.lastDraw;\n this.cell.isScrolling = this.isScrolling;\n this.lastDraw = now;\n // the loading indicator animates until there is data\n let keepDrawing = this._dataCollection.length === 0;\n\n if ((forced || this.hasXScrolled()) && this.showHeaders) {\n this.renderHeaders();\n }\n\n const fakeRows = 200;\n if (forced && this.showRowNumbers && this._dataCollection.length === 0) {\n for (let fakeRowIndex= 0; fakeRowIndex <= fakeRows; fakeRowIndex++) {\n this.renderRowNumber({ index: fakeRowIndex }, (fakeRowIndex * this.cellHeight) + (this.showHeaders ? this.headerHeight : 0) - this.scrollYOffset);\n }\n }\n\n if (this._dataCollection.length === 0) {\n this.loadingIndicator.render();\n for (let fakeRowIndex= 0; fakeRowIndex <= fakeRows; fakeRowIndex++) {\n this.headers.forEach(header => {\n this.describe(\n Math.round((header.index * header.width) + (this.showRowNumbers ? this.rowNumbersWidth : 0) - this.scrollXOffset),\n Math.round((fakeRowIndex * this.cellHeight) + (this.showHeaders ? this.headerHeight : 0) - this.scrollYOffset),\n header.width,\n this.cellHeight,\n { column: header, valueChanged: false },\n );\n this.paintAll(header.renderers ?? this.cellRenderers);\n });\n }\n }\n\n const originY = Math.round((this.showHeaders ? this.headerHeight : 0) - this.scrollYOffset);\n const xOffset = Math.round((this.showRowNumbers ? this.rowNumbersWidth : 0) - this.scrollXOffset);\n // only the rows overlapping the viewport: found by offset instead of walking from the first row\n const firstRow = this._dataCollection.indexAt(-originY);\n const visibleColumns = this.getVisibleColumns(xOffset);\n for (let rowIndex = firstRow; rowIndex < this._dataCollection.length; rowIndex++) {\n const row = this._dataCollection.at(rowIndex);\n const currentY = originY + this._dataCollection.topOf(rowIndex);\n if (!row || currentY >= this.viewportHeight) break;\n\n const { id: key, slot } = row;\n\n if ((forced || this.hasYScrolled()) && this.showRowNumbers) {\n this.renderRowNumber(row, currentY);\n }\n\n if (row.height + currentY > 0) {\n let entries = this.cellEntries.get(String(key));\n if (!entries) {\n entries = {};\n this.cellEntries.set(String(key), entries);\n }\n const cellRow = { id: key, index: row.index };\n\n for (const { header, id: columnKey, x, store } of visibleColumns) {\n const value = store?.get(slot);\n if (value === undefined) continue;\n\n const entry = entries[columnKey] ??= { value: undefined, formatted: undefined, animating: false, state: {} };\n // values are only formatted for the cells being drawn, and again only once they change\n const formatted = entry.formatted !== undefined && entry.value === value ? entry.formatted : header.valueFormatter(value);\n const valueChanged = entry.formatted !== formatted;\n const updatedAt = store?.getUpdatedAt(slot);\n\n const { cell } = this;\n cell.x = x;\n cell.y = currentY;\n cell.width = header.width;\n cell.height = row.height;\n cell.row = cellRow;\n cell.column = header;\n cell.value = value;\n cell.formatted = formatted;\n cell.updatedAt = updatedAt;\n cell.age = updatedAt === undefined ? Infinity : now - updatedAt;\n cell.valueChanged = valueChanged;\n cell.forced = redrawAll;\n cell.state = entry.state;\n const refs = header.renderers ?? this.cellRenderers;\n const animating = this.isAnimating(refs);\n // an animation gets one last frame after it stops, so its final state is what stays on screen\n if (redrawAll || valueChanged || animating || entry.animating) this.paintAll(refs);\n entry.animating = animating;\n entry.value = value;\n entry.formatted = formatted;\n keepDrawing ||= animating;\n }\n }\n }\n if (this.scrollYOffset > 0 || this.scrollXOffset > 0) {\n this.renderBrick();\n }\n this.prevScrollYOffset = this.scrollYOffset;\n this.prevScrollXOffset = this.scrollXOffset;\n if (keepDrawing) this.requestRender();\n }\n\n /** The columns overlapping the viewport horizontally, with their x position and values; found once per draw, not per row. */\n private getVisibleColumns(xOffset: number) {\n const visible: { header: ColumnHeader; id: string; x: number; store: ColumnStore | undefined }[] = [];\n let x = xOffset;\n this.headers.forEach((header, key) => {\n if (this.isInViewport(x, 0, header.width, 0)) {\n visible.push({ header, id: String(key), x, store: this.dataStore.columns.get(String(key)) });\n }\n x += Math.round(header.width);\n });\n return visible;\n }\n\n renderRowNumber(row: { index: number; height?: number }, y: number) {\n if (!this.isInViewport(0, y, this.rowNumbersWidth, row.height)) return;\n this.describe(0, Math.ceil(y), this.rowNumbersWidth, row.height ?? 0, {\n row: { id: row.index, index: row.index },\n formatted: `${row.index + 1}`,\n });\n this.paint(builtIn.headerRenderer);\n }\n\n forceDraw() {\n this.layers.forEach(layer => layer.clear());\n this.draw(true);\n }\n\n /** Viewport size in CSS pixels as of the last resize; cached because reading `clientWidth` per cell is slow. */\n viewportWidth = 0;\n\n viewportHeight = 0;\n\n /** Device pixels per CSS pixel; canvases are scaled by it to stay sharp on HiDPI screens. */\n get pixelRatio() {\n return window.devicePixelRatio || 1;\n }\n\n /** Resizes the layers when the size or pixel ratio changed, then redraws everything. */\n resize() {\n this.cancelRender();\n const { pixelRatio } = this;\n this.viewportWidth = this.clientWidth;\n this.viewportHeight = this.clientHeight;\n this.layers.forEach(layer => layer.resize(this.clientWidth, this.clientHeight, pixelRatio));\n if (this.cellValueRenderer.pixelRatio !== pixelRatio) {\n this.renderers.clearCaches();\n }\n this.cellValueRenderer.pixelRatio = pixelRatio;\n this.headerCellRenderer.pixelRatio = pixelRatio;\n this.forceDraw();\n }\n\n /** Redraws when the element changes size, instead of checking on every frame. */\n private observeSize() {\n this.resizeObserver ??= new ResizeObserver(() => this.resize());\n this.resizeObserver.observe(this);\n }\n\n /** The pixel ratio changes with browser zoom or when the window moves to another screen. */\n private watchPixelRatio = () => {\n this.pixelRatioQuery?.removeEventListener('change', this.watchPixelRatio);\n this.pixelRatioQuery = window.matchMedia(`(resolution: ${this.pixelRatio}dppx)`);\n this.pixelRatioQuery.addEventListener('change', this.watchPixelRatio, { once: true });\n this.resize();\n };\n\n private resizeObserver: ResizeObserver | undefined = undefined;\n\n private pixelRatioQuery: MediaQueryList | undefined = undefined;\n\n /** A row's position and height along with its values by column id, or undefined for an unknown row. */\n getRowData(rowId: RowId) {\n const row = this._dataCollection.get(rowId);\n if (!row) return undefined;\n\n const values: Record<string, unknown> = {};\n this.dataStore.columns.forEach((column, key) => {\n const value = column.get(row.slot);\n if (value !== undefined) values[key] = value;\n });\n return { id: row.id, index: row.index, height: row.height, values };\n }\n\n /** Orders the rows by the given columns, in priority order; an empty list restores the original order. */\n setSortModel(model: readonly SortKey[]) {\n this.dataStore.setSortModel(model);\n this.forceDraw();\n }\n\n getSortModel() {\n return this.dataStore.getSortModel();\n }\n\n renderBrick() {\n if (this.showHeaders && this.showRowNumbers && this._headerBackgroundColor) {\n this.describe(0, 0, this.rowNumbersWidth, this.headerHeight, {});\n this.paint(builtIn.headerRenderer);\n }\n }\n\n renderHeaders() {\n let currentX = (this.showRowNumbers ? this.rowNumbersWidth : 0) - this.scrollXOffset;\n\n this.headers.forEach(header => {\n if (this.isInViewport(currentX, 0, header.width, this.headerHeight)) {\n this.describe(currentX, 0, header.width, this.headerHeight, {\n column: header,\n formatted: header.displayName ?? '',\n });\n this.paint(header.headerRenderer);\n }\n currentX += header.width;\n });\n\n if (this.scrollXOffset + this.rowNumbersWidth > 0) {\n this.renderBrick();\n }\n }\n\n getColumnHeader(key: Key) {\n return this.headers.get(key);\n }\n\n get totalHeight() {\n return this._dataCollection.totalHeight;\n }\n\n refreshScrollbar() {\n const height = this.totalHeight + this.headerHeight;\n this.scrollHelper.style.height = `${height}px`;\n let width = 0;\n this.headers.forEach(header => {\n width += Math.round(header.width);\n });\n this.scrollHelper.style.width = `${width}px`;\n }\n\n queueUpdate(row: RowInput) {\n this.dataStore.queueUpdate(row);\n this.throttleTransation();\n }\n\n queueRemove(row: RowInput) {\n this.dataStore.queueRemove(row);\n this.throttleTransation();\n }\n\n transaction({ add = [], remove = [], update = [] }: Transaction) {\n if (Array.isArray(add)) {\n add.forEach(row => this.queueUpdate(row));\n }\n\n if (Array.isArray(update)) {\n update.forEach(row => this.queueUpdate(row));\n }\n\n if (Array.isArray(remove)) {\n remove.forEach(row => this.queueRemove(row));\n }\n }\n\n clearValues() {\n this.dataStore.clear();\n this.cellEntries.clear();\n }\n\n formatValue(key: Key, value: unknown) {\n return this.headers.get(key)?.valueFormatter(value) ?? String(value);\n }\n\n setValues(data: RowInput[]) {\n this.throttleTransation.cancel();\n this.clearValues();\n if (!Array.isArray(data)) return;\n this.dataStore.setRows(data);\n this.refreshScrollbar();\n this.forceDraw();\n }\n\n setColumns(columns: ColumnDefinition[]) {\n if (Array.isArray(columns)) {\n this.headers.clear();\n // cached formatted values belong to the previous formatters\n this.cellEntries.clear();\n const defaults = {\n width: 100,\n valueFormatter: (v: unknown) => String(v),\n headerRenderer: builtIn.headerRenderer,\n };\n columns.forEach((column, index) => {\n if (typeof column === 'string' || typeof column === 'number') {\n const columnId = column + '';\n this.headers.set(columnId, {\n ...defaults,\n index: index,\n id: column,\n displayName: columnId,\n });\n }\n if (typeof column === 'object') {\n this.headers.set(column.id + '', {\n ...defaults,\n index: index,\n ...column,\n });\n }\n });\n this.refreshScrollbar();\n this.forceDraw();\n }\n }\n\n disconnectedCallback() {\n this.cancelRender();\n document.removeEventListener('visibilitychange', this.onVisibilityChange);\n this.resizeObserver?.disconnect();\n this.pixelRatioQuery?.removeEventListener('change', this.watchPixelRatio);\n document.fonts?.removeEventListener('loadingdone', this.onFontsLoaded);\n clearTimeout(this.fontsTimeout);\n }\n}\n\nif (window && window.customElements) {\n injectStyles();\n customElements.define('canvas-grid', CanvasGridComponent);\n}\n\nexport default CanvasGridComponent;\n"],"ignoreList":[0,1],"mappings":";;;;;;;;;;;CAUA,IAAI0B,IAAkB,uBAGlBC,IAAM,KAMNC,IAAS,cAGTC,I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AAFA,KAAK,mBAAmB,OAAO,GAC/B,KAAK,YAAY,GACZ,MAAM,QAAQuE,CAAI,MACvB,KAAK,UAAU,QAAQA,CAAI,GAC3B,KAAK,iBAAiB,GACtB,KAAK,UAAU;CACjB;CAEA,WAAW,GAA6B;EACtC,IAAI,MAAM,QAAQyH,CAAO,GAAG;GAG1B,AAFA,KAAK,QAAQ,MAAM,GAEnB,KAAK,YAAY,MAAM;GACvB,IAAMC,IAAW;IACf,OAAO;IACP,iBAAiB,MAAe,OAAOC,CAAC;IACxC,gBAAgBxC,EAAQ;GAC1B;GAoBA,AAnBAsC,EAAQ,SAAS,GAAQ,MAAU;IACjC,IAAI,OAAOpH,KAAW,YAAY,OAAOA,KAAW,UAAU;KAC5D,IAAMG,IAAWH,IAAS;KAC1B,KAAK,QAAQ,IAAIG,GAAU;MACzB,GAAGkH;MACI;MACP,IAAIrH;MACJ,aAAaG;KACf,CAAC;IACH;IACA,AAAI,OAAOH,KAAW,YACpB,KAAK,QAAQ,IAAIA,EAAO,KAAK,IAAI;KAC/B,GAAGqH;KACI;KACP,GAAGrH;IACL,CAAC;GAEL,CAAC,GACD,KAAK,iBAAiB,GACtB,KAAK,UAAU;EACjB;CACF;CAEA,uBAAuB;EAMrB,AALA,KAAK,aAAa,GAClB,SAAS,oBAAoB,oBAAoB,KAAK,kBAAkB,GACxE,KAAK,gBAAgB,WAAW,GAChC,KAAK,iBAAiB,oBAAoB,UAAU,KAAK,eAAe,GACxE,SAAS,OAAO,oBAAoB,eAAe,KAAK,aAAa,GACrE,aAAa,KAAK,YAAY;CAChC;AACF;AAEI,UAAU,OAAO,mBACnBgF,EAAa,GACb,eAAe,OAAO,eAAeE,CAAmB"}
|
|
1
|
+
{"version":3,"file":"web-component.mjs","names":["styles","throttle","debounce","__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__commonJSMin","mod","cb","__copyProps","from","keys","i","n","key","to","except","k","desc","__toESM","isNodeMode","target","require_lodash_throttle","FUNC_ERROR_TEXT","NAN","reTrim","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","freeGlobal","freeSelf","root","objectToString","nativeMax","nativeMin","now","debounce","lastArgs","lastThis","maxWait","result","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","func","toNumber","wait","isObject","options","invokeFunc","args","thisArg","time","leadingEdge","timerExpired","remainingWait","timeSinceLastCall","timeSinceLastInvoke","shouldInvoke","trailingEdge","cancel","flush","debounced","isInvoking","throttle","\"leading\"","\"maxWait\"","\"trailing\"","type","value","isObjectLike","isSymbol","other","isBinary","require_lodash_debounce","import_lodash_throttle","import_lodash_debounce","Collection","entry","existing","matcher","id","fn","ColumnStore","length","slot","updatedAt","slots","MIN_HOLES_TO_COMPACT","RowStore","row","index","offset","low","high","middle","previous","replacement","added","removed","ids","indexes","a","b","holes","live","renumbered","rank","compare","moving","oldIndexes","inserts","positions","settledLength","end","at","items","write","read","removedIndex","rows","top","getNow","getRowId","collator","INCREMENTAL_SORT_RATIO","typeRank","compareValues","createDefaultKey","ranks","values","textIds","text","sorted","position","DataStore","environment","model","rowId","columnKey","data","changes","removals","moved","applyRemovals","column","kept","rowData","columnId","cached","only","rest","onlyColumn","precompute","sign","order","direction","sortKeys","changed","LruCache","limit","oldest","component_default","isNode","child","primitive","paint","ctx","props","x","y","Group","children","originX","originY","React","component","Renderer","getContext2d","canvas","Loading","Layer","name","width","height","pixelRatio","RendererRegistry","renderer","ref","Rect","w","h","color","alpha","CellBackground","age","flashInDuration","flashOutDuration","flash","background","flashRGB","borderRightWidth","borderRightColor","borderBottomWidth","borderBottomColor","fitText","used","widthOf","available","ellipsisWidth","ellipsis","TextRenderer","font","character","totalWidth","cellPadding","HeaderRenderer","formatted","CellValueRenderer","valueChanged","forced","classes","builtIn","STYLE_ELEMENT_ID","injectStyles","style","CanvasGridComponent","prevSize","getId","layer","next","before","candidate","scrollArea","debounceAfterScroll","throttledUpdate","scrollXOffset","scrollYOffset","scrollTop","scrollLeft","overrides","refs","redrawAll","keepDrawing","fakeRowIndex","header","xOffset","firstRow","visibleColumns","rowIndex","currentY","entries","cellRow","store","animating","visible","currentX","add","update","remove","columns","defaults","v"],"sources":["../node_modules/lodash.throttle/index.js","../node_modules/lodash.debounce/index.js","../components/utils/collection.ts","../components/utils/column-store.ts","../components/utils/row-store.ts","../components/utils/selectors.ts","../components/utils/data-store.ts","../components/utils/lru-cache.ts","../components/component.css?inline","../components/utils/jsx.ts","../components/utils/renderer.ts","../components/utils/canvas.ts","../components/utils/loading.ts","../components/utils/layer.ts","../components/utils/renderer-registry.ts","../components/rectangle/index.ts","../components/cell-background/index.tsx","../components/utils/fit-text.ts","../components/text/index.ts","../components/header/index.tsx","../components/cell-value/index.tsx","../components/web-component.ts"],"sourcesContent":["/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n result = wait - timeSinceLastCall;\n\n return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = throttle;\n","/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n result = wait - timeSinceLastCall;\n\n return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = debounce;\n","import type { Key } from '../types';\n\ninterface Entry<T> {\n key: Key;\n value: T;\n}\n\n/**\n * Insertion-ordered map. Keys are compared as strings (1 and '1' are the same entry),\n * and every operation is O(1) apart from iteration.\n */\nclass Collection<T> {\n private entries = new Map<string, Entry<T>>();\n\n constructor() {\n this.get = this.get.bind(this);\n this.set = this.set.bind(this);\n this.clear = this.clear.bind(this);\n this.forEach = this.forEach.bind(this);\n }\n\n get keys(): Key[] {\n return Array.from(this.entries.values(), entry => entry.key);\n }\n\n get(key: Key): T | undefined {\n return this.entries.get(String(key))?.value;\n }\n\n set(key: Key, value: T) {\n const existing = this.entries.get(String(key));\n if (existing) {\n existing.value = value;\n return;\n }\n this.entries.set(String(key), { key, value });\n }\n\n add(value: T) {\n this.set(this.entries.size, value);\n }\n\n delete(key: Key) {\n this.entries.delete(String(key));\n }\n\n clear(matcher?: (item: T, key: Key) => boolean) {\n if (typeof matcher !== 'function') {\n this.entries.clear();\n return;\n }\n this.entries.forEach(({ key, value }, id) => {\n if (matcher(value, key)) this.entries.delete(id);\n });\n }\n\n forEach(fn: (item: T, key: Key) => void) {\n this.entries.forEach(({ key, value }) => fn(value, key));\n }\n\n get length() {\n return this.entries.size;\n }\n}\n\nexport default Collection;\n","/**\n * Values of one column for all rows, indexed by row slot. Two flat arrays instead of an object per cell.\n * `undefined` means the row has no value in this column.\n */\nclass ColumnStore {\n values: unknown[];\n\n /** Changes whenever a value is set, cleared or moved, so results computed from the values can be reused while it stays the same. */\n version = 0;\n\n /** When each value last changed, 0 when unknown; only allocated once a value changes after loading. */\n private updatedAt: number[] | undefined = undefined;\n\n constructor(length = 0) {\n this.values = new Array(length).fill(undefined);\n }\n\n get(slot: number) {\n return this.values[slot];\n }\n\n getUpdatedAt(slot: number): number | undefined {\n return this.updatedAt?.[slot] || undefined;\n }\n\n set(slot: number, value: unknown, updatedAt?: number) {\n this.version++;\n while (this.values.length < slot) this.values.push(undefined);\n this.values[slot] = value;\n if (updatedAt === undefined && this.updatedAt === undefined) return;\n\n this.updatedAt ??= new Array(this.values.length).fill(0);\n while (this.updatedAt.length < this.values.length) this.updatedAt.push(0);\n this.updatedAt[slot] = updatedAt ?? 0;\n }\n\n /** Empties the given slots, leaving holes; the other slots keep their place. */\n clearSlots(slots: readonly number[]) {\n this.version++;\n slots.forEach(slot => {\n if (slot < this.values.length) this.values[slot] = undefined;\n if (this.updatedAt && slot < this.updatedAt.length) this.updatedAt[slot] = 0;\n });\n }\n\n /** Keeps only the given slots (ascending), renumbering them 0, 1, 2... in that order. */\n compact(slots: ArrayLike<number>) {\n this.version++;\n this.values = Array.from(slots, slot => this.values[slot]);\n const { updatedAt } = this;\n if (updatedAt) this.updatedAt = Array.from(slots, slot => updatedAt[slot] ?? 0);\n }\n}\n\nexport default ColumnStore;\n","import type { Key, RowData, RowId } from '../types';\n\nexport type Row = RowData;\n\n/** Holes below this are not worth a pass over every column. */\nconst MIN_HOLES_TO_COMPACT = 1024;\n\n/**\n * Rows in display order: a dense array with an id lookup and each row's top offset,\n * so appends, lookups and finding the row at a scroll offset never scan every row.\n * Removing rows renumbers the positions after the first removed one (once per call).\n * Rows keep a `slot` into the column stores that does not change when the rows are sorted or others removed;\n * removed rows leave holes, which are closed when they outnumber the rows.\n */\nclass RowStore {\n private items: Row[] = [];\n\n private readonly byId = new Map<string, Row>();\n\n /** `tops[i]` is the offset of row `i` from the top of the first row. */\n private tops: number[] = [];\n\n private end = 0;\n\n /** Slots handed out so far, including holes left by removed rows. */\n private nextSlot = 0;\n\n get length() {\n return this.items.length;\n }\n\n /** Sum of all row heights. */\n get totalHeight() {\n return this.end;\n }\n\n /** Number of slots in use or left as holes; the length the column stores need. */\n get slotCount() {\n return this.nextSlot;\n }\n\n get keys(): RowId[] {\n return this.items.map(row => row.id);\n }\n\n get(id: Key): Row | undefined {\n return this.byId.get(String(id));\n }\n\n at(index: number): Row | undefined {\n return this.items[index];\n }\n\n topOf(index: number) {\n return this.tops[index] ?? this.end;\n }\n\n /** Index of the first row that ends below `offset`; `length` when the offset is past the last row. */\n indexAt(offset: number) {\n if (offset <= 0) return 0;\n if (offset >= this.end) return this.length;\n\n let low = 0;\n let high = this.items.length - 1;\n while (low < high) {\n const middle = Math.ceil((low + high) / 2);\n if (this.tops[middle] <= offset) low = middle;\n else high = middle - 1;\n }\n return low;\n }\n\n /** Appends the row, or replaces the row with the same id in place; returns the stored row. */\n set(row: Omit<Row, 'index' | 'slot'>): Row {\n const key = String(row.id);\n const previous = this.byId.get(key);\n if (previous) {\n const replacement = { id: row.id, height: row.height, index: previous.index, slot: previous.slot };\n this.items[previous.index] = replacement;\n this.byId.set(key, replacement);\n this.reindexFrom(previous.index);\n return replacement;\n }\n\n const index = this.items.length;\n const added = { id: row.id, height: row.height, index, slot: this.nextSlot++ };\n this.items.push(added);\n this.byId.set(key, added);\n this.tops.push(this.end);\n this.end += Math.round(row.height);\n return added;\n }\n\n /**\n * Removes the rows with the given ids, ignoring unknown ones.\n * Returns the slots of the removed rows in ascending order, which the column stores must clear.\n * Other rows keep their slots, so removing costs nothing per column; see `compactSlots`.\n */\n removeMany(ids: Key[]): number[] {\n const removed = new Set<Row>();\n ids.forEach(id => {\n const row = this.get(id);\n if (row) removed.add(row);\n });\n if (removed.size === 0) return [];\n\n removed.forEach(row => this.byId.delete(String(row.id)));\n const indexes = Array.from(removed, row => row.index).sort((a, b) => a - b);\n\n this.closeGaps(indexes);\n this.reindexFrom(indexes[0]);\n return Array.from(removed, row => row.slot).sort((a, b) => a - b);\n }\n\n /**\n * Renumbers the slots densely once more than half of them are holes left by removed rows.\n * Returns the previous slots of the remaining rows in ascending order (the column stores keep exactly those),\n * or undefined when nothing was renumbered. Doing this rarely keeps removal cheap for streams that drop old rows.\n */\n compactSlots(): Int32Array | undefined {\n const holes = this.nextSlot - this.items.length;\n if (holes < MIN_HOLES_TO_COMPACT || holes <= this.items.length) return undefined;\n\n const live = Int32Array.from(this.items, row => row.slot).sort();\n const renumbered = new Int32Array(this.nextSlot);\n live.forEach((slot, rank) => { renumbered[slot] = rank; });\n this.items.forEach(row => { row.slot = renumbered[row.slot]; });\n this.nextSlot = this.items.length;\n return live;\n }\n\n /** Reorders the rows; the sort is stable, so equal rows keep their relative order. */\n sort(compare: (a: Row, b: Row) => number) {\n this.items.sort(compare);\n this.reindexFrom(0);\n }\n\n /**\n * Puts the given rows back in order, assuming every other row is already ordered.\n * `compare` must be a total order (no ties), which a slot tiebreak provides. Costs one comparison pass per\n * moved row (a binary search) plus a copy, instead of sorting every row.\n */\n resort(ids: Iterable<Key>, compare: (a: Row, b: Row) => number) {\n const moving = new Set<Row>();\n for (const id of ids) {\n const row = this.get(id);\n if (row) moving.add(row);\n }\n if (moving.size === 0) return;\n\n const oldIndexes = Array.from(moving, row => row.index).sort((a, b) => a - b);\n this.closeGaps(oldIndexes);\n\n // only the moving rows are compared; the rest is moved around with memmoves, never visited one by one\n const inserts = Array.from(moving).sort(compare);\n const positions = inserts.map(row => this.lowerBound(this.items, row, compare));\n const settledLength = this.items.length;\n inserts.forEach(row => this.items.push(row));\n\n // from the back, so every settled row moves once, past the inserts that end up before it\n const { items } = this;\n let end = settledLength;\n for (let at = inserts.length - 1; at >= 0; at--) {\n for (let from = end - 1; from >= positions[at]; from--) items[from + at + 1] = items[from];\n items[positions[at] + at] = inserts[at];\n end = positions[at];\n }\n\n this.reindexFrom(Math.min(oldIndexes[0], positions[0]));\n }\n\n clear() {\n this.items = [];\n this.byId.clear();\n this.tops = [];\n this.end = 0;\n this.nextSlot = 0;\n }\n\n /** Removes the items at the given ascending indexes in place, moving the others down in runs. */\n private closeGaps(indexes: readonly number[]) {\n const { items } = this;\n let write = indexes[0];\n indexes.forEach((removedIndex, at) => {\n const end = indexes[at + 1] ?? items.length;\n // a plain loop: Array.prototype.copyWithin is much slower than this on arrays of objects\n for (let read = removedIndex + 1; read < end; read++) items[write++] = items[read];\n });\n items.length = write;\n }\n\n /** Index of the first row in `rows` that is not ordered before `row`. */\n private lowerBound(rows: Row[], row: Row, compare: (a: Row, b: Row) => number) {\n let low = 0;\n let high = rows.length;\n while (low < high) {\n const middle = (low + high) >>> 1;\n if (compare(rows[middle], row) < 0) low = middle + 1;\n else high = middle;\n }\n return low;\n }\n\n /** Recomputes positions and offsets from `from` onwards. */\n private reindexFrom(from: number) {\n this.tops.length = this.items.length;\n let top = from === 0 ? 0 : this.tops[from - 1] + Math.round(this.items[from - 1].height);\n for (let index = from; index < this.items.length; index++) {\n const row = this.items[index];\n row.index = index;\n this.tops[index] = top;\n top += Math.round(row.height);\n }\n this.end = top;\n }\n}\n\nexport default RowStore;\n","import type { RowId, RowInput } from '../types';\n\nexport const getNow = () => new Date().valueOf();\n\nexport const getRowId = (row: RowInput, _index?: number): RowId => row.id;\n","import ColumnStore from './column-store';\nimport RowStore from './row-store';\nimport { getNow } from './selectors';\nimport type { Row } from './row-store';\nimport type { Key, RowId, RowInput, SortKey } from '../types';\n\nexport type RowIdGetter = (row: RowInput, index?: number) => RowId;\n\nexport interface DataStoreEnvironment {\n getRowId: RowIdGetter;\n getCellHeight: () => number;\n}\n\ninterface PendingChange {\n type: 'update' | 'remove';\n row: RowInput;\n}\n\nconst collator = new Intl.Collator();\n\n/** Fewer changed rows than this fraction of all rows are moved one by one; more are cheaper to sort together. */\nconst INCREMENTAL_SORT_RATIO = 8;\n\nconst typeRank = (value: unknown) => {\n if (value === undefined || value === null) return 3;\n if (typeof value === 'number' || typeof value === 'bigint') return 0;\n return typeof value === 'string' ? 1 : 2;\n};\n\n/** Numbers numerically, then text, then anything else as text; empty values sort last. */\nexport const compareValues = (a: unknown, b: unknown) => {\n const rank = typeRank(a) - typeRank(b);\n if (rank !== 0) return rank;\n if (typeRank(a) === 3) return 0;\n if (typeRank(a) === 0) return Number(a) - Number(b);\n return collator.compare(String(a), String(b));\n};\n\n/**\n * Sort keys for the default ordering of a column, computed once so comparing two rows is two array reads:\n * a type rank, and within it a number (the value, or the position of its text among all the column's texts).\n */\nconst createDefaultKey = (values: readonly unknown[]) => {\n const ranks = new Uint8Array(values.length);\n const keys = new Float64Array(values.length);\n // every distinct text gets an id on the way, so ranks can be looked up by index instead of by text again\n const textIds = new Int32Array(values.length);\n const ids = new Map<string, number>();\n for (let slot = 0; slot < values.length; slot++) {\n const value = values[slot];\n const rank = typeRank(value);\n ranks[slot] = rank;\n if (rank === 0) {\n keys[slot] = Number(value);\n continue;\n }\n if (rank !== 1 && rank !== 2) continue;\n\n const text = String(value);\n let id = ids.get(text);\n if (id === undefined) {\n id = ids.size;\n ids.set(text, id);\n }\n textIds[slot] = id;\n }\n\n // equal texts (as the collator sees them) share a position, so they tie and fall through to the next key\n const positions = new Float64Array(ids.size);\n const sorted = Array.from(ids.keys()).sort(collator.compare);\n let position = 0;\n sorted.forEach((text, index) => {\n if (index > 0 && collator.compare(sorted[index - 1], text) !== 0) position++;\n positions[ids.get(text) ?? 0] = position;\n });\n for (let slot = 0; slot < values.length; slot++) {\n if (ranks[slot] === 1 || ranks[slot] === 2) keys[slot] = positions[textIds[slot]];\n }\n return { ranks, keys };\n};\n\ntype DefaultKey = ReturnType<typeof createDefaultKey>;\n\n/**\n * Cell values stored by column (one array per column, addressed by the row's slot) plus the row order,\n * with the queued add/update/remove handling and the sort model. Independent of the DOM.\n */\nclass DataStore {\n rows = new RowStore();\n columns = new Map<string, ColumnStore>();\n\n /** Queued changes, applied in the order they were made. */\n private pending: PendingChange[] = [];\n private sortModel: readonly SortKey[] = [];\n private sortDirty = false;\n /** Ids of the rows changed since the last sort; only those have to move when few changed. */\n private sortChanged = new Set<string>();\n /** Sort keys per column, reused until the column's values change (e.g. when only the direction flips). */\n private defaultKeys = new WeakMap<ColumnStore, { version: number; key: DefaultKey }>();\n\n private environment: DataStoreEnvironment;\n\n constructor(environment: DataStoreEnvironment) {\n this.environment = environment;\n }\n\n get hasPending() {\n return this.pending.length > 0;\n }\n\n getSortModel() {\n return this.sortModel;\n }\n\n /** Orders the rows by the given columns, in priority order; an empty model restores the insertion order. */\n setSortModel(model: readonly SortKey[]) {\n this.sortModel = [...model];\n this.sort();\n }\n\n /** Value of a cell, `undefined` when the row has none. */\n getValue(rowId: RowId, columnKey: Key) {\n const row = this.rows.get(rowId);\n return row ? this.columns.get(String(columnKey))?.get(row.slot) : undefined;\n }\n\n getUpdatedAt(rowId: RowId, columnKey: Key) {\n const row = this.rows.get(rowId);\n return row ? this.columns.get(String(columnKey))?.getUpdatedAt(row.slot) : undefined;\n }\n\n queueUpdate(row: RowInput) {\n this.pending.push({ type: 'update', row });\n }\n\n queueRemove(row: RowInput) {\n this.pending.push({ type: 'remove', row });\n }\n\n clear() {\n this.rows.clear();\n this.columns.clear();\n }\n\n /** Replaces everything, dropping any queued changes. */\n setRows(data: RowInput[]) {\n this.pending = [];\n this.clear();\n this.sortChanged.clear();\n // size the columns of the first row up front instead of growing them one value at a time\n Object.keys(data[0] ?? {}).forEach(key => this.columns.set(key, new ColumnStore(data.length)));\n data.forEach((row, index) => this.addRow(this.environment.getRowId(row, index), row, undefined));\n // rows were added in insertion order, which is the order without a sort model\n if (this.sortModel.length > 0) this.sort();\n }\n\n /**\n * Applies the queued changes in the order they were queued; consecutive removals are applied together.\n * Returns whether rows changed position (removed or re-sorted), which needs the whole grid to be redrawn.\n */\n flush(now = getNow()) {\n const changes = this.pending;\n this.pending = [];\n const removals: Key[] = [];\n let moved = false;\n const applyRemovals = () => {\n moved = this.removeRows(removals) || moved;\n removals.length = 0;\n };\n\n changes.forEach(({ type, row }) => {\n if (type === 'remove') {\n removals.push(this.environment.getRowId(row));\n return;\n }\n applyRemovals();\n this.applyUpdate(row, now);\n });\n applyRemovals();\n\n if (!this.sortDirty) return moved;\n this.sortChanges();\n return true;\n }\n\n private column(key: string) {\n let column = this.columns.get(key);\n if (!column) {\n column = new ColumnStore(this.rows.slotCount);\n this.columns.set(key, column);\n }\n return column;\n }\n\n private addRow(id: RowId, row: RowInput, updatedAt: number | undefined) {\n const { slot } = this.rows.set({ id, height: this.environment.getCellHeight() });\n const keys = Object.keys(row);\n for (const key of keys) this.column(key).set(slot, row[key], updatedAt);\n this.markSortDirty(id, keys);\n }\n\n private removeRows(ids: Key[]) {\n if (ids.length === 0) return false;\n\n const slots = this.rows.removeMany(ids);\n this.columns.forEach(column => column.clearSlots(slots));\n const kept = this.rows.compactSlots();\n if (kept) this.columns.forEach(column => column.compact(kept));\n return slots.length > 0;\n }\n\n private applyUpdate(row: RowInput, now: number) {\n const rowId = this.environment.getRowId(row);\n const rowData = this.rows.get(rowId);\n if (!rowData) {\n this.addRow(rowId, row, now);\n return;\n }\n Object.keys(row).forEach(key => this.applyValue(rowData.id, rowData.slot, key, row[key], now));\n }\n\n private applyValue(rowId: RowId, slot: number, key: string, value: unknown, now: number) {\n const column = this.column(key);\n const previous = column.get(slot);\n if (previous === value) return;\n // a value appearing in a column the row did not have yet is not an update worth flashing\n column.set(slot, value, previous === undefined ? undefined : now);\n this.markSortDirty(rowId, [key]);\n }\n\n private markSortDirty(rowId: RowId, keys: string[]) {\n if (!this.sortModel.some(({ columnId }) => keys.includes(String(columnId)))) return;\n this.sortDirty = true;\n this.sortChanged.add(String(rowId));\n }\n\n private defaultKeyOf(column: ColumnStore) {\n const cached = this.defaultKeys.get(column);\n if (cached && cached.version === column.version) return cached.key;\n\n const key = createDefaultKey(column.values);\n this.defaultKeys.set(column, { version: column.version, key });\n return key;\n }\n\n /** Orders two rows by the sort model, ties by slot so the order is total. */\n private createComparator(precompute: boolean) {\n const [only, ...rest] = this.sortModel;\n const onlyColumn = only && !only.compare && precompute && rest.length === 0 ? this.columns.get(String(only.columnId)) : undefined;\n if (onlyColumn) {\n // the common case, a single default-ordered column, without the per-key loop and calls\n const { ranks, keys } = this.defaultKeyOf(onlyColumn);\n const sign = only.direction === 'desc' ? -1 : 1;\n return (a: Row, b: Row) => {\n const order = ranks[a.slot] - ranks[b.slot] || keys[a.slot] - keys[b.slot] || 0;\n return order === 0 ? a.slot - b.slot : order * sign;\n };\n }\n\n const keys = this.sortModel.map(({ columnId, direction = 'asc', compare }) => {\n const column = this.columns.get(String(columnId));\n const values = column?.values;\n const sign = direction === 'desc' ? -1 : 1;\n if (!column || !values) return { order: () => 0, sign };\n if (compare) return { order: (a: Row, b: Row) => compare(values[a.slot], values[b.slot]), sign };\n if (!precompute) return { order: (a: Row, b: Row) => compareValues(values[a.slot], values[b.slot]), sign };\n\n const { ranks, keys: sortKeys } = this.defaultKeyOf(column);\n return {\n order: (a: Row, b: Row) => ranks[a.slot] - ranks[b.slot] || sortKeys[a.slot] - sortKeys[b.slot] || 0,\n sign,\n };\n });\n\n return (a: Row, b: Row) => {\n for (const { order, sign } of keys) {\n const result = order(a, b);\n if (result !== 0) return result * sign;\n }\n return a.slot - b.slot;\n };\n }\n\n private sort() {\n this.sortDirty = false;\n this.sortChanged.clear();\n this.rows.sort(this.createComparator(true));\n }\n\n /** Re-sorts after a flush: moves only the changed rows when they are few, otherwise sorts everything. */\n private sortChanges() {\n const changed = this.sortChanged;\n if (changed.size * INCREMENTAL_SORT_RATIO >= this.rows.length) {\n this.sort();\n return;\n }\n\n this.sortDirty = false;\n this.sortChanged = new Set();\n this.rows.resort(changed, this.createComparator(false));\n }\n}\n\nexport default DataStore;\n","/** Size-bounded map that evicts the least recently used entry first. */\nclass LruCache<T> {\n private readonly entries = new Map<string, T>();\n\n private readonly limit: number;\n\n constructor(limit: number) {\n this.limit = limit;\n }\n\n get(key: string): T | undefined {\n const value = this.entries.get(key);\n if (value === undefined) return undefined;\n // re-insert so iteration order tracks recency\n this.entries.delete(key);\n this.entries.set(key, value);\n return value;\n }\n\n set(key: string, value: T) {\n this.entries.delete(key);\n this.entries.set(key, value);\n const [oldest] = this.entries.keys();\n if (this.entries.size > this.limit && oldest !== undefined) this.entries.delete(oldest);\n }\n\n clear() {\n this.entries.clear();\n }\n\n get size() {\n return this.entries.size;\n }\n}\n\nexport default LruCache;\n","canvas-grid {\n position: relative;\n display: block;\n /* keeps the layers' z-indexes inside the grid, so it cannot paint over page content such as sticky headers */\n isolation: isolate;\n\n &, & * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n }\n\n & .drawingLayer {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n /* the canvas is a fixed-size box, so layout and paint never depend on or leak into the rest of the page */\n contain: strict;\n\n &.background {\n /* z-index: 1; */\n /* background-color: #333; */\n }\n\n &.content {\n /* z-index: 2; */\n }\n\n &.header {\n /* z-index: 3; */\n }\n }\n\n & .scrollArea {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow: auto;\n z-index: 10;\n backface-visibility: hidden;\n will-change: transform;\n\n & > div {\n will-change: scroll-position, transform;\n }\n }\n}\n","/**\n * Minimal declarative layer over the canvas 2D API.\n *\n * `<Group>` and friends do not draw when evaluated. They build a light tree of nodes, and calling\n * `node.draw(ctx, x, y)` paints it, with `(x, y)` as the origin that child positions are relative to.\n * Nothing is rasterized to an intermediate canvas unless a component opts into bitmap caching.\n */\nexport interface VNode {\n draw(ctx: CanvasRenderingContext2D, x: number, y: number): void;\n}\n\n/** `false`, `null` and `undefined` are skipped, so `{condition && <Rect />}` works. */\nexport type Child = VNode | false | null | undefined;\n\nexport type Children = Child | readonly Child[];\n\nexport interface ChildrenProps {\n /** A single child, an array of them, or the mix of both that JSX produces for several children. */\n children?: Children | readonly Children[];\n}\n\nexport type Component<Props extends object> = (props: Props) => VNode;\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n type Element = VNode;\n interface ElementChildrenAttribute {\n children: unknown;\n }\n interface IntrinsicElements {}\n }\n}\n\nconst isNode = (child: Child): child is VNode => !!child;\n\n/** Wraps a paint function into a leaf component; positions in `props` are relative to the draw origin. */\nexport const primitive = <Props extends object>(\n paint: (ctx: CanvasRenderingContext2D, props: Props, x: number, y: number) => void,\n): Component<Props> => props => ({\n draw: (ctx, x, y) => paint(ctx, props, x, y),\n});\n\nexport interface GroupProps extends ChildrenProps {\n x?: number;\n y?: number;\n}\n\n/** Draws its children relative to its own offset. */\nexport const Group: Component<GroupProps> = ({ x = 0, y = 0, children }) => ({\n draw: (ctx, originX, originY) => [children]\n .flat(2)\n .filter(isNode)\n .forEach(child => child.draw(ctx, originX + x, originY + y)),\n});\n\nconst React = {\n createElement<Props extends object>(\n component: Component<Props & ChildrenProps>,\n props: Props | null,\n ...children: Children[]\n ): VNode {\n return component(Object.assign({}, props, { children }));\n },\n};\n\nexport default React;\n","import LruCache from './lru-cache';\nimport { primitive } from './jsx';\nimport type { RenderProps } from '../types';\n\nabstract class Renderer<Options extends object> {\n readonly options: Options;\n\n protected constructor(options: Options) {\n this.options = { ...options };\n }\n\n /** Applies the given options and notifies `optionsUpdated` with the previous ones. */\n update(options: Partial<Options>) {\n const previous = { ...this.options };\n Object.assign(this.options, options);\n this.optionsUpdated(previous);\n }\n\n optionsUpdated(_previous: Options) {}\n\n clearCache() {}\n}\n\n/**\n * Renderer producing a bitmap from props; usable as a JSX tag through `element`.\n * Bitmaps are reused through a bounded LRU cache whenever `cacheKey` returns a key.\n */\nexport abstract class CanvasRenderer<Options extends object> extends Renderer<Options> {\n private readonly bitmaps = new LruCache<HTMLCanvasElement>(4096);\n\n abstract render(props: RenderProps): HTMLCanvasElement;\n\n /** Props with the same key must render the same pixels. Undefined disables caching. */\n protected cacheKey(_props: RenderProps): string | undefined {\n return undefined;\n }\n\n /** Device pixels per CSS pixel of the layer being drawn to; bitmaps are rendered at this scale to stay sharp. */\n pixelRatio = 1;\n\n clearCache() {\n this.bitmaps.clear();\n }\n\n paint(ctx: CanvasRenderingContext2D, props: RenderProps, x: number, y: number) {\n const key = this.cacheKey(props);\n const bitmap = (key === undefined ? undefined : this.bitmaps.get(key)) ?? this.renderBitmap(props, key);\n if (bitmap.width <= 0 || bitmap.height <= 0) return;\n ctx.drawImage(bitmap, x + (props.x ?? 0), y + (props.y ?? 0), bitmap.width / this.pixelRatio, bitmap.height / this.pixelRatio);\n }\n\n readonly element = primitive<RenderProps>((ctx, props, x, y) => this.paint(ctx, props, x, y));\n\n private renderBitmap(props: RenderProps, key: string | undefined) {\n const canvas = this.render(props);\n if (key === undefined || canvas.width <= 0 || canvas.height <= 0) return canvas;\n\n const bitmap = document.createElement('canvas');\n bitmap.width = canvas.width;\n bitmap.height = canvas.height;\n bitmap.getContext('2d')?.drawImage(canvas, 0, 0);\n this.bitmaps.set(key, bitmap);\n return bitmap;\n }\n}\n\nexport default Renderer;\n","export const getContext2d = (canvas: HTMLCanvasElement, options?: CanvasRenderingContext2DSettings) => {\n const ctx = canvas.getContext('2d', options);\n if (!ctx) throw new Error('2D canvas context is not available');\n return ctx;\n};\n","import Renderer from './renderer';\nimport { getContext2d } from './canvas';\n\ninterface LoadingOptions {\n ctx: CanvasRenderingContext2D;\n}\n\nclass Loading extends Renderer<LoadingOptions> {\n private readonly ctx: CanvasRenderingContext2D;\n\n private readonly offCanvas = document.createElement('canvas');\n\n private readonly offCtx: CanvasRenderingContext2D;\n\n private rotation = 270 * (Math.PI / 180);\n\n private readonly speed = 6;\n\n private readonly count = 75;\n\n constructor(options: LoadingOptions) {\n super(options);\n\n this.ctx = this.options.ctx;\n\n this.offCanvas.width = 250;\n this.offCanvas.height = 250;\n this.offCtx = getContext2d(this.offCanvas);\n this.offCtx.lineWidth = 0.5;\n this.offCtx.strokeStyle = 'rgba(255, 255, 255, 0.75)';\n }\n\n updateLoader() {\n this.rotation += this.speed / 100;\n }\n\n renderLoader() {\n this.offCtx.save();\n this.offCtx.globalCompositeOperation = 'source-over';\n this.offCtx.translate(125, 125);\n this.offCtx.rotate(this.rotation);\n let i = this.count;\n while (i--) {\n this.offCtx.beginPath();\n this.offCtx.arc(0, 0, i + (Math.random() * 35), Math.random(), Math.PI / 3 + (Math.random() / 12), false);\n this.offCtx.stroke();\n }\n this.offCtx.restore();\n }\n\n render() {\n this.offCtx.globalCompositeOperation = 'destination-out';\n this.offCtx.fillStyle = 'rgba(255, 255, 255, 0.03)';\n this.offCtx.fillRect(0, 0, 250, 250);\n this.updateLoader();\n this.renderLoader();\n\n const x = Math.round((this.ctx.canvas.width - this.offCanvas.width) / 2);\n const y = Math.round((this.ctx.canvas.height - this.offCanvas.height) / 2);\n this.ctx.clearRect(x, y, 250, 250);\n this.ctx.drawImage(this.offCanvas, x, y);\n\n return this.offCanvas;\n }\n}\n\nexport default Loading;\n","import { getContext2d } from './canvas';\n\nexport interface LayerOptions {\n /** Transparent canvas. Opaque layers (`false`) draw faster; keep the bottom layer opaque. */\n alpha?: boolean;\n /** Lets the browser present frames without syncing to the compositor: lower latency, but may tear. Off by default. */\n desynchronized?: boolean;\n /** Name of an existing layer to stack this one below; defaults to the top. */\n before?: string;\n}\n\n/** A named canvas stacked in the grid; renderers draw into its context. */\nclass Layer {\n readonly name: string;\n\n readonly canvas = document.createElement('canvas');\n\n readonly ctx: CanvasRenderingContext2D;\n\n constructor(name: string, { alpha = true, desynchronized = false }: Pick<LayerOptions, 'alpha' | 'desynchronized'> = {}) {\n this.name = name;\n this.canvas.className = `drawingLayer ${name}`;\n this.ctx = getContext2d(this.canvas, { alpha, desynchronized });\n }\n\n /** Size in CSS pixels; the backing store is `pixelRatio` times larger. */\n width = 0;\n\n height = 0;\n\n pixelRatio = 1;\n\n /**\n * Resizes the canvas, scaling the context so renderers keep drawing in CSS pixels.\n * Returns false, leaving the canvas untouched, when nothing changed (assigning a size clears the canvas).\n */\n resize(width: number, height: number, pixelRatio = 1) {\n if (width === this.width && height === this.height && pixelRatio === this.pixelRatio) return false;\n\n this.width = width;\n this.height = height;\n this.pixelRatio = pixelRatio;\n this.canvas.width = Math.round(width * pixelRatio);\n this.canvas.height = Math.round(height * pixelRatio);\n this.ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\n return true;\n }\n\n clear() {\n this.ctx.clearRect(0, 0, this.width, this.height);\n }\n}\n\nexport default Layer;\n","import type { CellRenderer, RendererRef } from '../types';\n\n/** Named renderers; columns refer to them by name or hand over a renderer directly. */\nclass RendererRegistry {\n private readonly renderers = new Map<string, CellRenderer>();\n\n private readonly warned = new Set<string>();\n\n register(name: string, renderer: CellRenderer) {\n this.renderers.set(name, renderer);\n this.warned.delete(name);\n }\n\n unregister(name: string) {\n this.renderers.delete(name);\n }\n\n get(name: string) {\n return this.renderers.get(name);\n }\n\n /** Resolves a reference without allocating; unknown names are reported once and yield undefined. */\n resolve(ref: RendererRef): CellRenderer | undefined {\n if (typeof ref !== 'string') return ref;\n\n const renderer = this.renderers.get(ref);\n if (!renderer && !this.warned.has(ref)) {\n this.warned.add(ref);\n console.warn(`canvas-grid: no renderer registered as \"${ref}\"`);\n }\n return renderer;\n }\n\n clearCaches() {\n this.renderers.forEach(renderer => renderer.clearCache?.());\n }\n}\n\nexport default RendererRegistry;\n","import { primitive } from '../utils/jsx';\n\nexport interface RectProps {\n x?: number;\n y?: number;\n width: number;\n height: number;\n color: string;\n /** Opacity from 0 to 1, applied on top of the color. */\n alpha?: number;\n}\n\n/** Solid rectangle, filled straight onto the target context. */\nconst Rect = primitive<RectProps>((ctx, { x = 0, y = 0, width, height, color, alpha = 1 }, originX, originY) => {\n const w = Math.trunc(width);\n const h = Math.trunc(height);\n if (!color || w <= 0 || h <= 0 || alpha <= 0) return;\n\n ctx.fillStyle = color;\n if (alpha >= 1) {\n ctx.fillRect(originX + x, originY + y, w, h);\n return;\n }\n ctx.globalAlpha = alpha;\n ctx.fillRect(originX + x, originY + y, w, h);\n ctx.globalAlpha = 1;\n});\n\nexport default Rect;\n","import React, { Group } from '../utils/jsx';\nimport Renderer from '../utils/renderer';\nimport Rect from '../rectangle';\nimport type { CellContext, CellRenderer } from '../types';\n\nexport interface CellBackgroundOptions {\n layer: string;\n enableFlashing: boolean;\n background: string;\n flashInDuration: number;\n flashOutDuration: number;\n flashRGB: string;\n borderRightWidth: number;\n borderRightColor: string;\n borderBottomWidth: number;\n borderBottomColor: string;\n}\n\nclass CellBackground extends Renderer<CellBackgroundOptions> implements CellRenderer {\n static readonly defaultOptions: CellBackgroundOptions = {\n layer: 'background',\n enableFlashing: true,\n background: '#333',\n flashInDuration: 200,\n flashOutDuration: 400,\n flashRGB: '214, 144, 13',\n borderRightWidth: 0,\n borderRightColor: '#fff',\n borderBottomWidth: 0,\n borderBottomColor: '#fff',\n };\n\n constructor(options: Partial<CellBackgroundOptions> = {}) {\n super({ ...CellBackground.defaultOptions, ...options });\n }\n\n get layer() {\n return this.options.layer;\n }\n\n /** Cells flash after their value changed, until the flash has faded out. */\n isAnimating({ age }: Readonly<CellContext>) {\n return this.options.enableFlashing && age <= this.options.flashInDuration + this.options.flashOutDuration;\n }\n\n /** Flash opacity for a cell updated `age` ms ago: fades in, then out, then 0. */\n private getFlashAlpha(age: number) {\n if (!this.options.enableFlashing) return 0;\n\n const { flashInDuration, flashOutDuration } = this.options;\n const alpha = age < flashInDuration\n ? age / flashInDuration\n : (flashInDuration + flashOutDuration - age) / flashOutDuration;\n return Math.max(0, Math.round(alpha * 1000) / 1000);\n }\n\n draw({ ctx, x, y, width, height, age }: Readonly<CellContext>) {\n const { background, flashRGB, borderRightWidth, borderRightColor, borderBottomWidth, borderBottomColor } = this.options;\n const flash = this.getFlashAlpha(age);\n\n (\n <Group>\n <Rect width={width} height={height} color={background} />\n {flash > 0 && <Rect width={width} height={height} color={`rgb(${flashRGB})`} alpha={flash} />}\n {borderRightWidth > 0 && <Rect x={width - borderRightWidth} width={borderRightWidth} height={height} color={borderRightColor} />}\n {borderBottomWidth > 0 && <Rect y={height - borderBottomWidth} width={width} height={borderBottomWidth} color={borderBottomColor} />}\n </Group>\n ).draw(ctx, x, y);\n }\n}\n\nexport default CellBackground;\n","/**\n * Cuts `text` to fit `available` pixels, ending in `ellipsis` when something was cut.\n * `widthOf` gives the width of one character; the width of the text is the sum of its characters.\n */\nconst fitText = (text: string, available: number, ellipsis: string, widthOf: (character: string) => number) => {\n let used = 0;\n let end = 0;\n while (end < text.length) {\n const width = widthOf(text.charAt(end));\n if (used + width > available) break;\n used += width;\n end++;\n }\n if (end === text.length) return text;\n\n // the ellipsis needs room too: give up characters until it fits\n const ellipsisWidth = widthOf(ellipsis);\n while (end > 0 && used + ellipsisWidth > available) {\n end--;\n used -= widthOf(text.charAt(end));\n }\n return used + ellipsisWidth > available ? '' : text.slice(0, end) + ellipsis;\n};\n\nexport default fitText;\n","import Renderer from '../utils/renderer';\nimport { primitive } from '../utils/jsx';\nimport fitText from '../utils/fit-text';\nimport { getContext2d } from '../utils/canvas';\nimport type { RenderProps } from '../types';\n\nexport interface TextOptions {\n ellipsis: string;\n cellPadding: {\n top: number;\n right: number;\n bottom: number;\n left: number;\n };\n font: string;\n color: string;\n isEllipsisRight: boolean;\n}\n\nclass TextRenderer extends Renderer<TextOptions> {\n static readonly defaultOptions: TextOptions = {\n ellipsis: '…',\n cellPadding: {\n top: 3,\n right: 3,\n bottom: 3,\n left: 3,\n },\n font: '12px monospace',\n color: '#fff',\n isEllipsisRight: true,\n };\n\n private readonly characterWidths = new Map<string, number>();\n\n private readonly measureContext = getContext2d(document.createElement('canvas'));\n\n private measuredFont = '';\n\n constructor(options: Partial<TextOptions> = {}) {\n super({ ...TextRenderer.defaultOptions, ...options });\n }\n\n set font(font: string) {\n if (this.options.font !== font) {\n this.options.font = font;\n this.clearCache();\n }\n }\n\n get font() {\n return this.options.font;\n }\n\n set color(color: string) {\n this.options.color = color;\n }\n\n get color() {\n return this.options.color;\n }\n\n /** Text is drawn straight into the layer, whose transform already scales it to the device pixel ratio. */\n pixelRatio = 1;\n\n clearCache() {\n this.characterWidths.clear();\n this.measuredFont = '';\n }\n\n /** Width of one character in the current font, measured once. */\n private measureCharacter(character: string) {\n const cached = this.characterWidths.get(character);\n if (cached !== undefined) return cached;\n\n if (this.measuredFont !== this.options.font) {\n this.measureContext.font = this.options.font;\n this.measuredFont = this.options.font;\n }\n const width = this.measureContext.measureText(character).width;\n this.characterWidths.set(character, width);\n return width;\n }\n\n getTextWidth(text: string) {\n let totalWidth = 0;\n for (let i = 0; i < text.length; i++) totalWidth += this.measureCharacter(text.charAt(i));\n return totalWidth;\n }\n\n /**\n * Draws the text clipped with an ellipsis; `(x, y)` is the offset of the text box from `(originX, originY)`.\n * The whole string is drawn with one `fillText`: recording one command per cell is much cheaper than\n * one `drawImage` per character, and the browser keeps its own glyph cache.\n */\n paint(ctx: CanvasRenderingContext2D, { value = '', x = 0, y = 0, width = 0, height = 0 }: RenderProps, originX: number, originY: number) {\n const { cellPadding } = this.options;\n const available = width - cellPadding.left - cellPadding.right;\n const text = fitText(value, available, this.options.ellipsis, character => this.measureCharacter(character));\n if (text === '' || height - cellPadding.top - cellPadding.bottom <= 0) return;\n\n ctx.font = this.options.font;\n ctx.fillStyle = this.options.color;\n ctx.textAlign = 'left';\n ctx.textBaseline = 'top';\n ctx.fillText(text, originX + x + cellPadding.left, originY + y + cellPadding.top);\n }\n\n readonly element = primitive<RenderProps>((ctx, props, x, y) => this.paint(ctx, props, x, y));\n}\n\nexport default TextRenderer;\n","import React, { Group } from '../utils/jsx';\nimport Renderer from '../utils/renderer';\nimport Rect from '../rectangle';\nimport TextRenderer from '../text';\nimport type { CellContext, CellRenderer } from '../types';\n\nexport interface HeaderOptions {\n layer: string;\n background: string;\n font: string;\n color: string;\n borderRightWidth: number;\n borderRightColor: string;\n borderBottomWidth: number;\n borderBottomColor: string;\n}\n\nclass HeaderRenderer extends Renderer<HeaderOptions> implements CellRenderer {\n static readonly defaultOptions: HeaderOptions = {\n layer: 'header',\n background: '#333',\n font: '13px monospace',\n color: '#fff',\n borderRightWidth: 1,\n borderRightColor: '#fff',\n borderBottomWidth: 1,\n borderBottomColor: '#fff',\n };\n\n private readonly textRenderer: TextRenderer;\n\n constructor(options: Partial<HeaderOptions> = {}) {\n super({ ...HeaderRenderer.defaultOptions, ...options });\n\n this.textRenderer = new TextRenderer({\n font: this.options.font,\n color: this.options.color,\n });\n }\n\n get layer() {\n return this.options.layer;\n }\n\n set font(font: string) {\n this.options.font = font;\n this.textRenderer.font = font;\n }\n\n get font() {\n return this.textRenderer.font;\n }\n\n set pixelRatio(pixelRatio: number) {\n this.textRenderer.pixelRatio = pixelRatio;\n }\n\n get pixelRatio() {\n return this.textRenderer.pixelRatio;\n }\n\n clearCache() {\n this.textRenderer.clearCache();\n }\n\n draw({ ctx, x, y, width, height, formatted }: Readonly<CellContext>) {\n if (width === 0 || height === 0) return;\n\n const { background, borderRightWidth, borderRightColor, borderBottomWidth, borderBottomColor } = this.options;\n\n (\n <Group>\n <Rect width={width} height={height} color={background} />\n {borderRightWidth > 0 && <Rect x={width - borderRightWidth} width={borderRightWidth} height={height} color={borderRightColor} />}\n {borderBottomWidth > 0 && <Rect y={height - borderBottomWidth} width={width} height={borderBottomWidth} color={borderBottomColor} />}\n <this.textRenderer.element value={formatted} width={width} height={height} />\n </Group>\n ).draw(ctx, x, y);\n }\n}\n\nexport default HeaderRenderer;\n","import React from '../utils/jsx';\nimport Renderer from '../utils/renderer';\nimport TextRenderer from '../text';\nimport type { CellContext, CellRenderer } from '../types';\n\nexport interface CellValueOptions {\n layer: string;\n font: string;\n color: string;\n}\n\nexport default class CellValueRenderer extends Renderer<CellValueOptions> implements CellRenderer {\n static readonly defaultOptions: CellValueOptions = {\n layer: 'content',\n font: '12px monospace',\n color: '#fff',\n };\n\n private readonly renderer: TextRenderer;\n\n constructor(options: Partial<CellValueOptions> = {}) {\n super({ ...CellValueRenderer.defaultOptions, ...options });\n\n this.renderer = new TextRenderer({\n font: this.options.font,\n color: this.options.color,\n });\n }\n\n get layer() {\n return this.options.layer;\n }\n\n set font(font: string) {\n this.options.font = font;\n this.renderer.font = font;\n }\n\n get font() {\n return this.options.font;\n }\n\n set color(color: string) {\n this.options.color = color;\n this.renderer.color = color;\n }\n\n get color() {\n return this.options.color;\n }\n\n set pixelRatio(pixelRatio: number) {\n this.renderer.pixelRatio = pixelRatio;\n }\n\n get pixelRatio() {\n return this.renderer.pixelRatio;\n }\n\n clearCache() {\n this.renderer.clearCache();\n }\n\n draw({ ctx, x, y, width, height, formatted, valueChanged, forced }: Readonly<CellContext>) {\n if (!valueChanged && !forced) return;\n\n ctx.clearRect(x, y, width, height);\n (<this.renderer.element value={formatted} width={width} height={height} />).draw(ctx, x, y);\n }\n}\n","import throttle from 'lodash.throttle';\nimport debounce from 'lodash.debounce';\nimport Collection from './utils/collection';\nimport ColumnStore from './utils/column-store';\nimport DataStore from './utils/data-store';\nimport LruCache from './utils/lru-cache';\nimport { getRowId } from './utils/selectors';\nimport styles from './component.css?inline';\nimport Loading from './utils/loading';\nimport Layer from './utils/layer';\nimport RendererRegistry from './utils/renderer-registry';\nimport CellBackground from './cell-background';\nimport HeaderRenderer from './header';\nimport CellValueRenderer from './cell-value';\nimport type { LayerOptions } from './utils/layer';\nimport type { CellContext, CellRenderer, CellState, Key, RendererRef, RowId, RowInput, SortDirection, SortKey } from './types';\nimport type { RowIdGetter } from './utils/data-store';\n\nconst classes = {\n scrollArea: 'scrollArea',\n};\n\n/** Layers and renderers every grid starts with. */\nconst builtIn = {\n background: 'background',\n content: 'content',\n header: 'header',\n backgroundRenderer: 'background',\n valueRenderer: 'value',\n headerRenderer: 'header',\n};\n\n/** What the grid remembers about a cell between frames. */\ninterface CellEntry {\n /** The raw value last drawn, and its formatted text; formatting only runs when the value differs. */\n value: unknown;\n formatted: string | undefined;\n animating: boolean;\n state: CellState;\n}\n\nconst STYLE_ELEMENT_ID = 'canvas-grid-styles';\n\nconst injectStyles = () => {\n if (document.getElementById(STYLE_ELEMENT_ID)) return;\n const style = document.createElement('style');\n style.id = STYLE_ELEMENT_ID;\n style.textContent = styles;\n document.head.appendChild(style);\n};\n\nexport interface ColumnHeader {\n index: number;\n id: Key;\n displayName?: string;\n width: number;\n /** Renderers drawing a cell of this column, in order. Defaults to the grid's `cellRenderers`. */\n renderers?: RendererRef[];\n valueFormatter: (value: unknown) => string;\n /** Renderer drawing the header of this column. */\n headerRenderer: RendererRef;\n}\n\nexport type ColumnDefinition = Key | (Partial<ColumnHeader> & { id: Key });\n\nexport interface Transaction {\n add?: RowInput[];\n remove?: RowInput[];\n update?: RowInput[];\n}\n\ninterface AgApi {\n setRowData: (data: RowInput[]) => void;\n updateRowData: (transaction: Transaction) => void;\n setColumnDefs: (columns: ColumnDefinition[]) => void;\n getRowNodeId: RowIdGetter;\n}\n\nexport type { CellContext, CellRenderer, CellState, LayerOptions, RendererRef, SortDirection, SortKey };\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'canvas-grid': CanvasGridComponent;\n }\n}\n\nclass CanvasGridComponent extends HTMLElement {\n fps = 30;\n _font = '12px monospace';\n _headerFont = '13px monospace';\n headerHeight = 30;\n cellHeight = 20;\n cellPadding = {\n top: 3,\n right: 3,\n bottom: 3,\n left: 3,\n };\n showRowNumbers = true;\n showHeaders = true;\n rowNumbersWidth = 30;\n ellipsis = '…';\n _backgroundColor = '#333';\n _headerBackgroundColor = '#222';\n textColor = '#efefef';\n dataStore = new DataStore({\n getRowId: (row, index) => this.getRowId(row, index),\n getCellHeight: () => this.cellHeight,\n });\n _dataCollection = this.dataStore.rows;\n /** Per-cell memory of the rows drawn recently; bounded, since only the rows in view need it. */\n cellEntries = new LruCache<Record<string, CellEntry>>(2048);\n getRowId: RowIdGetter = getRowId;\n headers = new Collection<ColumnHeader>();\n animationFrame: number | undefined = undefined;\n scrollYOffset = 0;\n prevScrollYOffset = 0;\n scrollXOffset = 0;\n prevScrollXOffset = 0;\n lastRender = new Date().valueOf();\n lastDraw = this.lastRender;\n isScrolling = false;\n scrollHelper = document.createElement('div');\n scrollArea = this.createScrollArea();\n\n /** Canvases from bottom to top. */\n layers: Layer[] = [];\n private readonly layersByName = new Map<string, Layer>();\n private readonly warnedLayers = new Set<string>();\n renderers = new RendererRegistry();\n /** Renderers drawing a cell when its column does not name its own. */\n cellRenderers: RendererRef[] = [builtIn.backgroundRenderer, builtIn.valueRenderer];\n\n cellBackgroundRenderer = new CellBackground({\n layer: builtIn.background,\n background: this._backgroundColor,\n enableFlashing: true,\n flashInDuration: 200,\n flashOutDuration: 400,\n flashRGB: '214, 144, 13',\n borderRightWidth: 1,\n borderRightColor: '#3f3f3f',\n borderBottomWidth: 1,\n borderBottomColor: '#3f3f3f',\n });\n\n cellValueRenderer = new CellValueRenderer({\n layer: builtIn.content,\n font: this._font,\n color: this.textColor,\n });\n\n headerCellRenderer = new HeaderRenderer({\n layer: builtIn.header,\n font: this._headerFont,\n color: this.textColor,\n background: '#222',\n borderRightWidth: 1,\n borderRightColor: '#2f2f2f',\n borderBottomWidth: 1,\n borderBottomColor: '#2f2f2f',\n });\n\n loadingIndicator: Loading;\n /** Reused for every cell drawn; see CellContext. */\n private readonly cell: CellContext;\n private readonly placeholderState: CellState = {};\n throttleTransation = throttle(() => {\n const prevSize = this.totalHeight;\n const moved = this.dataStore.flush();\n if (prevSize !== this.totalHeight) {\n this.refreshScrollbar();\n }\n // rows that were removed or re-sorted changed position, and a normal draw only repaints cells whose value changed\n if (moved) this.forceDraw();\n this.requestRender();\n }, 50);\n\n agApi: AgApi;\n\n constructor() {\n super();\n\n this.resize = this.resize.bind(this);\n this.setValues = this.setValues.bind(this);\n this.setColumns = this.setColumns.bind(this);\n this.clearValues = this.clearValues.bind(this);\n this.updateLastRender = this.updateLastRender.bind(this);\n this.transaction = this.transaction.bind(this);\n this.queueUpdate = this.queueUpdate.bind(this);\n\n this.addLayer(builtIn.background, { alpha: false });\n this.addLayer(builtIn.content);\n this.addLayer(builtIn.header);\n this.registerRenderer(builtIn.backgroundRenderer, this.cellBackgroundRenderer);\n this.registerRenderer(builtIn.valueRenderer, this.cellValueRenderer);\n this.registerRenderer(builtIn.headerRenderer, this.headerCellRenderer);\n this.loadingIndicator = new Loading({ ctx: this.requireLayer(builtIn.header).ctx });\n this.cell = {\n ctx: this.requireLayer(builtIn.content).ctx,\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n row: undefined,\n column: undefined,\n value: undefined,\n formatted: '',\n updatedAt: undefined,\n age: Infinity,\n now: 0,\n dt: 0,\n valueChanged: false,\n forced: false,\n isScrolling: false,\n state: {},\n };\n\n const component = this;\n this.agApi = {\n setRowData: this.setValues,\n updateRowData: this.transaction,\n setColumnDefs: this.setColumns,\n get getRowNodeId() {\n return component.getRowId;\n },\n set getRowNodeId(getId) {\n if (typeof getId === 'function') component.getRowId = getId;\n },\n };\n }\n\n /** Canvas of the content layer, which also defines the viewport size. */\n get canvas() {\n return this.requireLayer(builtIn.content).canvas;\n }\n\n get flashInDuration() {\n return this.cellBackgroundRenderer.options.flashInDuration;\n }\n\n set flashInDuration(flashInDuration: number) {\n this.cellBackgroundRenderer.update({ flashInDuration });\n }\n\n get flashOutDuration() {\n return this.cellBackgroundRenderer.options.flashOutDuration;\n }\n\n set flashOutDuration(flashOutDuration: number) {\n this.cellBackgroundRenderer.update({ flashOutDuration });\n }\n\n getLayer(name: string) {\n return this.layersByName.get(name);\n }\n\n private requireLayer(name: string) {\n const layer = this.getLayer(name);\n if (!layer) throw new Error(`canvas-grid: no layer named \"${name}\"`);\n return layer;\n }\n\n /** Adds a canvas on top of the existing layers, or below the layer named in `before`. */\n addLayer(name: string, { alpha = true, desynchronized = false, before }: LayerOptions = {}) {\n if (this.getLayer(name)) throw new Error(`canvas-grid: layer \"${name}\" already exists`);\n\n const layer = new Layer(name, { alpha, desynchronized });\n const next = before === undefined ? undefined : this.requireLayer(before);\n this.layers.splice(next ? this.layers.indexOf(next) : this.layers.length, 0, layer);\n this.layersByName.set(name, layer);\n // the constructor already runs on elements that are in the document, before connectedCallback mounted anything\n if (this.scrollArea.parentElement === this) {\n this.insertBefore(layer.canvas, next?.canvas ?? this.scrollArea);\n layer.resize(this.clientWidth, this.clientHeight, this.pixelRatio);\n this.forceDraw();\n }\n return layer;\n }\n\n removeLayer(name: string) {\n const layer = this.requireLayer(name);\n this.layers = this.layers.filter(candidate => candidate !== layer);\n this.layersByName.delete(name);\n layer.canvas.remove();\n }\n\n /** Makes a renderer available to columns under `name`; registering an existing name replaces it. */\n registerRenderer(name: string, renderer: CellRenderer) {\n this.renderers.register(name, renderer);\n }\n\n unregisterRenderer(name: string) {\n this.renderers.unregister(name);\n }\n\n createScrollArea() {\n const scrollArea = document.createElement('div');\n scrollArea.className = classes.scrollArea;\n scrollArea.appendChild(this.scrollHelper);\n return scrollArea;\n }\n\n set font(font: string) {\n if (this._font !== font) {\n this._font = font;\n this.cellValueRenderer.font = font;\n }\n }\n\n get font() {\n return this._font;\n }\n\n set headerFont(font: string) {\n if (this._headerFont !== font) {\n this._headerFont = font;\n this.headerCellRenderer.font = font;\n }\n }\n\n get headerFont() {\n return this._headerFont;\n }\n\n connectedCallback() {\n this.layers.forEach(layer => this.appendChild(layer.canvas));\n this.appendChild(this.scrollArea);\n\n this.updateLastRender();\n this.resize();\n if (this.headers.length === 0) this.setColumns(Array(50).fill(1).map((_, index) => index));\n\n document.addEventListener('visibilitychange', this.onVisibilityChange);\n this.observeSize();\n this.pixelRatioQuery = window.matchMedia(`(resolution: ${this.pixelRatio}dppx)`);\n this.pixelRatioQuery.addEventListener('change', this.watchPixelRatio, { once: true });\n\n if (document.fonts) {\n document.fonts.addEventListener('loadingdone', this.onFontsLoaded);\n } else {\n this.fontsTimeout = setTimeout(this.onFontsLoaded, 2000);\n }\n\n const debounceAfterScroll = debounce(() => {\n this.isScrolling = false;\n }, 200);\n const throttledUpdate = throttle((scrollYOffset: number, scrollXOffset: number) => {\n this.scrollXOffset = Math.round(scrollXOffset);\n this.scrollYOffset = Math.round(scrollYOffset);\n debounceAfterScroll();\n this.requestRender();\n }, 10);\n this.scrollArea.addEventListener('scroll', () => {\n const { scrollTop, scrollLeft } = this.scrollArea;\n this.isScrolling = true;\n throttledUpdate(scrollTop, scrollLeft);\n });\n }\n\n private fontsTimeout: ReturnType<typeof setTimeout> | undefined = undefined;\n\n private readonly onVisibilityChange = () => {\n if (document.visibilityState === 'hidden') {\n this.cancelRender();\n return;\n }\n this.resize();\n };\n\n private readonly onFontsLoaded = () => {\n this.renderers.clearCaches();\n this.resize();\n };\n\n cancelRender() {\n if (this.animationFrame !== undefined) cancelAnimationFrame(this.animationFrame);\n this.animationFrame = undefined;\n }\n\n /**\n * Schedules a draw for the next animation frame. Nothing is drawn while the grid is idle:\n * scrolling, data changes and resizes request a draw, and `draw` requests the next one itself while a cell animates.\n */\n requestRender() {\n this.animationFrame ??= requestAnimationFrame(() => this.render());\n }\n\n updateLastRender() {\n this.lastRender = new Date().valueOf();\n }\n\n render() {\n this.animationFrame = undefined;\n const delta = new Date().valueOf() - this.lastRender;\n if (delta < (1000 / this.fps)) {\n this.requestRender();\n return;\n }\n this.draw();\n this.updateLastRender();\n }\n\n hasScrolled() {\n return this.hasXScrolled() || this.hasYScrolled();\n }\n\n hasYScrolled() {\n return this.prevScrollYOffset !== this.scrollYOffset;\n }\n\n hasXScrolled() {\n return this.prevScrollXOffset !== this.scrollXOffset;\n }\n\n isInViewport(x = 0, y = 0, width = 0, height = 0) {\n if (x > this.viewportWidth) return false;\n if (y > this.viewportHeight) return false;\n if (x + width < 0) return false;\n if (y + height < 0) return false;\n\n return true;\n }\n\n /** Fills the shared context for something that is not a data cell: a header, row number or placeholder. */\n private describe(x: number, y: number, width: number, height: number, overrides: Partial<CellContext>) {\n return Object.assign(this.cell, {\n x,\n y,\n width,\n height,\n row: undefined,\n column: undefined,\n value: undefined,\n formatted: '',\n updatedAt: undefined,\n age: Infinity,\n valueChanged: true,\n forced: true,\n state: this.placeholderState,\n }, overrides);\n }\n\n private paint(ref: RendererRef) {\n const renderer = this.renderers.resolve(ref);\n const layer = renderer && this.layersByName.get(renderer.layer);\n if (renderer && !layer && !this.warnedLayers.has(renderer.layer)) {\n this.warnedLayers.add(renderer.layer);\n console.warn(`canvas-grid: renderer draws on missing layer \"${renderer.layer}\"`);\n }\n if (!renderer || !layer) return;\n\n this.cell.ctx = layer.ctx;\n renderer.draw(this.cell);\n }\n\n private paintAll(refs: readonly RendererRef[]) {\n refs.forEach(ref => this.paint(ref));\n }\n\n private isAnimating(refs: readonly RendererRef[]) {\n return refs.some(ref => this.renderers.resolve(ref)?.isAnimating?.(this.cell) === true);\n }\n\n draw(forced = false) {\n const now = new Date().valueOf();\n const redrawAll = forced || this.hasScrolled();\n this.cell.now = now;\n this.cell.dt = now - this.lastDraw;\n this.cell.isScrolling = this.isScrolling;\n this.lastDraw = now;\n // the loading indicator animates until there is data\n let keepDrawing = this._dataCollection.length === 0;\n\n if ((forced || this.hasXScrolled()) && this.showHeaders) {\n this.renderHeaders();\n }\n\n const fakeRows = 200;\n if (forced && this.showRowNumbers && this._dataCollection.length === 0) {\n for (let fakeRowIndex= 0; fakeRowIndex <= fakeRows; fakeRowIndex++) {\n this.renderRowNumber({ index: fakeRowIndex }, (fakeRowIndex * this.cellHeight) + (this.showHeaders ? this.headerHeight : 0) - this.scrollYOffset);\n }\n }\n\n if (this._dataCollection.length === 0) {\n this.loadingIndicator.render();\n for (let fakeRowIndex= 0; fakeRowIndex <= fakeRows; fakeRowIndex++) {\n this.headers.forEach(header => {\n this.describe(\n Math.round((header.index * header.width) + (this.showRowNumbers ? this.rowNumbersWidth : 0) - this.scrollXOffset),\n Math.round((fakeRowIndex * this.cellHeight) + (this.showHeaders ? this.headerHeight : 0) - this.scrollYOffset),\n header.width,\n this.cellHeight,\n { column: header, valueChanged: false },\n );\n this.paintAll(header.renderers ?? this.cellRenderers);\n });\n }\n }\n\n const originY = Math.round((this.showHeaders ? this.headerHeight : 0) - this.scrollYOffset);\n const xOffset = Math.round((this.showRowNumbers ? this.rowNumbersWidth : 0) - this.scrollXOffset);\n // only the rows overlapping the viewport: found by offset instead of walking from the first row\n const firstRow = this._dataCollection.indexAt(-originY);\n const visibleColumns = this.getVisibleColumns(xOffset);\n for (let rowIndex = firstRow; rowIndex < this._dataCollection.length; rowIndex++) {\n const row = this._dataCollection.at(rowIndex);\n const currentY = originY + this._dataCollection.topOf(rowIndex);\n if (!row || currentY >= this.viewportHeight) break;\n\n const { id: key, slot } = row;\n\n if ((forced || this.hasYScrolled()) && this.showRowNumbers) {\n this.renderRowNumber(row, currentY);\n }\n\n if (row.height + currentY > 0) {\n let entries = this.cellEntries.get(String(key));\n if (!entries) {\n entries = {};\n this.cellEntries.set(String(key), entries);\n }\n const cellRow = { id: key, index: row.index };\n\n for (const { header, id: columnKey, x, store } of visibleColumns) {\n const value = store?.get(slot);\n if (value === undefined) continue;\n\n const entry = entries[columnKey] ??= { value: undefined, formatted: undefined, animating: false, state: {} };\n // values are only formatted for the cells being drawn, and again only once they change\n const formatted = entry.formatted !== undefined && entry.value === value ? entry.formatted : header.valueFormatter(value);\n const valueChanged = entry.formatted !== formatted;\n const updatedAt = store?.getUpdatedAt(slot);\n\n const { cell } = this;\n cell.x = x;\n cell.y = currentY;\n cell.width = header.width;\n cell.height = row.height;\n cell.row = cellRow;\n cell.column = header;\n cell.value = value;\n cell.formatted = formatted;\n cell.updatedAt = updatedAt;\n cell.age = updatedAt === undefined ? Infinity : now - updatedAt;\n cell.valueChanged = valueChanged;\n cell.forced = redrawAll;\n cell.state = entry.state;\n const refs = header.renderers ?? this.cellRenderers;\n const animating = this.isAnimating(refs);\n // an animation gets one last frame after it stops, so its final state is what stays on screen\n if (redrawAll || valueChanged || animating || entry.animating) this.paintAll(refs);\n entry.animating = animating;\n entry.value = value;\n entry.formatted = formatted;\n keepDrawing ||= animating;\n }\n }\n }\n if (this.scrollYOffset > 0 || this.scrollXOffset > 0) {\n this.renderBrick();\n }\n this.prevScrollYOffset = this.scrollYOffset;\n this.prevScrollXOffset = this.scrollXOffset;\n if (keepDrawing) this.requestRender();\n }\n\n /** The columns overlapping the viewport horizontally, with their x position and values; found once per draw, not per row. */\n private getVisibleColumns(xOffset: number) {\n const visible: { header: ColumnHeader; id: string; x: number; store: ColumnStore | undefined }[] = [];\n let x = xOffset;\n this.headers.forEach((header, key) => {\n if (this.isInViewport(x, 0, header.width, 0)) {\n visible.push({ header, id: String(key), x, store: this.dataStore.columns.get(String(key)) });\n }\n x += Math.round(header.width);\n });\n return visible;\n }\n\n renderRowNumber(row: { index: number; height?: number }, y: number) {\n if (!this.isInViewport(0, y, this.rowNumbersWidth, row.height)) return;\n this.describe(0, Math.ceil(y), this.rowNumbersWidth, row.height ?? 0, {\n row: { id: row.index, index: row.index },\n formatted: `${row.index + 1}`,\n });\n this.paint(builtIn.headerRenderer);\n }\n\n forceDraw() {\n this.layers.forEach(layer => layer.clear());\n this.draw(true);\n }\n\n /** Viewport size in CSS pixels as of the last resize; cached because reading `clientWidth` per cell is slow. */\n viewportWidth = 0;\n\n viewportHeight = 0;\n\n /** Device pixels per CSS pixel; canvases are scaled by it to stay sharp on HiDPI screens. */\n get pixelRatio() {\n return window.devicePixelRatio || 1;\n }\n\n /** Resizes the layers when the size or pixel ratio changed, then redraws everything. */\n resize() {\n this.cancelRender();\n const { pixelRatio } = this;\n this.viewportWidth = this.clientWidth;\n this.viewportHeight = this.clientHeight;\n this.layers.forEach(layer => layer.resize(this.clientWidth, this.clientHeight, pixelRatio));\n if (this.cellValueRenderer.pixelRatio !== pixelRatio) {\n this.renderers.clearCaches();\n }\n this.cellValueRenderer.pixelRatio = pixelRatio;\n this.headerCellRenderer.pixelRatio = pixelRatio;\n this.forceDraw();\n }\n\n /** Redraws when the element changes size, instead of checking on every frame. */\n private observeSize() {\n this.resizeObserver ??= new ResizeObserver(() => this.resize());\n this.resizeObserver.observe(this);\n }\n\n /** The pixel ratio changes with browser zoom or when the window moves to another screen. */\n private watchPixelRatio = () => {\n this.pixelRatioQuery?.removeEventListener('change', this.watchPixelRatio);\n this.pixelRatioQuery = window.matchMedia(`(resolution: ${this.pixelRatio}dppx)`);\n this.pixelRatioQuery.addEventListener('change', this.watchPixelRatio, { once: true });\n this.resize();\n };\n\n private resizeObserver: ResizeObserver | undefined = undefined;\n\n private pixelRatioQuery: MediaQueryList | undefined = undefined;\n\n /** A row's position and height along with its values by column id, or undefined for an unknown row. */\n getRowData(rowId: RowId) {\n const row = this._dataCollection.get(rowId);\n if (!row) return undefined;\n\n const values: Record<string, unknown> = {};\n this.dataStore.columns.forEach((column, key) => {\n const value = column.get(row.slot);\n if (value !== undefined) values[key] = value;\n });\n return { id: row.id, index: row.index, height: row.height, values };\n }\n\n /** Orders the rows by the given columns, in priority order; an empty list restores the original order. */\n setSortModel(model: readonly SortKey[]) {\n this.dataStore.setSortModel(model);\n this.forceDraw();\n }\n\n getSortModel() {\n return this.dataStore.getSortModel();\n }\n\n renderBrick() {\n if (this.showHeaders && this.showRowNumbers && this._headerBackgroundColor) {\n this.describe(0, 0, this.rowNumbersWidth, this.headerHeight, {});\n this.paint(builtIn.headerRenderer);\n }\n }\n\n renderHeaders() {\n let currentX = (this.showRowNumbers ? this.rowNumbersWidth : 0) - this.scrollXOffset;\n\n this.headers.forEach(header => {\n if (this.isInViewport(currentX, 0, header.width, this.headerHeight)) {\n this.describe(currentX, 0, header.width, this.headerHeight, {\n column: header,\n formatted: header.displayName ?? '',\n });\n this.paint(header.headerRenderer);\n }\n currentX += header.width;\n });\n\n if (this.scrollXOffset + this.rowNumbersWidth > 0) {\n this.renderBrick();\n }\n }\n\n getColumnHeader(key: Key) {\n return this.headers.get(key);\n }\n\n get totalHeight() {\n return this._dataCollection.totalHeight;\n }\n\n refreshScrollbar() {\n const height = this.totalHeight + this.headerHeight;\n this.scrollHelper.style.height = `${height}px`;\n let width = 0;\n this.headers.forEach(header => {\n width += Math.round(header.width);\n });\n this.scrollHelper.style.width = `${width}px`;\n }\n\n queueUpdate(row: RowInput) {\n this.dataStore.queueUpdate(row);\n this.throttleTransation();\n }\n\n queueRemove(row: RowInput) {\n this.dataStore.queueRemove(row);\n this.throttleTransation();\n }\n\n transaction({ add = [], remove = [], update = [] }: Transaction) {\n if (Array.isArray(add)) {\n add.forEach(row => this.queueUpdate(row));\n }\n\n if (Array.isArray(update)) {\n update.forEach(row => this.queueUpdate(row));\n }\n\n if (Array.isArray(remove)) {\n remove.forEach(row => this.queueRemove(row));\n }\n }\n\n clearValues() {\n this.dataStore.clear();\n this.cellEntries.clear();\n }\n\n formatValue(key: Key, value: unknown) {\n return this.headers.get(key)?.valueFormatter(value) ?? String(value);\n }\n\n setValues(data: RowInput[]) {\n this.throttleTransation.cancel();\n this.clearValues();\n if (!Array.isArray(data)) return;\n this.dataStore.setRows(data);\n this.refreshScrollbar();\n this.forceDraw();\n }\n\n setColumns(columns: ColumnDefinition[]) {\n if (Array.isArray(columns)) {\n this.headers.clear();\n // cached formatted values belong to the previous formatters\n this.cellEntries.clear();\n const defaults = {\n width: 100,\n valueFormatter: (v: unknown) => String(v),\n headerRenderer: builtIn.headerRenderer,\n };\n columns.forEach((column, index) => {\n if (typeof column === 'string' || typeof column === 'number') {\n const columnId = column + '';\n this.headers.set(columnId, {\n ...defaults,\n index: index,\n id: column,\n displayName: columnId,\n });\n }\n if (typeof column === 'object') {\n this.headers.set(column.id + '', {\n ...defaults,\n index: index,\n ...column,\n });\n }\n });\n this.refreshScrollbar();\n this.forceDraw();\n }\n }\n\n disconnectedCallback() {\n this.cancelRender();\n document.removeEventListener('visibilitychange', this.onVisibilityChange);\n this.resizeObserver?.disconnect();\n this.pixelRatioQuery?.removeEventListener('change', this.watchPixelRatio);\n document.fonts?.removeEventListener('loadingdone', this.onFontsLoaded);\n clearTimeout(this.fontsTimeout);\n }\n}\n\nif (window && window.customElements) {\n injectStyles();\n customElements.define('canvas-grid', CanvasGridComponent);\n}\n\nexport default CanvasGridComponent;\n"],"ignoreList":[0,1],"mappings":";;;;;;;;;;;CAUA,IAAI0B,IAAkB,uBAGlBC,IAAM,KAMNC,IAAS,cAGTC,IAAa,sBAGbC,IAAa,cAGbC,IAAY,eAGZC,IAAe,UAGfC,IAAa,OAAO,UAAU,YAAY,UAAU,OAAO,WAAW,UAAU,QAGhFC,IAAW,OAAO,QAAQ,YAAY,QAAQ,KAAK,WAAW,UAAU,MAGxEC,IAAOF,KAAcC,KAAY,SAAS,aAAa,CAAC,CAAC,GAUzDE,IAPc,OAAO,UAOQ,UAG7BC,IAAY,KAAK,KACjBC,IAAY,KAAK,KAkBjBC,IAAM,WAAW;EACnB,OAAOJ,EAAK,KAAK,IAAI;CACvB;CAwDA,SAASK,EAAS,GAAM,GAAM,GAAS;EACrC,IAAIC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,IAAiB,GACjBC,IAAU,IACVC,IAAS,IACTC,IAAW;EAEf,IAAI,OAAOC,KAAQ,YACjB,MAAU,UAAUzB,CAAe;EAGrC,AADA,IAAO0B,EAASC,CAAI,KAAK,GACrBC,EAASC,CAAO,MAClB,IAAU,CAAC,CAACA,EAAQ,SACpB,IAAS,aAAaA,GACtB,IAAUN,IAASZ,EAAUe,EAASG,EAAQ,OAAO,KAAK,GAAGF,CAAI,IAAIV,GACrE,IAAW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