govuk_publishing_components 12.13.0 → 12.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/components/accessible-autocomplete.js +37 -0
  3. data/app/assets/javascripts/govuk_publishing_components/components/checkboxes.js +6 -5
  4. data/app/assets/javascripts/govuk_publishing_components/components/copy-to-clipboard.js +15 -15
  5. data/app/assets/javascripts/govuk_publishing_components/components/feedback.js +2 -4
  6. data/app/assets/javascripts/govuk_publishing_components/components/initial-focus.js +8 -8
  7. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +3 -3
  8. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
  9. data/app/assets/stylesheets/govuk_publishing_components/components/_accessible-autocomplete.scss +16 -0
  10. data/app/views/govuk_publishing_components/components/_accessible_autocomplete.html.erb +24 -0
  11. data/app/views/govuk_publishing_components/components/docs/accessible_autocomplete.yml +42 -0
  12. data/config/initializers/assets.rb +1 -0
  13. data/lib/govuk_publishing_components/version.rb +1 -1
  14. data/node_modules/accessible-autocomplete/CHANGELOG.md +269 -0
  15. data/node_modules/accessible-autocomplete/CONTRIBUTING.md +150 -0
  16. data/node_modules/accessible-autocomplete/LICENSE.txt +20 -0
  17. data/node_modules/accessible-autocomplete/Procfile +1 -0
  18. data/node_modules/accessible-autocomplete/README.md +416 -0
  19. data/node_modules/accessible-autocomplete/accessibility-criteria.md +42 -0
  20. data/node_modules/accessible-autocomplete/app.json +15 -0
  21. data/node_modules/accessible-autocomplete/dist/accessible-autocomplete.min.css +1 -0
  22. data/node_modules/accessible-autocomplete/dist/accessible-autocomplete.min.js +2 -0
  23. data/node_modules/accessible-autocomplete/dist/accessible-autocomplete.min.js.map +1 -0
  24. data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.preact.min.js +2 -0
  25. data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.preact.min.js.map +1 -0
  26. data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.react.min.js +2 -0
  27. data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.react.min.js.map +1 -0
  28. data/node_modules/accessible-autocomplete/examples/form.html +671 -0
  29. data/node_modules/accessible-autocomplete/examples/index.html +616 -0
  30. data/node_modules/accessible-autocomplete/examples/preact/index.html +346 -0
  31. data/node_modules/accessible-autocomplete/examples/react/index.html +347 -0
  32. data/node_modules/accessible-autocomplete/package.json +192 -0
  33. data/node_modules/accessible-autocomplete/preact.js +1 -0
  34. data/node_modules/accessible-autocomplete/react.js +1 -0
  35. data/node_modules/accessible-autocomplete/scripts/check-staged.js +14 -0
  36. data/node_modules/accessible-autocomplete/src/autocomplete.css +141 -0
  37. data/node_modules/accessible-autocomplete/src/autocomplete.js +524 -0
  38. data/node_modules/accessible-autocomplete/src/dropdown-arrow-down.js +11 -0
  39. data/node_modules/accessible-autocomplete/src/status.js +80 -0
  40. data/node_modules/accessible-autocomplete/src/wrapper.js +60 -0
  41. data/node_modules/accessible-autocomplete/test/functional/dropdown-arrow-down.js +44 -0
  42. data/node_modules/accessible-autocomplete/test/functional/index.js +485 -0
  43. data/node_modules/accessible-autocomplete/test/functional/wrapper.js +267 -0
  44. data/node_modules/accessible-autocomplete/test/integration/index.js +188 -0
  45. data/node_modules/accessible-autocomplete/test/karma.config.js +42 -0
  46. data/node_modules/accessible-autocomplete/test/wdio.config.js +80 -0
  47. data/node_modules/accessible-autocomplete/webpack.config.babel.js +193 -0
  48. data/node_modules/preact/LICENSE +21 -0
  49. data/node_modules/preact/README.md +580 -0
  50. data/node_modules/preact/debug.js +112 -0
  51. data/node_modules/preact/debug.js.map +1 -0
  52. data/node_modules/preact/debug/index.js +121 -0
  53. data/node_modules/preact/devtools.js +403 -0
  54. data/node_modules/preact/devtools.js.map +1 -0
  55. data/node_modules/preact/devtools/devtools.js +395 -0
  56. data/node_modules/preact/devtools/index.js +4 -0
  57. data/node_modules/preact/dist/preact.d.ts +891 -0
  58. data/node_modules/preact/dist/preact.dev.js +718 -0
  59. data/node_modules/preact/dist/preact.dev.js.map +1 -0
  60. data/node_modules/preact/dist/preact.js +408 -0
  61. data/node_modules/preact/dist/preact.js.flow +13 -0
  62. data/node_modules/preact/dist/preact.js.map +1 -0
  63. data/node_modules/preact/dist/preact.min.js +2 -0
  64. data/node_modules/preact/dist/preact.min.js.map +1 -0
  65. data/node_modules/preact/dist/preact.mjs +715 -0
  66. data/node_modules/preact/dist/preact.mjs.map +1 -0
  67. data/node_modules/preact/package.json +218 -0
  68. data/node_modules/preact/src/clone-element.js +18 -0
  69. data/node_modules/preact/src/component.js +90 -0
  70. data/node_modules/preact/src/constants.js +17 -0
  71. data/node_modules/preact/src/dom/index.js +138 -0
  72. data/node_modules/preact/src/h.js +86 -0
  73. data/node_modules/preact/src/options.js +22 -0
  74. data/node_modules/preact/src/preact.d.ts +891 -0
  75. data/node_modules/preact/src/preact.js +26 -0
  76. data/node_modules/preact/src/preact.js.flow +13 -0
  77. data/node_modules/preact/src/render-queue.js +28 -0
  78. data/node_modules/preact/src/render.js +22 -0
  79. data/node_modules/preact/src/util.js +19 -0
  80. data/node_modules/preact/src/vdom/component-recycler.js +48 -0
  81. data/node_modules/preact/src/vdom/component.js +296 -0
  82. data/node_modules/preact/src/vdom/diff.js +336 -0
  83. data/node_modules/preact/src/vdom/index.js +54 -0
  84. data/node_modules/preact/src/vnode.js +9 -0
  85. data/node_modules/preact/typings.json +5 -0
  86. metadata +78 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devtools.js","sources":["src/constants.js","devtools/devtools.js","devtools/index.js"],"sourcesContent":["// render modes\n\n/** Do not re-render a component */\nexport const NO_RENDER = 0;\n/** Synchronously re-render a component and its children */\nexport const SYNC_RENDER = 1;\n/** Synchronously re-render a component, even if its lifecycle methods attempt to prevent it. */\nexport const FORCE_RENDER = 2;\n/** Queue asynchronous re-render of a component and it's children */\nexport const ASYNC_RENDER = 3;\n\n\nexport const ATTR_KEY = '__preactattr_';\n\n/** DOM properties that should NOT have \"px\" added when numeric */\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;\n\n","/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\n\nimport { options } from 'preact';\n\n// Internal helpers from preact\nimport { ATTR_KEY } from '../src/constants';\n\n/**\n * Return a ReactElement-compatible object for the current state of a preact\n * component.\n */\nfunction createReactElement(component) {\n\treturn {\n\t\ttype: component.constructor,\n\t\tkey: component.key,\n\t\tref: null, // Unsupported\n\t\tprops: component.props\n\t};\n}\n\n/**\n * Create a ReactDOMComponent-compatible object for a given DOM node rendered\n * by preact.\n *\n * This implements the subset of the ReactDOMComponent interface that\n * React DevTools requires in order to display DOM nodes in the inspector with\n * the correct type and properties.\n *\n * @param {Node} node\n */\nfunction createReactDOMComponent(node) {\n\tconst childNodes = node.nodeType === Node.ELEMENT_NODE ?\n\t\tArray.from(node.childNodes) : [];\n\n\tconst isText = node.nodeType === Node.TEXT_NODE;\n\n\treturn {\n\t\t// --- ReactDOMComponent interface\n\t\t_currentElement: isText ? node.textContent : {\n\t\t\ttype: node.nodeName.toLowerCase(),\n\t\t\tprops: node[ATTR_KEY]\n\t\t},\n\t\t_renderedChildren: childNodes.map(child => {\n\t\t\tif (child._component) {\n\t\t\t\treturn updateReactComponent(child._component);\n\t\t\t}\n\t\t\treturn updateReactComponent(child);\n\t\t}),\n\t\t_stringText: isText ? node.textContent : null,\n\n\t\t// --- Additional properties used by preact devtools\n\n\t\t// A flag indicating whether the devtools have been notified about the\n\t\t// existence of this component instance yet.\n\t\t// This is used to send the appropriate notifications when DOM components\n\t\t// are added or updated between composite component updates.\n\t\t_inDevTools: false,\n\t\tnode\n\t};\n}\n\n/**\n * Return the name of a component created by a `ReactElement`-like object.\n *\n * @param {ReactElement} element\n */\nfunction typeName(element) {\n\tif (typeof element.type === 'function') {\n\t\treturn element.type.displayName || element.type.name;\n\t}\n\treturn element.type;\n}\n\n/**\n * Return a ReactCompositeComponent-compatible object for a given preact\n * component instance.\n *\n * This implements the subset of the ReactCompositeComponent interface that\n * the DevTools requires in order to walk the component tree and inspect the\n * component's properties.\n *\n * See https://github.com/facebook/react-devtools/blob/e31ec5825342eda570acfc9bcb43a44258fceb28/backend/getData.js\n */\nfunction createReactCompositeComponent(component) {\n\tconst _currentElement = createReactElement(component);\n\tconst node = component.base;\n\n\tlet instance = {\n\t\t// --- ReactDOMComponent properties\n\t\tgetName() {\n\t\t\treturn typeName(_currentElement);\n\t\t},\n\t\t_currentElement: createReactElement(component),\n\t\tprops: component.props,\n\t\tstate: component.state,\n\t\tforceUpdate: component.forceUpdate && component.forceUpdate.bind(component),\n\t\tsetState: component.setState && component.setState.bind(component),\n\n\t\t// --- Additional properties used by preact devtools\n\t\tnode\n\t};\n\n\t// React DevTools exposes the `_instance` field of the selected item in the\n\t// component tree as `$r` in the console. `_instance` must refer to a\n\t// React Component (or compatible) class instance with `props` and `state`\n\t// fields and `setState()`, `forceUpdate()` methods.\n\tinstance._instance = component;\n\n\t// If the root node returned by this component instance's render function\n\t// was itself a composite component, there will be a `_component` property\n\t// containing the child component instance.\n\tif (component._component) {\n\t\tinstance._renderedComponent = updateReactComponent(component._component);\n\t} else {\n\t\t// Otherwise, if the render() function returned an HTML/SVG element,\n\t\t// create a ReactDOMComponent-like object for the DOM node itself.\n\t\tinstance._renderedComponent = updateReactComponent(node);\n\t}\n\n\treturn instance;\n}\n\n/**\n * Map of Component|Node to ReactDOMComponent|ReactCompositeComponent-like\n * object.\n *\n * The same React*Component instance must be used when notifying devtools\n * about the initial mount of a component and subsequent updates.\n */\nlet instanceMap = typeof Map==='function' && new Map();\n\n/**\n * Update (and create if necessary) the ReactDOMComponent|ReactCompositeComponent-like\n * instance for a given preact component instance or DOM Node.\n *\n * @param {Component|Node} componentOrNode\n */\nfunction updateReactComponent(componentOrNode) {\n\tconst newInstance = componentOrNode instanceof Node ?\n\t\tcreateReactDOMComponent(componentOrNode) :\n\t\tcreateReactCompositeComponent(componentOrNode);\n\tif (instanceMap.has(componentOrNode)) {\n\t\tlet inst = instanceMap.get(componentOrNode);\n\t\tObject.assign(inst, newInstance);\n\t\treturn inst;\n\t}\n\tinstanceMap.set(componentOrNode, newInstance);\n\treturn newInstance;\n}\n\nfunction nextRootKey(roots) {\n\treturn '.' + Object.keys(roots).length;\n}\n\n/**\n * Find all root component instances rendered by preact in `node`'s children\n * and add them to the `roots` map.\n *\n * @param {DOMElement} node\n * @param {[key: string] => ReactDOMComponent|ReactCompositeComponent}\n */\nfunction findRoots(node, roots) {\n\tArray.from(node.childNodes).forEach(child => {\n\t\tif (child._component) {\n\t\t\troots[nextRootKey(roots)] = updateReactComponent(child._component);\n\t\t} else {\n\t\t\tfindRoots(child, roots);\n\t\t}\n\t});\n}\n\n/**\n * Create a bridge for exposing preact's component tree to React DevTools.\n *\n * It creates implementations of the interfaces that ReactDOM passes to\n * devtools to enable it to query the component tree and hook into component\n * updates.\n *\n * See https://github.com/facebook/react/blob/59ff7749eda0cd858d5ee568315bcba1be75a1ca/src/renderers/dom/ReactDOM.js\n * for how ReactDOM exports its internals for use by the devtools and\n * the `attachRenderer()` function in\n * https://github.com/facebook/react-devtools/blob/e31ec5825342eda570acfc9bcb43a44258fceb28/backend/attachRenderer.js\n * for how the devtools consumes the resulting objects.\n */\nfunction createDevToolsBridge() {\n\t// The devtools has different paths for interacting with the renderers from\n\t// React Native, legacy React DOM and current React DOM.\n\t//\n\t// Here we emulate the interface for the current React DOM (v15+) lib.\n\n\t// ReactDOMComponentTree-like object\n\tconst ComponentTree = {\n\t\tgetNodeFromInstance(instance) {\n\t\t\treturn instance.node;\n\t\t},\n\t\tgetClosestInstanceFromNode(node) {\n\t\t\twhile (node && !node._component) {\n\t\t\t\tnode = node.parentNode;\n\t\t\t}\n\t\t\treturn node ? updateReactComponent(node._component) : null;\n\t\t}\n\t};\n\n\t// Map of root ID (the ID is unimportant) to component instance.\n\tlet roots = {};\n\tfindRoots(document.body, roots);\n\n\t// ReactMount-like object\n\t//\n\t// Used by devtools to discover the list of root component instances and get\n\t// notified when new root components are rendered.\n\tconst Mount = {\n\t\t_instancesByReactRootID: roots,\n\n\t\t// Stub - React DevTools expects to find this method and replace it\n\t\t// with a wrapper in order to observe new root components being added\n\t\t_renderNewRootComponent(/* instance, ... */) { }\n\t};\n\n\t// ReactReconciler-like object\n\tconst Reconciler = {\n\t\t// Stubs - React DevTools expects to find these methods and replace them\n\t\t// with wrappers in order to observe components being mounted, updated and\n\t\t// unmounted\n\t\tmountComponent(/* instance, ... */) { },\n\t\tperformUpdateIfNecessary(/* instance, ... */) { },\n\t\treceiveComponent(/* instance, ... */) { },\n\t\tunmountComponent(/* instance, ... */) { }\n\t};\n\n\t/** Notify devtools that a new component instance has been mounted into the DOM. */\n\tconst componentAdded = component => {\n\t\tconst instance = updateReactComponent(component);\n\t\tif (isRootComponent(component)) {\n\t\t\tinstance._rootID = nextRootKey(roots);\n\t\t\troots[instance._rootID] = instance;\n\t\t\tMount._renderNewRootComponent(instance);\n\t\t}\n\t\tvisitNonCompositeChildren(instance, childInst => {\n\t\t\tchildInst._inDevTools = true;\n\t\t\tReconciler.mountComponent(childInst);\n\t\t});\n\t\tReconciler.mountComponent(instance);\n\t};\n\n\t/** Notify devtools that a component has been updated with new props/state. */\n\tconst componentUpdated = component => {\n\t\tconst prevRenderedChildren = [];\n\t\tlet instance = instanceMap.get(component);\n\t\tif (instance) {\n\t\t\tvisitNonCompositeChildren(instance, childInst => {\n\t\t\t\tprevRenderedChildren.push(childInst);\n\t\t\t});\n\t\t}\n\t\t// Notify devtools about updates to this component and any non-composite\n\t\t// children\n\t\tinstance = updateReactComponent(component);\n\n\t\tReconciler.receiveComponent(instance);\n\t\tvisitNonCompositeChildren(instance, childInst => {\n\t\t\tif (!childInst._inDevTools) {\n\t\t\t\t// New DOM child component\n\t\t\t\tchildInst._inDevTools = true;\n\t\t\t\tReconciler.mountComponent(childInst);\n\t\t\t} else {\n\t\t\t\t// Updated DOM child component\n\t\t\t\tReconciler.receiveComponent(childInst);\n\t\t\t}\n\t\t});\n\n\t\t// For any non-composite children that were removed by the latest render,\n\t\t// remove the corresponding ReactDOMComponent-like instances and notify\n\t\t// the devtools\n\t\tprevRenderedChildren.forEach(childInst => {\n\t\t\tif (!document.body.contains(childInst.node)) {\n\t\t\t\tinstanceMap.delete(childInst.node);\n\t\t\t\tReconciler.unmountComponent(childInst);\n\t\t\t}\n\t\t});\n\t};\n\n\t/** Notify devtools that a component has been unmounted from the DOM. */\n\tconst componentRemoved = component => {\n\t\tconst instance = updateReactComponent(component);\n\t\tvisitNonCompositeChildren(childInst => {\n\t\t\tinstanceMap.delete(childInst.node);\n\t\t\tReconciler.unmountComponent(childInst);\n\t\t});\n\t\tReconciler.unmountComponent(instance);\n\t\tinstanceMap.delete(component);\n\t\tif (instance._rootID) {\n\t\t\tdelete roots[instance._rootID];\n\t\t}\n\t};\n\n\treturn {\n\t\tcomponentAdded,\n\t\tcomponentUpdated,\n\t\tcomponentRemoved,\n\n\t\t// Interfaces passed to devtools via __REACT_DEVTOOLS_GLOBAL_HOOK__.inject()\n\t\tComponentTree,\n\t\tMount,\n\t\tReconciler\n\t};\n}\n\n/**\n * Return `true` if a preact component is a top level component rendered by\n * `render()` into a container Element.\n */\nfunction isRootComponent(component) {\n\t// `_parentComponent` is actually `__u` after minification\n\tif (component._parentComponent || component.__u) {\n\t\t// Component with a composite parent\n\t\treturn false;\n\t}\n\tif (component.base.parentElement && component.base.parentElement[ATTR_KEY]) {\n\t\t// Component with a parent DOM element rendered by Preact\n\t\treturn false;\n\t}\n\treturn true;\n}\n\n/**\n * Visit all child instances of a ReactCompositeComponent-like object that are\n * not composite components (ie. they represent DOM elements or text)\n *\n * @param {Component} component\n * @param {(Component) => void} visitor\n */\nfunction visitNonCompositeChildren(component, visitor) {\n\tif (!component) return;\n\tif (component._renderedComponent) {\n\t\tif (!component._renderedComponent._component) {\n\t\t\tvisitor(component._renderedComponent);\n\t\t\tvisitNonCompositeChildren(component._renderedComponent, visitor);\n\t\t}\n\t} else if (component._renderedChildren) {\n\t\tcomponent._renderedChildren.forEach(child => {\n\t\t\tvisitor(child);\n\t\t\tif (!child._component) visitNonCompositeChildren(child, visitor);\n\t\t});\n\t}\n}\n\n/**\n * Create a bridge between the preact component tree and React's dev tools\n * and register it.\n *\n * After this function is called, the React Dev Tools should be able to detect\n * \"React\" on the page and show the component tree.\n *\n * This function hooks into preact VNode creation in order to expose functional\n * components correctly, so it should be called before the root component(s)\n * are rendered.\n *\n * Returns a cleanup function which unregisters the hooks.\n */\nexport function initDevTools() {\n\tif (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {\n\t\t// React DevTools are not installed\n\t\treturn;\n\t}\n\n\t// Notify devtools when preact components are mounted, updated or unmounted\n\tconst bridge = createDevToolsBridge();\n\n\tconst nextAfterMount = options.afterMount;\n\toptions.afterMount = component => {\n\t\tbridge.componentAdded(component);\n\t\tif (nextAfterMount) nextAfterMount(component);\n\t};\n\n\tconst nextAfterUpdate = options.afterUpdate;\n\toptions.afterUpdate = component => {\n\t\tbridge.componentUpdated(component);\n\t\tif (nextAfterUpdate) nextAfterUpdate(component);\n\t};\n\n\tconst nextBeforeUnmount = options.beforeUnmount;\n\toptions.beforeUnmount = component => {\n\t\tbridge.componentRemoved(component);\n\t\tif (nextBeforeUnmount) nextBeforeUnmount(component);\n\t};\n\n\t// Notify devtools about this instance of \"React\"\n\t__REACT_DEVTOOLS_GLOBAL_HOOK__.inject(bridge);\n\n\treturn () => {\n\t\toptions.afterMount = nextAfterMount;\n\t\toptions.afterUpdate = nextAfterUpdate;\n\t\toptions.beforeUnmount = nextBeforeUnmount;\n\t};\n}\n","import { initDevTools } from './devtools';\n\ninitDevTools();\n\n"],"names":["ATTR_KEY","createReactElement","component","type","constructor","key","ref","props","createReactDOMComponent","node","childNodes","nodeType","Node","ELEMENT_NODE","Array","from","isText","TEXT_NODE","_currentElement","textContent","nodeName","toLowerCase","_renderedChildren","map","child","_component","updateReactComponent","_stringText","_inDevTools","typeName","element","displayName","name","createReactCompositeComponent","base","instance","getName","state","forceUpdate","bind","setState","_instance","_renderedComponent","instanceMap","Map","componentOrNode","newInstance","has","inst","get","Object","assign","set","nextRootKey","roots","keys","length","findRoots","forEach","createDevToolsBridge","ComponentTree","getNodeFromInstance","getClosestInstanceFromNode","parentNode","document","body","Mount","_instancesByReactRootID","_renderNewRootComponent","Reconciler","mountComponent","performUpdateIfNecessary","receiveComponent","unmountComponent","componentAdded","isRootComponent","_rootID","visitNonCompositeChildren","childInst","componentUpdated","prevRenderedChildren","push","contains","delete","componentRemoved","_parentComponent","__u","parentElement","visitor","initDevTools","__REACT_DEVTOOLS_GLOBAL_HOOK__","bridge","nextAfterMount","options","afterMount","nextAfterUpdate","afterUpdate","nextBeforeUnmount","beforeUnmount","inject"],"mappings":";;;;;;CAAA;;AAYA,CAAO,IAAMA,WAAW,eAAjB;;CCZP;;CAOA;;;;CAIA,SAASC,kBAAT,CAA4BC,SAA5B,EAAuC;CACtC,QAAO;CACNC,QAAMD,UAAUE,WADV;CAENC,OAAKH,UAAUG,GAFT;CAGNC,OAAK,IAHC;CAINC,SAAOL,UAAUK;CAJX,EAAP;CAMA;;CAED;;;;;;;;;;CAUA,SAASC,uBAAT,CAAiCC,IAAjC,EAAuC;CACtC,KAAMC,aAAaD,KAAKE,QAAL,KAAkBC,KAAKC,YAAvB,GAClBC,MAAMC,IAAN,CAAWN,KAAKC,UAAhB,CADkB,GACY,EAD/B;;CAGA,KAAMM,SAASP,KAAKE,QAAL,KAAkBC,KAAKK,SAAtC;;CAEA,QAAO;CACN;CACAC,mBAAiBF,SAASP,KAAKU,WAAd,GAA4B;CAC5ChB,SAAMM,KAAKW,QAAL,CAAcC,WAAd,EADsC;CAE5Cd,UAAOE,KAAKT,QAAL;CAFqC,GAFvC;CAMNsB,qBAAmBZ,WAAWa,GAAX,CAAe,iBAAS;CAC1C,OAAIC,MAAMC,UAAV,EAAs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,gBAAP,CAAwBlF,SAAxB;CACA,MAAI+F,iBAAJ,EAAuBA,kBAAkB/F,SAAlB;CACvB,EAHD;;CAKA;CACAwF,gCAA+BS,MAA/B,CAAsCR,MAAtC;;CAEA,QAAO,YAAM;CACZE,iBAAQC,UAAR,GAAqBF,cAArB;CACAC,iBAAQG,WAAR,GAAsBD,eAAtB;CACAF,iBAAQK,aAAR,GAAwBD,iBAAxB;CACA,EAJD;CAKA;;CCxYDR;;;;"}
