Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

shared.d.ts 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. /**
  2. * Make a map and return a function for checking if a key
  3. * is in that map.
  4. * IMPORTANT: all calls of this function must be prefixed with
  5. * \/\*#\_\_PURE\_\_\*\/
  6. * So that rollup can tree-shake them if necessary.
  7. */
  8. /*! #__NO_SIDE_EFFECTS__ */
  9. export declare function makeMap(str: string, expectsLowerCase?: boolean): (key: string) => boolean;
  10. export declare const EMPTY_OBJ: {
  11. readonly [key: string]: any;
  12. };
  13. export declare const EMPTY_ARR: readonly never[];
  14. export declare const NOOP: () => void;
  15. /**
  16. * Always return false.
  17. */
  18. export declare const NO: () => boolean;
  19. export declare const isOn: (key: string) => boolean;
  20. export declare const isModelListener: (key: string) => boolean;
  21. export declare const extend: {
  22. <T extends {}, U>(target: T, source: U): T & U;
  23. <T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
  24. <T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
  25. (target: object, ...sources: any[]): any;
  26. };
  27. export declare const remove: <T>(arr: T[], el: T) => void;
  28. export declare const hasOwn: (val: object, key: string | symbol) => key is never;
  29. export declare const isArray: (arg: any) => arg is any[];
  30. export declare const isMap: (val: unknown) => val is Map<any, any>;
  31. export declare const isSet: (val: unknown) => val is Set<any>;
  32. export declare const isDate: (val: unknown) => val is Date;
  33. export declare const isRegExp: (val: unknown) => val is RegExp;
  34. export declare const isFunction: (val: unknown) => val is Function;
  35. export declare const isString: (val: unknown) => val is string;
  36. export declare const isSymbol: (val: unknown) => val is symbol;
  37. export declare const isObject: (val: unknown) => val is Record<any, any>;
  38. export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
  39. export declare const objectToString: () => string;
  40. export declare const toTypeString: (value: unknown) => string;
  41. export declare const toRawType: (value: unknown) => string;
  42. export declare const isPlainObject: (val: unknown) => val is object;
  43. export declare const isIntegerKey: (key: unknown) => boolean;
  44. export declare const isReservedProp: (key: string) => boolean;
  45. export declare const isBuiltInDirective: (key: string) => boolean;
  46. /**
  47. * @private
  48. */
  49. export declare const camelize: (str: string) => string;
  50. /**
  51. * @private
  52. */
  53. export declare const hyphenate: (str: string) => string;
  54. /**
  55. * @private
  56. */
  57. export declare const capitalize: <T extends string>(str: T) => Capitalize<T>;
  58. /**
  59. * @private
  60. */
  61. export declare const toHandlerKey: <T extends string>(str: T) => T extends "" ? "" : `on${Capitalize<T>}`;
  62. export declare const hasChanged: (value: any, oldValue: any) => boolean;
  63. export declare const invokeArrayFns: (fns: Function[], ...arg: any[]) => void;
  64. export declare const def: (obj: object, key: string | symbol, value: any, writable?: boolean) => void;
  65. /**
  66. * "123-foo" will be parsed to 123
  67. * This is used for the .number modifier in v-model
  68. */
  69. export declare const looseToNumber: (val: any) => any;
  70. /**
  71. * Only concerns number-like strings
  72. * "123-foo" will be returned as-is
  73. */
  74. export declare const toNumber: (val: any) => any;
  75. export declare const getGlobalThis: () => any;
  76. export declare function genPropsAccessExp(name: string): string;
  77. /**
  78. * Patch flags are optimization hints generated by the compiler.
  79. * when a block with dynamicChildren is encountered during diff, the algorithm
  80. * enters "optimized mode". In this mode, we know that the vdom is produced by
  81. * a render function generated by the compiler, so the algorithm only needs to
  82. * handle updates explicitly marked by these patch flags.
  83. *
  84. * Patch flags can be combined using the | bitwise operator and can be checked
  85. * using the & operator, e.g.
  86. *
  87. * ```js
  88. * const flag = TEXT | CLASS
  89. * if (flag & TEXT) { ... }
  90. * ```
  91. *
  92. * Check the `patchElement` function in '../../runtime-core/src/renderer.ts' to see how the
  93. * flags are handled during diff.
  94. */
  95. export declare enum PatchFlags {
  96. /**
  97. * Indicates an element with dynamic textContent (children fast path)
  98. */
  99. TEXT = 1,
  100. /**
  101. * Indicates an element with dynamic class binding.
  102. */
  103. CLASS = 2,
  104. /**
  105. * Indicates an element with dynamic style
  106. * The compiler pre-compiles static string styles into static objects
  107. * + detects and hoists inline static objects
  108. * e.g. `style="color: red"` and `:style="{ color: 'red' }"` both get hoisted
  109. * as:
  110. * ```js
  111. * const style = { color: 'red' }
  112. * render() { return e('div', { style }) }
  113. * ```
  114. */
  115. STYLE = 4,
  116. /**
  117. * Indicates an element that has non-class/style dynamic props.
  118. * Can also be on a component that has any dynamic props (includes
  119. * class/style). when this flag is present, the vnode also has a dynamicProps
  120. * array that contains the keys of the props that may change so the runtime
  121. * can diff them faster (without having to worry about removed props)
  122. */
  123. PROPS = 8,
  124. /**
  125. * Indicates an element with props with dynamic keys. When keys change, a full
  126. * diff is always needed to remove the old key. This flag is mutually
  127. * exclusive with CLASS, STYLE and PROPS.
  128. */
  129. FULL_PROPS = 16,
  130. /**
  131. * Indicates an element that requires props hydration
  132. * (but not necessarily patching)
  133. * e.g. event listeners & v-bind with prop modifier
  134. */
  135. NEED_HYDRATION = 32,
  136. /**
  137. * Indicates a fragment whose children order doesn't change.
  138. */
  139. STABLE_FRAGMENT = 64,
  140. /**
  141. * Indicates a fragment with keyed or partially keyed children
  142. */
  143. KEYED_FRAGMENT = 128,
  144. /**
  145. * Indicates a fragment with unkeyed children.
  146. */
  147. UNKEYED_FRAGMENT = 256,
  148. /**
  149. * Indicates an element that only needs non-props patching, e.g. ref or
  150. * directives (onVnodeXXX hooks). since every patched vnode checks for refs
  151. * and onVnodeXXX hooks, it simply marks the vnode so that a parent block
  152. * will track it.
  153. */
  154. NEED_PATCH = 512,
  155. /**
  156. * Indicates a component with dynamic slots (e.g. slot that references a v-for
  157. * iterated value, or dynamic slot names).
  158. * Components with this flag are always force updated.
  159. */
  160. DYNAMIC_SLOTS = 1024,
  161. /**
  162. * Indicates a fragment that was created only because the user has placed
  163. * comments at the root level of a template. This is a dev-only flag since
  164. * comments are stripped in production.
  165. */
  166. DEV_ROOT_FRAGMENT = 2048,
  167. /**
  168. * SPECIAL FLAGS -------------------------------------------------------------
  169. * Special flags are negative integers. They are never matched against using
  170. * bitwise operators (bitwise matching should only happen in branches where
  171. * patchFlag > 0), and are mutually exclusive. When checking for a special
  172. * flag, simply check patchFlag === FLAG.
  173. */
  174. /**
  175. * Indicates a hoisted static vnode. This is a hint for hydration to skip
  176. * the entire sub tree since static content never needs to be updated.
  177. */
  178. HOISTED = -1,
  179. /**
  180. * A special flag that indicates that the diffing algorithm should bail out
  181. * of optimized mode. For example, on block fragments created by renderSlot()
  182. * when encountering non-compiler generated slots (i.e. manually written
  183. * render functions, which should always be fully diffed)
  184. * OR manually cloneVNodes
  185. */
  186. BAIL = -2
  187. }
  188. /**
  189. * dev only flag -> name mapping
  190. */
  191. export declare const PatchFlagNames: Record<PatchFlags, string>;
  192. export declare enum ShapeFlags {
  193. ELEMENT = 1,
  194. FUNCTIONAL_COMPONENT = 2,
  195. STATEFUL_COMPONENT = 4,
  196. TEXT_CHILDREN = 8,
  197. ARRAY_CHILDREN = 16,
  198. SLOTS_CHILDREN = 32,
  199. TELEPORT = 64,
  200. SUSPENSE = 128,
  201. COMPONENT_SHOULD_KEEP_ALIVE = 256,
  202. COMPONENT_KEPT_ALIVE = 512,
  203. COMPONENT = 6
  204. }
  205. export declare enum SlotFlags {
  206. /**
  207. * Stable slots that only reference slot props or context state. The slot
  208. * can fully capture its own dependencies so when passed down the parent won't
  209. * need to force the child to update.
  210. */
  211. STABLE = 1,
  212. /**
  213. * Slots that reference scope variables (v-for or an outer slot prop), or
  214. * has conditional structure (v-if, v-for). The parent will need to force
  215. * the child to update because the slot does not fully capture its dependencies.
  216. */
  217. DYNAMIC = 2,
  218. /**
  219. * `<slot/>` being forwarded into a child component. Whether the parent needs
  220. * to update the child is dependent on what kind of slots the parent itself
  221. * received. This has to be refined at runtime, when the child's vnode
  222. * is being created (in `normalizeChildren`)
  223. */
  224. FORWARDED = 3
  225. }
  226. /**
  227. * Dev only
  228. */
  229. export declare const slotFlagsText: {
  230. 1: string;
  231. 2: string;
  232. 3: string;
  233. };
  234. export declare const isGloballyAllowed: (key: string) => boolean;
  235. /** @deprecated use `isGloballyAllowed` instead */
  236. export declare const isGloballyWhitelisted: (key: string) => boolean;
  237. export declare function generateCodeFrame(source: string, start?: number, end?: number): string;
  238. export type NormalizedStyle = Record<string, string | number>;
  239. export declare function normalizeStyle(value: unknown): NormalizedStyle | string | undefined;
  240. export declare function parseStringStyle(cssText: string): NormalizedStyle;
  241. export declare function stringifyStyle(styles: NormalizedStyle | string | undefined): string;
  242. export declare function normalizeClass(value: unknown): string;
  243. export declare function normalizeProps(props: Record<string, any> | null): Record<string, any> | null;
  244. /**
  245. * Compiler only.
  246. * Do NOT use in runtime code paths unless behind `__DEV__` flag.
  247. */
  248. export declare const isHTMLTag: (key: string) => boolean;
  249. /**
  250. * Compiler only.
  251. * Do NOT use in runtime code paths unless behind `__DEV__` flag.
  252. */
  253. export declare const isSVGTag: (key: string) => boolean;
  254. /**
  255. * Compiler only.
  256. * Do NOT use in runtime code paths unless behind `__DEV__` flag.
  257. */
  258. export declare const isMathMLTag: (key: string) => boolean;
  259. /**
  260. * Compiler only.
  261. * Do NOT use in runtime code paths unless behind `__DEV__` flag.
  262. */
  263. export declare const isVoidTag: (key: string) => boolean;
  264. export declare const isSpecialBooleanAttr: (key: string) => boolean;
  265. /**
  266. * The full list is needed during SSR to produce the correct initial markup.
  267. */
  268. export declare const isBooleanAttr: (key: string) => boolean;
  269. /**
  270. * Boolean attributes should be included if the value is truthy or ''.
  271. * e.g. `<select multiple>` compiles to `{ multiple: '' }`
  272. */
  273. export declare function includeBooleanAttr(value: unknown): boolean;
  274. export declare function isSSRSafeAttrName(name: string): boolean;
  275. export declare const propsToAttrMap: Record<string, string | undefined>;
  276. /**
  277. * Known attributes, this is used for stringification of runtime static nodes
  278. * so that we don't stringify bindings that cannot be set from HTML.
  279. * Don't also forget to allow `data-*` and `aria-*`!
  280. * Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
  281. */
  282. export declare const isKnownHtmlAttr: (key: string) => boolean;
  283. /**
  284. * Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
  285. */
  286. export declare const isKnownSvgAttr: (key: string) => boolean;
  287. /**
  288. * Shared between server-renderer and runtime-core hydration logic
  289. */
  290. export declare function isRenderableAttrValue(value: unknown): boolean;
  291. export declare function escapeHtml(string: unknown): string;
  292. export declare function escapeHtmlComment(src: string): string;
  293. export declare function looseEqual(a: any, b: any): boolean;
  294. export declare function looseIndexOf(arr: any[], val: any): number;
  295. /**
  296. * For converting {{ interpolation }} values to displayed strings.
  297. * @private
  298. */
  299. export declare const toDisplayString: (val: unknown) => string;
  300. export type Prettify<T> = {
  301. [K in keyof T]: T[K];
  302. } & {};
  303. export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
  304. export type LooseRequired<T> = {
  305. [P in keyof (T & Required<T>)]: T[P];
  306. };
  307. export type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
  308. export type Awaited<T> = T extends null | undefined ? T : T extends object & {
  309. then(onfulfilled: infer F, ...args: infer _): any;
  310. } ? F extends (value: infer V, ...args: infer _) => any ? Awaited<V> : never : T;