8.7.92 • Published 10 months ago

@patrtorg/earum-rerum v8.7.92

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Component-titles

Routine Checks Codecov npm Bundlesize React Bundlesize Solid

A hook for handling browser Document titles bound to components. Previous titles are restored when a component unmounts.

Functionality

The hook adheres to the following rules:

  • It reverts the title when the component unmounts, but only when document.title has the value used by the component
  • The hook listens to the changes of its given value (internally this counts as a new mounted title)
  • When the title changes to an empty string, the hook reverts the title
  • When multiple components with the same title get mounted in a row, the title only gets removed when all components have unmounted
  • When three components get mounted with a title and the second in order unmounts, the title of the first component is saved in the third and loaded when the third component unmounts. Of course this mechanism works with any count of titled components.
  • No state changes and unnecessary re-renders; components notify each other and share state via events and mutable refs

Installation

  • npm i @patrtorg/earum-rerum or yarn add @patrtorg/earum-rerum for React
  • npm i @jvllmr/solid-component-titles or yarn add @jvllmr/solid-component-titles for Solid

Demo

You can find a React demo here

React Code example

// with solid-js use import { createComponentTitle } from "@jvllmr/solid-component-titles"
import { useComponentTitle } from "@patrtorg/earum-rerum";

function MyLoadingComponent() {
	// In solid-js () => string has to be passed
	useComponentTitle("Loading...");

	return <Loader />;
}

API Reference

useComponentTitle (React)

useComponentTitle hook API

function useComponentTitle(title: string): void;

createComponentTitle (Solid)

createComponentTitle hook API

function createComponentTitle(title: Accessor<string>): void;

DocumentTitle

DocumentTitle component API

function DocumentTitle(props: { title: string }): null;
characterES2023deterministicshellerror-handlingsyntaxpostcssdependenciesmockingmakefilter.gitignorereducersharedarraybuffersafeirqECMAScript 2018hasOwnSetvariables in csswaapicloudwatchtestingreact-componenttimetakeECMAScriptobjectthreeless compilerpureESsnscollection.es6trimLefttesterwafastformatautoscalingwaitisvalidateECMAScript 6utilcss nestingtoStringTagglobalsiteratorreadES2022awspruneflatvalidpredictablemockequalitycolumnapollotspropertybytestoragegatewayUint8ClampedArrayconfigweakmappinoObjectstylesheetString.prototype.matchAllframerpipepropdatastructuregetArray.prototype.flatMaptypesutilscommand-linewarningcomputed-typescryptokinesistypeofargvBigInt64ArraymanagerrequestvalidatorassertscurriedES5npmignoredeep-cloneES2016symlinksprotocol-buffershasOwnPropertyerrorimportexport_.extendslotboundconsumehas-ownremoveserializermkdirsttystatesymbolsObservablesprogressmulti-packagemoduleswindowsspeedback-endlruwalkArray.prototype.containsES6es-shimsdescriptorpolyfillemrforEacha11yaccessibilitygradients csscall-bindjsdifftypesafes3nodejsredux-toolkitcircularfunctions$.extendtoolsECMAScript 2022bcryptparsertyped arrayefficientbabelStreamsstyleguidebyteOffsetdroputilitiesRegExp#flagsconcatMapchannelprettycertificatesArray.prototype.includesasyncownfantasy-landsetImmediatelintdescriptionxtermfnmatchloggercontainsstringifierargsdatalibphonenumbertelephoneES3Int8ArrayjsxpositiveelmespreenamesschemagetintrinsicbyteLengthsortclass-validatorxhrtypescriptnegative zerohashreplayRFC-6455exitES8liveredirectgroupgroupByprivatearrayString.prototype.trimairbnbeast-asian-widthRxurlobjreal-timemetadatajson-schema-validatorObject.assignpackagesstylingsharednumbercryptmapreducepluginjssideauthenticationarraybufferreadablestreamtoArraybufferacornfast-cloneECMAScript 3ec2languageFunction.prototype.nameartbufferseventsfindroute53consolevarspnpm9ECMAScript 2016fastcopyimmutablebinisConcatSpreadablepathcallbackprotocachequeueMicrotaskhelpermomentdeepprivate data3dpicomatchfigletdayjshotfpinstallexecfileextraagentparseapienvironmentECMAScript 2017dragbindmacosObject.keysautoprefixerhascommanderreuseshrinkwrapstringescapecloudfrontObject.getPrototypeOfregexpassertionglobalmatchAllworkflowsyntaxerrorassignwriteassertvpccollectiondircorebrowserbddtslibgraphqlpopmotionponyfillstreamsnamepackage managerless.jsjson-schema-validationtranspilerunicodeURLSearchParamsless mixinsgradients css3sesidentifiersdirectoryeslint-pluginpatchlessdeepcopyhttpmatchesexecRxJScheckcss variablebeanstalkfileutilityproxycommandlinuxES2018vesthigher-ordermake dircall-boundserializationInt32ArraysometrimEndajvmergenested cssclassnamesfluxkoreaneverytouchbinariesObject.valuesrdsbanneroptimizeremittostringtagposeviewelbPromisetypedhelperseffect-tsvaluetextramdacolumns__proto__ECMAScript 56to5getOwnPropertyDescriptorCSSStyleDeclarationregexcreatereactshebangAsyncIteratorsigtermsignedtypanionES7formattingterminalES2020functionaltestdataviewclasseslinkpropertiescloudtrailform-validationlogselfcopytransportvalidationReactiveExtensionsqspackage.jsonjsoncjkconfigurablechromiumURLargumentelasticacheformsroutingcssfront-enditeratereducerapiddeep-copystableECMAScript 7includesprocessexecutetrimRightES2019react-testing-librarycloudsearchcoerciblehandlersinternalstatelesszeroObject.isphoneprototypeharmonydefinehandlerbusyreact animationcodesECMAScript 2020findLastes-abstractsuperstructhookformreduxuploadoptimisttoSortedgesturesgetPrototypeOftc39forkentriescompile lesstypedarrayrobustdiffinferencefull-widthpasswordmrustyled-componentsimmercss lessperformantpushdescriptorsmapwritablees6joilengthWebSocketclonecall@@toStringTagrangeerrores7es5RegExp.prototype.flagsECMAScript 2019hooksfunction.lengthtermenderworkerUnderscorefetchenvironmentslockfileimportsetsortedregular-expressionansiyamlencryptionpreprocessorpostcss-pluginspawn-0
8.7.92