@@ -0,0 +1,395 @@
1
+ /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
2
+
3
+ import { options } from 'preact';
4
+
5
+ // Internal helpers from preact
6
+ import { ATTR_KEY } from '../src/constants';
7
+
8
+ /**
9
+ * Return a ReactElement-compatible object for the current state of a preact
10
+ * component.
11
+ */
12
+ function createReactElement(component) {
13
+ return {
14
+ type: component.constructor,
15
+ key: component.key,
16
+ ref: null, // Unsupported
17
+ props: component.props
18
+ };
19
+ }
20
+
21
+ /**
22
+ * Create a ReactDOMComponent-compatible object for a given DOM node rendered
23
+ * by preact.
24
+ *
25
+ * This implements the subset of the ReactDOMComponent interface that
26
+ * React DevTools requires in order to display DOM nodes in the inspector with
27
+ * the correct type and properties.
28
+ *
29
+ * @param {Node} node
30
+ */
31
+ function createReactDOMComponent(node) {
32
+ const childNodes = node.nodeType === Node.ELEMENT_NODE ?
33
+ Array.from(node.childNodes) : [];
34
+
35
+ const isText = node.nodeType === Node.TEXT_NODE;
36
+
37
+ return {
38
+ // --- ReactDOMComponent interface
39
+ _currentElement: isText ? node.textContent : {
40
+ type: node.nodeName.toLowerCase(),
41
+ props: node[ATTR_KEY]
42
+ },
43
+ _renderedChildren: childNodes.map(child => {
44
+ if (child._component) {
45
+ return updateReactComponent(child._component);
46
+ }
47
+ return updateReactComponent(child);
48
+ }),
49
+ _stringText: isText ? node.textContent : null,
50
+
51
+ // --- Additional properties used by preact devtools
52
+
53
+ // A flag indicating whether the devtools have been notified about the
54
+ // existence of this component instance yet.
55
+ // This is used to send the appropriate notifications when DOM components
56
+ // are added or updated between composite component updates.
57
+ _inDevTools: false,
58
+ node
59
+ };
60
+ }
61
+
62
+ /**
63
+ * Return the name of a component created by a `ReactElement`-like object.
64
+ *
65
+ * @param {ReactElement} element
66
+ */
67
+ function typeName(element) {
68
+ if (typeof element.type === 'function') {
69
+ return element.type.displayName || element.type.name;
70
+ }
71
+ return element.type;
72
+ }
73
+
74
+ /**
75
+ * Return a ReactCompositeComponent-compatible object for a given preact
76
+ * component instance.
77
+ *
78
+ * This implements the subset of the ReactCompositeComponent interface that
79
+ * the DevTools requires in order to walk the component tree and inspect the
80
+ * component's properties.
81
+ *
82
+ * See https://github.com/facebook/react-devtools/blob/e31ec5825342eda570acfc9bcb43a44258fceb28/backend/getData.js
83
+ */
84
+ function createReactCompositeComponent(component) {
85
+ const _currentElement = createReactElement(component);
86
+ const node = component.base;
87
+
88
+ let instance = {
89
+ // --- ReactDOMComponent properties
90
+ getName() {
91
+ return typeName(_currentElement);
92
+ },
93
+ _currentElement: createReactElement(component),
94
+ props: component.props,
95
+ state: component.state,
96
+ forceUpdate: component.forceUpdate && component.forceUpdate.bind(component),
97
+ setState: component.setState && component.setState.bind(component),
98
+
99
+ // --- Additional properties used by preact devtools
100
+ node
101
+ };
102
+
103
+ // React DevTools exposes the `_instance` field of the selected item in the
104
+ // component tree as `$r` in the console. `_instance` must refer to a
105
+ // React Component (or compatible) class instance with `props` and `state`
106
+ // fields and `setState()`, `forceUpdate()` methods.
107
+ instance._instance = component;
108
+
109
+ // If the root node returned by this component instance's render function
110
+ // was itself a composite component, there will be a `_component` property
111
+ // containing the child component instance.
112
+ if (component._component) {
113
+ instance._renderedComponent = updateReactComponent(component._component);
114
+ } else {
115
+ // Otherwise, if the render() function returned an HTML/SVG element,
116
+ // create a ReactDOMComponent-like object for the DOM node itself.
117
+ instance._renderedComponent = updateReactComponent(node);
118
+ }
119
+
120
+ return instance;
121
+ }
122
+
123
+ /**
124
+ * Map of Component|Node to ReactDOMComponent|ReactCompositeComponent-like
125
+ * object.
126
+ *
127
+ * The same React*Component instance must be used when notifying devtools
128
+ * about the initial mount of a component and subsequent updates.
129
+ */
130
+ let instanceMap = typeof Map==='function' && new Map();
131
+
132
+ /**
133
+ * Update (and create if necessary) the ReactDOMComponent|ReactCompositeComponent-like
134
+ * instance for a given preact component instance or DOM Node.
135
+ *
136
+ * @param {Component|Node} componentOrNode
137
+ */
138
+ function updateReactComponent(componentOrNode) {
139
+ const newInstance = componentOrNode instanceof Node ?
140
+ createReactDOMComponent(componentOrNode) :
141
+ createReactCompositeComponent(componentOrNode);
142
+ if (instanceMap.has(componentOrNode)) {
143
+ let inst = instanceMap.get(componentOrNode);
144
+ Object.assign(inst, newInstance);
145
+ return inst;
146
+ }
147
+ instanceMap.set(componentOrNode, newInstance);
148
+ return newInstance;
149
+ }
150
+
151
+ function nextRootKey(roots) {
152
+ return '.' + Object.keys(roots).length;
153
+ }
154
+
155
+ /**
156
+ * Find all root component instances rendered by preact in `node`'s children
157
+ * and add them to the `roots` map.
158
+ *
159
+ * @param {DOMElement} node
160
+ * @param {[key: string] => ReactDOMComponent|ReactCompositeComponent}
161
+ */
162
+ function findRoots(node, roots) {
163
+ Array.from(node.childNodes).forEach(child => {
164
+ if (child._component) {
165
+ roots[nextRootKey(roots)] = updateReactComponent(child._component);
166
+ } else {
167
+ findRoots(child, roots);
168
+ }
169
+ });
170
+ }
171
+
172
+ /**
173
+ * Create a bridge for exposing preact's component tree to React DevTools.
174
+ *
175
+ * It creates implementations of the interfaces that ReactDOM passes to
176
+ * devtools to enable it to query the component tree and hook into component
177
+ * updates.
178
+ *
179
+ * See https://github.com/facebook/react/blob/59ff7749eda0cd858d5ee568315bcba1be75a1ca/src/renderers/dom/ReactDOM.js
180
+ * for how ReactDOM exports its internals for use by the devtools and
181
+ * the `attachRenderer()` function in
182
+ * https://github.com/facebook/react-devtools/blob/e31ec5825342eda570acfc9bcb43a44258fceb28/backend/attachRenderer.js
183
+ * for how the devtools consumes the resulting objects.
184
+ */
185
+ function createDevToolsBridge() {
186
+ // The devtools has different paths for interacting with the renderers from
187
+ // React Native, legacy React DOM and current React DOM.
188
+ //
189
+ // Here we emulate the interface for the current React DOM (v15+) lib.
190
+
191
+ // ReactDOMComponentTree-like object
192
+ const ComponentTree = {
193
+ getNodeFromInstance(instance) {
194
+ return instance.node;
195
+ },
196
+ getClosestInstanceFromNode(node) {
197
+ while (node && !node._component) {
198
+ node = node.parentNode;
199
+ }
200
+ return node ? updateReactComponent(node._component) : null;
201
+ }
202
+ };
203
+
204
+ // Map of root ID (the ID is unimportant) to component instance.
205
+ let roots = {};
206
+ findRoots(document.body, roots);
207
+
208
+ // ReactMount-like object
209
+ //
210
+ // Used by devtools to discover the list of root component instances and get
211
+ // notified when new root components are rendered.
212
+ const Mount = {
213
+ _instancesByReactRootID: roots,
214
+
215
+ // Stub - React DevTools expects to find this method and replace it
216
+ // with a wrapper in order to observe new root components being added
217
+ _renderNewRootComponent(/* instance, ... */) { }
218
+ };
219
+
220
+ // ReactReconciler-like object
221
+ const Reconciler = {
222
+ // Stubs - React DevTools expects to find these methods and replace them
223
+ // with wrappers in order to observe components being mounted, updated and
224
+ // unmounted
225
+ mountComponent(/* instance, ... */) { },
226
+ performUpdateIfNecessary(/* instance, ... */) { },
227
+ receiveComponent(/* instance, ... */) { },
228
+ unmountComponent(/* instance, ... */) { }
229
+ };
230
+
231
+ /** Notify devtools that a new component instance has been mounted into the DOM. */
232
+ const componentAdded = component => {
233
+ const instance = updateReactComponent(component);
234
+ if (isRootComponent(component)) {
235
+ instance._rootID = nextRootKey(roots);
236
+ roots[instance._rootID] = instance;
237
+ Mount._renderNewRootComponent(instance);
238
+ }
239
+ visitNonCompositeChildren(instance, childInst => {
240
+ childInst._inDevTools = true;
241
+ Reconciler.mountComponent(childInst);
242
+ });
243
+ Reconciler.mountComponent(instance);
244
+ };
245
+
246
+ /** Notify devtools that a component has been updated with new props/state. */
247
+ const componentUpdated = component => {
248
+ const prevRenderedChildren = [];
249
+ let instance = instanceMap.get(component);
250
+ if (instance) {
251
+ visitNonCompositeChildren(instance, childInst => {
252
+ prevRenderedChildren.push(childInst);
253
+ });
254
+ }
255
+ // Notify devtools about updates to this component and any non-composite
256
+ // children
257
+ instance = updateReactComponent(component);
258
+
259
+ Reconciler.receiveComponent(instance);
260
+ visitNonCompositeChildren(instance, childInst => {
261
+ if (!childInst._inDevTools) {
262
+ // New DOM child component
263
+ childInst._inDevTools = true;
264
+ Reconciler.mountComponent(childInst);
265
+ } else {
266
+ // Updated DOM child component
267
+ Reconciler.receiveComponent(childInst);
268
+ }
269
+ });
270
+
271
+ // For any non-composite children that were removed by the latest render,
272
+ // remove the corresponding ReactDOMComponent-like instances and notify
273
+ // the devtools
274
+ prevRenderedChildren.forEach(childInst => {
275
+ if (!document.body.contains(childInst.node)) {
276
+ instanceMap.delete(childInst.node);
277
+ Reconciler.unmountComponent(childInst);
278
+ }
279
+ });
280
+ };
281
+
282
+ /** Notify devtools that a component has been unmounted from the DOM. */
283
+ const componentRemoved = component => {
284
+ const instance = updateReactComponent(component);
285
+ visitNonCompositeChildren(childInst => {
286
+ instanceMap.delete(childInst.node);
287
+ Reconciler.unmountComponent(childInst);
288
+ });
289
+ Reconciler.unmountComponent(instance);
290
+ instanceMap.delete(component);
291
+ if (instance._rootID) {
292
+ delete roots[instance._rootID];
293
+ }
294
+ };
295
+
296
+ return {
297
+ componentAdded,
298
+ componentUpdated,
299
+ componentRemoved,
300
+
301
+ // Interfaces passed to devtools via __REACT_DEVTOOLS_GLOBAL_HOOK__.inject()
302
+ ComponentTree,
303
+ Mount,
304
+ Reconciler
305
+ };
306
+ }
307
+
308
+ /**
309
+ * Return `true` if a preact component is a top level component rendered by
310
+ * `render()` into a container Element.
311
+ */
312
+ function isRootComponent(component) {
313
+ // `_parentComponent` is actually `__u` after minification
314
+ if (component._parentComponent || component.__u) {
315
+ // Component with a composite parent
316
+ return false;
317
+ }
318
+ if (component.base.parentElement && component.base.parentElement[ATTR_KEY]) {
319
+ // Component with a parent DOM element rendered by Preact
320
+ return false;
321
+ }
322
+ return true;
323
+ }
324
+
325
+ /**
326
+ * Visit all child instances of a ReactCompositeComponent-like object that are
327
+ * not composite components (ie. they represent DOM elements or text)
328
+ *
329
+ * @param {Component} component
330
+ * @param {(Component) => void} visitor
331
+ */
332
+ function visitNonCompositeChildren(component, visitor) {
333
+ if (!component) return;
334
+ if (component._renderedComponent) {
335
+ if (!component._renderedComponent._component) {
336
+ visitor(component._renderedComponent);
337
+ visitNonCompositeChildren(component._renderedComponent, visitor);
338
+ }
339
+ } else if (component._renderedChildren) {
340
+ component._renderedChildren.forEach(child => {
341
+ visitor(child);
342
+ if (!child._component) visitNonCompositeChildren(child, visitor);
343
+ });
344
+ }
345
+ }
346
+
347
+ /**
348
+ * Create a bridge between the preact component tree and React's dev tools
349
+ * and register it.
350
+ *
351
+ * After this function is called, the React Dev Tools should be able to detect
352
+ * "React" on the page and show the component tree.
353
+ *
354
+ * This function hooks into preact VNode creation in order to expose functional
355
+ * components correctly, so it should be called before the root component(s)
356
+ * are rendered.
357
+ *
358
+ * Returns a cleanup function which unregisters the hooks.
359
+ */
360
+ export function initDevTools() {
361
+ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
362
+ // React DevTools are not installed
363
+ return;
364
+ }
365
+
366
+ // Notify devtools when preact components are mounted, updated or unmounted
367
+ const bridge = createDevToolsBridge();
368
+
369
+ const nextAfterMount = options.afterMount;
370
+ options.afterMount = component => {
371
+ bridge.componentAdded(component);
372
+ if (nextAfterMount) nextAfterMount(component);
373
+ };
374
+
375
+ const nextAfterUpdate = options.afterUpdate;
376
+ options.afterUpdate = component => {
377
+ bridge.componentUpdated(component);
378
+ if (nextAfterUpdate) nextAfterUpdate(component);
379
+ };
380
+
381
+ const nextBeforeUnmount = options.beforeUnmount;
382
+ options.beforeUnmount = component => {
383
+ bridge.componentRemoved(component);
384
+ if (nextBeforeUnmount) nextBeforeUnmount(component);
385
+ };
386
+
387
+ // Notify devtools about this instance of "React"
388
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.inject(bridge);
389
+
390
+ return () => {
391
+ options.afterMount = nextAfterMount;
392
+ options.afterUpdate = nextAfterUpdate;
393
+ options.beforeUnmount = nextBeforeUnmount;
394
+ };
395
+ }
@@ -0,0 +1,4 @@
1
+ import { initDevTools } from './devtools';
2
+
3
+ initDevTools();
4
+
@@ -0,0 +1,891 @@
1
+ export = preact;
2
+ export as namespace preact;
3
+
4
+ declare namespace preact {
5
+ type Key = string | number;
6
+ type Ref<T> = (instance: T) => void;
7
+ type ComponentChild = VNode<any> | string | number | null;
8
+ type ComponentChildren = ComponentChild[] | ComponentChild | object | string | number | null;
9
+
10
+ /**
11
+ * @deprecated
12
+ *
13
+ * Use Attributes instead
14
+ */
15
+ type ComponentProps = Attributes;
16
+
17
+ /**
18
+ * @deprecated
19
+ *
20
+ * Use ClassAttributes instead
21
+ */
22
+ type PreactHTMLAttributes = ClassAttributes<any>;
23
+
24
+ interface Attributes {
25
+ key?: string | number | any;
26
+ jsx?: boolean;
27
+ }
28
+
29
+ interface ClassAttributes<T> extends Attributes {
30
+ ref?: Ref<T>;
31
+ }
32
+
33
+ interface PreactDOMAttributes {
34
+ children?: ComponentChildren;
35
+ dangerouslySetInnerHTML?: {
36
+ __html: string;
37
+ };
38
+ }
39
+
40
+ type ComponentFactory<P> = ComponentConstructor<P> | FunctionalComponent<P>;
41
+ /**
42
+ * Define the contract for a virtual node in preact.
43
+ *
44
+ * A virtual node has a name, a map of attributes, an array
45
+ * of child {VNode}s and a key. The key is used by preact for
46
+ * internal purposes.
47
+ */
48
+ interface VNode<P = any> {
49
+ nodeName: ComponentFactory<P> | string;
50
+ attributes: P;
51
+ children: Array<VNode<any> | string>;
52
+ key?: Key | null;
53
+ }
54
+
55
+ type RenderableProps<P, RefType = any> = Readonly<
56
+ P & Attributes & { children?: ComponentChildren; ref?: Ref<RefType> }
57
+ >;
58
+
59
+ interface FunctionalComponent<P = {}> {
60
+ (props: RenderableProps<P>, context?: any): VNode<any> | null;
61
+ displayName?: string;
62
+ defaultProps?: Partial<P>;
63
+ }
64
+
65
+ interface ComponentConstructor<P = {}, S = {}> {
66
+ new (props: P, context?: any): Component<P, S>;
67
+ displayName?: string;
68
+ defaultProps?: Partial<P>;
69
+ }
70
+
71
+ // Type alias for a component considered generally, whether stateless or stateful.
72
+ type AnyComponent<P = {}, S = {}> = FunctionalComponent<P> | Component<P, S>;
73
+
74
+ interface Component<P = {}, S = {}> {
75
+ componentWillMount?(): void;
76
+ componentDidMount?(): void;
77
+ componentWillUnmount?(): void;
78
+ getChildContext?(): object;
79
+ componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
80
+ shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): boolean;
81
+ componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void;
82
+ componentDidUpdate?(previousProps: Readonly<P>, previousState: Readonly<S>, previousContext: any): void;
83
+ }
84
+
85
+ abstract class Component<P, S> {
86
+ constructor(props?: P, context?: any);
87
+
88
+ static displayName?: string;
89
+ static defaultProps?: any;
90
+
91
+ state: Readonly<S>;
92
+ props: RenderableProps<P>;
93
+ context: any;
94
+ base?: HTMLElement;
95
+
96
+ setState<K extends keyof S>(state: Pick<S, K>, callback?: () => void): void;
97
+ setState<K extends keyof S>(fn: (prevState: S, props: P) => Pick<S, K>, callback?: () => void): void;
98
+
99
+ forceUpdate(callback?: () => void): void;
100
+
101
+ abstract render(props?: RenderableProps<P>, state?: Readonly<S>, context?: any): ComponentChild;
102
+ }
103
+
104
+ function h<P>(
105
+ node: ComponentFactory<P>,
106
+ params: Attributes & P | null,
107
+ ...children: ComponentChildren[]
108
+ ): VNode<any>;
109
+ function h(
110
+ node: string,
111
+ params: JSX.HTMLAttributes & JSX.SVGAttributes & Record<string, any> | null,
112
+ ...children: ComponentChildren[]
113
+ ): VNode<any>;
114
+
115
+ function render(node: ComponentChild, parent: Element | Document | ShadowRoot | DocumentFragment, mergeWith?: Element): Element;
116
+ function rerender(): void;
117
+ function cloneElement(element: JSX.Element, props: any): JSX.Element;
118
+
119
+ var options: {
120
+ syncComponentUpdates?: boolean;
121
+ debounceRendering?: (render: () => void) => void;
122
+ vnode?: (vnode: VNode<any>) => void;
123
+ event?: (event: Event) => Event;
124
+ };
125
+ }
126
+
127
+ declare global {
128
+ namespace JSX {
129
+ interface Element extends preact.VNode<any> {
130
+ }
131
+
132
+ interface ElementClass extends preact.Component<any, any> {
133
+ }
134
+
135
+ interface ElementAttributesProperty {
136
+ props: any;
137
+ }
138
+
139
+ interface ElementChildrenAttribute {
140
+ children: any;
141
+ }
142
+
143
+ interface SVGAttributes extends HTMLAttributes {
144
+ accentHeight?: number | string;
145
+ accumulate?: "none" | "sum";
146
+ additive?: "replace" | "sum";
147
+ alignmentBaseline?: "auto" | "baseline" | "before-edge" | "text-before-edge" | "middle" | "central" | "after-edge" | "text-after-edge" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "inherit";
148
+ allowReorder?: "no" | "yes";
149
+ alphabetic?: number | string;
150
+ amplitude?: number | string;
151
+ arabicForm?: "initial" | "medial" | "terminal" | "isolated";
152
+ ascent?: number | string;
153
+ attributeName?: string;
154
+ attributeType?: string;
155
+ autoReverse?: number | string;
156
+ azimuth?: number | string;
157
+ baseFrequency?: number | string;
158
+ baselineShift?: number | string;
159
+ baseProfile?: number | string;
160
+ bbox?: number | string;
161
+ begin?: number | string;
162
+ bias?: number | string;
163
+ by?: number | string;
164
+ calcMode?: number | string;
165
+ capHeight?: number | string;
166
+ clip?: number | string;
167
+ clipPath?: string;
168
+ clipPathUnits?: number | string;
169
+ clipRule?: number | string;
170
+ colorInterpolation?: number | string;
171
+ colorInterpolationFilters?: "auto" | "sRGB" | "linearRGB" | "inherit";
172
+ colorProfile?: number | string;
173
+ colorRendering?: number | string;
174
+ contentScriptType?: number | string;
175
+ contentStyleType?: number | string;
176
+ cursor?: number | string;
177
+ cx?: number | string;
178
+ cy?: number | string;
179
+ d?: string;
180
+ decelerate?: number | string;
181
+ descent?: number | string;
182
+ diffuseConstant?: number | string;
183
+ direction?: number | string;
184
+ display?: number | string;
185
+ divisor?: number | string;
186
+ dominantBaseline?: number | string;
187
+ dur?: number | string;
188
+ dx?: number | string;
189
+ dy?: number | string;
190
+ edgeMode?: number | string;
191
+ elevation?: number | string;
192
+ enableBackground?: number | string;
193
+ end?: number | string;
194
+ exponent?: number | string;
195
+ externalResourcesRequired?: number | string;
196
+ fill?: string;
197
+ fillOpacity?: number | string;
198
+ fillRule?: "nonzero" | "evenodd" | "inherit";
199
+ filter?: string;
200
+ filterRes?: number | string;
201
+ filterUnits?: number | string;
202
+ floodColor?: number | string;
203
+ floodOpacity?: number | string;
204
+ focusable?: number | string;
205
+ fontFamily?: string;
206
+ fontSize?: number | string;
207
+ fontSizeAdjust?: number | string;
208
+ fontStretch?: number | string;
209
+ fontStyle?: number | string;
210
+ fontVariant?: number | string;
211
+ fontWeight?: number | string;
212
+ format?: number | string;
213
+ from?: number | string;
214
+ fx?: number | string;
215
+ fy?: number | string;
216
+ g1?: number | string;
217
+ g2?: number | string;
218
+ glyphName?: number | string;
219
+ glyphOrientationHorizontal?: number | string;
220
+ glyphOrientationVertical?: number | string;
221
+ glyphRef?: number | string;
222
+ gradientTransform?: string;
223
+ gradientUnits?: string;
224
+ hanging?: number | string;
225
+ horizAdvX?: number | string;
226
+ horizOriginX?: number | string;
227
+ ideographic?: number | string;
228
+ imageRendering?: number | string;
229
+ in2?: number | string;
230
+ in?: string;
231
+ intercept?: number | string;
232
+ k1?: number | string;
233
+ k2?: number | string;
234
+ k3?: number | string;
235
+ k4?: number | string;
236
+ k?: number | string;
237
+ kernelMatrix?: number | string;
238
+ kernelUnitLength?: number | string;
239
+ kerning?: number | string;
240
+ keyPoints?: number | string;
241
+ keySplines?: number | string;
242
+ keyTimes?: number | string;
243
+ lengthAdjust?: number | string;
244
+ letterSpacing?: number | string;
245
+ lightingColor?: number | string;
246
+ limitingConeAngle?: number | string;
247
+ local?: number | string;
248
+ markerEnd?: string;
249
+ markerHeight?: number | string;
250
+ markerMid?: string;
251
+ markerStart?: string;
252
+ markerUnits?: number | string;
253
+ markerWidth?: number | string;
254
+ mask?: string;
255
+ maskContentUnits?: number | string;
256
+ maskUnits?: number | string;
257
+ mathematical?: number | string;
258
+ mode?: number | string;
259
+ numOctaves?: number | string;
260
+ offset?: number | string;
261
+ opacity?: number | string;
262
+ operator?: number | string;
263
+ order?: number | string;
264
+ orient?: number | string;
265
+ orientation?: number | string;
266
+ origin?: number | string;
267
+ overflow?: number | string;
268
+ overlinePosition?: number | string;
269
+ overlineThickness?: number | string;
270
+ paintOrder?: number | string;
271
+ panose1?: number | string;
272
+ pathLength?: number | string;
273
+ patternContentUnits?: string;
274
+ patternTransform?: number | string;
275
+ patternUnits?: string;
276
+ pointerEvents?: number | string;
277
+ points?: string;
278
+ pointsAtX?: number | string;
279
+ pointsAtY?: number | string;
280
+ pointsAtZ?: number | string;
281
+ preserveAlpha?: number | string;
282
+ preserveAspectRatio?: string;
283
+ primitiveUnits?: number | string;
284
+ r?: number | string;
285
+ radius?: number | string;
286
+ refX?: number | string;
287
+ refY?: number | string;
288
+ renderingIntent?: number | string;
289
+ repeatCount?: number | string;
290
+ repeatDur?: number | string;
291
+ requiredExtensions?: number | string;
292
+ requiredFeatures?: number | string;
293
+ restart?: number | string;
294
+ result?: string;
295
+ rotate?: number | string;
296
+ rx?: number | string;
297
+ ry?: number | string;
298
+ scale?: number | string;
299
+ seed?: number | string;
300
+ shapeRendering?: number | string;
301
+ slope?: number | string;
302
+ spacing?: number | string;
303
+ specularConstant?: number | string;
304
+ specularExponent?: number | string;
305
+ speed?: number | string;
306
+ spreadMethod?: string;
307
+ startOffset?: number | string;
308
+ stdDeviation?: number | string;
309
+ stemh?: number | string;
310
+ stemv?: number | string;
311
+ stitchTiles?: number | string;
312
+ stopColor?: string;
313
+ stopOpacity?: number | string;
314
+ strikethroughPosition?: number | string;
315
+ strikethroughThickness?: number | string;
316
+ string?: number | string;
317
+ stroke?: string;
318
+ strokeDasharray?: string | number;
319
+ strokeDashoffset?: string | number;
320
+ strokeLinecap?: "butt" | "round" | "square" | "inherit";
321
+ strokeLinejoin?: "miter" | "round" | "bevel" | "inherit";
322
+ strokeMiterlimit?: string;
323
+ strokeOpacity?: number | string;
324
+ strokeWidth?: number | string;
325
+ surfaceScale?: number | string;
326
+ systemLanguage?: number | string;
327
+ tableValues?: number | string;
328
+ targetX?: number | string;
329
+ targetY?: number | string;
330
+ textAnchor?: string;
331
+ textDecoration?: number | string;
332
+ textLength?: number | string;
333
+ textRendering?: number | string;
334
+ to?: number | string;
335
+ transform?: string;
336
+ u1?: number | string;
337
+ u2?: number | string;
338
+ underlinePosition?: number | string;
339
+ underlineThickness?: number | string;
340
+ unicode?: number | string;
341
+ unicodeBidi?: number | string;
342
+ unicodeRange?: number | string;
343
+ unitsPerEm?: number | string;
344
+ vAlphabetic?: number | string;
345
+ values?: string;
346
+ vectorEffect?: number | string;
347
+ version?: string;
348
+ vertAdvY?: number | string;
349
+ vertOriginX?: number | string;
350
+ vertOriginY?: number | string;
351
+ vHanging?: number | string;
352
+ vIdeographic?: number | string;
353
+ viewBox?: string;
354
+ viewTarget?: number | string;
355
+ visibility?: number | string;
356
+ vMathematical?: number | string;
357
+ widths?: number | string;
358
+ wordSpacing?: number | string;
359
+ writingMode?: number | string;
360
+ x1?: number | string;
361
+ x2?: number | string;
362
+ x?: number | string;
363
+ xChannelSelector?: string;
364
+ xHeight?: number | string;
365
+ xlinkActuate?: string;
366
+ xlinkArcrole?: string;
367
+ xlinkHref?: string;
368
+ xlinkRole?: string;
369
+ xlinkShow?: string;
370
+ xlinkTitle?: string;
371
+ xlinkType?: string;
372
+ xmlBase?: string;
373
+ xmlLang?: string;
374
+ xmlns?: string;
375
+ xmlnsXlink?: string;
376
+ xmlSpace?: string;
377
+ y1?: number | string;
378
+ y2?: number | string;
379
+ y?: number | string;
380
+ yChannelSelector?: string;
381
+ z?: number | string;
382
+ zoomAndPan?: string;
383
+ }
384
+
385
+ interface PathAttributes {
386
+ d: string;
387
+ }
388
+
389
+ interface EventHandler<E extends Event> {
390
+ (event: E): void;
391
+ }
392
+
393
+ type ClipboardEventHandler = EventHandler<ClipboardEvent>;
394
+ type CompositionEventHandler = EventHandler<CompositionEvent>;
395
+ type DragEventHandler = EventHandler<DragEvent>;
396
+ type FocusEventHandler = EventHandler<FocusEvent>;
397
+ type KeyboardEventHandler = EventHandler<KeyboardEvent>;
398
+ type MouseEventHandler = EventHandler<MouseEvent>;
399
+ type TouchEventHandler = EventHandler<TouchEvent>;
400
+ type UIEventHandler = EventHandler<UIEvent>;
401
+ type WheelEventHandler = EventHandler<WheelEvent>;
402
+ type AnimationEventHandler = EventHandler<AnimationEvent>;
403
+ type TransitionEventHandler = EventHandler<TransitionEvent>;
404
+ type GenericEventHandler = EventHandler<Event>;
405
+ type PointerEventHandler = EventHandler<PointerEvent>;
406
+
407
+ interface DOMAttributes extends preact.PreactDOMAttributes {
408
+ // Image Events
409
+ onLoad?: GenericEventHandler;
410
+ onLoadCapture?: GenericEventHandler;
411
+
412
+ // Clipboard Events
413
+ onCopy?: ClipboardEventHandler;
414
+ onCopyCapture?: ClipboardEventHandler;
415
+ onCut?: ClipboardEventHandler;
416
+ onCutCapture?: ClipboardEventHandler;
417
+ onPaste?: ClipboardEventHandler;
418
+ onPasteCapture?: ClipboardEventHandler;
419
+
420
+ // Composition Events
421
+ onCompositionEnd?: CompositionEventHandler;
422
+ onCompositionEndCapture?: CompositionEventHandler;
423
+ onCompositionStart?: CompositionEventHandler;
424
+ onCompositionStartCapture?: CompositionEventHandler;
425
+ onCompositionUpdate?: CompositionEventHandler;
426
+ onCompositionUpdateCapture?: CompositionEventHandler;
427
+
428
+ // Focus Events
429
+ onFocus?: FocusEventHandler;
430
+ onFocusCapture?: FocusEventHandler;
431
+ onBlur?: FocusEventHandler;
432
+ onBlurCapture?: FocusEventHandler;
433
+
434
+ // Form Events
435
+ onChange?: GenericEventHandler;
436
+ onChangeCapture?: GenericEventHandler;
437
+ onInput?: GenericEventHandler;
438
+ onInputCapture?: GenericEventHandler;
439
+ onSearch?: GenericEventHandler;
440
+ onSearchCapture?: GenericEventHandler;
441
+ onSubmit?: GenericEventHandler;
442
+ onSubmitCapture?: GenericEventHandler;
443
+
444
+ // Keyboard Events
445
+ onKeyDown?: KeyboardEventHandler;
446
+ onKeyDownCapture?: KeyboardEventHandler;
447
+ onKeyPress?: KeyboardEventHandler;
448
+ onKeyPressCapture?: KeyboardEventHandler;
449
+ onKeyUp?: KeyboardEventHandler;
450
+ onKeyUpCapture?: KeyboardEventHandler;
451
+
452
+ // Media Events
453
+ onAbort?: GenericEventHandler;
454
+ onAbortCapture?: GenericEventHandler;
455
+ onCanPlay?: GenericEventHandler;
456
+ onCanPlayCapture?: GenericEventHandler;
457
+ onCanPlayThrough?: GenericEventHandler;
458
+ onCanPlayThroughCapture?: GenericEventHandler;
459
+ onDurationChange?: GenericEventHandler;
460
+ onDurationChangeCapture?: GenericEventHandler;
461
+ onEmptied?: GenericEventHandler;
462
+ onEmptiedCapture?: GenericEventHandler;
463
+ onEncrypted?: GenericEventHandler;
464
+ onEncryptedCapture?: GenericEventHandler;
465
+ onEnded?: GenericEventHandler;
466
+ onEndedCapture?: GenericEventHandler;
467
+ onLoadedData?: GenericEventHandler;
468
+ onLoadedDataCapture?: GenericEventHandler;
469
+ onLoadedMetadata?: GenericEventHandler;
470
+ onLoadedMetadataCapture?: GenericEventHandler;
471
+ onLoadStart?: GenericEventHandler;
472
+ onLoadStartCapture?: GenericEventHandler;
473
+ onPause?: GenericEventHandler;
474
+ onPauseCapture?: GenericEventHandler;
475
+ onPlay?: GenericEventHandler;
476
+ onPlayCapture?: GenericEventHandler;
477
+ onPlaying?: GenericEventHandler;
478
+ onPlayingCapture?: GenericEventHandler;
479
+ onProgress?: GenericEventHandler;
480
+ onProgressCapture?: GenericEventHandler;
481
+ onRateChange?: GenericEventHandler;
482
+ onRateChangeCapture?: GenericEventHandler;
483
+ onSeeked?: GenericEventHandler;
484
+ onSeekedCapture?: GenericEventHandler;
485
+ onSeeking?: GenericEventHandler;
486
+ onSeekingCapture?: GenericEventHandler;
487
+ onStalled?: GenericEventHandler;
488
+ onStalledCapture?: GenericEventHandler;
489
+ onSuspend?: GenericEventHandler;
490
+ onSuspendCapture?: GenericEventHandler;
491
+ onTimeUpdate?: GenericEventHandler;
492
+ onTimeUpdateCapture?: GenericEventHandler;
493
+ onVolumeChange?: GenericEventHandler;
494
+ onVolumeChangeCapture?: GenericEventHandler;
495
+ onWaiting?: GenericEventHandler;
496
+ onWaitingCapture?: GenericEventHandler;
497
+
498
+ // MouseEvents
499
+ onClick?: MouseEventHandler;
500
+ onClickCapture?: MouseEventHandler;
501
+ onContextMenu?: MouseEventHandler;
502
+ onContextMenuCapture?: MouseEventHandler;
503
+ onDblClick?: MouseEventHandler;
504
+ onDblClickCapture?: MouseEventHandler;
505
+ onDrag?: DragEventHandler;
506
+ onDragCapture?: DragEventHandler;
507
+ onDragEnd?: DragEventHandler;
508
+ onDragEndCapture?: DragEventHandler;
509
+ onDragEnter?: DragEventHandler;
510
+ onDragEnterCapture?: DragEventHandler;
511
+ onDragExit?: DragEventHandler;
512
+ onDragExitCapture?: DragEventHandler;
513
+ onDragLeave?: DragEventHandler;
514
+ onDragLeaveCapture?: DragEventHandler;
515
+ onDragOver?: DragEventHandler;
516
+ onDragOverCapture?: DragEventHandler;
517
+ onDragStart?: DragEventHandler;
518
+ onDragStartCapture?: DragEventHandler;
519
+ onDrop?: DragEventHandler;
520
+ onDropCapture?: DragEventHandler;
521
+ onMouseDown?: MouseEventHandler;
522
+ onMouseDownCapture?: MouseEventHandler;
523
+ onMouseEnter?: MouseEventHandler;
524
+ onMouseEnterCapture?: MouseEventHandler;
525
+ onMouseLeave?: MouseEventHandler;
526
+ onMouseLeaveCapture?: MouseEventHandler;
527
+ onMouseMove?: MouseEventHandler;
528
+ onMouseMoveCapture?: MouseEventHandler;
529
+ onMouseOut?: MouseEventHandler;
530
+ onMouseOutCapture?: MouseEventHandler;
531
+ onMouseOver?: MouseEventHandler;
532
+ onMouseOverCapture?: MouseEventHandler;
533
+ onMouseUp?: MouseEventHandler;
534
+ onMouseUpCapture?: MouseEventHandler;
535
+
536
+ // Selection Events
537
+ onSelect?: GenericEventHandler;
538
+ onSelectCapture?: GenericEventHandler;
539
+
540
+ // Touch Events
541
+ onTouchCancel?: TouchEventHandler;
542
+ onTouchCancelCapture?: TouchEventHandler;
543
+ onTouchEnd?: TouchEventHandler;
544
+ onTouchEndCapture?: TouchEventHandler;
545
+ onTouchMove?: TouchEventHandler;
546
+ onTouchMoveCapture?: TouchEventHandler;
547
+ onTouchStart?: TouchEventHandler;
548
+ onTouchStartCapture?: TouchEventHandler;
549
+
550
+ // Pointer Events
551
+ onPointerOver?: PointerEventHandler;
552
+ onPointerOverCapture?: PointerEventHandler;
553
+ onPointerEnter?: PointerEventHandler;
554
+ onPointerEnterCapture?: PointerEventHandler;
555
+ onPointerDown?: PointerEventHandler;
556
+ onPointerDownCapture?: PointerEventHandler;
557
+ onPointerMove?: PointerEventHandler;
558
+ onPointerMoveCapture?: PointerEventHandler;
559
+ onPointerUp?: PointerEventHandler;
560
+ onPointerUpCapture?: PointerEventHandler;
561
+ onPointerCancel?: PointerEventHandler;
562
+ onPointerCancelCapture?: PointerEventHandler;
563
+ onPointerOut?: PointerEventHandler;
564
+ onPointerOutCapture?: PointerEventHandler;
565
+ onPointerLeave?: PointerEventHandler;
566
+ onPointerLeaveCapture?: PointerEventHandler;
567
+ onGotPointerCapture?: PointerEventHandler;
568
+ onGotPointerCaptureCapture?: PointerEventHandler;
569
+ onLostPointerCapture?: PointerEventHandler;
570
+ onLostPointerCaptureCapture?: PointerEventHandler;
571
+
572
+ // UI Events
573
+ onScroll?: UIEventHandler;
574
+ onScrollCapture?: UIEventHandler;
575
+
576
+ // Wheel Events
577
+ onWheel?: WheelEventHandler;
578
+ onWheelCapture?: WheelEventHandler;
579
+
580
+ // Animation Events
581
+ onAnimationStart?: AnimationEventHandler;
582
+ onAnimationStartCapture?: AnimationEventHandler;
583
+ onAnimationEnd?: AnimationEventHandler;
584
+ onAnimationEndCapture?: AnimationEventHandler;
585
+ onAnimationIteration?: AnimationEventHandler;
586
+ onAnimationIterationCapture?: AnimationEventHandler;
587
+
588
+ // Transition Events
589
+ onTransitionEnd?: TransitionEventHandler;
590
+ onTransitionEndCapture?: TransitionEventHandler;
591
+ }
592
+
593
+ interface HTMLAttributes extends preact.PreactHTMLAttributes, DOMAttributes {
594
+ // Standard HTML Attributes
595
+ accept?: string;
596
+ acceptCharset?: string;
597
+ accessKey?: string;
598
+ action?: string;
599
+ allowFullScreen?: boolean;
600
+ allowTransparency?: boolean;
601
+ alt?: string;
602
+ async?: boolean;
603
+ autocomplete?: string;
604
+ autofocus?: boolean;
605
+ autoPlay?: boolean;
606
+ capture?: boolean;
607
+ cellPadding?: number | string;
608
+ cellSpacing?: number | string;
609
+ charSet?: string;
610
+ challenge?: string;
611
+ checked?: boolean;
612
+ class?: string;
613
+ className?: string;
614
+ cols?: number;
615
+ colSpan?: number;
616
+ content?: string;
617
+ contentEditable?: boolean;
618
+ contextMenu?: string;
619
+ controls?: boolean;
620
+ controlsList?: string;
621
+ coords?: string;
622
+ crossOrigin?: string;
623
+ data?: string;
624
+ dateTime?: string;
625
+ default?: boolean;
626
+ defer?: boolean;
627
+ dir?: string;
628
+ disabled?: boolean;
629
+ download?: any;
630
+ draggable?: boolean;
631
+ encType?: string;
632
+ form?: string;
633
+ formAction?: string;
634
+ formEncType?: string;
635
+ formMethod?: string;
636
+ formNoValidate?: boolean;
637
+ formTarget?: string;
638
+ frameBorder?: number | string;
639
+ headers?: string;
640
+ height?: number | string;
641
+ hidden?: boolean;
642
+ high?: number;
643
+ href?: string;
644
+ hrefLang?: string;
645
+ for?: string;
646
+ httpEquiv?: string;
647
+ icon?: string;
648
+ id?: string;
649
+ inputMode?: string;
650
+ integrity?: string;
651
+ is?: string;
652
+ keyParams?: string;
653
+ keyType?: string;
654
+ kind?: string;
655
+ label?: string;
656
+ lang?: string;
657
+ list?: string;
658
+ loop?: boolean;
659
+ low?: number;
660
+ manifest?: string;
661
+ marginHeight?: number;
662
+ marginWidth?: number;
663
+ max?: number | string;
664
+ maxLength?: number;
665
+ media?: string;
666
+ mediaGroup?: string;
667
+ method?: string;
668
+ min?: number | string;
669
+ minLength?: number;
670
+ multiple?: boolean;
671
+ muted?: boolean;
672
+ name?: string;
673
+ noValidate?: boolean;
674
+ open?: boolean;
675
+ optimum?: number;
676
+ pattern?: string;
677
+ placeholder?: string;
678
+ playsInline?: boolean;
679
+ poster?: string;
680
+ preload?: string;
681
+ radioGroup?: string;
682
+ readOnly?: boolean;
683
+ rel?: string;
684
+ required?: boolean;
685
+ role?: string;
686
+ rows?: number;
687
+ rowSpan?: number;
688
+ sandbox?: string;
689
+ scope?: string;
690
+ scoped?: boolean;
691
+ scrolling?: string;
692
+ seamless?: boolean;
693
+ selected?: boolean;
694
+ shape?: string;
695
+ size?: number;
696
+ sizes?: string;
697
+ slot?: string;
698
+ span?: number;
699
+ spellcheck?: boolean;
700
+ src?: string;
701
+ srcset?: string;
702
+ srcDoc?: string;
703
+ srcLang?: string;
704
+ srcSet?: string;
705
+ start?: number;
706
+ step?: number | string;
707
+ style?: any;
708
+ summary?: string;
709
+ tabIndex?: number;
710
+ target?: string;
711
+ title?: string;
712
+ type?: string;
713
+ useMap?: string;
714
+ value?: string | string[] | number;
715
+ width?: number | string;
716
+ wmode?: string;
717
+ wrap?: string;
718
+
719
+ // RDFa Attributes
720
+ about?: string;
721
+ datatype?: string;
722
+ inlist?: any;
723
+ prefix?: string;
724
+ property?: string;
725
+ resource?: string;
726
+ typeof?: string;
727
+ vocab?: string;
728
+ }
729
+
730
+ interface IntrinsicElements {
731
+ // HTML
732
+ a: HTMLAttributes;
733
+ abbr: HTMLAttributes;
734
+ address: HTMLAttributes;
735
+ area: HTMLAttributes;
736
+ article: HTMLAttributes;
737
+ aside: HTMLAttributes;
738
+ audio: HTMLAttributes;
739
+ b: HTMLAttributes;
740
+ base: HTMLAttributes;
741
+ bdi: HTMLAttributes;
742
+ bdo: HTMLAttributes;
743
+ big: HTMLAttributes;
744
+ blockquote: HTMLAttributes;
745
+ body: HTMLAttributes;
746
+ br: HTMLAttributes;
747
+ button: HTMLAttributes;
748
+ canvas: HTMLAttributes;
749
+ caption: HTMLAttributes;
750
+ cite: HTMLAttributes;
751
+ code: HTMLAttributes;
752
+ col: HTMLAttributes;
753
+ colgroup: HTMLAttributes;
754
+ data: HTMLAttributes;
755
+ datalist: HTMLAttributes;
756
+ dd: HTMLAttributes;
757
+ del: HTMLAttributes;
758
+ details: HTMLAttributes;
759
+ dfn: HTMLAttributes;
760
+ dialog: HTMLAttributes;
761
+ div: HTMLAttributes;
762
+ dl: HTMLAttributes;
763
+ dt: HTMLAttributes;
764
+ em: HTMLAttributes;
765
+ embed: HTMLAttributes;
766
+ fieldset: HTMLAttributes;
767
+ figcaption: HTMLAttributes;
768
+ figure: HTMLAttributes;
769
+ footer: HTMLAttributes;
770
+ form: HTMLAttributes;
771
+ h1: HTMLAttributes;
772
+ h2: HTMLAttributes;
773
+ h3: HTMLAttributes;
774
+ h4: HTMLAttributes;
775
+ h5: HTMLAttributes;
776
+ h6: HTMLAttributes;
777
+ head: HTMLAttributes;
778
+ header: HTMLAttributes;
779
+ hr: HTMLAttributes;
780
+ html: HTMLAttributes;
781
+ i: HTMLAttributes;
782
+ iframe: HTMLAttributes;
783
+ img: HTMLAttributes;
784
+ input: HTMLAttributes;
785
+ ins: HTMLAttributes;
786
+ kbd: HTMLAttributes;
787
+ keygen: HTMLAttributes;
788
+ label: HTMLAttributes;
789
+ legend: HTMLAttributes;
790
+ li: HTMLAttributes;
791
+ link: HTMLAttributes;
792
+ main: HTMLAttributes;
793
+ map: HTMLAttributes;
794
+ mark: HTMLAttributes;
795
+ menu: HTMLAttributes;
796
+ menuitem: HTMLAttributes;
797
+ meta: HTMLAttributes;
798
+ meter: HTMLAttributes;
799
+ nav: HTMLAttributes;
800
+ noscript: HTMLAttributes;
801
+ object: HTMLAttributes;
802
+ ol: HTMLAttributes;
803
+ optgroup: HTMLAttributes;
804
+ option: HTMLAttributes;
805
+ output: HTMLAttributes;
806
+ p: HTMLAttributes;
807
+ param: HTMLAttributes;
808
+ picture: HTMLAttributes;
809
+ pre: HTMLAttributes;
810
+ progress: HTMLAttributes;
811
+ q: HTMLAttributes;
812
+ rp: HTMLAttributes;
813
+ rt: HTMLAttributes;
814
+ ruby: HTMLAttributes;
815
+ s: HTMLAttributes;
816
+ samp: HTMLAttributes;
817
+ script: HTMLAttributes;
818
+ section: HTMLAttributes;
819
+ select: HTMLAttributes;
820
+ slot: HTMLAttributes;
821
+ small: HTMLAttributes;
822
+ source: HTMLAttributes;
823
+ span: HTMLAttributes;
824
+ strong: HTMLAttributes;
825
+ style: HTMLAttributes;
826
+ sub: HTMLAttributes;
827
+ summary: HTMLAttributes;
828
+ sup: HTMLAttributes;
829
+ table: HTMLAttributes;
830
+ tbody: HTMLAttributes;
831
+ td: HTMLAttributes;
832
+ textarea: HTMLAttributes;
833
+ tfoot: HTMLAttributes;
834
+ th: HTMLAttributes;
835
+ thead: HTMLAttributes;
836
+ time: HTMLAttributes;
837
+ title: HTMLAttributes;
838
+ tr: HTMLAttributes;
839
+ track: HTMLAttributes;
840
+ u: HTMLAttributes;
841
+ ul: HTMLAttributes;
842
+ "var": HTMLAttributes;
843
+ video: HTMLAttributes;
844
+ wbr: HTMLAttributes;
845
+
846
+ //SVG
847
+ svg: SVGAttributes;
848
+ animate: SVGAttributes;
849
+ circle: SVGAttributes;
850
+ clipPath: SVGAttributes;
851
+ defs: SVGAttributes;
852
+ ellipse: SVGAttributes;
853
+ feBlend: SVGAttributes;
854
+ feColorMatrix: SVGAttributes;
855
+ feComponentTransfer: SVGAttributes;
856
+ feComposite: SVGAttributes;
857
+ feConvolveMatrix: SVGAttributes;
858
+ feDiffuseLighting: SVGAttributes;
859
+ feDisplacementMap: SVGAttributes;
860
+ feFlood: SVGAttributes;
861
+ feGaussianBlur: SVGAttributes;
862
+ feImage: SVGAttributes;
863
+ feMerge: SVGAttributes;
864
+ feMergeNode: SVGAttributes;
865
+ feMorphology: SVGAttributes;
866
+ feOffset: SVGAttributes;
867
+ feSpecularLighting: SVGAttributes;
868
+ feTile: SVGAttributes;
869
+ feTurbulence: SVGAttributes;
870
+ filter: SVGAttributes;
871
+ foreignObject: SVGAttributes;
872
+ g: SVGAttributes;
873
+ image: SVGAttributes;
874
+ line: SVGAttributes;
875
+ linearGradient: SVGAttributes;
876
+ marker: SVGAttributes;
877
+ mask: SVGAttributes;
878
+ path: SVGAttributes;
879
+ pattern: SVGAttributes;
880
+ polygon: SVGAttributes;
881
+ polyline: SVGAttributes;
882
+ radialGradient: SVGAttributes;
883
+ rect: SVGAttributes;
884
+ stop: SVGAttributes;
885
+ symbol: SVGAttributes;
886
+ text: SVGAttributes;
887
+ tspan: SVGAttributes;
888
+ use: SVGAttributes;
889
+ }
890
+ }
891
+ }