{"_id":"@a-2-c-2-anpm/asperiores-vero-quas","name":"@a-2-c-2-anpm/asperiores-vero-quas","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@a-2-c-2-anpm/asperiores-vero-quas","version":"1.0.0","description":"[![Downloads][downloads-badge]][downloads] [![Size][size-badge]][size]","main":"index.js","scripts":{},"author":{"name":"a-2-c-2-a"},"license":"MIT","dependencies":{"@a-2-c-2-anpm/alias-ducimus-sit":"^1.0.0","@a-2-c-2-anpm/atque-nemo-accusantium":"^1.0.0","@a-2-c-2-anpm/distinctio-quibusdam-culpa":"^1.0.0","@a-2-c-2-anpm/eligendi-praesentium-hic":"^1.0.0","@a-2-c-2-anpm/enim-amet-voluptatem":"^1.0.0","@a-2-c-2-anpm/error-dolorem-a":"^1.0.0","@a-2-c-2-anpm/excepturi-natus-facere":"^1.0.0","@a-2-c-2-anpm/expedita-recusandae-aut":"^1.0.0","@a-2-c-2-anpm/fugit-impedit-quae":"^1.0.0","@a-2-c-2-anpm/hic-maiores-accusantium":"^1.0.0","@a-2-c-2-anpm/laborum-exercitationem-quis":"^1.0.0","@a-2-c-2-anpm/laudantium-dolor-perspiciatis":"^1.0.0","@a-2-c-2-anpm/maiores-quis-dignissimos":"^1.0.0","@a-2-c-2-anpm/nam-eaque-occaecati":"^1.0.0","@a-2-c-2-anpm/neque-culpa-culpa":"^1.0.0","@a-2-c-2-anpm/neque-iste-eum":"^1.0.0","@a-2-c-2-anpm/nobis-similique-magni":"^1.0.0","@a-2-c-2-anpm/officia-tempore-ipsa":"^1.0.0","@a-2-c-2-anpm/perferendis-qui-suscipit":"^1.0.0","@a-2-c-2-anpm/placeat-suscipit-cumque":"^1.0.0","@a-2-c-2-anpm/quo-quia-expedita":"^1.0.0","@a-2-c-2-anpm/quos-voluptates-excepturi":"^1.0.0","@a-2-c-2-anpm/saepe-praesentium-iusto":"^1.0.0","@a-2-c-2-anpm/sint-ipsa-atque":"^1.0.0","@a-2-c-2-anpm/vitae-ad-molestiae":"^1.0.0","@ajhgwdjnpm/quas-mollitia-aspernatur-reprehenderit":"^1.0.0","calculator-3rd":"^1.0.12","mi-dex-func-3":"^1.0.0","vnhat-button-component":"^1.0.0","vnhat-forminput-component":"^1.0.1"},"keywords":["gestures","guid","tester","Symbol.toStringTag","javascript","console","internal slot","es2015","higher-order","weakmap","globals","ECMAScript 2017","karma","wait","some","error","progress","file system","local","s3","aws","has-own","rate","Rx","dependencies","symbol","styled-components","fastcopy","function.length","util.inspect","core-js","URL","react-hook-form","linewrap","electron","sns","espree","YAML","vpc","japanese","tape","regular expressions","importexport","output","rapid","loading","a11y","omit","eslint","identifiers","ECMAScript 3","dataView","lazy","computed-types","stringifier","fork","client","data","simpledb","find","invariant","uninstall","jsdom","concurrency","[[Prototype]]","forEach","react-hooks","coercible","wget","commander","phone","efficient","typed","redux","runtime","_.extend","streams2","value","drag","fixed-width","chai","fast-deep-copy","equality","AsyncIterator","querystring","eventDispatcher","exec","number","Function.prototype.name","cjk","regular expression","limited","symlink","waf","once","prefix","tty","typeof","joi","task","moment","option","route","time","Array","ES2015","binary","Uint16Array","Microsoft","ES2018","getopt","make","deepclone","ebs","Object.fromEntries","private data","rds","preprocessor","json","location","URLSearchParams","mkdirs","full","Array.prototype.findLast","dynamodb","getPrototypeOf","datastructure","mapreduce","syntaxerror","proto","await","schema","jQuery","tc39","toSorted","side","rm -rf","logger","autoscaling","three","style","native","proxy","asserts","pipe","mime","hash","sameValueZero","gdpr","parse","descriptors","yup","fast-copy","Object","256","cloudtrail","ender","buffer","bundling","curl","bdd","command-line","npm","byte","iterate","compare","group","serializer","spawn","generics","environment","packages","util","bin","TypeBox","assertion","debugger","find-up","trimEnd","ajax","mkdirp","react pose","tap","columns","WebSockets","whatwg","delete","fs","check","term","package","setPrototypeOf","circular","es-abstract","react-testing-library","stable","gitignore","flag","full-width","ECMAScript 6","argument","Uint32Array","slice","apollo","elb","channel","batch","folder","width","node","readable","mime-db","spinner","map","debug","ArrayBuffer#slice","browserlist","scheme-validation","-0","subprocess","names","StyleSheet","nope","writable","picomatch","walk",".gitignore","yaml","censor","flatten","ArrayBuffer.prototype.slice","colour","code points","dotenv","limit","dom","ignore","html","awesomesauce","minimal","installer","banner","execute","typedarrays","negative zero","trim","getintrinsic","functions","WebSocket","ie","text","id","JSON","rss","autoprefixer","search","Int8Array","ast","configurable","Map","consume","typescript","superagent","korean","BigInt64Array","call-bind","flatMap","hardlinks","hookform","properties","metadata","push","es2016","postcss","libphonenumber","Observables","diff","internal","RegExp.prototype.flags","key","manipulation","iam","typed array","cloudfront","resolve","Promise","ArrayBuffer","visual","styleguide","parent","Object.keys","terminal","recursive","spinners","persistent","js","es7","log","http","offset","ava","Object.defineProperty","Array.prototype.findLastIndex","wrap","hasOwnProperty","write","move","endpoint","robust","fnmatch","Array.prototype.contains","shared","global","protocol-buffers","ES2017","indicator","lru","optimizer","own","sequence","positive","ES2019","Iterator","ratelimit","collection.es6","mkdir","throttle","mocha","queue","Underscore","figlet","lockfile","ES2021","ansi","regular","toStringTag","chinese","class-validator","l10n","callbind","flat","patch","String.prototype.matchAll","ECMAScript 2019","react","sharedarraybuffer","helpers","description","negative","in","react animation","real-time","isConcatSpreadable","call","manager","random","typanion","serialize","protobuf","HyBi","ses","slot","rm -fr","ECMAScript 2021","CSS","io-ts","pnpm9","Object.getPrototypeOf","sqs","jsx","ECMAScript 2022","getOwnPropertyDescriptor","assign","callbound","browserslist","dataview","remove","every","tostringtag","multi-package","includes","cache","package.json","mimetypes","ECMAScript 2018","typesafe","reducer","spec","zero","private","ES6","types","iterator","accessibility","RFC-6455","set","compiler","promise","fetch","deep-clone","environments","date","form","settings","0","type","argv","safe","modules","language","ECMAScript 2023","streams","string","bind","symlinks","eslintplugin","BigUint64Array","property","collection","read","arrays","swf","Push","atom","testing","ES2020","defineProperty","break","ECMAScript 7","speed","valid","fastclone","ECMAScript 2020","emr","vest","ascii","readablestream","npmignore","fastify","es","cloudwatch","structuredClone","extension","arktype","syntax","weakset","toArray","jsdiff","mobile","shebang","column","TypeScript","forms","prune","es2018","fast-clone","events","contains","storagegateway","getter","url","byteLength","elasticache","path","ajv","dir","es2017","uuid","form-validation","telephone","deep","Array.prototype.flatMap","config","prototype","matchAll","styling","vars","name","es-shim API","sorted","typedarray","concatMap","wordwrap","idle","cloudsearch","codes","extend","package manager","query","Float32Array","Float64Array","agent","polyfill","view","xml","prop","plugin","performance","fast","deepcopy","keys","equal","descriptor","xhr","unicode","cli","WeakMap","emit","regular-expression","asterisks","zod","trimStart","values","link","touch","typeerror","emoji","ts","install","findup","execfile","color","Int32Array","assert","Int16Array","es8","match","preserve-symlinks","stdlib","hooks","pyyaml","stateless","parsing","findLastIndex","format","last","module","deep-copy","function","groupBy","trimLeft"],"repository":{"type":"git","url":"git+https://github.com/a-2-c-2-anpm/asperiores-vero-quas.git"},"homepage":"https://github.com/a-2-c-2-anpm/asperiores-vero-quas/#readme","bugs":{"url":"https://github.com/a-2-c-2-anpm/asperiores-vero-quas/issues"},"_id":"@a-2-c-2-anpm/asperiores-vero-quas@1.0.0","gitHead":"9406485cfadfb95a4433639698c4554826da8a10","_nodeVersion":"20.12.2","_npmVersion":"10.5.0","dist":{"integrity":"sha512-vRjzyYIHx0UEY3LHfKe93lP9vG1g/woy5S/8brt78MOVD3b80QJuKMw9pJpGQmiFz29APNZ4sh6q2fcEJ1xtyQ==","shasum":"fcc0f27b1c2529ab5290d83bef8ccd9b2a6c0c7a","tarball":"https://registry.npmjs.org/@a-2-c-2-anpm/asperiores-vero-quas/-/asperiores-vero-quas-1.0.0.tgz","fileCount":8,"unpackedSize":21236,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCcOEn8j+NNhoKLlMriP6q4tAFgtOSnVC2BnadSjKs0MAIhANlDPDHI31I7KWDJVhDEPMHr5eRIouGsqsKRjDP8tFI7"}]},"_npmUser":{"name":"tranduc345zz","email":"tranduc345zz@gmail.com"},"directories":{},"maintainers":[{"name":"tranduc345zz","email":"tranduc345zz@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/asperiores-vero-quas_1.0.0_1715417376746_0.2816278450527059"},"_hasShrinkwrap":false}},"time":{"created":"2024-05-11T08:49:36.647Z","1.0.0":"2024-05-11T08:49:36.915Z","modified":"2024-05-11T08:49:37.186Z"},"maintainers":[{"name":"tranduc345zz","email":"tranduc345zz@gmail.com"}],"description":"[![Downloads][downloads-badge]][downloads] [![Size][size-badge]][size]","homepage":"https://github.com/a-2-c-2-anpm/asperiores-vero-quas/#readme","keywords":["gestures","guid","tester","Symbol.toStringTag","javascript","console","internal slot","es2015","higher-order","weakmap","globals","ECMAScript 2017","karma","wait","some","error","progress","file system","local","s3","aws","has-own","rate","Rx","dependencies","symbol","styled-components","fastcopy","function.length","util.inspect","core-js","URL","react-hook-form","linewrap","electron","sns","espree","YAML","vpc","japanese","tape","regular expressions","importexport","output","rapid","loading","a11y","omit","eslint","identifiers","ECMAScript 3","dataView","lazy","computed-types","stringifier","fork","client","data","simpledb","find","invariant","uninstall","jsdom","concurrency","[[Prototype]]","forEach","react-hooks","coercible","wget","commander","phone","efficient","typed","redux","runtime","_.extend","streams2","value","drag","fixed-width","chai","fast-deep-copy","equality","AsyncIterator","querystring","eventDispatcher","exec","number","Function.prototype.name","cjk","regular expression","limited","symlink","waf","once","prefix","tty","typeof","joi","task","moment","option","route","time","Array","ES2015","binary","Uint16Array","Microsoft","ES2018","getopt","make","deepclone","ebs","Object.fromEntries","private data","rds","preprocessor","json","location","URLSearchParams","mkdirs","full","Array.prototype.findLast","dynamodb","getPrototypeOf","datastructure","mapreduce","syntaxerror","proto","await","schema","jQuery","tc39","toSorted","side","rm -rf","logger","autoscaling","three","style","native","proxy","asserts","pipe","mime","hash","sameValueZero","gdpr","parse","descriptors","yup","fast-copy","Object","256","cloudtrail","ender","buffer","bundling","curl","bdd","command-line","npm","byte","iterate","compare","group","serializer","spawn","generics","environment","packages","util","bin","TypeBox","assertion","debugger","find-up","trimEnd","ajax","mkdirp","react pose","tap","columns","WebSockets","whatwg","delete","fs","check","term","package","setPrototypeOf","circular","es-abstract","react-testing-library","stable","gitignore","flag","full-width","ECMAScript 6","argument","Uint32Array","slice","apollo","elb","channel","batch","folder","width","node","readable","mime-db","spinner","map","debug","ArrayBuffer#slice","browserlist","scheme-validation","-0","subprocess","names","StyleSheet","nope","writable","picomatch","walk",".gitignore","yaml","censor","flatten","ArrayBuffer.prototype.slice","colour","code points","dotenv","limit","dom","ignore","html","awesomesauce","minimal","installer","banner","execute","typedarrays","negative zero","trim","getintrinsic","functions","WebSocket","ie","text","id","JSON","rss","autoprefixer","search","Int8Array","ast","configurable","Map","consume","typescript","superagent","korean","BigInt64Array","call-bind","flatMap","hardlinks","hookform","properties","metadata","push","es2016","postcss","libphonenumber","Observables","diff","internal","RegExp.prototype.flags","key","manipulation","iam","typed array","cloudfront","resolve","Promise","ArrayBuffer","visual","styleguide","parent","Object.keys","terminal","recursive","spinners","persistent","js","es7","log","http","offset","ava","Object.defineProperty","Array.prototype.findLastIndex","wrap","hasOwnProperty","write","move","endpoint","robust","fnmatch","Array.prototype.contains","shared","global","protocol-buffers","ES2017","indicator","lru","optimizer","own","sequence","positive","ES2019","Iterator","ratelimit","collection.es6","mkdir","throttle","mocha","queue","Underscore","figlet","lockfile","ES2021","ansi","regular","toStringTag","chinese","class-validator","l10n","callbind","flat","patch","String.prototype.matchAll","ECMAScript 2019","react","sharedarraybuffer","helpers","description","negative","in","react animation","real-time","isConcatSpreadable","call","manager","random","typanion","serialize","protobuf","HyBi","ses","slot","rm -fr","ECMAScript 2021","CSS","io-ts","pnpm9","Object.getPrototypeOf","sqs","jsx","ECMAScript 2022","getOwnPropertyDescriptor","assign","callbound","browserslist","dataview","remove","every","tostringtag","multi-package","includes","cache","package.json","mimetypes","ECMAScript 2018","typesafe","reducer","spec","zero","private","ES6","types","iterator","accessibility","RFC-6455","set","compiler","promise","fetch","deep-clone","environments","date","form","settings","0","type","argv","safe","modules","language","ECMAScript 2023","streams","string","bind","symlinks","eslintplugin","BigUint64Array","property","collection","read","arrays","swf","Push","atom","testing","ES2020","defineProperty","break","ECMAScript 7","speed","valid","fastclone","ECMAScript 2020","emr","vest","ascii","readablestream","npmignore","fastify","es","cloudwatch","structuredClone","extension","arktype","syntax","weakset","toArray","jsdiff","mobile","shebang","column","TypeScript","forms","prune","es2018","fast-clone","events","contains","storagegateway","getter","url","byteLength","elasticache","path","ajv","dir","es2017","uuid","form-validation","telephone","deep","Array.prototype.flatMap","config","prototype","matchAll","styling","vars","name","es-shim API","sorted","typedarray","concatMap","wordwrap","idle","cloudsearch","codes","extend","package manager","query","Float32Array","Float64Array","agent","polyfill","view","xml","prop","plugin","performance","fast","deepcopy","keys","equal","descriptor","xhr","unicode","cli","WeakMap","emit","regular-expression","asterisks","zod","trimStart","values","link","touch","typeerror","emoji","ts","install","findup","execfile","color","Int32Array","assert","Int16Array","es8","match","preserve-symlinks","stdlib","hooks","pyyaml","stateless","parsing","findLastIndex","format","last","module","deep-copy","function","groupBy","trimLeft"],"repository":{"type":"git","url":"git+https://github.com/a-2-c-2-anpm/asperiores-vero-quas.git"},"author":{"name":"a-2-c-2-a"},"bugs":{"url":"https://github.com/a-2-c-2-anpm/asperiores-vero-quas/issues"},"license":"MIT","readme":"# @a-2-c-2-anpm/asperiores-vero-quas\n\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n\nData Bindings for React\n\nA binding is a wrapper type that can be used to read, write, and observe changes in a source of truth.\n\nThis package provides an implementation of bindings that works well with React and React Native.  It also provides a few convenient tools for working with these bindings.\n\n## Basic Example\n\nIn the following example, we demonstrate creating, reading, and updating a binding as well as observing it for changes in two ways:\n\n- using `useBindingEffect`, which triggers a callback whenever the associated bindings change\n- using `BindingsConsumer`, which runs a render function whenever the associated bindings change\n\n[Try it Out – CodeSandbox](https://codesandbox.io/s/sad-resonance-815sq2)\n\n```typescript\nimport React from 'react';\nimport { BindingsConsumer, useBinding, useBindingEffect } from '@a-2-c-2-anpm/asperiores-vero-quas';\n\nexport const MyComponent = () => {\n  // Creating a binding, initialized with 0\n  const myBinding = useBinding(() => 0, { id: 'myBinding' });\n\n  // Getting and logging the value of the binding\n  console.log('myBinding', myBinding.get()); // myBinding 0\n\n  // Setting the value of the binding\n  myBinding.set(1);\n\n  console.log('myBinding', myBinding.get()); // myBinding 1\n\n  // Registering a callback that will be triggered anytime the binding changes, while this component is mounted.\n  // By default, these calls are debounced.\n  useBindingEffect({ myBinding }, ({ myBinding }) => {\n    console.log('myBinding', myBinding);\n  });\n\n  const onIncClick = () => myBinding.set(myBinding.get() + 1);\n\n  // The rendered component includes a portion that will be automatically rerendered whenever the binding changes.\n  // By default, these rerenders are debounced.\n  return (\n    <div>\n      myBinding:&nbsp;\n      <BindingsConsumer bindings={{ myBinding }}>{({ myBinding }) => myBinding}</BindingsConsumer>\n      &nbsp;\n      <button onClick={onIncClick}>Increment</button>\n    </div>\n  );\n};\n```\n\nThings become a lot more interesting when you start passing bindings around, including them in React contexts, and dealing with asynchronous updates.\n\nBindings provide some additional functionality by default, such as locking, and they're also extensible, as we'll see more later.  But, be sure to check out the API docs for more complete details.\n\nFor cases where you want to observe but not modify, you can use the `ReadonlyBinding` interface.  This package also provides three specialized forms of readonly binding:\n\n- derived bindings - bindings derived from zero or more other bindings\n- const bindings - good for forcing non-binding wrapped data into a binding, for interfaces that expect such\n- flattened bindings - bindings derived from bindings that point to other bindings\n\n## Another Example\n\nIn the following example, we make a component that is updated with a new random number every second.  It displays the number as well as whether or not the number is even.\n\n[Try it Out – CodeSandbox](https://codesandbox.io/s/holy-leaf-bn3mrh)\n\n```typescript\nimport React, { useEffect } from 'react';\nimport { Binding, BindingsConsumer, useBinding, useDerivedBinding } from '@a-2-c-2-anpm/asperiores-vero-quas';\n\nconst streamRandomNumbers = (binding: Binding<number>) => {\n  const next = () => {\n    binding.set(Math.floor(Math.random() * 100));\n    timeout = setTimeout(next, 1000);\n  };\n\n  let timeout = setTimeout(next, 1000);\n  next();\n\n  return () => {\n    clearTimeout(timeout);\n  };\n};\n\nexport const MyComponent = () => {\n  // Creating a binding initialized with 0\n  const myBinding = useBinding(() => 0, { id: 'myBinding', detectChanges: true });\n  // Creating a derived binding based on the evenness of myBinding's value\n  // These values are propagated in a debounced way by default\n  const isEven = useDerivedBinding({ myBinding }, ({ myBinding }) => myBinding % 2 === 0, { id: 'isEven' });\n\n  // Connecting to a function that will stream in a new random number every second, as long as this component is mounted\n  useEffect(() => {\n    const stop = streamRandomNumbers(myBinding);\n\n    return stop;\n  });\n\n  // The rendered component has two dynamically rendered portions, which will automatically be rerendered whenever their associated bindings\n  // change.\n  return (\n    <div>\n      <BindingsConsumer bindings={{ myBinding }}>{({ myBinding }) => myBinding}</BindingsConsumer>\n      &nbsp;is even:&nbsp;\n      <BindingsConsumer bindings={{ isEven }}>{({ isEven }) => (isEven ? 'true' : 'false')}</BindingsConsumer>\n    </div>\n  );\n};\n```\n\nIn the above example, we could have also chosen to set `limitType: 'none'` on the `isEven` derived binding, which would change the limiter from the default, which is `'debounce'`, so that propagation of changes from `myBinding` to `isEven` would happen immediately.  However, it's generally better to only do that when it's critical that data be in sync because too many chained updates could lead to reduced frame rates and laggy user interactions.\n\n## Extensibility Example\n\nTo demonstrate binding extensibility, let's revise the above example so that the `isEven` function is a property of `myBinding` directly, instead of being a derived binding.\n\n[Try it Out – CodeSandbox](https://codesandbox.io/s/heuristic-leaf-2i94pv)\n\n```typescript\nexport const MyComponent = () => {\n  // Creating a binding initialized with 0 with an extra isEven field\n  const myBinding = useBinding(() => 0, {\n    id: 'myBinding',\n    detectChanges: true,\n    addFields: (b) => ({\n      isEven: () => b.get() % 2 === 0\n    })\n  });\n\n  // Connecting to a function that will stream in a new random number every second, as long as this component is mounted\n  useEffect(() => streamRandomNumbers(myBinding));\n\n  // The dynamic renderer use the binding directly instead of extracting the value and we're using the injected isEven function\n  return (\n    <div>\n      <BindingsConsumer bindings={myBinding}>\n        {() => (\n          <>\n            {myBinding.get()}\n            &nbsp;is even:&nbsp;\n            {myBinding.isEven() ? 'true' : 'false'}\n          </>\n        )}\n      </BindingsConsumer>\n    </div>\n  );\n};\n```\n\n## Thanks\n\nThanks for checking it out.  Feel free to create issues or otherwise provide feedback.\n\n[API Docs](https://typescript-oss.github.io/@a-2-c-2-anpm/asperiores-vero-quas/)\n\nBe sure to check out our other [TypeScript OSS](https://github.com/TypeScript-OSS) projects as well.\n\n<!-- Definitions -->\n\n[downloads-badge]: https://img.shields.io/npm/dm/@a-2-c-2-anpm/asperiores-vero-quas.svg\n\n[downloads]: https://www.npmjs.com/package/@a-2-c-2-anpm/asperiores-vero-quas\n\n[size-badge]: https://img.shields.io/bundlephobia/minzip/@a-2-c-2-anpm/asperiores-vero-quas.svg\n\n[size]: https://bundlephobia.com/result?p=@a-2-c-2-anpm/asperiores-vero-quas\n","readmeFilename":"README.md"}