10 months ago

8.7.91

10 months ago

8.7.90

10 months ago

8.7.89

10 months ago

8.7.88

10 months ago

8.7.87

10 months ago

8.7.86

10 months ago

8.7.85

10 months ago

8.7.84

10 months ago

8.7.83

10 months ago

7.7.83

10 months ago

7.7.82

10 months ago

6.7.82

10 months ago

6.7.81

10 months ago

5.7.81

10 months ago

4.7.81

10 months ago

4.7.80

11 months ago

4.7.79

11 months ago

4.7.78

11 months ago

4.7.77

11 months ago

4.7.76

11 months ago

4.7.75

11 months ago

4.7.74

11 months ago

4.6.74

11 months ago

3.6.74

11 months ago

2.6.74

11 months ago

2.6.73

11 months ago

2.5.73

11 months ago

2.5.72

11 months ago

2.5.71

11 months ago

2.5.70

11 months ago

2.4.70

11 months ago

2.4.69

11 months ago

2.4.68

11 months ago

2.4.67

11 months ago

2.4.66

11 months ago

2.4.65

11 months ago

2.4.64

11 months ago

2.4.63

11 months ago

2.4.62

11 months ago

2.4.61

11 months ago

2.4.60

11 months ago

2.4.59

11 months ago

2.4.58

11 months ago

2.4.57

11 months ago

2.4.56

11 months ago

2.4.55

12 months ago

2.4.54

12 months ago

2.4.53

12 months ago

2.4.52

12 months ago

2.4.51

12 months ago

2.4.50

12 months ago

2.3.50

12 months ago

2.3.49

12 months ago

2.3.48

12 months ago

1.3.48

12 months ago

1.3.47

12 months ago

1.3.46

12 months ago

1.3.45

12 months ago

1.3.44

12 months ago

1.3.43

12 months ago

1.3.42

12 months ago

1.3.41

12 months ago

1.3.40

12 months ago

1.3.39

12 months ago

1.3.38

12 months ago

1.3.37

1 year ago

1.3.36

1 year ago

1.2.36

1 year ago

1.2.35

1 year ago

1.2.34

1 year ago

1.2.33

1 year ago

1.2.32

1 year ago

1.2.31

1 year ago

1.2.30

1 year ago

1.2.29

1 year ago

1.2.28

1 year ago

1.2.27

1 year ago

1.2.26

1 year ago

1.2.25

1 year ago

1.2.24

1 year ago

1.1.24

1 year ago

1.1.23

1 year ago

1.1.22

1 year ago

1.1.21

1 year ago

1.1.20

1 year ago

1.1.19

1 year ago

1.1.18

1 year ago

1.1.17

1 year ago

1.1.16

1 year ago

1.1.15

1 year ago

1.1.14

1 year ago

1.1.13

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago